snort3: fix build with OpenSSL 4.0

OpenSSL 4.0 returns const pointers from X509_get_subject_name(),
X509_get_issuer_name(), X509_NAME_get_entry(), and
X509_NAME_ENTRY_get_data().

Upstream-Status: Submitted [https://github.com/snort3/snort3/pull/477]
Signed-off-by: Jaipaul Cheernam <jaipaul.cheernam@est.tech>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
This commit is contained in:
Jaipaul Cheernam
2026-08-27 23:33:15 -07:00
committed by Khem Raj
parent 12024b3aea
commit 2e8eba02ec
2 changed files with 54 additions and 0 deletions
@@ -0,0 +1,53 @@
From 799739f51e8bc40c55f58a8dcbcb00ddb7ff679e Mon Sep 17 00:00:00 2001
From: Jaipaul Cheernam <jaipaul.cheernam@est.tech>
Date: Wed, 26 Aug 2026 16:39:34 +0000
Subject: [PATCH] ssl: fix const qualifiers for OpenSSL 4.0
OpenSSL 4.0 returns const pointers from X509_get_subject_name(),
X509_get_issuer_name(), X509_NAME_get_entry(), and
X509_NAME_ENTRY_get_data(). Update local variables to match.
Upstream-Status: Submitted [https://github.com/snort3/snort3/pull/477]
Signed-off-by: Jaipaul Cheernam <jaipaul.cheernam@est.tech>
---
src/protocols/ssl.cc | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/protocols/ssl.cc b/src/protocols/ssl.cc
index 733d19adf..4afac05dd 100644
--- a/src/protocols/ssl.cc
+++ b/src/protocols/ssl.cc
@@ -860,8 +860,8 @@ ParseResult parse_server_certificates(SSLV3ServerCertData* server_cert_data)
while (len > 2 and !(common_name and org_unit))
{
X509* cert = nullptr;
- X509_NAME* cert_subject = nullptr;
- X509_NAME* cert_issuer = nullptr;
+ const X509_NAME* cert_subject = nullptr;
+ const X509_NAME* cert_issuer = nullptr;
int cert_len = ntoh3(data);
data += 3;
@@ -918,8 +918,8 @@ ParseResult parse_server_certificates(SSLV3ServerCertData* server_cert_data)
lastpos = X509_NAME_get_index_by_NID(cert_subject, NID_commonName, lastpos);
if (lastpos != -1)
{
- X509_NAME_ENTRY* e = X509_NAME_get_entry(cert_subject, lastpos);
- ASN1_STRING* asn1_str = X509_NAME_ENTRY_get_data(e);
+ const X509_NAME_ENTRY* e = X509_NAME_get_entry(cert_subject, lastpos);
+ const ASN1_STRING* asn1_str = X509_NAME_ENTRY_get_data(e);
const unsigned char* str_data = ASN1_STRING_get0_data(asn1_str);
int length = ASN1_STRING_length(asn1_str);
@@ -941,8 +941,8 @@ ParseResult parse_server_certificates(SSLV3ServerCertData* server_cert_data)
lastpos = X509_NAME_get_index_by_NID(cert_subject, NID_organizationalUnitName, lastpos);
if (lastpos != -1)
{
- X509_NAME_ENTRY* e = X509_NAME_get_entry(cert_subject, lastpos);
- ASN1_STRING* asn1_str = X509_NAME_ENTRY_get_data(e);
+ const X509_NAME_ENTRY* e = X509_NAME_get_entry(cert_subject, lastpos);
+ const ASN1_STRING* asn1_str = X509_NAME_ENTRY_get_data(e);
const unsigned char* str_data = ASN1_STRING_get0_data(asn1_str);
org_unit_len = ASN1_STRING_length(asn1_str);
@@ -10,6 +10,7 @@ DEPENDS = "flex-native hwloc libdaq libdnet libpcap libpcre libtirpc libunwind l
SRC_URI = "git://github.com/snort3/snort3.git;protocol=https;branch=master;tag=${PV} \
file://0001-cmake-Check-for-HP-libunwind.patch \
file://0001-cmake-Pass-noline-flag-to-flex.patch \
file://0001-ssl-fix-const-qualifiers-for-OpenSSL-4.0.patch \
"
SRCREV = "14aeb09f5a0856812dbe08ead3c21f99e8860aa0"