fix NXP LTC build with wc_curve25519_generic(), only supports single basepoint

This commit is contained in:
Chris Conlon
2020-12-17 09:50:18 -07:00
parent 6d9cf6b31e
commit e8785666c4

View File

@@ -110,6 +110,12 @@ int wc_curve25519_generic(int public_size, byte* pub,
int basepoint_size, const byte* basepoint) { int basepoint_size, const byte* basepoint) {
int ret; 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) || if ((public_size != CURVE25519_KEYSIZE) ||
(private_size != CURVE25519_KEYSIZE) || (private_size != CURVE25519_KEYSIZE) ||
(basepoint_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; 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(); fe_init();
#if defined(USE_INTEL_SPEEDUP) || defined(WOLFSSL_ARMASM) #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) #if defined(USE_INTEL_SPEEDUP) || defined(WOLFSSL_ARMASM)
RESTORE_VECTOR_REGISTERS(); RESTORE_VECTOR_REGISTERS();
#endif #endif
#endif
return ret; return ret;
} }