Browse Source

avoid warning for uninitialized entropy; change asm cpuid to look more like cpuid.h in the vain hope that this will compile better

master
Michael Hamburg 7 years ago
parent
commit
cdb0ce047d
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      src/spongerng.c

+ 2
- 2
src/spongerng.c View File

@@ -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));


Loading…
Cancel
Save