polish dilithium
This commit is contained in:
parent
d5818a40b0
commit
2d2211791f
@ -180,11 +180,6 @@ int PQCLEAN_DILITHIUM2_CLEAN_crypto_sign_signature(
|
|||||||
shake256_inc_finalize(&state);
|
shake256_inc_finalize(&state);
|
||||||
shake256_inc_squeeze(mu, CRHBYTES, &state);
|
shake256_inc_squeeze(mu, CRHBYTES, &state);
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < CRHBYTES; ++i) {
|
|
||||||
sig[CRYPTO_BYTES - CRHBYTES + i] = tr[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
crh(rhoprime, key, SEEDBYTES + CRHBYTES);
|
crh(rhoprime, key, SEEDBYTES + CRHBYTES);
|
||||||
|
|
||||||
/* Expand matrix and transform vectors */
|
/* Expand matrix and transform vectors */
|
||||||
@ -286,19 +281,15 @@ int PQCLEAN_DILITHIUM2_CLEAN_crypto_sign_verify(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Compute CRH(CRH(rho, t1), msg) */
|
/* Compute CRH(CRH(rho, t1), msg) */
|
||||||
shake256incctx state;
|
crh(mu, pk, CRYPTO_PUBLICKEYBYTES);
|
||||||
shake256_inc_init(&state);
|
|
||||||
shake256_inc_absorb(&state, pk, CRYPTO_PUBLICKEYBYTES);
|
|
||||||
shake256_inc_finalize(&state);
|
|
||||||
shake256_inc_squeeze(mu, CRHBYTES, &state);
|
|
||||||
|
|
||||||
|
shake256incctx state;
|
||||||
shake256_inc_init(&state);
|
shake256_inc_init(&state);
|
||||||
shake256_inc_absorb(&state, mu, CRHBYTES);
|
shake256_inc_absorb(&state, mu, CRHBYTES);
|
||||||
shake256_inc_absorb(&state, m, mlen);
|
shake256_inc_absorb(&state, m, mlen);
|
||||||
shake256_inc_finalize(&state);
|
shake256_inc_finalize(&state);
|
||||||
shake256_inc_squeeze(mu, CRHBYTES, &state);
|
shake256_inc_squeeze(mu, CRHBYTES, &state);
|
||||||
|
|
||||||
|
|
||||||
/* Matrix-vector multiplication; compute Az - c2^dt1 */
|
/* Matrix-vector multiplication; compute Az - c2^dt1 */
|
||||||
PQCLEAN_DILITHIUM2_CLEAN_expand_mat(mat, rho);
|
PQCLEAN_DILITHIUM2_CLEAN_expand_mat(mat, rho);
|
||||||
|
|
||||||
|
@ -180,11 +180,6 @@ int PQCLEAN_DILITHIUM3_CLEAN_crypto_sign_signature(
|
|||||||
shake256_inc_finalize(&state);
|
shake256_inc_finalize(&state);
|
||||||
shake256_inc_squeeze(mu, CRHBYTES, &state);
|
shake256_inc_squeeze(mu, CRHBYTES, &state);
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < CRHBYTES; ++i) {
|
|
||||||
sig[CRYPTO_BYTES - CRHBYTES + i] = tr[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
crh(rhoprime, key, SEEDBYTES + CRHBYTES);
|
crh(rhoprime, key, SEEDBYTES + CRHBYTES);
|
||||||
|
|
||||||
/* Expand matrix and transform vectors */
|
/* Expand matrix and transform vectors */
|
||||||
@ -286,19 +281,15 @@ int PQCLEAN_DILITHIUM3_CLEAN_crypto_sign_verify(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Compute CRH(CRH(rho, t1), msg) */
|
/* Compute CRH(CRH(rho, t1), msg) */
|
||||||
shake256incctx state;
|
crh(mu, pk, CRYPTO_PUBLICKEYBYTES);
|
||||||
shake256_inc_init(&state);
|
|
||||||
shake256_inc_absorb(&state, pk, CRYPTO_PUBLICKEYBYTES);
|
|
||||||
shake256_inc_finalize(&state);
|
|
||||||
shake256_inc_squeeze(mu, CRHBYTES, &state);
|
|
||||||
|
|
||||||
|
shake256incctx state;
|
||||||
shake256_inc_init(&state);
|
shake256_inc_init(&state);
|
||||||
shake256_inc_absorb(&state, mu, CRHBYTES);
|
shake256_inc_absorb(&state, mu, CRHBYTES);
|
||||||
shake256_inc_absorb(&state, m, mlen);
|
shake256_inc_absorb(&state, m, mlen);
|
||||||
shake256_inc_finalize(&state);
|
shake256_inc_finalize(&state);
|
||||||
shake256_inc_squeeze(mu, CRHBYTES, &state);
|
shake256_inc_squeeze(mu, CRHBYTES, &state);
|
||||||
|
|
||||||
|
|
||||||
/* Matrix-vector multiplication; compute Az - c2^dt1 */
|
/* Matrix-vector multiplication; compute Az - c2^dt1 */
|
||||||
PQCLEAN_DILITHIUM3_CLEAN_expand_mat(mat, rho);
|
PQCLEAN_DILITHIUM3_CLEAN_expand_mat(mat, rho);
|
||||||
|
|
||||||
|
@ -180,11 +180,6 @@ int PQCLEAN_DILITHIUM4_CLEAN_crypto_sign_signature(
|
|||||||
shake256_inc_finalize(&state);
|
shake256_inc_finalize(&state);
|
||||||
shake256_inc_squeeze(mu, CRHBYTES, &state);
|
shake256_inc_squeeze(mu, CRHBYTES, &state);
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < CRHBYTES; ++i) {
|
|
||||||
sig[CRYPTO_BYTES - CRHBYTES + i] = tr[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
crh(rhoprime, key, SEEDBYTES + CRHBYTES);
|
crh(rhoprime, key, SEEDBYTES + CRHBYTES);
|
||||||
|
|
||||||
/* Expand matrix and transform vectors */
|
/* Expand matrix and transform vectors */
|
||||||
@ -286,19 +281,15 @@ int PQCLEAN_DILITHIUM4_CLEAN_crypto_sign_verify(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Compute CRH(CRH(rho, t1), msg) */
|
/* Compute CRH(CRH(rho, t1), msg) */
|
||||||
shake256incctx state;
|
crh(mu, pk, CRYPTO_PUBLICKEYBYTES);
|
||||||
shake256_inc_init(&state);
|
|
||||||
shake256_inc_absorb(&state, pk, CRYPTO_PUBLICKEYBYTES);
|
|
||||||
shake256_inc_finalize(&state);
|
|
||||||
shake256_inc_squeeze(mu, CRHBYTES, &state);
|
|
||||||
|
|
||||||
|
shake256incctx state;
|
||||||
shake256_inc_init(&state);
|
shake256_inc_init(&state);
|
||||||
shake256_inc_absorb(&state, mu, CRHBYTES);
|
shake256_inc_absorb(&state, mu, CRHBYTES);
|
||||||
shake256_inc_absorb(&state, m, mlen);
|
shake256_inc_absorb(&state, m, mlen);
|
||||||
shake256_inc_finalize(&state);
|
shake256_inc_finalize(&state);
|
||||||
shake256_inc_squeeze(mu, CRHBYTES, &state);
|
shake256_inc_squeeze(mu, CRHBYTES, &state);
|
||||||
|
|
||||||
|
|
||||||
/* Matrix-vector multiplication; compute Az - c2^dt1 */
|
/* Matrix-vector multiplication; compute Az - c2^dt1 */
|
||||||
PQCLEAN_DILITHIUM4_CLEAN_expand_mat(mat, rho);
|
PQCLEAN_DILITHIUM4_CLEAN_expand_mat(mat, rho);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user