Skip to content

GnuTLS: remove our own OCSP signature verification - #23312

Closed
icing wants to merge 1 commit into
curl:masterfrom
icing:gtls-verify-status-simpler
Closed

icing wants to merge 1 commit into
curl:masterfrom
icing:gtls-verify-status-simpler

Conversation

@icing

@icing icing commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

GnuTLS documents for gnutls_certificate_verify_peers2() that it already takes a received OCSP response into account. Therefore our own code needs only to check if a stapled OCSP response was receieved when verifystatus is requested.

Besides being superfluous, the code was also producing false negatives as the list of trust anchors used is insufficent for verification, as correclty pointed out in #23311.

GnuTLS documents for gnutls_certificate_verify_peers2() that it
already takes a received OCSP response into account. Therefore
our own code needs only to check if a stapled OCSP response was
receieved when verifystatus is requested.

Besides being superfluous, the code was also producing false
negatives as the list of trust anchors used is insufficent for
verification, as correclty pointed out in curl#23311.

@bagder bagder left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One has to love a good negative line count!

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

OCSP validation can be bypassed when peer verification is disabled or SecTrust replaces the GnuTLS result.

1 open finding
What changed in this PR

Simplifies GnuTLS OCSP handling by relying on built-in certificate verification and retaining only the stapled-response presence check.

Changes:

  • Removes manual OCSP parsing, signature verification, and status handling.
  • Checks only whether an OCSP response was received.
File Description
lib/​vtls/​gtls.c Simplifies GnuTLS stapled OCSP validation.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Comment thread lib/vtls/gtls.c
if(ocsp_resp)
gnutls_ocsp_resp_deinit(ocsp_resp);
return result;
return CURLE_OK;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

--insecure --cert-status is a pretty useless combination...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I tend to agree.🤭

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We could make this combination fail, but if people want to shoot themselves in the foot...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hmm...I think our test for presence is good enough for such a case.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ah true

@bagder bagder closed this in 5e727ca Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

3 participants