From e8785666c4143e802e92332a184c4bcd5961a81a Mon Sep 17 00:00:00 2001 From: Chris Conlon Date: Thu, 17 Dec 2020 09:50:18 -0700 Subject: [PATCH] fix NXP LTC build with wc_curve25519_generic(), only supports single basepoint --- wolfcrypt/src/curve25519.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/wolfcrypt/src/curve25519.c b/wolfcrypt/src/curve25519.c index 2d952c75e..24910df89 100644 --- a/wolfcrypt/src/curve25519.c +++ b/wolfcrypt/src/curve25519.c @@ -110,6 +110,12 @@ int wc_curve25519_generic(int public_size, byte* pub, int basepoint_size, const byte* basepoint) { int ret; +#ifdef FREESCALE_LTC_ECC + /* unsupported with NXP LTC, onlly supports single basepoint with + * nxp_ltc_curve25519_GetBasePoint() */ + return WC_HW_E; +#endif + if ((public_size != CURVE25519_KEYSIZE) || (private_size != CURVE25519_KEYSIZE) || (basepoint_size != CURVE25519_KEYSIZE)) { @@ -124,14 +130,6 @@ int wc_curve25519_generic(int public_size, byte* pub, return ECC_BAD_ARG_E; } -#ifdef FREESCALE_LTC_ECC - { - ECPoint wc_pub; - ret = nxp_ltc_curve25519(&wc_pub, priv, basepoint, basepoint); - if (ret == 0) - XMEMCPY(pub, wc_pub.point, CURVE25519_KEYSIZE); - } -#else fe_init(); #if defined(USE_INTEL_SPEEDUP) || defined(WOLFSSL_ARMASM) @@ -143,7 +141,6 @@ int wc_curve25519_generic(int public_size, byte* pub, #if defined(USE_INTEL_SPEEDUP) || defined(WOLFSSL_ARMASM) RESTORE_VECTOR_REGISTERS(); #endif -#endif return ret; }