From 739b09b33140a7cde6da09372fc371d59f4751c7 Mon Sep 17 00:00:00 2001 From: deraadt <> Date: Mon, 11 Dec 2017 05:48:01 +0000 Subject: http://repzret.org/p/repzret/ My read of this: Long time ago (Think Conan, not dinasaurs) during the race to make speedier processors, a cpu vendor built a pipeline with a bad stall, and proposed a tremendously hasky workaround. A wizard adopted this into his perl scroll, and failed to reflect later when no compiler adopted the practice. This relic remains at the tail end of some functions in OpenSSL as ".byte 0xf3,0xc3". Banish it straight to hell. ok mlarkin, others also stared blankly --- src/lib/libcrypto/aes/asm/aes-x86_64.pl | 10 +++++----- src/lib/libcrypto/camellia/asm/cmll-x86_64.pl | 4 ++-- src/lib/libcrypto/perlasm/x86_64-xlate.pl | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lib/libcrypto/aes/asm/aes-x86_64.pl b/src/lib/libcrypto/aes/asm/aes-x86_64.pl index c37fd55648..9072f603a9 100755 --- a/src/lib/libcrypto/aes/asm/aes-x86_64.pl +++ b/src/lib/libcrypto/aes/asm/aes-x86_64.pl @@ -352,7 +352,7 @@ ___ ___ } $code.=<<___; - .byte 0xf3,0xc3 # rep ret + retq .size _x86_64_AES_encrypt,.-_x86_64_AES_encrypt ___ @@ -580,7 +580,7 @@ $code.=<<___; xor 4($key),$s1 xor 8($key),$s2 xor 12($key),$s3 - .byte 0xf3,0xc3 # rep ret + retq .size _x86_64_AES_encrypt_compact,.-_x86_64_AES_encrypt_compact ___ @@ -925,7 +925,7 @@ ___ ___ } $code.=<<___; - .byte 0xf3,0xc3 # rep ret + retq .size _x86_64_AES_decrypt,.-_x86_64_AES_decrypt ___ @@ -1179,7 +1179,7 @@ $code.=<<___; xor 4($key),$s1 xor 8($key),$s2 xor 12($key),$s3 - .byte 0xf3,0xc3 # rep ret + retq .size _x86_64_AES_decrypt_compact,.-_x86_64_AES_decrypt_compact ___ @@ -1496,7 +1496,7 @@ $code.=<<___; .Lbadpointer: mov \$-1,%rax .Lexit: - .byte 0xf3,0xc3 # rep ret + retq .size _x86_64_AES_set_encrypt_key,.-_x86_64_AES_set_encrypt_key ___ diff --git a/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl b/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl index a171c654b2..df6bf11a28 100644 --- a/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl +++ b/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl @@ -218,7 +218,7 @@ $code.=<<___; mov $t2,@S[2] mov $t3,@S[3] - .byte 0xf3,0xc3 # rep ret + retq .size _x86_64_Camellia_encrypt,.-_x86_64_Camellia_encrypt # V1.x API @@ -329,7 +329,7 @@ $code.=<<___; mov $t0,@S[2] mov $t1,@S[3] - .byte 0xf3,0xc3 # rep ret + retq .size _x86_64_Camellia_decrypt,.-_x86_64_Camellia_decrypt ___ diff --git a/src/lib/libcrypto/perlasm/x86_64-xlate.pl b/src/lib/libcrypto/perlasm/x86_64-xlate.pl index a8393d2730..5f7f585549 100755 --- a/src/lib/libcrypto/perlasm/x86_64-xlate.pl +++ b/src/lib/libcrypto/perlasm/x86_64-xlate.pl @@ -149,7 +149,7 @@ my %globals; $epilogue = "movq 8(%rsp),%rdi\n\t" . "movq 16(%rsp),%rsi\n\t"; } - $epilogue . ".byte 0xf3,0xc3"; + $epilogue . "retq"; } elsif ($self->{op} eq "call" && !$elf && $current_segment eq ".init") { ".p2align\t3\n\t.quad"; } else { -- cgit v1.2.3-55-g6feb