From 03596d47050a3199f7bb9d4da16d6b875777075c Mon Sep 17 00:00:00 2001 From: "Matthias J. Kannwischer" Date: Tue, 18 Jun 2019 12:07:48 +0200 Subject: [PATCH] another vs warning --- crypto_kem/saber/clean/verify.c | 4 ++-- crypto_kem/saber/clean/verify.h | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/crypto_kem/saber/clean/verify.c b/crypto_kem/saber/clean/verify.c index 2c0f3e07..ac464863 100644 --- a/crypto_kem/saber/clean/verify.c +++ b/crypto_kem/saber/clean/verify.c @@ -9,7 +9,7 @@ Vadim Lyubashevsky, John M. Schanck, Peter Schwabe & Damien stehle #include /* returns 0 for equal strings, 1 for non-equal strings */ -int PQCLEAN_SABER_CLEAN_verify(const unsigned char *a, const unsigned char *b, size_t len) { +unsigned char PQCLEAN_SABER_CLEAN_verify(const unsigned char *a, const unsigned char *b, size_t len) { uint64_t r; size_t i; r = 0; @@ -19,7 +19,7 @@ int PQCLEAN_SABER_CLEAN_verify(const unsigned char *a, const unsigned char *b, s } r = (-r) >> 63; - return r; + return (unsigned char) r; } /* b = 1 means mov, b = 0 means don't mov*/ diff --git a/crypto_kem/saber/clean/verify.h b/crypto_kem/saber/clean/verify.h index 8c0450a4..baea8be7 100644 --- a/crypto_kem/saber/clean/verify.h +++ b/crypto_kem/saber/clean/verify.h @@ -9,9 +9,10 @@ Vadim Lyubashevsky, John M. Schanck, Peter Schwabe & Damien stehle #define VERIFY_H #include +#include /* returns 0 for equal strings, 1 for non-equal strings */ -int PQCLEAN_SABER_CLEAN_verify(const unsigned char *a, const unsigned char *b, size_t len); +unsigned char PQCLEAN_SABER_CLEAN_verify(const unsigned char *a, const unsigned char *b, size_t len); /* b = 1 means mov, b = 0 means don't mov*/ void PQCLEAN_SABER_CLEAN_cmov(unsigned char *r, const unsigned char *x, size_t len, unsigned char b);