File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
crates/bitwarden-crypto/src/safe Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -286,9 +286,19 @@ impl TryInto<Argon2RawSettings> for Header {
286
286
) ) ?;
287
287
288
288
Ok ( Argon2RawSettings {
289
- iterations : i128:: from ( * iterations) . try_into ( ) . unwrap ( ) ,
290
- memory : i128:: from ( * memory) . try_into ( ) . unwrap ( ) ,
291
- parallelism : i128:: from ( * parallelism) . try_into ( ) . unwrap ( ) ,
289
+ iterations : i128:: from ( * iterations) . try_into ( ) . map_err ( |_| {
290
+ PasswordProtectedKeyEnvelopeError :: ParsingError (
291
+ "Invalid Argon2 iterations" . to_string ( ) ,
292
+ )
293
+ } ) ?,
294
+ memory : i128:: from ( * memory) . try_into ( ) . map_err ( |_| {
295
+ PasswordProtectedKeyEnvelopeError :: ParsingError ( "Invalid Argon2 memory" . to_string ( ) )
296
+ } ) ?,
297
+ parallelism : i128:: from ( * parallelism) . try_into ( ) . map_err ( |_| {
298
+ PasswordProtectedKeyEnvelopeError :: ParsingError (
299
+ "Invalid Argon2 parallelism" . to_string ( ) ,
300
+ )
301
+ } ) ?,
292
302
salt,
293
303
} )
294
304
}
You can’t perform that action at this time.
0 commit comments