Repository navigation
Conversation
2b51a82 to
21b2f3f
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates curl’s OpenSSL-backed MD5/MD4 implementations to use the EVP digest API instead of the deprecated low-level MD5_* / MD4_* functions, keeping curl compatible with newer OpenSSL deprecation policies.
Changes:
- Switch MD5 OpenSSL backend from
<openssl/md5.h>+MD5_*to<openssl/evp.h>+EVP_Digest*. - Switch MD4 OpenSSL backend from
<openssl/md4.h>+MD4_*to<openssl/evp.h>+EVP_Digest*.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| lib/md5.c | Replaces OpenSSL MD5 low-level API usage with EVP-based MD5 context management. |
| lib/md4.c | Replaces OpenSSL MD4 low-level API usage with EVP-based MD4 context management. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ec8a23c to
9ced360
Compare
01b8413 to
029d4cc
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
lib/curl_sha512_256.c:176
- The new
digest == NULLcleanup pattern (used fromCurl_HMAC_init()'sfail:path) is only implemented for the OpenSSL SHA-512/256 backend here. The wolfSSL and GnuTLS/NetttleCurl_sha512_256_finish()implementations in this same file still unconditionally write todigest, which will crash whenhfinal(NULL, ...)is used during cleanup. Please add the sameif(digest)handling (and any required abort/reset) to the other backend branches to keep the HMAC cleanup contract consistent across TLS backends.
if(digest) {
#ifdef NEED_NETBSD_SHA512_256_WORKAROUND
/* Use a larger buffer to work around a bug in NetBSD:
https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=58039 */
unsigned char tmp_digest[CURL_SHA512_256_DIGEST_SIZE * 2];
result = EVP_DigestFinal_ex(*ctx, tmp_digest, NULL) ?
CURLE_OK : CURLE_BAD_FUNCTION_ARGUMENT;
if(result == CURLE_OK)
memcpy(digest, tmp_digest, CURL_SHA512_256_DIGEST_SIZE);
curlx_memzero(tmp_digest, sizeof(tmp_digest));
#else /* !NEED_NETBSD_SHA512_256_WORKAROUND */
result = EVP_DigestFinal_ex(*ctx, digest, NULL) ?
CURLE_OK : CURLE_BAD_FUNCTION_ARGUMENT;
#endif /* NEED_NETBSD_SHA512_256_WORKAROUND */
}
EVP_MD_CTX_free(*ctx);
| static CURLcode Curl_sha512_256_finish(unsigned char *digest, void *context) | ||
| static CURLcode Curl_sha512_256_finish(unsigned char *digest, void *in) | ||
| { | ||
| CURLcode result; |
There was a problem hiding this comment.
Maybe the most annoying thing in LLM review being enabled by default, is
that it's trying to do the job of compilers. It's redundant, wasteful and annoying.
The second one is that it makes at least me half-insane with the barrage of
reports, unread notifications (those are also coming for PRs actively monitored
and reacted-to), especially when working on a PR that's not ready yet. Maybe
something to get used to, or something that'll eventually make me disable this.
The 3rd one is when doing experimental PRs and LLM going crazy with mostly
useless reports.
(I did not enable automatic reviews, still don't know how/why it happened, and
where's the toggle to control it.)
There was a problem hiding this comment.
(I did not enable automatic reviews, still don't know how/why it happened, and
where's the toggle to control it.)
It was some magic GitHub did themselves for untold reasons. I don't know how to switch it back to on-demand either, but I have asked someone.
There was a problem hiding this comment.
Thanks a lot @bagder!
My guess so far is that it's a personal setting. It's unset on my profile, an
omission (or dark pattern) where neither disabled/enabled is selected,
and the actual setting sourced maybe from a GitHub global default. It's
irreversible to the current state once one selects something, so did not
touch it yet. (ref "Automatic Copilot code review")
dec4035 to
45f26b4
Compare
45f26b4 to
9ffd481
Compare
c00528d to
114cbb1
Compare
179bc1c to
b1e375d
Compare
|
The non-flaky CI failure is unrelated and happening in master since 9be5c68. edit: fix PR → #22834 |
Rework MD4 and MD5 code to use the modern
EVP_Digest_*()API,replacing the deprecated
MD4_*()andMD5_*()ones. It allows to usethese OpenSSL crypto primitives with OpenSSL built with the
no-deprecatedoption.Also:
(drop holder struct, clear ptr after freeing, add
(void))Also in unused codepaths with SHA256 (OpenSSL, Windows).
Bug: openssl: use non-deprecated API for MD5/MD4 #22221 (comment)