From 1c8b8cb77dae21c146e41a6e7ff384cfdb49fc0e Mon Sep 17 00:00:00 2001 From: Michael Hamburg Date: Tue, 6 Jun 2017 13:40:23 -0700 Subject: [PATCH] fix warning due to MACRO?4:3 in elligator.c --- src/GENERATED/c/curve25519/elligator.c | 6 +++++- src/GENERATED/c/ed448goldilocks/elligator.c | 6 +++++- src/per_curve/elligator.tmpl.c | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/GENERATED/c/curve25519/elligator.c b/src/GENERATED/c/curve25519/elligator.c index e9178ec..1427ca2 100644 --- a/src/GENERATED/c/curve25519/elligator.c +++ b/src/GENERATED/c/curve25519/elligator.c @@ -180,7 +180,11 @@ API_NS(invert_elligator_nonuniform) ( gf_serialize(recovered_hash,b,1); #if PKP_MASK != 0 /* Add a multiple of p to make the result either almost-onto or completely onto. */ - succ &= plus_k_p(recovered_hash, (hint >> ((COFACTOR==8)?4:3)) & PKP_MASK); + #if COFACTOR == 8 + succ &= plus_k_p(recovered_hash, (hint >> 4) & PKP_MASK); + #else + succ &= plus_k_p(recovered_hash, (hint >> 3) & PKP_MASK); + #endif #endif #endif return decaf_succeed_if(mask_to_bool(succ)); diff --git a/src/GENERATED/c/ed448goldilocks/elligator.c b/src/GENERATED/c/ed448goldilocks/elligator.c index 379340d..68ee811 100644 --- a/src/GENERATED/c/ed448goldilocks/elligator.c +++ b/src/GENERATED/c/ed448goldilocks/elligator.c @@ -180,7 +180,11 @@ API_NS(invert_elligator_nonuniform) ( gf_serialize(recovered_hash,b,1); #if PKP_MASK != 0 /* Add a multiple of p to make the result either almost-onto or completely onto. */ - succ &= plus_k_p(recovered_hash, (hint >> ((COFACTOR==8)?4:3)) & PKP_MASK); + #if COFACTOR == 8 + succ &= plus_k_p(recovered_hash, (hint >> 4) & PKP_MASK); + #else + succ &= plus_k_p(recovered_hash, (hint >> 3) & PKP_MASK); + #endif #endif #endif return decaf_succeed_if(mask_to_bool(succ)); diff --git a/src/per_curve/elligator.tmpl.c b/src/per_curve/elligator.tmpl.c index c3a864b..6a37fd5 100644 --- a/src/per_curve/elligator.tmpl.c +++ b/src/per_curve/elligator.tmpl.c @@ -169,7 +169,11 @@ API_NS(invert_elligator_nonuniform) ( gf_serialize(recovered_hash,b,1); #if PKP_MASK != 0 /* Add a multiple of p to make the result either almost-onto or completely onto. */ - succ &= plus_k_p(recovered_hash, (hint >> ((COFACTOR==8)?4:3)) & PKP_MASK); + #if COFACTOR == 8 + succ &= plus_k_p(recovered_hash, (hint >> 4) & PKP_MASK); + #else + succ &= plus_k_p(recovered_hash, (hint >> 3) & PKP_MASK); + #endif #endif #endif return decaf_succeed_if(mask_to_bool(succ));