Skip to content

Commit 56c20ae

Browse files
Rust wrapper: dilithium: remove unnecessary size define presence checks
Fix F-1256
1 parent 5959aa2 commit 56c20ae

2 files changed

Lines changed: 0 additions & 8 deletions

File tree

wrapper/rust/wolfssl-wolfcrypt/build.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,6 @@ fn scan_cfg() -> Result<()> {
461461
check_cfg(&binding, "DILITHIUM_LEVEL2_KEY_SIZE", "dilithium_level2");
462462
check_cfg(&binding, "DILITHIUM_LEVEL3_KEY_SIZE", "dilithium_level3");
463463
check_cfg(&binding, "DILITHIUM_LEVEL5_KEY_SIZE", "dilithium_level5");
464-
check_cfg(&binding, "DILITHIUM_SEED_SZ", "dilithium_make_key_seed_sz");
465-
check_cfg(&binding, "DILITHIUM_RND_SZ", "dilithium_rnd_sz");
466464

467465
/* mlkem / ML-KEM */
468466
check_cfg(&binding, "wc_MlKemKey_Init", "mlkem");

wrapper/rust/wolfssl-wolfcrypt/src/dilithium.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,11 @@ impl Dilithium {
8484

8585
/// Required size in bytes of the seed passed to
8686
/// [`Dilithium::generate_from_seed()`] (`DILITHIUM_SEED_SZ`).
87-
#[cfg(dilithium_make_key_seed_sz)]
8887
pub const DILITHIUM_SEED_SZ: usize = sys::DILITHIUM_SEED_SZ as usize;
8988

9089
/// Required size in bytes of the seed passed to signing-with-seed
9190
/// functions such as [`Dilithium::sign_msg_with_seed()`]
9291
/// (`DILITHIUM_RND_SZ`).
93-
#[cfg(dilithium_rnd_sz)]
9492
pub const SIGN_SEED_SIZE: usize = sys::DILITHIUM_RND_SZ as usize;
9593

9694
/// Private (secret) key size in bytes for ML-DSA-44.
@@ -277,7 +275,6 @@ impl Dilithium {
277275
heap: Option<*mut core::ffi::c_void>,
278276
dev_id: Option<i32>,
279277
) -> Result<Self, i32> {
280-
#[cfg(dilithium_make_key_seed_sz)]
281278
if seed.len() != Self::DILITHIUM_SEED_SZ {
282279
return Err(sys::wolfCrypt_ErrorCodes_BUFFER_E);
283280
}
@@ -1032,7 +1029,6 @@ impl Dilithium {
10321029
sig: &mut [u8],
10331030
seed: &[u8],
10341031
) -> Result<usize, i32> {
1035-
#[cfg(dilithium_rnd_sz)]
10361032
if seed.len() != sys::DILITHIUM_RND_SZ as usize {
10371033
return Err(sys::wolfCrypt_ErrorCodes_BUFFER_E);
10381034
}
@@ -1077,7 +1073,6 @@ impl Dilithium {
10771073
if ctx.len() > 255 {
10781074
return Err(sys::wolfCrypt_ErrorCodes_BUFFER_E);
10791075
}
1080-
#[cfg(dilithium_rnd_sz)]
10811076
if seed.len() != sys::DILITHIUM_RND_SZ as usize {
10821077
return Err(sys::wolfCrypt_ErrorCodes_BUFFER_E);
10831078
}
@@ -1126,7 +1121,6 @@ impl Dilithium {
11261121
if ctx.len() > 255 {
11271122
return Err(sys::wolfCrypt_ErrorCodes_BUFFER_E);
11281123
}
1129-
#[cfg(dilithium_rnd_sz)]
11301124
if seed.len() != sys::DILITHIUM_RND_SZ as usize {
11311125
return Err(sys::wolfCrypt_ErrorCodes_BUFFER_E);
11321126
}

0 commit comments

Comments
 (0)