Skip to content

Commit

Permalink
All parameters RSB-check.
Browse files Browse the repository at this point in the history
  • Loading branch information
xvzcf committed Dec 18, 2024
1 parent f969bb4 commit a67d2bf
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions ref/ml_dsa_44/arithmetic/rounding.jinc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ namespace coefficient {
return low_bits, high_bits;
}

inline
fn use_hint(reg u32 a hint, reg u64 msf) -> reg u32, #msf reg u64 {
reg u32 high_bits low_bits;

Expand Down
3 changes: 2 additions & 1 deletion ref/ml_dsa_44/encoding/gamma1.jinc
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ namespace gamma1 {
return encoded;
}

inline
fn decode_to_polynomial(
reg ptr u8[ENCODED_GAMMA1_POLYNOMIAL_SIZE] bytes,
reg ptr u32[COEFFICIENTS_IN_POLYNOMIAL] polynomial
Expand Down Expand Up @@ -203,7 +204,7 @@ namespace gamma1 {

inline
fn decode(
reg ptr u8[GAMMA1_ENCODED_SIZE] encoded,
#spill_to_mmx reg ptr u8[GAMMA1_ENCODED_SIZE] encoded,
reg ptr u32[COLUMNS_IN_MATRIX_A * COEFFICIENTS_IN_POLYNOMIAL] decoded
) -> reg ptr u32[COLUMNS_IN_MATRIX_A * COEFFICIENTS_IN_POLYNOMIAL]
{
Expand Down
1 change: 1 addition & 0 deletions ref/ml_dsa_87/arithmetic/rounding.jinc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ namespace coefficient {
return low_bits, high_bits;
}

inline
fn use_hint(reg u32 a hint, reg u64 msf) -> reg u32, #msf reg u64 {
reg u32 a0;
reg u32 a1;
Expand Down
16 changes: 9 additions & 7 deletions ref/ml_dsa_87/encoding/commitment.jinc
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
require "../parameters.jinc"

namespace commitment {
inline
fn encode_polynomial(
reg ptr u8[ENCODED_COMMITMENT_POLYNOMIAL_SIZE] encoded,
reg ptr u32[COEFFICIENTS_IN_POLYNOMIAL] polynomial
reg ptr u32[COEFFICIENTS_IN_POLYNOMIAL] polynomial,
reg ptr u8[ENCODED_COMMITMENT_POLYNOMIAL_SIZE] encoded
) -> reg ptr u8[ENCODED_COMMITMENT_POLYNOMIAL_SIZE]
{
reg u64 i = 0;
Expand All @@ -29,15 +30,16 @@ namespace commitment {
-> stack u8[ENCODED_COMMITMENT_SIZE]
{
stack u8[ENCODED_COMMITMENT_SIZE] encoded_commitment;
reg ptr u8[ENCODED_COMMITMENT_POLYNOMIAL_SIZE] encoded_polynomial;
reg ptr u32[COEFFICIENTS_IN_POLYNOMIAL] polynomial;

inline int i;

for i = 0 to ROWS_IN_MATRIX_A {
encoded_polynomial = encoded_commitment[i * ENCODED_COMMITMENT_POLYNOMIAL_SIZE : ENCODED_COMMITMENT_POLYNOMIAL_SIZE];
polynomial = commitment[i * COEFFICIENTS_IN_POLYNOMIAL : COEFFICIENTS_IN_POLYNOMIAL];
encoded_commitment[i * ENCODED_COMMITMENT_POLYNOMIAL_SIZE : ENCODED_COMMITMENT_POLYNOMIAL_SIZE] = encode_polynomial(encoded_polynomial, polynomial);
encoded_commitment[i * ENCODED_COMMITMENT_POLYNOMIAL_SIZE :
ENCODED_COMMITMENT_POLYNOMIAL_SIZE] =
encode_polynomial(
commitment[i * COEFFICIENTS_IN_POLYNOMIAL : COEFFICIENTS_IN_POLYNOMIAL],
encoded_commitment[i * ENCODED_COMMITMENT_POLYNOMIAL_SIZE : ENCODED_COMMITMENT_POLYNOMIAL_SIZE]
);
}

return encoded_commitment;
Expand Down
1 change: 1 addition & 0 deletions ref/ml_dsa_87/encoding/gamma1.jinc
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ namespace gamma1 {
return encoded;
}

inline
fn decode_to_polynomial(
reg ptr u8[ENCODED_GAMMA1_POLYNOMIAL_SIZE] bytes,
reg ptr u32[COEFFICIENTS_IN_POLYNOMIAL] polynomial
Expand Down

0 comments on commit a67d2bf

Please sign in to comment.