aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorSamuel Neves <sneves@dei.uc.pt>2018-08-18 04:14:18 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2018-08-28 23:20:13 -0600
commit327c291414fc7fc7e2eab90123ef9beab97cf0e4 (patch)
tree952fe243cd245940c01a054328a5322b4bc89f83
parentcurve25519-hacl64: use formally verified C for comparisons (diff)
downloadwireguard-monolithic-historical-327c291414fc7fc7e2eab90123ef9beab97cf0e4.tar.xz
wireguard-monolithic-historical-327c291414fc7fc7e2eab90123ef9beab97cf0e4.zip
curve25519-x86_64: let the compiler decide when/how to load constants
Signed-off-by: Samuel Neves <sneves@dei.uc.pt>
-rw-r--r--src/crypto/curve25519-x86_64.h7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/crypto/curve25519-x86_64.h b/src/crypto/curve25519-x86_64.h
index 7324cee..ac3fbfd 100644
--- a/src/crypto/curve25519-x86_64.h
+++ b/src/crypto/curve25519-x86_64.h
@@ -1606,11 +1606,8 @@ static void inv_eltfp25519_1w_bmi2(u64 *const c, const u64 *const a)
*/
static __always_inline void fred_eltfp25519_1w(u64 *const c)
{
- u64 tmp0, tmp1;
+ u64 tmp0 = 38, tmp1 = 19;
asm volatile(
- "movl $19, %k5 ;"
- "movl $38, %k4 ;"
-
"btrq $63, %3 ;" /* Put bit 255 in carry flag and clear */
"cmovncl %k5, %k4 ;" /* c[255] ? 38 : 19 */
@@ -1631,7 +1628,7 @@ static __always_inline void fred_eltfp25519_1w(u64 *const c)
"sbbq $0, %2 ;"
"sbbq $0, %3 ;"
- : "+r"(c[0]), "+r"(c[1]), "+r"(c[2]), "+r"(c[3]), "=r"(tmp0), "=r"(tmp1)
+ : "+r"(c[0]), "+r"(c[1]), "+r"(c[2]), "+r"(c[3]), "+r"(tmp0), "+r"(tmp1)
:
: "memory", "cc");
}