From: "cron2 (Code Review)" Date: Sat, 18 Apr 2026 18:33:04 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, matthias.andree@...68..., frank@...2641... Message-ID: <43680f83a6ddf7f04fbe4b30384e786edec8cb85-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="VrjwDFFRKTo="; charset=UTF-8 Subject: [Openvpn-devel] [M] Change in openvpn[master]: OpenSSL 4.0: Use X509_check_certificate_times instead of X509_cmp_time List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld Cc: openvpn-devel , mandree --VrjwDFFRKTo= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#6) to the change originally created by= plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/1595?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by cron2 Change subject: OpenSSL 4.0: Use X509_check_certificate_times instead of X5= 09_cmp_time ...................................................................... OpenSSL 4.0: Use X509_check_certificate_times instead of X509_cmp_time The X509_cmp_time function is deprecated in OpenSSL 4.0. So we avoid it and use the new API. Change-Id: I6c2eda0e5bbb3a70b404f821e25ded81f0f5ddd5 Signed-off-by: Arne Schwabe Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1595 Message-Id: <20260417164644.17897-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36= 651.html Signed-off-by: Gert Doering --- M src/openvpn/ssl_openssl.c 1 file changed, 55 insertions(+), 0 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/95/1595/6 diff --git a/src/openvpn/ssl_openssl.c b/src/openvpn/ssl_openssl.c index efe5b5b..6130dc3 100644 --- a/src/openvpn/ssl_openssl.c +++ b/src/openvpn/ssl_openssl.c @@ -634,6 +634,7 @@ #endif /* if OPENSSL_VERSION_NUMBER < 0x30000000L */ } +#if OPENSSL_VERSION_NUMBER < 0x40000000L void tls_ctx_check_cert_time(const struct tls_root_ctx *ctx) { @@ -669,6 +670,60 @@ msg(M_WARN, "WARNING: Your certificate has expired!"); } } +#else +void +tls_ctx_check_cert_time(const struct tls_root_ctx *ctx) +{ + const X509 *cert; + ASSERT(ctx); + + cert =3D SSL_CTX_get0_certificate(ctx->ctx); + + if (cert =3D=3D NULL) + { + return; /* Nothing to check if there is no certificate */ + } + + X509_VERIFY_PARAM *vpm =3D X509_VERIFY_PARAM_new(); + + if (vpm =3D=3D NULL) + { + msg(D_TLS_DEBUG_MED, "Failed to initialise certificate verificatio= n parameters."); + return; + } + + X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_USE_CHECK_TIME); + X509_VERIFY_PARAM_set_time(vpm, now); + + int error =3D 0; + int ret =3D X509_check_certificate_times(vpm, cert, &error); + X509_VERIFY_PARAM_free(vpm); + + if (ret =3D=3D 1) + { + return; + } + + switch (error) + { + case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: + msg(D_TLS_DEBUG_MED, "Failed to read certificate notBefore fie= ld."); + break; + + case X509_V_ERR_CERT_NOT_YET_VALID: + msg(M_WARN, "WARNING: Your certificate is not yet valid!"); + break; + + case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: + msg(D_TLS_DEBUG_MED, "Failed to read certificate notAfter fiel= d."); + break; + + case X509_V_ERR_CERT_HAS_EXPIRED: + msg(M_WARN, "WARNING: Your certificate has expired!"); + break; + } +} +#endif void tls_ctx_load_dh_params(struct tls_root_ctx *ctx, const char *dh_file, bool= dh_file_inline) -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1595?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newpatchset Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I6c2eda0e5bbb3a70b404f821e25ded81f0f5ddd5 Gerrit-Change-Number: 1595 Gerrit-PatchSet: 6 Gerrit-Owner: plaisthos Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-CC: mandree Gerrit-CC: openvpn-devel --VrjwDFFRKTo= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 upl= oaded patch set #6 to the change originally created by plaisthos.<= /p>

Vi= ew Change

The following approvals got outdated and were removed: Code-Review+2 by cron2

OpenSSL 4.0: Use X509_check_certifi=
cate_times instead of X509_cmp_time

The X509_cmp_time function is de= precated in OpenSSL 4.0. So we avoid it and
use the new API.

Chan= ge-Id: I6c2eda0e5bbb3a70b404f821e25ded81f0f5ddd5
Signed-off-by: Arne Sch= wabe <arne@...1227...>
Acked-by: Gert Doering <gert@...1296...&= gt;
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1595
Message-I= d: <20260417164644.17897-1-gert@...1296...>
URL: https://www.mail-= archive.com/openvpn-devel@lists.sourceforge.net/msg36651.html
Signed-off= -by: Gert Doering <gert@...1296...>
---
M src/openvpn/ssl_opens= sl.c
1 file changed, 55 insertions(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/95/15=
95/6
diff --git a/src/openvpn/ssl_openssl.c b/src/openvpn/ssl_opens=
sl.c
index efe5b5b..6130dc3 100644
--- a/sr= c/openvpn/ssl_openssl.c
+++ b/src/openvpn/ssl_openssl.c
@@ -634,6 +634,7 @@
#endif /* if OPENSSL_VERS= ION_NUMBER < 0x30000000L */
}
<= br>+#if OPENSSL_VERSION_NUMBER = < 0x40000000L
void
tls_ctx_check_cert_= time(const struct tls_root_ctx *ctx)
{
@@ = -669,6 +670,60 @@
msg(M_WARN, "WARNING: Your = certificate has expired!");
}
}<= /span>
+#else
+void

+tls_ctx_check_cert_time(const struct tls_root_ctx= *ctx)
+{
<= span style=3D"color: hsl(120, 100%, 40%);">+ const X509 *cert;
+ ASSERT(ctx);
+
+ cert =3D SSL_CTX_get0_certificate(ctx->ctx);=
+
+ if (cert =3D=3D NULL)
+ {
+ return; /* Nothing to check if there i= s no certificate */
+= }
+
+ X509_VERIFY_PARAM *vpm =3D X5= 09_VERIFY_PARAM_new();
+ if (vpm =3D= =3D NULL)
+ {
+ msg(D_TLS_DEBUG_= MED, "Failed to initialise certificate verification parameters.")= ;
+ return;

+ }
+
+ X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_USE_CH= ECK_TIME);
+ X509_= VERIFY_PARAM_set_time(vpm, now);
+
+ in= t error =3D 0;
+ i= nt ret =3D X509_check_certificate_times(vpm, cert, &error);
<= span style=3D"color: hsl(120, 100%, 40%);">+ X509_VERIFY_PARAM_free(vpm)= ;
+
+ if (ret =3D=3D 1)
+ {
+ return;
+ }
+
+ switch = (error)
+ {=
+ case X509_V_ERR_ER= ROR_IN_CERT_NOT_BEFORE_FIELD:
+ msg(D_TLS_DEBUG_MED, "Failed to read certificate= notBefore field.");
+ break;
+
+ case X= 509_V_ERR_CERT_NOT_YET_VALID:
+ msg(M_WARN, "WARNING: Your certificate is not ye= t valid!");
+ = break;
+
+ case X509_V_ERR= _ERROR_IN_CERT_NOT_AFTER_FIELD:
+ msg(D_TLS_DEBUG_MED, "Failed to read certifica= te notAfter field.");
+ break;
+
+ case = X509_V_ERR_CERT_HAS_EXPIRED:
+ msg(M_WARN, "WARNING: Your certificate has expire= d!");
+ = break;
+ }
+}
+#endif

= void
tls_ctx_load_dh_params(struct tls_root_ctx *ctx, con= st char *dh_file, bool dh_file_inline)

= To view, visit change 1595. To unsubscribe, or for help writing mail filters, v= isit settings.

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6c2eda0e5bbb3a70b404f821e25= ded81f0f5ddd5
Gerrit-Change-Number: 1595
Gerrit-PatchSet: 6
Gerrit-Owner: plaisthos <arne-openvpn@...1711...= 27...>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-CC: mandree <matthias.andree@...2908...= .>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --VrjwDFFRKTo=--