Disable algs: fix code to compile with various algs off/on

benchmark.c: Only X25519/Ed25519/X448/Ed448 now compiles
asn.c/asn.h: Only DSA now compiles
This commit is contained in:
Sean Parkinson
2021-01-05 13:49:13 +10:00
parent a13e9bde29
commit 6a5e802cc4
4 changed files with 12 additions and 10 deletions

View File

@@ -584,13 +584,11 @@ static const char* bench_result_words1[][4] = {
#endif #endif
}; };
#if !defined(NO_RSA) || defined(WOLFSSL_KEY_GEN) || defined(HAVE_NTRU) || \ #if !defined(NO_RSA) || defined(HAVE_NTRU) || \
defined(HAVE_ECC) || !defined(NO_DH) || defined(HAVE_ECC_ENCRYPT) || \ defined(HAVE_ECC) || !defined(NO_DH) || defined(HAVE_ECC_ENCRYPT) || \
defined(HAVE_CURVE25519) || defined(HAVE_CURVE25519_SHARED_SECRET) || \ defined(HAVE_CURVE25519) || defined(HAVE_CURVE25519_SHARED_SECRET) || \
defined(HAVE_ED25519) || defined(HAVE_CURVE448) || \ defined(HAVE_ED25519) || defined(HAVE_CURVE448) || \
defined(HAVE_CURVE448_SHARED_SECRET) || defined(HAVE_ED448) defined(HAVE_CURVE448_SHARED_SECRET) || defined(HAVE_ED448)
#if defined(HAVE_ECC) || defined(WOLFSSL_PUBLIC_MP) || !defined(NO_DH) || \
(!defined(NO_RSA) && !defined(WOLFSSL_RSA_PUBLIC_ONLY))
static const char* bench_desc_words[][9] = { static const char* bench_desc_words[][9] = {
/* 0 1 2 3 4 5 6 7 8 */ /* 0 1 2 3 4 5 6 7 8 */
@@ -600,7 +598,6 @@ static const char* bench_desc_words[][9] = {
#endif #endif
}; };
#endif
#endif #endif
#if defined(__GNUC__) && defined(__x86_64__) && !defined(NO_ASM) && !defined(WOLFSSL_SGX) #if defined(__GNUC__) && defined(__x86_64__) && !defined(NO_ASM) && !defined(WOLFSSL_SGX)

View File

@@ -15958,8 +15958,9 @@ int DecodeECC_DSA_Sig_Bin(const byte* sig, word32 sigLen, byte* r, word32* rLen,
return ret; return ret;
} }
#endif
#if defined(HAVE_ECC) || !defined(NO_DSA)
int DecodeECC_DSA_Sig(const byte* sig, word32 sigLen, mp_int* r, mp_int* s) int DecodeECC_DSA_Sig(const byte* sig, word32 sigLen, mp_int* r, mp_int* s)
{ {
word32 idx = 0; word32 idx = 0;
@@ -15992,8 +15993,9 @@ int DecodeECC_DSA_Sig(const byte* sig, word32 sigLen, mp_int* r, mp_int* s)
return 0; return 0;
} }
#endif
#ifdef HAVE_ECC
int wc_EccPrivateKeyDecode(const byte* input, word32* inOutIdx, ecc_key* key, int wc_EccPrivateKeyDecode(const byte* input, word32* inOutIdx, ecc_key* key,
word32 inSz) word32 inSz)
{ {

View File

@@ -2220,7 +2220,7 @@ void sp_forcezero(sp_int* a)
#endif /* !WOLFSSL_RSA_VERIFY_ONLY || !NO_DH || HAVE_ECC */ #endif /* !WOLFSSL_RSA_VERIFY_ONLY || !NO_DH || HAVE_ECC */
#if defined(WOLSSL_SP_MATH_ALL) || !defined(NO_DH) || defined(HAVE_ECC) || \ #if defined(WOLSSL_SP_MATH_ALL) || !defined(NO_DH) || defined(HAVE_ECC) || \
!defined(NO_RSA) !defined(NO_RSA) || defined(WOLFSSL_KEY_GEN) || defined(HAVE_COMP_KEY)
/* Copy value of multi-precision number a into r. /* Copy value of multi-precision number a into r.
* *
* @param [in] a SP integer - source. * @param [in] a SP integer - source.

View File

@@ -682,7 +682,8 @@ struct SignatureCtx {
#if !(defined(NO_RSA) && defined(NO_DSA)) #if !(defined(NO_RSA) && defined(NO_DSA))
byte* sigCpy; byte* sigCpy;
#endif #endif
#if defined(HAVE_ECC) || defined(HAVE_ED25519) || defined(HAVE_ED448) || !defined(NO_DSA) #if defined(HAVE_ECC) || defined(HAVE_ED25519) || defined(HAVE_ED448) || \
!defined(NO_DSA)
int verify; int verify;
#endif #endif
union { union {
@@ -1209,11 +1210,13 @@ WOLFSSL_LOCAL int FlattenAltNames( byte*, word32, const DNS_entry*);
mp_int* s); mp_int* s);
WOLFSSL_LOCAL int StoreECC_DSA_Sig_Bin(byte* out, word32* outLen, WOLFSSL_LOCAL int StoreECC_DSA_Sig_Bin(byte* out, word32* outLen,
const byte* r, word32 rLen, const byte* s, word32 sLen); const byte* r, word32 rLen, const byte* s, word32 sLen);
WOLFSSL_LOCAL int DecodeECC_DSA_Sig(const byte* sig, word32 sigLen,
mp_int* r, mp_int* s);
WOLFSSL_LOCAL int DecodeECC_DSA_Sig_Bin(const byte* sig, word32 sigLen, WOLFSSL_LOCAL int DecodeECC_DSA_Sig_Bin(const byte* sig, word32 sigLen,
byte* r, word32* rLen, byte* s, word32* sLen); byte* r, word32* rLen, byte* s, word32* sLen);
#endif #endif
#if defined(HAVE_ECC) || !defined(NO_DSA)
WOLFSSL_LOCAL int DecodeECC_DSA_Sig(const byte* sig, word32 sigLen,
mp_int* r, mp_int* s);
#endif
#if defined HAVE_ECC && (defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)) #if defined HAVE_ECC && (defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL))
WOLFSSL_API int EccEnumToNID(int n); WOLFSSL_API int EccEnumToNID(int n);
#endif #endif