Skip to content

Commit

Permalink
Fix typo, and fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
randombit committed Jun 14, 2024
1 parent 67ebe39 commit f410914
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkcs5/src/pbes2/encryption.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,14 @@ where
TagSize: aes_gcm::TagSize,
NonceSize: aes::cipher::ArraySize,
{
let msg_len = buffer.len().checked_sub(TagSize::USIZE).ok_or{Error::DecryptFailed)?;
let msg_len = buffer
.len()
.checked_sub(TagSize::USIZE)
.ok_or(Error::DecryptFailed)?;

let gcm = <aes_gcm::AesGcm<C, NonceSize, TagSize> as GcmKeyInit>::new_from_slice(key.as_slice())
.map_err(|_| es.to_alg_params_invalid())?;
let gcm =
<aes_gcm::AesGcm<C, NonceSize, TagSize> as GcmKeyInit>::new_from_slice(key.as_slice())
.map_err(|_| es.to_alg_params_invalid())?;

let tag = Tag::try_from(&buffer[msg_len..]).map_err(|_| Error::DecryptFailed)?;

Expand Down

0 comments on commit f410914

Please sign in to comment.