added support for OCSP multistapling#19183
Conversation
| int i = 0, last = 0, ok = 0; | ||
|
|
||
| if ((ctx->param->flags & X509_V_FLAG_CRL_CHECK) == 0) | ||
| if (!(ctx->param->flags & X509_V_FLAG_CRL_CHECK) |
There was a problem hiding this comment.
nit: explicit test against 0 : if ((ctx->param->flags & X509_V_FLAG_CRL_CHECK) == 0)
| && !(ctx->param->flags & X509_V_FLAG_OCSP_CHECK)) | ||
| return 1; | ||
| if ((ctx->param->flags & X509_V_FLAG_CRL_CHECK_ALL) != 0) { | ||
| if (ctx->param->flags & X509_V_FLAG_CRL_CHECK_ALL |
There was a problem hiding this comment.
You may combine the flags test : if (ctx->param->flags & (X509_V_FLAG_CRL_CHECK_ALL|X509_V_FLAG_OCSP_CHECK_ALL)) != 0)
| if (ok == V_OCSP_CERTSTATUS_GOOD) | ||
| continue; | ||
|
|
||
| if (!(ctx->param->flags & X509_V_FLAG_CRL_CHECK)) { |
There was a problem hiding this comment.
nit: explicit flag test against 0
| X509_get_issuer_name(x)); | ||
|
|
||
|
|
||
| if(ctx->ocsp_resp == NULL || sk_OCSP_RESPONSE_num(ctx->ocsp_resp) == 0) { |
|
|
||
| cert_id = OCSP_cert_to_id(NULL, ctx->current_cert, ctx->current_issuer); | ||
|
|
||
| for (i=0; i<sk_OCSP_RESPONSE_num(ctx->ocsp_resp); i++) { |
There was a problem hiding this comment.
style nit : spaces around operators : for ( i = 0; i < sk_...
| SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_R_LENGTH_MISMATCH); | ||
| return 0; | ||
| if (SSL_CONNECTION_IS_TLS13(s) || type == TLSEXT_STATUSTYPE_ocsp) { | ||
| if(PACKET_remaining(pkt) > 0) { |
| if (resplen > 0) { | ||
| respder = OPENSSL_malloc(resplen); | ||
| if (!PACKET_copy_bytes(pkt, respder, resplen)) { | ||
| SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_R_LENGTH_MISMATCH); |
There was a problem hiding this comment.
indentation is off by 4 space here
There was a problem hiding this comment.
you are leaking respder on both return 0
| p = respder; | ||
| resp = d2i_OCSP_RESPONSE(NULL, &p, resplen); | ||
| if (resp == NULL) { | ||
|
|
|
|
||
| /* In TLSv1.3 the caller gives the index of the certificate for which the | ||
| * status message should be created. | ||
| * Prior to TLSv1.3 the chain index is 0 and the body should only the status |
There was a problem hiding this comment.
and the body should only the
Missing word ?
| * if chainidx > 0 an intermediate certificate is request | ||
| */ | ||
| if((int)chainidx < sk_X509_num(server_certs)+1 && chainidx > 0) { | ||
| x = sk_X509_value(server_certs, chainidx-1); |
There was a problem hiding this comment.
nit: space around operators : chainidx - 1
|
Need a bit of tidy up. |
FdaSilvaYY
left a comment
There was a problem hiding this comment.
Reading a bit more, I see that theses changes need more work to be finished.
| STACK_OF(OCSP_RESPONSE) *sk_resp = NULL; | ||
| OCSP_RESPONSE *rsp; | ||
| len = SSL_get_tlsext_status_ocsp_resp(s, &p); | ||
| SSL_get_tlsext_status_ocsp_resp(s, &sk_resp); |
There was a problem hiding this comment.
Where have you change the SSL_get_tlsext_status_ocsp_resp method signature ?
SSL_get_tlsext_status_ocsp_resp is a macro around a SSL_CRTL command.
You can't change existing API .
You should keep it untouched, and add new methods for your purpose.
| OPENSSL_free(sc->ext.ocsp.resp); | ||
| sc->ext.ocsp.resp = parg; | ||
| sc->ext.ocsp.resp_len = larg; | ||
| sc->ext.ocsp.resp = (STACK_OF(OCSP_RESPONSE) *)parg; |
There was a problem hiding this comment.
you should keep freeing the existing extensions sc->ext.ocsp.resp
| || sc->ext.ocsp.resp_len > LONG_MAX) | ||
| return -1; | ||
| return (long)sc->ext.ocsp.resp_len; | ||
| *(STACK_OF(OCSP_RESPONSE) **)parg = sc->ext.ocsp.resp; |
There was a problem hiding this comment.
You can't change the code behind a SSL_CTRL like this.
It will break any existing code calling it.
This probably breaks some test code.
|
Closed and re-open to remove the “CLA missing” tag |
|
You've submitted the patch with a different e-mail address than that of your ICLA. Would you please amend the commit and force push? |
|
This PR has the label 'hold: cla required' and is stale: it has not been updated in 30 days. Note that this PR may be automatically closed in the future if no CLA is provided. For CLA help see https://www.openssl.org/policies/cla.html |
|
Hello!
I have already submitted the CLA a few weeks ago. How can I remove this label?
Regards
Michael Krüger
… Am 13.10.2022 um 02:09 schrieb openssl-machine ***@***.***>:
This PR has the label 'hold: cla required' and is stale: it has not been updated in 30 days. Note that this PR may be automatically closed in the future if no CLA is provided. For CLA help see https://www.openssl.org/policies/cla.html <https://www.openssl.org/policies/cla.html>
—
Reply to this email directly, view it on GitHub <#19183 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AL6KEQSOVIUZE7Q4YDGQKATWC5HKDANCNFSM6AAAAAAQIWK3HA>.
You are receiving this because you modified the open/close state.
|
You should close and reopen your PR, to get the bot run again |
Please rebase the pull request against fresh master branch. Also amend the e-mail address so it is the same as on your CLA submission. |
|
This PR has the label 'hold: cla required' and is stale: it has not been updated in 30 days. Note that this PR may be automatically closed in the future if no CLA is provided. For CLA help see https://www.openssl.org/policies/cla.html |
|
This PR has the label 'hold: cla required' and is stale: it has not been updated in 61 days. Note that this PR may be automatically closed in the future if no CLA is provided. For CLA help see https://www.openssl.org/policies/cla.html |
|
This PR has been closed. It was waiting for a CLA for 90 days. |
OCSP multistapling for TLSv1.3:
changed resp variable in the the ssl_struct from one DER encoded OCSP response to a stack of responses
server side: added function in s_server code for retrieving the OCSP responses from all certificates in the server cert chain
server side: added function in statem_srvr code to retrieve and return the response for the requested certificate
client side: added verify function for multiple OCSP responses
Checklist