diff --git a/src/lib.rs b/src/lib.rs
index 93c6bbb..5cdb592 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,7 +1,16 @@
#![no_std]
-#![deny(clippy::pedantic)]
-#![deny(warnings)]
-#![deny(missing_docs)]
+#![deny(clippy::pedantic, warnings, missing_docs, unsafe_code)]
+// Most of the 'allow' category...
+#![deny(absolute_paths_not_starting_with_crate, dead_code)]
+#![deny(elided_lifetimes_in_paths, explicit_outlives_requirements, keyword_idents)]
+#![deny(let_underscore_drop, macro_use_extern_crate, meta_variable_misuse, missing_abi)]
+#![deny(non_ascii_idents, rust_2021_incompatible_closure_captures)]
+#![deny(rust_2021_incompatible_or_patterns, rust_2021_prefixes_incompatible_syntax)]
+#![deny(rust_2021_prelude_collisions, single_use_lifetimes, trivial_casts)]
+#![deny(trivial_numeric_casts, unreachable_pub, unsafe_op_in_unsafe_fn, unstable_features)]
+#![deny(unused_extern_crates, unused_import_braces, unused_lifetimes, unused_macro_rules)]
+#![deny(unused_qualifications, unused_results, variant_size_differences)]
+//
#![doc = include_str!("../README.md")]
// Implements FIPS 205 Stateless Hash-Based Digital Signature Standard.
@@ -209,8 +218,9 @@ macro_rules! functionality {
sig.map(|s| s.serialize())
}
- /// blah!
- /// # Errors
+ /// As of Oct 2 2024, the NIST test vectors are applied to the **internal** functions rather than
+ /// the external API.
+ /// # Errors
fn _test_only_raw_sign(
&self, rng: &mut impl CryptoRngCore, m: &[u8], randomize: bool,
) -> Result<[u8; SIG_LEN], &'static str> {
@@ -259,19 +269,15 @@ macro_rules! functionality {
let sig = SlhDsaSig::::deserialize(sig_bytes);
let mut phm = [0u8; 64]; // hashers don't all play well with each other (varying output size)
let (oid, phm_len) = hash_message(m, ph, &mut phm);
- let mp: &[&[u8]] = &[
- &[1u8],
- &[ctx.len().to_le_bytes()[0]],
- ctx,
- &oid,
- &phm[0..phm_len],
- ];
+ let mp: &[&[u8]] = &[&[1u8], &[ctx.len().to_le_bytes()[0]], ctx, &oid, &phm[0..phm_len]];
let res = crate::slh::slh_verify::(
&HASHERS, &mp, &sig, &self.0,
);
res
}
+ /// As of Oct 2 2024, the NIST test vectors are applied to the **internal** functions rather than
+ /// the external API.
fn _test_only_raw_verify(
&self, m: &[u8], sig_bytes: &[u8; SIG_LEN],
) -> Result {
diff --git a/src/traits.rs b/src/traits.rs
index 76f65c3..43b221d 100644
--- a/src/traits.rs
+++ b/src/traits.rs
@@ -247,8 +247,10 @@ pub trait Signer {
) -> Result;
- /// blah
+ /// As of Oct 2 2024, the NIST test vectors are applied to the **internal** functions rather than
+ /// the external API.
/// # Errors
+ #[deprecated = "Temporary function to allow application of internal nist vectors; will be removed"]
fn _test_only_raw_sign(
&self, rng: &mut impl CryptoRngCore, m: &[u8], randomize: bool,
) -> Result;
@@ -291,15 +293,16 @@ pub trait Verifier {
#[must_use]
fn verify(&self, message: &[u8], signature: &Self::Signature, ctx: &[u8]) -> bool;
-
- /// blah
+ /// blah todo
#[must_use]
fn verify_hash(&self, message: &[u8], signature: &Self::Signature, ctx: &[u8], ph: &Ph)
-> bool;
- /// blah
+ /// As of Oct 2 2024, the NIST test vectors are applied to the **internal** functions rather than
+ /// the external API.
/// # Errors
+ #[deprecated = "Temporary function to allow application of internal nist vectors; will be removed"]
fn _test_only_raw_verify(
&self, m: &[u8], sig_bytes: &Self::Signature,
) -> Result;
diff --git a/src/types.rs b/src/types.rs
index 1a4d405..e3abddf 100644
--- a/src/types.rs
+++ b/src/types.rs
@@ -32,7 +32,7 @@ pub(crate) struct SlhDsaSig<
/// Fig 16 on page 33
#[derive(Clone, Zeroize, ZeroizeOnDrop)]
-pub struct SlhPublicKey {
+pub(crate) struct SlhPublicKey {
pub(crate) pk_seed: [u8; N],
pub(crate) pk_root: [u8; N],
}
@@ -40,7 +40,7 @@ pub struct SlhPublicKey {
/// Fig 15 on page 33
#[derive(Clone, Debug, Zeroize, ZeroizeOnDrop)]
-pub struct SlhPrivateKey {
+pub(crate) struct SlhPrivateKey {
pub(crate) sk_seed: [u8; N],
pub(crate) sk_prf: [u8; N],
pub(crate) pk_seed: [u8; N],
@@ -77,18 +77,18 @@ pub(crate) struct HtSig {
+pub(crate) struct WotsSig {
pub(crate) data: [[u8; N]; LEN],
}
#[derive(Clone, Zeroize, ZeroizeOnDrop)]
-pub struct WotsPk(pub(crate) [u8; N]);
+pub(crate) struct WotsPk(pub(crate) [u8; N]);
/// Fig 11 on page 22
#[derive(Clone, Debug, Zeroize, ZeroizeOnDrop)]
-pub struct XmssSig {
+pub(crate) struct XmssSig {
pub(crate) sig_wots: WotsSig,
pub(crate) auth: [[u8; N]; HP],
}
@@ -112,7 +112,7 @@ pub(crate) const FORS_PRF: u32 = 6;
/// Straddling the line between struct, enum and union...
#[derive(Clone, Default, Zeroize, ZeroizeOnDrop)]
-#[repr(align(32))] // TODO: check alignment size perf/requirements
+#[repr(align(32))] // TODO: check alignment size perf/requirements
pub(crate) struct Adrs {
pub(crate) f0: [u8; 4],
// layer address
diff --git a/src/wots.rs b/src/wots.rs
index e10ff40..a1d0ff8 100644
--- a/src/wots.rs
+++ b/src/wots.rs
@@ -1,5 +1,4 @@
use crate::hashers::Hashers;
-use crate::helpers;
use crate::helpers::{base_2b, to_byte};
use crate::types::{Adrs, WotsPk, WotsSig, WOTS_PK, WOTS_PRF};
@@ -82,8 +81,7 @@ pub(crate) fn wots_pkgen