aboutsummaryrefslogtreecommitdiff
path: root/azalea-crypto
diff options
context:
space:
mode:
Diffstat (limited to 'azalea-crypto')
-rw-r--r--azalea-crypto/benches/my_benchmark.rs6
-rw-r--r--azalea-crypto/src/lib.rs6
2 files changed, 6 insertions, 6 deletions
diff --git a/azalea-crypto/benches/my_benchmark.rs b/azalea-crypto/benches/my_benchmark.rs
index 4a115b37..78c74c4e 100644
--- a/azalea-crypto/benches/my_benchmark.rs
+++ b/azalea-crypto/benches/my_benchmark.rs
@@ -2,7 +2,7 @@ use azalea_crypto::{create_cipher, decrypt_packet, encrypt_packet};
use criterion::{Criterion, criterion_group, criterion_main};
fn bench(c: &mut Criterion) {
- let (mut enc, dec) = create_cipher(b"0123456789abcdef");
+ let (mut enc, mut dec) = create_cipher(b"0123456789abcdef");
let mut packet = [0u8; 65536];
for (i, item) in packet.iter_mut().enumerate() {
@@ -10,13 +10,13 @@ fn bench(c: &mut Criterion) {
}
c.bench_function("Encrypt 64kb", |b| {
- b.iter(|| encrypt_packet(&mut enc.clone(), &mut packet.clone()))
+ b.iter(|| encrypt_packet(&mut enc, &mut packet.clone()))
});
encrypt_packet(&mut enc, &mut packet);
c.bench_function("Decrypt 64kb", |b| {
- b.iter(|| decrypt_packet(&mut dec.clone(), &mut packet.clone()))
+ b.iter(|| decrypt_packet(&mut dec, &mut packet.clone()))
});
}
diff --git a/azalea-crypto/src/lib.rs b/azalea-crypto/src/lib.rs
index 4676f18f..ddb4b746 100644
--- a/azalea-crypto/src/lib.rs
+++ b/azalea-crypto/src/lib.rs
@@ -6,7 +6,7 @@ pub mod signing;
use aes::{
Aes128,
- cipher::{BlockDecryptMut, BlockEncryptMut, KeyIvInit, inout::InOutBuf},
+ cipher::{BlockModeDecrypt, BlockModeEncrypt, KeyIvInit, inout::InOutBuf},
};
use rand::{TryRng, rngs::SysRng};
use sha1::{Digest, Sha1};
@@ -92,12 +92,12 @@ pub fn create_cipher(key: &[u8]) -> (Aes128CfbEnc, Aes128CfbDec) {
pub fn encrypt_packet(cipher: &mut Aes128CfbEnc, packet: &mut [u8]) {
let (chunks, rest) = InOutBuf::from(packet).into_chunks();
assert!(rest.is_empty());
- cipher.encrypt_blocks_inout_mut(chunks);
+ cipher.encrypt_blocks_inout(chunks);
}
pub fn decrypt_packet(cipher: &mut Aes128CfbDec, packet: &mut [u8]) {
let (chunks, rest) = InOutBuf::from(packet).into_chunks();
assert!(rest.is_empty());
- cipher.decrypt_blocks_inout_mut(chunks);
+ cipher.decrypt_blocks_inout(chunks);
}
#[cfg(test)]