package/snort3: fix build with OpenSSL 4.0.0

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
Cc: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Bernd Kuhls
2026-10-06 18:20:06 +02:00
committed by Thomas Petazzoni
parent 1b3321fa8f
commit e8194b1f22

View File

@@ -0,0 +1,63 @@
From a32587b0fc22a716b70f242f7a130de003fb3b42 Mon Sep 17 00:00:00 2001
From: Jaipaul Cheernam <jaipaul.cheernam@est.tech>
Date: Thu, 27 Aug 2026 11:45:48 +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.
This is backward-compatible with older OpenSSL versions since
assigning non-const to const is always valid.
Fixes: https://github.com/snort3/snort3/issues/476
Signed-off-by: Jaipaul Cheernam <jaipaul.cheernam@est.tech>
Upstream: https://github.com/snort3/snort3/pull/477
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
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);
--
2.47.3