Skip to content

Commit

Permalink
cleanse like we cleanse ml-kem
Browse files Browse the repository at this point in the history
  • Loading branch information
jakemas committed Dec 5, 2024
1 parent c33b520 commit d04999b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 14 deletions.
10 changes: 0 additions & 10 deletions crypto/dilithium/pqcrystals_dilithium_ref_common/poly.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,6 @@ void poly_uniform(poly *a,
ctr += rej_uniform(a->coeffs + ctr, N - ctr, buf, buflen);
}
/* FIPS 204. Section 3.6.3 Destruction of intermediate values. */
OPENSSL_cleanse(&i, sizeof(i));
OPENSSL_cleanse(&ctr, sizeof(ctr));
OPENSSL_cleanse(&off, sizeof(off));
OPENSSL_cleanse(&buflen, sizeof(buflen));
OPENSSL_cleanse(buf, sizeof(buf));
OPENSSL_cleanse(&state, sizeof(state));
}
Expand Down Expand Up @@ -410,8 +406,6 @@ void poly_uniform_eta(ml_dsa_params *params,
ctr += rej_eta(params, a->coeffs + ctr, N - ctr, buf, STREAM256_BLOCKBYTES);
}
/* FIPS 204. Section 3.6.3 Destruction of intermediate values. */
OPENSSL_cleanse(&ctr, sizeof(ctr));
OPENSSL_cleanse(&buflen, sizeof(buflen));
OPENSSL_cleanse(buf, sizeof(buf));
OPENSSL_cleanse(&state, sizeof(state));
}
Expand Down Expand Up @@ -491,10 +485,6 @@ void poly_challenge(ml_dsa_params *params, poly *c, const uint8_t *seed) {
signs >>= 1;
}
/* FIPS 204. Section 3.6.3 Destruction of intermediate values. */
OPENSSL_cleanse(&i, sizeof(i));
OPENSSL_cleanse(&b, sizeof(pos));
OPENSSL_cleanse(&pos, sizeof(pos));
OPENSSL_cleanse(&signs, sizeof(signs));
OPENSSL_cleanse(buf, sizeof(buf));
OPENSSL_cleanse(&state, sizeof(state));
}
Expand Down
4 changes: 0 additions & 4 deletions crypto/dilithium/pqcrystals_dilithium_ref_common/sign.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ int crypto_sign_signature_internal(ml_dsa_params *params,
*siglen = params->bytes;

/* FIPS 204. Section 3.6.3 Destruction of intermediate values. */
OPENSSL_cleanse(&n, sizeof(n));
OPENSSL_cleanse(seedbuf, sizeof(seedbuf));
OPENSSL_cleanse(&rho, sizeof(rho));
OPENSSL_cleanse(&tr, sizeof(tr));
Expand Down Expand Up @@ -346,8 +345,6 @@ int crypto_sign(ml_dsa_params *params,
}
ret = crypto_sign_signature(params, sm, smlen, sm + params->bytes, mlen, ctx, ctxlen, sk);
*smlen += mlen;
/* FIPS 204. Section 3.6.3 Destruction of intermediate values. */
OPENSSL_cleanse(&i, sizeof(i));
return ret;
}

Expand Down Expand Up @@ -447,7 +444,6 @@ int crypto_sign_verify_internal(ml_dsa_params *params,
}
}
/* FIPS 204. Section 3.6.3 Destruction of intermediate values. */
OPENSSL_cleanse(&i, sizeof(i));
OPENSSL_cleanse(buf, sizeof(buf));
OPENSSL_cleanse(rho, sizeof(rho));
OPENSSL_cleanse(mu, sizeof(mu));
Expand Down

0 comments on commit d04999b

Please sign in to comment.