Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

polyvecl_uniform_gamma1 implementation is different than FIPS204 #97

Open
libo-wu opened this issue Dec 9, 2024 · 0 comments
Open

polyvecl_uniform_gamma1 implementation is different than FIPS204 #97

libo-wu opened this issue Dec 9, 2024 · 0 comments

Comments

@libo-wu
Copy link

libo-wu commented Dec 9, 2024

Hi,

The function polyvecl_uniform_gamma1 is used in the MLDSA sign internal API to perform the ExpandMask functionality. But looks like the XOF input source is different than the FIPS 204 standard.

In FIPS204, ExpandMask(rho, mu) computes the vector y in the iteration over L:

𝑐 ← 1 + bitlen (𝛾1 − 1) 
for 𝑟 from 0 to ℓ − 1 do
  𝜌′ ← 𝜌||IntegerToBytes(𝜇 + 𝑟, 2)
  𝑣 ← H(𝜌′, 32𝑐) // seed depends on 𝜇 + 𝑟
  𝐲[𝑟] ← BitUnpack(𝑣, 𝛾1 − 1, 𝛾1)
  end for
return y

The XOF is performed on the rho || (mu + r).
But in the code polyvecl_uniform_gamma1, the XOF is performed on the rho || (L * mu + r):

void polyvecl_uniform_gamma1(polyvecl *v, const uint8_t seed[CRHBYTES], uint16_t nonce) {
  unsigned int i;

  for(i = 0; i < L; ++i)
    poly_uniform_gamma1(&v->vec[i], seed, L*nonce + i);
}

Could you help check? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant