From: "cron2 (Code Review)" Date: Thu, 26 Mar 2026 14:06:55 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="6iN3+6ajaBk="; charset=UTF-8 Subject: [Openvpn-devel] [XS] Change in openvpn[master]: ssl_verify_openssl: use official ASN1_STRING_ API List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld Cc: plaisthos , openvpn-devel --6iN3+6ajaBk= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/15= 84?usp=3Demail ) Change subject: ssl_verify_openssl: use official ASN1_STRING_ API ...................................................................... ssl_verify_openssl: use official ASN1_STRING_ API ASN1_STRING are now opaque types in OpenSSL 4.x =E2=80=94 the internal data= and length fields are no longer directly accessible. Use the accessor API instead. Accessors have been available since OpenSSL 1.1.0 The ASN1_STRING_length accessor is already in use, but not consistently applied. Standardise on using ASN1_STRING_length and ASN1_STRING_get0_data which allows for successful build of OpenSSL 4.x Change-Id: I8adffc3152b5b502a820a8ae0f901717e4831f81 Signed-off-by: Rudi Heitbaum Acked-by: Arne Schwabe Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1584 Message-Id: <20260323121908.730-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36= 254.html Signed-off-by: Gert Doering --- M src/openvpn/ssl_verify_openssl.c 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/openvpn/ssl_verify_openssl.c b/src/openvpn/ssl_verify_open= ssl.c index 46401cd..d96879b 100644 --- a/src/openvpn/ssl_verify_openssl.c +++ b/src/openvpn/ssl_verify_openssl.c @@ -259,7 +259,7 @@ { ASN1_INTEGER *asn1_i =3D X509_get_serialNumber(peer_cert); struct gc_arena gc =3D gc_new(); - char *serial =3D format_hex_ex(asn1_i->data, asn1_i->length, 0, 1 = | FHE_CAPS, NULL, &gc); + char *serial =3D format_hex_ex(ASN1_STRING_get0_data(asn1_i), ASN1= _STRING_length(asn1_i), 0, 1 | FHE_CAPS, NULL, &gc); if (!serial || cn_len <=3D strlen(serial) + 2) { @@ -313,7 +313,7 @@ { const ASN1_INTEGER *asn1_i =3D X509_get_serialNumber(cert); - return format_hex_ex(asn1_i->data, asn1_i->length, 0, 1, ":", gc); + return format_hex_ex(ASN1_STRING_get0_data(asn1_i), ASN1_STRING_length= (asn1_i), 0, 1, ":", gc); } result_t @@ -626,7 +626,7 @@ { ASN1_BIT_STRING *ns; ns =3D X509_get_ext_d2i(peer_cert, NID_netscape_cert_type, NUL= L, NULL); - result =3D (ns && ns->length > 0 && (ns->data[0] & NS_SSL_CLIE= NT)) ? SUCCESS : FAILURE; + result =3D (ns && ASN1_STRING_length(ns) > 0 && (ASN1_STRING_g= et0_data(ns)[0] & NS_SSL_CLIENT)) ? SUCCESS : FAILURE; if (result =3D=3D SUCCESS) { msg(M_WARN, "X509: Certificate is a client certificate yet= it's purpose " @@ -654,7 +654,7 @@ { ASN1_BIT_STRING *ns; ns =3D X509_get_ext_d2i(peer_cert, NID_netscape_cert_type, NUL= L, NULL); - result =3D (ns && ns->length > 0 && (ns->data[0] & NS_SSL_SERV= ER)) ? SUCCESS : FAILURE; + result =3D (ns && ASN1_STRING_length(ns) > 0 && (ASN1_STRING_g= et0_data(ns)[0] & NS_SSL_SERVER)) ? SUCCESS : FAILURE; if (result =3D=3D SUCCESS) { msg(M_WARN, "X509: Certificate is a server certificate yet= it's purpose " -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1584?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: merged Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I8adffc3152b5b502a820a8ae0f901717e4831f81 Gerrit-Change-Number: 1584 Gerrit-PatchSet: 2 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel --6iN3+6ajaBk= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 sub= mitted this change.

View Change

ssl_verify_openssl: use official ASN1_STRING_ AP=
I

ASN1_STRING are now opaque types in OpenSSL 4.x =E2=80=94 the inte= rnal data and
length fields are no longer directly accessible. Use the a= ccessor API
instead. Accessors have been available since OpenSSL 1.1.0
The ASN1_STRING_length accessor is already in use, but not consistent= ly
applied. Standardise on using ASN1_STRING_length and ASN1_STRING_get0= _data
which allows for successful build of OpenSSL 4.x

Change-Id:= I8adffc3152b5b502a820a8ae0f901717e4831f81
Signed-off-by: Rudi Heitbaum = <rudi@...2993...>
Acked-by: Arne Schwabe <arne-openvpn@...2639...= ..>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1584
Messag= e-Id: <20260323121908.730-1-gert@...1296...>
URL: https://www.mail= -archive.com/openvpn-devel@lists.sourceforge.net/msg36254.html
Signed-of= f-by: Gert Doering <gert@...1296...>
---
M src/openvpn/ssl_veri= fy_openssl.c
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/openvpn/ssl_verify_openssl.c b/src/openvpn/ssl_verify_o=
penssl.c
index 46401cd..d96879b 100644
--- = a/src/openvpn/ssl_verify_openssl.c
+++ b/src/openvpn/ssl_ve= rify_openssl.c
@@ -259,7 +259,7 @@
{
ASN1_INTEGER *asn1_i =3D X509_get_serialNumber(peer= _cert);
struct gc_arena gc =3D gc_new();- char *serial =3D format= _hex_ex(asn1_i->data, asn1_i->length, 0, 1 | FHE_CAPS, NULL, &gc)= ;
+ char *seri= al =3D format_hex_ex(ASN1_STRING_get0_data(asn1_i), ASN1_STRING_length(asn1= _i), 0, 1 | FHE_CAPS, NULL, &gc);

= if (!serial || cn_len <=3D strlen(serial) + 2)
= {
@@ -313,7 +313,7 @@
{
const ASN1_INTEGER *asn1_i =3D X509_get_serialNumber(cert);
=

- return= format_hex_ex(asn1_i->data, asn1_i->length, 0, 1, ":", gc)= ;
+ return format_= hex_ex(ASN1_STRING_get0_data(asn1_i), ASN1_STRING_length(asn1_i), 0, 1, &qu= ot;:", gc);
}

resu= lt_t
@@ -626,7 +626,7 @@
{<= br> ASN1_BIT_STRING *ns;
ns = =3D X509_get_ext_d2i(peer_cert, NID_netscape_cert_type, NULL, NULL);=
- result =3D (ns &= amp;& ns->length > 0 && (ns->data[0] & NS_SSL_CLIE= NT)) ? SUCCESS : FAILURE;
+ result =3D (ns && ASN1_STRING_length(ns) > 0 &= amp;& (ASN1_STRING_get0_data(ns)[0] & NS_SSL_CLIENT)) ? SUCCESS : F= AILURE;
if (result =3D=3D SUCCESS)
<= span> {
msg(M_WARN, "X509= : Certificate is a client certificate yet it's purpose "@@ -654,7 +654,7 @@
{
= ASN1_BIT_STRING *ns;
ns =3D X509_get_e= xt_d2i(peer_cert, NID_netscape_cert_type, NULL, NULL);
- result =3D (ns && ns-&= gt;length > 0 && (ns->data[0] & NS_SSL_SERVER)) ? SUCCESS= : FAILURE;
+ = result =3D (ns && ASN1_STRING_length(ns) > 0 && (ASN= 1_STRING_get0_data(ns)[0] & NS_SSL_SERVER)) ? SUCCESS : FAILURE;=
if (result =3D=3D SUCCESS)
= {
msg(M_WARN, "X509: Certificate = is a server certificate yet it's purpose "
=

To view, visit change 1584. To unsubscribe, or for help writing ma= il filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I8adffc3152b5b502a820a8ae0f9= 01717e4831f81
Gerrit-Change-Number: 1584
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --6iN3+6ajaBk=--