Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Jun 2020 09:49:25 +0000 (UTC)
From:      Alexey Dokuchaev <danfe@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r540884 - in head/devel/ucommon: . files
Message-ID:  <202006300949.05U9nPTh088451@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: danfe
Date: Tue Jun 30 09:49:25 2020
New Revision: 540884
URL: https://svnweb.freebsd.org/changeset/ports/540884

Log:
  Allow to build against contemporary versions of OpenSSL.
  
  PR:	229027

Added:
  head/devel/ucommon/files/patch-openssl_cipher.cpp   (contents, props changed)
  head/devel/ucommon/files/patch-openssl_digest.cpp   (contents, props changed)
  head/devel/ucommon/files/patch-openssl_hmac.cpp   (contents, props changed)
Modified:
  head/devel/ucommon/Makefile

Modified: head/devel/ucommon/Makefile
==============================================================================
--- head/devel/ucommon/Makefile	Tue Jun 30 09:48:30 2020	(r540883)
+++ head/devel/ucommon/Makefile	Tue Jun 30 09:49:25 2020	(r540884)
@@ -13,23 +13,13 @@ COMMENT=	Very lightweight C++ design pattern library
 LICENSE=	LGPL3
 LICENSE_FILE=	${WRKSRC}/COPYING.LESSER
 
-BROKEN_SSL=	openssl
-BROKEN_SSL_REASON_openssl=	error: allocation of incomplete type 'EVP_CIPHER_CTX'
-
 USES=		compiler:c++11-lib cmake pathfix pkgconfig ssl
 CMAKE_ARGS=	-DBUILD_TESTING:BOOL=ON \
 		-DCMAKE_INSTALL_BINDIR:STRING=bin/${PORTNAME}
 USE_LDCONFIG=	yes
 TEST_TARGET=	test
 
-.include <bsd.port.pre.mk>
-
-.if ${SSL_DEFAULT} == base
-BROKEN_FreeBSD_12=	error: allocation of incomplete type 'EVP_CIPHER_CTX' (aka 'evp_cipher_ctx_st')
-BROKEN_FreeBSD_13=	error: allocation of incomplete type 'EVP_CIPHER_CTX' (aka 'evp_cipher_ctx_st')
-.endif
-
 post-install:
 	${INSTALL_DATA} ${BUILD_WRKSRC}/ucommon-config.h ${STAGEDIR}${PREFIX}/include/ucommon
 
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>

Added: head/devel/ucommon/files/patch-openssl_cipher.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/ucommon/files/patch-openssl_cipher.cpp	Tue Jun 30 09:49:25 2020	(r540884)
@@ -0,0 +1,28 @@
+--- openssl/cipher.cpp.orig	2015-10-11 02:32:36 UTC
++++ openssl/cipher.cpp
+@@ -107,8 +107,12 @@ void Cipher::release(void)
+ {
+     keys.clear();
+     if(context) {
++#if OPENSSL_VERSION_NUMBER >= 0x10100005L
++        EVP_CIPHER_CTX_free((EVP_CIPHER_CTX*)context);
++#else
+         EVP_CIPHER_CTX_cleanup((EVP_CIPHER_CTX*)context);
+         delete (EVP_CIPHER_CTX*)context;
++#endif
+         context = NULL;
+     }
+ }
+@@ -125,8 +129,12 @@ void Cipher::set(const key_t key, mode_t mode, uint8_t
+     if(!keys.keysize)
+         return;
+ 
++#if OPENSSL_VERSION_NUMBER >= 0x10100005L
++    context = EVP_MD_CTX_new();
++#else
+     context = new EVP_CIPHER_CTX;
+     EVP_CIPHER_CTX_init((EVP_CIPHER_CTX *)context);
++#endif
+     EVP_CipherInit_ex((EVP_CIPHER_CTX *)context, (EVP_CIPHER *)keys.algotype, NULL, keys.keybuf, keys.ivbuf, (int)mode);
+     EVP_CIPHER_CTX_set_padding((EVP_CIPHER_CTX *)context, 0);
+ }

Added: head/devel/ucommon/files/patch-openssl_digest.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/ucommon/files/patch-openssl_digest.cpp	Tue Jun 30 09:49:25 2020	(r540884)
@@ -0,0 +1,46 @@
+--- openssl/digest.cpp.orig	2015-10-11 02:32:36 UTC
++++ openssl/digest.cpp
+@@ -37,20 +37,30 @@ void Digest::set(const char *type)
+ 
+     hashtype = (void *)EVP_get_digestbyname(type);
+     if(hashtype) {
++#if OPENSSL_VERSION_NUMBER >= 0x10100005L
++        context = EVP_MD_CTX_new();
++#else
+         context = new EVP_MD_CTX;
+         EVP_MD_CTX_init((EVP_MD_CTX *)context);
++#endif
+         EVP_DigestInit_ex((EVP_MD_CTX *)context, (const EVP_MD *)hashtype, NULL);
+     }
+ }
+ 
+ void Digest::release(void)
+ {
++#if OPENSSL_VERSION_NUMBER < 0x10100005L
+     if(context)
+         EVP_MD_CTX_cleanup((EVP_MD_CTX *)context);
++#endif
+ 
+     if(context) {
++#if OPENSSL_VERSION_NUMBER >= 0x10100005L
++        EVP_MD_CTX_free((EVP_MD_CTX *)context);
++#else
+         memset(context, 0, sizeof(EVP_MD_CTX));
+         delete (EVP_MD_CTX *)context;
++#endif
+         context = NULL;
+     }
+ 
+@@ -71,8 +81,12 @@ void Digest::reset(void)
+ {
+     if(!context) {
+         if(hashtype) {
++#if OPENSSL_VERSION_NUMBER >= 0x10100005L
++            context = EVP_MD_CTX_new();
++#else
+             context = new EVP_MD_CTX;
+             EVP_MD_CTX_init((EVP_MD_CTX *)context);
++#endif
+         }
+         else
+             return;

Added: head/devel/ucommon/files/patch-openssl_hmac.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/ucommon/files/patch-openssl_hmac.cpp	Tue Jun 30 09:49:25 2020	(r540884)
@@ -0,0 +1,29 @@
+--- openssl/hmac.cpp.orig	2015-10-11 02:32:36 UTC
++++ openssl/hmac.cpp
+@@ -35,8 +35,12 @@ void HMAC::set(const char *digest, const secure::keyby
+ 
+     hmactype = EVP_get_digestbyname(digest);
+     if(hmactype && len) {
++#if OPENSSL_VERSION_NUMBER >= 0x10100005L
++        context = HMAC_CTX_new();
++#else
+         context = new ::HMAC_CTX;
+         HMAC_CTX_init((HMAC_CTX *)context);
++#endif
+         HMAC_Init((HMAC_CTX *)context, *key, (int)len, (const EVP_MD *)hmactype);
+     }
+ }
+@@ -44,9 +48,13 @@ void HMAC::set(const char *digest, const secure::keyby
+ void HMAC::release(void)
+ {
+     if(context) {
++#if OPENSSL_VERSION_NUMBER >= 0x10100005L
++        HMAC_CTX_free((HMAC_CTX *)context);
++#else
+         HMAC_cleanup((HMAC_CTX *)context);
+         memset(context, 0, sizeof(HMAC_CTX));
+         delete (HMAC_CTX *)context;
++#endif
+         context = NULL;
+     }
+ 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202006300949.05U9nPTh088451>