pqc/crypto_kem/ntruhrss701/avx2/cmov.c
2020-08-24 09:47:30 -04:00

12 lines
279 B
C

#include "cmov.h"
/* b = 1 means mov, b = 0 means don't mov*/
void PQCLEAN_NTRUHRSS701_AVX2_cmov(unsigned char *r, const unsigned char *x, size_t len, unsigned char b) {
size_t i;
b = (~b + 1);
for (i = 0; i < len; i++) {
r[i] ^= b & (x[i] ^ r[i]);
}
}