mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-24 04:25:10 -07:00
Help compilers with vectorization
This commit is contained in:
parent
686c6a210d
commit
933b3e8ec1
@ -985,20 +985,24 @@ ge25519_has_small_order(const unsigned char s[32])
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f }
|
||||
};
|
||||
unsigned char c[7] = { 0 };
|
||||
unsigned int k;
|
||||
size_t i, j;
|
||||
unsigned char c;
|
||||
|
||||
for (i = 0; i < sizeof blacklist / sizeof blacklist[0]; i++) {
|
||||
c = 0;
|
||||
for (j = 0; j < 31; j++) {
|
||||
c |= s[j] ^ blacklist[i][j];
|
||||
}
|
||||
c |= (s[j] & 0x7f) ^ blacklist[i][j];
|
||||
if (c == 0) {
|
||||
return 1;
|
||||
COMPILER_ASSERT(7 == sizeof blacklist / sizeof blacklist[0]);
|
||||
for (j = 0; j < 31; j++) {
|
||||
for (i = 0; i < sizeof blacklist / sizeof blacklist[0]; i++) {
|
||||
c[i] |= s[j] ^ blacklist[i][j];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
for (i = 0; i < sizeof blacklist / sizeof blacklist[0]; i++) {
|
||||
c[i] |= (s[j] & 0x7f) ^ blacklist[i][j];
|
||||
}
|
||||
k = 0;
|
||||
for (i = 0; i < sizeof blacklist / sizeof blacklist[0]; i++) {
|
||||
k |= (c[i] - 1);
|
||||
}
|
||||
return (int) ((k >> 8) & 1);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user