Skip to content

Commit

Permalink
Better guarding.
Browse files Browse the repository at this point in the history
  • Loading branch information
anhu committed Jul 10, 2024
1 parent 6456281 commit fe2a826
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion wolfcrypt/src/pkcs7.c
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,10 @@ int wc_PKCS7_Init(PKCS7* pkcs7, void* heap, int devId)
return 0;
}

#if defined(WOLFSSL_CUSTOM_OID)
xxx
#endif

#if defined(WOLFSSL_CUSTOM_OID) && defined(WOLFSSL_ASN_TEMPLATE) \
&& defined(HAVE_OID_DECODING)
void wc_PKCS7_SetUnknownExtCallback(PKCS7* pkcs7, wc_UnknownExtCallback cb)
Expand Down Expand Up @@ -1083,7 +1087,10 @@ int wc_PKCS7_InitWithCert(PKCS7* pkcs7, byte* derCert, word32 derCertSz)
int devId;
Pkcs7Cert* cert;
Pkcs7Cert* lastCert;
#if defined(WOLFSSL_CUSTOM_OID) && defined(WOLFSSL_ASN_TEMPLATE) \
&& defined(HAVE_OID_DECODING)
wc_UnknownExtCallback cb;
#endif

if (pkcs7 == NULL || (derCert == NULL && derCertSz != 0)) {
return BAD_FUNC_ARG;
Expand All @@ -1092,13 +1099,18 @@ int wc_PKCS7_InitWithCert(PKCS7* pkcs7, byte* derCert, word32 derCertSz)
heap = pkcs7->heap;
devId = pkcs7->devId;
cert = pkcs7->certList;
#if defined(WOLFSSL_CUSTOM_OID) && defined(WOLFSSL_ASN_TEMPLATE) \
&& defined(HAVE_OID_DECODING)
cb = pkcs7->unknownExtCallback;

#endif
ret = wc_PKCS7_Init(pkcs7, heap, devId);
if (ret != 0)
return ret;

#if defined(WOLFSSL_CUSTOM_OID) && defined(WOLFSSL_ASN_TEMPLATE) \
&& defined(HAVE_OID_DECODING)
pkcs7->unknownExtCallback = cb;
#endif
pkcs7->certList = cert;

if (derCert != NULL && derCertSz > 0) {
Expand Down

0 comments on commit fe2a826

Please sign in to comment.