Skip to content

Commit 111feed

Browse files
committed
Add build guards on the crypto callback ECC items.
1 parent c7f6673 commit 111feed

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

wolfcrypt/src/cryptocb.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,7 @@ int wc_CryptoCb_RsaGetSize(const RsaKey* key, int* keySize)
577577
#endif /* !NO_RSA */
578578

579579
#ifdef HAVE_ECC
580+
#ifdef HAVE_ECC_DHE
580581
int wc_CryptoCb_MakeEccKey(WC_RNG* rng, int keySize, ecc_key* key, int curveId)
581582
{
582583
int ret = WC_NO_ERR_TRACE(CRYPTOCB_UNAVAILABLE);
@@ -629,7 +630,9 @@ int wc_CryptoCb_Ecdh(ecc_key* private_key, ecc_key* public_key,
629630

630631
return wc_CryptoCb_TranslateErrorCode(ret);
631632
}
633+
#endif
632634

635+
#ifdef HAVE_ECC_SIGN
633636
int wc_CryptoCb_EccSign(const byte* in, word32 inlen, byte* out,
634637
word32 *outlen, WC_RNG* rng, ecc_key* key)
635638
{
@@ -658,7 +661,9 @@ int wc_CryptoCb_EccSign(const byte* in, word32 inlen, byte* out,
658661

659662
return wc_CryptoCb_TranslateErrorCode(ret);
660663
}
664+
#endif
661665

666+
#ifdef HAVE_ECC_VERIFY
662667
int wc_CryptoCb_EccVerify(const byte* sig, word32 siglen,
663668
const byte* hash, word32 hashlen, int* res, ecc_key* key)
664669
{
@@ -687,7 +692,9 @@ int wc_CryptoCb_EccVerify(const byte* sig, word32 siglen,
687692

688693
return wc_CryptoCb_TranslateErrorCode(ret);
689694
}
695+
#endif
690696

697+
#ifdef HAVE_ECC_CHECK_KEY
691698
int wc_CryptoCb_EccCheckPrivKey(ecc_key* key, const byte* pubKey,
692699
word32 pubKeySz)
693700
{
@@ -713,6 +720,7 @@ int wc_CryptoCb_EccCheckPrivKey(ecc_key* key, const byte* pubKey,
713720

714721
return wc_CryptoCb_TranslateErrorCode(ret);
715722
}
723+
#endif
716724
#endif /* HAVE_ECC */
717725

718726
#ifdef HAVE_CURVE25519

wolfssl/wolfcrypt/cryptocb.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ typedef struct wc_CryptoInfo {
176176
} rsa_get_size;
177177
#endif
178178
#ifdef HAVE_ECC
179+
#ifdef HAVE_ECC_DHE
179180
struct {
180181
WC_RNG* rng;
181182
int size;
@@ -188,6 +189,8 @@ typedef struct wc_CryptoInfo {
188189
byte* out;
189190
word32* outlen;
190191
} ecdh;
192+
#endif
193+
#ifdef HAVE_ECC_SIGN
191194
struct {
192195
const byte* in;
193196
word32 inlen;
@@ -196,6 +199,8 @@ typedef struct wc_CryptoInfo {
196199
WC_RNG* rng;
197200
ecc_key* key;
198201
} eccsign;
202+
#endif
203+
#ifdef HAVE_ECC_VERIFY
199204
struct {
200205
const byte* sig;
201206
word32 siglen;
@@ -204,12 +209,15 @@ typedef struct wc_CryptoInfo {
204209
int* res;
205210
ecc_key* key;
206211
} eccverify;
212+
#endif
213+
#ifdef HAVE_ECC_CHECK_KEY
207214
struct {
208215
ecc_key* key;
209216
const byte* pubKey;
210217
word32 pubKeySz;
211218
} ecc_check;
212-
#endif
219+
#endif
220+
#endif /* HAVE_ECC */
213221
#ifdef HAVE_CURVE25519
214222
struct {
215223
WC_RNG* rng;

0 commit comments

Comments
 (0)