Skip to content

Commit

Permalink
Fix changed encrypt_aes function, correctly this time
Browse files Browse the repository at this point in the history
  • Loading branch information
dani-garcia committed Oct 6, 2023
1 parent 5d33c41 commit 282d0ca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions crates/bitwarden/benches/chunked_decryption.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::io::Write;

use bitwarden::crypto::{encrypt_aes256, ChunkedDecryptor, SymmetricCryptoKey};
use bitwarden::crypto::{encrypt_aes256_hmac, ChunkedDecryptor, SymmetricCryptoKey};
use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion};
use rand::RngCore;

Expand Down Expand Up @@ -32,7 +32,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
initial_buf.resize(size, 0);
rand::thread_rng().fill_bytes(&mut initial_buf[..size]);
let key: SymmetricCryptoKey = SymmetricCryptoKey::generate("test");
let enc_str = encrypt_aes256(&initial_buf, key.key).unwrap();
let enc_str = encrypt_aes256_hmac(&initial_buf, key.mac_key.unwrap(), key.key).unwrap();
let enc_buf = enc_str.to_buffer().unwrap();

group.bench_with_input(
Expand Down
4 changes: 2 additions & 2 deletions crates/bitwarden/src/crypto/chunked_decryptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ mod tests {

use rand::RngCore;

use crate::crypto::{encrypt_aes256, SymmetricCryptoKey};
use crate::crypto::{encrypt_aes256_hmac, SymmetricCryptoKey};

use super::ChunkedDecryptor;

Expand All @@ -326,7 +326,7 @@ mod tests {
initial_buf.resize(size, 0);
rand::thread_rng().fill_bytes(&mut initial_buf[..size]);
let key: SymmetricCryptoKey = SymmetricCryptoKey::generate("test");
let encrypted_buf = encrypt_aes256(&initial_buf, key.key)
let encrypted_buf = encrypt_aes256_hmac(&initial_buf, key.mac_key.unwrap(), key.key)
.unwrap()
.to_buffer()
.unwrap();
Expand Down

0 comments on commit 282d0ca

Please sign in to comment.