Skip to content

Conversation

@ptsiewie
Copy link
Contributor

Description

This adds a callback for retrieving OCSP response issuer certificate data in case no such data is provided in the OCSP response's "certificate" extension. In our use case we have the OCSP response which is signed through an issuer chain, but that certificate is not included in the OCSP response certificate extension. This callback allows the OCSP response verification code to retrieve that certificate from the caller, after which the OCSP issuer verification can be performed.

Fixes zd#20415
Relates to zd#19571

Testing

How did you test?

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@devin-ai-integration
Copy link
Contributor

🛟 Devin Lifeguard found 1 likely issues in this PR

  • declare-const-pointers snippet: Declare the callback parameter as const to signal it is not modified: int wolfSSL_CertManagerSetOCSPResponseIssuer_Cb(WOLFSSL_CERT_MANAGER* cm, const CbOCSPRespCert respCertCb)

@ptsiewie
please take a look at the above issues which Devin flagged. Devin will not fix these issues automatically.

@wolfSSL-Bot
Copy link

Can one of the admins verify this patch?

@embhorn embhorn requested a review from rizlik August 20, 2025 11:59
@dgarske
Copy link
Contributor

dgarske commented Aug 20, 2025

Okay to test. Contributor agreement on file.

return ret;
}

WOLFSSL_API int wolfSSL_CertManagerSetOCSPResponseIssuer_Cb(WOLFSSL_CERT_MANAGER* cm,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the public API needs WOLFSSL_API.

GetASN_GetRef(&dataASN[OCSPBASICRESPASN_IDX_CERTS_SEQ], &resp->cert,
&resp->certSz);
}
/* If no certificate was read from the response data, but an response issuer certificate callback is available. */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add callback in the non ASN template case too... above. Test with --enable-asn=original.

int ret = 0;
word32 idx = *ioIndex;
Signer* ca = NULL;
CbOCSPRespCert ocspRespCertCb = (NULL != cm) ? ((WOLFSSL_CERT_MANAGER*)cm)->ocspRespCertCb: NULL;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix to 80 characters max:

src/ssl_certman.c:2487 WOLFSSL_API int wolfSSL_CertManagerSetOCSPResponseIssuer_Cb(WOLFSSL_CERT_MANAGER* cm,
wolfcrypt/src/asn.c:39517     CbOCSPRespCert ocspRespCertCb = (NULL != cm) ? ((WOLFSSL_CERT_MANAGER*)cm)->ocspRespCertCb: NULL;
wolfcrypt/src/asn.c:39566     /* If no certificate was read from the response data, but an response issuer certificate callback is available. */
wolfssl/internal.h:2699     CbOCSPRespCert  ocspRespCertCb;        /* Callback for OCSP response issuer certificate */
wolfssl/ssl.h:4268     WOLFSSL_API int wolfSSL_CertManagerSetOCSPResponseIssuer_Cb(WOLFSSL_CERT_MANAGER* cm,

WOLFSSL_CERT_MANAGER* cm, const char* url);
WOLFSSL_API int wolfSSL_CertManagerSetOCSP_Cb(WOLFSSL_CERT_MANAGER* cm,
CbOCSPIO ioCb, CbOCSPRespFree respFreeCb, void* ioCbCtx);
WOLFSSL_API int wolfSSL_CertManagerSetOCSPResponseIssuer_Cb(WOLFSSL_CERT_MANAGER* cm,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add test case in tests/api.c for new functionality. Thank you

@dgarske dgarske assigned ptsiewie and unassigned rizlik Aug 29, 2025
@julek-wolfssl
Copy link
Member

Closing in favor of #9144

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants