Skip to content

Commit d218d3f

Browse files
committed
wolfcrypt/src/ge_operations.c and wolfssl/wolfcrypt/ge_operations.h: when ge_tobytes_nct and ge_tobytes have identical definitions, map the former to the latter using a macro and omit the latter definition, to avoid problematic R_ARM_THM_JUMP11 tail call.
1 parent 00b65a9 commit d218d3f

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

wolfcrypt/src/ge_operations.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10176,12 +10176,8 @@ void ge_tobytes(unsigned char *s,const ge_p2 *h)
1017610176
s[31] ^= (unsigned char)((unsigned char)fe_isnegative(x) << 7);
1017710177
}
1017810178

10179-
#ifdef HAVE_ED25519_VERIFY
10180-
#ifndef CURVED25519_ASM_64BIT
10181-
#define fe_invert_nct fe_invert
10182-
#endif
10183-
10184-
/* ge tobytes */
10179+
#if defined(HAVE_ED25519_VERIFY) && defined(CURVED25519_ASM_64BIT)
10180+
/* ge tobytes_nct */
1018510181
void ge_tobytes_nct(unsigned char *s,const ge_p2 *h)
1018610182
{
1018710183
ge recip;
@@ -10194,7 +10190,7 @@ void ge_tobytes_nct(unsigned char *s,const ge_p2 *h)
1019410190
fe_tobytes(s,y);
1019510191
s[31] ^= (unsigned char)((unsigned char)fe_isnegative(x) << 7);
1019610192
}
10197-
#endif
10193+
#endif /* HAVE_ED25519_VERIFY && CURVED25519_ASM_64BIT */
1019810194

1019910195
#endif /* !ED25519_SMALL */
1020010196

wolfssl/wolfcrypt/ge_operations.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,13 @@ WOLFSSL_LOCAL void sc_reduce(byte* s);
8585
WOLFSSL_LOCAL void sc_muladd(byte* s, const byte* a, const byte* b,
8686
const byte* c);
8787
WOLFSSL_LOCAL void ge_tobytes(unsigned char *s,const ge_p2 *h);
88-
#ifndef ED25519_SMALL
88+
#ifdef HAVE_ED25519_VERIFY
89+
#if !defined(ED25519_SMALL) && defined(CURVED25519_ASM_64BIT)
8990
WOLFSSL_LOCAL void ge_tobytes_nct(unsigned char *s,const ge_p2 *h);
9091
#else
9192
#define ge_tobytes_nct ge_tobytes
9293
#endif
94+
#endif /* HAVE_ED25519_VERIFY */
9395
#ifndef GE_P3_TOBYTES_IMPL
9496
#define ge_p3_tobytes(s, h) ge_tobytes((s), (const ge_p2 *)(h))
9597
#else

0 commit comments

Comments
 (0)