diff --git a/.github/workflows/workspace.yml b/.github/workflows/workspace.yml index d321c825..1cd3f63f 100644 --- a/.github/workflows/workspace.yml +++ b/.github/workflows/workspace.yml @@ -28,6 +28,6 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: - toolchain: 1.72.0 + toolchain: 1.81.0 components: clippy - run: cargo clippy --all --all-features -- -D warnings diff --git a/aes-siv/src/lib.rs b/aes-siv/src/lib.rs index 48360e4b..f9fcd020 100644 --- a/aes-siv/src/lib.rs +++ b/aes-siv/src/lib.rs @@ -110,6 +110,8 @@ pub type Nonce = Array; /// AES-SIV tags (i.e. the Synthetic Initialization Vector value) pub type Tag = Array; +/// Convinience wrapper around `Siv` interface. +/// /// The `SivAead` type wraps the more powerful `Siv` interface in a more /// commonly used Authenticated Encryption with Associated Data (AEAD) API, /// which accepts a key, nonce, and associated data when encrypting/decrypting. diff --git a/ccm/src/lib.rs b/ccm/src/lib.rs index 352a73ac..77114363 100644 --- a/ccm/src/lib.rs +++ b/ccm/src/lib.rs @@ -85,13 +85,13 @@ impl NonceSize for T {} /// Type parameters: /// - `C`: block cipher. /// - `M`: size of MAC tag in bytes, valid values: -/// [`U4`][consts::U4], [`U6`][consts::U6], [`U8`][consts::U8], -/// [`U10`][consts::U10], [`U12`][consts::U12], [`U14`][consts::U14], -/// [`U16`][consts::U16]. +/// [`U4`][consts::U4], [`U6`][consts::U6], [`U8`][consts::U8], +/// [`U10`][consts::U10], [`U12`][consts::U12], [`U14`][consts::U14], +/// [`U16`][consts::U16]. /// - `N`: size of nonce, valid values: -/// [`U7`][consts::U7], [`U8`][consts::U8], [`U9`][consts::U9], -/// [`U10`][consts::U10], [`U11`][consts::U11], [`U12`][consts::U12], -/// [`U13`][consts::U13]. +/// [`U7`][consts::U7], [`U8`][consts::U8], [`U9`][consts::U9], +/// [`U10`][consts::U10], [`U11`][consts::U11], [`U12`][consts::U12], +/// [`U13`][consts::U13]. #[derive(Clone)] pub struct Ccm where @@ -335,7 +335,7 @@ fn fill_aad_header(adata_len: usize) -> (usize, Array) { let n = if adata_len < 0xFF00 { b[..2].copy_from_slice(&(adata_len as u16).to_be_bytes()); 2 - } else if adata_len <= core::u32::MAX as usize { + } else if adata_len <= u32::MAX as usize { b[0] = 0xFF; b[1] = 0xFE; b[2..6].copy_from_slice(&(adata_len as u32).to_be_bytes()); diff --git a/ccm/src/private.rs b/ccm/src/private.rs index 658ee028..53a12883 100644 --- a/ccm/src/private.rs +++ b/ccm/src/private.rs @@ -16,7 +16,7 @@ pub trait SealedNonce: Unsigned { // compiler should be able to completely optimize it out let l = Self::get_l() as u128; let v = (1 << (8 * l)) - 1; - core::cmp::min(v, core::usize::MAX as u128) as usize + core::cmp::min(v, usize::MAX as u128) as usize } } diff --git a/ccm/tests/mod.rs b/ccm/tests/mod.rs index 4270a92e..96d3c985 100644 --- a/ccm/tests/mod.rs +++ b/ccm/tests/mod.rs @@ -18,11 +18,11 @@ fn test_data_len_check() { let nonce = Array(nonce); let c = Cipher::new(&key); - let mut buf1 = [1; core::u16::MAX as usize]; + let mut buf1 = [1; u16::MAX as usize]; let res = c.encrypt_in_place_detached(&nonce, &[], &mut buf1); assert!(res.is_ok()); - let mut buf2 = [1; core::u16::MAX as usize + 1]; + let mut buf2 = [1; u16::MAX as usize + 1]; let res = c.encrypt_in_place_detached(&nonce, &[], &mut buf2); assert!(res.is_err()); } diff --git a/chacha20poly1305/src/cipher.rs b/chacha20poly1305/src/cipher.rs index 83dcd271..68cb83f7 100644 --- a/chacha20poly1305/src/cipher.rs +++ b/chacha20poly1305/src/cipher.rs @@ -16,7 +16,7 @@ const BLOCK_SIZE: usize = 64; /// Maximum number of blocks that can be encrypted with ChaCha20 before the /// counter overflows. -const MAX_BLOCKS: usize = core::u32::MAX as usize; +const MAX_BLOCKS: usize = u32::MAX as usize; /// ChaCha20Poly1305 instantiated with a particular nonce pub(crate) struct Cipher