Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
reneme committed Aug 15, 2024
1 parent 1211151 commit f80b12a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ class DilithiumPolyTraits final : public CRYSTALS::Trait_Base<DilithiumConstants
private:
friend class CRYSTALS::Trait_Base<DilithiumConstants, DilithiumPolyTraits>;

/**
* NIST FIPS 204 IPD, Algorithm 37 (Montgomery_Reduce)
*/
static constexpr T montgomery_reduce_coefficient(T2 a) {
const T2 t = static_cast<T>(static_cast<T2>(static_cast<T>(a)) * Q_inverse);
return (a - static_cast<T2>(t) * Q) >> (sizeof(T) * 8);
Expand All @@ -40,7 +37,7 @@ class DilithiumPolyTraits final : public CRYSTALS::Trait_Base<DilithiumConstants

public:
/**
* NIST FIPS 204 IPD, Algorithm 35 (NTT)
* NIST FIPS 204, Algorithm 41 (NTT)
*
* Note: ntt(), inverse_ntt() and operator* have side effects on the
* montgomery factor of the involved coefficients!
Expand Down Expand Up @@ -68,7 +65,7 @@ class DilithiumPolyTraits final : public CRYSTALS::Trait_Base<DilithiumConstants
}

/**
* NIST FIPS 204 IPD, Algorithm 36 (NTT^-1).
* NIST FIPS 204, Algorithm 42 (NTT^-1).
*
* The output is effectively multiplied by the montgomery parameter 2^32
* mod q so that the input factors 2^(-32) mod q are eliminated. Note
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ class Dilithium_ML_DSA_IPD_Symmetric_Primitives : public Dilithium_Common_Symmet

StrongSpan<const DilithiumCommitmentHash> truncate_commitment_hash(
StrongSpan<const DilithiumCommitmentHash> seed) const override {
// TODO: ML-DSA does not truncate the commitment hash
// TODO: ML-DSA does not truncate the commitment hash, so we could
// simply "return seed" here;
return StrongSpan<const DilithiumCommitmentHash>(
seed.get().first(DilithiumConstants::COMMITMENT_HASH_C1_BYTES));
};
Expand Down

0 comments on commit f80b12a

Please sign in to comment.