mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-03 20:54:41 +02:00
free decoded cert with small stack build
This commit is contained in:
@@ -8501,18 +8501,27 @@ int wc_SetAuthKeyIdFromCert(Cert *cert, const byte *der, int derSz)
|
|||||||
ret = ParseCert(decoded, CERT_TYPE, NO_VERIFY, 0);
|
ret = ParseCert(decoded, CERT_TYPE, NO_VERIFY, 0);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
FreeDecodedCert(decoded);
|
FreeDecodedCert(decoded);
|
||||||
|
#ifdef WOLFSSL_SMALL_STACK
|
||||||
|
XFREE(decoded, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Subject Key Id not found !! */
|
/* Subject Key Id not found !! */
|
||||||
if (decoded->extSubjKeyIdSet == 0) {
|
if (decoded->extSubjKeyIdSet == 0) {
|
||||||
FreeDecodedCert(decoded);
|
FreeDecodedCert(decoded);
|
||||||
|
#ifdef WOLFSSL_SMALL_STACK
|
||||||
|
XFREE(decoded, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
|
#endif
|
||||||
return ASN_NO_SKID;
|
return ASN_NO_SKID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SKID invalid size */
|
/* SKID invalid size */
|
||||||
if (sizeof(cert->akid) < sizeof(decoded->extSubjKeyId)) {
|
if (sizeof(cert->akid) < sizeof(decoded->extSubjKeyId)) {
|
||||||
FreeDecodedCert(decoded);
|
FreeDecodedCert(decoded);
|
||||||
|
#ifdef WOLFSSL_SMALL_STACK
|
||||||
|
XFREE(decoded, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
|
#endif
|
||||||
return MEMORY_E;
|
return MEMORY_E;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8521,6 +8530,10 @@ int wc_SetAuthKeyIdFromCert(Cert *cert, const byte *der, int derSz)
|
|||||||
cert->akidSz = KEYID_SIZE;
|
cert->akidSz = KEYID_SIZE;
|
||||||
|
|
||||||
FreeDecodedCert(decoded);
|
FreeDecodedCert(decoded);
|
||||||
|
#ifdef WOLFSSL_SMALL_STACK
|
||||||
|
XFREE(decoded, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user