Skip to content

Commit 185a05e

Browse files
icingbagder
authored andcommitted
ngtcp2+quictls: fix cert-status use
- add test for --cert-status on all http versions Reported-by: Dexter Gerig Fixes #14049 Closes #14050
1 parent 6e95e3f commit 185a05e

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

lib/vtls/openssl.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -2285,9 +2285,9 @@ CURLcode Curl_ossl_verifyhost(struct Curl_easy *data, struct connectdata *conn,
22852285
#if (OPENSSL_VERSION_NUMBER >= 0x0090808fL) && !defined(OPENSSL_NO_TLSEXT) && \
22862286
!defined(OPENSSL_NO_OCSP)
22872287
static CURLcode verifystatus(struct Curl_cfilter *cf,
2288-
struct Curl_easy *data)
2288+
struct Curl_easy *data,
2289+
struct ossl_ctx *octx)
22892290
{
2290-
struct ssl_connect_data *connssl = cf->ctx;
22912291
int i, ocsp_status;
22922292
#if defined(OPENSSL_IS_AWSLC)
22932293
const uint8_t *status;
@@ -2300,14 +2300,14 @@ static CURLcode verifystatus(struct Curl_cfilter *cf,
23002300
OCSP_BASICRESP *br = NULL;
23012301
X509_STORE *st = NULL;
23022302
STACK_OF(X509) *ch = NULL;
2303-
struct ossl_ctx *octx = (struct ossl_ctx *)connssl->backend;
23042303
X509 *cert;
23052304
OCSP_CERTID *id = NULL;
23062305
int cert_status, crl_reason;
23072306
ASN1_GENERALIZEDTIME *rev, *thisupd, *nextupd;
23082307
int ret;
23092308
long len;
23102309

2310+
(void)cf;
23112311
DEBUGASSERT(octx);
23122312

23132313
len = (long)SSL_get_tlsext_status_ocsp_resp(octx->ssl, &status);
@@ -4657,7 +4657,7 @@ CURLcode Curl_oss_check_peer_cert(struct Curl_cfilter *cf,
46574657
!defined(OPENSSL_NO_OCSP)
46584658
if(conn_config->verifystatus && !octx->reused_session) {
46594659
/* don't do this after Session ID reuse */
4660-
result = verifystatus(cf, data);
4660+
result = verifystatus(cf, data, octx);
46614661
if(result) {
46624662
/* when verifystatus failed, remove the session id from the cache again
46634663
if present */

tests/http/test_17_ssl_use.py

+17
Original file line numberDiff line numberDiff line change
@@ -240,3 +240,20 @@ def test_17_07_ssl_ciphers(self, env: Env, httpd, nghttpx, ciphers, succeed, rep
240240
assert r.json['SSL_CIPHER'] in cipher_names, f'{r.json}'
241241
else:
242242
assert r.exit_code != 0, f'{r}'
243+
244+
@pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3'])
245+
def test_17_08_cert_status(self, env: Env, httpd, nghttpx, repeat, proto):
246+
if proto == 'h3' and not env.have_h3():
247+
pytest.skip("h3 not supported")
248+
if not env.curl_uses_lib('openssl') and \
249+
not env.curl_uses_lib('gnutls') and \
250+
not env.curl_uses_lib('quictls'):
251+
pytest.skip("tls library does not support --cert-status")
252+
curl = CurlClient(env=env)
253+
domain = f'localhost'
254+
url = f'https://{env.authority_for(domain, proto)}/'
255+
r = curl.http_get(url=url, alpn_proto=proto, extra_args=[
256+
'--cert-status'
257+
])
258+
# CURLE_SSL_INVALIDCERTSTATUS, our certs have no OCSP info
259+
assert r.exit_code == 91, f'{r}'

0 commit comments

Comments
 (0)