diff --git a/.rustfmt.toml b/.rustfmt.toml new file mode 100644 index 00000000000..c1578aafbcf --- /dev/null +++ b/.rustfmt.toml @@ -0,0 +1 @@ +imports_granularity = "Module" diff --git a/aws-lc-rs-testing/benches/kem_benchmark.rs b/aws-lc-rs-testing/benches/kem_benchmark.rs index 56f9206f4e2..f6571dd66c2 100644 --- a/aws-lc-rs-testing/benches/kem_benchmark.rs +++ b/aws-lc-rs-testing/benches/kem_benchmark.rs @@ -1,10 +1,7 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC -use aws_lc_rs::{ - kem::DecapsulationKey, - kem::{Algorithm, ML_KEM_1024, ML_KEM_512, ML_KEM_768}, -}; +use aws_lc_rs::kem::{Algorithm, DecapsulationKey, ML_KEM_1024, ML_KEM_512, ML_KEM_768}; use criterion::{criterion_group, criterion_main, Criterion}; const KEM_ALGORITHMS: &[Algorithm; 3] = &[ML_KEM_512, ML_KEM_768, ML_KEM_1024]; diff --git a/aws-lc-rs/examples/cipher.rs b/aws-lc-rs/examples/cipher.rs index 96cc976547d..59ccc42d61e 100644 --- a/aws-lc-rs/examples/cipher.rs +++ b/aws-lc-rs/examples/cipher.rs @@ -24,15 +24,12 @@ //! $ cargo run --example cipher -- decrypt --mode cbc --key 6489d8ce0c4facf18b872705a05d5ee4 --iv 5cd56fb752830ec2459889226c5431bd 6311c14e8104730be124ce1e57e51fe3 //! Hello World //! ``` -use aws_lc_rs::{ - cipher::{ - DecryptingKey, DecryptionContext, EncryptingKey, EncryptionContext, - PaddedBlockDecryptingKey, PaddedBlockEncryptingKey, UnboundCipherKey, AES_128, - AES_128_KEY_LEN, AES_192, AES_192_KEY_LEN, AES_256, AES_256_KEY_LEN, AES_CBC_IV_LEN, - AES_CTR_IV_LEN, - }, - iv::FixedLength, +use aws_lc_rs::cipher::{ + DecryptingKey, DecryptionContext, EncryptingKey, EncryptionContext, PaddedBlockDecryptingKey, + PaddedBlockEncryptingKey, UnboundCipherKey, AES_128, AES_128_KEY_LEN, AES_192, AES_192_KEY_LEN, + AES_256, AES_256_KEY_LEN, AES_CBC_IV_LEN, AES_CTR_IV_LEN, }; +use aws_lc_rs::iv::FixedLength; use clap::{Parser, Subcommand, ValueEnum}; #[derive(Parser)] diff --git a/aws-lc-rs/src/aead.rs b/aws-lc-rs/src/aead.rs index 74bd8711961..0a3e0dc40c8 100644 --- a/aws-lc-rs/src/aead.rs +++ b/aws-lc-rs/src/aead.rs @@ -180,9 +180,12 @@ //! # } //! ``` -use crate::{derive_debug_via_id, error::Unspecified, hkdf}; +use crate::error::Unspecified; +use crate::{derive_debug_via_id, hkdf}; use aead_ctx::AeadCtx; -use core::{fmt::Debug, ops::RangeFrom, stringify}; +use core::fmt::Debug; +use core::ops::RangeFrom; +use core::stringify; use paste::paste; mod aead_ctx; @@ -197,14 +200,12 @@ mod rand_nonce; mod tls; mod unbound_key; -pub use self::{ - aes_gcm::{AES_128_GCM, AES_128_GCM_SIV, AES_192_GCM, AES_256_GCM, AES_256_GCM_SIV}, - chacha::CHACHA20_POLY1305, - nonce::{Nonce, NONCE_LEN}, - rand_nonce::RandomizedNonceKey, - tls::{TlsProtocolId, TlsRecordOpeningKey, TlsRecordSealingKey}, - unbound_key::UnboundKey, -}; +pub use self::aes_gcm::{AES_128_GCM, AES_128_GCM_SIV, AES_192_GCM, AES_256_GCM, AES_256_GCM_SIV}; +pub use self::chacha::CHACHA20_POLY1305; +pub use self::nonce::{Nonce, NONCE_LEN}; +pub use self::rand_nonce::RandomizedNonceKey; +pub use self::tls::{TlsProtocolId, TlsRecordOpeningKey, TlsRecordSealingKey}; +pub use self::unbound_key::UnboundKey; /// A sequences of unique nonces. /// @@ -1019,7 +1020,8 @@ mod tests { use nonce_sequence::Counter32Builder; use super::*; - use crate::{iv::FixedLength, test::from_hex}; + use crate::iv::FixedLength; + use crate::test::from_hex; #[cfg(feature = "fips")] mod fips; diff --git a/aws-lc-rs/src/aead/chacha20_poly1305_openssh.rs b/aws-lc-rs/src/aead/chacha20_poly1305_openssh.rs index a761bb42ccd..9ab92dc514d 100644 --- a/aws-lc-rs/src/aead/chacha20_poly1305_openssh.rs +++ b/aws-lc-rs/src/aead/chacha20_poly1305_openssh.rs @@ -26,8 +26,9 @@ use super::{poly1305, Nonce, Tag}; use crate::cipher::block::BLOCK_LEN; use crate::cipher::chacha::{self, ChaCha20Key}; +use crate::endian::BigEndian; use crate::iv::FixedLength; -use crate::{constant_time, endian::BigEndian, error}; +use crate::{constant_time, error}; /// A key for sealing packets. pub struct SealingKey { diff --git a/aws-lc-rs/src/aead/rand_nonce.rs b/aws-lc-rs/src/aead/rand_nonce.rs index d6af8265c23..6e085e2f85d 100644 --- a/aws-lc-rs/src/aead/rand_nonce.rs +++ b/aws-lc-rs/src/aead/rand_nonce.rs @@ -4,7 +4,8 @@ use crate::error::Unspecified; use core::fmt::Debug; -use super::{aead_ctx::AeadCtx, Aad, Algorithm, AlgorithmID, Nonce, Tag, UnboundKey}; +use super::aead_ctx::AeadCtx; +use super::{Aad, Algorithm, AlgorithmID, Nonce, Tag, UnboundKey}; /// AEAD Cipher key using a randomized nonce. /// @@ -148,10 +149,8 @@ impl Debug for RandomizedNonceKey { #[cfg(test)] mod tests { use super::{Aad, RandomizedNonceKey}; - use crate::{ - aead::{AES_128_GCM, AES_256_GCM, CHACHA20_POLY1305}, - test::from_hex, - }; + use crate::aead::{AES_128_GCM, AES_256_GCM, CHACHA20_POLY1305}; + use crate::test::from_hex; use paste::paste; const TEST_128_BIT_KEY: &[u8] = &[ diff --git a/aws-lc-rs/src/aead/tests/fips.rs b/aws-lc-rs/src/aead/tests/fips.rs index 2926a60d186..ca33b272dd4 100644 --- a/aws-lc-rs/src/aead/tests/fips.rs +++ b/aws-lc-rs/src/aead/tests/fips.rs @@ -6,14 +6,13 @@ mod chacha20_poly1305_openssh; mod quic; -use crate::{ - aead::{ - nonce_sequence::Counter64Builder, Aad, BoundKey, Nonce, OpeningKey, RandomizedNonceKey, - SealingKey, TlsProtocolId, TlsRecordOpeningKey, TlsRecordSealingKey, UnboundKey, - AES_128_GCM, AES_256_GCM, CHACHA20_POLY1305, - }, - fips::{assert_fips_status_indicator, FipsServiceStatus}, +use crate::aead::nonce_sequence::Counter64Builder; +use crate::aead::{ + Aad, BoundKey, Nonce, OpeningKey, RandomizedNonceKey, SealingKey, TlsProtocolId, + TlsRecordOpeningKey, TlsRecordSealingKey, UnboundKey, AES_128_GCM, AES_256_GCM, + CHACHA20_POLY1305, }; +use crate::fips::{assert_fips_status_indicator, FipsServiceStatus}; const TEST_KEY_128_BIT: [u8; 16] = [ 0x9f, 0xd9, 0x41, 0xc3, 0xa6, 0xfe, 0xb9, 0x26, 0x2a, 0x35, 0xa7, 0x44, 0xbb, 0xc0, 0x3a, 0x6a, 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 e441233978d..8e5b16349a0 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 @@ -1,10 +1,8 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC -use crate::{ - aead::chacha20_poly1305_openssh::{OpeningKey, SealingKey}, - fips::{assert_fips_status_indicator, FipsServiceStatus}, -}; +use crate::aead::chacha20_poly1305_openssh::{OpeningKey, SealingKey}; +use crate::fips::{assert_fips_status_indicator, FipsServiceStatus}; use super::TEST_MESSAGE; diff --git a/aws-lc-rs/src/aead/tests/fips/quic.rs b/aws-lc-rs/src/aead/tests/fips/quic.rs index 4e8157b0e55..d687990c94b 100644 --- a/aws-lc-rs/src/aead/tests/fips/quic.rs +++ b/aws-lc-rs/src/aead/tests/fips/quic.rs @@ -1,10 +1,8 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC -use crate::{ - aead::quic::{HeaderProtectionKey, AES_128, AES_256, CHACHA20}, - fips::{assert_fips_status_indicator, FipsServiceStatus}, -}; +use crate::aead::quic::{HeaderProtectionKey, AES_128, AES_256, CHACHA20}; +use crate::fips::{assert_fips_status_indicator, FipsServiceStatus}; use super::{TEST_KEY_128_BIT, TEST_KEY_256_BIT}; diff --git a/aws-lc-rs/src/aead/tls.rs b/aws-lc-rs/src/aead/tls.rs index 9761df61adf..980ddae8f52 100644 --- a/aws-lc-rs/src/aead/tls.rs +++ b/aws-lc-rs/src/aead/tls.rs @@ -1,10 +1,8 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC -use super::{ - aead_ctx::{self, AeadCtx}, - Aad, Algorithm, AlgorithmID, Nonce, Tag, UnboundKey, -}; +use super::aead_ctx::{self, AeadCtx}; +use super::{Aad, Algorithm, AlgorithmID, Nonce, Tag, UnboundKey}; use crate::error::Unspecified; use core::fmt::Debug; use core::ops::RangeFrom; @@ -298,11 +296,8 @@ impl Debug for TlsRecordOpeningKey { #[cfg(test)] mod tests { use super::{TlsProtocolId, TlsRecordOpeningKey, TlsRecordSealingKey}; - use crate::{ - aead::Aad, - aead::{Nonce, AES_128_GCM, AES_256_GCM, CHACHA20_POLY1305}, - test::from_hex, - }; + use crate::aead::{Aad, Nonce, AES_128_GCM, AES_256_GCM, CHACHA20_POLY1305}; + use crate::test::from_hex; use paste::paste; const TEST_128_BIT_KEY: &[u8] = &[ diff --git a/aws-lc-rs/src/aead/unbound_key.rs b/aws-lc-rs/src/aead/unbound_key.rs index 58f0fa2aac1..b622959fa01 100644 --- a/aws-lc-rs/src/aead/unbound_key.rs +++ b/aws-lc-rs/src/aead/unbound_key.rs @@ -1,17 +1,22 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC -use super::{aead_ctx::AeadCtx, Algorithm, Nonce, MAX_KEY_LEN, MAX_TAG_LEN, NONCE_LEN}; +use super::aead_ctx::AeadCtx; use super::{ - Tag, AES_128_GCM, AES_128_GCM_SIV, AES_192_GCM, AES_256_GCM, AES_256_GCM_SIV, CHACHA20_POLY1305, + Algorithm, Nonce, Tag, AES_128_GCM, AES_128_GCM_SIV, AES_192_GCM, AES_256_GCM, AES_256_GCM_SIV, + CHACHA20_POLY1305, MAX_KEY_LEN, MAX_TAG_LEN, NONCE_LEN, }; use crate::aws_lc::{ EVP_AEAD_CTX_open, EVP_AEAD_CTX_open_gather, EVP_AEAD_CTX_seal, EVP_AEAD_CTX_seal_scatter, }; +use crate::error::Unspecified; +use crate::fips::indicator_check; +use crate::hkdf; use crate::iv::FixedLength; -use crate::{error::Unspecified, fips::indicator_check, hkdf}; use core::fmt::Debug; -use core::{mem::MaybeUninit, ops::RangeFrom, ptr::null}; +use core::mem::MaybeUninit; +use core::ops::RangeFrom; +use core::ptr::null; /// The maximum length of a nonce returned by our AEAD API. const MAX_NONCE_LEN: usize = NONCE_LEN; diff --git a/aws-lc-rs/src/agreement.rs b/aws-lc-rs/src/agreement.rs index 928f0b8b1b8..75945542d36 100644 --- a/aws-lc-rs/src/agreement.rs +++ b/aws-lc-rs/src/agreement.rs @@ -1199,8 +1199,7 @@ mod tests { #[test] fn agreement_traits() { use crate::test; - use regex; - use regex::Regex; + use regex::{self, Regex}; let rng = rand::SystemRandom::new(); let private_key = PrivateKey::generate_for_test(&ECDH_P256, &rng).unwrap(); diff --git a/aws-lc-rs/src/cipher/aes.rs b/aws-lc-rs/src/cipher/aes.rs index 2700f452372..580e561b898 100644 --- a/aws-lc-rs/src/cipher/aes.rs +++ b/aws-lc-rs/src/cipher/aes.rs @@ -7,7 +7,9 @@ use crate::aws_lc::{ AES_cbc_encrypt, AES_cfb128_encrypt, AES_ctr128_encrypt, AES_ecb_encrypt, AES_DECRYPT, AES_ENCRYPT, AES_KEY, }; -use crate::{cipher::block::Block, error::Unspecified, fips::indicator_check}; +use crate::cipher::block::Block; +use crate::error::Unspecified; +use crate::fips::indicator_check; use zeroize::Zeroize; use super::{DecryptionContext, EncryptionContext, OperatingMode, SymmetricCipherKey}; diff --git a/aws-lc-rs/src/cipher/padded.rs b/aws-lc-rs/src/cipher/padded.rs index 25c7bd99df3..bb1b70225a4 100644 --- a/aws-lc-rs/src/cipher/padded.rs +++ b/aws-lc-rs/src/cipher/padded.rs @@ -291,9 +291,10 @@ impl Debug for PaddedBlockDecryptingKey { #[cfg(test)] mod tests { + use crate::cipher::padded::PaddingStrategy; use crate::cipher::{ - padded::PaddingStrategy, Algorithm, EncryptionContext, OperatingMode, - PaddedBlockDecryptingKey, PaddedBlockEncryptingKey, UnboundCipherKey, AES_128, AES_256, + Algorithm, EncryptionContext, OperatingMode, PaddedBlockDecryptingKey, + PaddedBlockEncryptingKey, UnboundCipherKey, AES_128, AES_256, }; use crate::iv::FixedLength; use crate::test::from_hex; diff --git a/aws-lc-rs/src/cipher/tests/fips.rs b/aws-lc-rs/src/cipher/tests/fips.rs index 77f5a9a5bd4..59c4c9015d3 100644 --- a/aws-lc-rs/src/cipher/tests/fips.rs +++ b/aws-lc-rs/src/cipher/tests/fips.rs @@ -3,14 +3,11 @@ #![cfg(debug_assertions)] -use crate::{ - cipher::{ - DecryptingKey, EncryptingKey, PaddedBlockDecryptingKey, PaddedBlockEncryptingKey, - StreamingDecryptingKey, StreamingEncryptingKey, UnboundCipherKey, AES_128, AES_192, - AES_256, - }, - fips::{assert_fips_status_indicator, FipsServiceStatus}, +use crate::cipher::{ + DecryptingKey, EncryptingKey, PaddedBlockDecryptingKey, PaddedBlockEncryptingKey, + StreamingDecryptingKey, StreamingEncryptingKey, UnboundCipherKey, AES_128, AES_192, AES_256, }; +use crate::fips::{assert_fips_status_indicator, FipsServiceStatus}; const TEST_KEY_128_BIT: [u8; 16] = [ 0x9f, 0xd9, 0x41, 0xc3, 0xa6, 0xfe, 0xb9, 0x26, 0x2a, 0x35, 0xa7, 0x44, 0xbb, 0xc0, 0x3a, 0x6a, diff --git a/aws-lc-rs/src/digest/tests/fips.rs b/aws-lc-rs/src/digest/tests/fips.rs index f2a83d33d5d..9ccff8a5f16 100644 --- a/aws-lc-rs/src/digest/tests/fips.rs +++ b/aws-lc-rs/src/digest/tests/fips.rs @@ -3,13 +3,11 @@ #![cfg(debug_assertions)] -use crate::{ - digest::{ - Context, SHA1_FOR_LEGACY_USE_ONLY, SHA224, SHA256, SHA384, SHA3_256, SHA3_384, SHA3_512, - SHA512, SHA512_256, - }, - fips::{assert_fips_status_indicator, FipsServiceStatus}, +use crate::digest::{ + Context, SHA1_FOR_LEGACY_USE_ONLY, SHA224, SHA256, SHA384, SHA3_256, SHA3_384, SHA3_512, + SHA512, SHA512_256, }; +use crate::fips::{assert_fips_status_indicator, FipsServiceStatus}; const TEST_MESSAGE: &str = "test message"; diff --git a/aws-lc-rs/src/ec.rs b/aws-lc-rs/src/ec.rs index 781363fa4d8..56264350b3a 100644 --- a/aws-lc-rs/src/ec.rs +++ b/aws-lc-rs/src/ec.rs @@ -5,8 +5,7 @@ use crate::ec::signature::AlgorithmID; use core::mem::MaybeUninit; -use core::ptr::null; -use core::ptr::null_mut; +use core::ptr::{null, null_mut}; // TODO: Uncomment when MSRV >= 1.64 // use core::ffi::c_int; use std::os::raw::c_int; @@ -427,8 +426,10 @@ mod tests { use crate::encoding::{ AsBigEndian, AsDer, EcPublicKeyCompressedBin, EcPublicKeyUncompressedBin, PublicKeyX509Der, }; - use crate::signature::{EcdsaKeyPair, UnparsedPublicKey, ECDSA_P256_SHA256_FIXED}; - use crate::signature::{KeyPair, ECDSA_P256_SHA256_FIXED_SIGNING}; + use crate::signature::{ + EcdsaKeyPair, KeyPair, UnparsedPublicKey, ECDSA_P256_SHA256_FIXED, + ECDSA_P256_SHA256_FIXED_SIGNING, + }; use crate::test::from_dirty_hex; use crate::{signature, test}; diff --git a/aws-lc-rs/src/hkdf/tests/fips.rs b/aws-lc-rs/src/hkdf/tests/fips.rs index d628ab3c69e..b58672c3900 100644 --- a/aws-lc-rs/src/hkdf/tests/fips.rs +++ b/aws-lc-rs/src/hkdf/tests/fips.rs @@ -3,11 +3,9 @@ #![cfg(debug_assertions)] -use crate::{ - fips::{assert_fips_status_indicator, FipsServiceStatus}, - hkdf::{ - KeyType, Prk, Salt, HKDF_SHA1_FOR_LEGACY_USE_ONLY, HKDF_SHA256, HKDF_SHA384, HKDF_SHA512, - }, +use crate::fips::{assert_fips_status_indicator, FipsServiceStatus}; +use crate::hkdf::{ + KeyType, Prk, Salt, HKDF_SHA1_FOR_LEGACY_USE_ONLY, HKDF_SHA256, HKDF_SHA384, HKDF_SHA512, }; const TEST_KEY_128_BIT: [u8; 16] = [ diff --git a/aws-lc-rs/src/hmac/tests/fips.rs b/aws-lc-rs/src/hmac/tests/fips.rs index f7c34aba5ab..d70606316ef 100644 --- a/aws-lc-rs/src/hmac/tests/fips.rs +++ b/aws-lc-rs/src/hmac/tests/fips.rs @@ -3,15 +3,13 @@ #![cfg(debug_assertions)] -use crate::{ - digest::{SHA1_OUTPUT_LEN, SHA224_OUTPUT_LEN, SHA256_OUTPUT_LEN, SHA512_OUTPUT_LEN}, - fips::{assert_fips_status_indicator, FipsServiceStatus}, - hmac::{ - sign, verify, Key, HMAC_SHA1_FOR_LEGACY_USE_ONLY, HMAC_SHA224, HMAC_SHA256, HMAC_SHA384, - HMAC_SHA512, - }, - rand::{self, SystemRandom}, +use crate::digest::{SHA1_OUTPUT_LEN, SHA224_OUTPUT_LEN, SHA256_OUTPUT_LEN, SHA512_OUTPUT_LEN}; +use crate::fips::{assert_fips_status_indicator, FipsServiceStatus}; +use crate::hmac::{ + sign, verify, Key, HMAC_SHA1_FOR_LEGACY_USE_ONLY, HMAC_SHA224, HMAC_SHA256, HMAC_SHA384, + HMAC_SHA512, }; +use crate::rand::{self, SystemRandom}; const TEST_MESSAGE: &str = "test message"; diff --git a/aws-lc-rs/src/kdf.rs b/aws-lc-rs/src/kdf.rs index 32fb80037e4..eaf91434f43 100644 --- a/aws-lc-rs/src/kdf.rs +++ b/aws-lc-rs/src/kdf.rs @@ -225,10 +225,10 @@ pub use sskdf::{ #[cfg(test)] mod tests { + use crate::kdf::sskdf::SskdfHmacAlgorithmId; use crate::kdf::{ get_kbkdf_ctr_hmac_algorithm, get_sskdf_digest_algorithm, get_sskdf_hmac_algorithm, - kbkdf_ctr_hmac, sskdf::SskdfHmacAlgorithmId, sskdf_digest, sskdf_hmac, - KbkdfCtrHmacAlgorithmId, SskdfDigestAlgorithmId, + kbkdf_ctr_hmac, sskdf_digest, sskdf_hmac, KbkdfCtrHmacAlgorithmId, SskdfDigestAlgorithmId, }; #[test] diff --git a/aws-lc-rs/src/kdf/kbkdf.rs b/aws-lc-rs/src/kdf/kbkdf.rs index ec0f96b0c39..f5f2bdd9319 100644 --- a/aws-lc-rs/src/kdf/kbkdf.rs +++ b/aws-lc-rs/src/kdf/kbkdf.rs @@ -3,14 +3,11 @@ #![allow(clippy::module_name_repetitions)] -use crate::aws_lc::KBKDF_ctr_hmac; -use crate::aws_lc::EVP_MD; +use crate::aws_lc::{KBKDF_ctr_hmac, EVP_MD}; -use crate::{ - digest::{match_digest_type, AlgorithmID}, - error::Unspecified, - ptr::ConstPointer, -}; +use crate::digest::{match_digest_type, AlgorithmID}; +use crate::error::Unspecified; +use crate::ptr::ConstPointer; /// KBKDF in Counter Mode with HMAC-SHA224 #[allow(dead_code)] diff --git a/aws-lc-rs/src/kdf/sskdf.rs b/aws-lc-rs/src/kdf/sskdf.rs index b46da9ad15a..2e4f0bfd2b4 100644 --- a/aws-lc-rs/src/kdf/sskdf.rs +++ b/aws-lc-rs/src/kdf/sskdf.rs @@ -3,14 +3,11 @@ #![allow(clippy::module_name_repetitions)] -use crate::aws_lc::EVP_MD; -use crate::aws_lc::{SSKDF_digest, SSKDF_hmac}; +use crate::aws_lc::{SSKDF_digest, SSKDF_hmac, EVP_MD}; -use crate::{ - digest::{match_digest_type, AlgorithmID}, - error::Unspecified, - ptr::ConstPointer, -}; +use crate::digest::{match_digest_type, AlgorithmID}; +use crate::error::Unspecified; +use crate::ptr::ConstPointer; /// SSKDF with HMAC-SHA224 #[allow(dead_code)] diff --git a/aws-lc-rs/src/kem.rs b/aws-lc-rs/src/kem.rs index 92b34e807c6..3438855e5aa 100644 --- a/aws-lc-rs/src/kem.rs +++ b/aws-lc-rs/src/kem.rs @@ -50,14 +50,13 @@ use crate::aws_lc::{ EVP_PKEY_get_raw_private_key, EVP_PKEY_get_raw_public_key, EVP_PKEY_kem_new_raw_public_key, EVP_PKEY_keygen, EVP_PKEY_keygen_init, EVP_PKEY, EVP_PKEY_KEM, }; -use crate::{ - buffer::Buffer, - encoding::generated_encodings, - error::{KeyRejected, Unspecified}, - ptr::LcPtr, -}; +use crate::buffer::Buffer; +use crate::encoding::generated_encodings; +use crate::error::{KeyRejected, Unspecified}; +use crate::ptr::LcPtr; use alloc::borrow::Cow; -use core::{cmp::Ordering, ptr::null_mut}; +use core::cmp::Ordering; +use core::ptr::null_mut; use zeroize::Zeroize; const ML_KEM_512_SHARED_SECRET_LENGTH: usize = 32; @@ -508,8 +507,7 @@ fn kem_key_generate(nid: i32) -> Result, Unspecified> { #[cfg(test)] mod tests { - use super::{Ciphertext, SharedSecret}; - use super::{DecapsulationKey, EncapsulationKey}; + use super::{Ciphertext, DecapsulationKey, EncapsulationKey, SharedSecret}; use crate::error::KeyRejected; use crate::kem::{ML_KEM_1024, ML_KEM_512, ML_KEM_768}; diff --git a/aws-lc-rs/src/key_wrap.rs b/aws-lc-rs/src/key_wrap.rs index e1b45dc91df..0e91f2bd1ad 100644 --- a/aws-lc-rs/src/key_wrap.rs +++ b/aws-lc-rs/src/key_wrap.rs @@ -36,8 +36,12 @@ use crate::aws_lc::{ AES_set_decrypt_key, AES_set_encrypt_key, AES_unwrap_key, AES_unwrap_key_padded, AES_wrap_key, AES_wrap_key_padded, AES_KEY, }; -use crate::{error::Unspecified, fips::indicator_check, sealed::Sealed}; -use core::{fmt::Debug, mem::MaybeUninit, ptr::null}; +use crate::error::Unspecified; +use crate::fips::indicator_check; +use crate::sealed::Sealed; +use core::fmt::Debug; +use core::mem::MaybeUninit; +use core::ptr::null; mod tests; diff --git a/aws-lc-rs/src/key_wrap/tests/fips.rs b/aws-lc-rs/src/key_wrap/tests/fips.rs index 8fadc45c78e..45b609778ab 100644 --- a/aws-lc-rs/src/key_wrap/tests/fips.rs +++ b/aws-lc-rs/src/key_wrap/tests/fips.rs @@ -3,10 +3,8 @@ #![cfg(debug_assertions)] -use crate::{ - fips::{assert_fips_status_indicator, FipsServiceStatus}, - key_wrap::{AesKek, KeyWrap, KeyWrapPadded, AES_128, AES_256}, -}; +use crate::fips::{assert_fips_status_indicator, FipsServiceStatus}; +use crate::key_wrap::{AesKek, KeyWrap, KeyWrapPadded, AES_128, AES_256}; const K_128: &[u8] = &[ 0x60, 0x43, 0xb2, 0x73, 0xe9, 0x71, 0x26, 0x5e, 0x53, 0x8a, 0x6c, 0xcd, 0x5d, 0x5a, 0x11, 0xe4, diff --git a/aws-lc-rs/src/pbkdf2/tests/fips.rs b/aws-lc-rs/src/pbkdf2/tests/fips.rs index b027c7202c6..d9c64b9221e 100644 --- a/aws-lc-rs/src/pbkdf2/tests/fips.rs +++ b/aws-lc-rs/src/pbkdf2/tests/fips.rs @@ -5,12 +5,9 @@ use core::num::NonZeroU32; -use crate::{ - fips::{assert_fips_status_indicator, FipsServiceStatus}, - pbkdf2::{ - derive, verify, PBKDF2_HMAC_SHA1, PBKDF2_HMAC_SHA256, PBKDF2_HMAC_SHA384, - PBKDF2_HMAC_SHA512, - }, +use crate::fips::{assert_fips_status_indicator, FipsServiceStatus}; +use crate::pbkdf2::{ + derive, verify, PBKDF2_HMAC_SHA1, PBKDF2_HMAC_SHA256, PBKDF2_HMAC_SHA384, PBKDF2_HMAC_SHA512, }; macro_rules! pbkdf2_api { diff --git a/aws-lc-rs/src/rsa.rs b/aws-lc-rs/src/rsa.rs index 586a4e977a1..ffced1a8292 100644 --- a/aws-lc-rs/src/rsa.rs +++ b/aws-lc-rs/src/rsa.rs @@ -70,19 +70,15 @@ mod encryption; pub(crate) mod key; pub(crate) mod signature; +pub use self::encryption::oaep::{ + OaepAlgorithm, OaepPrivateDecryptingKey, OaepPublicEncryptingKey, OAEP_SHA1_MGF1SHA1, + OAEP_SHA256_MGF1SHA256, OAEP_SHA384_MGF1SHA384, OAEP_SHA512_MGF1SHA512, +}; +pub use self::encryption::pkcs1::{Pkcs1PrivateDecryptingKey, Pkcs1PublicEncryptingKey}; +pub use self::encryption::{EncryptionAlgorithmId, PrivateDecryptingKey, PublicEncryptingKey}; +pub use self::key::{KeyPair, KeySize, PublicKey, PublicKeyComponents}; #[allow(clippy::module_name_repetitions)] pub use self::signature::RsaParameters; -pub use self::{ - encryption::{ - oaep::{ - OaepAlgorithm, OaepPrivateDecryptingKey, OaepPublicEncryptingKey, OAEP_SHA1_MGF1SHA1, - OAEP_SHA256_MGF1SHA256, OAEP_SHA384_MGF1SHA384, OAEP_SHA512_MGF1SHA512, - }, - pkcs1::{Pkcs1PrivateDecryptingKey, Pkcs1PublicEncryptingKey}, - EncryptionAlgorithmId, PrivateDecryptingKey, PublicEncryptingKey, - }, - key::{KeyPair, KeySize, PublicKey, PublicKeyComponents}, -}; pub(crate) use self::signature::RsaVerificationAlgorithmId; diff --git a/aws-lc-rs/src/rsa/encoding.rs b/aws-lc-rs/src/rsa/encoding.rs index 564356ea86f..a9a6dc3e0a3 100644 --- a/aws-lc-rs/src/rsa/encoding.rs +++ b/aws-lc-rs/src/rsa/encoding.rs @@ -4,13 +4,11 @@ /// PKCS#8 Encoding Functions pub(in crate::rsa) mod pkcs8 { use crate::aws_lc::{EVP_marshal_private_key, EVP_parse_private_key, EVP_PKEY}; - use crate::{ - cbb::LcCBB, - cbs, - error::{KeyRejected, Unspecified}, - ptr::LcPtr, - rsa::key::is_rsa_key, - }; + use crate::cbb::LcCBB; + use crate::cbs; + use crate::error::{KeyRejected, Unspecified}; + use crate::ptr::LcPtr; + use crate::rsa::key::is_rsa_key; // Based on a measurement of a PKCS#8 v1 document containing an RSA-8192 key with an additional 1% capacity buffer // rounded to an even 64-bit words (4678 + 1% + padding ≈ 4728). @@ -53,11 +51,9 @@ pub(in crate::rsa) mod rfc8017 { EVP_PKEY_assign_RSA, EVP_PKEY_new, RSA_parse_private_key, RSA_public_key_from_bytes, RSA_public_key_to_bytes, EVP_PKEY, }; - use crate::{ - cbs, - error::{KeyRejected, Unspecified}, - ptr::{DetachableLcPtr, LcPtr}, - }; + use crate::cbs; + use crate::error::{KeyRejected, Unspecified}; + use crate::ptr::{DetachableLcPtr, LcPtr}; use std::ptr::null_mut; /// DER encode a RSA public key to `RSAPublicKey` structure. @@ -127,14 +123,12 @@ pub(in crate::rsa) mod rfc8017 { /// Encodings that use the `SubjectPublicKeyInfo` structure. pub(in crate::rsa) mod rfc5280 { use crate::aws_lc::{EVP_marshal_public_key, EVP_parse_public_key, EVP_PKEY}; - use crate::{ - cbb::LcCBB, - cbs, - encoding::PublicKeyX509Der, - error::{KeyRejected, Unspecified}, - ptr::LcPtr, - rsa::key::{is_rsa_key, key_size_bytes}, - }; + use crate::cbb::LcCBB; + use crate::cbs; + use crate::encoding::PublicKeyX509Der; + use crate::error::{KeyRejected, Unspecified}; + use crate::ptr::LcPtr; + use crate::rsa::key::{is_rsa_key, key_size_bytes}; pub(in crate::rsa) fn encode_public_key_der( key: &LcPtr, diff --git a/aws-lc-rs/src/rsa/encryption.rs b/aws-lc-rs/src/rsa/encryption.rs index 7a199bd3d58..cd9a5618522 100644 --- a/aws-lc-rs/src/rsa/encryption.rs +++ b/aws-lc-rs/src/rsa/encryption.rs @@ -4,17 +4,12 @@ pub(super) mod oaep; pub(super) mod pkcs1; -use super::{ - encoding, - key::{generate_rsa_key, is_rsa_key, key_size_bits, key_size_bytes}, - KeySize, -}; +use super::key::{generate_rsa_key, is_rsa_key, key_size_bits, key_size_bytes}; +use super::{encoding, KeySize}; use crate::aws_lc::EVP_PKEY; -use crate::{ - encoding::{AsDer, Pkcs8V1Der, PublicKeyX509Der}, - error::{KeyRejected, Unspecified}, - ptr::LcPtr, -}; +use crate::encoding::{AsDer, Pkcs8V1Der, PublicKeyX509Der}; +use crate::error::{KeyRejected, Unspecified}; +use crate::ptr::LcPtr; use core::fmt::Debug; /// RSA Encryption Algorithm Identifier diff --git a/aws-lc-rs/src/rsa/encryption/oaep.rs b/aws-lc-rs/src/rsa/encryption/oaep.rs index 279058eb4ee..35ff7603bd9 100644 --- a/aws-lc-rs/src/rsa/encryption/oaep.rs +++ b/aws-lc-rs/src/rsa/encryption/oaep.rs @@ -10,12 +10,12 @@ use crate::aws_lc::{ EVP_PKEY_encrypt_init, EVP_sha1, EVP_sha256, EVP_sha384, EVP_sha512, OPENSSL_malloc, EVP_MD, EVP_PKEY_CTX, RSA_PKCS1_OAEP_PADDING, }; -use crate::{ - error::Unspecified, - fips::indicator_check, - ptr::{DetachableLcPtr, LcPtr}, -}; -use core::{fmt::Debug, mem::size_of_val, ptr::null_mut}; +use crate::error::Unspecified; +use crate::fips::indicator_check; +use crate::ptr::{DetachableLcPtr, LcPtr}; +use core::fmt::Debug; +use core::mem::size_of_val; +use core::ptr::null_mut; /// RSA-OAEP with SHA1 Hash and SHA1 MGF1 pub const OAEP_SHA1_MGF1SHA1: OaepAlgorithm = OaepAlgorithm { diff --git a/aws-lc-rs/src/rsa/encryption/pkcs1.rs b/aws-lc-rs/src/rsa/encryption/pkcs1.rs index 7a0e94d655e..ac47452b92a 100644 --- a/aws-lc-rs/src/rsa/encryption/pkcs1.rs +++ b/aws-lc-rs/src/rsa/encryption/pkcs1.rs @@ -8,7 +8,9 @@ use crate::aws_lc::{ EVP_PKEY_CTX_set_rsa_padding, EVP_PKEY_decrypt, EVP_PKEY_decrypt_init, EVP_PKEY_encrypt, EVP_PKEY_encrypt_init, EVP_PKEY_CTX, RSA_PKCS1_PADDING, }; -use crate::{error::Unspecified, fips::indicator_check, ptr::LcPtr}; +use crate::error::Unspecified; +use crate::fips::indicator_check; +use crate::ptr::LcPtr; use core::fmt::Debug; /// RSA PKCS1-v1.5 public key for encryption. diff --git a/aws-lc-rs/src/rsa/key.rs b/aws-lc-rs/src/rsa/key.rs index e2116b5f663..1fce720e9de 100644 --- a/aws-lc-rs/src/rsa/key.rs +++ b/aws-lc-rs/src/rsa/key.rs @@ -3,11 +3,8 @@ // Modifications copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC -use super::{ - encoding, - signature::{compute_rsa_signature, RsaEncoding, RsaPadding}, - RsaParameters, -}; +use super::signature::{compute_rsa_signature, RsaEncoding, RsaPadding}; +use super::{encoding, RsaParameters}; #[cfg(feature = "fips")] use crate::aws_lc::RSA_check_fips; use crate::aws_lc::{ @@ -17,25 +14,20 @@ use crate::aws_lc::{ }; #[cfg(feature = "ring-io")] use crate::aws_lc::{RSA_get0_e, RSA_get0_n}; +use crate::digest::{self}; +use crate::encoding::{AsDer, Pkcs8V1Der}; +use crate::error::{KeyRejected, Unspecified}; +use crate::fips::indicator_check; #[cfg(feature = "ring-io")] use crate::io; #[cfg(feature = "ring-io")] use crate::ptr::ConstPointer; -use crate::{ - digest::{self}, - encoding::{AsDer, Pkcs8V1Der}, - error::{KeyRejected, Unspecified}, - fips::indicator_check, - hex, - ptr::{DetachableLcPtr, LcPtr}, - rand, - rsa::PublicEncryptingKey, - sealed::Sealed, -}; -use core::{ - fmt::{self, Debug, Formatter}, - ptr::null_mut, -}; +use crate::ptr::{DetachableLcPtr, LcPtr}; +use crate::rsa::PublicEncryptingKey; +use crate::sealed::Sealed; +use crate::{hex, rand}; +use core::fmt::{self, Debug, Formatter}; +use core::ptr::null_mut; // TODO: Uncomment when MSRV >= 1.64 // use core::ffi::c_int; diff --git a/aws-lc-rs/src/rsa/signature.rs b/aws-lc-rs/src/rsa/signature.rs index d23590ef5e2..b4300bb6ab0 100644 --- a/aws-lc-rs/src/rsa/signature.rs +++ b/aws-lc-rs/src/rsa/signature.rs @@ -1,12 +1,10 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC -use std::{ - fmt::{self, Debug, Formatter}, - mem::MaybeUninit, - ops::RangeInclusive, - ptr::{null, null_mut}, -}; +use std::fmt::{self, Debug, Formatter}; +use std::mem::MaybeUninit; +use std::ops::RangeInclusive; +use std::ptr::{null, null_mut}; use crate::aws_lc::{ EVP_DigestSign, EVP_DigestVerify, EVP_DigestVerifyInit, EVP_PKEY_CTX_set_rsa_padding, @@ -14,14 +12,13 @@ use crate::aws_lc::{ EVP_PKEY_CTX, RSA_PKCS1_PSS_PADDING, RSA_PSS_SALTLEN_DIGEST, }; -use crate::{ - digest::{self, digest_ctx::DigestContext}, - error::Unspecified, - fips::indicator_check, - ptr::{ConstPointer, DetachableLcPtr, LcPtr}, - sealed::Sealed, - signature::VerificationAlgorithm, -}; +use crate::digest::digest_ctx::DigestContext; +use crate::digest::{self}; +use crate::error::Unspecified; +use crate::fips::indicator_check; +use crate::ptr::{ConstPointer, DetachableLcPtr, LcPtr}; +use crate::sealed::Sealed; +use crate::signature::VerificationAlgorithm; #[cfg(feature = "ring-sig-verify")] use untrusted::Input; diff --git a/aws-lc-rs/src/rsa/tests/fips.rs b/aws-lc-rs/src/rsa/tests/fips.rs index a844b71869a..c2c0ac19654 100644 --- a/aws-lc-rs/src/rsa/tests/fips.rs +++ b/aws-lc-rs/src/rsa/tests/fips.rs @@ -3,10 +3,8 @@ #![cfg(debug_assertions)] -use crate::{ - fips::{assert_fips_status_indicator, FipsServiceStatus}, - rsa::{KeyPair, KeySize, PrivateDecryptingKey}, -}; +use crate::fips::{assert_fips_status_indicator, FipsServiceStatus}; +use crate::rsa::{KeyPair, KeySize, PrivateDecryptingKey}; macro_rules! generate_key { ($name:ident, KeyPair, $size:expr) => { diff --git a/aws-lc-rs/src/signature.rs b/aws-lc-rs/src/signature.rs index 37473732370..ee375bdf627 100644 --- a/aws-lc-rs/src/signature.rs +++ b/aws-lc-rs/src/signature.rs @@ -238,15 +238,14 @@ use core::fmt::{Debug, Formatter}; #[cfg(feature = "ring-sig-verify")] use untrusted::Input; +pub use crate::rsa::signature::RsaEncoding; pub use crate::rsa::{ - signature::RsaEncoding, KeyPair as RsaKeyPair, PublicKey as RsaSubjectPublicKey, + KeyPair as RsaKeyPair, PublicKey as RsaSubjectPublicKey, PublicKeyComponents as RsaPublicKeyComponents, RsaParameters, }; -use crate::rsa::{ - signature::{RsaSignatureEncoding, RsaSigningAlgorithmId}, - RsaVerificationAlgorithmId, -}; +use crate::rsa::signature::{RsaSignatureEncoding, RsaSigningAlgorithmId}; +use crate::rsa::RsaVerificationAlgorithmId; pub use crate::ec::key_pair::{EcdsaKeyPair, PrivateKey as EcdsaPrivateKey}; use crate::ec::signature::EcdsaSignatureFormat; @@ -256,8 +255,7 @@ pub use crate::ec::signature::{ pub use crate::ed25519::{ Ed25519KeyPair, EdDSAParameters, Seed as Ed25519Seed, ED25519_PUBLIC_KEY_LEN, }; -use crate::rsa; -use crate::{digest, ec, error, hex, sealed}; +use crate::{digest, ec, error, hex, rsa, sealed}; /// The longest signature is an ASN.1 P-384 signature where *r* and *s* are of /// maximum length with the leading high bit set on each. Then each component diff --git a/aws-lc-rs/src/signature/tests/fips.rs b/aws-lc-rs/src/signature/tests/fips.rs index a8ef3e14938..b5080552773 100644 --- a/aws-lc-rs/src/signature/tests/fips.rs +++ b/aws-lc-rs/src/signature/tests/fips.rs @@ -3,27 +3,23 @@ #![cfg(debug_assertions)] -use crate::{ - fips::{assert_fips_status_indicator, FipsServiceStatus}, - rand::SystemRandom, - signature::{ - EcdsaKeyPair, Ed25519KeyPair, EdDSAParameters, KeyPair, RsaKeyPair, VerificationAlgorithm, - ECDSA_P256_SHA256_ASN1, ECDSA_P256_SHA256_ASN1_SIGNING, ECDSA_P256_SHA256_FIXED, - ECDSA_P256_SHA256_FIXED_SIGNING, ECDSA_P256_SHA384_ASN1, ECDSA_P384_SHA256_ASN1, - ECDSA_P384_SHA384_ASN1, ECDSA_P384_SHA384_ASN1_SIGNING, ECDSA_P384_SHA384_FIXED, - ECDSA_P384_SHA384_FIXED_SIGNING, ECDSA_P384_SHA3_384_ASN1, - ECDSA_P384_SHA3_384_ASN1_SIGNING, ECDSA_P384_SHA3_384_FIXED, - ECDSA_P384_SHA3_384_FIXED_SIGNING, ECDSA_P521_SHA3_512_ASN1, - ECDSA_P521_SHA3_512_ASN1_SIGNING, ECDSA_P521_SHA3_512_FIXED, - ECDSA_P521_SHA3_512_FIXED_SIGNING, ECDSA_P521_SHA512_ASN1, ECDSA_P521_SHA512_ASN1_SIGNING, - ECDSA_P521_SHA512_FIXED, ECDSA_P521_SHA512_FIXED_SIGNING, - RSA_PKCS1_1024_8192_SHA1_FOR_LEGACY_USE_ONLY, - RSA_PKCS1_1024_8192_SHA256_FOR_LEGACY_USE_ONLY, - RSA_PKCS1_1024_8192_SHA512_FOR_LEGACY_USE_ONLY, RSA_PKCS1_2048_8192_SHA256, - RSA_PKCS1_2048_8192_SHA384, RSA_PKCS1_2048_8192_SHA512, RSA_PKCS1_SHA256, RSA_PKCS1_SHA384, - RSA_PKCS1_SHA512, RSA_PSS_2048_8192_SHA256, RSA_PSS_2048_8192_SHA384, - RSA_PSS_2048_8192_SHA512, RSA_PSS_SHA256, RSA_PSS_SHA384, RSA_PSS_SHA512, - }, +use crate::fips::{assert_fips_status_indicator, FipsServiceStatus}; +use crate::rand::SystemRandom; +use crate::signature::{ + EcdsaKeyPair, Ed25519KeyPair, EdDSAParameters, KeyPair, RsaKeyPair, VerificationAlgorithm, + ECDSA_P256_SHA256_ASN1, ECDSA_P256_SHA256_ASN1_SIGNING, ECDSA_P256_SHA256_FIXED, + ECDSA_P256_SHA256_FIXED_SIGNING, ECDSA_P256_SHA384_ASN1, ECDSA_P384_SHA256_ASN1, + ECDSA_P384_SHA384_ASN1, ECDSA_P384_SHA384_ASN1_SIGNING, ECDSA_P384_SHA384_FIXED, + ECDSA_P384_SHA384_FIXED_SIGNING, ECDSA_P384_SHA3_384_ASN1, ECDSA_P384_SHA3_384_ASN1_SIGNING, + ECDSA_P384_SHA3_384_FIXED, ECDSA_P384_SHA3_384_FIXED_SIGNING, ECDSA_P521_SHA3_512_ASN1, + ECDSA_P521_SHA3_512_ASN1_SIGNING, ECDSA_P521_SHA3_512_FIXED, ECDSA_P521_SHA3_512_FIXED_SIGNING, + ECDSA_P521_SHA512_ASN1, ECDSA_P521_SHA512_ASN1_SIGNING, ECDSA_P521_SHA512_FIXED, + ECDSA_P521_SHA512_FIXED_SIGNING, RSA_PKCS1_1024_8192_SHA1_FOR_LEGACY_USE_ONLY, + RSA_PKCS1_1024_8192_SHA256_FOR_LEGACY_USE_ONLY, RSA_PKCS1_1024_8192_SHA512_FOR_LEGACY_USE_ONLY, + RSA_PKCS1_2048_8192_SHA256, RSA_PKCS1_2048_8192_SHA384, RSA_PKCS1_2048_8192_SHA512, + RSA_PKCS1_SHA256, RSA_PKCS1_SHA384, RSA_PKCS1_SHA512, RSA_PSS_2048_8192_SHA256, + RSA_PSS_2048_8192_SHA384, RSA_PSS_2048_8192_SHA512, RSA_PSS_SHA256, RSA_PSS_SHA384, + RSA_PSS_SHA512, }; mod keys; diff --git a/aws-lc-rs/src/tls_prf.rs b/aws-lc-rs/src/tls_prf.rs index 4c929064122..e729ff7a20f 100644 --- a/aws-lc-rs/src/tls_prf.rs +++ b/aws-lc-rs/src/tls_prf.rs @@ -27,9 +27,9 @@ use core::fmt::Debug; -use crate::{ - digest::match_digest_type, digest::AlgorithmID, error::Unspecified, fips::indicator_check, -}; +use crate::digest::{match_digest_type, AlgorithmID}; +use crate::error::Unspecified; +use crate::fips::indicator_check; use core::ptr::null; use crate::aws_lc::CRYPTO_tls1_prf; diff --git a/aws-lc-rs/tests/ecdsa_tests.rs b/aws-lc-rs/tests/ecdsa_tests.rs index 9935ceca4fc..14470c7af28 100644 --- a/aws-lc-rs/tests/ecdsa_tests.rs +++ b/aws-lc-rs/tests/ecdsa_tests.rs @@ -3,13 +3,10 @@ // Modifications copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC -use aws_lc_rs::encoding::{AsBigEndian, EcPrivateKeyRfc5915Der}; -use aws_lc_rs::{ - encoding::AsDer, - rand::SystemRandom, - signature::{self, EcdsaKeyPair, KeyPair, Signature, UnparsedPublicKey}, - test, test_file, -}; +use aws_lc_rs::encoding::{AsBigEndian, AsDer, EcPrivateKeyRfc5915Der}; +use aws_lc_rs::rand::SystemRandom; +use aws_lc_rs::signature::{self, EcdsaKeyPair, KeyPair, Signature, UnparsedPublicKey}; +use aws_lc_rs::{test, test_file}; #[test] fn ecdsa_traits() { diff --git a/aws-lc-rs/tests/ed25519_tests.rs b/aws-lc-rs/tests/ed25519_tests.rs index 444607af22e..ee3b9be3cf8 100644 --- a/aws-lc-rs/tests/ed25519_tests.rs +++ b/aws-lc-rs/tests/ed25519_tests.rs @@ -5,11 +5,8 @@ use aws_lc_rs::encoding::{AsBigEndian, Curve25519SeedBin}; use aws_lc_rs::rand::SystemRandom; -use aws_lc_rs::{ - error, - signature::{self, Ed25519KeyPair, KeyPair}, - test, test_file, -}; +use aws_lc_rs::signature::{self, Ed25519KeyPair, KeyPair}; +use aws_lc_rs::{error, test, test_file}; #[test] fn test_ed25519_traits() { diff --git a/aws-lc-rs/tests/rand_test.rs b/aws-lc-rs/tests/rand_test.rs index d9b0903e8f1..e3cef0bd5be 100644 --- a/aws-lc-rs/tests/rand_test.rs +++ b/aws-lc-rs/tests/rand_test.rs @@ -3,10 +3,8 @@ // Modifications copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC -use aws_lc_rs::{ - rand::{self, SecureRandom as _}, - test, -}; +use aws_lc_rs::rand::{self, SecureRandom as _}; +use aws_lc_rs::test; #[cfg(target_arch = "wasm32")] use wasm_bindgen_test::{wasm_bindgen_test as test, wasm_bindgen_test_configure}; diff --git a/aws-lc-sys/builder/main.rs b/aws-lc-sys/builder/main.rs index 15706429afd..89e7eab5050 100644 --- a/aws-lc-sys/builder/main.rs +++ b/aws-lc-sys/builder/main.rs @@ -11,9 +11,10 @@ #![cfg_attr(clippy, clippy::msrv = "1.77")] use std::ffi::{OsStr, OsString}; +use std::fmt::Debug; use std::path::{Path, PathBuf}; use std::process::Command; -use std::{env, fmt, fmt::Debug}; +use std::{env, fmt}; use cc_builder::CcBuilder; use cmake_builder::CmakeBuilder;