diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/libcrypto/alphacpuid.pl | 80 | ||||
| -rw-r--r-- | src/lib/libcrypto/arch/alpha/Makefile.inc | 9 | ||||
| -rw-r--r-- | src/lib/libcrypto/arch/arm/armv4cpuid.S | 96 | ||||
| -rw-r--r-- | src/lib/libcrypto/arch/hppa/Makefile.inc | 9 | ||||
| -rw-r--r-- | src/lib/libcrypto/arch/powerpc/Makefile.inc | 8 | ||||
| -rw-r--r-- | src/lib/libcrypto/arch/powerpc64/Makefile.inc | 8 | ||||
| -rw-r--r-- | src/lib/libcrypto/pariscid.pl | 86 | ||||
| -rw-r--r-- | src/lib/libcrypto/ppccap.c | 32 | ||||
| -rwxr-xr-x | src/lib/libcrypto/ppccpuid.pl | 85 | ||||
| -rw-r--r-- | src/lib/libcrypto/sparccpuid.S | 201 | ||||
| -rw-r--r-- | src/lib/libcrypto/x86_64cpuid.pl | 48 | ||||
| -rw-r--r-- | src/lib/libcrypto/x86cpuid.pl | 45 |
12 files changed, 7 insertions, 700 deletions
diff --git a/src/lib/libcrypto/alphacpuid.pl b/src/lib/libcrypto/alphacpuid.pl deleted file mode 100644 index 0ff4ae22e3..0000000000 --- a/src/lib/libcrypto/alphacpuid.pl +++ /dev/null | |||
| @@ -1,80 +0,0 @@ | |||
| 1 | #!/usr/bin/env perl | ||
| 2 | print <<'___'; | ||
| 3 | .text | ||
| 4 | |||
| 5 | .set noat | ||
| 6 | |||
| 7 | .globl OPENSSL_cpuid_setup | ||
| 8 | .ent OPENSSL_cpuid_setup | ||
| 9 | OPENSSL_cpuid_setup: | ||
| 10 | .frame $30,0,$26 | ||
| 11 | .prologue 0 | ||
| 12 | ret ($26) | ||
| 13 | .end OPENSSL_cpuid_setup | ||
| 14 | |||
| 15 | .globl OPENSSL_wipe_cpu | ||
| 16 | .ent OPENSSL_wipe_cpu | ||
| 17 | OPENSSL_wipe_cpu: | ||
| 18 | .frame $30,0,$26 | ||
| 19 | .prologue 0 | ||
| 20 | clr $1 | ||
| 21 | clr $2 | ||
| 22 | clr $3 | ||
| 23 | clr $4 | ||
| 24 | clr $5 | ||
| 25 | clr $6 | ||
| 26 | clr $7 | ||
| 27 | clr $8 | ||
| 28 | clr $16 | ||
| 29 | clr $17 | ||
| 30 | clr $18 | ||
| 31 | clr $19 | ||
| 32 | clr $20 | ||
| 33 | clr $21 | ||
| 34 | clr $22 | ||
| 35 | clr $23 | ||
| 36 | clr $24 | ||
| 37 | clr $25 | ||
| 38 | clr $27 | ||
| 39 | clr $at | ||
| 40 | clr $29 | ||
| 41 | fclr $f0 | ||
| 42 | fclr $f1 | ||
| 43 | fclr $f10 | ||
| 44 | fclr $f11 | ||
| 45 | fclr $f12 | ||
| 46 | fclr $f13 | ||
| 47 | fclr $f14 | ||
| 48 | fclr $f15 | ||
| 49 | fclr $f16 | ||
| 50 | fclr $f17 | ||
| 51 | fclr $f18 | ||
| 52 | fclr $f19 | ||
| 53 | fclr $f20 | ||
| 54 | fclr $f21 | ||
| 55 | fclr $f22 | ||
| 56 | fclr $f23 | ||
| 57 | fclr $f24 | ||
| 58 | fclr $f25 | ||
| 59 | fclr $f26 | ||
| 60 | fclr $f27 | ||
| 61 | fclr $f28 | ||
| 62 | fclr $f29 | ||
| 63 | fclr $f30 | ||
| 64 | mov $sp,$0 | ||
| 65 | ret ($26) | ||
| 66 | .end OPENSSL_wipe_cpu | ||
| 67 | |||
| 68 | .globl OPENSSL_atomic_add | ||
| 69 | .ent OPENSSL_atomic_add | ||
| 70 | OPENSSL_atomic_add: | ||
| 71 | .frame $30,0,$26 | ||
| 72 | .prologue 0 | ||
| 73 | 1: ldl_l $0,0($16) | ||
| 74 | addl $0,$17,$1 | ||
| 75 | stl_c $1,0($16) | ||
| 76 | beq $1,1b | ||
| 77 | addl $0,$17,$0 | ||
| 78 | ret ($26) | ||
| 79 | .end OPENSSL_atomic_add | ||
| 80 | ___ | ||
diff --git a/src/lib/libcrypto/arch/alpha/Makefile.inc b/src/lib/libcrypto/arch/alpha/Makefile.inc index 3b693c2ad2..9d1eab835c 100644 --- a/src/lib/libcrypto/arch/alpha/Makefile.inc +++ b/src/lib/libcrypto/arch/alpha/Makefile.inc | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile.inc,v 1.4 2019/05/11 13:05:24 tb Exp $ | 1 | # $OpenBSD: Makefile.inc,v 1.5 2023/01/17 15:04:27 miod Exp $ |
| 2 | 2 | ||
| 3 | # alpha-specific libcrypto build rules | 3 | # alpha-specific libcrypto build rules |
| 4 | 4 | ||
| @@ -32,10 +32,3 @@ ${f}.S: ${LCRYPTO_SRC}/${dir}/asm/${f}.pl | |||
| 32 | /usr/bin/perl \ | 32 | /usr/bin/perl \ |
| 33 | ${LCRYPTO_SRC}/${dir}/asm/${f}.pl > ${.TARGET} | 33 | ${LCRYPTO_SRC}/${dir}/asm/${f}.pl > ${.TARGET} |
| 34 | .endfor | 34 | .endfor |
| 35 | |||
| 36 | CFLAGS+= -DOPENSSL_CPUID_OBJ | ||
| 37 | SRCS+= alphacpuid.S | ||
| 38 | GENERATED+=alphacpuid.S | ||
| 39 | alphacpuid.S: ${LCRYPTO_SRC}/alphacpuid.pl | ||
| 40 | /usr/bin/perl \ | ||
| 41 | ${LCRYPTO_SRC}/alphacpuid.pl > ${.TARGET} | ||
diff --git a/src/lib/libcrypto/arch/arm/armv4cpuid.S b/src/lib/libcrypto/arch/arm/armv4cpuid.S index bb9abafebe..db0b54e496 100644 --- a/src/lib/libcrypto/arch/arm/armv4cpuid.S +++ b/src/lib/libcrypto/arch/arm/armv4cpuid.S | |||
| @@ -9,43 +9,6 @@ | |||
| 9 | #undef __thumb2__ | 9 | #undef __thumb2__ |
| 10 | #endif | 10 | #endif |
| 11 | 11 | ||
| 12 | .align 5 | ||
| 13 | .globl OPENSSL_atomic_add | ||
| 14 | .type OPENSSL_atomic_add,%function | ||
| 15 | OPENSSL_atomic_add: | ||
| 16 | #if __ARM_ARCH__>=6 | ||
| 17 | .Ladd: ldrex r2,[r0] | ||
| 18 | add r3,r2,r1 | ||
| 19 | strex r2,r3,[r0] | ||
| 20 | cmp r2,#0 | ||
| 21 | bne .Ladd | ||
| 22 | mov r0,r3 | ||
| 23 | bx lr | ||
| 24 | #else | ||
| 25 | stmdb sp!,{r4,r5,r6,lr} | ||
| 26 | ldr r2,.Lspinlock | ||
| 27 | adr r3,.Lspinlock | ||
| 28 | mov r4,r0 | ||
| 29 | mov r5,r1 | ||
| 30 | add r6,r3,r2 @ &spinlock | ||
| 31 | b .+8 | ||
| 32 | .Lspin: bl sched_yield | ||
| 33 | mov r0,#-1 | ||
| 34 | swp r0,r0,[r6] | ||
| 35 | cmp r0,#0 | ||
| 36 | bne .Lspin | ||
| 37 | |||
| 38 | ldr r2,[r4] | ||
| 39 | add r2,r2,r5 | ||
| 40 | str r2,[r4] | ||
| 41 | str r0,[r6] @ release spinlock | ||
| 42 | ldmia sp!,{r4,r5,r6,lr} | ||
| 43 | tst lr,#1 | ||
| 44 | moveq pc,lr | ||
| 45 | .word 0xe12fff1e @ bx lr | ||
| 46 | #endif | ||
| 47 | .size OPENSSL_atomic_add,.-OPENSSL_atomic_add | ||
| 48 | |||
| 49 | #if __ARM_ARCH__>=7 | 12 | #if __ARM_ARCH__>=7 |
| 50 | .arch armv7-a | 13 | .arch armv7-a |
| 51 | .fpu neon | 14 | .fpu neon |
| @@ -102,64 +65,5 @@ _armv8_pmull_probe: | |||
| 102 | .size _armv8_pmull_probe,.-_armv8_pmull_probe | 65 | .size _armv8_pmull_probe,.-_armv8_pmull_probe |
| 103 | #endif | 66 | #endif |
| 104 | 67 | ||
| 105 | .globl OPENSSL_wipe_cpu | ||
| 106 | .type OPENSSL_wipe_cpu,%function | ||
| 107 | OPENSSL_wipe_cpu: | ||
| 108 | #if __ARM_ARCH__>=7 | ||
| 109 | ldr r0,.LOPENSSL_armcap | ||
| 110 | adr r1,.LOPENSSL_armcap | ||
| 111 | ldr r0,[r1,r0] | ||
| 112 | #ifdef __APPLE__ | ||
| 113 | ldr r0,[r0] | ||
| 114 | #endif | ||
| 115 | #endif | ||
| 116 | eor r2,r2,r2 | ||
| 117 | eor r3,r3,r3 | ||
| 118 | eor ip,ip,ip | ||
| 119 | #if __ARM_ARCH__>=7 | ||
| 120 | tst r0,#1 | ||
| 121 | beq .Lwipe_done | ||
| 122 | veor q0, q0, q0 | ||
| 123 | veor q1, q1, q1 | ||
| 124 | veor q2, q2, q2 | ||
| 125 | veor q3, q3, q3 | ||
| 126 | veor q8, q8, q8 | ||
| 127 | veor q9, q9, q9 | ||
| 128 | veor q10, q10, q10 | ||
| 129 | veor q11, q11, q11 | ||
| 130 | veor q12, q12, q12 | ||
| 131 | veor q13, q13, q13 | ||
| 132 | veor q14, q14, q14 | ||
| 133 | veor q15, q15, q15 | ||
| 134 | .Lwipe_done: | ||
| 135 | #endif | ||
| 136 | mov r0,sp | ||
| 137 | #if __ARM_ARCH__>=5 | ||
| 138 | bx lr | ||
| 139 | #else | ||
| 140 | tst lr,#1 | ||
| 141 | moveq pc,lr | ||
| 142 | .word 0xe12fff1e @ bx lr | ||
| 143 | #endif | ||
| 144 | .size OPENSSL_wipe_cpu,.-OPENSSL_wipe_cpu | ||
| 145 | |||
| 146 | .align 5 | ||
| 147 | #if __ARM_ARCH__>=7 | ||
| 148 | .LOPENSSL_armcap: | ||
| 149 | .word OPENSSL_armcap_P-. | ||
| 150 | #endif | ||
| 151 | #if __ARM_ARCH__>=6 | ||
| 152 | .align 5 | ||
| 153 | #else | ||
| 154 | .Lspinlock: | ||
| 155 | .word atomic_add_spinlock-.Lspinlock | ||
| 156 | .align 5 | ||
| 157 | |||
| 158 | .data | ||
| 159 | .align 2 | ||
| 160 | atomic_add_spinlock: | ||
| 161 | .word 0 | ||
| 162 | #endif | ||
| 163 | |||
| 164 | .comm OPENSSL_armcap_P,4,4 | 68 | .comm OPENSSL_armcap_P,4,4 |
| 165 | .hidden OPENSSL_armcap_P | 69 | .hidden OPENSSL_armcap_P |
diff --git a/src/lib/libcrypto/arch/hppa/Makefile.inc b/src/lib/libcrypto/arch/hppa/Makefile.inc index eb15810f38..76affc391d 100644 --- a/src/lib/libcrypto/arch/hppa/Makefile.inc +++ b/src/lib/libcrypto/arch/hppa/Makefile.inc | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile.inc,v 1.12 2023/01/13 17:11:41 miod Exp $ | 1 | # $OpenBSD: Makefile.inc,v 1.13 2023/01/17 15:04:27 miod Exp $ |
| 2 | 2 | ||
| 3 | # hppa-specific libcrypto build rules | 3 | # hppa-specific libcrypto build rules |
| 4 | 4 | ||
| @@ -40,10 +40,3 @@ ${dst}.S: ${LCRYPTO_SRC}/${dir}/asm/${src}.pl | |||
| 40 | /usr/bin/perl \ | 40 | /usr/bin/perl \ |
| 41 | ${LCRYPTO_SRC}/${dir}/asm/${src}.pl 32 ${.TARGET} > ${.TARGET} | 41 | ${LCRYPTO_SRC}/${dir}/asm/${src}.pl 32 ${.TARGET} > ${.TARGET} |
| 42 | .endfor | 42 | .endfor |
| 43 | |||
| 44 | CFLAGS+= -DOPENSSL_CPUID_OBJ | ||
| 45 | SRCS+= pariscid.S | ||
| 46 | GENERATED+=pariscid.S | ||
| 47 | pariscid.S: ${LCRYPTO_SRC}/pariscid.pl | ||
| 48 | /usr/bin/perl \ | ||
| 49 | ${LCRYPTO_SRC}/pariscid.pl 32 > ${.TARGET} | ||
diff --git a/src/lib/libcrypto/arch/powerpc/Makefile.inc b/src/lib/libcrypto/arch/powerpc/Makefile.inc index 2682fc9e21..6c168c7989 100644 --- a/src/lib/libcrypto/arch/powerpc/Makefile.inc +++ b/src/lib/libcrypto/arch/powerpc/Makefile.inc | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile.inc,v 1.3 2019/05/11 13:05:25 tb Exp $ | 1 | # $OpenBSD: Makefile.inc,v 1.4 2023/01/17 15:04:27 miod Exp $ |
| 2 | 2 | ||
| 3 | # powerpc-specific libcrypto build rules | 3 | # powerpc-specific libcrypto build rules |
| 4 | 4 | ||
| @@ -37,8 +37,4 @@ ${dst}.S: ${LCRYPTO_SRC}/${dir}/asm/${src}.pl | |||
| 37 | .endfor | 37 | .endfor |
| 38 | 38 | ||
| 39 | #CFLAGS+= -DOPENSSL_CPUID_OBJ # it's commented out in ppccap.c | 39 | #CFLAGS+= -DOPENSSL_CPUID_OBJ # it's commented out in ppccap.c |
| 40 | SRCS+= ppccpuid.S ppccap.c | 40 | SRCS+= ppccap.c |
| 41 | GENERATED+=ppccpuid.S | ||
| 42 | ppccpuid.S: ${LCRYPTO_SRC}/ppccpuid.pl | ||
| 43 | /usr/bin/perl \ | ||
| 44 | ${LCRYPTO_SRC}/ppccpuid.pl linux32 > ${.TARGET} | ||
diff --git a/src/lib/libcrypto/arch/powerpc64/Makefile.inc b/src/lib/libcrypto/arch/powerpc64/Makefile.inc index 0713b8cd94..51e1c569dc 100644 --- a/src/lib/libcrypto/arch/powerpc64/Makefile.inc +++ b/src/lib/libcrypto/arch/powerpc64/Makefile.inc | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile.inc,v 1.4 2020/06/29 15:32:44 kettenis Exp $ | 1 | # $OpenBSD: Makefile.inc,v 1.5 2023/01/17 15:04:27 miod Exp $ |
| 2 | 2 | ||
| 3 | # powerpc-specific libcrypto build rules | 3 | # powerpc-specific libcrypto build rules |
| 4 | 4 | ||
| @@ -38,8 +38,4 @@ ${dst}.S: ${LCRYPTO_SRC}/${dir}/asm/${src}.pl | |||
| 38 | .endfor | 38 | .endfor |
| 39 | 39 | ||
| 40 | #CFLAGS+= -DOPENSSL_CPUID_OBJ # it's commented out in ppccap.c | 40 | #CFLAGS+= -DOPENSSL_CPUID_OBJ # it's commented out in ppccap.c |
| 41 | SRCS+= ppccpuid.S ppccap.c | 41 | SRCS+= ppccap.c |
| 42 | GENERATED+=ppccpuid.S | ||
| 43 | ppccpuid.S: ${LCRYPTO_SRC}/ppccpuid.pl | ||
| 44 | /usr/bin/perl \ | ||
| 45 | ${LCRYPTO_SRC}/ppccpuid.pl linux32 > ${.TARGET} | ||
diff --git a/src/lib/libcrypto/pariscid.pl b/src/lib/libcrypto/pariscid.pl deleted file mode 100644 index da74a2836c..0000000000 --- a/src/lib/libcrypto/pariscid.pl +++ /dev/null | |||
| @@ -1,86 +0,0 @@ | |||
| 1 | #!/usr/bin/env perl | ||
| 2 | |||
| 3 | $flavour = shift; | ||
| 4 | $output = shift; | ||
| 5 | open STDOUT,">$output"; | ||
| 6 | |||
| 7 | if ($flavour =~ /64/) { | ||
| 8 | $LEVEL ="2.0W"; | ||
| 9 | $SIZE_T =8; | ||
| 10 | $ST ="std"; | ||
| 11 | } else { | ||
| 12 | $LEVEL ="1.1"; | ||
| 13 | $SIZE_T =4; | ||
| 14 | $ST ="stw"; | ||
| 15 | } | ||
| 16 | |||
| 17 | $rp="%r2"; | ||
| 18 | $sp="%r30"; | ||
| 19 | $rv="%r28"; | ||
| 20 | |||
| 21 | $code=<<___; | ||
| 22 | .LEVEL $LEVEL | ||
| 23 | #if 0 | ||
| 24 | .SPACE \$TEXT\$ | ||
| 25 | .SUBSPA \$CODE\$,QUAD=0,ALIGN=8,ACCESS=0x2C,CODE_ONLY | ||
| 26 | #else | ||
| 27 | .text | ||
| 28 | #endif | ||
| 29 | |||
| 30 | .EXPORT OPENSSL_cpuid_setup,ENTRY | ||
| 31 | .ALIGN 8 | ||
| 32 | OPENSSL_cpuid_setup | ||
| 33 | .PROC | ||
| 34 | .CALLINFO NO_CALLS | ||
| 35 | .ENTRY | ||
| 36 | bv ($rp) | ||
| 37 | .EXIT | ||
| 38 | nop | ||
| 39 | .PROCEND | ||
| 40 | |||
| 41 | .EXPORT OPENSSL_wipe_cpu,ENTRY | ||
| 42 | .ALIGN 8 | ||
| 43 | OPENSSL_wipe_cpu | ||
| 44 | .PROC | ||
| 45 | .CALLINFO NO_CALLS | ||
| 46 | .ENTRY | ||
| 47 | xor %r0,%r0,%r1 | ||
| 48 | fcpy,dbl %fr0,%fr4 | ||
| 49 | xor %r0,%r0,%r19 | ||
| 50 | fcpy,dbl %fr0,%fr5 | ||
| 51 | xor %r0,%r0,%r20 | ||
| 52 | fcpy,dbl %fr0,%fr6 | ||
| 53 | xor %r0,%r0,%r21 | ||
| 54 | fcpy,dbl %fr0,%fr7 | ||
| 55 | xor %r0,%r0,%r22 | ||
| 56 | fcpy,dbl %fr0,%fr8 | ||
| 57 | xor %r0,%r0,%r23 | ||
| 58 | fcpy,dbl %fr0,%fr9 | ||
| 59 | xor %r0,%r0,%r24 | ||
| 60 | fcpy,dbl %fr0,%fr10 | ||
| 61 | xor %r0,%r0,%r25 | ||
| 62 | fcpy,dbl %fr0,%fr11 | ||
| 63 | xor %r0,%r0,%r26 | ||
| 64 | fcpy,dbl %fr0,%fr22 | ||
| 65 | xor %r0,%r0,%r29 | ||
| 66 | fcpy,dbl %fr0,%fr23 | ||
| 67 | xor %r0,%r0,%r31 | ||
| 68 | fcpy,dbl %fr0,%fr24 | ||
| 69 | fcpy,dbl %fr0,%fr25 | ||
| 70 | fcpy,dbl %fr0,%fr26 | ||
| 71 | fcpy,dbl %fr0,%fr27 | ||
| 72 | fcpy,dbl %fr0,%fr28 | ||
| 73 | fcpy,dbl %fr0,%fr29 | ||
| 74 | fcpy,dbl %fr0,%fr30 | ||
| 75 | fcpy,dbl %fr0,%fr31 | ||
| 76 | bv ($rp) | ||
| 77 | .EXIT | ||
| 78 | ldo 0($sp),$rv | ||
| 79 | .PROCEND | ||
| 80 | ___ | ||
| 81 | $code =~ s/cmpib,\*/comib,/gm if ($SIZE_T==4); | ||
| 82 | $code =~ s/,\*/,/gm if ($SIZE_T==4); | ||
| 83 | $code =~ s/\bbv\b/bve/gm if ($SIZE_T==8); | ||
| 84 | print $code; | ||
| 85 | close STDOUT; | ||
| 86 | |||
diff --git a/src/lib/libcrypto/ppccap.c b/src/lib/libcrypto/ppccap.c index ce01edf6ec..8c4565f57c 100644 --- a/src/lib/libcrypto/ppccap.c +++ b/src/lib/libcrypto/ppccap.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ppccap.c,v 1.6 2014/07/17 23:48:24 deraadt Exp $ */ | 1 | /* $OpenBSD: ppccap.c,v 1.7 2023/01/17 15:04:27 miod Exp $ */ |
| 2 | 2 | ||
| 3 | #include <sys/types.h> | 3 | #include <sys/types.h> |
| 4 | #include <sys/sysctl.h> | 4 | #include <sys/sysctl.h> |
| @@ -8,13 +8,6 @@ | |||
| 8 | #include <crypto.h> | 8 | #include <crypto.h> |
| 9 | #include <openssl/bn.h> | 9 | #include <openssl/bn.h> |
| 10 | 10 | ||
| 11 | #ifdef unused | ||
| 12 | #define PPC_FPU64 (1<<0) | ||
| 13 | #define PPC_ALTIVEC (1<<1) | ||
| 14 | |||
| 15 | static int OPENSSL_ppccap_P = 0; | ||
| 16 | #endif | ||
| 17 | |||
| 18 | #ifdef OPENSSL_BN_ASM_MONT | 11 | #ifdef OPENSSL_BN_ASM_MONT |
| 19 | extern int bn_mul_mont_int(BN_ULONG *, const BN_ULONG *, const BN_ULONG *, | 12 | extern int bn_mul_mont_int(BN_ULONG *, const BN_ULONG *, const BN_ULONG *, |
| 20 | const BN_ULONG *, const BN_ULONG *, int); | 13 | const BN_ULONG *, const BN_ULONG *, int); |
| @@ -25,26 +18,3 @@ bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, | |||
| 25 | return bn_mul_mont_int(rp, ap, bp, np, n0, num); | 18 | return bn_mul_mont_int(rp, ap, bp, np, n0, num); |
| 26 | } | 19 | } |
| 27 | #endif | 20 | #endif |
| 28 | |||
| 29 | #ifdef unused | ||
| 30 | void OPENSSL_cpuid_setup(void) __attribute__((constructor)); | ||
| 31 | |||
| 32 | void | ||
| 33 | OPENSSL_cpuid_setup(void) | ||
| 34 | { | ||
| 35 | static const int mib[2] = { CTL_MACHDEP, CPU_ALTIVEC }; | ||
| 36 | static int trigger = 0; | ||
| 37 | int altivec = 0; | ||
| 38 | size_t size; | ||
| 39 | |||
| 40 | if (trigger) | ||
| 41 | return; | ||
| 42 | trigger = 1; | ||
| 43 | |||
| 44 | size = sizeof altivec; | ||
| 45 | if (sysctl(mib, 2, &altivec, &size, NULL, 0) != -1) { | ||
| 46 | if (altivec != 0) | ||
| 47 | OPENSSL_ppccap_P |= PPC_ALTIVEC; | ||
| 48 | } | ||
| 49 | } | ||
| 50 | #endif | ||
diff --git a/src/lib/libcrypto/ppccpuid.pl b/src/lib/libcrypto/ppccpuid.pl deleted file mode 100755 index 0cef7014b6..0000000000 --- a/src/lib/libcrypto/ppccpuid.pl +++ /dev/null | |||
| @@ -1,85 +0,0 @@ | |||
| 1 | #!/usr/bin/env perl | ||
| 2 | |||
| 3 | $flavour = shift; | ||
| 4 | |||
| 5 | $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; | ||
| 6 | ( $xlate="${dir}ppc-xlate.pl" and -f $xlate ) or | ||
| 7 | ( $xlate="${dir}perlasm/ppc-xlate.pl" and -f $xlate) or | ||
| 8 | die "can't locate ppc-xlate.pl"; | ||
| 9 | |||
| 10 | open STDOUT,"| $^X $xlate $flavour ".shift || die "can't call $xlate: $!"; | ||
| 11 | |||
| 12 | if ($flavour=~/64/) { | ||
| 13 | $CMPLI="cmpldi"; | ||
| 14 | $SHRLI="srdi"; | ||
| 15 | $SIGNX="extsw"; | ||
| 16 | } else { | ||
| 17 | $CMPLI="cmplwi"; | ||
| 18 | $SHRLI="srwi"; | ||
| 19 | $SIGNX="mr"; | ||
| 20 | } | ||
| 21 | |||
| 22 | $code=<<___; | ||
| 23 | .machine "any" | ||
| 24 | .text | ||
| 25 | |||
| 26 | #if 0 | ||
| 27 | .globl .OPENSSL_ppc64_probe | ||
| 28 | .align 4 | ||
| 29 | .OPENSSL_ppc64_probe: | ||
| 30 | fcfid f1,f1 | ||
| 31 | extrdi r0,r0,32,0 | ||
| 32 | blr | ||
| 33 | .long 0 | ||
| 34 | .byte 0,12,0x14,0,0,0,0,0 | ||
| 35 | #endif | ||
| 36 | |||
| 37 | .globl .OPENSSL_wipe_cpu | ||
| 38 | .align 4 | ||
| 39 | .OPENSSL_wipe_cpu: | ||
| 40 | xor r0,r0,r0 | ||
| 41 | fmr f0,f31 | ||
| 42 | fmr f1,f31 | ||
| 43 | fmr f2,f31 | ||
| 44 | mr r3,r1 | ||
| 45 | fmr f3,f31 | ||
| 46 | xor r4,r4,r4 | ||
| 47 | fmr f4,f31 | ||
| 48 | xor r5,r5,r5 | ||
| 49 | fmr f5,f31 | ||
| 50 | xor r6,r6,r6 | ||
| 51 | fmr f6,f31 | ||
| 52 | xor r7,r7,r7 | ||
| 53 | fmr f7,f31 | ||
| 54 | xor r8,r8,r8 | ||
| 55 | fmr f8,f31 | ||
| 56 | xor r9,r9,r9 | ||
| 57 | fmr f9,f31 | ||
| 58 | xor r10,r10,r10 | ||
| 59 | fmr f10,f31 | ||
| 60 | xor r11,r11,r11 | ||
| 61 | fmr f11,f31 | ||
| 62 | xor r12,r12,r12 | ||
| 63 | fmr f12,f31 | ||
| 64 | fmr f13,f31 | ||
| 65 | blr | ||
| 66 | .long 0 | ||
| 67 | .byte 0,12,0x14,0,0,0,0,0 | ||
| 68 | |||
| 69 | .globl .OPENSSL_atomic_add | ||
| 70 | .align 4 | ||
| 71 | .OPENSSL_atomic_add: | ||
| 72 | Ladd: lwarx r5,0,r3 | ||
| 73 | add r0,r4,r5 | ||
| 74 | stwcx. r0,0,r3 | ||
| 75 | bne- Ladd | ||
| 76 | $SIGNX r3,r0 | ||
| 77 | blr | ||
| 78 | .long 0 | ||
| 79 | .byte 0,12,0x14,0,0,0,2,0 | ||
| 80 | .long 0 | ||
| 81 | ___ | ||
| 82 | |||
| 83 | $code =~ s/\`([^\`]*)\`/eval $1/gem; | ||
| 84 | print $code; | ||
| 85 | close STDOUT; | ||
diff --git a/src/lib/libcrypto/sparccpuid.S b/src/lib/libcrypto/sparccpuid.S index 757e015704..5d314d5d88 100644 --- a/src/lib/libcrypto/sparccpuid.S +++ b/src/lib/libcrypto/sparccpuid.S | |||
| @@ -14,207 +14,6 @@ | |||
| 14 | # define BIAS 0 | 14 | # define BIAS 0 |
| 15 | #endif | 15 | #endif |
| 16 | 16 | ||
| 17 | .text | ||
| 18 | .align 32 | ||
| 19 | .global OPENSSL_wipe_cpu | ||
| 20 | .type OPENSSL_wipe_cpu,#function | ||
| 21 | ! Keep in mind that this does not excuse us from wiping the stack! | ||
| 22 | ! This routine wipes registers, but not the backing store [which | ||
| 23 | ! resides on the stack, toward lower addresses]. To facilitate for | ||
| 24 | ! stack wiping I return pointer to the top of stack of the *caller*. | ||
| 25 | OPENSSL_wipe_cpu: | ||
| 26 | save %sp,FRAME,%sp | ||
| 27 | nop | ||
| 28 | #ifdef __sun | ||
| 29 | #include <sys/trap.h> | ||
| 30 | ta ST_CLEAN_WINDOWS | ||
| 31 | #else | ||
| 32 | call .walk.reg.wins | ||
| 33 | #endif | ||
| 34 | nop | ||
| 35 | call .PIC.zero.up | ||
| 36 | mov .zero-(.-4),%o0 | ||
| 37 | ld [%o0],%f0 | ||
| 38 | ld [%o0],%f1 | ||
| 39 | |||
| 40 | subcc %g0,1,%o0 | ||
| 41 | ! Following is V9 "rd %ccr,%o0" instruction. However! V8 | ||
| 42 | ! specification says that it ("rd %asr2,%o0" in V8 terms) does | ||
| 43 | ! not cause illegal_instruction trap. It therefore can be used | ||
| 44 | ! to determine if the CPU the code is executing on is V8- or | ||
| 45 | ! V9-compliant, as V9 returns a distinct value of 0x99, | ||
| 46 | ! "negative" and "borrow" bits set in both %icc and %xcc. | ||
| 47 | .word 0x91408000 !rd %ccr,%o0 | ||
| 48 | cmp %o0,0x99 | ||
| 49 | bne .v8 | ||
| 50 | nop | ||
| 51 | ! Even though we do not use %fp register bank, | ||
| 52 | ! we wipe it as memcpy might have used it... | ||
| 53 | .word 0xbfa00040 !fmovd %f0,%f62 | ||
| 54 | .word 0xbba00040 !... | ||
| 55 | .word 0xb7a00040 | ||
| 56 | .word 0xb3a00040 | ||
| 57 | .word 0xafa00040 | ||
| 58 | .word 0xaba00040 | ||
| 59 | .word 0xa7a00040 | ||
| 60 | .word 0xa3a00040 | ||
| 61 | .word 0x9fa00040 | ||
| 62 | .word 0x9ba00040 | ||
| 63 | .word 0x97a00040 | ||
| 64 | .word 0x93a00040 | ||
| 65 | .word 0x8fa00040 | ||
| 66 | .word 0x8ba00040 | ||
| 67 | .word 0x87a00040 | ||
| 68 | .word 0x83a00040 !fmovd %f0,%f32 | ||
| 69 | .v8: fmovs %f1,%f31 | ||
| 70 | clr %o0 | ||
| 71 | fmovs %f0,%f30 | ||
| 72 | clr %o1 | ||
| 73 | fmovs %f1,%f29 | ||
| 74 | clr %o2 | ||
| 75 | fmovs %f0,%f28 | ||
| 76 | clr %o3 | ||
| 77 | fmovs %f1,%f27 | ||
| 78 | clr %o4 | ||
| 79 | fmovs %f0,%f26 | ||
| 80 | clr %o5 | ||
| 81 | fmovs %f1,%f25 | ||
| 82 | clr %o7 | ||
| 83 | fmovs %f0,%f24 | ||
| 84 | clr %l0 | ||
| 85 | fmovs %f1,%f23 | ||
| 86 | clr %l1 | ||
| 87 | fmovs %f0,%f22 | ||
| 88 | clr %l2 | ||
| 89 | fmovs %f1,%f21 | ||
| 90 | clr %l3 | ||
| 91 | fmovs %f0,%f20 | ||
| 92 | clr %l4 | ||
| 93 | fmovs %f1,%f19 | ||
| 94 | clr %l5 | ||
| 95 | fmovs %f0,%f18 | ||
| 96 | clr %l6 | ||
| 97 | fmovs %f1,%f17 | ||
| 98 | clr %l7 | ||
| 99 | fmovs %f0,%f16 | ||
| 100 | clr %i0 | ||
| 101 | fmovs %f1,%f15 | ||
| 102 | clr %i1 | ||
| 103 | fmovs %f0,%f14 | ||
| 104 | clr %i2 | ||
| 105 | fmovs %f1,%f13 | ||
| 106 | clr %i3 | ||
| 107 | fmovs %f0,%f12 | ||
| 108 | clr %i4 | ||
| 109 | fmovs %f1,%f11 | ||
| 110 | clr %i5 | ||
| 111 | fmovs %f0,%f10 | ||
| 112 | clr %g1 | ||
| 113 | fmovs %f1,%f9 | ||
| 114 | clr %g2 | ||
| 115 | fmovs %f0,%f8 | ||
| 116 | clr %g3 | ||
| 117 | fmovs %f1,%f7 | ||
| 118 | clr %g4 | ||
| 119 | fmovs %f0,%f6 | ||
| 120 | clr %g5 | ||
| 121 | fmovs %f1,%f5 | ||
| 122 | fmovs %f0,%f4 | ||
| 123 | fmovs %f1,%f3 | ||
| 124 | fmovs %f0,%f2 | ||
| 125 | |||
| 126 | add %fp,BIAS,%i0 ! return pointer to callerīs top of stack | ||
| 127 | |||
| 128 | ret | ||
| 129 | restore | ||
| 130 | |||
| 131 | .zero: .long 0x0,0x0 | ||
| 132 | .PIC.zero.up: | ||
| 133 | retl | ||
| 134 | add %o0,%o7,%o0 | ||
| 135 | #ifdef DEBUG | ||
| 136 | .global walk_reg_wins | ||
| 137 | .type walk_reg_wins,#function | ||
| 138 | walk_reg_wins: | ||
| 139 | #endif | ||
| 140 | .walk.reg.wins: | ||
| 141 | save %sp,FRAME,%sp | ||
| 142 | cmp %i7,%o7 | ||
| 143 | be 2f | ||
| 144 | clr %o0 | ||
| 145 | cmp %o7,0 ! compiler never cleans %o7... | ||
| 146 | be 1f ! could have been a leaf function... | ||
| 147 | clr %o1 | ||
| 148 | call .walk.reg.wins | ||
| 149 | nop | ||
| 150 | 1: clr %o2 | ||
| 151 | clr %o3 | ||
| 152 | clr %o4 | ||
| 153 | clr %o5 | ||
| 154 | clr %o7 | ||
| 155 | clr %l0 | ||
| 156 | clr %l1 | ||
| 157 | clr %l2 | ||
| 158 | clr %l3 | ||
| 159 | clr %l4 | ||
| 160 | clr %l5 | ||
| 161 | clr %l6 | ||
| 162 | clr %l7 | ||
| 163 | add %o0,1,%i0 ! used for debugging | ||
| 164 | 2: ret | ||
| 165 | restore | ||
| 166 | .size OPENSSL_wipe_cpu,.-OPENSSL_wipe_cpu | ||
| 167 | |||
| 168 | .global OPENSSL_atomic_add | ||
| 169 | .type OPENSSL_atomic_add,#function | ||
| 170 | .align 32 | ||
| 171 | OPENSSL_atomic_add: | ||
| 172 | #ifndef ABI64 | ||
| 173 | subcc %g0,1,%o2 | ||
| 174 | .word 0x95408000 !rd %ccr,%o2, see comment above | ||
| 175 | cmp %o2,0x99 | ||
| 176 | be .v9 | ||
| 177 | nop | ||
| 178 | save %sp,FRAME,%sp | ||
| 179 | ba .enter | ||
| 180 | nop | ||
| 181 | #ifdef __sun | ||
| 182 | ! Note that you do not have to link with libthread to call thr_yield, | ||
| 183 | ! as libc provides a stub, which is overloaded the moment you link | ||
| 184 | ! with *either* libpthread or libthread... | ||
| 185 | #define YIELD_CPU thr_yield | ||
| 186 | #else | ||
| 187 | ! applies at least to Linux and FreeBSD... Feedback expected... | ||
| 188 | #define YIELD_CPU sched_yield | ||
| 189 | #endif | ||
| 190 | .spin: call YIELD_CPU | ||
| 191 | nop | ||
| 192 | .enter: ld [%i0],%i2 | ||
| 193 | cmp %i2,-4096 | ||
| 194 | be .spin | ||
| 195 | mov -1,%i2 | ||
| 196 | swap [%i0],%i2 | ||
| 197 | cmp %i2,-1 | ||
| 198 | be .spin | ||
| 199 | add %i2,%i1,%i2 | ||
| 200 | stbar | ||
| 201 | st %i2,[%i0] | ||
| 202 | sra %i2,%g0,%i0 | ||
| 203 | ret | ||
| 204 | restore | ||
| 205 | .v9: | ||
| 206 | #endif | ||
| 207 | ld [%o0],%o2 | ||
| 208 | 1: add %o1,%o2,%o3 | ||
| 209 | .word 0xd7e2100a !cas [%o0],%o2,%o3, compare [%o0] with %o2 and swap %o3 | ||
| 210 | cmp %o2,%o3 | ||
| 211 | bne 1b | ||
| 212 | mov %o3,%o2 ! cas is always fetching to dest. register | ||
| 213 | add %o1,%o2,%o0 ! OpenSSL expects the new value | ||
| 214 | retl | ||
| 215 | sra %o0,%g0,%o0 ! we return signed int, remember? | ||
| 216 | .size OPENSSL_atomic_add,.-OPENSSL_atomic_add | ||
| 217 | |||
| 218 | .global _sparcv9_vis1_probe | 17 | .global _sparcv9_vis1_probe |
| 219 | .align 8 | 18 | .align 8 |
| 220 | _sparcv9_vis1_probe: | 19 | _sparcv9_vis1_probe: |
diff --git a/src/lib/libcrypto/x86_64cpuid.pl b/src/lib/libcrypto/x86_64cpuid.pl index 6558dedb6b..2780b0f8ce 100644 --- a/src/lib/libcrypto/x86_64cpuid.pl +++ b/src/lib/libcrypto/x86_64cpuid.pl | |||
| @@ -25,20 +25,6 @@ print<<___; | |||
| 25 | 25 | ||
| 26 | .text | 26 | .text |
| 27 | 27 | ||
| 28 | .globl OPENSSL_atomic_add | ||
| 29 | .type OPENSSL_atomic_add,\@abi-omnipotent | ||
| 30 | .align 16 | ||
| 31 | OPENSSL_atomic_add: | ||
| 32 | movl ($arg1),%eax | ||
| 33 | .Lspin: leaq ($arg2,%rax),%r8 | ||
| 34 | .byte 0xf0 # lock | ||
| 35 | cmpxchgl %r8d,($arg1) | ||
| 36 | jne .Lspin | ||
| 37 | movl %r8d,%eax | ||
| 38 | .byte 0x48,0x98 # cltq/cdqe | ||
| 39 | ret | ||
| 40 | .size OPENSSL_atomic_add,.-OPENSSL_atomic_add | ||
| 41 | |||
| 42 | .globl OPENSSL_ia32_cpuid | 28 | .globl OPENSSL_ia32_cpuid |
| 43 | .type OPENSSL_ia32_cpuid,\@abi-omnipotent | 29 | .type OPENSSL_ia32_cpuid,\@abi-omnipotent |
| 44 | .align 16 | 30 | .align 16 |
| @@ -165,38 +151,4 @@ OPENSSL_ia32_cpuid: | |||
| 165 | .size OPENSSL_ia32_cpuid,.-OPENSSL_ia32_cpuid | 151 | .size OPENSSL_ia32_cpuid,.-OPENSSL_ia32_cpuid |
| 166 | ___ | 152 | ___ |
| 167 | 153 | ||
| 168 | print<<___; | ||
| 169 | .globl OPENSSL_wipe_cpu | ||
| 170 | .type OPENSSL_wipe_cpu,\@abi-omnipotent | ||
| 171 | .align 16 | ||
| 172 | OPENSSL_wipe_cpu: | ||
| 173 | pxor %xmm0,%xmm0 | ||
| 174 | pxor %xmm1,%xmm1 | ||
| 175 | pxor %xmm2,%xmm2 | ||
| 176 | pxor %xmm3,%xmm3 | ||
| 177 | pxor %xmm4,%xmm4 | ||
| 178 | pxor %xmm5,%xmm5 | ||
| 179 | pxor %xmm6,%xmm6 | ||
| 180 | pxor %xmm7,%xmm7 | ||
| 181 | pxor %xmm8,%xmm8 | ||
| 182 | pxor %xmm9,%xmm9 | ||
| 183 | pxor %xmm10,%xmm10 | ||
| 184 | pxor %xmm11,%xmm11 | ||
| 185 | pxor %xmm12,%xmm12 | ||
| 186 | pxor %xmm13,%xmm13 | ||
| 187 | pxor %xmm14,%xmm14 | ||
| 188 | pxor %xmm15,%xmm15 | ||
| 189 | xorq %rcx,%rcx | ||
| 190 | xorq %rdx,%rdx | ||
| 191 | xorq %rsi,%rsi | ||
| 192 | xorq %rdi,%rdi | ||
| 193 | xorq %r8,%r8 | ||
| 194 | xorq %r9,%r9 | ||
| 195 | xorq %r10,%r10 | ||
| 196 | xorq %r11,%r11 | ||
| 197 | leaq 8(%rsp),%rax | ||
| 198 | ret | ||
| 199 | .size OPENSSL_wipe_cpu,.-OPENSSL_wipe_cpu | ||
| 200 | ___ | ||
| 201 | |||
| 202 | close STDOUT; # flush | 154 | close STDOUT; # flush |
diff --git a/src/lib/libcrypto/x86cpuid.pl b/src/lib/libcrypto/x86cpuid.pl index 0fc906a3e9..d6ebede0f8 100644 --- a/src/lib/libcrypto/x86cpuid.pl +++ b/src/lib/libcrypto/x86cpuid.pl | |||
| @@ -152,51 +152,6 @@ for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); } | |||
| 152 | 152 | ||
| 153 | &external_label("OPENSSL_ia32cap_P"); | 153 | &external_label("OPENSSL_ia32cap_P"); |
| 154 | 154 | ||
| 155 | &function_begin_B("OPENSSL_wipe_cpu",""); | ||
| 156 | &xor ("eax","eax"); | ||
| 157 | &xor ("edx","edx"); | ||
| 158 | &picmeup("ecx","OPENSSL_ia32cap_P"); | ||
| 159 | &mov ("ecx",&DWP(0,"ecx")); | ||
| 160 | &bt (&DWP(0,"ecx"),"\$IA32CAP_BIT0_FPU"); | ||
| 161 | &jnc (&label("no_x87")); | ||
| 162 | if ($sse2) { | ||
| 163 | # Check SSE2 and FXSR bits. | ||
| 164 | &and ("ecx", "\$(IA32CAP_MASK0_FXSR | IA32CAP_MASK0_SSE2)"); | ||
| 165 | &cmp ("ecx", "\$(IA32CAP_MASK0_FXSR | IA32CAP_MASK0_SSE2)"); | ||
| 166 | &jne (&label("no_sse2")); | ||
| 167 | &pxor ("xmm0","xmm0"); | ||
| 168 | &pxor ("xmm1","xmm1"); | ||
| 169 | &pxor ("xmm2","xmm2"); | ||
| 170 | &pxor ("xmm3","xmm3"); | ||
| 171 | &pxor ("xmm4","xmm4"); | ||
| 172 | &pxor ("xmm5","xmm5"); | ||
| 173 | &pxor ("xmm6","xmm6"); | ||
| 174 | &pxor ("xmm7","xmm7"); | ||
| 175 | &set_label("no_sse2"); | ||
| 176 | } | ||
| 177 | # just a bunch of fldz to zap the fp/mm bank followed by finit... | ||
| 178 | &data_word(0xeed9eed9,0xeed9eed9,0xeed9eed9,0xeed9eed9,0x90e3db9b); | ||
| 179 | &set_label("no_x87"); | ||
| 180 | &lea ("eax",&DWP(4,"esp")); | ||
| 181 | &ret (); | ||
| 182 | &function_end_B("OPENSSL_wipe_cpu"); | ||
| 183 | |||
| 184 | &function_begin_B("OPENSSL_atomic_add"); | ||
| 185 | &mov ("edx",&DWP(4,"esp")); # fetch the pointer, 1st arg | ||
| 186 | &mov ("ecx",&DWP(8,"esp")); # fetch the increment, 2nd arg | ||
| 187 | &push ("ebx"); | ||
| 188 | &nop (); | ||
| 189 | &mov ("eax",&DWP(0,"edx")); | ||
| 190 | &set_label("spin"); | ||
| 191 | &lea ("ebx",&DWP(0,"eax","ecx")); | ||
| 192 | &nop (); | ||
| 193 | &data_word(0x1ab10ff0); # lock; cmpxchg %ebx,(%edx) # %eax is involved and is always reloaded | ||
| 194 | &jne (&label("spin")); | ||
| 195 | &mov ("eax","ebx"); # OpenSSL expects the new value | ||
| 196 | &pop ("ebx"); | ||
| 197 | &ret (); | ||
| 198 | &function_end_B("OPENSSL_atomic_add"); | ||
| 199 | |||
| 200 | &initseg("OPENSSL_cpuid_setup"); | 155 | &initseg("OPENSSL_cpuid_setup"); |
| 201 | 156 | ||
| 202 | &asm_finish(); | 157 | &asm_finish(); |
