diff options
| author | miod <> | 2016-11-04 17:30:30 +0000 |
|---|---|---|
| committer | miod <> | 2016-11-04 17:30:30 +0000 |
| commit | 1a12fc8399638223feca8f853e2ac2cc22eeb471 (patch) | |
| tree | 77b413175d422148cfb0ef7b2062340230aa5413 /src/lib/libcrypto/rc4/asm/rc4-x86_64.pl | |
| parent | 78e68d71838891e44ddbb5238203ccfce3b62d80 (diff) | |
| download | openbsd-1a12fc8399638223feca8f853e2ac2cc22eeb471.tar.gz openbsd-1a12fc8399638223feca8f853e2ac2cc22eeb471.tar.bz2 openbsd-1a12fc8399638223feca8f853e2ac2cc22eeb471.zip | |
Replace all uses of magic numbers when operating on OPENSSL_ia32_P[] by
meaningful constants in a private header file, so that reviewers can actually
get a chance to figure out what the code is attempting to do without knowing
all cpuid bits.
While there, turn it from an array of two 32-bit ints into a properly aligned
64-bit int.
Use of OPENSSL_ia32_P is now restricted to the assembler parts. C code will
now always use OPENSSL_cpu_caps() and check for the proper bits in the
whole 64-bit word it returns.
i386 tests and ok jsing@
Diffstat (limited to 'src/lib/libcrypto/rc4/asm/rc4-x86_64.pl')
| -rwxr-xr-x | src/lib/libcrypto/rc4/asm/rc4-x86_64.pl | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl b/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl index 197749dda7..2135b38ef8 100755 --- a/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl +++ b/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl | |||
| @@ -122,6 +122,7 @@ $out="%rcx"; # arg4 | |||
| 122 | $code=<<___; | 122 | $code=<<___; |
| 123 | .text | 123 | .text |
| 124 | .extern OPENSSL_ia32cap_P | 124 | .extern OPENSSL_ia32cap_P |
| 125 | .hidden OPENSSL_ia32cap_P | ||
| 125 | 126 | ||
| 126 | .globl RC4 | 127 | .globl RC4 |
| 127 | .type RC4,\@function,4 | 128 | .type RC4,\@function,4 |
| @@ -164,7 +165,7 @@ $code.=<<___; | |||
| 164 | movl ($dat,$XX[0],4),$TX[0]#d | 165 | movl ($dat,$XX[0],4),$TX[0]#d |
| 165 | test \$-16,$len | 166 | test \$-16,$len |
| 166 | jz .Lloop1 | 167 | jz .Lloop1 |
| 167 | bt \$30,%r8d # Intel CPU? | 168 | bt \$IA32CAP_BIT0_INTEL,%r8d # Intel CPU? |
| 168 | jc .Lintel | 169 | jc .Lintel |
| 169 | and \$7,$TX[1] | 170 | and \$7,$TX[1] |
| 170 | lea 1($XX[0]),$XX[1] | 171 | lea 1($XX[0]),$XX[1] |
| @@ -442,7 +443,7 @@ RC4_set_key: | |||
| 442 | xor %r11,%r11 | 443 | xor %r11,%r11 |
| 443 | 444 | ||
| 444 | mov OPENSSL_ia32cap_P(%rip),$idx#d | 445 | mov OPENSSL_ia32cap_P(%rip),$idx#d |
| 445 | bt \$20,$idx#d # RC4_CHAR? | 446 | bt \$IA32CAP_BIT0_INTELP4,$idx#d # RC4_CHAR? |
| 446 | jc .Lc1stloop | 447 | jc .Lc1stloop |
| 447 | jmp .Lw1stloop | 448 | jmp .Lw1stloop |
| 448 | 449 | ||
| @@ -506,9 +507,9 @@ RC4_set_key: | |||
| 506 | RC4_options: | 507 | RC4_options: |
| 507 | lea .Lopts(%rip),%rax | 508 | lea .Lopts(%rip),%rax |
| 508 | mov OPENSSL_ia32cap_P(%rip),%edx | 509 | mov OPENSSL_ia32cap_P(%rip),%edx |
| 509 | bt \$20,%edx | 510 | bt \$IA32CAP_BIT0_INTELP4,%edx |
| 510 | jc .L8xchar | 511 | jc .L8xchar |
| 511 | bt \$30,%edx | 512 | bt \$IA32CAP_BIT0_INTEL,%edx |
| 512 | jnc .Ldone | 513 | jnc .Ldone |
| 513 | add \$25,%rax | 514 | add \$25,%rax |
| 514 | ret | 515 | ret |
