From 3d5962c330c6dbaae2cfd79d6c1fc9f3d2b5cbaa Mon Sep 17 00:00:00 2001 From: Michael Hamburg Date: Wed, 31 May 2017 18:18:31 -0700 Subject: [PATCH] fix two warnings pointed out by Sofia Celi --- src/GENERATED/c/curve25519/scalar.c | 4 +++- src/GENERATED/c/ed448goldilocks/scalar.c | 4 +++- src/per_curve/scalar.tmpl.c | 4 +++- src/spongerng.c | 1 + 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/GENERATED/c/curve25519/scalar.c b/src/GENERATED/c/curve25519/scalar.c index 04a3425..c04475c 100644 --- a/src/GENERATED/c/curve25519/scalar.c +++ b/src/GENERATED/c/curve25519/scalar.c @@ -205,7 +205,9 @@ API_NS(scalar_set_unsigned) ( unsigned int i = 0; for (; ilimb[i] = w; - w >>= (sizeof(uint64_t) > sizeof(decaf_word_t)) ? 8*sizeof(decaf_word_t) : 0; +#if DECAF_WORD_BITS < 64 + w >>= 8*sizeof(decaf_word_t); +#endif } } diff --git a/src/GENERATED/c/ed448goldilocks/scalar.c b/src/GENERATED/c/ed448goldilocks/scalar.c index 03d58e8..1c98ac9 100644 --- a/src/GENERATED/c/ed448goldilocks/scalar.c +++ b/src/GENERATED/c/ed448goldilocks/scalar.c @@ -205,7 +205,9 @@ API_NS(scalar_set_unsigned) ( unsigned int i = 0; for (; ilimb[i] = w; - w >>= (sizeof(uint64_t) > sizeof(decaf_word_t)) ? 8*sizeof(decaf_word_t) : 0; +#if DECAF_WORD_BITS < 64 + w >>= 8*sizeof(decaf_word_t); +#endif } } diff --git a/src/per_curve/scalar.tmpl.c b/src/per_curve/scalar.tmpl.c index 5a5b91d..af15851 100644 --- a/src/per_curve/scalar.tmpl.c +++ b/src/per_curve/scalar.tmpl.c @@ -194,7 +194,9 @@ API_NS(scalar_set_unsigned) ( unsigned int i = 0; for (; ilimb[i] = w; - w >>= (sizeof(uint64_t) > sizeof(decaf_word_t)) ? 8*sizeof(decaf_word_t) : 0; +#if DECAF_WORD_BITS < 64 + w >>= 8*sizeof(decaf_word_t); +#endif } } diff --git a/src/spongerng.c b/src/spongerng.c index 52b424c..6b3136b 100644 --- a/src/spongerng.c +++ b/src/spongerng.c @@ -45,6 +45,7 @@ static void get_cpu_entropy(uint8_t *entropy, size_t len) { #else __asm__("cpuid" : "=a"(a), "=b"(b), "=c"(c), "=d"(d) : "0"(1)); #endif + (void)a; (void)b; (void)d; have_rdrand = (c>>30)&1; tested = 1; }