Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore!: Update aes-gcm to 0.10.3 and aes to 0.8.4 #261

Merged
merged 7 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ socket2 = "0.4"
smallvec = "1"
parking_lot = "0.11"
lazy_static = "1"
aes = { version = "0.7", features = ["ctr"] }
aes-gcm = "0.9"
aes = "0.8.4"
ctr = "0.9.2"
aes-gcm = "0.10.3"
tracing = { version = "0.1", features = ["log"] }
lru = "0.12"
hashlink = "0.8"
Expand Down
2 changes: 1 addition & 1 deletion src/handler/crypto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::{
packet::{ChallengeData, MessageNonce},
};
use aes_gcm::{
aead::{generic_array::GenericArray, Aead, NewAead, Payload},
aead::{generic_array::GenericArray, Aead, KeyInit, Payload},
Aes128Gcm,
};
use ecdh::ecdh;
Expand Down
12 changes: 6 additions & 6 deletions src/packet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
//! [`Packet`]: enum.Packet.html

use crate::{error::PacketError, Enr};
use aes::{
cipher::{generic_array::GenericArray, NewCipher, StreamCipher},
Aes128Ctr,
};
use aes::cipher::{generic_array::GenericArray, KeyIvInit, StreamCipher};

type Aes128Ctr64BE = ctr::Ctr64BE<aes::Aes128>;

use alloy_rlp::Decodable;
use enr::NodeId;
use rand::Rng;
Expand Down Expand Up @@ -411,7 +411,7 @@ impl Packet {
let mut key = GenericArray::clone_from_slice(&dst_id.raw()[..16]);
let mut nonce = GenericArray::clone_from_slice(&self.iv.to_be_bytes());

let mut cipher = Aes128Ctr::new(&key, &nonce);
let mut cipher = Aes128Ctr64BE::new(&key, &nonce);
cipher.apply_keystream(&mut header_bytes);
key.zeroize();
nonce.zeroize();
Expand Down Expand Up @@ -442,7 +442,7 @@ impl Packet {
*/
let key = GenericArray::clone_from_slice(&src_id.raw()[..16]);
let nonce = GenericArray::clone_from_slice(&iv);
let mut cipher = Aes128Ctr::new(&key, &nonce);
let mut cipher = Aes128Ctr64BE::new(&key, &nonce);

// Take the static header content
let mut static_header = data[IV_LENGTH..IV_LENGTH + STATIC_HEADER_LENGTH].to_vec();
Expand Down
Loading