Browse Source

fix rax input for rdrand detection

master
Mike Hamburg 10 years ago
parent
commit
39ca07a060
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      src/crandom.c
  2. +1
    -1
      src/shake.c

+ 1
- 1
src/crandom.c View File

@@ -27,10 +27,10 @@ unsigned int crandom_detect_features(void) {
if (c & 1<<25) out |= AESNI;
if (c & 1<<28) out |= AVX;
if (b & 1<<5) out |= AVX2;
if (c & 1<<30) out |= RDRAND;
a=0x80000001; __asm__("cpuid" : "+a"(a), "=b"(b), "=c"(c), "=d"(d));
if (c & 1<<11) out |= XOP;
if (c & 1<<30) out |= RDRAND;
# endif
return out;


+ 1
- 1
src/shake.c View File

@@ -272,7 +272,7 @@ static void get_cpu_entropy(uint8_t *entropy, size_t len) {
static char tested = 0, have_rdrand = 0;
if (!tested) {
u_int32_t a,b,c,d;
a=0x80000001; __asm__("cpuid" : "+a"(a), "=b"(b), "=c"(c), "=d"(d));
a=1; __asm__("cpuid" : "+a"(a), "=b"(b), "=c"(c), "=d"(d));
have_rdrand = (c>>30)&1;
tested = 1;
}


Loading…
Cancel
Save