Skip to content

Commit

Permalink
Extend Valgrind's constant-time test
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklonga committed Jun 11, 2022
1 parent 753cfb4 commit e7b23c3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/sike.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ int crypto_kem_dec(unsigned char *ss, const unsigned char *ct, const unsigned ch
if (!EphemeralSecretAgreement_B_extended(sk + MSG_BYTES, ct, jinvariant_, 1) == 0) {
goto Hashing;
}
#ifdef DO_VALGRIND_CHECK
VALGRIND_MAKE_MEM_UNDEFINED(ct, CRYPTO_CIPHERTEXTBYTES);
#endif
shake256(h_, MSG_BYTES, jinvariant_, FP2_ENCODED_BYTES);
for (int i = 0; i < MSG_BYTES; i++) {
temp[i] = ct[i + CRYPTO_PUBLICKEYBYTES] ^ h_[i];
Expand All @@ -121,6 +124,7 @@ int crypto_kem_dec(unsigned char *ss, const unsigned char *ct, const unsigned ch

#ifdef DO_VALGRIND_CHECK
VALGRIND_MAKE_MEM_DEFINED(sk, MSG_BYTES + SECRETKEY_B_BYTES);
VALGRIND_MAKE_MEM_DEFINED(ct, CRYPTO_CIPHERTEXTBYTES);
#endif
return 0;
}

0 comments on commit e7b23c3

Please sign in to comment.