Skip to content

Commit 9ef16e8

Browse files
committed
Curve25519 improvements
Add non-constant time implemenations of mod_inv for x64 and Aarch64 assembly. Generate base point table, with better formatting, for double smul with a script. Increase Bi table size to 32 entries for 64-bit asm. Minor improvements to double smul. WOLFSSL_CURVE25519_NOT_USE_ED25519 to not use ed25519 base smul in curve25519 base smul.
1 parent b7e69fb commit 9ef16e8

File tree

9 files changed

+3145
-1790
lines changed

9 files changed

+3145
-1790
lines changed

configure.ac

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10280,6 +10280,12 @@ then
1028010280
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CURVE25519_USE_ED25519"
1028110281
AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_CURVE25519_USE_ED25519"
1028210282
fi
10283+
if test "$ENABLED_CURVE25519" = "not-ed"
10284+
then
10285+
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CURVE25519_NOT_USE_ED25519"
10286+
AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_CURVE25519_NOT_USE_ED25519"
10287+
fi
10288+
1028310289
1028410290
AM_CFLAGS="$AM_CFLAGS -DHAVE_CURVE25519"
1028510291
AM_CCASFLAGS="$AM_CCASFLAGS -DHAVE_CURVE25519"

wolfcrypt/src/curve25519.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,9 @@ const curve25519_set_type curve25519_sets[] = {
7575
}
7676
};
7777

78-
#if !defined(WOLFSSL_CURVE25519_USE_ED25519) || \
79-
defined(WOLFSSL_CURVE25519_BLINDING)
78+
#if (!defined(WOLFSSL_CURVE25519_USE_ED25519) && \
79+
!(defined(CURVED25519_X64) || (defined(WOLFSSL_ARMASM) && \
80+
defined(__aarch64__)))) || defined(WOLFSSL_CURVE25519_BLINDING)
8081
static const word32 kCurve25519BasePoint[CURVE25519_KEYSIZE/sizeof(word32)] = {
8182
#ifdef BIG_ENDIAN_ORDER
8283
0x09000000

wolfcrypt/src/ed25519.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ static int ed25519_verify_msg_final_with_sha(const byte* sig, word32 sigLen,
822822
if (ret != 0)
823823
return ret;
824824

825-
ge_tobytes(rcheck, &R);
825+
ge_tobytes_nct(rcheck, &R);
826826
#endif /* FREESCALE_LTC_ECC */
827827

828828
/* comparison of R created to R in sig */

0 commit comments

Comments
 (0)