schannel: check schannel_sha256sum() success, and more#21739
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Schannel SHA-256 helper path to propagate failures from the underlying WinCrypt hashing routines, and uses that status when computing digests for CA cache validation.
Changes:
- Change
schannel_checksum()to return aCURLcodeand report success/failure. - Make
schannel_sha256sum()return the checksum result instead of alwaysCURLE_OK. - Check
schannel_sha256sum()return value when comparing/storing CAinfo blob digests for the Schannel cert-store cache.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
f313879 to
1cbdb37
Compare
|
augment review |
🔒 Aisle Security AnalysisWe found 1 low security issue(s) in this PR: See details in the comment below.Analyzed PR: #21739 at commit Last updated on: 2026-05-26T23:13:50Z |
🤖 Augment PR SummarySummary: This PR tightens SChannel SHA-256 digest handling so failures are detected and don’t silently produce/propagate incorrect hashes. Changes:
Technical Notes: The cache validation path now fails closed if hashing fails, preventing reuse of a store keyed by an invalid/zeroed digest. 🤖 Was this summary useful? React with 👍 or 👎 |
🔒 Aisle Security Analysis✅ Aisle scan complete — no security issues detected. Previously reported findings🔵 Size truncation in SChannel CAinfo blob hashing can cause incorrect certificate-store cache hitsLow severity CWE-197 at DescriptionIn This digest is used to key the cached certificate store for Vulnerable code: if(!CryptHashData(hHash, input, (DWORD)inputlen, 0))
goto out;Notes:
RecommendationReject or safely handle inputs larger than Option A (simplest/safest): fail if if(inputlen > (size_t)DWORD_MAX)
return CURLE_BAD_FUNCTION_ARGUMENT;
if(!CryptHashData(hHash, input, (DWORD)inputlen, 0))
goto out;Option B: hash in chunks to support arbitrary sizes. size_t off = 0;
while(off < inputlen) {
DWORD chunk = (DWORD)CURLMIN(inputlen - off, (size_t)DWORD_MAX);
if(!CryptHashData(hHash, input + off, chunk, 0))
goto out;
off += chunk;
}Also consider adding a similar size guard at the call site using Aisle supplements but does not replace security review. Last updated on: 2026-05-26T23:52:28Z |
schannel_sha256sum() successschannel_sha256sum() success, and more
Also: - support 4GiB+ SHA-256 digest inputs. - check `CryptGetHashParam()` output size. - avoid overwriting existing digest when new digest calculation fails. - avoid adding digest hash element on failure. Closes curl#21739
Also:
CryptGetHashParam()output size.https://github.com/curl/curl/pull/21739/files?w=1