Skip to content

Commit

Permalink
Fixes for building with OCSP (like --enable-curl).
Browse files Browse the repository at this point in the history
  • Loading branch information
dgarske committed Jul 26, 2024
1 parent 5dd41b5 commit 0989f41
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
14 changes: 11 additions & 3 deletions src/ocsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -702,8 +702,10 @@ int wolfSSL_OCSP_resp_find_status(WOLFSSL_OCSP_BASICRESP *bs,
if (nextupd != NULL)
*nextupd = &single->status->nextDateParsed;
#else
(void)thisupd;
(void)nextupd;
if (thisupd != NULL)
*thisupd = NULL;
if (nextupd != NULL)
*nextupd = NULL;
#endif

/* TODO: Not needed for Nginx or httpd */
Expand Down Expand Up @@ -1348,11 +1350,17 @@ int wolfSSL_OCSP_single_get0_status(WOLFSSL_OCSP_SINGLERESP *single,
if (single == NULL)
return WOLFSSL_FAILURE;

#ifdef WOLFSSL_OCSP_PARSE_STATUS
if (thisupd != NULL)
*thisupd = &single->status->thisDateParsed;
if (nextupd != NULL)
*nextupd = &single->status->nextDateParsed;

#else
if (thisupd != NULL)
*thisupd = NULL;
if (nextupd != NULL)
*nextupd = NULL;
#endif
if (reason != NULL)
*reason = 0;
if (revtime != NULL)
Expand Down
4 changes: 2 additions & 2 deletions wolfcrypt/src/asn.c
Original file line number Diff line number Diff line change
Expand Up @@ -20420,7 +20420,7 @@ static int DecodeNameConstraints(const byte* input, word32 sz,
}
#endif /* IGNORE_NAME_CONSTRAINTS */

#ifdef WOLFSSL_CERT_EXT
#if defined(WOLFSSL_CERT_EXT) || (defined(HAVE_OCSP) && defined(OPENSSL_EXTRA))

/* Decode ITU-T X.690 OID format to a string representation
* return string length */
Expand Down Expand Up @@ -20472,7 +20472,7 @@ int DecodePolicyOID(char *out, word32 outSz, const byte *in, word32 inSz)
exit:
return w;
}
#endif /* WOLFSSL_CERT_EXT */
#endif /* WOLFSSL_CERT_EXT || (HAVE_OCSP && OPENSSL_EXTRA) */

#if defined(WOLFSSL_SEP) || defined(WOLFSSL_CERT_EXT)
#ifdef WOLFSSL_ASN_TEMPLATE
Expand Down
16 changes: 6 additions & 10 deletions wolfssl/ocsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,11 @@ WOLFSSL_LOCAL int CheckOcspResponse(WOLFSSL_OCSP *ocsp, byte *response, int resp
WOLFSSL_LOCAL int CheckOcspResponder(OcspResponse *bs, DecodedCert *cert,
void* vp);

#if defined(OPENSSL_ALL) || defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY) || \
defined(WOLFSSL_APACHE_HTTPD) || defined(HAVE_LIGHTY)

WOLFSSL_API int wolfSSL_OCSP_resp_find_status(WOLFSSL_OCSP_BASICRESP *bs,
WOLFSSL_OCSP_CERTID *id, int *status, int *reason,
WOLFSSL_ASN1_TIME **revtime, WOLFSSL_ASN1_TIME **thisupd,
WOLFSSL_ASN1_TIME **nextupd);
#ifdef OPENSSL_EXTRA
WOLFSSL_API int wolfSSL_OCSP_resp_find_status(WOLFSSL_OCSP_BASICRESP *bs,
WOLFSSL_OCSP_CERTID *id, int *status, int *reason,
WOLFSSL_ASN1_TIME **revtime, WOLFSSL_ASN1_TIME **thisupd,
WOLFSSL_ASN1_TIME **nextupd);
WOLFSSL_API const char *wolfSSL_OCSP_cert_status_str(long s);
WOLFSSL_API int wolfSSL_OCSP_check_validity(WOLFSSL_ASN1_TIME* thisupd,
WOLFSSL_ASN1_TIME* nextupd, long sec, long maxsec);
Expand Down Expand Up @@ -132,8 +130,6 @@ WOLFSSL_API int wolfSSL_OCSP_resp_count(WOLFSSL_OCSP_BASICRESP *bs);
WOLFSSL_API WOLFSSL_OCSP_SINGLERESP* wolfSSL_OCSP_resp_get0(
WOLFSSL_OCSP_BASICRESP *bs, int idx);

#endif
#ifdef OPENSSL_EXTRA
WOLFSSL_API int wolfSSL_OCSP_REQUEST_add_ext(OcspRequest* req,
WOLFSSL_X509_EXTENSION* ext, int idx);
WOLFSSL_API OcspResponse* wolfSSL_OCSP_response_create(int status,
Expand All @@ -148,7 +144,7 @@ WOLFSSL_API int wolfSSL_OCSP_request_add1_nonce(OcspRequest* req,
unsigned char* val, int sz);
WOLFSSL_API int wolfSSL_OCSP_check_nonce(OcspRequest* req,
WOLFSSL_OCSP_BASICRESP* bs);
#endif
#endif /* OPENSSL_EXTRA */


#ifdef __cplusplus
Expand Down

0 comments on commit 0989f41

Please sign in to comment.