mirror of
https://github.com/jedisct1/libsodium.git
synced 2026-08-27 12:17:12 +09:00
Merge branch 'master' of github.com:jedisct1/libsodium
* 'master' of github.com:jedisct1/libsodium: Language Improvements (#972)
This commit is contained in:
@@ -1130,7 +1130,7 @@ int
|
||||
ge25519_has_small_order(const unsigned char s[32])
|
||||
{
|
||||
CRYPTO_ALIGN(16)
|
||||
static const unsigned char blacklist[][32] = {
|
||||
static const unsigned char blocklist[][32] = {
|
||||
/* 0 (order 4) */
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
@@ -1166,17 +1166,17 @@ ge25519_has_small_order(const unsigned char s[32])
|
||||
unsigned int k;
|
||||
size_t i, j;
|
||||
|
||||
COMPILER_ASSERT(7 == sizeof blacklist / sizeof blacklist[0]);
|
||||
COMPILER_ASSERT(7 == sizeof blocklist / sizeof blocklist[0]);
|
||||
for (j = 0; j < 31; j++) {
|
||||
for (i = 0; i < sizeof blacklist / sizeof blacklist[0]; i++) {
|
||||
c[i] |= s[j] ^ blacklist[i][j];
|
||||
for (i = 0; i < sizeof blocklist / sizeof blocklist[0]; i++) {
|
||||
c[i] |= s[j] ^ blocklist[i][j];
|
||||
}
|
||||
}
|
||||
for (i = 0; i < sizeof blacklist / sizeof blacklist[0]; i++) {
|
||||
c[i] |= (s[j] & 0x7f) ^ blacklist[i][j];
|
||||
for (i = 0; i < sizeof blocklist / sizeof blocklist[0]; i++) {
|
||||
c[i] |= (s[j] & 0x7f) ^ blocklist[i][j];
|
||||
}
|
||||
k = 0;
|
||||
for (i = 0; i < sizeof blacklist / sizeof blacklist[0]; i++) {
|
||||
for (i = 0; i < sizeof blocklist / sizeof blocklist[0]; i++) {
|
||||
k |= (c[i] - 1);
|
||||
}
|
||||
return (int) ((k >> 8) & 1);
|
||||
|
||||
@@ -17,7 +17,7 @@ static int
|
||||
has_small_order(const unsigned char s[32])
|
||||
{
|
||||
CRYPTO_ALIGN(16)
|
||||
static const unsigned char blacklist[][32] = {
|
||||
static const unsigned char blocklist[][32] = {
|
||||
/* 0 (order 4) */
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
@@ -53,17 +53,17 @@ has_small_order(const unsigned char s[32])
|
||||
unsigned int k;
|
||||
size_t i, j;
|
||||
|
||||
COMPILER_ASSERT(7 == sizeof blacklist / sizeof blacklist[0]);
|
||||
COMPILER_ASSERT(7 == sizeof blocklist / sizeof blocklist[0]);
|
||||
for (j = 0; j < 31; j++) {
|
||||
for (i = 0; i < sizeof blacklist / sizeof blacklist[0]; i++) {
|
||||
c[i] |= s[j] ^ blacklist[i][j];
|
||||
for (i = 0; i < sizeof blocklist / sizeof blocklist[0]; i++) {
|
||||
c[i] |= s[j] ^ blocklist[i][j];
|
||||
}
|
||||
}
|
||||
for (i = 0; i < sizeof blacklist / sizeof blacklist[0]; i++) {
|
||||
c[i] |= (s[j] & 0x7f) ^ blacklist[i][j];
|
||||
for (i = 0; i < sizeof blocklist / sizeof blocklist[0]; i++) {
|
||||
c[i] |= (s[j] & 0x7f) ^ blocklist[i][j];
|
||||
}
|
||||
k = 0;
|
||||
for (i = 0; i < sizeof blacklist / sizeof blacklist[0]; i++) {
|
||||
for (i = 0; i < sizeof blocklist / sizeof blocklist[0]; i++) {
|
||||
k |= (c[i] - 1);
|
||||
}
|
||||
return (int) ((k >> 8) & 1);
|
||||
|
||||
Reference in New Issue
Block a user