-
Notifications
You must be signed in to change notification settings - Fork 169
Description
The current HQC implementation still contains the timing side-channel vulnerable rejection sampling, whose running time is dependent on the seed that is derived from the secret message.
PQClean/crypto_kem/hqc-rmrs-128/avx2/vector.c
Lines 49 to 54 in f1ef566
| while (i < weight) { | |
| do { | |
| if (j == random_bytes_size) { | |
| seedexpander(ctx, rand_bytes, random_bytes_size); | |
| j = 0; | |
| } |
See here for details.
There's a new round 4 submission that uses Sendrier's countermeasure (see vector.c).
Unfortunately with gcc the modulo reductions in the loop compile to divide instructions, which might not be constant-time.
clang successfully compiles the modulo reductions down to (I believe) Barrett reductions (which don't use div instructions).
I don't know how practical it is however to exploit any leakage from this on x86, however the clean version which might be used to target microprocessors where division might be very leaky.
One could manually inline the assembly to ensure that the timing behavior of the implementation doesn't depend on whether the compiler is having a good day or not 🙂
