From 4590d98e042ab7f61ae2ecc6c40cce06a2d11333 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Tue, 30 Apr 2019 17:16:41 -0400 Subject: [PATCH] Disable move_conditional_bytes until it can be tested --- donna_32.cpp | 8 ++++++-- donna_64.cpp | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/donna_32.cpp b/donna_32.cpp index 28ae82df..2e07834a 100644 --- a/donna_32.cpp +++ b/donna_32.cpp @@ -927,8 +927,12 @@ curve25519_contract(byte out[32], const bignum25519 in) { /* out = (flag) ? in : out */ inline void -curve25519_move_conditional_bytes(byte out[96], const byte in[96], word32 flag) { -#if defined(__GNUC__) && defined(__i686__) +curve25519_move_conditional_bytes(byte out[96], const byte in[96], word32 flag) +{ + // TODO: enable this code path once we can test and benchmark it. + // It is about 48 insns shorter, it avoids punning which may be UB, + // and it is guaranteed constant time. +#if defined(__GNUC__) && defined(__i686__) && 0 const word32 iter = 96/sizeof(word32); word32* outl = reinterpret_cast(out); const word32* inl = reinterpret_cast(in); diff --git a/donna_64.cpp b/donna_64.cpp index a1d22c4e..1a67ed38 100644 --- a/donna_64.cpp +++ b/donna_64.cpp @@ -749,8 +749,12 @@ curve25519_contract(byte *out, const bignum25519 input) { /* out = (flag) ? in : out */ inline void -curve25519_move_conditional_bytes(byte out[96], const byte in[96], word64 flag) { -#if defined(__GNUC__) && defined(__x86_64__) +curve25519_move_conditional_bytes(byte out[96], const byte in[96], word64 flag) +{ + // TODO: enable this code path once we can test and benchmark it. + // It is about 24 insns shorter, it avoids punning which may be UB, + // and it is guaranteed constant time. +#if defined(__GNUC__) && defined(__x86_64__) && 0 const word32 iter = 96/sizeof(word64); word64* outq = reinterpret_cast(out); const word64* inq = reinterpret_cast(in);