1
1
mirror of https://github.com/henrydcase/pqc.git synced 2024-11-26 17:31:38 +00:00
pqcrypto/crypto_kem/ntruhps4096821/clean/cmov.c
2021-03-24 21:02:46 +00:00

12 lines
283 B
C

#include "cmov.h"
/* b = 1 means mov, b = 0 means don't mov*/
void PQCLEAN_NTRUHPS4096821_CLEAN_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]);
}
}