Skip to content

Commit

Permalink
a̸l̴l̸ ̶h̷a̴i̴l̶ ̸c̴l̵i̶p̴p̸y̵
Browse files Browse the repository at this point in the history
  • Loading branch information
skmcgrail committed Nov 13, 2024
1 parent 6f3a0e8 commit 113cfff
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
1 change: 1 addition & 0 deletions aws-lc-rs-testing/benches/kem_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use aws_lc_rs::{
};
use criterion::{criterion_group, criterion_main, Criterion};

#[allow(deprecated)]
const UNSTABLE_ALGORITHMS: &[Option<&aws_lc_rs::kem::Algorithm<AlgorithmId>>] = &[
get_algorithm(AlgorithmId::Kyber512_R3),
get_algorithm(AlgorithmId::Kyber768_R3),
Expand Down
20 changes: 6 additions & 14 deletions aws-lc-rs/src/cipher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -670,13 +670,8 @@ fn encrypt(
) -> Result<DecryptionContext, Unspecified> {
let block_len = algorithm.block_len();

match mode {
OperatingMode::CBC => {
if (in_out.len() % block_len) != 0 {
return Err(Unspecified);
}
}
_ => {}
if mode == OperatingMode::CBC && (in_out.len() % block_len) != 0 {
return Err(Unspecified);
}

match mode {
Expand Down Expand Up @@ -704,13 +699,8 @@ fn decrypt<'in_out>(
) -> Result<&'in_out mut [u8], Unspecified> {
let block_len = algorithm.block_len();

match mode {
OperatingMode::CBC => {
if (in_out.len() % block_len) != 0 {
return Err(Unspecified);
}
}
_ => {}
if mode == OperatingMode::CBC && (in_out.len() % block_len) != 0 {
return Err(Unspecified);
}

match mode {
Expand Down Expand Up @@ -816,6 +806,7 @@ fn decrypt_aes_cbc_mode<'in_out>(
Ok(in_out)
}

#[allow(clippy::needless_pass_by_value)]
fn encrypt_aes_cfb_mode(
key: &SymmetricCipherKey,
mode: OperatingMode,
Expand Down Expand Up @@ -848,6 +839,7 @@ fn encrypt_aes_cfb_mode(
Ok(context.into())
}

#[allow(clippy::needless_pass_by_value)]
fn decrypt_aes_cfb_mode<'in_out>(
key: &SymmetricCipherKey,
mode: OperatingMode,
Expand Down
2 changes: 1 addition & 1 deletion aws-lc-rs/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ impl TestCase {
let result = if s.starts_with('\"') {
// The value is a quoted UTF-8 string.

let mut bytes = Vec::with_capacity(s.as_bytes().len());
let mut bytes = Vec::with_capacity(s.len());
let mut s = s.as_bytes().iter().skip(1);
loop {
let b = match s.next() {
Expand Down

0 comments on commit 113cfff

Please sign in to comment.