diff options
| author | miod <> | 2014-04-17 18:49:35 +0000 |
|---|---|---|
| committer | miod <> | 2014-04-17 18:49:35 +0000 |
| commit | b4ee6facff27de9af90bfa187f0b058454154db5 (patch) | |
| tree | 9b300ff5f2f5884420887d8f593434c1547a5934 | |
| parent | 3edb7884406560f3fbb30f0461205d9ee1a9af40 (diff) | |
| download | openbsd-b4ee6facff27de9af90bfa187f0b058454154db5.tar.gz openbsd-b4ee6facff27de9af90bfa187f0b058454154db5.tar.bz2 openbsd-b4ee6facff27de9af90bfa187f0b058454154db5.zip | |
Remove oh-so-important-from-a-security-pov OpenSSL_rtdsc() function.
24 files changed, 4 insertions, 502 deletions
diff --git a/src/lib/libcrypto/alphacpuid.pl b/src/lib/libcrypto/alphacpuid.pl index f6aea6a766..0ff4ae22e3 100644 --- a/src/lib/libcrypto/alphacpuid.pl +++ b/src/lib/libcrypto/alphacpuid.pl | |||
| @@ -77,13 +77,4 @@ OPENSSL_atomic_add: | |||
| 77 | addl $0,$17,$0 | 77 | addl $0,$17,$0 |
| 78 | ret ($26) | 78 | ret ($26) |
| 79 | .end OPENSSL_atomic_add | 79 | .end OPENSSL_atomic_add |
| 80 | |||
| 81 | .globl OPENSSL_rdtsc | ||
| 82 | .ent OPENSSL_rdtsc | ||
| 83 | OPENSSL_rdtsc: | ||
| 84 | .frame $30,0,$26 | ||
| 85 | .prologue 0 | ||
| 86 | rpcc $0 | ||
| 87 | ret ($26) | ||
| 88 | .end OPENSSL_rdtsc | ||
| 89 | ___ | 80 | ___ |
diff --git a/src/lib/libcrypto/arm_arch.h b/src/lib/libcrypto/arm_arch.h index 0ccafb2215..01797eb4e3 100644 --- a/src/lib/libcrypto/arm_arch.h +++ b/src/lib/libcrypto/arm_arch.h | |||
| @@ -45,7 +45,6 @@ | |||
| 45 | extern unsigned int OPENSSL_armcap_P; | 45 | extern unsigned int OPENSSL_armcap_P; |
| 46 | 46 | ||
| 47 | #define ARMV7_NEON (1<<0) | 47 | #define ARMV7_NEON (1<<0) |
| 48 | #define ARMV7_TICK (1<<1) | ||
| 49 | #endif | 48 | #endif |
| 50 | 49 | ||
| 51 | #endif | 50 | #endif |
diff --git a/src/lib/libcrypto/armcap.c b/src/lib/libcrypto/armcap.c index 0625587bdd..f40993c1d5 100644 --- a/src/lib/libcrypto/armcap.c +++ b/src/lib/libcrypto/armcap.c | |||
| @@ -20,16 +20,6 @@ static sigjmp_buf ill_jmp; | |||
| 20 | * ARM compilers support inline assembler... | 20 | * ARM compilers support inline assembler... |
| 21 | */ | 21 | */ |
| 22 | void _armv7_neon_probe(void); | 22 | void _armv7_neon_probe(void); |
| 23 | unsigned int _armv7_tick(void); | ||
| 24 | |||
| 25 | unsigned int | ||
| 26 | OPENSSL_rdtsc(void) | ||
| 27 | { | ||
| 28 | if (OPENSSL_armcap_P & ARMV7_TICK) | ||
| 29 | return _armv7_tick(); | ||
| 30 | else | ||
| 31 | return 0; | ||
| 32 | } | ||
| 33 | 23 | ||
| 34 | #if defined(__GNUC__) && __GNUC__>=2 | 24 | #if defined(__GNUC__) && __GNUC__>=2 |
| 35 | void OPENSSL_cpuid_setup(void) __attribute__((constructor)); | 25 | void OPENSSL_cpuid_setup(void) __attribute__((constructor)); |
| @@ -72,10 +62,6 @@ OPENSSL_cpuid_setup(void) | |||
| 72 | _armv7_neon_probe(); | 62 | _armv7_neon_probe(); |
| 73 | OPENSSL_armcap_P |= ARMV7_NEON; | 63 | OPENSSL_armcap_P |= ARMV7_NEON; |
| 74 | } | 64 | } |
| 75 | if (sigsetjmp(ill_jmp, 1) == 0) { | ||
| 76 | _armv7_tick(); | ||
| 77 | OPENSSL_armcap_P |= ARMV7_TICK; | ||
| 78 | } | ||
| 79 | 65 | ||
| 80 | sigaction (SIGILL, &ill_oact, NULL); | 66 | sigaction (SIGILL, &ill_oact, NULL); |
| 81 | sigprocmask(SIG_SETMASK, &oset, NULL); | 67 | sigprocmask(SIG_SETMASK, &oset, NULL); |
diff --git a/src/lib/libcrypto/armv4cpuid.S b/src/lib/libcrypto/armv4cpuid.S index bdfde19c1f..ba86c9709a 100644 --- a/src/lib/libcrypto/armv4cpuid.S +++ b/src/lib/libcrypto/armv4cpuid.S | |||
| @@ -11,13 +11,6 @@ _armv7_neon_probe: | |||
| 11 | .word 0xe12fff1e @ bx lr | 11 | .word 0xe12fff1e @ bx lr |
| 12 | .size _armv7_neon_probe,.-_armv7_neon_probe | 12 | .size _armv7_neon_probe,.-_armv7_neon_probe |
| 13 | 13 | ||
| 14 | .global _armv7_tick | ||
| 15 | .type _armv7_tick,%function | ||
| 16 | _armv7_tick: | ||
| 17 | mrc p15,0,r0,c9,c13,0 | ||
| 18 | .word 0xe12fff1e @ bx lr | ||
| 19 | .size _armv7_tick,.-_armv7_tick | ||
| 20 | |||
| 21 | .global OPENSSL_atomic_add | 14 | .global OPENSSL_atomic_add |
| 22 | .type OPENSSL_atomic_add,%function | 15 | .type OPENSSL_atomic_add,%function |
| 23 | OPENSSL_atomic_add: | 16 | OPENSSL_atomic_add: |
diff --git a/src/lib/libcrypto/ia64cpuid.S b/src/lib/libcrypto/ia64cpuid.S index 517d938888..39e8093c6c 100644 --- a/src/lib/libcrypto/ia64cpuid.S +++ b/src/lib/libcrypto/ia64cpuid.S | |||
| @@ -8,13 +8,6 @@ OPENSSL_cpuid_setup: | |||
| 8 | { .mib; br.ret.sptk.many b0 };; | 8 | { .mib; br.ret.sptk.many b0 };; |
| 9 | .endp OPENSSL_cpuid_setup# | 9 | .endp OPENSSL_cpuid_setup# |
| 10 | 10 | ||
| 11 | .global OPENSSL_rdtsc# | ||
| 12 | .proc OPENSSL_rdtsc# | ||
| 13 | OPENSSL_rdtsc: | ||
| 14 | { .mib; mov r8=ar.itc | ||
| 15 | br.ret.sptk.many b0 };; | ||
| 16 | .endp OPENSSL_rdtsc# | ||
| 17 | |||
| 18 | .global OPENSSL_atomic_add# | 11 | .global OPENSSL_atomic_add# |
| 19 | .proc OPENSSL_atomic_add# | 12 | .proc OPENSSL_atomic_add# |
| 20 | .align 32 | 13 | .align 32 |
diff --git a/src/lib/libcrypto/pariscid.pl b/src/lib/libcrypto/pariscid.pl index 38985afbac..cd86b90704 100644 --- a/src/lib/libcrypto/pariscid.pl +++ b/src/lib/libcrypto/pariscid.pl | |||
| @@ -34,18 +34,6 @@ OPENSSL_cpuid_setup | |||
| 34 | nop | 34 | nop |
| 35 | .PROCEND | 35 | .PROCEND |
| 36 | 36 | ||
| 37 | .EXPORT OPENSSL_rdtsc,ENTRY | ||
| 38 | .ALIGN 8 | ||
| 39 | OPENSSL_rdtsc | ||
| 40 | .PROC | ||
| 41 | .CALLINFO NO_CALLS | ||
| 42 | .ENTRY | ||
| 43 | mfctl %cr16,$rv | ||
| 44 | bv ($rp) | ||
| 45 | .EXIT | ||
| 46 | nop | ||
| 47 | .PROCEND | ||
| 48 | |||
| 49 | .EXPORT OPENSSL_wipe_cpu,ENTRY | 37 | .EXPORT OPENSSL_wipe_cpu,ENTRY |
| 50 | .ALIGN 8 | 38 | .ALIGN 8 |
| 51 | OPENSSL_wipe_cpu | 39 | OPENSSL_wipe_cpu |
diff --git a/src/lib/libcrypto/ppccpuid.pl b/src/lib/libcrypto/ppccpuid.pl index cf48714e33..37c33c051a 100755 --- a/src/lib/libcrypto/ppccpuid.pl +++ b/src/lib/libcrypto/ppccpuid.pl | |||
| @@ -84,15 +84,6 @@ Ladd: lwarx r5,0,r3 | |||
| 84 | .long 0 | 84 | .long 0 |
| 85 | .byte 0,12,0x14,0,0,0,2,0 | 85 | .byte 0,12,0x14,0,0,0,2,0 |
| 86 | .long 0 | 86 | .long 0 |
| 87 | |||
| 88 | .globl .OPENSSL_rdtsc | ||
| 89 | .align 4 | ||
| 90 | .OPENSSL_rdtsc: | ||
| 91 | mftb r3 | ||
| 92 | mftbu r4 | ||
| 93 | blr | ||
| 94 | .long 0 | ||
| 95 | .byte 0,12,0x14,0,0,0,0,0 | ||
| 96 | ___ | 87 | ___ |
| 97 | 88 | ||
| 98 | $code =~ s/\`([^\`]*)\`/eval $1/gem; | 89 | $code =~ s/\`([^\`]*)\`/eval $1/gem; |
diff --git a/src/lib/libcrypto/s390xcpuid.S b/src/lib/libcrypto/s390xcpuid.S index 89bf6be82f..25adb646c4 100644 --- a/src/lib/libcrypto/s390xcpuid.S +++ b/src/lib/libcrypto/s390xcpuid.S | |||
| @@ -16,15 +16,6 @@ OPENSSL_s390x_facilities: | |||
| 16 | br %r14 | 16 | br %r14 |
| 17 | .size OPENSSL_s390x_facilities,.-OPENSSL_s390x_facilities | 17 | .size OPENSSL_s390x_facilities,.-OPENSSL_s390x_facilities |
| 18 | 18 | ||
| 19 | .globl OPENSSL_rdtsc | ||
| 20 | .type OPENSSL_rdtsc,@function | ||
| 21 | .align 16 | ||
| 22 | OPENSSL_rdtsc: | ||
| 23 | stck 16(%r15) | ||
| 24 | lg %r2,16(%r15) | ||
| 25 | br %r14 | ||
| 26 | .size OPENSSL_rdtsc,.-OPENSSL_rdtsc | ||
| 27 | |||
| 28 | .globl OPENSSL_atomic_add | 19 | .globl OPENSSL_atomic_add |
| 29 | .type OPENSSL_atomic_add,@function | 20 | .type OPENSSL_atomic_add,@function |
| 30 | .align 16 | 21 | .align 16 |
diff --git a/src/lib/libcrypto/sparccpuid.S b/src/lib/libcrypto/sparccpuid.S index d8b44af2f0..b913e3dddb 100644 --- a/src/lib/libcrypto/sparccpuid.S +++ b/src/lib/libcrypto/sparccpuid.S | |||
| @@ -215,23 +215,6 @@ OPENSSL_atomic_add: | |||
| 215 | sra %o0,%g0,%o0 ! we return signed int, remember? | 215 | sra %o0,%g0,%o0 ! we return signed int, remember? |
| 216 | .size OPENSSL_atomic_add,.-OPENSSL_atomic_add | 216 | .size OPENSSL_atomic_add,.-OPENSSL_atomic_add |
| 217 | 217 | ||
| 218 | .global _sparcv9_rdtick | ||
| 219 | .align 32 | ||
| 220 | _sparcv9_rdtick: | ||
| 221 | subcc %g0,1,%o0 | ||
| 222 | .word 0x91408000 !rd %ccr,%o0 | ||
| 223 | cmp %o0,0x99 | ||
| 224 | bne .notick | ||
| 225 | xor %o0,%o0,%o0 | ||
| 226 | .word 0x91410000 !rd %tick,%o0 | ||
| 227 | retl | ||
| 228 | .word 0x93323020 !srlx %o0,32,%o1 | ||
| 229 | .notick: | ||
| 230 | retl | ||
| 231 | xor %o1,%o1,%o1 | ||
| 232 | .type _sparcv9_rdtick,#function | ||
| 233 | .size _sparcv9_rdtick,.-_sparcv9_rdtick | ||
| 234 | |||
| 235 | .global _sparcv9_vis1_probe | 218 | .global _sparcv9_vis1_probe |
| 236 | .align 8 | 219 | .align 8 |
| 237 | _sparcv9_vis1_probe: | 220 | _sparcv9_vis1_probe: |
diff --git a/src/lib/libcrypto/sparcv9cap.c b/src/lib/libcrypto/sparcv9cap.c index 05c084807a..f49e71ec93 100644 --- a/src/lib/libcrypto/sparcv9cap.c +++ b/src/lib/libcrypto/sparcv9cap.c | |||
| @@ -6,13 +6,12 @@ | |||
| 6 | #include <sys/time.h> | 6 | #include <sys/time.h> |
| 7 | #include <openssl/bn.h> | 7 | #include <openssl/bn.h> |
| 8 | 8 | ||
| 9 | #define SPARCV9_TICK_PRIVILEGED (1<<0) | ||
| 10 | #define SPARCV9_PREFER_FPU (1<<1) | 9 | #define SPARCV9_PREFER_FPU (1<<1) |
| 11 | #define SPARCV9_VIS1 (1<<2) | 10 | #define SPARCV9_VIS1 (1<<2) |
| 12 | #define SPARCV9_VIS2 (1<<3) /* reserved */ | 11 | #define SPARCV9_VIS2 (1<<3) /* reserved */ |
| 13 | #define SPARCV9_FMADD (1<<4) /* reserved for SPARC64 V */ | 12 | #define SPARCV9_FMADD (1<<4) /* reserved for SPARC64 V */ |
| 14 | 13 | ||
| 15 | static int OPENSSL_sparcv9cap_P = SPARCV9_TICK_PRIVILEGED; | 14 | static int OPENSSL_sparcv9cap_P = 0; |
| 16 | 15 | ||
| 17 | int | 16 | int |
| 18 | bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, | 17 | bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, |
| @@ -29,146 +28,11 @@ bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, | |||
| 29 | return bn_mul_mont_int(rp, ap, bp, np, n0, num); | 28 | return bn_mul_mont_int(rp, ap, bp, np, n0, num); |
| 30 | } | 29 | } |
| 31 | 30 | ||
| 32 | unsigned long _sparcv9_rdtick(void); | ||
| 33 | void _sparcv9_vis1_probe(void); | 31 | void _sparcv9_vis1_probe(void); |
| 34 | unsigned long _sparcv9_vis1_instrument(void); | 32 | unsigned long _sparcv9_vis1_instrument(void); |
| 35 | void _sparcv9_vis2_probe(void); | 33 | void _sparcv9_vis2_probe(void); |
| 36 | void _sparcv9_fmadd_probe(void); | 34 | void _sparcv9_fmadd_probe(void); |
| 37 | 35 | ||
| 38 | unsigned long | ||
| 39 | OPENSSL_rdtsc(void) | ||
| 40 | { | ||
| 41 | if (OPENSSL_sparcv9cap_P&SPARCV9_TICK_PRIVILEGED) | ||
| 42 | #if defined(__sun) && defined(__SVR4) | ||
| 43 | return gethrtime(); | ||
| 44 | #else | ||
| 45 | return 0; | ||
| 46 | #endif | ||
| 47 | else | ||
| 48 | return _sparcv9_rdtick(); | ||
| 49 | } | ||
| 50 | |||
| 51 | #if 0 && defined(__sun) && defined(__SVR4) | ||
| 52 | /* This code path is disabled, because of incompatibility of | ||
| 53 | * libdevinfo.so.1 and libmalloc.so.1 (see below for details) | ||
| 54 | */ | ||
| 55 | #include <malloc.h> | ||
| 56 | #include <dlfcn.h> | ||
| 57 | #include <libdevinfo.h> | ||
| 58 | #include <sys/systeminfo.h> | ||
| 59 | |||
| 60 | typedef di_node_t (*di_init_t)(const char *, uint_t); | ||
| 61 | typedef void (*di_fini_t)(di_node_t); | ||
| 62 | typedef char * (*di_node_name_t)(di_node_t); | ||
| 63 | typedef int (*di_walk_node_t)(di_node_t, uint_t, di_node_name_t, int (*)(di_node_t, di_node_name_t)); | ||
| 64 | |||
| 65 | #define DLLINK(h,name) (name=(name##_t)dlsym((h),#name)) | ||
| 66 | |||
| 67 | static int | ||
| 68 | walk_nodename(di_node_t node, di_node_name_t di_node_name) | ||
| 69 | { | ||
| 70 | char *name = (*di_node_name)(node); | ||
| 71 | |||
| 72 | /* This is expected to catch all UltraSPARC flavors prior T1 */ | ||
| 73 | if (!strcmp (name, "SUNW,UltraSPARC") || | ||
| 74 | !strncmp(name,"SUNW,UltraSPARC-I",17)) /* covers II,III,IV */ | ||
| 75 | { | ||
| 76 | OPENSSL_sparcv9cap_P |= SPARCV9_PREFER_FPU|SPARCV9_VIS1; | ||
| 77 | |||
| 78 | /* %tick is privileged only on UltraSPARC-I/II, but not IIe */ | ||
| 79 | if (name[14]!='\0' && name[17]!='\0' && name[18]!='\0') | ||
| 80 | OPENSSL_sparcv9cap_P &= ~SPARCV9_TICK_PRIVILEGED; | ||
| 81 | |||
| 82 | return DI_WALK_TERMINATE; | ||
| 83 | } | ||
| 84 | /* This is expected to catch remaining UltraSPARCs, such as T1 */ | ||
| 85 | else if (!strncmp(name, "SUNW,UltraSPARC", 15)) { | ||
| 86 | OPENSSL_sparcv9cap_P &= ~SPARCV9_TICK_PRIVILEGED; | ||
| 87 | |||
| 88 | return DI_WALK_TERMINATE; | ||
| 89 | } | ||
| 90 | |||
| 91 | return DI_WALK_CONTINUE; | ||
| 92 | } | ||
| 93 | |||
| 94 | void | ||
| 95 | OPENSSL_cpuid_setup(void) | ||
| 96 | { | ||
| 97 | void *h; | ||
| 98 | char *e, si[256]; | ||
| 99 | static int trigger = 0; | ||
| 100 | |||
| 101 | if (trigger) | ||
| 102 | return; | ||
| 103 | trigger = 1; | ||
| 104 | |||
| 105 | if ((e = getenv("OPENSSL_sparcv9cap"))) { | ||
| 106 | OPENSSL_sparcv9cap_P = strtoul(e, NULL, 0); | ||
| 107 | return; | ||
| 108 | } | ||
| 109 | |||
| 110 | if (sysinfo(SI_MACHINE, si, sizeof(si)) > 0) { | ||
| 111 | if (strcmp(si, "sun4v")) | ||
| 112 | /* FPU is preferred for all CPUs, but US-T1/2 */ | ||
| 113 | OPENSSL_sparcv9cap_P |= SPARCV9_PREFER_FPU; | ||
| 114 | } | ||
| 115 | |||
| 116 | if (sysinfo(SI_ISALIST, si, sizeof(si)) > 0) { | ||
| 117 | if (strstr(si, "+vis")) | ||
| 118 | OPENSSL_sparcv9cap_P |= SPARCV9_VIS1; | ||
| 119 | if (strstr(si, "+vis2")) { | ||
| 120 | OPENSSL_sparcv9cap_P |= SPARCV9_VIS2; | ||
| 121 | OPENSSL_sparcv9cap_P &= ~SPARCV9_TICK_PRIVILEGED; | ||
| 122 | return; | ||
| 123 | } | ||
| 124 | } | ||
| 125 | #ifdef M_KEEP | ||
| 126 | /* | ||
| 127 | * Solaris libdevinfo.so.1 is effectively incomatible with | ||
| 128 | * libmalloc.so.1. Specifically, if application is linked with | ||
| 129 | * -lmalloc, it crashes upon startup with SIGSEGV in | ||
| 130 | * free(3LIBMALLOC) called by di_fini. Prior call to | ||
| 131 | * mallopt(M_KEEP,0) somehow helps... But not always... | ||
| 132 | */ | ||
| 133 | if ((h = dlopen(NULL, RTLD_LAZY))) { | ||
| 134 | union { void *p; | ||
| 135 | int (*f)(int, int); | ||
| 136 | } sym; | ||
| 137 | if ((sym.p = dlsym(h, "mallopt"))) (*sym.f)(M_KEEP, 0); | ||
| 138 | dlclose(h); | ||
| 139 | } | ||
| 140 | #endif | ||
| 141 | if ((h = dlopen("libdevinfo.so.1", RTLD_LAZY))) | ||
| 142 | do { | ||
| 143 | di_init_t di_init; | ||
| 144 | di_fini_t di_fini; | ||
| 145 | di_walk_node_t di_walk_node; | ||
| 146 | di_node_name_t di_node_name; | ||
| 147 | di_node_t root_node; | ||
| 148 | |||
| 149 | if (!DLLINK(h, di_init)) | ||
| 150 | break; | ||
| 151 | if (!DLLINK(h, di_fini)) | ||
| 152 | break; | ||
| 153 | if (!DLLINK(h, di_walk_node)) | ||
| 154 | break; | ||
| 155 | if (!DLLINK(h, di_node_name)) | ||
| 156 | break; | ||
| 157 | |||
| 158 | if ((root_node = (*di_init)("/", DINFOSUBTREE)) != | ||
| 159 | DI_NODE_NIL) { | ||
| 160 | (*di_walk_node)(root_node, DI_WALK_SIBFIRST, | ||
| 161 | di_node_name, walk_nodename); | ||
| 162 | (*di_fini)(root_node); | ||
| 163 | } | ||
| 164 | } while (0); | ||
| 165 | |||
| 166 | if (h) | ||
| 167 | dlclose(h); | ||
| 168 | } | ||
| 169 | |||
| 170 | #else | ||
| 171 | |||
| 172 | static sigjmp_buf common_jmp; | 36 | static sigjmp_buf common_jmp; |
| 173 | static void common_handler(int sig) | 37 | static void common_handler(int sig) |
| 174 | { | 38 | { |
| @@ -193,7 +57,7 @@ OPENSSL_cpuid_setup(void) | |||
| 193 | } | 57 | } |
| 194 | 58 | ||
| 195 | /* Initial value, fits UltraSPARC-I&II... */ | 59 | /* Initial value, fits UltraSPARC-I&II... */ |
| 196 | OPENSSL_sparcv9cap_P = SPARCV9_PREFER_FPU|SPARCV9_TICK_PRIVILEGED; | 60 | OPENSSL_sparcv9cap_P = SPARCV9_PREFER_FPU; |
| 197 | 61 | ||
| 198 | sigfillset(&all_masked); | 62 | sigfillset(&all_masked); |
| 199 | sigdelset(&all_masked, SIGILL); | 63 | sigdelset(&all_masked, SIGILL); |
| @@ -214,11 +78,6 @@ OPENSSL_cpuid_setup(void) | |||
| 214 | sigaction(SIGBUS,&common_act,&bus_oact);/* T1 fails 16-bit ldda [on Linux] */ | 78 | sigaction(SIGBUS,&common_act,&bus_oact);/* T1 fails 16-bit ldda [on Linux] */ |
| 215 | 79 | ||
| 216 | if (sigsetjmp(common_jmp, 1) == 0) { | 80 | if (sigsetjmp(common_jmp, 1) == 0) { |
| 217 | _sparcv9_rdtick(); | ||
| 218 | OPENSSL_sparcv9cap_P &= ~SPARCV9_TICK_PRIVILEGED; | ||
| 219 | } | ||
| 220 | |||
| 221 | if (sigsetjmp(common_jmp, 1) == 0) { | ||
| 222 | _sparcv9_vis1_probe(); | 81 | _sparcv9_vis1_probe(); |
| 223 | OPENSSL_sparcv9cap_P |= SPARCV9_VIS1; | 82 | OPENSSL_sparcv9cap_P |= SPARCV9_VIS1; |
| 224 | /* detect UltraSPARC-Tx, see sparccpud.S for details... */ | 83 | /* detect UltraSPARC-Tx, see sparccpud.S for details... */ |
| @@ -240,5 +99,3 @@ OPENSSL_cpuid_setup(void) | |||
| 240 | 99 | ||
| 241 | sigprocmask(SIG_SETMASK, &oset, NULL); | 100 | sigprocmask(SIG_SETMASK, &oset, NULL); |
| 242 | } | 101 | } |
| 243 | |||
| 244 | #endif | ||
diff --git a/src/lib/libcrypto/x86_64cpuid.pl b/src/lib/libcrypto/x86_64cpuid.pl index 8422e91342..3fe9a2d566 100644 --- a/src/lib/libcrypto/x86_64cpuid.pl +++ b/src/lib/libcrypto/x86_64cpuid.pl | |||
| @@ -42,16 +42,6 @@ OPENSSL_atomic_add: | |||
| 42 | ret | 42 | ret |
| 43 | .size OPENSSL_atomic_add,.-OPENSSL_atomic_add | 43 | .size OPENSSL_atomic_add,.-OPENSSL_atomic_add |
| 44 | 44 | ||
| 45 | .globl OPENSSL_rdtsc | ||
| 46 | .type OPENSSL_rdtsc,\@abi-omnipotent | ||
| 47 | .align 16 | ||
| 48 | OPENSSL_rdtsc: | ||
| 49 | rdtsc | ||
| 50 | shl \$32,%rdx | ||
| 51 | or %rdx,%rax | ||
| 52 | ret | ||
| 53 | .size OPENSSL_rdtsc,.-OPENSSL_rdtsc | ||
| 54 | |||
| 55 | .globl OPENSSL_ia32_cpuid | 45 | .globl OPENSSL_ia32_cpuid |
| 56 | .type OPENSSL_ia32_cpuid,\@abi-omnipotent | 46 | .type OPENSSL_ia32_cpuid,\@abi-omnipotent |
| 57 | .align 16 | 47 | .align 16 |
diff --git a/src/lib/libcrypto/x86cpuid.pl b/src/lib/libcrypto/x86cpuid.pl index 0da613f697..c7a57a3465 100644 --- a/src/lib/libcrypto/x86cpuid.pl +++ b/src/lib/libcrypto/x86cpuid.pl | |||
| @@ -143,17 +143,6 @@ for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); } | |||
| 143 | 143 | ||
| 144 | &external_label("OPENSSL_ia32cap_P"); | 144 | &external_label("OPENSSL_ia32cap_P"); |
| 145 | 145 | ||
| 146 | &function_begin_B("OPENSSL_rdtsc","EXTRN\t_OPENSSL_ia32cap_P:DWORD"); | ||
| 147 | &xor ("eax","eax"); | ||
| 148 | &xor ("edx","edx"); | ||
| 149 | &picmeup("ecx","OPENSSL_ia32cap_P"); | ||
| 150 | &bt (&DWP(0,"ecx"),4); | ||
| 151 | &jnc (&label("notsc")); | ||
| 152 | &rdtsc (); | ||
| 153 | &set_label("notsc"); | ||
| 154 | &ret (); | ||
| 155 | &function_end_B("OPENSSL_rdtsc"); | ||
| 156 | |||
| 157 | # This works in Ring 0 only [read DJGPP+MS-DOS+privileged DPMI host], | 146 | # This works in Ring 0 only [read DJGPP+MS-DOS+privileged DPMI host], |
| 158 | # but it's safe to call it on any [supported] 32-bit platform... | 147 | # but it's safe to call it on any [supported] 32-bit platform... |
| 159 | # Just check for [non-]zero return value... | 148 | # Just check for [non-]zero return value... |
diff --git a/src/lib/libssl/src/crypto/alphacpuid.pl b/src/lib/libssl/src/crypto/alphacpuid.pl index f6aea6a766..0ff4ae22e3 100644 --- a/src/lib/libssl/src/crypto/alphacpuid.pl +++ b/src/lib/libssl/src/crypto/alphacpuid.pl | |||
| @@ -77,13 +77,4 @@ OPENSSL_atomic_add: | |||
| 77 | addl $0,$17,$0 | 77 | addl $0,$17,$0 |
| 78 | ret ($26) | 78 | ret ($26) |
| 79 | .end OPENSSL_atomic_add | 79 | .end OPENSSL_atomic_add |
| 80 | |||
| 81 | .globl OPENSSL_rdtsc | ||
| 82 | .ent OPENSSL_rdtsc | ||
| 83 | OPENSSL_rdtsc: | ||
| 84 | .frame $30,0,$26 | ||
| 85 | .prologue 0 | ||
| 86 | rpcc $0 | ||
| 87 | ret ($26) | ||
| 88 | .end OPENSSL_rdtsc | ||
| 89 | ___ | 80 | ___ |
diff --git a/src/lib/libssl/src/crypto/arm_arch.h b/src/lib/libssl/src/crypto/arm_arch.h index 0ccafb2215..01797eb4e3 100644 --- a/src/lib/libssl/src/crypto/arm_arch.h +++ b/src/lib/libssl/src/crypto/arm_arch.h | |||
| @@ -45,7 +45,6 @@ | |||
| 45 | extern unsigned int OPENSSL_armcap_P; | 45 | extern unsigned int OPENSSL_armcap_P; |
| 46 | 46 | ||
| 47 | #define ARMV7_NEON (1<<0) | 47 | #define ARMV7_NEON (1<<0) |
| 48 | #define ARMV7_TICK (1<<1) | ||
| 49 | #endif | 48 | #endif |
| 50 | 49 | ||
| 51 | #endif | 50 | #endif |
diff --git a/src/lib/libssl/src/crypto/armcap.c b/src/lib/libssl/src/crypto/armcap.c index 0625587bdd..f40993c1d5 100644 --- a/src/lib/libssl/src/crypto/armcap.c +++ b/src/lib/libssl/src/crypto/armcap.c | |||
| @@ -20,16 +20,6 @@ static sigjmp_buf ill_jmp; | |||
| 20 | * ARM compilers support inline assembler... | 20 | * ARM compilers support inline assembler... |
| 21 | */ | 21 | */ |
| 22 | void _armv7_neon_probe(void); | 22 | void _armv7_neon_probe(void); |
| 23 | unsigned int _armv7_tick(void); | ||
| 24 | |||
| 25 | unsigned int | ||
| 26 | OPENSSL_rdtsc(void) | ||
| 27 | { | ||
| 28 | if (OPENSSL_armcap_P & ARMV7_TICK) | ||
| 29 | return _armv7_tick(); | ||
| 30 | else | ||
| 31 | return 0; | ||
| 32 | } | ||
| 33 | 23 | ||
| 34 | #if defined(__GNUC__) && __GNUC__>=2 | 24 | #if defined(__GNUC__) && __GNUC__>=2 |
| 35 | void OPENSSL_cpuid_setup(void) __attribute__((constructor)); | 25 | void OPENSSL_cpuid_setup(void) __attribute__((constructor)); |
| @@ -72,10 +62,6 @@ OPENSSL_cpuid_setup(void) | |||
| 72 | _armv7_neon_probe(); | 62 | _armv7_neon_probe(); |
| 73 | OPENSSL_armcap_P |= ARMV7_NEON; | 63 | OPENSSL_armcap_P |= ARMV7_NEON; |
| 74 | } | 64 | } |
| 75 | if (sigsetjmp(ill_jmp, 1) == 0) { | ||
| 76 | _armv7_tick(); | ||
| 77 | OPENSSL_armcap_P |= ARMV7_TICK; | ||
| 78 | } | ||
| 79 | 65 | ||
| 80 | sigaction (SIGILL, &ill_oact, NULL); | 66 | sigaction (SIGILL, &ill_oact, NULL); |
| 81 | sigprocmask(SIG_SETMASK, &oset, NULL); | 67 | sigprocmask(SIG_SETMASK, &oset, NULL); |
diff --git a/src/lib/libssl/src/crypto/armv4cpuid.S b/src/lib/libssl/src/crypto/armv4cpuid.S index bdfde19c1f..ba86c9709a 100644 --- a/src/lib/libssl/src/crypto/armv4cpuid.S +++ b/src/lib/libssl/src/crypto/armv4cpuid.S | |||
| @@ -11,13 +11,6 @@ _armv7_neon_probe: | |||
| 11 | .word 0xe12fff1e @ bx lr | 11 | .word 0xe12fff1e @ bx lr |
| 12 | .size _armv7_neon_probe,.-_armv7_neon_probe | 12 | .size _armv7_neon_probe,.-_armv7_neon_probe |
| 13 | 13 | ||
| 14 | .global _armv7_tick | ||
| 15 | .type _armv7_tick,%function | ||
| 16 | _armv7_tick: | ||
| 17 | mrc p15,0,r0,c9,c13,0 | ||
| 18 | .word 0xe12fff1e @ bx lr | ||
| 19 | .size _armv7_tick,.-_armv7_tick | ||
| 20 | |||
| 21 | .global OPENSSL_atomic_add | 14 | .global OPENSSL_atomic_add |
| 22 | .type OPENSSL_atomic_add,%function | 15 | .type OPENSSL_atomic_add,%function |
| 23 | OPENSSL_atomic_add: | 16 | OPENSSL_atomic_add: |
diff --git a/src/lib/libssl/src/crypto/ia64cpuid.S b/src/lib/libssl/src/crypto/ia64cpuid.S index 517d938888..39e8093c6c 100644 --- a/src/lib/libssl/src/crypto/ia64cpuid.S +++ b/src/lib/libssl/src/crypto/ia64cpuid.S | |||
| @@ -8,13 +8,6 @@ OPENSSL_cpuid_setup: | |||
| 8 | { .mib; br.ret.sptk.many b0 };; | 8 | { .mib; br.ret.sptk.many b0 };; |
| 9 | .endp OPENSSL_cpuid_setup# | 9 | .endp OPENSSL_cpuid_setup# |
| 10 | 10 | ||
| 11 | .global OPENSSL_rdtsc# | ||
| 12 | .proc OPENSSL_rdtsc# | ||
| 13 | OPENSSL_rdtsc: | ||
| 14 | { .mib; mov r8=ar.itc | ||
| 15 | br.ret.sptk.many b0 };; | ||
| 16 | .endp OPENSSL_rdtsc# | ||
| 17 | |||
| 18 | .global OPENSSL_atomic_add# | 11 | .global OPENSSL_atomic_add# |
| 19 | .proc OPENSSL_atomic_add# | 12 | .proc OPENSSL_atomic_add# |
| 20 | .align 32 | 13 | .align 32 |
diff --git a/src/lib/libssl/src/crypto/pariscid.pl b/src/lib/libssl/src/crypto/pariscid.pl index 38985afbac..cd86b90704 100644 --- a/src/lib/libssl/src/crypto/pariscid.pl +++ b/src/lib/libssl/src/crypto/pariscid.pl | |||
| @@ -34,18 +34,6 @@ OPENSSL_cpuid_setup | |||
| 34 | nop | 34 | nop |
| 35 | .PROCEND | 35 | .PROCEND |
| 36 | 36 | ||
| 37 | .EXPORT OPENSSL_rdtsc,ENTRY | ||
| 38 | .ALIGN 8 | ||
| 39 | OPENSSL_rdtsc | ||
| 40 | .PROC | ||
| 41 | .CALLINFO NO_CALLS | ||
| 42 | .ENTRY | ||
| 43 | mfctl %cr16,$rv | ||
| 44 | bv ($rp) | ||
| 45 | .EXIT | ||
| 46 | nop | ||
| 47 | .PROCEND | ||
| 48 | |||
| 49 | .EXPORT OPENSSL_wipe_cpu,ENTRY | 37 | .EXPORT OPENSSL_wipe_cpu,ENTRY |
| 50 | .ALIGN 8 | 38 | .ALIGN 8 |
| 51 | OPENSSL_wipe_cpu | 39 | OPENSSL_wipe_cpu |
diff --git a/src/lib/libssl/src/crypto/ppccpuid.pl b/src/lib/libssl/src/crypto/ppccpuid.pl index cf48714e33..37c33c051a 100755 --- a/src/lib/libssl/src/crypto/ppccpuid.pl +++ b/src/lib/libssl/src/crypto/ppccpuid.pl | |||
| @@ -84,15 +84,6 @@ Ladd: lwarx r5,0,r3 | |||
| 84 | .long 0 | 84 | .long 0 |
| 85 | .byte 0,12,0x14,0,0,0,2,0 | 85 | .byte 0,12,0x14,0,0,0,2,0 |
| 86 | .long 0 | 86 | .long 0 |
| 87 | |||
| 88 | .globl .OPENSSL_rdtsc | ||
| 89 | .align 4 | ||
| 90 | .OPENSSL_rdtsc: | ||
| 91 | mftb r3 | ||
| 92 | mftbu r4 | ||
| 93 | blr | ||
| 94 | .long 0 | ||
| 95 | .byte 0,12,0x14,0,0,0,0,0 | ||
| 96 | ___ | 87 | ___ |
| 97 | 88 | ||
| 98 | $code =~ s/\`([^\`]*)\`/eval $1/gem; | 89 | $code =~ s/\`([^\`]*)\`/eval $1/gem; |
diff --git a/src/lib/libssl/src/crypto/s390xcpuid.S b/src/lib/libssl/src/crypto/s390xcpuid.S index 89bf6be82f..25adb646c4 100644 --- a/src/lib/libssl/src/crypto/s390xcpuid.S +++ b/src/lib/libssl/src/crypto/s390xcpuid.S | |||
| @@ -16,15 +16,6 @@ OPENSSL_s390x_facilities: | |||
| 16 | br %r14 | 16 | br %r14 |
| 17 | .size OPENSSL_s390x_facilities,.-OPENSSL_s390x_facilities | 17 | .size OPENSSL_s390x_facilities,.-OPENSSL_s390x_facilities |
| 18 | 18 | ||
| 19 | .globl OPENSSL_rdtsc | ||
| 20 | .type OPENSSL_rdtsc,@function | ||
| 21 | .align 16 | ||
| 22 | OPENSSL_rdtsc: | ||
| 23 | stck 16(%r15) | ||
| 24 | lg %r2,16(%r15) | ||
| 25 | br %r14 | ||
| 26 | .size OPENSSL_rdtsc,.-OPENSSL_rdtsc | ||
| 27 | |||
| 28 | .globl OPENSSL_atomic_add | 19 | .globl OPENSSL_atomic_add |
| 29 | .type OPENSSL_atomic_add,@function | 20 | .type OPENSSL_atomic_add,@function |
| 30 | .align 16 | 21 | .align 16 |
diff --git a/src/lib/libssl/src/crypto/sparccpuid.S b/src/lib/libssl/src/crypto/sparccpuid.S index d8b44af2f0..b913e3dddb 100644 --- a/src/lib/libssl/src/crypto/sparccpuid.S +++ b/src/lib/libssl/src/crypto/sparccpuid.S | |||
| @@ -215,23 +215,6 @@ OPENSSL_atomic_add: | |||
| 215 | sra %o0,%g0,%o0 ! we return signed int, remember? | 215 | sra %o0,%g0,%o0 ! we return signed int, remember? |
| 216 | .size OPENSSL_atomic_add,.-OPENSSL_atomic_add | 216 | .size OPENSSL_atomic_add,.-OPENSSL_atomic_add |
| 217 | 217 | ||
| 218 | .global _sparcv9_rdtick | ||
| 219 | .align 32 | ||
| 220 | _sparcv9_rdtick: | ||
| 221 | subcc %g0,1,%o0 | ||
| 222 | .word 0x91408000 !rd %ccr,%o0 | ||
| 223 | cmp %o0,0x99 | ||
| 224 | bne .notick | ||
| 225 | xor %o0,%o0,%o0 | ||
| 226 | .word 0x91410000 !rd %tick,%o0 | ||
| 227 | retl | ||
| 228 | .word 0x93323020 !srlx %o0,32,%o1 | ||
| 229 | .notick: | ||
| 230 | retl | ||
| 231 | xor %o1,%o1,%o1 | ||
| 232 | .type _sparcv9_rdtick,#function | ||
| 233 | .size _sparcv9_rdtick,.-_sparcv9_rdtick | ||
| 234 | |||
| 235 | .global _sparcv9_vis1_probe | 218 | .global _sparcv9_vis1_probe |
| 236 | .align 8 | 219 | .align 8 |
| 237 | _sparcv9_vis1_probe: | 220 | _sparcv9_vis1_probe: |
diff --git a/src/lib/libssl/src/crypto/sparcv9cap.c b/src/lib/libssl/src/crypto/sparcv9cap.c index 05c084807a..f49e71ec93 100644 --- a/src/lib/libssl/src/crypto/sparcv9cap.c +++ b/src/lib/libssl/src/crypto/sparcv9cap.c | |||
| @@ -6,13 +6,12 @@ | |||
| 6 | #include <sys/time.h> | 6 | #include <sys/time.h> |
| 7 | #include <openssl/bn.h> | 7 | #include <openssl/bn.h> |
| 8 | 8 | ||
| 9 | #define SPARCV9_TICK_PRIVILEGED (1<<0) | ||
| 10 | #define SPARCV9_PREFER_FPU (1<<1) | 9 | #define SPARCV9_PREFER_FPU (1<<1) |
| 11 | #define SPARCV9_VIS1 (1<<2) | 10 | #define SPARCV9_VIS1 (1<<2) |
| 12 | #define SPARCV9_VIS2 (1<<3) /* reserved */ | 11 | #define SPARCV9_VIS2 (1<<3) /* reserved */ |
| 13 | #define SPARCV9_FMADD (1<<4) /* reserved for SPARC64 V */ | 12 | #define SPARCV9_FMADD (1<<4) /* reserved for SPARC64 V */ |
| 14 | 13 | ||
| 15 | static int OPENSSL_sparcv9cap_P = SPARCV9_TICK_PRIVILEGED; | 14 | static int OPENSSL_sparcv9cap_P = 0; |
| 16 | 15 | ||
| 17 | int | 16 | int |
| 18 | bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, | 17 | bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, |
| @@ -29,146 +28,11 @@ bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, | |||
| 29 | return bn_mul_mont_int(rp, ap, bp, np, n0, num); | 28 | return bn_mul_mont_int(rp, ap, bp, np, n0, num); |
| 30 | } | 29 | } |
| 31 | 30 | ||
| 32 | unsigned long _sparcv9_rdtick(void); | ||
| 33 | void _sparcv9_vis1_probe(void); | 31 | void _sparcv9_vis1_probe(void); |
| 34 | unsigned long _sparcv9_vis1_instrument(void); | 32 | unsigned long _sparcv9_vis1_instrument(void); |
| 35 | void _sparcv9_vis2_probe(void); | 33 | void _sparcv9_vis2_probe(void); |
| 36 | void _sparcv9_fmadd_probe(void); | 34 | void _sparcv9_fmadd_probe(void); |
| 37 | 35 | ||
| 38 | unsigned long | ||
| 39 | OPENSSL_rdtsc(void) | ||
| 40 | { | ||
| 41 | if (OPENSSL_sparcv9cap_P&SPARCV9_TICK_PRIVILEGED) | ||
| 42 | #if defined(__sun) && defined(__SVR4) | ||
| 43 | return gethrtime(); | ||
| 44 | #else | ||
| 45 | return 0; | ||
| 46 | #endif | ||
| 47 | else | ||
| 48 | return _sparcv9_rdtick(); | ||
| 49 | } | ||
| 50 | |||
| 51 | #if 0 && defined(__sun) && defined(__SVR4) | ||
| 52 | /* This code path is disabled, because of incompatibility of | ||
| 53 | * libdevinfo.so.1 and libmalloc.so.1 (see below for details) | ||
| 54 | */ | ||
| 55 | #include <malloc.h> | ||
| 56 | #include <dlfcn.h> | ||
| 57 | #include <libdevinfo.h> | ||
| 58 | #include <sys/systeminfo.h> | ||
| 59 | |||
| 60 | typedef di_node_t (*di_init_t)(const char *, uint_t); | ||
| 61 | typedef void (*di_fini_t)(di_node_t); | ||
| 62 | typedef char * (*di_node_name_t)(di_node_t); | ||
| 63 | typedef int (*di_walk_node_t)(di_node_t, uint_t, di_node_name_t, int (*)(di_node_t, di_node_name_t)); | ||
| 64 | |||
| 65 | #define DLLINK(h,name) (name=(name##_t)dlsym((h),#name)) | ||
| 66 | |||
| 67 | static int | ||
| 68 | walk_nodename(di_node_t node, di_node_name_t di_node_name) | ||
| 69 | { | ||
| 70 | char *name = (*di_node_name)(node); | ||
| 71 | |||
| 72 | /* This is expected to catch all UltraSPARC flavors prior T1 */ | ||
| 73 | if (!strcmp (name, "SUNW,UltraSPARC") || | ||
| 74 | !strncmp(name,"SUNW,UltraSPARC-I",17)) /* covers II,III,IV */ | ||
| 75 | { | ||
| 76 | OPENSSL_sparcv9cap_P |= SPARCV9_PREFER_FPU|SPARCV9_VIS1; | ||
| 77 | |||
| 78 | /* %tick is privileged only on UltraSPARC-I/II, but not IIe */ | ||
| 79 | if (name[14]!='\0' && name[17]!='\0' && name[18]!='\0') | ||
| 80 | OPENSSL_sparcv9cap_P &= ~SPARCV9_TICK_PRIVILEGED; | ||
| 81 | |||
| 82 | return DI_WALK_TERMINATE; | ||
| 83 | } | ||
| 84 | /* This is expected to catch remaining UltraSPARCs, such as T1 */ | ||
| 85 | else if (!strncmp(name, "SUNW,UltraSPARC", 15)) { | ||
| 86 | OPENSSL_sparcv9cap_P &= ~SPARCV9_TICK_PRIVILEGED; | ||
| 87 | |||
| 88 | return DI_WALK_TERMINATE; | ||
| 89 | } | ||
| 90 | |||
| 91 | return DI_WALK_CONTINUE; | ||
| 92 | } | ||
| 93 | |||
| 94 | void | ||
| 95 | OPENSSL_cpuid_setup(void) | ||
| 96 | { | ||
| 97 | void *h; | ||
| 98 | char *e, si[256]; | ||
| 99 | static int trigger = 0; | ||
| 100 | |||
| 101 | if (trigger) | ||
| 102 | return; | ||
| 103 | trigger = 1; | ||
| 104 | |||
| 105 | if ((e = getenv("OPENSSL_sparcv9cap"))) { | ||
| 106 | OPENSSL_sparcv9cap_P = strtoul(e, NULL, 0); | ||
| 107 | return; | ||
| 108 | } | ||
| 109 | |||
| 110 | if (sysinfo(SI_MACHINE, si, sizeof(si)) > 0) { | ||
| 111 | if (strcmp(si, "sun4v")) | ||
| 112 | /* FPU is preferred for all CPUs, but US-T1/2 */ | ||
| 113 | OPENSSL_sparcv9cap_P |= SPARCV9_PREFER_FPU; | ||
| 114 | } | ||
| 115 | |||
| 116 | if (sysinfo(SI_ISALIST, si, sizeof(si)) > 0) { | ||
| 117 | if (strstr(si, "+vis")) | ||
| 118 | OPENSSL_sparcv9cap_P |= SPARCV9_VIS1; | ||
| 119 | if (strstr(si, "+vis2")) { | ||
| 120 | OPENSSL_sparcv9cap_P |= SPARCV9_VIS2; | ||
| 121 | OPENSSL_sparcv9cap_P &= ~SPARCV9_TICK_PRIVILEGED; | ||
| 122 | return; | ||
| 123 | } | ||
| 124 | } | ||
| 125 | #ifdef M_KEEP | ||
| 126 | /* | ||
| 127 | * Solaris libdevinfo.so.1 is effectively incomatible with | ||
| 128 | * libmalloc.so.1. Specifically, if application is linked with | ||
| 129 | * -lmalloc, it crashes upon startup with SIGSEGV in | ||
| 130 | * free(3LIBMALLOC) called by di_fini. Prior call to | ||
| 131 | * mallopt(M_KEEP,0) somehow helps... But not always... | ||
| 132 | */ | ||
| 133 | if ((h = dlopen(NULL, RTLD_LAZY))) { | ||
| 134 | union { void *p; | ||
| 135 | int (*f)(int, int); | ||
| 136 | } sym; | ||
| 137 | if ((sym.p = dlsym(h, "mallopt"))) (*sym.f)(M_KEEP, 0); | ||
| 138 | dlclose(h); | ||
| 139 | } | ||
| 140 | #endif | ||
| 141 | if ((h = dlopen("libdevinfo.so.1", RTLD_LAZY))) | ||
| 142 | do { | ||
| 143 | di_init_t di_init; | ||
| 144 | di_fini_t di_fini; | ||
| 145 | di_walk_node_t di_walk_node; | ||
| 146 | di_node_name_t di_node_name; | ||
| 147 | di_node_t root_node; | ||
| 148 | |||
| 149 | if (!DLLINK(h, di_init)) | ||
| 150 | break; | ||
| 151 | if (!DLLINK(h, di_fini)) | ||
| 152 | break; | ||
| 153 | if (!DLLINK(h, di_walk_node)) | ||
| 154 | break; | ||
| 155 | if (!DLLINK(h, di_node_name)) | ||
| 156 | break; | ||
| 157 | |||
| 158 | if ((root_node = (*di_init)("/", DINFOSUBTREE)) != | ||
| 159 | DI_NODE_NIL) { | ||
| 160 | (*di_walk_node)(root_node, DI_WALK_SIBFIRST, | ||
| 161 | di_node_name, walk_nodename); | ||
| 162 | (*di_fini)(root_node); | ||
| 163 | } | ||
| 164 | } while (0); | ||
| 165 | |||
| 166 | if (h) | ||
| 167 | dlclose(h); | ||
| 168 | } | ||
| 169 | |||
| 170 | #else | ||
| 171 | |||
| 172 | static sigjmp_buf common_jmp; | 36 | static sigjmp_buf common_jmp; |
| 173 | static void common_handler(int sig) | 37 | static void common_handler(int sig) |
| 174 | { | 38 | { |
| @@ -193,7 +57,7 @@ OPENSSL_cpuid_setup(void) | |||
| 193 | } | 57 | } |
| 194 | 58 | ||
| 195 | /* Initial value, fits UltraSPARC-I&II... */ | 59 | /* Initial value, fits UltraSPARC-I&II... */ |
| 196 | OPENSSL_sparcv9cap_P = SPARCV9_PREFER_FPU|SPARCV9_TICK_PRIVILEGED; | 60 | OPENSSL_sparcv9cap_P = SPARCV9_PREFER_FPU; |
| 197 | 61 | ||
| 198 | sigfillset(&all_masked); | 62 | sigfillset(&all_masked); |
| 199 | sigdelset(&all_masked, SIGILL); | 63 | sigdelset(&all_masked, SIGILL); |
| @@ -214,11 +78,6 @@ OPENSSL_cpuid_setup(void) | |||
| 214 | sigaction(SIGBUS,&common_act,&bus_oact);/* T1 fails 16-bit ldda [on Linux] */ | 78 | sigaction(SIGBUS,&common_act,&bus_oact);/* T1 fails 16-bit ldda [on Linux] */ |
| 215 | 79 | ||
| 216 | if (sigsetjmp(common_jmp, 1) == 0) { | 80 | if (sigsetjmp(common_jmp, 1) == 0) { |
| 217 | _sparcv9_rdtick(); | ||
| 218 | OPENSSL_sparcv9cap_P &= ~SPARCV9_TICK_PRIVILEGED; | ||
| 219 | } | ||
| 220 | |||
| 221 | if (sigsetjmp(common_jmp, 1) == 0) { | ||
| 222 | _sparcv9_vis1_probe(); | 81 | _sparcv9_vis1_probe(); |
| 223 | OPENSSL_sparcv9cap_P |= SPARCV9_VIS1; | 82 | OPENSSL_sparcv9cap_P |= SPARCV9_VIS1; |
| 224 | /* detect UltraSPARC-Tx, see sparccpud.S for details... */ | 83 | /* detect UltraSPARC-Tx, see sparccpud.S for details... */ |
| @@ -240,5 +99,3 @@ OPENSSL_cpuid_setup(void) | |||
| 240 | 99 | ||
| 241 | sigprocmask(SIG_SETMASK, &oset, NULL); | 100 | sigprocmask(SIG_SETMASK, &oset, NULL); |
| 242 | } | 101 | } |
| 243 | |||
| 244 | #endif | ||
diff --git a/src/lib/libssl/src/crypto/x86_64cpuid.pl b/src/lib/libssl/src/crypto/x86_64cpuid.pl index 8422e91342..3fe9a2d566 100644 --- a/src/lib/libssl/src/crypto/x86_64cpuid.pl +++ b/src/lib/libssl/src/crypto/x86_64cpuid.pl | |||
| @@ -42,16 +42,6 @@ OPENSSL_atomic_add: | |||
| 42 | ret | 42 | ret |
| 43 | .size OPENSSL_atomic_add,.-OPENSSL_atomic_add | 43 | .size OPENSSL_atomic_add,.-OPENSSL_atomic_add |
| 44 | 44 | ||
| 45 | .globl OPENSSL_rdtsc | ||
| 46 | .type OPENSSL_rdtsc,\@abi-omnipotent | ||
| 47 | .align 16 | ||
| 48 | OPENSSL_rdtsc: | ||
| 49 | rdtsc | ||
| 50 | shl \$32,%rdx | ||
| 51 | or %rdx,%rax | ||
| 52 | ret | ||
| 53 | .size OPENSSL_rdtsc,.-OPENSSL_rdtsc | ||
| 54 | |||
| 55 | .globl OPENSSL_ia32_cpuid | 45 | .globl OPENSSL_ia32_cpuid |
| 56 | .type OPENSSL_ia32_cpuid,\@abi-omnipotent | 46 | .type OPENSSL_ia32_cpuid,\@abi-omnipotent |
| 57 | .align 16 | 47 | .align 16 |
diff --git a/src/lib/libssl/src/crypto/x86cpuid.pl b/src/lib/libssl/src/crypto/x86cpuid.pl index 0da613f697..c7a57a3465 100644 --- a/src/lib/libssl/src/crypto/x86cpuid.pl +++ b/src/lib/libssl/src/crypto/x86cpuid.pl | |||
| @@ -143,17 +143,6 @@ for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); } | |||
| 143 | 143 | ||
| 144 | &external_label("OPENSSL_ia32cap_P"); | 144 | &external_label("OPENSSL_ia32cap_P"); |
| 145 | 145 | ||
| 146 | &function_begin_B("OPENSSL_rdtsc","EXTRN\t_OPENSSL_ia32cap_P:DWORD"); | ||
| 147 | &xor ("eax","eax"); | ||
| 148 | &xor ("edx","edx"); | ||
| 149 | &picmeup("ecx","OPENSSL_ia32cap_P"); | ||
| 150 | &bt (&DWP(0,"ecx"),4); | ||
| 151 | &jnc (&label("notsc")); | ||
| 152 | &rdtsc (); | ||
| 153 | &set_label("notsc"); | ||
| 154 | &ret (); | ||
| 155 | &function_end_B("OPENSSL_rdtsc"); | ||
| 156 | |||
| 157 | # This works in Ring 0 only [read DJGPP+MS-DOS+privileged DPMI host], | 146 | # This works in Ring 0 only [read DJGPP+MS-DOS+privileged DPMI host], |
| 158 | # but it's safe to call it on any [supported] 32-bit platform... | 147 | # but it's safe to call it on any [supported] 32-bit platform... |
| 159 | # Just check for [non-]zero return value... | 148 | # Just check for [non-]zero return value... |
