diff options
author | Andy Polyakov <appro@openssl.org> | 2011-12-09 15:46:41 +0000 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2011-12-09 15:46:41 +0000 |
commit | b140ae91375582f3840d4daa13edb1a94951e0b7 (patch) | |
tree | c10abd35a64b11c5dddf12c3f1c7d0fd0d6bc520 | |
parent | 8ee0591f284bf984c13a0fe5dbac02315fe4c786 (diff) |
cryptlib.c: allow for OPENSSL_ia32cap=~0x????? syntax for environment value
in question.
-rw-r--r-- | crypto/cryptlib.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/crypto/cryptlib.c b/crypto/cryptlib.c index 8384b5d339..615bcebec4 100644 --- a/crypto/cryptlib.c +++ b/crypto/cryptlib.c @@ -693,12 +693,15 @@ void OPENSSL_cpuid_setup(void) if (trigger) return; trigger=1; - if ((env=getenv("OPENSSL_ia32cap"))) + if ((env=getenv("OPENSSL_ia32cap"))) { + int off = (env[0]=='~')?1:0; #if defined(_WIN32) - { if (!sscanf(env,"%I64i",&vec)) vec = strtoul(env,NULL,0); } + if (!sscanf(env+off,"%I64i",&vec)) vec = strtoul(env+off,NULL,0); #else - vec = strtoull(env,NULL,0); + vec = strtoull(env+off,NULL,0); #endif + if (off) vec = OPENSSL_ia32_cpuid()&~vec; + } else vec = OPENSSL_ia32_cpuid(); /* |