Browse Source

NTRU Prime: more unary negations

tags/v0.0.1
John M. Schanck 4 years ago
committed by Kris Kwiatkowski
parent
commit
333248de03
3 changed files with 3 additions and 3 deletions
  1. +1
    -1
      crypto_kem/sntrup653/clean/crypto_core_invsntrup653.c
  2. +1
    -1
      crypto_kem/sntrup761/clean/crypto_core_invsntrup761.c
  3. +1
    -1
      crypto_kem/sntrup857/clean/crypto_core_invsntrup857.c

+ 1
- 1
crypto_kem/sntrup653/clean/crypto_core_invsntrup653.c View File

@@ -15,7 +15,7 @@
static int int16_nonzero_mask(int16 x) {
uint16 u = (uint16) x; /* 0, else 1...65535 */
uint32 v = u; /* 0, else 1...65535 */
v = -v; /* 0, else 2^32-65535...2^32-1 */
v = ~v + 1; /* 0, else 2^32-65535...2^32-1 */
v >>= 31; /* 0, else 1 */
return -(int) v; /* 0, else -1 */
}


+ 1
- 1
crypto_kem/sntrup761/clean/crypto_core_invsntrup761.c View File

@@ -15,7 +15,7 @@
static int int16_nonzero_mask(int16 x) {
uint16 u = (uint16) x; /* 0, else 1...65535 */
uint32 v = u; /* 0, else 1...65535 */
v = -v; /* 0, else 2^32-65535...2^32-1 */
v = ~v + 1; /* 0, else 2^32-65535...2^32-1 */
v >>= 31; /* 0, else 1 */
return -(int) v; /* 0, else -1 */
}


+ 1
- 1
crypto_kem/sntrup857/clean/crypto_core_invsntrup857.c View File

@@ -15,7 +15,7 @@
static int int16_nonzero_mask(int16 x) {
uint16 u = (uint16) x; /* 0, else 1...65535 */
uint32 v = u; /* 0, else 1...65535 */
v = -v; /* 0, else 2^32-65535...2^32-1 */
v = ~v + 1; /* 0, else 2^32-65535...2^32-1 */
v >>= 31; /* 0, else 1 */
return -(int) v; /* 0, else -1 */
}


Loading…
Cancel
Save