diff mbox series

[meta-networking] ntp: fix build with OpenSSL 4.0

Message ID 20260909204836.344955-1-alperyasinak1@gmail.com
State Under Review
Headers show
Series [meta-networking] ntp: fix build with OpenSSL 4.0 | expand

Commit Message

Alper Ak Sept. 9, 2026, 8:48 p.m. UTC
do_compile fails with:

  ntp_crypto.c:2035:23: error: invalid use of incomplete typedef
  'ASN1_TIME' {aka 'const struct asn1_string_st'}

Signed-off-by: Alper Ak <alperyasinak1@gmail.com>
---
 ...crypto-use-the-ASN1_STRING-accessors.patch | 39 +++++++++++++++++++
 .../recipes-support/ntp/ntp_4.2.8p18.bb       |  1 +
 2 files changed, 40 insertions(+)
 create mode 100644 meta-networking/recipes-support/ntp/ntp/0001-ntp_crypto-use-the-ASN1_STRING-accessors.patch
diff mbox series

Patch

diff --git a/meta-networking/recipes-support/ntp/ntp/0001-ntp_crypto-use-the-ASN1_STRING-accessors.patch b/meta-networking/recipes-support/ntp/ntp/0001-ntp_crypto-use-the-ASN1_STRING-accessors.patch
new file mode 100644
index 0000000000..5d4633a41e
--- /dev/null
+++ b/meta-networking/recipes-support/ntp/ntp/0001-ntp_crypto-use-the-ASN1_STRING-accessors.patch
@@ -0,0 +1,39 @@ 
+From: Alper Ak <alperyasinak1@gmail.com>
+Date: Wed, 9 Sep 2026 23:30:00 +0300
+Subject: [PATCH] ntp_crypto: use the ASN1_STRING accessors
+
+ASN1_STRING is opaque in OpenSSL 4, so asn1time->length and data->data
+no longer compile. The accessors have been available since OpenSSL
+1.1.0, which this file already requires.
+
+Upstream-Status: Pending
+Signed-off-by: Alper Ak <alperyasinak1@gmail.com>
+---
+ ntpd/ntp_crypto.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+--- a/ntpd/ntp_crypto.c
++++ b/ntpd/ntp_crypto.c
+@@ -2032,9 +2032,9 @@
+ 	 * Also note that two-digit years less than 50 map to years greater than
+ 	 * 100. Dontcha love ASN.1? Better than MIL-188.
+ 	 */
+-	len = asn1time->length;
++	len = ASN1_STRING_length(asn1time);
+ 	REQUIRE(len < sizeof(v));
+-	(void)strncpy(v, (char *)(asn1time->data), len);
++	(void)strncpy(v, (const char *)ASN1_STRING_get0_data(asn1time), len);
+ 	REQUIRE(len >= 13);
+ 	temp = strtoul(v+len-3, NULL, 10);
+ 	pjd->second = temp;
+@@ -3551,8 +3551,8 @@
+ 		 */
+ 		case NID_subject_key_identifier:
+ 			data = X509_EXTENSION_get_data(ext);
+-			ret->grpkey = BN_bin2bn(&data->data[2],
+-			    data->length - 2, NULL);
++			ret->grpkey = BN_bin2bn(ASN1_STRING_get0_data(data) + 2,
++			    ASN1_STRING_length(data) - 2, NULL);
+ 			/* fall through */
+ 		default:
+ 			DPRINTF(1, ("cert_parse: %s\n",
diff --git a/meta-networking/recipes-support/ntp/ntp_4.2.8p18.bb b/meta-networking/recipes-support/ntp/ntp_4.2.8p18.bb
index 334120814d..8479b6ce12 100644
--- a/meta-networking/recipes-support/ntp/ntp_4.2.8p18.bb
+++ b/meta-networking/recipes-support/ntp/ntp_4.2.8p18.bb
@@ -20,6 +20,7 @@  SRC_URI = "http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-${PV}.tar.g
            file://0001-ITS-10011-build-fix-compatibility-with-stricter-C99-.patch \
            file://0001-colcomp-sntp-libpkgver-colcomp.c-Convert-K-R-functio.patch \
            file://0001-Makefile.am-Don-t-build-deprecated-ntpdate.patch \
+           file://0001-ntp_crypto-use-the-ASN1_STRING-accessors.patch \
            file://ntpd \
            file://ntp.conf \
            file://ntpd.service \