Skip to content

Commit 79e750f

Browse files
authored
ascon-aead128: enable and fix workspace-level lints (#842)
1 parent 2608e83 commit 79e750f

5 files changed

Lines changed: 20 additions & 9 deletions

File tree

ascon-aead128/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ getrandom = ["aead/getrandom"]
2929
rand_core = ["aead/rand_core"]
3030
zeroize = ["dep:zeroize", "ascon/zeroize"]
3131

32+
[lints]
33+
workspace = true
34+
3235
[package.metadata.docs.rs]
3336
all-features = true
3437
rustdoc-args = ["--cfg", "docsrs"]

ascon-aead128/LICENSE-MIT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Copyright (c) 2021-2023 Sebastian Ramacher <sebastian.ramacher@ait.ac.at>
2-
Copyright (c) 2023 The RustCrypto Project Developers
2+
Copyright (c) 2023-2026 The RustCrypto Project Developers
33

44
Permission is hereby granted, free of charge, to any
55
person obtaining a copy of this software and associated

ascon-aead128/src/asconcore.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ const fn clear(word: u64, n: usize) -> u64 {
2222
// Helper functions to convert &[u8] to u64. Once the `processing_*`
2323
// functions are rewritten with `as_chunks`, they can be dropped.
2424

25+
// Note: function is always called with slices of the correct size
2526
#[inline]
2627
fn u64_from_bytes(input: &[u8]) -> u64 {
27-
// Soundness: function is always called with slices of the correct size
28-
u64::from_le_bytes(input.try_into().unwrap())
28+
debug_assert_eq!(input.len(), 8);
29+
u64::from_le_bytes(input.try_into().expect("input should be 8-bytes long"))
2930
}
3031

3132
#[inline]

ascon-aead128/src/lib.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
#![no_std]
2-
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
2+
#![cfg_attr(docsrs, feature(doc_cfg))]
33
#![doc = include_str!("../README.md")]
44
#![doc(
55
html_logo_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg",
66
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg"
77
)]
8-
#![warn(missing_docs)]
98

109
//! ## Usage
1110
//!
@@ -84,15 +83,15 @@
8483
//! # }
8584
//! ```
8685
86+
mod asconcore;
87+
88+
pub use aead::{self, Error, Key, Nonce, Tag};
8789
#[cfg(feature = "zeroize")]
8890
pub use zeroize;
8991

90-
pub use aead::{self, Error, Key, Nonce, Tag};
9192
use aead::{AeadCore, AeadInOut, KeyInit, KeySizeUser, TagPosition, consts::U16, inout::InOutBuf};
92-
93-
mod asconcore;
94-
9593
use asconcore::{AsconCore, Parameters, Parameters128};
94+
use core::fmt;
9695

9796
/// Ascon generic over some Parameters
9897
///
@@ -207,3 +206,9 @@ impl AeadInOut for AsconAead128 {
207206
.decrypt_inout_detached(nonce, associated_data, buffer, tag)
208207
}
209208
}
209+
210+
impl fmt::Debug for AsconAead128 {
211+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
212+
f.debug_struct("AsconAead128").finish_non_exhaustive()
213+
}
214+
}

ascon-aead128/tests/reference_kats.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Ascon-AEAD128 Known Answer Tests (KATs).
2+
13
use ascon_aead128::AsconAead128;
24

35
// Test vectors are taken from the reference Ascon implementation:

0 commit comments

Comments
 (0)