git: e7fe6916018d - main - security/hexl: New port: Intel homomorphic encryption acceleration library

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Thu, 07 Oct 2021 08:28:45 UTC
The branch main has been updated by yuri:

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

commit e7fe6916018d9844573d2f9d89dace13ceefe461
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2021-10-07 08:10:04 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2021-10-07 08:27:36 +0000

    security/hexl: New port: Intel homomorphic encryption acceleration library
---
 security/Makefile                        |  1 +
 security/hexl/Makefile                   | 25 +++++++++++++++++++++++++
 security/hexl/distinfo                   |  3 +++
 security/hexl/files/patch-CMakeLists.txt | 30 ++++++++++++++++++++++++++++++
 security/hexl/pkg-descr                  |  7 +++++++
 security/hexl/pkg-plist                  | 30 ++++++++++++++++++++++++++++++
 6 files changed, 96 insertions(+)

diff --git a/security/Makefile b/security/Makefile
index aa842b5ac059..98f6bbbffe3c 100644
--- a/security/Makefile
+++ b/security/Makefile
@@ -221,6 +221,7 @@
     SUBDIR += heaan
     SUBDIR += heimdal
     SUBDIR += helib
+    SUBDIR += hexl
     SUBDIR += highwayhash
     SUBDIR += hitch
     SUBDIR += hlfl
diff --git a/security/hexl/Makefile b/security/hexl/Makefile
new file mode 100644
index 000000000000..ed5783fdf134
--- /dev/null
+++ b/security/hexl/Makefile
@@ -0,0 +1,25 @@
+PORTNAME=	hexl
+DISTVERSIONPREFIX=	v
+DISTVERSION=	1.2.1
+CATEGORIES=	security
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	Intel homomorphic encryption acceleration library
+
+LICENSE=	APACHE20
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+LIB_DEPENDS=	libcpu_features.so:devel/cpu_features
+
+USES=		cmake:testing compiler:c++11-lang localbase:ldflags
+USE_LDCONFIG=	yes
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	intel
+
+CMAKE_ON=		HEXL_SHARED_LIB
+CMAKE_OFF=		HEXL_BENCHMARK HEXL_TESTING
+CMAKE_TESTING_ON=	HEXL_TESTING
+CMAKE_TESTING_TARGET=	unittest
+
+.include <bsd.port.mk>
diff --git a/security/hexl/distinfo b/security/hexl/distinfo
new file mode 100644
index 000000000000..9fc5ab39df92
--- /dev/null
+++ b/security/hexl/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1633592608
+SHA256 (intel-hexl-v1.2.1_GH0.tar.gz) = d09f4bf5309f4fa13f0046475f77e8c5a065d7b9c726eba2d3d943fc13cdae1a
+SIZE (intel-hexl-v1.2.1_GH0.tar.gz) = 94892
diff --git a/security/hexl/files/patch-CMakeLists.txt b/security/hexl/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..aff9c395dc11
--- /dev/null
+++ b/security/hexl/files/patch-CMakeLists.txt
@@ -0,0 +1,30 @@
+- workaround for hexl's failure to find cpu_features
+
+--- CMakeLists.txt.orig	2021-10-07 07:53:10 UTC
++++ CMakeLists.txt
+@@ -137,17 +137,17 @@ message(STATUS "CMAKE_INSTALL_PREFIX:     ${CMAKE_INST
+ #------------------------------------------------------------------------------
+ # Third-party code...
+ #------------------------------------------------------------------------------
+-find_package(CpuFeatures CONFIG)
+-if (NOT CpuFeatures_FOUND)
++#find_package(CpuFeatures CONFIG)
++if (FALSE AND NOT CpuFeatures_FOUND)
+   message(STATUS "CpuFeatures: pre-installed CpuFeatures not found")
+   add_subdirectory(cmake/third-party/cpu-features)
+ else()
+-  message(STATUS "CpuFeatures: found")
+-  add_library(cpu_features ALIAS CpuFeatures::cpu_features)
+-  get_target_property(
+-    CpuFeatures_INCLUDE_DIR
+-    CpuFeatures::cpu_features
+-    INTERFACE_INCLUDE_DIRECTORIES)
++#  message(STATUS "CpuFeatures: found")
++#  add_library(cpu_features ALIAS CpuFeatures::cpu_features)
++#  get_target_property(
++#    CpuFeatures_INCLUDE_DIR
++#    CpuFeatures::cpu_features
++#    INTERFACE_INCLUDE_DIRECTORIES)
+ endif()
+ 
+ if (HEXL_TESTING OR HEXL_BENCHMARK OR HEXL_DEBUG)
diff --git a/security/hexl/pkg-descr b/security/hexl/pkg-descr
new file mode 100644
index 000000000000..fe3a801da123
--- /dev/null
+++ b/security/hexl/pkg-descr
@@ -0,0 +1,7 @@
+Intel HEXL is an open-source library which provides efficient implementations of
+integer arithmetic on Galois fields. Such arithmetic is prevalent in
+cryptography, particularly in homomorphic encryption (HE) schemes. Intel HEXL
+targets integer arithmetic with word-sized primes, typically 30-60 bits. Intel
+HEXL provides an API for 64-bit unsigned integers and targets Intel CPUs.
+
+WWW: https://intel.github.io/hexl/v1.2.1/doxygen/html/index.html
diff --git a/security/hexl/pkg-plist b/security/hexl/pkg-plist
new file mode 100644
index 000000000000..6efd07adc1ad
--- /dev/null
+++ b/security/hexl/pkg-plist
@@ -0,0 +1,30 @@
+include/hexl/eltwise/eltwise-add-mod.hpp
+include/hexl/eltwise/eltwise-cmp-add.hpp
+include/hexl/eltwise/eltwise-cmp-sub-mod.hpp
+include/hexl/eltwise/eltwise-fma-mod.hpp
+include/hexl/eltwise/eltwise-mult-mod.hpp
+include/hexl/eltwise/eltwise-reduce-mod.hpp
+include/hexl/eltwise/eltwise-sub-mod.hpp
+include/hexl/experimental/seal/ckks-multiply.hpp
+include/hexl/experimental/seal/ckks-switch-key.hpp
+include/hexl/hexl.hpp
+include/hexl/logging/logging.hpp
+include/hexl/ntt/ntt.hpp
+include/hexl/number-theory/number-theory.hpp
+include/hexl/util/aligned-allocator.hpp
+include/hexl/util/allocator.hpp
+include/hexl/util/check.hpp
+include/hexl/util/clang.hpp
+include/hexl/util/compiler.hpp
+include/hexl/util/defines.hpp
+include/hexl/util/gcc.hpp
+include/hexl/util/msvc.hpp
+include/hexl/util/types.hpp
+include/hexl/util/util.hpp
+lib/cmake/hexl-1.2.1/HEXLConfig.cmake
+lib/cmake/hexl-1.2.1/HEXLConfigVersion.cmake
+lib/cmake/hexl-1.2.1/HEXLTargets-%%CMAKE_BUILD_TYPE%%.cmake
+lib/cmake/hexl-1.2.1/HEXLTargets.cmake
+lib/libhexl.so
+lib/libhexl.so.1.2.1
+libdata/pkgconfig/hexl.pc