From ecc38f267f91dffdb8afaaea8d5e5853be72df21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Vejpustek?= Date: Fri, 6 Dec 2024 12:37:44 +0100 Subject: [PATCH] fix(crypto): make ge25519_cmove_stride4b constant time --- .../ed25519-donna/ed25519-donna-impl-base.c | 58 +++++++++++-------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/crypto/ed25519-donna/ed25519-donna-impl-base.c b/crypto/ed25519-donna/ed25519-donna-impl-base.c index b6e435bd2c..5ef7b43863 100644 --- a/crypto/ed25519-donna/ed25519-donna-impl-base.c +++ b/crypto/ed25519-donna/ed25519-donna-impl-base.c @@ -389,18 +389,23 @@ void ge25519_double_scalarmult_vartime2(ge25519 *r, const ge25519 *p1, const big * cause the code to not generate conditional moves. Don't use any -march= * with less than i686 on x86 */ -static void ge25519_cmove_stride4(long * r, long * p, long * pos, long * n, int stride) { - long x0=r[0], x1=r[1], x2=r[2], x3=r[3], y0 = 0, y1 = 0, y2 = 0, y3 = 0; +static void ge25519_cmove_stride4(unsigned long * r, unsigned long * p, unsigned long * pos, unsigned long * n, int stride) { + unsigned long x0=r[0], x1=r[1], x2=r[2], x3=r[3], y0 = 0, y1 = 0, y2 = 0, y3 = 0; for(; p