Only implement and call fe_init when available

This commit is contained in:
Sean Parkinson
2017-12-08 14:16:24 +10:00
parent 4c4b02bb31
commit c457ca462a
3 changed files with 8 additions and 2 deletions

View File

@@ -67,7 +67,9 @@ int wc_curve25519_make_key(WC_RNG* rng, int keysize, curve25519_key* key)
if (keysize != CURVE25519_KEYSIZE) if (keysize != CURVE25519_KEYSIZE)
return ECC_BAD_ARG_E; return ECC_BAD_ARG_E;
#ifndef FREESCALE_LTC_ECC
fe_init(); fe_init();
#endif
/* random number for private key */ /* random number for private key */
ret = wc_RNG_GenerateBlock(rng, key->k.point, keysize); ret = wc_RNG_GenerateBlock(rng, key->k.point, keysize);
@@ -430,10 +432,10 @@ int wc_curve25519_init(curve25519_key* key)
#ifdef FREESCALE_LTC_ECC #ifdef FREESCALE_LTC_ECC
XMEMSET(key->k.pointY, 0, key->dp->size); XMEMSET(key->k.pointY, 0, key->dp->size);
XMEMSET(key->p.pointY, 0, key->dp->size); XMEMSET(key->p.pointY, 0, key->dp->size);
#else
fe_init();
#endif #endif
fe_init();
return 0; return 0;
} }

View File

@@ -295,7 +295,9 @@ int wc_ed25519_init(ed25519_key* key)
XMEMSET(key, 0, sizeof(ed25519_key)); XMEMSET(key, 0, sizeof(ed25519_key));
#ifndef FREESCALE_LTC_ECC
fe_init(); fe_init();
#endif
return 0; return 0;
} }

View File

@@ -57,9 +57,11 @@ void lm_copy(byte* x, const byte* a)
#ifdef CURVE25519_SMALL #ifdef CURVE25519_SMALL
#ifndef FREESCALE_LTC_ECC
void fe_init() void fe_init()
{ {
} }
#endif
/* Double an X-coordinate */ /* Double an X-coordinate */
static void xc_double(byte *x3, byte *z3, static void xc_double(byte *x3, byte *z3,