From: Arne Schwabe <[email protected]>

OpenSSL 4.1 introduced ASN1_STRING_get_length and at the same
time deprecated the ASN1_STRING_length method. Use the
new method and keep and compat macro for older versions and
other OpenSSL like libraries.

Change-Id: I1bff3107f95b403d554bea4262c2dda270a1fc79
Signed-off-by: Arne Schwabe <[email protected]>
Acked-by: Razvan Cojocaru <[email protected]>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2087
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2087
This mail reflects revision 2 of this Change.

Acked-by according to Gerrit (reflected above):
Razvan Cojocaru <[email protected]>

        
diff --git a/src/openvpn/openssl_compat.h b/src/openvpn/openssl_compat.h
index 4305fea..8309cee 100644
--- a/src/openvpn/openssl_compat.h
+++ b/src/openvpn/openssl_compat.h
@@ -204,4 +204,9 @@
 #define EVP_CIPH_FLAG_ENC_THEN_MAC 0x10000000
 #endif
 
+/* Introduced in OpenSSL 4.1.0 */
+#if OPENSSL_VERSION_NUMBER < 0x40100000
+#define ASN1_STRING_get_length (size_t)ASN1_STRING_length
+#endif
+
 #endif /* OPENSSL_COMPAT_H_ */
diff --git a/src/openvpn/ssl_verify_openssl.c b/src/openvpn/ssl_verify_openssl.c
index 146a384..0c36cf2 100644
--- a/src/openvpn/ssl_verify_openssl.c
+++ b/src/openvpn/ssl_verify_openssl.c
@@ -154,7 +154,7 @@
                     {
                         continue;
                     }
-                    if ((ssize_t)strlen(buf) != 
ASN1_STRING_length(name->d.rfc822Name))
+                    if (strlen(buf) != 
ASN1_STRING_get_length(name->d.rfc822Name))
                     {
                         msg(D_TLS_ERRORS, "ASN1 ERROR: string contained 
terminating zero");
                     }


_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to