diff options
author | Andy Polyakov <appro@openssl.org> | 2017-11-05 20:03:17 +0100 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2017-11-08 21:45:16 +0100 |
commit | d6ee8f3dc4414cd97bd63b801f8644f0ff8a1f17 (patch) | |
tree | 738ea44a85df4e37720dc48a6a9e8fb6da93f415 /crypto | |
parent | Don't NULL check before calling DSO_free. (diff) | |
download | openssl-d6ee8f3dc4414cd97bd63b801f8644f0ff8a1f17.tar.xz openssl-d6ee8f3dc4414cd97bd63b801f8644f0ff8a1f17.zip |
OPENSSL_ia32cap: reserve for new extensions.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/cryptlib.c | 22 | ||||
-rw-r--r-- | crypto/x86_64cpuid.pl | 3 |
2 files changed, 18 insertions, 7 deletions
diff --git a/crypto/cryptlib.c b/crypto/cryptlib.c index eb24b27808..c2bd2193b7 100644 --- a/crypto/cryptlib.c +++ b/crypto/cryptlib.c @@ -61,16 +61,26 @@ void OPENSSL_cpuid_setup(void) } if ((env = strchr(env, ':'))) { - unsigned int vecx; + IA32CAP vecx; env++; off = (env[0] == '~') ? 1 : 0; - vecx = strtoul(env + off, NULL, 0); - if (off) - OPENSSL_ia32cap_P[2] &= ~vecx; - else - OPENSSL_ia32cap_P[2] = vecx; +# if defined(_WIN32) + if (!sscanf(env + off, "%I64i", &vecx)) + vecx = strtoul(env + off, NULL, 0); +# else + if (!sscanf(env + off, "%lli", (long long *)&vecx)) + vecx = strtoul(env + off, NULL, 0); +# endif + if (off) { + OPENSSL_ia32cap_P[2] &= ~(unsigned int)vecx; + OPENSSL_ia32cap_P[3] &= ~(unsigned int)(vecx >> 32); + } else { + OPENSSL_ia32cap_P[2] = (unsigned int)vecx; + OPENSSL_ia32cap_P[3] = (unsigned int)(vecx >> 32); + } } else { OPENSSL_ia32cap_P[2] = 0; + OPENSSL_ia32cap_P[3] = 0; } } else { vec = OPENSSL_ia32_cpuid(OPENSSL_ia32cap_P); diff --git a/crypto/x86_64cpuid.pl b/crypto/x86_64cpuid.pl index f228c24ba1..7c8952e721 100644 --- a/crypto/x86_64cpuid.pl +++ b/crypto/x86_64cpuid.pl @@ -68,7 +68,7 @@ OPENSSL_ia32_cpuid: .cfi_register %rbx,%r8 xor %eax,%eax - mov %eax,8(%rdi) # clear extended feature flags + mov %rax,8(%rdi) # clear extended feature flags cpuid mov %eax,%r11d # max value for standard query level @@ -187,6 +187,7 @@ OPENSSL_ia32_cpuid: and \$0xfff7ffff,%ebx # clear ADCX/ADOX flag .Lnotknights: mov %ebx,8(%rdi) # save extended feature flags + mov %ecx,12(%rdi) .Lno_extended_info: bt \$27,%r9d # check OSXSAVE bit |