From 4ba1ca9d91de4dc28f3d27e49449daab28709fc3 Mon Sep 17 00:00:00 2001 From: Justin Smith Date: Mon, 11 Nov 2024 17:03:05 -0500 Subject: [PATCH 1/3] Disable -Woverriding-t-option --- aws-lc-fips-sys/builder/cmake_builder.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/aws-lc-fips-sys/builder/cmake_builder.rs b/aws-lc-fips-sys/builder/cmake_builder.rs index 5d8baa1da6b..9e5549dd63f 100644 --- a/aws-lc-fips-sys/builder/cmake_builder.rs +++ b/aws-lc-fips-sys/builder/cmake_builder.rs @@ -187,6 +187,7 @@ impl CmakeBuilder { // If the build environment vendor is Apple #[cfg(target_vendor = "apple")] { + cmake_cfg.cflag("-Wno-overriding-t-option"); if target_arch() == "aarch64" { cmake_cfg.define("CMAKE_OSX_ARCHITECTURES", "arm64"); cmake_cfg.define("CMAKE_SYSTEM_PROCESSOR", "arm64"); From 7ec5a2ea3209e9552671737c153f270d334c578e Mon Sep 17 00:00:00 2001 From: Justin Smith Date: Tue, 12 Nov 2024 08:39:35 -0500 Subject: [PATCH 2/3] Satisfy clippy --- aws-lc-rs/src/aead/tests/fips.rs | 12 ++++++------ .../src/aead/tests/fips/chacha20_poly1305_openssh.rs | 6 +++--- aws-lc-rs/src/test.rs | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/aws-lc-rs/src/aead/tests/fips.rs b/aws-lc-rs/src/aead/tests/fips.rs index 13b681fe634..2926a60d186 100644 --- a/aws-lc-rs/src/aead/tests/fips.rs +++ b/aws-lc-rs/src/aead/tests/fips.rs @@ -28,7 +28,7 @@ const TEST_NONCE_96_BIT: [u8; 12] = [ 0xe4, 0x39, 0x17, 0x95, 0x86, 0xcd, 0xcd, 0x5a, 0x1b, 0x46, 0x7b, 0x1d, ]; -const TEST_MESSAGE: &str = "test message"; +const TEST_MESSAGE: &[u8] = "test message".as_bytes(); macro_rules! nonce_sequence_api { ($name:ident, $alg:expr, $key:expr, $seal_expect:path, $open_expect:path) => { @@ -59,7 +59,7 @@ macro_rules! nonce_sequence_api { ) .unwrap(); - assert_eq!(TEST_MESSAGE.as_bytes(), result); + assert_eq!(TEST_MESSAGE, result); } { @@ -89,7 +89,7 @@ macro_rules! nonce_sequence_api { ) .unwrap(); - assert_eq!(TEST_MESSAGE.as_bytes(), result); + assert_eq!(TEST_MESSAGE, result); } } }; @@ -137,7 +137,7 @@ macro_rules! randnonce_api { ) .unwrap(); - assert_eq!(TEST_MESSAGE.as_bytes(), in_out); + assert_eq!(TEST_MESSAGE, in_out); } { @@ -157,7 +157,7 @@ macro_rules! randnonce_api { ) .unwrap(); - assert_eq!(TEST_MESSAGE.as_bytes(), in_out); + assert_eq!(TEST_MESSAGE, in_out); } } }; @@ -213,7 +213,7 @@ macro_rules! tls_nonce_api { ) .unwrap(); - assert_eq!(in_out, TEST_MESSAGE.as_bytes()); + assert_eq!(in_out, TEST_MESSAGE); } }; // Match for unsupported variants diff --git a/aws-lc-rs/src/aead/tests/fips/chacha20_poly1305_openssh.rs b/aws-lc-rs/src/aead/tests/fips/chacha20_poly1305_openssh.rs index 6c86a9c5cb9..e441233978d 100644 --- a/aws-lc-rs/src/aead/tests/fips/chacha20_poly1305_openssh.rs +++ b/aws-lc-rs/src/aead/tests/fips/chacha20_poly1305_openssh.rs @@ -17,7 +17,7 @@ fn test() { #[allow(clippy::cast_possible_truncation)] message.extend_from_slice({ - let len = TEST_MESSAGE.as_bytes().len() as u32; + let len = TEST_MESSAGE.len() as u32; &[ ((len & 0xFF00_0000) >> 24) as u8, ((len & 0xFF_0000) >> 16) as u8, @@ -25,7 +25,7 @@ fn test() { (len & 0xFF) as u8, ] }); - message.extend_from_slice(TEST_MESSAGE.as_bytes()); + message.extend_from_slice(TEST_MESSAGE); let mut tag = [0u8; 16]; @@ -58,5 +58,5 @@ fn test() { key.open_in_place(1024, &mut message, &tag).unwrap(), FipsServiceStatus::NonApproved ); - assert_eq!(TEST_MESSAGE.as_bytes(), message); + assert_eq!(TEST_MESSAGE, message); } diff --git a/aws-lc-rs/src/test.rs b/aws-lc-rs/src/test.rs index ccc2f6675fd..735eb33a511 100644 --- a/aws-lc-rs/src/test.rs +++ b/aws-lc-rs/src/test.rs @@ -201,9 +201,9 @@ impl TestCase { let s = self.consume_optional_string(key)?; let result = if s.starts_with('\"') { // The value is a quoted UTF-8 string. - + let s = s.as_bytes(); let mut bytes = Vec::with_capacity(s.len()); - let mut s = s.as_bytes().iter().skip(1); + let mut s = s.iter().skip(1); loop { let b = match s.next() { Some(b'\\') => { From 89c9b55f7d558580a30c066353d2ccb5b12a9018 Mon Sep 17 00:00:00 2001 From: Justin Smith Date: Thu, 14 Nov 2024 17:24:48 -0500 Subject: [PATCH 3/3] Another day, another clippy lint --- aws-lc-rs/src/ed25519.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-lc-rs/src/ed25519.rs b/aws-lc-rs/src/ed25519.rs index 867cc7f5b1b..0460a22cb69 100644 --- a/aws-lc-rs/src/ed25519.rs +++ b/aws-lc-rs/src/ed25519.rs @@ -562,7 +562,7 @@ mod tests { let public_key = key_pair.public_key(); let signature = key_pair.sign(MESSAGE); let unparsed_public_key = UnparsedPublicKey::new(&ED25519, public_key.as_ref()); - let _ = unparsed_public_key + unparsed_public_key .verify(MESSAGE, signature.as_ref()) .unwrap(); }