[PR #2293] [MERGED] [PS-2249] Implement Argon2 #9633

Closed
opened 2026-04-11 02:25:37 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/2293
Author: @quexten
Created: 1/13/2023
Status: Merged
Merged: 1/20/2023
Merged by: @kspearrin

Base: argon2iosHead: feature/argon2-kdf


📝 Commits (6)

  • 511e91c Implement Argon2
  • d0531ed Fix incorrect argon2 type on iOS
  • 65c1416 Switch argon2 implementation to native bindings
  • ae36e91 Change argon2 to save iterations instead of memory as 'kdfIterations'
  • 8191424 Remove mistakenly added import
  • 60ac234 Remove unused library

📊 Changes

12 files changed (+54 additions, -1 deletions)

View changed files

📝 .gitignore (+1 -0)
📝 src/Android/Android.csproj (+4 -0)
📝 src/Android/Services/CryptoPrimitiveService.cs (+12 -0)
src/Android/lib/arm64-v8a/libargon2.so (+0 -0)
src/Android/lib/armeabi-v7a/libargon2.so (+0 -0)
src/Android/lib/x86/libargon2.so (+0 -0)
src/Android/lib/x86_64/libargon2.so (+0 -0)
📝 src/Core/Abstractions/ICryptoFunctionService.cs (+4 -0)
📝 src/Core/Abstractions/ICryptoPrimitiveService.cs (+1 -0)
📝 src/Core/Enums/KdfType.cs (+2 -1)
📝 src/Core/Services/CryptoService.cs (+8 -0)
📝 src/Core/Services/PclCryptoFunctionService.cs (+22 -0)

📄 Description

Type of change

  • Bug fix
  • New feature development
  • Tech debt (refactoring, code cleanup, dependency upgrades, etc)
  • Build/deploy pipeline (DevOps)
  • Other

Objective

This PR implements basic argon2id support. For now, only memory is configurable (and stored in the user's kdfIterations). There is also a Community discussion thread. I tested it only on Android, as I do not have a working iOS setup, but as it is the same iteration, it should work.

Code changes

  • Android.csproj, iOS.csproj: Add the Argon2 library. For the library I went by the one with the most stars on GitHub for C#.
  • KdfType.cs: We add argon2id as the KdfType with id 2 (since I already used id 1 in the scrypt pull request).
  • CryptoPrimitiveService.cs (iOS, Android), ICryptoPrimitiveService.cs: Implement argon2 calls
  • ICryptoFunctionService.cs, PclCryptoFunctionService.cs: Implement argon2 calls
  • CryptoService.cs: Add the case for argon2id. For now, memory is set to the user's kdfIterations. Parallelism and iterations are constants, though this is also the place to load them from a future "kdfOptions" object (possibly added in a later pull request?).

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/bitwarden/android/pull/2293 **Author:** [@quexten](https://github.com/quexten) **Created:** 1/13/2023 **Status:** ✅ Merged **Merged:** 1/20/2023 **Merged by:** [@kspearrin](https://github.com/kspearrin) **Base:** `argon2ios` ← **Head:** `feature/argon2-kdf` --- ### 📝 Commits (6) - [`511e91c`](https://github.com/bitwarden/android/commit/511e91ce9e944ff9588f9d356c305c3348279542) Implement Argon2 - [`d0531ed`](https://github.com/bitwarden/android/commit/d0531ed13767bbd8bef9598490cf803ab167f14d) Fix incorrect argon2 type on iOS - [`65c1416`](https://github.com/bitwarden/android/commit/65c14167dc514a7070c3c1d7c64303533d9d45fa) Switch argon2 implementation to native bindings - [`ae36e91`](https://github.com/bitwarden/android/commit/ae36e91ab99e96172f4e6308b6e85b0b19214382) Change argon2 to save iterations instead of memory as 'kdfIterations' - [`8191424`](https://github.com/bitwarden/android/commit/81914248ae1ffd3b60d8629ea69f1eaaae9fadc6) Remove mistakenly added import - [`60ac234`](https://github.com/bitwarden/android/commit/60ac23454dd61f0f0c3ea6bf87ae5d390756dd4d) Remove unused library ### 📊 Changes **12 files changed** (+54 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `.gitignore` (+1 -0) 📝 `src/Android/Android.csproj` (+4 -0) 📝 `src/Android/Services/CryptoPrimitiveService.cs` (+12 -0) ➕ `src/Android/lib/arm64-v8a/libargon2.so` (+0 -0) ➕ `src/Android/lib/armeabi-v7a/libargon2.so` (+0 -0) ➕ `src/Android/lib/x86/libargon2.so` (+0 -0) ➕ `src/Android/lib/x86_64/libargon2.so` (+0 -0) 📝 `src/Core/Abstractions/ICryptoFunctionService.cs` (+4 -0) 📝 `src/Core/Abstractions/ICryptoPrimitiveService.cs` (+1 -0) 📝 `src/Core/Enums/KdfType.cs` (+2 -1) 📝 `src/Core/Services/CryptoService.cs` (+8 -0) 📝 `src/Core/Services/PclCryptoFunctionService.cs` (+22 -0) </details> ### 📄 Description ## Type of change - [ ] Bug fix - [x] New feature development - [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [ ] Build/deploy pipeline (DevOps) - [ ] Other ## Objective This PR implements basic argon2id support. For now, only memory is configurable (and stored in the user's kdfIterations). There is also a[ Community discussion thread](https://community.bitwarden.com/t/argon2-kdf-support/48825). I tested it only on Android, as I do not have a working iOS setup, but as it is the same iteration, it *should* work. ## Code changes - Android.csproj, iOS.csproj: Add the Argon2 library. For the library I went by the one with the most stars on GitHub for C#. - KdfType.cs: We add argon2id as the KdfType with id 2 (since I already used id 1 in the scrypt pull request). - CryptoPrimitiveService.cs (iOS, Android), ICryptoPrimitiveService.cs: Implement argon2 calls - ICryptoFunctionService.cs, PclCryptoFunctionService.cs: Implement argon2 calls - CryptoService.cs: Add the case for argon2id. For now, memory is set to the user's kdfIterations. Parallelism and iterations are constants, though this is also the place to load them from a future "kdfOptions" object (possibly added in a later pull request?). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-11 02:25:37 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#9633