git: c98084fc137f - main - security/nmap: Add LibreSSL support

From: Cy Schubert <cy_at_FreeBSD.org>
Date: Wed, 28 Sep 2022 15:54:37 UTC
The branch main has been updated by cy:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c98084fc137f5a45e08162123f0642ad626d7f74

commit c98084fc137f5a45e08162123f0642ad626d7f74
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2022-09-28 15:25:20 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2022-09-28 15:54:31 +0000

    security/nmap: Add LibreSSL support
    
    PR:             266623
    Submitted by:   takefu@airport.fm
    Reported by:    takefu@airport.fm
---
 security/nmap/files/patch-libssh2_src_openssl.h | 14 ++++++++++++++
 security/nmap/files/patch-ncat__ncat_ssl.c      | 13 +++++++++++++
 security/nmap/files/patch-nping_Crypto.cc       | 13 +++++++++++++
 security/nmap/files/patch-nse__openssl.cc       | 13 +++++++++++++
 security/nmap/files/patch-nse__ssl__cert.cc     | 13 +++++++++++++
 5 files changed, 66 insertions(+)

diff --git a/security/nmap/files/patch-libssh2_src_openssl.h b/security/nmap/files/patch-libssh2_src_openssl.h
new file mode 100644
index 000000000000..a43c568b30cb
--- /dev/null
+++ b/security/nmap/files/patch-libssh2_src_openssl.h
@@ -0,0 +1,14 @@
+--- libssh2/src/openssl.h.orig	2022-06-29 20:40:29 UTC
++++ libssh2/src/openssl.h
+@@ -57,8 +57,9 @@
+ #include <openssl/pem.h>
+ #include <openssl/rand.h>
+ 
+-#if OPENSSL_VERSION_NUMBER >= 0x10100000L && \
+-    !defined(LIBRESSL_VERSION_NUMBER)
++#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && \
++    ((!defined LIBRESSL_VERSION_NUMBER) || \
++    (defined LIBRESSL_VERSION_NUMBER && LIBRESSL_VERSION_NUMBER >= 0x30500000L))
+ # define HAVE_OPAQUE_STRUCTS 1
+ #endif
+ 
diff --git a/security/nmap/files/patch-ncat__ncat_ssl.c b/security/nmap/files/patch-ncat__ncat_ssl.c
new file mode 100644
index 000000000000..59468e4b465b
--- /dev/null
+++ b/security/nmap/files/patch-ncat__ncat_ssl.c
@@ -0,0 +1,13 @@
+--- ncat/ncat_ssl.c.orig	2022-08-29 17:09:47 UTC
++++ ncat/ncat_ssl.c
+@@ -73,7 +73,9 @@
+ #include <openssl/x509.h>
+ #include <openssl/x509v3.h>
+ 
+-#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined LIBRESSL_VERSION_NUMBER
++#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && \
++    ((!defined LIBRESSL_VERSION_NUMBER) || \
++    (defined LIBRESSL_VERSION_NUMBER && LIBRESSL_VERSION_NUMBER >= 0x30500000L))
+ #define HAVE_OPAQUE_STRUCTS 1
+ #define FUNC_ASN1_STRING_data ASN1_STRING_get0_data
+ #else
diff --git a/security/nmap/files/patch-nping_Crypto.cc b/security/nmap/files/patch-nping_Crypto.cc
new file mode 100644
index 000000000000..c234e6c8d6cf
--- /dev/null
+++ b/security/nmap/files/patch-nping_Crypto.cc
@@ -0,0 +1,13 @@
+--- nping/Crypto.cc.orig	2022-02-18 17:38:46 UTC
++++ nping/Crypto.cc
+@@ -70,7 +70,9 @@
+ #include <openssl/evp.h>
+ #include <openssl/err.h>
+ 
+-#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined LIBRESSL_VERSION_NUMBER
++#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && \
++    ((!defined LIBRESSL_VERSION_NUMBER) || \
++    (defined LIBRESSL_VERSION_NUMBER && LIBRESSL_VERSION_NUMBER >= 0x30500000L))
+ #define HAVE_OPAQUE_EVP_PKEY 1
+ #define FUNC_EVP_MD_CTX_init EVP_MD_CTX_reset
+ #define FUNC_EVP_MD_CTX_cleanup EVP_MD_CTX_reset
diff --git a/security/nmap/files/patch-nse__openssl.cc b/security/nmap/files/patch-nse__openssl.cc
new file mode 100644
index 000000000000..43474fefa8b6
--- /dev/null
+++ b/security/nmap/files/patch-nse__openssl.cc
@@ -0,0 +1,13 @@
+--- nse_openssl.cc.orig	2022-09-01 22:22:29 UTC
++++ nse_openssl.cc
+@@ -13,7 +13,9 @@
+ #include <openssl/hmac.h>
+ #include <openssl/rand.h>
+ 
+-#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined LIBRESSL_VERSION_NUMBER
++#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && \
++    ((!defined LIBRESSL_VERSION_NUMBER) || \
++    (defined LIBRESSL_VERSION_NUMBER && LIBRESSL_VERSION_NUMBER >= 0x30500000L))
+ #define HAVE_OPAQUE_STRUCTS 1
+ #define FUNC_EVP_MD_CTX_init EVP_MD_CTX_reset
+ #define FUNC_EVP_MD_CTX_cleanup EVP_MD_CTX_reset
diff --git a/security/nmap/files/patch-nse__ssl__cert.cc b/security/nmap/files/patch-nse__ssl__cert.cc
new file mode 100644
index 000000000000..3f02236bb5af
--- /dev/null
+++ b/security/nmap/files/patch-nse__ssl__cert.cc
@@ -0,0 +1,13 @@
+--- nse_ssl_cert.cc.orig	2022-08-31 13:43:38 UTC
++++ nse_ssl_cert.cc
+@@ -80,7 +80,9 @@
+ #include <openssl/evp.h>
+ #include <openssl/err.h>
+ 
+-#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined LIBRESSL_VERSION_NUMBER
++#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && \
++    ((!defined LIBRESSL_VERSION_NUMBER) || \
++    (defined LIBRESSL_VERSION_NUMBER && LIBRESSL_VERSION_NUMBER >= 0x30500000L))
+ /* Technically some of these things were added in 0x10100006
+  * but that was pre-release. */
+ #define HAVE_OPAQUE_STRUCTS 1