From 441c0519a07e8b86c8d079954a6b10bd31d29efc Mon Sep 17 00:00:00 2001 From: Peter Schwabe Date: Mon, 3 Jun 2024 09:05:02 +0200 Subject: [PATCH] Added comment description of cmov_int16 --- ref/verify.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ref/verify.c b/ref/verify.c index 0fc007c4..4bcb1e5f 100644 --- a/ref/verify.c +++ b/ref/verify.c @@ -56,7 +56,17 @@ void cmov(uint8_t *r, const uint8_t *x, size_t len, uint8_t b) r[i] ^= b & (r[i] ^ x[i]); } - +/************************************************* +* Name: cmov_int16 +* +* Description: Copy input v to *r if b is 1, don't modify *r if b is 0. +* Requires b to be in {0,1}; +* Runs in constant time. +* +* Arguments: int16_t *r: pointer to output int16_t +* int16_t v: input int16_t +* uint8_t b: Condition bit; has to be in {0,1} +**************************************************/ void cmov_int16(int16_t *r, int16_t v, uint16_t b) { b = -b;