mirror of https://github.com/wolfSSL/wolfssl
Fix build issue with ASN enabled and no HMAC (missing MAX_DIGEST_SIZE). Switch to using WC_MAX_DIGEST_SIZE from hash.h, which is always available. Added small stack option for digest in MakeSignature. Fixed build error with unused "testVerifyCount" if "NO_ECC_SIGN" or "NO_ECC_VERIFY".
This commit is contained in:
parent
67d607324a
commit
a17bc2a42e
|
@ -3573,11 +3573,11 @@ static int ConfirmSignature(const byte* buf, word32 bufSz,
|
|||
#ifdef WOLFSSL_SMALL_STACK
|
||||
byte* digest;
|
||||
#else
|
||||
byte digest[MAX_DIGEST_SIZE];
|
||||
byte digest[WC_MAX_DIGEST_SIZE];
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
digest = (byte*)XMALLOC(MAX_DIGEST_SIZE, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
digest = (byte*)XMALLOC(WC_MAX_DIGEST_SIZE, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (digest == NULL)
|
||||
return 0; /* not confirmed */
|
||||
#endif
|
||||
|
@ -7227,7 +7227,11 @@ static int MakeSignature(const byte* buffer, int sz, byte* sig, int sigSz,
|
|||
int sigAlgoType)
|
||||
{
|
||||
int encSigSz, digestSz, typeH = 0, ret = 0;
|
||||
byte digest[MAX_DIGEST_SIZE]; /* max size */
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
byte* digest;
|
||||
#else
|
||||
byte digest[WC_MAX_DIGEST_SIZE]; /* max size */
|
||||
#endif
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
byte* encSig;
|
||||
#else
|
||||
|
@ -7248,6 +7252,12 @@ static int MakeSignature(const byte* buffer, int sz, byte* sig, int sigSz,
|
|||
(void)eccKey;
|
||||
(void)rng;
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
digest = (byte*)XMALLOC(WC_MAX_DIGEST_SIZE, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (digest == NULL)
|
||||
return 0; /* not confirmed */
|
||||
#endif
|
||||
|
||||
switch (sigAlgoType) {
|
||||
#ifndef NO_MD5
|
||||
case CTC_MD5wRSA:
|
||||
|
@ -7289,14 +7299,20 @@ static int MakeSignature(const byte* buffer, int sz, byte* sig, int sigSz,
|
|||
ret = ALGO_ID_E;
|
||||
}
|
||||
|
||||
if (ret != 0)
|
||||
if (ret != 0) {
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(digest, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
encSig = (byte*)XMALLOC(MAX_DER_DIGEST_SZ,
|
||||
NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (encSig == NULL)
|
||||
if (encSig == NULL) {
|
||||
XFREE(digest, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
return MEMORY_E;
|
||||
}
|
||||
#endif
|
||||
|
||||
ret = ALGO_ID_E;
|
||||
|
@ -7320,6 +7336,7 @@ static int MakeSignature(const byte* buffer, int sz, byte* sig, int sigSz,
|
|||
#endif
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(digest, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(encSig, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -6842,6 +6842,8 @@ static int ecc_test_curve_size(WC_RNG* rng, int keySize, int testVerifyCount,
|
|||
int ret;
|
||||
ecc_key userA, userB, pubKey;
|
||||
|
||||
(void)testVerifyCount;
|
||||
|
||||
wc_ecc_init(&userA);
|
||||
wc_ecc_init(&userB);
|
||||
wc_ecc_init(&pubKey);
|
||||
|
|
Loading…
Reference in New Issue