From: deraadt Date: Mon, 11 Dec 2017 05:48:01 +0000 (+0000) Subject: http://repzret.org/p/repzret/ X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=3f624d5f689b2964adb044dbb5971a0310c8869d;p=openbsd 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 --- diff --git a/lib/libcrypto/aes/asm/aes-x86_64.pl b/lib/libcrypto/aes/asm/aes-x86_64.pl index c37fd55648b..9072f603a94 100755 --- a/lib/libcrypto/aes/asm/aes-x86_64.pl +++ b/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/lib/libcrypto/camellia/asm/cmll-x86_64.pl b/lib/libcrypto/camellia/asm/cmll-x86_64.pl index a171c654b2d..df6bf11a288 100644 --- a/lib/libcrypto/camellia/asm/cmll-x86_64.pl +++ b/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/lib/libcrypto/perlasm/x86_64-xlate.pl b/lib/libcrypto/perlasm/x86_64-xlate.pl index a8393d27309..5f7f5855490 100755 --- a/lib/libcrypto/perlasm/x86_64-xlate.pl +++ b/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 {