Enhancement to support different sized Curve/Ed math library implementations for FE/GE. Remains backwards compatible with CURVED25519_SMALL define. Adds new defines CURVE25519_SMALL and ED25519_SMALL to allow individual enabling of math library choice (_low_mem or _operations). Example: ./configure --enable-ed25519=small --enable-curve25519.
This commit is contained in:
@@ -28,8 +28,8 @@
|
||||
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
|
||||
#ifndef CURVED25519_SMALL /* run when not defined to use small memory math */
|
||||
#if defined(HAVE_ED25519) || defined(HAVE_CURVE25519)
|
||||
#if defined(HAVE_CURVE25519) || defined(HAVE_ED25519)
|
||||
#if !defined(CURVE25519_SMALL) || !defined(ED25519_SMALL) /* run when not defined to use small memory math */
|
||||
|
||||
#include <wolfssl/wolfcrypt/fe_operations.h>
|
||||
#include <stdint.h>
|
||||
@@ -110,7 +110,7 @@ void fe_0(fe h)
|
||||
h[9] = 0;
|
||||
}
|
||||
|
||||
#ifndef FREESCALE_LTC_ECC
|
||||
#if !defined(CURVE25519_SMALL) && !defined(FREESCALE_LTC_ECC)
|
||||
int curve25519(byte* q, byte* n, byte* p)
|
||||
{
|
||||
#if 0
|
||||
@@ -186,7 +186,8 @@ int curve25519(byte* q, byte* n, byte* p)
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* !FREESCALE_LTC_ECC */
|
||||
#endif /* !CURVE25519_SMALL && !FREESCALE_LTC_ECC */
|
||||
|
||||
|
||||
/*
|
||||
h = f * f
|
||||
@@ -1411,6 +1412,6 @@ void fe_cmov(fe f, const fe g, int b)
|
||||
f[9] = f9 ^ x9;
|
||||
}
|
||||
#endif
|
||||
#endif /* HAVE ED25519 or CURVE25519 */
|
||||
#endif /* not defined CURVED25519_SMALL */
|
||||
|
||||
#endif /* !CURVE25519_SMALL || !ED25519_SMALL */
|
||||
#endif /* HAVE_CURVE25519 || HAVE_ED25519 */
|
||||
|
||||
Reference in New Issue
Block a user