OPENSSL_ia32cap: reserve for new extensions.

Reviewed-by: Rich Salz <rsalz@openssl.org>
This commit is contained in:
Andy Polyakov 2017-11-05 20:03:17 +01:00
parent 1b6fa9fdf8
commit d6ee8f3dc4
3 changed files with 23 additions and 7 deletions

View file

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