git: 51d910a3e0b4 - main - libfetch: Prepare for OpenSSL 4
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 11 Nov 2026 10:06:14 UTC
The branch main has been updated by des:
URL: https://cgit.FreeBSD.org/src/commit/?id=51d910a3e0b42e7d147f49776021a868330a1a8a
commit 51d910a3e0b42e7d147f49776021a868330a1a8a
Author: Gordon Tetlow <gordon@FreeBSD.org>
AuthorDate: 2026-11-10 13:48:11 +0000
Commit: Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-11-11 10:06:06 +0000
libfetch: Prepare for OpenSSL 4
* Always use libmd's MD5 since it's deprecated in OpenSSL.
* Use ASN1_STRING_get_length() instead of ASN1_STRING_length().
---
lib/libfetch/Makefile | 4 +---
lib/libfetch/common.c | 4 ++++
lib/libfetch/http.c | 16 ++++------------
share/mk/src.libnames.mk | 3 +--
4 files changed, 10 insertions(+), 17 deletions(-)
diff --git a/lib/libfetch/Makefile b/lib/libfetch/Makefile
index 37767cb5ec89..5eccb3127d42 100644
--- a/lib/libfetch/Makefile
+++ b/lib/libfetch/Makefile
@@ -16,11 +16,9 @@ CFLAGS+= -DINET6
.if ${MK_OPENSSL} != "no"
CFLAGS+= -DWITH_SSL
-CFLAGS+= -DOPENSSL_API_COMPAT=0x10100000L
LIBADD+= ssl crypto
-.else
-LIBADD+= md
.endif
+LIBADD+= md
CFLAGS+= -DFTP_COMBINE_CWDS
diff --git a/lib/libfetch/common.c b/lib/libfetch/common.c
index 023c491aa852..091bef849649 100644
--- a/lib/libfetch/common.c
+++ b/lib/libfetch/common.c
@@ -1009,7 +1009,11 @@ fetch_ssl_verify_altname(STACK_OF(GENERAL_NAME) *altnames,
for (i = 0; i < sk_GENERAL_NAME_num(altnames); ++i) {
name = sk_GENERAL_NAME_value(altnames, i);
ns = (const char *)ASN1_STRING_get0_data(name->d.ia5);
+#if OPENSSL_VERSION_NUMBER >= 0x40100000L
+ nslen = ASN1_STRING_get_length(name->d.ia5);
+#else
nslen = (size_t)ASN1_STRING_length(name->d.ia5);
+#endif
if (name->type == GEN_DNS && ip == NULL &&
fetch_ssl_hname_match(host, strlen(host), ns, nslen))
diff --git a/lib/libfetch/http.c b/lib/libfetch/http.c
index feb88f9c1452..04cdc878c191 100644
--- a/lib/libfetch/http.c
+++ b/lib/libfetch/http.c
@@ -65,10 +65,14 @@
#include <sys/socket.h>
#include <sys/time.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+
#include <ctype.h>
#include <err.h>
#include <errno.h>
#include <locale.h>
+#include <md5.h>
#include <netdb.h>
#include <stdarg.h>
#include <stdbool.h>
@@ -79,18 +83,6 @@
#include <unistd.h>
#include <xlocale.h>
-#ifdef WITH_SSL
-#include <openssl/md5.h>
-#define MD5Init(c) MD5_Init(c)
-#define MD5Update(c, data, len) MD5_Update(c, data, len)
-#define MD5Final(md, c) MD5_Final(md, c)
-#else
-#include <md5.h>
-#endif
-
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-
#include "fetch.h"
#include "common.h"
#include "httperr.h"
diff --git a/share/mk/src.libnames.mk b/share/mk/src.libnames.mk
index 081187dbc0e2..4da70218f377 100644
--- a/share/mk/src.libnames.mk
+++ b/share/mk/src.libnames.mk
@@ -367,9 +367,8 @@ _DP_edit= tinfow
_DP_execinfo= elf
.if ${MK_OPENSSL} != "no"
_DP_fetch= ssl crypto
-.else
-_DP_fetch= md
.endif
+_DP_fetch+= md
.if ${MK_OPENSSH} != "no"
_DP_fido2+= crypto z
.endif