Renamed local variable to avoid a warning about a redefinition; also disabled the MSVC warning C4146 (it is raised whenever negation is applied on an unsigned type, but this has a portable and standard behaviour, and there are good reasons to do that).
Esse commit está contido em:
pai
dba40c7d43
commit
7175413a5c
@ -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)
|
||||
|
||||
|
@ -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)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)));
|
||||
}
|
||||
}
|
||||
|
||||
|
Carregando…
Referência em uma nova issue
Block a user