Merge pull request #7246 from kareem-wolfssl/zd17176

Only include CRL monitor definitions when building with HAVE_CRL_MONITOR.
This commit is contained in:
David Garske
2024-02-14 13:45:23 -08:00
committed by GitHub
2 changed files with 8 additions and 2 deletions

View File

@ -69,9 +69,9 @@ int InitCRL(WOLFSSL_CRL* crl, WOLFSSL_CERT_MANAGER* cm)
crl->cm = cm;
crl->crlList = NULL;
crl->currentEntry = NULL;
#ifdef HAVE_CRL_MONITOR
crl->monitors[0].path = NULL;
crl->monitors[1].path = NULL;
#ifdef HAVE_CRL_MONITOR
crl->tid = INVALID_THREAD_VAL;
crl->mfd = WOLFSSL_CRL_MFD_INIT_VAL;
crl->setup = 0; /* thread setup done predicate */
@ -249,11 +249,13 @@ void FreeCRL(WOLFSSL_CRL* crl, int dynamic)
tmp = crl->crlList;
WOLFSSL_ENTER("FreeCRL");
#ifdef HAVE_CRL_MONITOR
if (crl->monitors[0].path)
XFREE(crl->monitors[0].path, crl->heap, DYNAMIC_TYPE_CRL_MONITOR);
if (crl->monitors[1].path)
XFREE(crl->monitors[1].path, crl->heap, DYNAMIC_TYPE_CRL_MONITOR);
#endif
XFREE(crl->currentEntry, crl->heap, DYNAMIC_TYPE_CRL_ENTRY);
crl->currentEntry = NULL;
@ -840,6 +842,7 @@ static int DupX509_CRL(WOLFSSL_X509_CRL *dupl, const WOLFSSL_X509_CRL* crl)
return BAD_FUNC_ARG;
}
#ifdef HAVE_CRL_MONITOR
if (crl->monitors[0].path) {
int pathSz = (int)XSTRLEN(crl->monitors[0].path) + 1;
dupl->monitors[0].path = (char*)XMALLOC(pathSz, dupl->heap,
@ -867,6 +870,7 @@ static int DupX509_CRL(WOLFSSL_X509_CRL *dupl, const WOLFSSL_X509_CRL* crl)
return MEMORY_E;
}
}
#endif
dupl->crlList = DupCRL_list(crl->crlList, dupl->heap);
#ifdef HAVE_CRL_IO

View File

@ -2519,6 +2519,7 @@ struct CRL_Entry {
};
#ifdef HAVE_CRL_MONITOR
typedef struct CRL_Monitor CRL_Monitor;
/* CRL directory monitor */
@ -2544,6 +2545,7 @@ typedef HANDLE wolfSSL_CRL_mfd_t; /* monitor fd, INVALID_HANDLE_VALUE if
* no init yet */
#define WOLFSSL_CRL_MFD_INIT_VAL (INVALID_HANDLE_VALUE)
#endif
#endif
/* wolfSSL CRL controller */
struct WOLFSSL_CRL {
@ -2554,8 +2556,8 @@ struct WOLFSSL_CRL {
CbCrlIO crlIOCb;
#endif
wolfSSL_RwLock crlLock; /* CRL list lock */
CRL_Monitor monitors[WOLFSSL_CRL_MONITORS_LEN];
#ifdef HAVE_CRL_MONITOR
CRL_Monitor monitors[WOLFSSL_CRL_MONITORS_LEN];
COND_TYPE cond; /* condition to signal setup */
THREAD_TYPE tid; /* monitoring thread */
wolfSSL_CRL_mfd_t mfd;