diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index b8cbc10b6..d81a97d82 100644 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -14356,7 +14356,7 @@ int wc_EccPublicKeyDecode(const byte* input, word32* inOutIdx, if (ret == 0) { static char customName[] = "Custom"; XMEMSET(curve, 0, sizeof(*curve)); - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC curve->name = customName; #else XMEMCPY((void*)curve->name, customName, sizeof(customName)); @@ -14377,17 +14377,17 @@ int wc_EccPublicKeyDecode(const byte* input, word32* inOutIdx, SkipObjectId(input, inOutIdx, inSz); ret = ASNToHexString(input, inOutIdx, &p, inSz, key->heap, DYNAMIC_TYPE_ECC_BUFFER); - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC curve->prime = p; #else if (ret == 0 && p != NULL) { - length = XSTRLEN(p) + 1; + length = (int)XSTRLEN(p) + 1; if (length > MAX_ECC_STRING) { WOLFSSL_MSG("Prime too large for buffer"); ret = BUFFER_E; } else { - XSTRNCPY(curve->prime, p, length); + XSTRNCPY((char*)curve->prime, p, length); } } XFREE(p, key->heap, DYNAMIC_TYPE_ECC_BUFFER); @@ -14403,17 +14403,17 @@ int wc_EccPublicKeyDecode(const byte* input, word32* inOutIdx, char* af = NULL; ret = ASNToHexString(input, inOutIdx, &af, inSz, key->heap, DYNAMIC_TYPE_ECC_BUFFER); - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC curve->Af = af; #else if (ret == 0 && af != NULL) { - length = XSTRLEN(af) + 1; + length = (int)XSTRLEN(af) + 1; if (length > MAX_ECC_STRING) { WOLFSSL_MSG("Af too large for buffer"); ret = BUFFER_E; } else { - XSTRNCPY(curve->Af, af, length); + XSTRNCPY((char*)curve->Af, af, length); } } XFREE(af, key->heap, DYNAMIC_TYPE_ECC_BUFFER); @@ -14424,17 +14424,17 @@ int wc_EccPublicKeyDecode(const byte* input, word32* inOutIdx, char* bf = NULL; ret = ASNToHexString(input, inOutIdx, &bf, inSz, key->heap, DYNAMIC_TYPE_ECC_BUFFER); - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC curve->Bf = bf; #else if (ret == 0 && bf != NULL) { - length = XSTRLEN(bf) + 1; + length = (int)XSTRLEN(bf) + 1; if (length > MAX_ECC_STRING) { WOLFSSL_MSG("Bf too large for buffer"); ret = BUFFER_E; } else { - XSTRNCPY(curve->Bf, bf, length); + XSTRNCPY((char*)curve->Bf, bf, length); } } XFREE(bf, key->heap, DYNAMIC_TYPE_ECC_BUFFER); @@ -14462,7 +14462,7 @@ int wc_EccPublicKeyDecode(const byte* input, word32* inOutIdx, } } if (ret == 0) { - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC curve->Gx = (const char*)XMALLOC(curve->size * 2 + 2, key->heap, DYNAMIC_TYPE_ECC_BUFFER); curve->Gy = (const char*)XMALLOC(curve->size * 2 + 2, key->heap, @@ -14490,17 +14490,17 @@ int wc_EccPublicKeyDecode(const byte* input, word32* inOutIdx, ret = ASNToHexString(input, inOutIdx, &o, inSz, key->heap, DYNAMIC_TYPE_ECC_BUFFER); - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC curve->order = o; #else if (ret == 0 && o != NULL) { - length = XSTRLEN(o) + 1; + length = (int)XSTRLEN(o) + 1; if (length > MAX_ECC_STRING) { WOLFSSL_MSG("Order too large for buffer"); ret = BUFFER_E; } else { - XSTRNCPY(curve->order, o, length); + XSTRNCPY((char*)curve->order, o, length); } } XFREE(o, key->heap, DYNAMIC_TYPE_ECC_BUFFER); @@ -14509,7 +14509,7 @@ int wc_EccPublicKeyDecode(const byte* input, word32* inOutIdx, if (ret == 0) { curve->cofactor = GetInteger7Bit(input, inOutIdx, inSz); - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC curve->oid = NULL; #else XMEMSET((void*)curve->oid, 0, sizeof(curve->oid)); @@ -14520,7 +14520,7 @@ int wc_EccPublicKeyDecode(const byte* input, word32* inOutIdx, if (wc_ecc_set_custom_curve(key, curve) < 0) { ret = ASN_PARSE_E; } - #ifndef USE_WINDOWS_API + #ifdef WOLFSSL_CUSTOM_CURVES key->deallocSet = 1; #endif curve = NULL; diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index d5bb8e04e..7185fd337 100644 --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c @@ -53,6 +53,9 @@ Possible ECC enable options: * FP_ECC: ECC Fixed Point Cache default: off * USE_ECC_B_PARAM: Enable ECC curve B param default: off (on for HAVE_COMP_KEY) + * WOLFSSL_ECC_CURVE_STATIC: default off (on for windows) + For the ECC curve paramaters `ecc_set_type` use fixed + array for hex string */ /* @@ -212,7 +215,7 @@ enum { #define CODED_SECP112R1 {0x2B,0x81,0x04,0x00,0x06} #define CODED_SECP112R1_SZ 5 #endif - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC static const ecc_oid_t ecc_oid_secp112r1[] = CODED_SECP112R1; #else #define ecc_oid_secp112r1 CODED_SECP112R1 @@ -227,7 +230,7 @@ enum { #define CODED_SECP112R2 {0x2B,0x81,0x04,0x00,0x07} #define CODED_SECP112R2_SZ 5 #endif - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC static const ecc_oid_t ecc_oid_secp112r2[] = CODED_SECP112R2; #else #define ecc_oid_secp112r2 CODED_SECP112R2 @@ -244,7 +247,7 @@ enum { #define CODED_SECP128R1 {0x2B,0x81,0x04,0x00,0x1C} #define CODED_SECP128R1_SZ 5 #endif - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC static const ecc_oid_t ecc_oid_secp128r1[] = CODED_SECP128R1; #else #define ecc_oid_secp128r1 CODED_SECP128R1 @@ -259,7 +262,7 @@ enum { #define CODED_SECP128R2 {0x2B,0x81,0x04,0x00,0x1D} #define CODED_SECP128R2_SZ 5 #endif - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC static const ecc_oid_t ecc_oid_secp128r2[] = CODED_SECP128R2; #else #define ecc_oid_secp128r2 CODED_SECP128R2 @@ -276,7 +279,7 @@ enum { #define CODED_SECP160R1 {0x2B,0x81,0x04,0x00,0x08} #define CODED_SECP160R1_SZ 5 #endif - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC static const ecc_oid_t ecc_oid_secp160r1[] = CODED_SECP160R1; #else #define ecc_oid_secp160r1 CODED_SECP160R1 @@ -291,7 +294,7 @@ enum { #define CODED_SECP160R2 {0x2B,0x81,0x04,0x00,0x1E} #define CODED_SECP160R2_SZ 5 #endif - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC static const ecc_oid_t ecc_oid_secp160r2[] = CODED_SECP160R2; #else #define ecc_oid_secp160r2 CODED_SECP160R2 @@ -306,7 +309,7 @@ enum { #define CODED_SECP160K1 {0x2B,0x81,0x04,0x00,0x09} #define CODED_SECP160K1_SZ 5 #endif - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC static const ecc_oid_t ecc_oid_secp160k1[] = CODED_SECP160K1; #else #define ecc_oid_secp160k1 CODED_SECP160K1 @@ -321,7 +324,7 @@ enum { #define CODED_BRAINPOOLP160R1 {0x2B,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x01} #define CODED_BRAINPOOLP160R1_SZ 9 #endif - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC static const ecc_oid_t ecc_oid_brainpoolp160r1[] = CODED_BRAINPOOLP160R1; #else #define ecc_oid_brainpoolp160r1 CODED_BRAINPOOLP160R1 @@ -338,7 +341,7 @@ enum { #define CODED_SECP192R1 {0x2A,0x86,0x48,0xCE,0x3D,0x03,0x01,0x01} #define CODED_SECP192R1_SZ 8 #endif - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC static const ecc_oid_t ecc_oid_secp192r1[] = CODED_SECP192R1; #else #define ecc_oid_secp192r1 CODED_SECP192R1 @@ -353,7 +356,7 @@ enum { #define CODED_PRIME192V2 {0x2A,0x86,0x48,0xCE,0x3D,0x03,0x01,0x02} #define CODED_PRIME192V2_SZ 8 #endif - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC static const ecc_oid_t ecc_oid_prime192v2[] = CODED_PRIME192V2; #else #define ecc_oid_prime192v2 CODED_PRIME192V2 @@ -368,7 +371,7 @@ enum { #define CODED_PRIME192V3 {0x2A,0x86,0x48,0xCE,0x3D,0x03,0x01,0x03} #define CODED_PRIME192V3_SZ 8 #endif - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC static const ecc_oid_t ecc_oid_prime192v3[] = CODED_PRIME192V3; #else #define ecc_oid_prime192v3 CODED_PRIME192V3 @@ -383,7 +386,7 @@ enum { #define CODED_SECP192K1 {0x2B,0x81,0x04,0x00,0x1F} #define CODED_SECP192K1_SZ 5 #endif - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC static const ecc_oid_t ecc_oid_secp192k1[] = CODED_SECP192K1; #else #define ecc_oid_secp192k1 CODED_SECP192K1 @@ -398,7 +401,7 @@ enum { #define CODED_BRAINPOOLP192R1 {0x2B,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x03} #define CODED_BRAINPOOLP192R1_SZ 9 #endif - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC static const ecc_oid_t ecc_oid_brainpoolp192r1[] = CODED_BRAINPOOLP192R1; #else #define ecc_oid_brainpoolp192r1 CODED_BRAINPOOLP192R1 @@ -415,7 +418,7 @@ enum { #define CODED_SECP224R1 {0x2B,0x81,0x04,0x00,0x21} #define CODED_SECP224R1_SZ 5 #endif - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC static const ecc_oid_t ecc_oid_secp224r1[] = CODED_SECP224R1; #else #define ecc_oid_secp224r1 CODED_SECP224R1 @@ -430,7 +433,7 @@ enum { #define CODED_SECP224K1 {0x2B,0x81,0x04,0x00,0x20} #define CODED_SECP224K1_SZ 5 #endif - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC static const ecc_oid_t ecc_oid_secp224k1[] = CODED_SECP224K1; #else #define ecc_oid_secp224k1 CODED_SECP224K1 @@ -445,7 +448,7 @@ enum { #define CODED_BRAINPOOLP224R1 {0x2B,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x05} #define CODED_BRAINPOOLP224R1_SZ 9 #endif - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC static const ecc_oid_t ecc_oid_brainpoolp224r1[] = CODED_BRAINPOOLP224R1; #else #define ecc_oid_brainpoolp224r1 CODED_BRAINPOOLP224R1 @@ -462,7 +465,7 @@ enum { #define CODED_PRIME239V1 {0x2A,0x86,0x48,0xCE,0x3D,0x03,0x01,0x04} #define CODED_PRIME239V1_SZ 8 #endif - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC static const ecc_oid_t ecc_oid_prime239v1[] = CODED_PRIME239V1; #else #define ecc_oid_prime239v1 CODED_PRIME239V1 @@ -477,7 +480,7 @@ enum { #define CODED_PRIME239V2 {0x2A,0x86,0x48,0xCE,0x3D,0x03,0x01,0x05} #define CODED_PRIME239V2_SZ 8 #endif - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC static const ecc_oid_t ecc_oid_prime239v2[] = CODED_PRIME239V2; #else #define ecc_oid_prime239v2 CODED_PRIME239V2 @@ -492,7 +495,7 @@ enum { #define CODED_PRIME239V3 {0x2A,0x86,0x48,0xCE,0x3D,0x03,0x01,0x06} #define CODED_PRIME239V3_SZ 8 #endif - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC static const ecc_oid_t ecc_oid_prime239v3[] = CODED_PRIME239V3; #else #define ecc_oid_prime239v3 CODED_PRIME239V3 @@ -509,7 +512,7 @@ enum { #define CODED_SECP256R1 {0x2A,0x86,0x48,0xCE,0x3D,0x03,0x01,0x07} #define CODED_SECP256R1_SZ 8 #endif - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC static const ecc_oid_t ecc_oid_secp256r1[] = CODED_SECP256R1; #else #define ecc_oid_secp256r1 CODED_SECP256R1 @@ -524,7 +527,7 @@ enum { #define CODED_SECP256K1 {0x2B,0x81,0x04,0x00,0x0A} #define CODED_SECP256K1_SZ 5 #endif - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC static const ecc_oid_t ecc_oid_secp256k1[] = CODED_SECP256K1; #else #define ecc_oid_secp256k1 CODED_SECP256K1 @@ -539,7 +542,7 @@ enum { #define CODED_BRAINPOOLP256R1 {0x2B,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x07} #define CODED_BRAINPOOLP256R1_SZ 9 #endif - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC static const ecc_oid_t ecc_oid_brainpoolp256r1[] = CODED_BRAINPOOLP256R1; #else #define ecc_oid_brainpoolp256r1 CODED_BRAINPOOLP256R1 @@ -556,7 +559,7 @@ enum { #define CODED_BRAINPOOLP320R1 {0x2B,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x09} #define CODED_BRAINPOOLP320R1_SZ 9 #endif - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC static const ecc_oid_t ecc_oid_brainpoolp320r1[] = CODED_BRAINPOOLP320R1; #else #define ecc_oid_brainpoolp320r1 CODED_BRAINPOOLP320R1 @@ -573,7 +576,7 @@ enum { #define CODED_SECP384R1 {0x2B,0x81,0x04,0x00,0x22} #define CODED_SECP384R1_SZ 5 #endif - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC static const ecc_oid_t ecc_oid_secp384r1[] = CODED_SECP384R1; #define CODED_SECP384R1_OID ecc_oid_secp384r1 #else @@ -589,7 +592,7 @@ enum { #define CODED_BRAINPOOLP384R1 {0x2B,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x0B} #define CODED_BRAINPOOLP384R1_SZ 9 #endif - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC static const ecc_oid_t ecc_oid_brainpoolp384r1[] = CODED_BRAINPOOLP384R1; #else #define ecc_oid_brainpoolp384r1 CODED_BRAINPOOLP384R1 @@ -606,7 +609,7 @@ enum { #define CODED_BRAINPOOLP512R1 {0x2B,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x0D} #define CODED_BRAINPOOLP512R1_SZ 9 #endif - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC static const ecc_oid_t ecc_oid_brainpoolp512r1[] = CODED_BRAINPOOLP512R1; #else #define ecc_oid_brainpoolp512r1 CODED_BRAINPOOLP512R1 @@ -623,7 +626,7 @@ enum { #define CODED_SECP521R1 {0x2B,0x81,0x04,0x00,0x23} #define CODED_SECP521R1_SZ 5 #endif - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC static const ecc_oid_t ecc_oid_secp521r1[] = CODED_SECP521R1; #else #define ecc_oid_secp521r1 CODED_SECP521R1 @@ -1118,7 +1121,7 @@ const ecc_set_type ecc_sets[] = { { 1, /* non-zero */ ECC_CURVE_CUSTOM, - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, #else {0},{0},{0},{0},{0},{0},{0},{0}, @@ -1129,7 +1132,7 @@ const ecc_set_type ecc_sets[] = { { 0, ECC_CURVE_INVALID, - #ifndef USE_WINDOWS_API + #ifndef WOLFSSL_ECC_CURVE_STATIC NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, #else {0},{0},{0},{0},{0},{0},{0},{0}, @@ -3144,7 +3147,10 @@ int wc_ecc_get_curve_idx_from_name(const char* curveName) len = (word32)XSTRLEN(curveName); for (curve_idx = 0; ecc_sets[curve_idx].size != 0; curve_idx++) { - if (ecc_sets[curve_idx].name && + if ( + #ifndef WOLFSSL_ECC_CURVE_STATIC + ecc_sets[curve_idx].name && + #endif XSTRNCASECMP(ecc_sets[curve_idx].name, curveName, len) == 0) { break; } @@ -3331,9 +3337,14 @@ int wc_ecc_get_curve_id_from_dp_params(const ecc_set_type* dp) { int idx; - if (dp == NULL || dp->prime == NULL || dp->Af == NULL || - dp->Bf == NULL || dp->order == NULL || dp->Gx == NULL || dp->Gy == NULL) + if (dp == NULL + #ifndef WOLFSSL_ECC_CURVE_STATIC + || dp->prime == NULL || dp->Af == NULL || + dp->Bf == NULL || dp->order == NULL || dp->Gx == NULL || dp->Gy == NULL + #endif + ) { return BAD_FUNC_ARG; + } for (idx = 0; ecc_sets[idx].size != 0; idx++) { if (dp->size == ecc_sets[idx].size) { @@ -3376,7 +3387,11 @@ int wc_ecc_get_curve_id_from_oid(const byte* oid, word32 len) return BAD_FUNC_ARG; for (curve_idx = 0; ecc_sets[curve_idx].size != 0; curve_idx++) { - if (ecc_sets[curve_idx].oid && ecc_sets[curve_idx].oidSz == len && + if ( + #ifndef WOLFSSL_ECC_CURVE_STATIC + ecc_sets[curve_idx].oid && + #endif + ecc_sets[curve_idx].oidSz == len && XMEMCMP(ecc_sets[curve_idx].oid, oid, len) == 0) { break; } @@ -5127,7 +5142,7 @@ int wc_ecc_sign_set_k(const byte* k, word32 klen, ecc_key* key) #ifdef WOLFSSL_CUSTOM_CURVES void wc_ecc_free_curve(const ecc_set_type* curve, void* heap) { -#ifndef USE_WINDOWS_API +#ifndef WOLFSSL_ECC_CURVE_STATIC if (curve->prime != NULL) XFREE((void*)curve->prime, heap, DYNAMIC_TYPE_ECC_BUFFER); if (curve->Af != NULL) diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 087c87dff..9949ba9b8 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -18241,10 +18241,20 @@ static int ecc_test_custom_curves(WC_RNG* rng) ecc_key key; /* test use of custom curve - using BRAINPOOLP256R1 for test */ + #ifndef WOLFSSL_ECC_CURVE_STATIC + const ecc_oid_t ecc_oid_brainpoolp256r1[] = { + 0x2B,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x07 + }; + const word32 ecc_oid_brainpoolp256r1_sz = + sizeof(ecc_oid_brainpoolp256r1) / sizeof(ecc_oid_t); + #else + #define ecc_oid_brainpoolp256r1 { \ + 0x2B,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x07 \ + } + #define ecc_oid_brainpoolp256r1_sz 9 + #endif const word32 ecc_oid_brainpoolp256r1_sum = 104; - const ecc_oid_t ecc_oid_brainpoolp256r1[] = { - 0x2B,0x24,0x03,0x03,0x02,0x08,0x01,0x01,0x07 - }; + const ecc_set_type ecc_dp_brainpool256r1 = { 32, /* size/bytes */ ECC_CURVE_CUSTOM, /* ID */ @@ -18256,7 +18266,7 @@ static int ecc_test_custom_curves(WC_RNG* rng) "8BD2AEB9CB7E57CB2C4B482FFC81B7AFB9DE27E1E3BD23C23A4453BD9ACE3262", /* Gx */ "547EF835C3DAC4FD97F8461A14611DC9C27745132DED8E545C1D54C72F046997", /* Gy */ ecc_oid_brainpoolp256r1, /* oid/oidSz */ - sizeof(ecc_oid_brainpoolp256r1) / sizeof(ecc_oid_t), + ecc_oid_brainpoolp256r1_sz, ecc_oid_brainpoolp256r1_sum, /* oid sum */ 1, /* cofactor */ }; diff --git a/wolfssl/wolfcrypt/ecc.h b/wolfssl/wolfcrypt/ecc.h index ba263deae..82ba00c10 100644 --- a/wolfssl/wolfcrypt/ecc.h +++ b/wolfssl/wolfcrypt/ecc.h @@ -214,8 +214,17 @@ typedef byte ecc_oid_t; if any element > 127 then MSB 0x80 indicates additional byte */ #endif + +#if !defined(WOLFSSL_ECC_CURVE_STATIC) && defined(USE_WINDOWS_API) + /* MSC does something different with the pointers to the arrays than GCC, + * and it causes the FIPS checksum to fail. In the case of windows builds, + * store everything as arrays instead of pointers to strings. */ + + #define WOLFSSL_ECC_CURVE_STATIC +#endif + /* ECC set type defined a GF(p) curve */ -#ifndef USE_WINDOWS_API +#ifndef WOLFSSL_ECC_CURVE_STATIC typedef struct ecc_set_type { int size; /* The size of the curve in octets */ int id; /* id of this curve */ @@ -232,10 +241,6 @@ typedef struct ecc_set_type { int cofactor; } ecc_set_type; #else -/* MSC does something different with the pointers to the arrays than GCC, - * and it causes the FIPS checksum to fail. In the case of windows builds, - * store everything as arrays instead of pointers to strings. */ - #define MAX_ECC_NAME 16 #define MAX_ECC_STRING ((MAX_ECC_BYTES * 2) + 1) /* The values are stored as text strings. */