Skip to content

Comments

added support for OCSP multistapling#19183

Closed
mikrue wants to merge 1 commit intoopenssl:masterfrom
mikrue:master
Closed

added support for OCSP multistapling#19183
mikrue wants to merge 1 commit intoopenssl:masterfrom
mikrue:master

Conversation

@mikrue
Copy link

@mikrue mikrue commented Sep 9, 2022

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
  • documentation is added or updated
  • tests are added or updated

@openssl-machine openssl-machine added the hold: cla required The contributor needs to submit a license agreement label Sep 9, 2022
Copy link
Contributor

@FdaSilvaYY FdaSilvaYY left a comment

Choose a reason for hiding this comment

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

nice feature !

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)
Copy link
Contributor

Choose a reason for hiding this comment

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

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
Copy link
Contributor

@FdaSilvaYY FdaSilvaYY Sep 9, 2022

Choose a reason for hiding this comment

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

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)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: explicit flag test against 0

X509_get_issuer_name(x));


if(ctx->ocsp_resp == NULL || sk_OCSP_RESPONSE_num(ctx->ocsp_resp) == 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

style nit: if (...


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++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

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) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit : if ( ...

if (resplen > 0) {
respder = OPENSSL_malloc(resplen);
if (!PACKET_copy_bytes(pkt, respder, resplen)) {
SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_R_LENGTH_MISMATCH);
Copy link
Contributor

Choose a reason for hiding this comment

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

indentation is off by 4 space here

Copy link
Contributor

Choose a reason for hiding this comment

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

you are leaking respder on both return 0

p = respder;
resp = d2i_OCSP_RESPONSE(NULL, &p, resplen);
if (resp == NULL) {

Copy link
Contributor

Choose a reason for hiding this comment

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

useless blank line


/* 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
Copy link
Contributor

Choose a reason for hiding this comment

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

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);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: space around operators : chainidx - 1

@FdaSilvaYY
Copy link
Contributor

Need a bit of tidy up.
A few memleaks in current code changes.
Can you add some tests ?

Copy link
Contributor

@FdaSilvaYY FdaSilvaYY left a comment

Choose a reason for hiding this comment

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

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);
Copy link
Contributor

@FdaSilvaYY FdaSilvaYY Sep 9, 2022

Choose a reason for hiding this comment

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

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;
Copy link
Contributor

Choose a reason for hiding this comment

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

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;
Copy link
Contributor

Choose a reason for hiding this comment

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

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.

@mikrue mikrue closed this Sep 10, 2022
@mikrue
Copy link
Author

mikrue commented Sep 10, 2022

Closed and re-open to remove the “CLA missing” tag

@mikrue mikrue reopened this Sep 10, 2022
@t8m
Copy link
Member

t8m commented Sep 12, 2022

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?

@t8m t8m added branch: master Applies to master branch triaged: feature The issue/pr requests/adds a feature labels Sep 12, 2022
@github-actions github-actions bot added the severity: fips change The pull request changes FIPS provider sources label Sep 12, 2022
@openssl-machine
Copy link
Collaborator

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

@mikrue
Copy link
Author

mikrue commented Oct 13, 2022 via email

@FdaSilvaYY
Copy link
Contributor

FdaSilvaYY commented Oct 13, 2022

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

You should close and reopen your PR, to get the bot run again

@t8m
Copy link
Member

t8m commented Oct 13, 2022

I have already submitted the CLA a few weeks ago. How can I remove this label?

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.

@openssl-machine
Copy link
Collaborator

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

@openssl-machine
Copy link
Collaborator

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

@openssl-machine
Copy link
Collaborator

This PR has been closed. It was waiting for a CLA for 90 days.

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

Labels

branch: master Applies to master branch hold: cla required The contributor needs to submit a license agreement severity: fips change The pull request changes FIPS provider sources triaged: feature The issue/pr requests/adds a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants