Skip to content

Commit

Permalink
small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jlmucb committed Apr 28, 2024
1 parent 6085cc7 commit 8d633f1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions v2/kyber/kyber.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ bool kyber_keygen(int g, kyber_parameters& p, int* ek_len, byte* ek,
}
pek += 384;
}
memcpy(pek, parameters, 32);
memcpy(pek, rho, 32);
*ek_len = t_ntt.dim_ * 384 + 32;

// dk := byte_encode(12) (s^)
Expand Down Expand Up @@ -1545,7 +1545,7 @@ bool kyber_decrypt(int g, kyber_parameters& p, int dk_len, byte* dk,
}

module_vector u_ntt(p.q_, p.n_, p.k_);
coefficient_vector tw(p.q_, p.n_);
coefficient_vector w_ntt(p.q_, p.n_);
coefficient_vector w(p.q_, p.n_);
coefficient_vector compressed_w(p.q_, p.n_);

Expand All @@ -1558,11 +1558,11 @@ bool kyber_decrypt(int g, kyber_parameters& p, int dk_len, byte* dk,
}

// Compute w = nu - ntt_inv(s_ntt dot ntt(u))
if (!ntt_module_vector_dot_product(s_ntt, u_ntt, &tw)) {
if (!ntt_module_vector_dot_product(s_ntt, u_ntt, &w_ntt)) {
printf("kyber_decrypt: ntt_module_vector_dot_product failed\n");
return false;
}
if (!ntt_inv(g, tw, &w)) {
if (!ntt_inv(g, w_ntt, &w)) {
printf("kyber_decrypt: ntt_inv failed\n");
return false;
}
Expand Down

0 comments on commit 8d633f1

Please sign in to comment.