File openssl-fix-cpuid_setup.patch of Package openssl-1_0_0.16376
Index: openssl-1.0.2h/crypto/cryptlib.c
===================================================================
--- openssl-1.0.2h.orig/crypto/cryptlib.c
+++ openssl-1.0.2h/crypto/cryptlib.c
@@ -676,10 +676,15 @@ typedef unsigned __int64 IA32CAP;
# else
typedef unsigned long long IA32CAP;
# endif
+
+/* Compat function for STEAM */
+extern IA32CAP OPENSSL_ia32_cpuid_new(unsigned int*);
+IA32CAP OPENSSL_ia32_cpuid(void) { return OPENSSL_ia32_cpuid_new(OPENSSL_ia32cap_P); }
+
void OPENSSL_cpuid_setup(void)
{
static int trigger = 0;
- IA32CAP OPENSSL_ia32_cpuid(unsigned int *);
+ IA32CAP OPENSSL_ia32_cpuid_new(unsigned int *);
IA32CAP vec;
char *env;
@@ -697,9 +702,9 @@ void OPENSSL_cpuid_setup(void)
vec = strtoul(env + off, NULL, 0);
# endif
if (off)
- vec = OPENSSL_ia32_cpuid(OPENSSL_ia32cap_P) & ~vec;
+ vec = OPENSSL_ia32_cpuid_new(OPENSSL_ia32cap_P) & ~vec;
else if (env[0] == ':')
- vec = OPENSSL_ia32_cpuid(OPENSSL_ia32cap_P);
+ vec = OPENSSL_ia32_cpuid_new(OPENSSL_ia32cap_P);
OPENSSL_ia32cap_P[2] = 0;
if ((env = strchr(env, ':'))) {
@@ -713,7 +718,7 @@ void OPENSSL_cpuid_setup(void)
OPENSSL_ia32cap_P[2] = vecx;
}
} else
- vec = OPENSSL_ia32_cpuid(OPENSSL_ia32cap_P);
+ vec = OPENSSL_ia32_cpuid_new(OPENSSL_ia32cap_P);
/*
* |(1<<10) sets a reserved bit to signal that variable
Index: openssl-1.0.2h/crypto/cryptlib.h
===================================================================
--- openssl-1.0.2h.orig/crypto/cryptlib.h
+++ openssl-1.0.2h/crypto/cryptlib.h
@@ -99,6 +99,9 @@ extern "C" {
# define HEX_SIZE(type) (sizeof(type)*2)
void OPENSSL_cpuid_setup(void);
+#pragma GCC visibility push(hidden)
+unsigned long long OPENSSL_ia32_cpuid(void);
+#pragma GCC visibility pop
extern unsigned int OPENSSL_ia32cap_P[];
void OPENSSL_showfatal(const char *fmta, ...) __attribute__ ((format (printf, 1, 2)));
void *OPENSSL_stderr(void);
Index: openssl-1.0.2h/crypto/x86_64cpuid.pl
===================================================================
--- openssl-1.0.2h.orig/crypto/x86_64cpuid.pl
+++ openssl-1.0.2h/crypto/x86_64cpuid.pl
@@ -52,10 +52,10 @@ OPENSSL_rdtsc:
ret
.size OPENSSL_rdtsc,.-OPENSSL_rdtsc
-.globl OPENSSL_ia32_cpuid
-.type OPENSSL_ia32_cpuid,\@function,1
+.globl OPENSSL_ia32_cpuid_new
+.type OPENSSL_ia32_cpuid_new,\@function,1
.align 16
-OPENSSL_ia32_cpuid:
+OPENSSL_ia32_cpuid_new:
mov %rbx,%r8 # save %rbx
xor %eax,%eax
@@ -181,7 +181,7 @@ OPENSSL_ia32_cpuid:
mov %r8,%rbx # restore %rbx
or %r9,%rax
ret
-.size OPENSSL_ia32_cpuid,.-OPENSSL_ia32_cpuid
+.size OPENSSL_ia32_cpuid_new,.-OPENSSL_ia32_cpuid_new
.globl OPENSSL_cleanse
.type OPENSSL_cleanse,\@abi-omnipotent
Index: openssl-1.0.2h/crypto/x86cpuid.pl
===================================================================
--- openssl-1.0.2h.orig/crypto/x86cpuid.pl
+++ openssl-1.0.2h/crypto/x86cpuid.pl
@@ -8,7 +8,7 @@ require "x86asm.pl";
for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); }
-&function_begin("OPENSSL_ia32_cpuid");
+&function_begin("OPENSSL_ia32_cpuid_new");
&xor ("edx","edx");
&pushf ();
&pop ("eax");
@@ -153,7 +153,7 @@ for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA3
&mov ("eax","esi");
&mov ("edx","ebp");
&set_label("nocpuid");
-&function_end("OPENSSL_ia32_cpuid");
+&function_end("OPENSSL_ia32_cpuid_new");
&external_label("OPENSSL_ia32cap_P");
Index: openssl-1.0.2h/crypto/fips/fips_standalone_hmac.c
===================================================================
--- openssl-1.0.2h.orig/crypto/fips/fips_standalone_hmac.c
+++ openssl-1.0.2h/crypto/fips/fips_standalone_hmac.c
@@ -109,7 +109,7 @@ typedef unsigned long long IA32CAP;
void OPENSSL_cpuid_setup(void)
{
static int trigger = 0;
- IA32CAP OPENSSL_ia32_cpuid(unsigned int *);
+ IA32CAP OPENSSL_ia32_cpuid_new(unsigned int *);
IA32CAP vec;
char *env;
@@ -127,9 +127,9 @@ void OPENSSL_cpuid_setup(void)
vec = strtoul(env + off, NULL, 0);
# endif
if (off)
- vec = OPENSSL_ia32_cpuid(OPENSSL_ia32cap_P) & ~vec;
+ vec = OPENSSL_ia32_cpuid_new(OPENSSL_ia32cap_P) & ~vec;
else if (env[0] == ':')
- vec = OPENSSL_ia32_cpuid(OPENSSL_ia32cap_P);
+ vec = OPENSSL_ia32_cpuid_new(OPENSSL_ia32cap_P);
OPENSSL_ia32cap_P[2] = 0;
if ((env = strchr(env, ':'))) {
@@ -143,7 +143,7 @@ void OPENSSL_cpuid_setup(void)
OPENSSL_ia32cap_P[2] = vecx;
}
} else
- vec = OPENSSL_ia32_cpuid(OPENSSL_ia32cap_P);
+ vec = OPENSSL_ia32_cpuid_new(OPENSSL_ia32cap_P);
/*
* |(1<<10) sets a reserved bit to signal that variable