git: 003fde6b296d - main - devel/gdcm: Fix build when with LibreSSL 3.8.2.

From: Stephen Montgomery-Smith <stephen_at_FreeBSD.org>
Date: Thu, 07 Dec 2023 05:48:23 UTC
The branch main has been updated by stephen:

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

commit 003fde6b296d6047db112bb72e2f7a7eb794c4e8
Author:     Stephen Montgomery-Smith <stephen@FreeBSD.org>
AuthorDate: 2023-12-07 05:44:17 +0000
Commit:     Stephen Montgomery-Smith <stephen@FreeBSD.org>
CommitDate: 2023-12-07 05:44:17 +0000

    devel/gdcm: Fix build when with LibreSSL 3.8.2.
    
    gdcm uses the BUF_memdup() function which was removed from LibreSSL.
    Attached patch adds a local copy when built with LibreSSL.
    
    PR:             275568
    Reported by:    zirias@
---
 ...ommon_gdcmOpenSSLCryptographicMessageSyntax.cxx | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/devel/gdcm/files/patch-Source_Common_gdcmOpenSSLCryptographicMessageSyntax.cxx b/devel/gdcm/files/patch-Source_Common_gdcmOpenSSLCryptographicMessageSyntax.cxx
new file mode 100644
index 000000000000..200f9919ba73
--- /dev/null
+++ b/devel/gdcm/files/patch-Source_Common_gdcmOpenSSLCryptographicMessageSyntax.cxx
@@ -0,0 +1,25 @@
+--- Source/Common/gdcmOpenSSLCryptographicMessageSyntax.cxx.orig	2023-12-04 07:33:11 UTC
++++ Source/Common/gdcmOpenSSLCryptographicMessageSyntax.cxx
+@@ -24,6 +24,22 @@
+ #include <openssl/err.h>
+ #include <openssl/rand.h>
+ 
++#if LIBRESSL_VERSION_NUMBER >= 0x3080200fL
++// implementation copied from LibreSSL before removal in 3.8.2
++static void *BUF_memdup(const void *data, size_t siz)
++{
++  void *ret = NULL;
++  if (data != NULL)
++    {
++    if ((ret = malloc(siz)) == NULL)
++      ERR_PUT_error(ERR_LIB_BUF,(0xfff),ERR_R_MALLOC_FAILURE,__FILE__,__LINE__);
++    else
++      (void) memcpy(ret, data, siz);
++    }
++  return ret;
++}
++#endif
++
+ namespace gdcm
+ {
+