diff options
author | kettenis <> | 2012-10-31 11:19:35 +0000 |
---|---|---|
committer | kettenis <> | 2012-10-31 11:19:35 +0000 |
commit | e05982c56ef9dbde368df8fe35a8458f34b76f76 (patch) | |
tree | df8275e2ac9f9c9853242382bc11bb6d08487c90 | |
parent | 21f5cd5730973fef800d5035b20030617736629a (diff) | |
download | openbsd-e05982c56ef9dbde368df8fe35a8458f34b76f76.tar.gz openbsd-e05982c56ef9dbde368df8fe35a8458f34b76f76.tar.bz2 openbsd-e05982c56ef9dbde368df8fe35a8458f34b76f76.zip |
On amd64 OPENSSL_cpuid_setup and OPENSSL_ia32cap_P are now hidden so we don't
have to go through the PLT/GOT to get at them anymore. In fact going through
the GOT now fails since we no longer have a GOT entry for OPENSSL_ia32cap_P.
Fixes the problem spotted by jasper@ and sthen@. Based on a diff from mikeb@
who did most of the actual work of tracking down the issue.
ok millert@, mikeb@
-rwxr-xr-x | src/lib/libcrypto/aes/asm/aes-x86_64.pl | 2 | ||||
-rwxr-xr-x | src/lib/libcrypto/perlasm/x86_64-xlate.pl | 5 | ||||
-rwxr-xr-x | src/lib/libcrypto/rc4/asm/rc4-x86_64.pl | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/x86_64cpuid.pl | 3 | ||||
-rwxr-xr-x | src/lib/libssl/src/crypto/aes/asm/aes-x86_64.pl | 2 | ||||
-rwxr-xr-x | src/lib/libssl/src/crypto/perlasm/x86_64-xlate.pl | 5 | ||||
-rwxr-xr-x | src/lib/libssl/src/crypto/rc4/asm/rc4-x86_64.pl | 4 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/x86_64cpuid.pl | 3 |
8 files changed, 10 insertions, 18 deletions
diff --git a/src/lib/libcrypto/aes/asm/aes-x86_64.pl b/src/lib/libcrypto/aes/asm/aes-x86_64.pl index 027b4ae2e5..48fa857d5b 100755 --- a/src/lib/libcrypto/aes/asm/aes-x86_64.pl +++ b/src/lib/libcrypto/aes/asm/aes-x86_64.pl | |||
@@ -1678,7 +1678,7 @@ AES_cbc_encrypt: | |||
1678 | lea .LAES_Td(%rip),$sbox | 1678 | lea .LAES_Td(%rip),$sbox |
1679 | .Lcbc_picked_te: | 1679 | .Lcbc_picked_te: |
1680 | 1680 | ||
1681 | mov PIC_GOT(OPENSSL_ia32cap_P),%r10d | 1681 | mov OPENSSL_ia32cap_P(%rip),%r10d |
1682 | cmp \$$speed_limit,%rdx | 1682 | cmp \$$speed_limit,%rdx |
1683 | jb .Lcbc_slow_prologue | 1683 | jb .Lcbc_slow_prologue |
1684 | test \$15,%rdx | 1684 | test \$15,%rdx |
diff --git a/src/lib/libcrypto/perlasm/x86_64-xlate.pl b/src/lib/libcrypto/perlasm/x86_64-xlate.pl index 50ff91e2f0..56d9b64b6f 100755 --- a/src/lib/libcrypto/perlasm/x86_64-xlate.pl +++ b/src/lib/libcrypto/perlasm/x86_64-xlate.pl | |||
@@ -215,8 +215,7 @@ my %globals; | |||
215 | undef $ret; | 215 | undef $ret; |
216 | 216 | ||
217 | # optional * ---vvv--- appears in indirect jmp/call | 217 | # optional * ---vvv--- appears in indirect jmp/call |
218 | if ($line =~ /^(\*?)([^\(,]*)\(([%\w,]+)\)/ && | 218 | if ($line =~ /^(\*?)([^\(,]*)\(([%\w,]+)\)/) { |
219 | !($line =~ /^PIC_(GOT|PLT)/)) { | ||
220 | $self->{asterisk} = $1; | 219 | $self->{asterisk} = $1; |
221 | $self->{label} = $2; | 220 | $self->{label} = $2; |
222 | ($self->{base},$self->{index},$self->{scale})=split(/,/,$3); | 221 | ($self->{base},$self->{index},$self->{scale})=split(/,/,$3); |
@@ -773,8 +772,6 @@ my $rdrand = sub { | |||
773 | } | 772 | } |
774 | }; | 773 | }; |
775 | 774 | ||
776 | print "#include <machine/asm.h>\n"; | ||
777 | |||
778 | if ($nasm) { | 775 | if ($nasm) { |
779 | print <<___; | 776 | print <<___; |
780 | default rel | 777 | default rel |
diff --git a/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl b/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl index ac2c05074e..d6eac205e9 100755 --- a/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl +++ b/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl | |||
@@ -442,7 +442,7 @@ private_RC4_set_key: | |||
442 | xor %r10,%r10 | 442 | xor %r10,%r10 |
443 | xor %r11,%r11 | 443 | xor %r11,%r11 |
444 | 444 | ||
445 | mov PIC_GOT(OPENSSL_ia32cap_P),$idx#d | 445 | mov OPENSSL_ia32cap_P(%rip),$idx#d |
446 | bt \$20,$idx#d # RC4_CHAR? | 446 | bt \$20,$idx#d # RC4_CHAR? |
447 | jc .Lc1stloop | 447 | jc .Lc1stloop |
448 | jmp .Lw1stloop | 448 | jmp .Lw1stloop |
@@ -506,7 +506,7 @@ private_RC4_set_key: | |||
506 | .align 16 | 506 | .align 16 |
507 | RC4_options: | 507 | RC4_options: |
508 | lea .Lopts(%rip),%rax | 508 | lea .Lopts(%rip),%rax |
509 | mov PIC_GOT(OPENSSL_ia32cap_P),%edx | 509 | mov OPENSSL_ia32cap_P(%rip),%edx |
510 | bt \$20,%edx | 510 | bt \$20,%edx |
511 | jc .L8xchar | 511 | jc .L8xchar |
512 | bt \$30,%edx | 512 | bt \$30,%edx |
diff --git a/src/lib/libcrypto/x86_64cpuid.pl b/src/lib/libcrypto/x86_64cpuid.pl index 58e9bedcf0..7b7b93b223 100644 --- a/src/lib/libcrypto/x86_64cpuid.pl +++ b/src/lib/libcrypto/x86_64cpuid.pl | |||
@@ -17,11 +17,10 @@ open STDOUT,"| $^X $xlate $flavour $output"; | |||
17 | ("%rdi","%rsi","%rdx","%rcx"); # Unix order | 17 | ("%rdi","%rsi","%rdx","%rcx"); # Unix order |
18 | 18 | ||
19 | print<<___; | 19 | print<<___; |
20 | #include <machine/asm.h> | ||
21 | .extern OPENSSL_cpuid_setup | 20 | .extern OPENSSL_cpuid_setup |
22 | .hidden OPENSSL_cpuid_setup | 21 | .hidden OPENSSL_cpuid_setup |
23 | .section .init | 22 | .section .init |
24 | call PIC_PLT(OPENSSL_cpuid_setup) | 23 | call OPENSSL_cpuid_setup |
25 | 24 | ||
26 | .hidden OPENSSL_ia32cap_P | 25 | .hidden OPENSSL_ia32cap_P |
27 | .comm OPENSSL_ia32cap_P,8,4 | 26 | .comm OPENSSL_ia32cap_P,8,4 |
diff --git a/src/lib/libssl/src/crypto/aes/asm/aes-x86_64.pl b/src/lib/libssl/src/crypto/aes/asm/aes-x86_64.pl index 027b4ae2e5..48fa857d5b 100755 --- a/src/lib/libssl/src/crypto/aes/asm/aes-x86_64.pl +++ b/src/lib/libssl/src/crypto/aes/asm/aes-x86_64.pl | |||
@@ -1678,7 +1678,7 @@ AES_cbc_encrypt: | |||
1678 | lea .LAES_Td(%rip),$sbox | 1678 | lea .LAES_Td(%rip),$sbox |
1679 | .Lcbc_picked_te: | 1679 | .Lcbc_picked_te: |
1680 | 1680 | ||
1681 | mov PIC_GOT(OPENSSL_ia32cap_P),%r10d | 1681 | mov OPENSSL_ia32cap_P(%rip),%r10d |
1682 | cmp \$$speed_limit,%rdx | 1682 | cmp \$$speed_limit,%rdx |
1683 | jb .Lcbc_slow_prologue | 1683 | jb .Lcbc_slow_prologue |
1684 | test \$15,%rdx | 1684 | test \$15,%rdx |
diff --git a/src/lib/libssl/src/crypto/perlasm/x86_64-xlate.pl b/src/lib/libssl/src/crypto/perlasm/x86_64-xlate.pl index 50ff91e2f0..56d9b64b6f 100755 --- a/src/lib/libssl/src/crypto/perlasm/x86_64-xlate.pl +++ b/src/lib/libssl/src/crypto/perlasm/x86_64-xlate.pl | |||
@@ -215,8 +215,7 @@ my %globals; | |||
215 | undef $ret; | 215 | undef $ret; |
216 | 216 | ||
217 | # optional * ---vvv--- appears in indirect jmp/call | 217 | # optional * ---vvv--- appears in indirect jmp/call |
218 | if ($line =~ /^(\*?)([^\(,]*)\(([%\w,]+)\)/ && | 218 | if ($line =~ /^(\*?)([^\(,]*)\(([%\w,]+)\)/) { |
219 | !($line =~ /^PIC_(GOT|PLT)/)) { | ||
220 | $self->{asterisk} = $1; | 219 | $self->{asterisk} = $1; |
221 | $self->{label} = $2; | 220 | $self->{label} = $2; |
222 | ($self->{base},$self->{index},$self->{scale})=split(/,/,$3); | 221 | ($self->{base},$self->{index},$self->{scale})=split(/,/,$3); |
@@ -773,8 +772,6 @@ my $rdrand = sub { | |||
773 | } | 772 | } |
774 | }; | 773 | }; |
775 | 774 | ||
776 | print "#include <machine/asm.h>\n"; | ||
777 | |||
778 | if ($nasm) { | 775 | if ($nasm) { |
779 | print <<___; | 776 | print <<___; |
780 | default rel | 777 | default rel |
diff --git a/src/lib/libssl/src/crypto/rc4/asm/rc4-x86_64.pl b/src/lib/libssl/src/crypto/rc4/asm/rc4-x86_64.pl index ac2c05074e..d6eac205e9 100755 --- a/src/lib/libssl/src/crypto/rc4/asm/rc4-x86_64.pl +++ b/src/lib/libssl/src/crypto/rc4/asm/rc4-x86_64.pl | |||
@@ -442,7 +442,7 @@ private_RC4_set_key: | |||
442 | xor %r10,%r10 | 442 | xor %r10,%r10 |
443 | xor %r11,%r11 | 443 | xor %r11,%r11 |
444 | 444 | ||
445 | mov PIC_GOT(OPENSSL_ia32cap_P),$idx#d | 445 | mov OPENSSL_ia32cap_P(%rip),$idx#d |
446 | bt \$20,$idx#d # RC4_CHAR? | 446 | bt \$20,$idx#d # RC4_CHAR? |
447 | jc .Lc1stloop | 447 | jc .Lc1stloop |
448 | jmp .Lw1stloop | 448 | jmp .Lw1stloop |
@@ -506,7 +506,7 @@ private_RC4_set_key: | |||
506 | .align 16 | 506 | .align 16 |
507 | RC4_options: | 507 | RC4_options: |
508 | lea .Lopts(%rip),%rax | 508 | lea .Lopts(%rip),%rax |
509 | mov PIC_GOT(OPENSSL_ia32cap_P),%edx | 509 | mov OPENSSL_ia32cap_P(%rip),%edx |
510 | bt \$20,%edx | 510 | bt \$20,%edx |
511 | jc .L8xchar | 511 | jc .L8xchar |
512 | bt \$30,%edx | 512 | bt \$30,%edx |
diff --git a/src/lib/libssl/src/crypto/x86_64cpuid.pl b/src/lib/libssl/src/crypto/x86_64cpuid.pl index 58e9bedcf0..7b7b93b223 100644 --- a/src/lib/libssl/src/crypto/x86_64cpuid.pl +++ b/src/lib/libssl/src/crypto/x86_64cpuid.pl | |||
@@ -17,11 +17,10 @@ open STDOUT,"| $^X $xlate $flavour $output"; | |||
17 | ("%rdi","%rsi","%rdx","%rcx"); # Unix order | 17 | ("%rdi","%rsi","%rdx","%rcx"); # Unix order |
18 | 18 | ||
19 | print<<___; | 19 | print<<___; |
20 | #include <machine/asm.h> | ||
21 | .extern OPENSSL_cpuid_setup | 20 | .extern OPENSSL_cpuid_setup |
22 | .hidden OPENSSL_cpuid_setup | 21 | .hidden OPENSSL_cpuid_setup |
23 | .section .init | 22 | .section .init |
24 | call PIC_PLT(OPENSSL_cpuid_setup) | 23 | call OPENSSL_cpuid_setup |
25 | 24 | ||
26 | .hidden OPENSSL_ia32cap_P | 25 | .hidden OPENSSL_ia32cap_P |
27 | .comm OPENSSL_ia32cap_P,8,4 | 26 | .comm OPENSSL_ia32cap_P,8,4 |