diff options
author | Michael Hamburg <mike@shiftleft.org> | 2017-05-28 12:29:43 -0700 |
---|---|---|
committer | Michael Hamburg <mike@shiftleft.org> | 2017-05-28 12:29:43 -0700 |
commit | cdb0ce047d5c1f05836526cbdb52998c13c627e5 (patch) | |
tree | 17ad103ef44050ae4f8074bdc2bbf5acfb840a4f | |
parent | replace default -mavx2 -mbmi2 with -march=native (diff) | |
download | goldilocks-cdb0ce047d5c1f05836526cbdb52998c13c627e5.tar.xz goldilocks-cdb0ce047d5c1f05836526cbdb52998c13c627e5.zip |
avoid warning for uninitialized entropy; change asm cpuid to look more like cpuid.h in the vain hope that this will compile better
-rw-r--r-- | src/spongerng.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/spongerng.c b/src/spongerng.c index d604b1c..fbcef7c 100644 --- a/src/spongerng.c +++ b/src/spongerng.c @@ -30,7 +30,7 @@ static void get_cpu_entropy(uint8_t *entropy, size_t len) { static char tested = 0, have_rdrand = 0; if (!tested) { uint32_t a,b,c,d; - a=1; __asm__("cpuid" : "+a"(a), "=b"(b), "=c"(c), "=d"(d)); + __asm__("cpuid" : "=a"(a), "=b"(b), "=c"(c), "=d"(d) : "0"(1)); have_rdrand = (c>>30)&1; tested = 1; } @@ -80,7 +80,7 @@ void decaf_spongerng_next ( ) { if (prng->sponge->params->remaining) { /* nondet */ - uint8_t cpu_entropy[32]; + uint8_t cpu_entropy[32] = {0}; get_cpu_entropy(cpu_entropy, sizeof(cpu_entropy)); decaf_spongerng_stir(prng,cpu_entropy,sizeof(cpu_entropy)); decaf_bzero(cpu_entropy,sizeof(cpu_entropy)); |