Skip to content

Commit

Permalink
支持摘要可选
Browse files Browse the repository at this point in the history
  • Loading branch information
vnt-dev committed Sep 2, 2023
1 parent fb60653 commit 0d78b5d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/cipher/aes_gcm_cipher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl Aes256GcmCipher {
nonce_raw[11] = net_packet.source_ttl();
let nonce: &GenericArray<u8, U12> = Nonce::from_slice(&nonce_raw);

let mut secret_body = SecretBody::new(net_packet.payload_mut())?;
let mut secret_body = SecretBody::new(net_packet.payload_mut(), true)?;
let tag = secret_body.tag();
let finger = self
.finger
Expand Down Expand Up @@ -86,7 +86,7 @@ impl Aes256GcmCipher {
nonce_raw[11] = net_packet.source_ttl();
let nonce: &GenericArray<u8, U12> = Nonce::from_slice(&nonce_raw);
net_packet.set_data_len(net_packet.data_len() + ENCRYPTION_RESERVED)?;
let mut secret_body = SecretBody::new(net_packet.payload_mut())?;
let mut secret_body = SecretBody::new(net_packet.payload_mut(), true)?;
secret_body.set_random(rand::thread_rng().next_u32());
return match self
.cipher
Expand Down
4 changes: 2 additions & 2 deletions src/cipher/ring_aes_gcm_cipher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl Aes256GcmCipher {
nonce_raw[10] = net_packet.is_gateway() as u8;
nonce_raw[11] = net_packet.source_ttl();
let nonce = aead::Nonce::assume_unique_for_key(nonce_raw);
let mut secret_body = SecretBody::new(net_packet.payload_mut())?;
let mut secret_body = SecretBody::new(net_packet.payload_mut(), true)?;
let tag = secret_body.tag();
let finger = self
.finger
Expand Down Expand Up @@ -107,7 +107,7 @@ impl Aes256GcmCipher {
let nonce = aead::Nonce::assume_unique_for_key(nonce_raw);
let data_len = net_packet.data_len() + ENCRYPTION_RESERVED;
net_packet.set_data_len(data_len)?;
let mut secret_body = SecretBody::new(net_packet.payload_mut())?;
let mut secret_body = SecretBody::new(net_packet.payload_mut(), true)?;
secret_body.set_random(rand::thread_rng().next_u32());

let rs = match &self.cipher {
Expand Down

0 comments on commit 0d78b5d

Please sign in to comment.