Skip to content

vtls: more large buffer support and error checks for SHA-256#21771

Closed
vszakats wants to merge 11 commits into
curl:masterfrom
vszakats:vtls-sha256-size_t
Closed

vtls: more large buffer support and error checks for SHA-256#21771
vszakats wants to merge 11 commits into
curl:masterfrom
vszakats:vtls-sha256-size_t

Conversation

@vszakats
Copy link
Copy Markdown
Member

@vszakats vszakats commented May 27, 2026

  • gnutls: support 4GiB+ SHA-256 digest inputs.
  • openssl: check success of low-level update/finish digest calls.
  • openssl: pass NULL to EVP_DigestFinal_ex() instead of discarding
    returned value.
  • wolfssl: support 4GiB+ SHA-256 digest inputs.
  • wolfssl: check success of low-level update/finish digest calls.
  • sync and tidy up argument names in low-level sha256_sum functions.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the robustness of the TLS backend SHA-256 helper implementations used by libcurl’s VTLS layer (notably for pinned public key hashing), by handling very large inputs for backends with 32-bit update APIs and tightening low-level digest error handling.

Changes:

  • Update GnuTLS+nettle and wolfSSL SHA-256 helpers to process inputs in chunks, supporting 4GiB+ digest inputs.
  • Add success checks for OpenSSL low-level digest update/final calls, and pass NULL to EVP_DigestFinal_ex() when the digest length output is not needed.
  • Normalize argument naming in low-level sha256sum functions (input/len).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
lib/vtls/wolfssl.c Chunk wolfSSL SHA-256 updates to support 32-bit length APIs and check update/final return codes.
lib/vtls/openssl.c Add return-value checks around OpenSSL digest update/final and adjust EVP_DigestFinal_ex() usage.
lib/vtls/gtls.c Chunk nettle SHA-256 updates to avoid unsigned-int length truncation for large inputs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/vtls/openssl.c Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread lib/vtls/openssl.c
@vszakats vszakats force-pushed the vtls-sha256-size_t branch from f6b9d2b to d1cfd39 Compare May 27, 2026 09:38
@vszakats vszakats marked this pull request as ready for review May 27, 2026 09:39
@vszakats vszakats changed the title vtls: improve SHA-256 low-level support vtls: more large buffer support and error checks for SHA-256 May 27, 2026
@vszakats vszakats closed this in 40f2da6 May 27, 2026
@vszakats vszakats deleted the vtls-sha256-size_t branch May 27, 2026 14:59
outcast36 pushed a commit to greearb/curl that referenced this pull request Jun 3, 2026
- gnutls: support 4GiB+ SHA-256 digest inputs.
- openssl: check success of low-level update/finish digest calls.
- openssl: pass NULL to `EVP_DigestFinal_ex()` instead of discarding
  returned value.
- wolfssl: support 4GiB+ SHA-256 digest inputs.
- wolfssl: check success of low-level update/finish digest calls.
- sync and tidy up argument names in low-level sha256_sum functions.

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

Development

Successfully merging this pull request may close these issues.

2 participants