Skip to content

Commit

Permalink
Fix clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
rlee287 committed Oct 24, 2023
1 parent bcff7a8 commit cf801c3
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions aead/src/committing_aead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ mod padded_aead {
);
// Check padding now
for byte in ptxt_vec.drain(..padding_overhead) {
decryption_is_ok = decryption_is_ok & byte.ct_eq(&0);
decryption_is_ok &= byte.ct_eq(&0);
}
if decryption_is_ok.into() {
Ok(ptxt_vec)
Expand Down Expand Up @@ -272,7 +272,7 @@ mod padded_aead {
);
// Check padding now
for byte in ptxt_vec.drain(..padding_overhead) {
decryption_is_ok = decryption_is_ok & byte.ct_eq(&0);
decryption_is_ok &= byte.ct_eq(&0);
}
if decryption_is_ok.into() {
Ok(ptxt_vec)
Expand Down Expand Up @@ -462,7 +462,8 @@ mod ctx {
fn new(key: &crypto_common::Key<Self>) -> Self {
CtxishHmacAead {
inner_aead: Aead::new(key),
hasher: <SimpleHmac<_> as KeyInit>::new_from_slice(key).unwrap(),
hasher: <SimpleHmac<_> as KeyInit>::new_from_slice(key)
.expect("HMAC accepts all key lengths so this always works"),
}
}
}
Expand Down Expand Up @@ -508,7 +509,8 @@ mod ctx {

let final_tag_iter = tag_inner.iter().copied().chain(hmac_tag);

let final_tag = crate::Tag::<Self>::from_exact_iter(final_tag_iter).unwrap();
let final_tag = crate::Tag::<Self>::from_exact_iter(final_tag_iter)
.expect("Lengths shoud always match");
Ok(final_tag)
}

Expand Down Expand Up @@ -546,7 +548,7 @@ mod ctx {
// If it doesn't then we'll likely get a mismatch here too
// Regardless, we require both `Choice`s to be OK
// So it doesn't matter if we ingest a potentially tainted tag here
tag_computer.update(&tag_inner);
tag_computer.update(tag_inner);

// Get the HMAC tag
let expected_hmac_tag = &tag[Aead::TagSize::to_usize()..];
Expand Down

0 comments on commit cf801c3

Please sign in to comment.