Remove oh-so-important-from-a-security-pov OpenSSL_rtdsc() function.
authormiod <miod@openbsd.org>
Thu, 17 Apr 2014 18:49:35 +0000 (18:49 +0000)
committermiod <miod@openbsd.org>
Thu, 17 Apr 2014 18:49:35 +0000 (18:49 +0000)
24 files changed:
lib/libcrypto/alphacpuid.pl
lib/libcrypto/arm_arch.h
lib/libcrypto/armcap.c
lib/libcrypto/armv4cpuid.S
lib/libcrypto/ia64cpuid.S
lib/libcrypto/pariscid.pl
lib/libcrypto/ppccpuid.pl
lib/libcrypto/s390xcpuid.S
lib/libcrypto/sparccpuid.S
lib/libcrypto/sparcv9cap.c
lib/libcrypto/x86_64cpuid.pl
lib/libcrypto/x86cpuid.pl
lib/libssl/src/crypto/alphacpuid.pl
lib/libssl/src/crypto/arm_arch.h
lib/libssl/src/crypto/armcap.c
lib/libssl/src/crypto/armv4cpuid.S
lib/libssl/src/crypto/ia64cpuid.S
lib/libssl/src/crypto/pariscid.pl
lib/libssl/src/crypto/ppccpuid.pl
lib/libssl/src/crypto/s390xcpuid.S
lib/libssl/src/crypto/sparccpuid.S
lib/libssl/src/crypto/sparcv9cap.c
lib/libssl/src/crypto/x86_64cpuid.pl
lib/libssl/src/crypto/x86cpuid.pl

index f6aea6a..0ff4ae2 100644 (file)
@@ -77,13 +77,4 @@ OPENSSL_atomic_add:
        addl    $0,$17,$0
        ret     ($26)
 .end   OPENSSL_atomic_add
-
-.globl OPENSSL_rdtsc
-.ent   OPENSSL_rdtsc
-OPENSSL_rdtsc:
-       .frame  $30,0,$26
-       .prologue 0
-       rpcc    $0
-       ret     ($26)
-.end   OPENSSL_rdtsc
 ___
index 0ccafb2..01797eb 100644 (file)
@@ -45,7 +45,6 @@
 extern unsigned int OPENSSL_armcap_P;
 
 #define ARMV7_NEON      (1<<0)
-#define ARMV7_TICK      (1<<1)
 #endif
 
 #endif
index 0625587..f40993c 100644 (file)
@@ -20,16 +20,6 @@ static sigjmp_buf ill_jmp;
  * ARM compilers support inline assembler...
  */
 void _armv7_neon_probe(void);
-unsigned int _armv7_tick(void);
-
-unsigned int
-OPENSSL_rdtsc(void)
-{
-       if (OPENSSL_armcap_P & ARMV7_TICK)
-               return _armv7_tick();
-       else
-               return 0;
-}
 
 #if defined(__GNUC__) && __GNUC__>=2
 void OPENSSL_cpuid_setup(void) __attribute__((constructor));
@@ -72,10 +62,6 @@ OPENSSL_cpuid_setup(void)
                _armv7_neon_probe();
                OPENSSL_armcap_P |= ARMV7_NEON;
        }
-       if (sigsetjmp(ill_jmp, 1) == 0) {
-               _armv7_tick();
-               OPENSSL_armcap_P |= ARMV7_TICK;
-       }
 
        sigaction (SIGILL, &ill_oact, NULL);
        sigprocmask(SIG_SETMASK, &oset, NULL);
index bdfde19..ba86c97 100644 (file)
@@ -11,13 +11,6 @@ _armv7_neon_probe:
        .word   0xe12fff1e      @ bx    lr
 .size  _armv7_neon_probe,.-_armv7_neon_probe
 
-.global        _armv7_tick
-.type  _armv7_tick,%function
-_armv7_tick:
-       mrc     p15,0,r0,c9,c13,0
-       .word   0xe12fff1e      @ bx    lr
-.size  _armv7_tick,.-_armv7_tick
-
 .global        OPENSSL_atomic_add
 .type  OPENSSL_atomic_add,%function
 OPENSSL_atomic_add:
index 517d938..39e8093 100644 (file)
@@ -8,13 +8,6 @@ OPENSSL_cpuid_setup:
 { .mib;        br.ret.sptk.many        b0              };;
 .endp  OPENSSL_cpuid_setup#
 
-.global        OPENSSL_rdtsc#
-.proc  OPENSSL_rdtsc#
-OPENSSL_rdtsc:
-{ .mib;        mov                     r8=ar.itc
-       br.ret.sptk.many        b0              };;
-.endp   OPENSSL_rdtsc#
-
 .global        OPENSSL_atomic_add#
 .proc  OPENSSL_atomic_add#
 .align 32
index 38985af..cd86b90 100644 (file)
@@ -34,18 +34,6 @@ OPENSSL_cpuid_setup
        nop
        .PROCEND
 
-       .EXPORT OPENSSL_rdtsc,ENTRY
-       .ALIGN  8
-OPENSSL_rdtsc
-       .PROC
-       .CALLINFO       NO_CALLS
-       .ENTRY
-       mfctl   %cr16,$rv
-       bv      ($rp)
-       .EXIT
-       nop
-       .PROCEND
-
        .EXPORT OPENSSL_wipe_cpu,ENTRY
        .ALIGN  8
 OPENSSL_wipe_cpu
index cf48714..37c33c0 100755 (executable)
@@ -84,15 +84,6 @@ Ladd:        lwarx   r5,0,r3
        .long   0
        .byte   0,12,0x14,0,0,0,2,0
        .long   0
-
-.globl .OPENSSL_rdtsc
-.align 4
-.OPENSSL_rdtsc:
-       mftb    r3
-       mftbu   r4
-       blr
-       .long   0
-       .byte   0,12,0x14,0,0,0,0,0
 ___
 
 $code =~ s/\`([^\`]*)\`/eval $1/gem;
index 89bf6be..25adb64 100644 (file)
@@ -16,15 +16,6 @@ OPENSSL_s390x_facilities:
        br      %r14
 .size  OPENSSL_s390x_facilities,.-OPENSSL_s390x_facilities
 
-.globl OPENSSL_rdtsc
-.type  OPENSSL_rdtsc,@function
-.align 16
-OPENSSL_rdtsc:
-       stck    16(%r15)
-       lg      %r2,16(%r15)
-       br      %r14
-.size  OPENSSL_rdtsc,.-OPENSSL_rdtsc
-
 .globl OPENSSL_atomic_add
 .type  OPENSSL_atomic_add,@function
 .align 16
index d8b44af..b913e3d 100644 (file)
@@ -215,23 +215,6 @@ OPENSSL_atomic_add:
        sra     %o0,%g0,%o0     ! we return signed int, remember?
 .size  OPENSSL_atomic_add,.-OPENSSL_atomic_add
 
-.global        _sparcv9_rdtick
-.align 32
-_sparcv9_rdtick:
-       subcc   %g0,1,%o0
-       .word   0x91408000      !rd     %ccr,%o0
-       cmp     %o0,0x99
-       bne     .notick
-       xor     %o0,%o0,%o0
-       .word   0x91410000      !rd     %tick,%o0
-       retl
-       .word   0x93323020      !srlx   %o0,32,%o1
-.notick:
-       retl
-       xor     %o1,%o1,%o1
-.type  _sparcv9_rdtick,#function
-.size  _sparcv9_rdtick,.-_sparcv9_rdtick
-
 .global        _sparcv9_vis1_probe
 .align 8
 _sparcv9_vis1_probe:
index 05c0848..f49e71e 100644 (file)
@@ -6,13 +6,12 @@
 #include <sys/time.h>
 #include <openssl/bn.h>
 
-#define SPARCV9_TICK_PRIVILEGED        (1<<0)
 #define SPARCV9_PREFER_FPU     (1<<1)
 #define SPARCV9_VIS1           (1<<2)
 #define SPARCV9_VIS2           (1<<3)  /* reserved */
 #define SPARCV9_FMADD          (1<<4)  /* reserved for SPARC64 V */
 
-static int OPENSSL_sparcv9cap_P = SPARCV9_TICK_PRIVILEGED;
+static int OPENSSL_sparcv9cap_P = 0;
 
 int
 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,
                return bn_mul_mont_int(rp, ap, bp, np, n0, num);
 }
 
-unsigned long  _sparcv9_rdtick(void);
 void           _sparcv9_vis1_probe(void);
 unsigned long  _sparcv9_vis1_instrument(void);
 void           _sparcv9_vis2_probe(void);
 void           _sparcv9_fmadd_probe(void);
 
-unsigned long
-OPENSSL_rdtsc(void)
-{
-       if (OPENSSL_sparcv9cap_P&SPARCV9_TICK_PRIVILEGED)
-#if defined(__sun) && defined(__SVR4)
-               return gethrtime();
-#else
-               return 0;
-#endif
-       else
-               return _sparcv9_rdtick();
-}
-
-#if 0 && defined(__sun) && defined(__SVR4)
-/* This code path is disabled, because of incompatibility of
- * libdevinfo.so.1 and libmalloc.so.1 (see below for details)
- */
-#include <malloc.h>
-#include <dlfcn.h>
-#include <libdevinfo.h>
-#include <sys/systeminfo.h>
-
-typedef di_node_t (*di_init_t)(const char *, uint_t);
-typedef void      (*di_fini_t)(di_node_t);
-typedef char *    (*di_node_name_t)(di_node_t);
-typedef int       (*di_walk_node_t)(di_node_t, uint_t, di_node_name_t, int (*)(di_node_t, di_node_name_t));
-
-#define DLLINK(h,name) (name=(name##_t)dlsym((h),#name))
-
-static int
-walk_nodename(di_node_t node, di_node_name_t di_node_name)
-{
-       char *name = (*di_node_name)(node);
-
-       /* This is expected to catch all UltraSPARC flavors prior T1 */
-       if (!strcmp (name, "SUNW,UltraSPARC") ||
-           !strncmp(name,"SUNW,UltraSPARC-I",17))  /* covers II,III,IV */
-       {
-               OPENSSL_sparcv9cap_P |= SPARCV9_PREFER_FPU|SPARCV9_VIS1;
-
-               /* %tick is privileged only on UltraSPARC-I/II, but not IIe */
-               if (name[14]!='\0' && name[17]!='\0' && name[18]!='\0')
-                       OPENSSL_sparcv9cap_P &= ~SPARCV9_TICK_PRIVILEGED;
-
-               return DI_WALK_TERMINATE;
-       }
-       /* This is expected to catch remaining UltraSPARCs, such as T1 */
-       else if (!strncmp(name, "SUNW,UltraSPARC", 15)) {
-               OPENSSL_sparcv9cap_P &= ~SPARCV9_TICK_PRIVILEGED;
-
-               return DI_WALK_TERMINATE;
-       }
-
-       return DI_WALK_CONTINUE;
-}
-
-void
-OPENSSL_cpuid_setup(void)
-{
-       void *h;
-       char *e, si[256];
-       static int trigger = 0;
-
-       if (trigger)
-               return;
-       trigger = 1;
-
-       if ((e = getenv("OPENSSL_sparcv9cap"))) {
-               OPENSSL_sparcv9cap_P = strtoul(e, NULL, 0);
-               return;
-       }
-
-       if (sysinfo(SI_MACHINE, si, sizeof(si)) > 0) {
-               if (strcmp(si, "sun4v"))
-                       /* FPU is preferred for all CPUs, but US-T1/2 */
-                       OPENSSL_sparcv9cap_P |= SPARCV9_PREFER_FPU;
-       }
-
-       if (sysinfo(SI_ISALIST, si, sizeof(si)) > 0) {
-               if (strstr(si, "+vis"))
-                       OPENSSL_sparcv9cap_P |= SPARCV9_VIS1;
-               if (strstr(si, "+vis2")) {
-                       OPENSSL_sparcv9cap_P |= SPARCV9_VIS2;
-                       OPENSSL_sparcv9cap_P &= ~SPARCV9_TICK_PRIVILEGED;
-                       return;
-               }
-       }
-#ifdef M_KEEP
-       /*
-        * Solaris libdevinfo.so.1 is effectively incomatible with
-        * libmalloc.so.1. Specifically, if application is linked with
-        * -lmalloc, it crashes upon startup with SIGSEGV in
-        * free(3LIBMALLOC) called by di_fini. Prior call to
-        * mallopt(M_KEEP,0) somehow helps... But not always...
-        */
-       if ((h = dlopen(NULL, RTLD_LAZY))) {
-                       union { void *p;
-                       int (*f)(int, int);
-               } sym;
-               if ((sym.p = dlsym(h, "mallopt"))) (*sym.f)(M_KEEP, 0);
-                       dlclose(h);
-       }
-#endif
-       if ((h = dlopen("libdevinfo.so.1", RTLD_LAZY)))
-               do {
-                       di_init_t       di_init;
-                       di_fini_t       di_fini;
-                       di_walk_node_t  di_walk_node;
-                       di_node_name_t  di_node_name;
-                       di_node_t       root_node;
-
-                       if (!DLLINK(h, di_init))
-                               break;
-                       if (!DLLINK(h, di_fini))
-                               break;
-                       if (!DLLINK(h, di_walk_node))
-                               break;
-                       if (!DLLINK(h, di_node_name))
-                               break;
-
-                       if ((root_node = (*di_init)("/", DINFOSUBTREE)) !=
-                           DI_NODE_NIL) {
-                               (*di_walk_node)(root_node, DI_WALK_SIBFIRST,
-                                  di_node_name, walk_nodename);
-                               (*di_fini)(root_node);
-                       }
-               } while (0);
-
-       if (h)
-               dlclose(h);
-}
-
-#else
-
 static sigjmp_buf common_jmp;
 static void common_handler(int sig)
 {
@@ -193,7 +57,7 @@ OPENSSL_cpuid_setup(void)
        }
 
        /* Initial value, fits UltraSPARC-I&II... */
-       OPENSSL_sparcv9cap_P = SPARCV9_PREFER_FPU|SPARCV9_TICK_PRIVILEGED;
+       OPENSSL_sparcv9cap_P = SPARCV9_PREFER_FPU;
 
        sigfillset(&all_masked);
        sigdelset(&all_masked, SIGILL);
@@ -213,11 +77,6 @@ OPENSSL_cpuid_setup(void)
        sigaction(SIGILL, &common_act, &ill_oact);
        sigaction(SIGBUS,&common_act,&bus_oact);/* T1 fails 16-bit ldda [on Linux] */
 
-       if (sigsetjmp(common_jmp, 1) == 0) {
-               _sparcv9_rdtick();
-               OPENSSL_sparcv9cap_P &= ~SPARCV9_TICK_PRIVILEGED;
-       }
-
        if (sigsetjmp(common_jmp, 1) == 0) {
                _sparcv9_vis1_probe();
                OPENSSL_sparcv9cap_P |= SPARCV9_VIS1;
@@ -240,5 +99,3 @@ OPENSSL_cpuid_setup(void)
 
        sigprocmask(SIG_SETMASK, &oset, NULL);
 }
-
-#endif
index 8422e91..3fe9a2d 100644 (file)
@@ -42,16 +42,6 @@ OPENSSL_atomic_add:
        ret
 .size  OPENSSL_atomic_add,.-OPENSSL_atomic_add
 
-.globl OPENSSL_rdtsc
-.type  OPENSSL_rdtsc,\@abi-omnipotent
-.align 16
-OPENSSL_rdtsc:
-       rdtsc
-       shl     \$32,%rdx
-       or      %rdx,%rax
-       ret
-.size  OPENSSL_rdtsc,.-OPENSSL_rdtsc
-
 .globl OPENSSL_ia32_cpuid
 .type  OPENSSL_ia32_cpuid,\@abi-omnipotent
 .align 16
index 0da613f..c7a57a3 100644 (file)
@@ -143,17 +143,6 @@ for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); }
 
 &external_label("OPENSSL_ia32cap_P");
 
-&function_begin_B("OPENSSL_rdtsc","EXTRN\t_OPENSSL_ia32cap_P:DWORD");
-       &xor    ("eax","eax");
-       &xor    ("edx","edx");
-       &picmeup("ecx","OPENSSL_ia32cap_P");
-       &bt     (&DWP(0,"ecx"),4);
-       &jnc    (&label("notsc"));
-       &rdtsc  ();
-&set_label("notsc");
-       &ret    ();
-&function_end_B("OPENSSL_rdtsc");
-
 # This works in Ring 0 only [read DJGPP+MS-DOS+privileged DPMI host],
 # but it's safe to call it on any [supported] 32-bit platform...
 # Just check for [non-]zero return value...
index f6aea6a..0ff4ae2 100644 (file)
@@ -77,13 +77,4 @@ OPENSSL_atomic_add:
        addl    $0,$17,$0
        ret     ($26)
 .end   OPENSSL_atomic_add
-
-.globl OPENSSL_rdtsc
-.ent   OPENSSL_rdtsc
-OPENSSL_rdtsc:
-       .frame  $30,0,$26
-       .prologue 0
-       rpcc    $0
-       ret     ($26)
-.end   OPENSSL_rdtsc
 ___
index 0ccafb2..01797eb 100644 (file)
@@ -45,7 +45,6 @@
 extern unsigned int OPENSSL_armcap_P;
 
 #define ARMV7_NEON      (1<<0)
-#define ARMV7_TICK      (1<<1)
 #endif
 
 #endif
index 0625587..f40993c 100644 (file)
@@ -20,16 +20,6 @@ static sigjmp_buf ill_jmp;
  * ARM compilers support inline assembler...
  */
 void _armv7_neon_probe(void);
-unsigned int _armv7_tick(void);
-
-unsigned int
-OPENSSL_rdtsc(void)
-{
-       if (OPENSSL_armcap_P & ARMV7_TICK)
-               return _armv7_tick();
-       else
-               return 0;
-}
 
 #if defined(__GNUC__) && __GNUC__>=2
 void OPENSSL_cpuid_setup(void) __attribute__((constructor));
@@ -72,10 +62,6 @@ OPENSSL_cpuid_setup(void)
                _armv7_neon_probe();
                OPENSSL_armcap_P |= ARMV7_NEON;
        }
-       if (sigsetjmp(ill_jmp, 1) == 0) {
-               _armv7_tick();
-               OPENSSL_armcap_P |= ARMV7_TICK;
-       }
 
        sigaction (SIGILL, &ill_oact, NULL);
        sigprocmask(SIG_SETMASK, &oset, NULL);
index bdfde19..ba86c97 100644 (file)
@@ -11,13 +11,6 @@ _armv7_neon_probe:
        .word   0xe12fff1e      @ bx    lr
 .size  _armv7_neon_probe,.-_armv7_neon_probe
 
-.global        _armv7_tick
-.type  _armv7_tick,%function
-_armv7_tick:
-       mrc     p15,0,r0,c9,c13,0
-       .word   0xe12fff1e      @ bx    lr
-.size  _armv7_tick,.-_armv7_tick
-
 .global        OPENSSL_atomic_add
 .type  OPENSSL_atomic_add,%function
 OPENSSL_atomic_add:
index 517d938..39e8093 100644 (file)
@@ -8,13 +8,6 @@ OPENSSL_cpuid_setup:
 { .mib;        br.ret.sptk.many        b0              };;
 .endp  OPENSSL_cpuid_setup#
 
-.global        OPENSSL_rdtsc#
-.proc  OPENSSL_rdtsc#
-OPENSSL_rdtsc:
-{ .mib;        mov                     r8=ar.itc
-       br.ret.sptk.many        b0              };;
-.endp   OPENSSL_rdtsc#
-
 .global        OPENSSL_atomic_add#
 .proc  OPENSSL_atomic_add#
 .align 32
index 38985af..cd86b90 100644 (file)
@@ -34,18 +34,6 @@ OPENSSL_cpuid_setup
        nop
        .PROCEND
 
-       .EXPORT OPENSSL_rdtsc,ENTRY
-       .ALIGN  8
-OPENSSL_rdtsc
-       .PROC
-       .CALLINFO       NO_CALLS
-       .ENTRY
-       mfctl   %cr16,$rv
-       bv      ($rp)
-       .EXIT
-       nop
-       .PROCEND
-
        .EXPORT OPENSSL_wipe_cpu,ENTRY
        .ALIGN  8
 OPENSSL_wipe_cpu
index cf48714..37c33c0 100755 (executable)
@@ -84,15 +84,6 @@ Ladd:        lwarx   r5,0,r3
        .long   0
        .byte   0,12,0x14,0,0,0,2,0
        .long   0
-
-.globl .OPENSSL_rdtsc
-.align 4
-.OPENSSL_rdtsc:
-       mftb    r3
-       mftbu   r4
-       blr
-       .long   0
-       .byte   0,12,0x14,0,0,0,0,0
 ___
 
 $code =~ s/\`([^\`]*)\`/eval $1/gem;
index 89bf6be..25adb64 100644 (file)
@@ -16,15 +16,6 @@ OPENSSL_s390x_facilities:
        br      %r14
 .size  OPENSSL_s390x_facilities,.-OPENSSL_s390x_facilities
 
-.globl OPENSSL_rdtsc
-.type  OPENSSL_rdtsc,@function
-.align 16
-OPENSSL_rdtsc:
-       stck    16(%r15)
-       lg      %r2,16(%r15)
-       br      %r14
-.size  OPENSSL_rdtsc,.-OPENSSL_rdtsc
-
 .globl OPENSSL_atomic_add
 .type  OPENSSL_atomic_add,@function
 .align 16
index d8b44af..b913e3d 100644 (file)
@@ -215,23 +215,6 @@ OPENSSL_atomic_add:
        sra     %o0,%g0,%o0     ! we return signed int, remember?
 .size  OPENSSL_atomic_add,.-OPENSSL_atomic_add
 
-.global        _sparcv9_rdtick
-.align 32
-_sparcv9_rdtick:
-       subcc   %g0,1,%o0
-       .word   0x91408000      !rd     %ccr,%o0
-       cmp     %o0,0x99
-       bne     .notick
-       xor     %o0,%o0,%o0
-       .word   0x91410000      !rd     %tick,%o0
-       retl
-       .word   0x93323020      !srlx   %o0,32,%o1
-.notick:
-       retl
-       xor     %o1,%o1,%o1
-.type  _sparcv9_rdtick,#function
-.size  _sparcv9_rdtick,.-_sparcv9_rdtick
-
 .global        _sparcv9_vis1_probe
 .align 8
 _sparcv9_vis1_probe:
index 05c0848..f49e71e 100644 (file)
@@ -6,13 +6,12 @@
 #include <sys/time.h>
 #include <openssl/bn.h>
 
-#define SPARCV9_TICK_PRIVILEGED        (1<<0)
 #define SPARCV9_PREFER_FPU     (1<<1)
 #define SPARCV9_VIS1           (1<<2)
 #define SPARCV9_VIS2           (1<<3)  /* reserved */
 #define SPARCV9_FMADD          (1<<4)  /* reserved for SPARC64 V */
 
-static int OPENSSL_sparcv9cap_P = SPARCV9_TICK_PRIVILEGED;
+static int OPENSSL_sparcv9cap_P = 0;
 
 int
 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,
                return bn_mul_mont_int(rp, ap, bp, np, n0, num);
 }
 
-unsigned long  _sparcv9_rdtick(void);
 void           _sparcv9_vis1_probe(void);
 unsigned long  _sparcv9_vis1_instrument(void);
 void           _sparcv9_vis2_probe(void);
 void           _sparcv9_fmadd_probe(void);
 
-unsigned long
-OPENSSL_rdtsc(void)
-{
-       if (OPENSSL_sparcv9cap_P&SPARCV9_TICK_PRIVILEGED)
-#if defined(__sun) && defined(__SVR4)
-               return gethrtime();
-#else
-               return 0;
-#endif
-       else
-               return _sparcv9_rdtick();
-}
-
-#if 0 && defined(__sun) && defined(__SVR4)
-/* This code path is disabled, because of incompatibility of
- * libdevinfo.so.1 and libmalloc.so.1 (see below for details)
- */
-#include <malloc.h>
-#include <dlfcn.h>
-#include <libdevinfo.h>
-#include <sys/systeminfo.h>
-
-typedef di_node_t (*di_init_t)(const char *, uint_t);
-typedef void      (*di_fini_t)(di_node_t);
-typedef char *    (*di_node_name_t)(di_node_t);
-typedef int       (*di_walk_node_t)(di_node_t, uint_t, di_node_name_t, int (*)(di_node_t, di_node_name_t));
-
-#define DLLINK(h,name) (name=(name##_t)dlsym((h),#name))
-
-static int
-walk_nodename(di_node_t node, di_node_name_t di_node_name)
-{
-       char *name = (*di_node_name)(node);
-
-       /* This is expected to catch all UltraSPARC flavors prior T1 */
-       if (!strcmp (name, "SUNW,UltraSPARC") ||
-           !strncmp(name,"SUNW,UltraSPARC-I",17))  /* covers II,III,IV */
-       {
-               OPENSSL_sparcv9cap_P |= SPARCV9_PREFER_FPU|SPARCV9_VIS1;
-
-               /* %tick is privileged only on UltraSPARC-I/II, but not IIe */
-               if (name[14]!='\0' && name[17]!='\0' && name[18]!='\0')
-                       OPENSSL_sparcv9cap_P &= ~SPARCV9_TICK_PRIVILEGED;
-
-               return DI_WALK_TERMINATE;
-       }
-       /* This is expected to catch remaining UltraSPARCs, such as T1 */
-       else if (!strncmp(name, "SUNW,UltraSPARC", 15)) {
-               OPENSSL_sparcv9cap_P &= ~SPARCV9_TICK_PRIVILEGED;
-
-               return DI_WALK_TERMINATE;
-       }
-
-       return DI_WALK_CONTINUE;
-}
-
-void
-OPENSSL_cpuid_setup(void)
-{
-       void *h;
-       char *e, si[256];
-       static int trigger = 0;
-
-       if (trigger)
-               return;
-       trigger = 1;
-
-       if ((e = getenv("OPENSSL_sparcv9cap"))) {
-               OPENSSL_sparcv9cap_P = strtoul(e, NULL, 0);
-               return;
-       }
-
-       if (sysinfo(SI_MACHINE, si, sizeof(si)) > 0) {
-               if (strcmp(si, "sun4v"))
-                       /* FPU is preferred for all CPUs, but US-T1/2 */
-                       OPENSSL_sparcv9cap_P |= SPARCV9_PREFER_FPU;
-       }
-
-       if (sysinfo(SI_ISALIST, si, sizeof(si)) > 0) {
-               if (strstr(si, "+vis"))
-                       OPENSSL_sparcv9cap_P |= SPARCV9_VIS1;
-               if (strstr(si, "+vis2")) {
-                       OPENSSL_sparcv9cap_P |= SPARCV9_VIS2;
-                       OPENSSL_sparcv9cap_P &= ~SPARCV9_TICK_PRIVILEGED;
-                       return;
-               }
-       }
-#ifdef M_KEEP
-       /*
-        * Solaris libdevinfo.so.1 is effectively incomatible with
-        * libmalloc.so.1. Specifically, if application is linked with
-        * -lmalloc, it crashes upon startup with SIGSEGV in
-        * free(3LIBMALLOC) called by di_fini. Prior call to
-        * mallopt(M_KEEP,0) somehow helps... But not always...
-        */
-       if ((h = dlopen(NULL, RTLD_LAZY))) {
-                       union { void *p;
-                       int (*f)(int, int);
-               } sym;
-               if ((sym.p = dlsym(h, "mallopt"))) (*sym.f)(M_KEEP, 0);
-                       dlclose(h);
-       }
-#endif
-       if ((h = dlopen("libdevinfo.so.1", RTLD_LAZY)))
-               do {
-                       di_init_t       di_init;
-                       di_fini_t       di_fini;
-                       di_walk_node_t  di_walk_node;
-                       di_node_name_t  di_node_name;
-                       di_node_t       root_node;
-
-                       if (!DLLINK(h, di_init))
-                               break;
-                       if (!DLLINK(h, di_fini))
-                               break;
-                       if (!DLLINK(h, di_walk_node))
-                               break;
-                       if (!DLLINK(h, di_node_name))
-                               break;
-
-                       if ((root_node = (*di_init)("/", DINFOSUBTREE)) !=
-                           DI_NODE_NIL) {
-                               (*di_walk_node)(root_node, DI_WALK_SIBFIRST,
-                                  di_node_name, walk_nodename);
-                               (*di_fini)(root_node);
-                       }
-               } while (0);
-
-       if (h)
-               dlclose(h);
-}
-
-#else
-
 static sigjmp_buf common_jmp;
 static void common_handler(int sig)
 {
@@ -193,7 +57,7 @@ OPENSSL_cpuid_setup(void)
        }
 
        /* Initial value, fits UltraSPARC-I&II... */
-       OPENSSL_sparcv9cap_P = SPARCV9_PREFER_FPU|SPARCV9_TICK_PRIVILEGED;
+       OPENSSL_sparcv9cap_P = SPARCV9_PREFER_FPU;
 
        sigfillset(&all_masked);
        sigdelset(&all_masked, SIGILL);
@@ -213,11 +77,6 @@ OPENSSL_cpuid_setup(void)
        sigaction(SIGILL, &common_act, &ill_oact);
        sigaction(SIGBUS,&common_act,&bus_oact);/* T1 fails 16-bit ldda [on Linux] */
 
-       if (sigsetjmp(common_jmp, 1) == 0) {
-               _sparcv9_rdtick();
-               OPENSSL_sparcv9cap_P &= ~SPARCV9_TICK_PRIVILEGED;
-       }
-
        if (sigsetjmp(common_jmp, 1) == 0) {
                _sparcv9_vis1_probe();
                OPENSSL_sparcv9cap_P |= SPARCV9_VIS1;
@@ -240,5 +99,3 @@ OPENSSL_cpuid_setup(void)
 
        sigprocmask(SIG_SETMASK, &oset, NULL);
 }
-
-#endif
index 8422e91..3fe9a2d 100644 (file)
@@ -42,16 +42,6 @@ OPENSSL_atomic_add:
        ret
 .size  OPENSSL_atomic_add,.-OPENSSL_atomic_add
 
-.globl OPENSSL_rdtsc
-.type  OPENSSL_rdtsc,\@abi-omnipotent
-.align 16
-OPENSSL_rdtsc:
-       rdtsc
-       shl     \$32,%rdx
-       or      %rdx,%rax
-       ret
-.size  OPENSSL_rdtsc,.-OPENSSL_rdtsc
-
 .globl OPENSSL_ia32_cpuid
 .type  OPENSSL_ia32_cpuid,\@abi-omnipotent
 .align 16
index 0da613f..c7a57a3 100644 (file)
@@ -143,17 +143,6 @@ for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); }
 
 &external_label("OPENSSL_ia32cap_P");
 
-&function_begin_B("OPENSSL_rdtsc","EXTRN\t_OPENSSL_ia32cap_P:DWORD");
-       &xor    ("eax","eax");
-       &xor    ("edx","edx");
-       &picmeup("ecx","OPENSSL_ia32cap_P");
-       &bt     (&DWP(0,"ecx"),4);
-       &jnc    (&label("notsc"));
-       &rdtsc  ();
-&set_label("notsc");
-       &ret    ();
-&function_end_B("OPENSSL_rdtsc");
-
 # This works in Ring 0 only [read DJGPP+MS-DOS+privileged DPMI host],
 # but it's safe to call it on any [supported] 32-bit platform...
 # Just check for [non-]zero return value...