memsan: enable kyber in bench
This commit is contained in:
parent
ea54cd3ea9
commit
e4eff10297
@ -289,7 +289,7 @@ void PQCLEAN_KYBER512_AVX2_indcpa_enc(uint8_t c[KYBER_INDCPA_BYTES],
|
|||||||
const uint8_t coins[KYBER_SYMBYTES]) {
|
const uint8_t coins[KYBER_SYMBYTES]) {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
uint8_t seed[KYBER_SYMBYTES];
|
uint8_t seed[KYBER_SYMBYTES];
|
||||||
polyvec sp, pkpv, ep, at[KYBER_K], b;
|
polyvec sp, pkpv, ep, at[KYBER_K], b = {0};
|
||||||
poly v, k, epp;
|
poly v, k, epp;
|
||||||
|
|
||||||
unpack_pk(&pkpv, seed, pk);
|
unpack_pk(&pkpv, seed, pk);
|
||||||
|
@ -51,9 +51,9 @@ int PQCLEAN_KYBER512_AVX2_crypto_kem_keypair(unsigned char pk[KYBER_PUBLICKEYBYT
|
|||||||
int PQCLEAN_KYBER512_AVX2_crypto_kem_enc(unsigned char ct[KYBER_CIPHERTEXTBYTES],
|
int PQCLEAN_KYBER512_AVX2_crypto_kem_enc(unsigned char ct[KYBER_CIPHERTEXTBYTES],
|
||||||
unsigned char ss[KYBER_SSBYTES],
|
unsigned char ss[KYBER_SSBYTES],
|
||||||
const unsigned char pk[KYBER_PUBLICKEYBYTES]) {
|
const unsigned char pk[KYBER_PUBLICKEYBYTES]) {
|
||||||
uint8_t buf[2 * KYBER_SYMBYTES];
|
uint8_t buf[2 * KYBER_SYMBYTES] = {0};
|
||||||
/* Will contain key, coins */
|
/* Will contain key, coins */
|
||||||
uint8_t kr[2 * KYBER_SYMBYTES];
|
uint8_t kr[2 * KYBER_SYMBYTES] = {0};
|
||||||
|
|
||||||
randombytes(buf, KYBER_SYMBYTES);
|
randombytes(buf, KYBER_SYMBYTES);
|
||||||
/* Don't release system RNG output */
|
/* Don't release system RNG output */
|
||||||
|
@ -182,7 +182,7 @@ void PQCLEAN_KYBER512_AVX2_polyvec_invntt_tomont(polyvec *r) {
|
|||||||
**************************************************/
|
**************************************************/
|
||||||
void PQCLEAN_KYBER512_AVX2_polyvec_basemul_acc_montgomery(poly *r, const polyvec *a, const polyvec *b) {
|
void PQCLEAN_KYBER512_AVX2_polyvec_basemul_acc_montgomery(poly *r, const polyvec *a, const polyvec *b) {
|
||||||
size_t i;
|
size_t i;
|
||||||
poly tmp;
|
poly tmp = {0};
|
||||||
|
|
||||||
PQCLEAN_KYBER512_AVX2_poly_basemul_montgomery(r, &a->vec[0], &b->vec[0]);
|
PQCLEAN_KYBER512_AVX2_poly_basemul_montgomery(r, &a->vec[0], &b->vec[0]);
|
||||||
for (i = 1; i < KYBER_K; i++) {
|
for (i = 1; i < KYBER_K; i++) {
|
||||||
|
@ -59,7 +59,6 @@ static void BenchKyberKeygen(benchmark::State &st) {
|
|||||||
cpucycle(st, total);
|
cpucycle(st, total);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef PQC_MEMSAN_BUILD
|
|
||||||
static void BenchKyberEncaps(benchmark::State &st) {
|
static void BenchKyberEncaps(benchmark::State &st) {
|
||||||
int64_t t, total = 0;
|
int64_t t, total = 0;
|
||||||
uint8_t sk[1632];
|
uint8_t sk[1632];
|
||||||
@ -92,7 +91,6 @@ static void BenchKyberDecaps(benchmark::State &st) {
|
|||||||
}
|
}
|
||||||
cpucycle(st, total);
|
cpucycle(st, total);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static void BenchKyberBaseMulAVX(benchmark::State &st) {
|
static void BenchKyberBaseMulAVX(benchmark::State &st) {
|
||||||
int64_t t, total = 0;
|
int64_t t, total = 0;
|
||||||
@ -126,7 +124,5 @@ BENCHMARK(BenchKyberBaseMulAVX);
|
|||||||
BENCHMARK(BenchKyberNttAVX);
|
BENCHMARK(BenchKyberNttAVX);
|
||||||
|
|
||||||
// TODO: not sure why but memcheck fails in INDCPA encryption
|
// TODO: not sure why but memcheck fails in INDCPA encryption
|
||||||
#ifndef PQC_MEMSAN_BUILD
|
|
||||||
BENCHMARK(BenchKyberEncaps);
|
BENCHMARK(BenchKyberEncaps);
|
||||||
BENCHMARK(BenchKyberDecaps);
|
BENCHMARK(BenchKyberDecaps);
|
||||||
#endif
|
|
||||||
|
Loading…
Reference in New Issue
Block a user