Skip to content

Commit

Permalink
Supply type hints to please rustc
Browse files Browse the repository at this point in the history
  • Loading branch information
HenkKalkwater committed Feb 26, 2021
1 parent 6c0223d commit 1bae3ed
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/rfc3711.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,14 +470,16 @@ where
ssrc: u32,
index: P::PacketIndex,
) {
let iv = BigUint::from_bytes_be(&context.session_salt_key) << 16;
let iv = iv ^ (BigUint::from(ssrc) << 64);
let iv = iv ^ (index.into() << 16);
let iv = iv ^ (BigUint::from(1_u8) << (context.session_encr_key.len() * 8));
let iv = &iv.to_bytes_be()[1..context.session_encr_key.len() + 1];
let iv: BigUint = BigUint::from_bytes_be(&context.session_salt_key) << 16;
let iv: BigUint = iv ^ (BigUint::from(ssrc) << 64);
let index_biguint: BigUint = index.into();
let iv: BigUint = iv ^ (index_biguint << 16);
let iv: BigUint = iv ^ (BigUint::from(1_u8) << (context.session_encr_key.len() * 8));
let iv: &[u8] = &iv.to_bytes_be()[1..context.session_encr_key.len() + 1];

let mut ctr =
aes_ctr::Aes128Ctr::new_var(&context.session_encr_key, iv).expect("Correct Key Length");
aes_ctr::Aes128Ctr::new_var(&context.session_encr_key, iv)
.expect("Correct Key Length");

let block_size = context.session_encr_key.len();

Expand All @@ -504,11 +506,12 @@ where
ssrc: u32,
index: P::PacketIndex,
) {
let iv = BigUint::from_bytes_be(&context.session_salt_key) << 16;
let iv = iv ^ (BigUint::from(ssrc) << 64);
let iv = iv ^ (index.into() << 16);
let iv = iv ^ (BigUint::from(1_u8) << (context.session_encr_key.len() * 8));
let iv = &iv.to_bytes_be()[1..context.session_encr_key.len() + 1];
let iv: BigUint = BigUint::from_bytes_be(&context.session_salt_key) << 16;
let iv: BigUint = iv ^ (BigUint::from(ssrc) << 64);
let index_biguint: BigUint = index.into();
let iv: BigUint = iv ^ (index_biguint << 16);
let iv: BigUint = iv ^ (BigUint::from(1_u8) << (context.session_encr_key.len() * 8));
let iv: &[u8] = &iv.to_bytes_be()[1..context.session_encr_key.len() + 1];

let mut ctr =
aes_ctr::Aes128Ctr::new_var(&context.session_encr_key, iv).expect("Correct Key Length");
Expand Down

0 comments on commit 1bae3ed

Please sign in to comment.