From: "flichtenheld (Code Review)" Date: Mon, 23 Mar 2026 12:09:36 +0000 References: Reply-To: frank@...2641..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="m3WK7Wo9bbU="; 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: plaisthos Cc: openvpn-devel --m3WK7Wo9bbU= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: plaisthos. Hello plaisthos, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/1584?usp=3Demail to review the following change. 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 --- M src/openvpn/ssl_verify_openssl.c 1 file changed, 4 insertions(+), 4 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/84/1584/1 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: newchange Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I8adffc3152b5b502a820a8ae0f901717e4831f81 Gerrit-Change-Number: 1584 Gerrit-PatchSet: 1 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos --m3WK7Wo9bbU= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: plaisthos.

flichtenheld would like plaisthos to review this change.

V= iew Change

ssl_verify_openssl: use official ASN1_STRIN=
G_ 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 consi= stently
applied. Standardise on using ASN1_STRING_length and ASN1_STRING= _get0_data
which allows for successful build of OpenSSL 4.x

Chang= e-Id: I8adffc3152b5b502a820a8ae0f901717e4831f81
Signed-off-by: Rudi Heit= baum <rudi@...2993...>
---
M src/openvpn/ssl_verify_openssl.c1 file changed, 4 insertions(+), 4 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/84/1584/1<=
/pre>
-        char *serial =3D f=
ormat_hex_ex(asn1_i->data, asn1_i->length, 0, 1 | FHE_CAPS, NULL, &am=
p;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 @@
{<= br> const ASN1_INTEGER *asn1_i =3D X509_get_serialNumber(cert);

- r= eturn format_hex_ex(asn1_i->data, asn1_i->length, 0, 1, ":"= , gc);
+ return fo= rmat_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, NULL, NULL);
- result =3D = (ns && ns->length > 0 && (ns->data[0] & NS_SSL= _CLIENT)) ? SUCCESS : FAILURE;
+ result =3D (ns && ASN1_STRING_length(ns) >= ; 0 && (ASN1_STRING_get0_data(ns)[0] & NS_SSL_CLIENT)) ? SUCCES= S : 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, NULL, NULL);
- result =3D (ns &&= ns->length > 0 && (ns->data[0] & NS_SSL_SERVER)) ? SU= CCESS : FAILURE;
+ = result =3D (ns && ASN1_STRING_length(ns) > 0 &&= (ASN1_STRING_get0_data(ns)[0] & NS_SSL_SERVER)) ? SUCCESS : FAILURE;
if (result =3D=3D SUCCESS)
= {
msg(M_WARN, "X509: Certifi= cate is a server certificate yet it's purpose "

To view, visit change 1584. To unsubscribe, or for help writi= ng mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I8adffc3152b5b502a820a8ae0f9= 01717e4831f81
Gerrit-Change-Number: 1584
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
= --m3WK7Wo9bbU=--