From: Loup Vaillant Date: Mon, 9 Mar 2020 19:40:24 +0000 (+0100) Subject: Typo, comment fe_isnegative() X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=dae1fdba96f806dd19ac319653a7fdff71796492;p=Monocypher.git Typo, comment fe_isnegative() --- diff --git a/src/monocypher.c b/src/monocypher.c index 7af9030..266eadd 100644 --- a/src/monocypher.c +++ b/src/monocypher.c @@ -1316,6 +1316,11 @@ static int fe_isodd(const fe f) return isodd; } +// Returns 0 if f <= (p-1)/2, 1 otherwise. +// "Positive" means between 0 and (p-1)/2 +// "Negative" means between (p+1)/2 and p-1 +// Since p is odd (2^255 - 19), the sign is easily tested by leveraging +// overflow: for any f in [0..p[, (2*f)%p is odd iff 2*f > p static int fe_isnegative(const fe f) { fe tmp; @@ -1335,7 +1340,7 @@ static int fe_isnonzero(const fe f) return -isnonzero; } -// Returns 1 if equal, 0 of not equal +// Returns 1 if equal, 0 if not equal static int fe_isequal(const fe f, const fe g) { fe diff;