Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion examples/ocsp_responder/ocsp_responder.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,16 @@ static int LoadFile(const char* filename, byte** buf, word32* bufSz, int* isPem)

/* Check if PEM format by looking for -----BEGIN */
if (isPem) {
/* Reallocate with space for null terminator for XSTRSTR */
byte* tmp = (byte*)XREALLOC(*buf, (word32)sz + 1, NULL,
DYNAMIC_TYPE_TMP_BUFFER);
if (tmp == NULL) {
XFREE(*buf, NULL, DYNAMIC_TYPE_TMP_BUFFER);
*buf = NULL;
return MEMORY_E;
}
*buf = tmp;
(*buf)[sz] = '\0';
*isPem = (XSTRSTR((char*)*buf, "-----BEGIN") != NULL) ? 1 : 0;
}

Expand Down Expand Up @@ -749,6 +759,9 @@ THREAD_RETURN WOLFSSL_THREAD ocsp_responder_test(void* args)
opts.sendCerts = 1;
opts.readyFile = NULL;

/* Initialize caCert */
XMEMSET(&caCert, 0, sizeof(caCert));

/* Parse command line arguments */
while ((ch = mygetopt_long(argc, argv, "?p:c:r:k:i:R:n:vx",
long_options, 0)) != -1) {
Expand Down Expand Up @@ -848,7 +861,6 @@ THREAD_RETURN WOLFSSL_THREAD ocsp_responder_test(void* args)
}

/* Parse CA certificate to get subject */
XMEMSET(&caCert, 0, sizeof(caCert));
wc_InitDecodedCert(&caCert, caCertDer, caCertDerSz, NULL);
ret = wc_ParseCert(&caCert, CERT_TYPE, 0, NULL);
if (ret != 0) {
Expand Down
1 change: 0 additions & 1 deletion src/ssl_api_pk.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ static int check_cert_key(const DerBuffer* cert, const DerBuffer* key,
InitDecodedCert_ex(der, cert->buffer, cert->length, heap, devId);
/* Parse certificate. */
if (ParseCertRelative(der, CERT_TYPE, NO_VERIFY, NULL, NULL) != 0) {
WC_FREE_VAR_EX(der, heap, DYNAMIC_TYPE_DCERT);
ret = 0;
}
}
Expand Down
3 changes: 3 additions & 0 deletions wolfcrypt/src/asn.c
Original file line number Diff line number Diff line change
Expand Up @@ -18027,10 +18027,13 @@ static word32 SetAlgoIDImpl(int algoOID, byte* output, int type, int curveSz,
word32 algoSz = 0;

CALLOC_ASNSETDATA(dataASN, algoIdASN_Length, ret, NULL);

#ifdef WOLFSSL_SMALL_STACK
if(ret < 0) {
/* Catch MEMORY_E */
return 0;
}
#endif

algoName = OidFromId((word32)algoOID, (word32)type, &algoSz);
if (algoName == NULL) {
Expand Down
Loading