* cipher/mceliece6688128f.c (sync_cmp): Use const-time helper for
comparison.
--

Signed-off-by: Jussi Kivilinna <[email protected]>
---
 cipher/mceliece6688128f.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/cipher/mceliece6688128f.c b/cipher/mceliece6688128f.c
index 4c4eb0bd..a8655672 100644
--- a/cipher/mceliece6688128f.c
+++ b/cipher/mceliece6688128f.c
@@ -2053,14 +2053,7 @@ static int weight_check(unsigned char * e, vec * error)
 
 static uint16_t synd_cmp(vec s0[][ GFBITS ] , vec s1[][ GFBITS ])
 {
-       int i, j;
-       vec diff = 0;
-
-       for (i = 0; i < 4; i++)
-       for (j = 0; j < GFBITS; j++)
-               diff |= (s0[i][j] ^ s1[i][j]);
-
-       return vec_testz(diff);
+       return _gcry_ct_memequal(s0, s1, sizeof(vec) * 4 * GFBITS);
 }
 
 /* Niederreiter decryption with the Berlekamp decoder */
-- 
2.48.1


_______________________________________________
Gcrypt-devel mailing list
[email protected]
https://lists.gnupg.org/mailman/listinfo/gcrypt-devel

Reply via email to