Skip to content

Commit

Permalink
ct prelim test
Browse files Browse the repository at this point in the history
  • Loading branch information
eschorn1 committed May 22, 2024
1 parent bf2cea7 commit b1d5941
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pub(crate) fn coef_from_three_bytes_vartime<const CTEST: bool>(
///
/// # Errors
/// Returns an error `⊥` on when eta = 4 and b > 8 for rejection sampling. (panics on b > 15)
#[allow(clippy::cast_possible_truncation)] // rem as u8
#[allow(clippy::cast_possible_truncation)] // rem as u8
pub(crate) fn coef_from_half_byte_vartime<const CTEST: bool>(
eta: i32, b: u8,
) -> Result<i32, &'static str> {
Expand Down
8 changes: 6 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,12 +307,16 @@ macro_rules! functionality {
}

// ----- SUPPORT FOR DUDECT CONSTANT TIME MEASUREMENTS ---
/// This function supports the dudect constant-time measurement framework.
///
/// # Errors
/// Returns an error when the random number generator fails; propagates internal errors.
#[cfg(feature = "dudect")]
pub fn dudect_keygen_sign_with_rng(
rng: &mut impl CryptoRngCore, message: &[u8]
rng: &mut impl CryptoRngCore, message: &[u8],
) -> Result<[u8; SIG_LEN], &'static str> {
//let (pk, sk) = KG::try_keygen_with_rng_vt(rng).unwrap();
let (pk, sk) = ml_dsa::key_gen::<true, K, L, PK_LEN, SK_LEN>(rng, ETA)?;
let (_pk, sk) = ml_dsa::key_gen::<true, K, L, PK_LEN, SK_LEN>(rng, ETA)?;
//Ok((PublicKey { 0: pk }, PrivateKey { 0: sk }))
let esk = ml_dsa::sign_start::<true, K, L, SK_LEN>(ETA, &sk)?;
let sig = ml_dsa::sign_finish::<true, K, L, LAMBDA_DIV4, SIG_LEN, SK_LEN>(
Expand Down

0 comments on commit b1d5941

Please sign in to comment.