Skip to content

Commit

Permalink
aes_gcm: Use encrypt_iv_xor_block for tag.
Browse files Browse the repository at this point in the history
  • Loading branch information
briansmith committed Jun 11, 2024
1 parent 60e9b43 commit da61deb
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/aead/aes_gcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use super::{
gcm, shift, Aad, Nonce, Tag,
};
use crate::{
constant_time, cpu, error,
cpu, error,
polyfill::{slice, sliceutil::overwrite_at_start, usize_from_u64_saturated},
};
use core::ops::RangeFrom;
Expand Down Expand Up @@ -297,8 +297,7 @@ pub(super) fn open(
fn finish(aes_key: &aes::Key, gcm_ctx: gcm::Context, tag_iv: aes::Iv) -> Tag {
// Finalize the tag and return it.
gcm_ctx.pre_finish(|pre_tag, cpu_features| {
let encrypted_iv = aes_key.encrypt_block(tag_iv.into_block_less_safe(), cpu_features);
Tag(constant_time::xor_16(pre_tag, encrypted_iv))
Tag(aes_key.encrypt_iv_xor_block(tag_iv, pre_tag, cpu_features))
})
}

Expand Down

0 comments on commit da61deb

Please sign in to comment.