Add build guards on the crypto callback ECC items.

pull/8854/head
David Garske 2025-06-10 14:57:25 -07:00
parent c7f6673e53
commit 111feedadc
2 changed files with 17 additions and 1 deletions

View File

@ -577,6 +577,7 @@ int wc_CryptoCb_RsaGetSize(const RsaKey* key, int* keySize)
#endif /* !NO_RSA */ #endif /* !NO_RSA */
#ifdef HAVE_ECC #ifdef HAVE_ECC
#ifdef HAVE_ECC_DHE
int wc_CryptoCb_MakeEccKey(WC_RNG* rng, int keySize, ecc_key* key, int curveId) int wc_CryptoCb_MakeEccKey(WC_RNG* rng, int keySize, ecc_key* key, int curveId)
{ {
int ret = WC_NO_ERR_TRACE(CRYPTOCB_UNAVAILABLE); 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); return wc_CryptoCb_TranslateErrorCode(ret);
} }
#endif
#ifdef HAVE_ECC_SIGN
int wc_CryptoCb_EccSign(const byte* in, word32 inlen, byte* out, int wc_CryptoCb_EccSign(const byte* in, word32 inlen, byte* out,
word32 *outlen, WC_RNG* rng, ecc_key* key) 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); return wc_CryptoCb_TranslateErrorCode(ret);
} }
#endif
#ifdef HAVE_ECC_VERIFY
int wc_CryptoCb_EccVerify(const byte* sig, word32 siglen, int wc_CryptoCb_EccVerify(const byte* sig, word32 siglen,
const byte* hash, word32 hashlen, int* res, ecc_key* key) 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); return wc_CryptoCb_TranslateErrorCode(ret);
} }
#endif
#ifdef HAVE_ECC_CHECK_KEY
int wc_CryptoCb_EccCheckPrivKey(ecc_key* key, const byte* pubKey, int wc_CryptoCb_EccCheckPrivKey(ecc_key* key, const byte* pubKey,
word32 pubKeySz) word32 pubKeySz)
{ {
@ -713,6 +720,7 @@ int wc_CryptoCb_EccCheckPrivKey(ecc_key* key, const byte* pubKey,
return wc_CryptoCb_TranslateErrorCode(ret); return wc_CryptoCb_TranslateErrorCode(ret);
} }
#endif
#endif /* HAVE_ECC */ #endif /* HAVE_ECC */
#ifdef HAVE_CURVE25519 #ifdef HAVE_CURVE25519

View File

@ -176,6 +176,7 @@ typedef struct wc_CryptoInfo {
} rsa_get_size; } rsa_get_size;
#endif #endif
#ifdef HAVE_ECC #ifdef HAVE_ECC
#ifdef HAVE_ECC_DHE
struct { struct {
WC_RNG* rng; WC_RNG* rng;
int size; int size;
@ -188,6 +189,8 @@ typedef struct wc_CryptoInfo {
byte* out; byte* out;
word32* outlen; word32* outlen;
} ecdh; } ecdh;
#endif
#ifdef HAVE_ECC_SIGN
struct { struct {
const byte* in; const byte* in;
word32 inlen; word32 inlen;
@ -196,6 +199,8 @@ typedef struct wc_CryptoInfo {
WC_RNG* rng; WC_RNG* rng;
ecc_key* key; ecc_key* key;
} eccsign; } eccsign;
#endif
#ifdef HAVE_ECC_VERIFY
struct { struct {
const byte* sig; const byte* sig;
word32 siglen; word32 siglen;
@ -204,12 +209,15 @@ typedef struct wc_CryptoInfo {
int* res; int* res;
ecc_key* key; ecc_key* key;
} eccverify; } eccverify;
#endif
#ifdef HAVE_ECC_CHECK_KEY
struct { struct {
ecc_key* key; ecc_key* key;
const byte* pubKey; const byte* pubKey;
word32 pubKeySz; word32 pubKeySz;
} ecc_check; } ecc_check;
#endif #endif
#endif /* HAVE_ECC */
#ifdef HAVE_CURVE25519 #ifdef HAVE_CURVE25519
struct { struct {
WC_RNG* rng; WC_RNG* rng;