diff options
author | miod <> | 2015-07-19 02:26:32 +0000 |
---|---|---|
committer | miod <> | 2015-07-19 02:26:32 +0000 |
commit | c03d4338a4ce59cb92570b8110f33544b704535d (patch) | |
tree | 2c3789d7df2cd56cc7daf8c517ccacf9a3603c95 /src/lib/libcrypto/aes | |
parent | 7d27977505dcf038edc3626f5af535a007e188a1 (diff) | |
download | openbsd-c03d4338a4ce59cb92570b8110f33544b704535d.tar.gz openbsd-c03d4338a4ce59cb92570b8110f33544b704535d.tar.bz2 openbsd-c03d4338a4ce59cb92570b8110f33544b704535d.zip |
Remove the logic responsible for outputting most AES-NI instructions as
raw byte sequences. The toolchains have had some time to update and assemble
the instructions correctly (except for p{ins,ext}rd which are not supported
yet by as(1) under OpenBSD, but will be fixed shortly).
Inspired by a discussion between tedu@ and John-Mark Gurney.
Verified to still work on Mac OS X and average Linux distros by bcook@
Diffstat (limited to 'src/lib/libcrypto/aes')
-rw-r--r-- | src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl | 18 | ||||
-rw-r--r-- | src/lib/libcrypto/aes/asm/aesni-x86_64.pl | 28 |
2 files changed, 0 insertions, 46 deletions
diff --git a/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl b/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl index 3c8f6c19e7..39b504cbe5 100644 --- a/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl +++ b/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl | |||
@@ -1226,25 +1226,7 @@ sub rex { | |||
1226 | push @opcode,$rex|0x40 if($rex); | 1226 | push @opcode,$rex|0x40 if($rex); |
1227 | } | 1227 | } |
1228 | 1228 | ||
1229 | sub aesni { | ||
1230 | my $line=shift; | ||
1231 | my @opcode=(0x66); | ||
1232 | |||
1233 | if ($line=~/(aes[a-z]+)\s+%xmm([0-9]+),\s*%xmm([0-9]+)/) { | ||
1234 | my %opcodelet = ( | ||
1235 | "aesenc" => 0xdc, "aesenclast" => 0xdd | ||
1236 | ); | ||
1237 | return undef if (!defined($opcodelet{$1})); | ||
1238 | rex(\@opcode,$3,$2); | ||
1239 | push @opcode,0x0f,0x38,$opcodelet{$1}; | ||
1240 | push @opcode,0xc0|($2&7)|(($3&7)<<3); # ModR/M | ||
1241 | return ".byte\t".join(',',@opcode); | ||
1242 | } | ||
1243 | return $line; | ||
1244 | } | ||
1245 | |||
1246 | $code =~ s/\`([^\`]*)\`/eval($1)/gem; | 1229 | $code =~ s/\`([^\`]*)\`/eval($1)/gem; |
1247 | $code =~ s/\b(aes.*%xmm[0-9]+).*$/aesni($1)/gem; | ||
1248 | 1230 | ||
1249 | print $code; | 1231 | print $code; |
1250 | close STDOUT; | 1232 | close STDOUT; |
diff --git a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl index a53204af6c..c073667fcb 100644 --- a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl +++ b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl | |||
@@ -3034,35 +3034,7 @@ sub rex { | |||
3034 | push @opcode,$rex|0x40 if($rex); | 3034 | push @opcode,$rex|0x40 if($rex); |
3035 | } | 3035 | } |
3036 | 3036 | ||
3037 | sub aesni { | ||
3038 | my $line=shift; | ||
3039 | my @opcode=(0x66); | ||
3040 | |||
3041 | if ($line=~/(aeskeygenassist)\s+\$([x0-9a-f]+),\s*%xmm([0-9]+),\s*%xmm([0-9]+)/) { | ||
3042 | rex(\@opcode,$4,$3); | ||
3043 | push @opcode,0x0f,0x3a,0xdf; | ||
3044 | push @opcode,0xc0|($3&7)|(($4&7)<<3); # ModR/M | ||
3045 | my $c=$2; | ||
3046 | push @opcode,$c=~/^0/?oct($c):$c; | ||
3047 | return ".byte\t".join(',',@opcode); | ||
3048 | } | ||
3049 | elsif ($line=~/(aes[a-z]+)\s+%xmm([0-9]+),\s*%xmm([0-9]+)/) { | ||
3050 | my %opcodelet = ( | ||
3051 | "aesimc" => 0xdb, | ||
3052 | "aesenc" => 0xdc, "aesenclast" => 0xdd, | ||
3053 | "aesdec" => 0xde, "aesdeclast" => 0xdf | ||
3054 | ); | ||
3055 | return undef if (!defined($opcodelet{$1})); | ||
3056 | rex(\@opcode,$3,$2); | ||
3057 | push @opcode,0x0f,0x38,$opcodelet{$1}; | ||
3058 | push @opcode,0xc0|($2&7)|(($3&7)<<3); # ModR/M | ||
3059 | return ".byte\t".join(',',@opcode); | ||
3060 | } | ||
3061 | return $line; | ||
3062 | } | ||
3063 | |||
3064 | $code =~ s/\`([^\`]*)\`/eval($1)/gem; | 3037 | $code =~ s/\`([^\`]*)\`/eval($1)/gem; |
3065 | $code =~ s/\b(aes.*%xmm[0-9]+).*$/aesni($1)/gem; | ||
3066 | 3038 | ||
3067 | print $code; | 3039 | print $code; |
3068 | 3040 | ||