diff --git a/crypto_sign/falcon-1024/clean/Makefile.Microsoft_nmake b/crypto_sign/falcon-1024/clean/Makefile.Microsoft_nmake index 108e458d..37731081 100644 --- a/crypto_sign/falcon-1024/clean/Makefile.Microsoft_nmake +++ b/crypto_sign/falcon-1024/clean/Makefile.Microsoft_nmake @@ -3,7 +3,12 @@ LIBRARY=libfalcon-1024_clean.lib OBJECTS=codec.obj common.obj fft.obj fpr.obj keygen.obj pqclean.obj rng.obj sign.obj vrfy.obj -CFLAGS=/nologo /I ..\..\..\common /W4 /WX + +# Warning C4146 is raised when a unary minus operator is applied to an +# unsigned type; this has nonetheless been standard and portable for as +# long as there has been a C standard, and we do that a lot, especially +# for constant-time computations. Thus, we disable that spurious warning. +CFLAGS=/nologo /I ..\..\..\common /W4 /wd4146 /WX all: $(LIBRARY) diff --git a/crypto_sign/falcon-1024/clean/common.c b/crypto_sign/falcon-1024/clean/common.c index 065053c0..7dc8ad20 100644 --- a/crypto_sign/falcon-1024/clean/common.c +++ b/crypto_sign/falcon-1024/clean/common.c @@ -140,7 +140,7 @@ PQCLEAN_FALCON1024_CLEAN_hash_to_point( v = 0; for (u = 0; u < m; u ++) { uint16_t *s, *d; - unsigned j, sv, dv, m; + unsigned j, sv, dv, mk; if (u < n) { s = &x[u]; @@ -160,11 +160,11 @@ PQCLEAN_FALCON1024_CLEAN_hash_to_point( /* * We increment v for the next iteration, but * only if the source value is valid. The mask - * 'm' is -1 if the value is valid, 0 otherwise, - * so we _subtract_ m. + * 'mk' is -1 if the value is valid, 0 otherwise, + * so we _subtract_ mk. */ - m = (sv >> 15) - 1U; - v -= m; + mk = (sv >> 15) - 1U; + v -= mk; /* * In this loop we consider jumps by p slots; if @@ -190,10 +190,10 @@ PQCLEAN_FALCON1024_CLEAN_hash_to_point( * The swap should be performed only if the source * is valid AND the jump j has its 'p' bit set. */ - m &= -(((j & p) + 0x1FF) >> 9); + mk &= -(((j & p) + 0x1FF) >> 9); - *s = (uint16_t)(sv ^ (m & (sv ^ dv))); - *d = (uint16_t)(dv ^ (m & (sv ^ dv))); + *s = (uint16_t)(sv ^ (mk & (sv ^ dv))); + *d = (uint16_t)(dv ^ (mk & (sv ^ dv))); } } diff --git a/crypto_sign/falcon-512/clean/Makefile.Microsoft_nmake b/crypto_sign/falcon-512/clean/Makefile.Microsoft_nmake index 7f35ac28..c3589bb4 100644 --- a/crypto_sign/falcon-512/clean/Makefile.Microsoft_nmake +++ b/crypto_sign/falcon-512/clean/Makefile.Microsoft_nmake @@ -3,7 +3,12 @@ LIBRARY=libfalcon-512_clean.lib OBJECTS=codec.obj common.obj fft.obj fpr.obj keygen.obj pqclean.obj rng.obj sign.obj vrfy.obj -CFLAGS=/nologo /I ..\..\..\common /W4 /WX + +# Warning C4146 is raised when a unary minus operator is applied to an +# unsigned type; this has nonetheless been standard and portable for as +# long as there has been a C standard, and we do that a lot, especially +# for constant-time computations. Thus, we disable that spurious warning. +CFLAGS=/nologo /I ..\..\..\common /W4 /wd4146 /WX all: $(LIBRARY) diff --git a/crypto_sign/falcon-512/clean/common.c b/crypto_sign/falcon-512/clean/common.c index bf17fe28..e46a4eb5 100644 --- a/crypto_sign/falcon-512/clean/common.c +++ b/crypto_sign/falcon-512/clean/common.c @@ -140,7 +140,7 @@ PQCLEAN_FALCON512_CLEAN_hash_to_point( v = 0; for (u = 0; u < m; u ++) { uint16_t *s, *d; - unsigned j, sv, dv, m; + unsigned j, sv, dv, mk; if (u < n) { s = &x[u]; @@ -160,11 +160,11 @@ PQCLEAN_FALCON512_CLEAN_hash_to_point( /* * We increment v for the next iteration, but * only if the source value is valid. The mask - * 'm' is -1 if the value is valid, 0 otherwise, - * so we _subtract_ m. + * 'mk' is -1 if the value is valid, 0 otherwise, + * so we _subtract_ mk. */ - m = (sv >> 15) - 1U; - v -= m; + mk = (sv >> 15) - 1U; + v -= mk; /* * In this loop we consider jumps by p slots; if @@ -190,10 +190,10 @@ PQCLEAN_FALCON512_CLEAN_hash_to_point( * The swap should be performed only if the source * is valid AND the jump j has its 'p' bit set. */ - m &= -(((j & p) + 0x1FF) >> 9); + mk &= -(((j & p) + 0x1FF) >> 9); - *s = (uint16_t)(sv ^ (m & (sv ^ dv))); - *d = (uint16_t)(dv ^ (m & (sv ^ dv))); + *s = (uint16_t)(sv ^ (mk & (sv ^ dv))); + *d = (uint16_t)(dv ^ (mk & (sv ^ dv))); } }