Skip to content

Commit 8ff72f3

Browse files
committed
Apply feedback
1 parent 6fb4e97 commit 8ff72f3

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

.vscode/settings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"encryptable",
1616
"Hkdf",
1717
"Hmac",
18-
"keyslot",
1918
"Maybeable",
2019
"Oaep",
2120
"Pbkdf",

crates/bitwarden-crypto/src/safe/password_protected_key_envelope.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl<Ids: KeyIds> PasswordProtectedKeyEnvelope<Ids> {
7777
Self::seal_ref_with_settings(
7878
key_to_seal,
7979
password,
80-
&Argon2RawSettings::default_for_platform(),
80+
&Argon2RawSettings::local_kdf_settings(),
8181
)
8282
}
8383

@@ -262,9 +262,9 @@ struct Argon2RawSettings {
262262
}
263263

264264
impl Argon2RawSettings {
265-
/// Creates default Argon2 settings based on the platform. This currently is a static preset
265+
/// Creates default Argon2 settings based on the device. This currently is a static preset
266266
/// based on the target os
267-
fn default_for_platform() -> Self {
267+
fn local_kdf_settings() -> Self {
268268
// iOS has memory limitations in the auto-fill context. So, the memory is halved
269269
// but the iterations are doubled
270270
if cfg!(target_os = "ios") {
@@ -310,8 +310,13 @@ impl TryInto<Params> for &Argon2RawSettings {
310310
type Error = PasswordProtectedKeyEnvelopeError;
311311

312312
fn try_into(self) -> Result<Params, PasswordProtectedKeyEnvelopeError> {
313-
Params::new(self.memory, self.iterations, self.parallelism, Some(32))
314-
.map_err(|_| PasswordProtectedKeyEnvelopeError::KdfError)
313+
Params::new(
314+
self.memory,
315+
self.iterations,
316+
self.parallelism,
317+
Some(ENVELOPE_ARGON2_OUTPUT_KEY_SIZE),
318+
)
319+
.map_err(|_| PasswordProtectedKeyEnvelopeError::KdfError)
315320
}
316321
}
317322

0 commit comments

Comments
 (0)