From 111feedadc6c362f6248a143edfa42dc20e424e9 Mon Sep 17 00:00:00 2001 From: David Garske Date: Tue, 10 Jun 2025 14:57:25 -0700 Subject: [PATCH] Add build guards on the crypto callback ECC items. --- wolfcrypt/src/cryptocb.c | 8 ++++++++ wolfssl/wolfcrypt/cryptocb.h | 10 +++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/wolfcrypt/src/cryptocb.c b/wolfcrypt/src/cryptocb.c index a83e529f9..7476245f9 100644 --- a/wolfcrypt/src/cryptocb.c +++ b/wolfcrypt/src/cryptocb.c @@ -577,6 +577,7 @@ int wc_CryptoCb_RsaGetSize(const RsaKey* key, int* keySize) #endif /* !NO_RSA */ #ifdef HAVE_ECC +#ifdef HAVE_ECC_DHE int wc_CryptoCb_MakeEccKey(WC_RNG* rng, int keySize, ecc_key* key, int curveId) { int ret = WC_NO_ERR_TRACE(CRYPTOCB_UNAVAILABLE); @@ -629,7 +630,9 @@ int wc_CryptoCb_Ecdh(ecc_key* private_key, ecc_key* public_key, return wc_CryptoCb_TranslateErrorCode(ret); } +#endif +#ifdef HAVE_ECC_SIGN int wc_CryptoCb_EccSign(const byte* in, word32 inlen, byte* out, word32 *outlen, WC_RNG* rng, ecc_key* key) { @@ -658,7 +661,9 @@ int wc_CryptoCb_EccSign(const byte* in, word32 inlen, byte* out, return wc_CryptoCb_TranslateErrorCode(ret); } +#endif +#ifdef HAVE_ECC_VERIFY int wc_CryptoCb_EccVerify(const byte* sig, word32 siglen, const byte* hash, word32 hashlen, int* res, ecc_key* key) { @@ -687,7 +692,9 @@ int wc_CryptoCb_EccVerify(const byte* sig, word32 siglen, return wc_CryptoCb_TranslateErrorCode(ret); } +#endif +#ifdef HAVE_ECC_CHECK_KEY int wc_CryptoCb_EccCheckPrivKey(ecc_key* key, const byte* pubKey, word32 pubKeySz) { @@ -713,6 +720,7 @@ int wc_CryptoCb_EccCheckPrivKey(ecc_key* key, const byte* pubKey, return wc_CryptoCb_TranslateErrorCode(ret); } +#endif #endif /* HAVE_ECC */ #ifdef HAVE_CURVE25519 diff --git a/wolfssl/wolfcrypt/cryptocb.h b/wolfssl/wolfcrypt/cryptocb.h index 9bcb35900..8db23f407 100644 --- a/wolfssl/wolfcrypt/cryptocb.h +++ b/wolfssl/wolfcrypt/cryptocb.h @@ -176,6 +176,7 @@ typedef struct wc_CryptoInfo { } rsa_get_size; #endif #ifdef HAVE_ECC + #ifdef HAVE_ECC_DHE struct { WC_RNG* rng; int size; @@ -188,6 +189,8 @@ typedef struct wc_CryptoInfo { byte* out; word32* outlen; } ecdh; + #endif + #ifdef HAVE_ECC_SIGN struct { const byte* in; word32 inlen; @@ -196,6 +199,8 @@ typedef struct wc_CryptoInfo { WC_RNG* rng; ecc_key* key; } eccsign; + #endif + #ifdef HAVE_ECC_VERIFY struct { const byte* sig; word32 siglen; @@ -204,12 +209,15 @@ typedef struct wc_CryptoInfo { int* res; ecc_key* key; } eccverify; + #endif + #ifdef HAVE_ECC_CHECK_KEY struct { ecc_key* key; const byte* pubKey; word32 pubKeySz; } ecc_check; - #endif + #endif + #endif /* HAVE_ECC */ #ifdef HAVE_CURVE25519 struct { WC_RNG* rng;