add macro blocks to make it easier on embedded devices and fix declaration after executable code

This commit is contained in:
Jacob Barthelmeh
2015-08-14 09:58:44 -06:00
parent 8cc9c62911
commit 0f9f4ea7e0
4 changed files with 10 additions and 3 deletions

View File

@@ -27,6 +27,7 @@
#include <wolfssl/wolfcrypt/settings.h>
#if defined(CURVED25519_SMALL) /* use slower code that takes less memory */
#if defined(HAVE_ED25519) || defined(HAVE_CURVE25519)
#include <wolfssl/wolfcrypt/fe_operations.h>
@@ -593,4 +594,4 @@ void fe_sqrt(byte *r, const byte *a)
}
#endif /* HAVE_CURVE25519 or HAVE_ED25519 */
#endif /* CURVED25519_SMALL */

View File

@@ -27,6 +27,7 @@
#include <wolfssl/wolfcrypt/settings.h>
#ifndef CURVED25519_SMALL /* run when not defined to use small memory math */
#if defined(HAVE_ED25519) || defined(HAVE_CURVE25519)
#include <wolfssl/wolfcrypt/fe_operations.h>
@@ -1405,4 +1406,5 @@ void fe_cmov(fe f,const fe g,unsigned int b)
f[9] = f9 ^ x9;
}
#endif /* HAVE ED25519 or CURVE25519 */
#endif /* not defined CURVED25519_SMALL */

View File

@@ -27,7 +27,8 @@
#include <wolfssl/wolfcrypt/settings.h>
#ifdef HAVE_ED25519
#if defined(CURVED25519_SMALL) /* use slower code that takes less memory */
#if defined(HAVE_ED25519)
#include <wolfssl/wolfcrypt/ge_operations.h>
#include <wolfssl/wolfcrypt/error-crypt.h>
@@ -71,12 +72,12 @@ int ge_compress_key(byte* out, const byte* xIn, const byte* yIn,
{
byte tmp[F25519_SIZE];
byte parity;
byte pt[32];
int i;
fe_copy(tmp, xIn);
parity = (tmp[0] & 1) << 7;
byte pt[32];
fe_copy(pt, yIn);
pt[31] |= parity;
@@ -555,4 +556,5 @@ int ge_double_scalarmult_vartime(ge_p2* R, const unsigned char *h,
}
#endif /* HAVE_ED25519 */
#endif /* CURVED25519_SMALL */

View File

@@ -28,6 +28,7 @@
#include <wolfssl/wolfcrypt/settings.h>
#ifndef CURVED25519_SMALL /* run when not defined to use small memory math */
#ifdef HAVE_ED25519
#include <wolfssl/wolfcrypt/ge_operations.h>
@@ -2600,4 +2601,5 @@ void ge_tobytes(unsigned char *s,const ge_p2 *h)
s[31] ^= fe_isnegative(x) << 7;
}
#endif /* HAVE_ED25519 */
#endif /* not defined CURVED25519_SMALL */