diff --git a/apps/s_client.c b/apps/s_client.c index 7eb45c103e..3d6effd520 100644 --- a/apps/s_client.c +++ b/apps/s_client.c @@ -3679,7 +3679,8 @@ static int ocsp_resp_cb(SSL *s, void *arg) STACK_OF(OCSP_RESPONSE) *sk_resp = NULL; OCSP_RESPONSE *rsp; - if (SSL_version(s) >= TLS1_3_VERSION) { + if ((!SSL_is_dtls(s) && SSL_version(s) >= TLS1_3_VERSION) + || (SSL_is_dtls(s) && SSL_version(s) <= DTLS1_3_VERSION)) { (void)SSL_get0_tlsext_status_ocsp_resp_ex(s, &sk_resp); BIO_puts(arg, "OCSP responses: "); diff --git a/apps/s_server.c b/apps/s_server.c index 30b34086d7..af80c6d986 100644 --- a/apps/s_server.c +++ b/apps/s_server.c @@ -616,11 +616,10 @@ static int bring_ocsp_resp_in_correct_order(SSL *s, tlsextstatusctx *srctx, sk_OCSP_RESPONSE_pop_free(*sk_resp, OCSP_RESPONSE_free); SSL_get0_chain_certs(s, &server_certs); - /* - * TODO(DTLS-1.3): in future DTLS should also be considered - */ + if (server_certs != NULL && srctx->status_all && - !SSL_is_dtls(s) && SSL_version(s) >= TLS1_3_VERSION) { + ((!SSL_is_dtls(s) && SSL_version(s) >= TLS1_3_VERSION) + || (SSL_is_dtls(s) && SSL_version(s) <= DTLS1_3_VERSION))) { /* certificate chain is available */ num = sk_X509_num(server_certs) + 1; } @@ -763,11 +762,10 @@ static int get_ocsp_resp_from_responder(SSL *s, tlsextstatusctx *srctx, } SSL_get0_chain_certs(s, &server_certs); - /* - * TODO(DTLS-1.3): in future DTLS should also be considered - */ + if (server_certs != NULL && srctx->status_all && - !SSL_is_dtls(s) && SSL_version(s) >= TLS1_3_VERSION) { + ((!SSL_is_dtls(s) && SSL_version(s) >= TLS1_3_VERSION) + || (SSL_is_dtls(s) && SSL_version(s) <= DTLS1_3_VERSION))) { /* certificate chain is available */ num = sk_X509_num(server_certs) + 1; } else { diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c index 73ddf054d1..009364d5b6 100644 --- a/ssl/ssl_cert.c +++ b/ssl/ssl_cert.c @@ -436,6 +436,7 @@ static int ssl_verify_internal(SSL_CONNECTION *s, STACK_OF(X509) *sk, EVP_PKEY * SSL_CTX *sctx; #ifndef OPENSSL_NO_OCSP SSL *ssl; + const int version1_3 = SSL_CONNECTION_IS_DTLS(s) ? DTLS1_3_VERSION : TLS1_3_VERSION; #endif /* Something must be passed in */ @@ -498,10 +499,8 @@ static int ssl_verify_internal(SSL_CONNECTION *s, STACK_OF(X509) *sk, EVP_PKEY * */ #ifndef OPENSSL_NO_OCSP ssl = SSL_CONNECTION_GET_SSL(s); - /* - * TODO(DTLS-1.3): in future DTLS should also be considered - */ - if (!SSL_is_dtls(ssl) && SSL_version(ssl) >= TLS1_3_VERSION) { + + if (ssl_version_cmp(s, SSL_version(ssl), version1_3) >= 0) { /* ignore status_request_v2 if TLS version < 1.3 */ int status = SSL_get_tlsext_status_type(ssl); diff --git a/ssl/statem/statem_clnt.c b/ssl/statem/statem_clnt.c index 32d136b1a7..edb2cb4eb0 100644 --- a/ssl/statem/statem_clnt.c +++ b/ssl/statem/statem_clnt.c @@ -3031,10 +3031,7 @@ int tls_process_cert_status_body(SSL_CONNECTION *s, size_t chainidx, PACKET *pkt if (s->ext.ocsp.resp_ex == NULL) s->ext.ocsp.resp_ex = sk_OCSP_RESPONSE_new_null(); - /* - * TODO(DTLS-1.3): in future DTLS should also be considered - */ - if (!SSL_CONNECTION_IS_TLS13(s) && type == TLSEXT_STATUSTYPE_ocsp) { + if (!SSL_CONNECTION_IS_VERSION13(s) && type == TLSEXT_STATUSTYPE_ocsp) { sk_OCSP_RESPONSE_pop_free(s->ext.ocsp.resp_ex, OCSP_RESPONSE_free); s->ext.ocsp.resp_ex = sk_OCSP_RESPONSE_new_null(); }