git: 2177ea1bb740 - main - security/libhydrogen: Add libhydrogen 0.0.0.g20240509
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 15 Sep 2024 20:15:35 UTC
The branch main has been updated by sunpoet: URL: https://cgit.FreeBSD.org/ports/commit/?id=2177ea1bb740c4021d20bb4c2c5bc2dee2581cdb commit 2177ea1bb740c4021d20bb4c2c5bc2dee2581cdb Author: Po-Chuan Hsieh <sunpoet@FreeBSD.org> AuthorDate: 2024-09-15 19:08:08 +0000 Commit: Po-Chuan Hsieh <sunpoet@FreeBSD.org> CommitDate: 2024-09-15 20:09:33 +0000 security/libhydrogen: Add libhydrogen 0.0.0.g20240509 The Hydrogen library is a small, easy-to-use, hard-to-misuse cryptographic library. Features: - Consistent high-level API, inspired by libsodium. Instead of low-level primitives, it exposes simple functions to solve common problems that cryptography can solve. - 100% built using just two cryptographic building blocks: the Curve25519 elliptic curve, and the Gimli permutation. - Small and easy to audit. Implemented as one tiny file for every set of operation, and adding a single .c file to your project is all it takes to use libhydrogen in your project. - The whole code is released under a single, very liberal license (ISC). - Zero dynamic memory allocations and low stack requirements (median: 32 bytes, max: 128 bytes). This makes it usable in constrained environments such as microcontrollers. - Portable: written in standard C99. Supports Linux, *BSD, MacOS, Windows, and the Arduino IDE out of the box. - Can generate cryptographically-secure random numbers, even on Arduino boards. - Attempts to mitigate the implications of accidental misuse, even on systems with an unreliable PRG and/or no clock. --- security/Makefile | 1 + security/libhydrogen/Makefile | 18 +++++++++++++ security/libhydrogen/distinfo | 3 +++ security/libhydrogen/files/patch-CMakeLists.txt | 36 +++++++++++++++++++++++++ security/libhydrogen/pkg-descr | 21 +++++++++++++++ security/libhydrogen/pkg-plist | 6 +++++ 6 files changed, 85 insertions(+) diff --git a/security/Makefile b/security/Makefile index 888955587526..ccd72e742840 100644 --- a/security/Makefile +++ b/security/Makefile @@ -295,6 +295,7 @@ SUBDIR += libgpg-error SUBDIR += libgsasl SUBDIR += libhijack + SUBDIR += libhydrogen SUBDIR += libident SUBDIR += libkleo SUBDIR += libkpass diff --git a/security/libhydrogen/Makefile b/security/libhydrogen/Makefile new file mode 100644 index 000000000000..0a4b7110e4b3 --- /dev/null +++ b/security/libhydrogen/Makefile @@ -0,0 +1,18 @@ +PORTNAME= libhydrogen +PORTVERSION= 0.0.0.g20240509 +CATEGORIES= security + +MAINTAINER= sunpoet@FreeBSD.org +COMMENT= Lightweight, secure, easy-to-use crypto library for constrained environments +WWW= https://github.com/jedisct1/libhydrogen + +LICENSE= ISCL +LICENSE_FILE= ${WRKSRC}/LICENSE + +USES= cmake + +USE_GITHUB= yes +GH_ACCOUNT= jedisct1 +GH_TAGNAME= c18e510 + +.include <bsd.port.mk> diff --git a/security/libhydrogen/distinfo b/security/libhydrogen/distinfo new file mode 100644 index 000000000000..3db51e90e1f1 --- /dev/null +++ b/security/libhydrogen/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1726080915 +SHA256 (jedisct1-libhydrogen-0.0.0.g20240509-c18e510_GH0.tar.gz) = 44e155d56a45cea83e7d838ad2b0c7757d83bcddff3d80663c510d77e365fc17 +SIZE (jedisct1-libhydrogen-0.0.0.g20240509-c18e510_GH0.tar.gz) = 45819 diff --git a/security/libhydrogen/files/patch-CMakeLists.txt b/security/libhydrogen/files/patch-CMakeLists.txt new file mode 100644 index 000000000000..ea713881a2a4 --- /dev/null +++ b/security/libhydrogen/files/patch-CMakeLists.txt @@ -0,0 +1,36 @@ +--- CMakeLists.txt.orig 2024-05-09 19:42:48 UTC ++++ CMakeLists.txt +@@ -89,8 +89,9 @@ set(compile_options + + # Main library + +-add_library("${PROJECT_NAME}") ++add_library("${PROJECT_NAME}" SHARED) + add_library("${PROJECT_NAME}::${PROJECT_NAME}" ALIAS "${PROJECT_NAME}") ++add_library("${PROJECT_NAME}_static" STATIC) + + target_sources("${PROJECT_NAME}" PRIVATE ${source_files}) + +@@ -100,11 +101,21 @@ target_compile_options("${PROJECT_NAME}" PRIVATE ${com + + target_compile_options("${PROJECT_NAME}" PRIVATE ${compile_options}) + ++target_sources("${PROJECT_NAME}_static" PRIVATE ${source_files}) ++ ++target_include_directories("${PROJECT_NAME}_static" ++ PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}> ++ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) ++ ++target_compile_options("${PROJECT_NAME}_static" PRIVATE ${compile_options}) ++ ++set_target_properties("${PROJECT_NAME}_static" PROPERTIES OUTPUT_NAME "${PROJECT_NAME}") ++ + # Installation + + set(targets_export_name "${PROJECT_NAME}-targets") + +-install(TARGETS "${PROJECT_NAME}" ++install(TARGETS "${PROJECT_NAME}" "${PROJECT_NAME}_static" + EXPORT "${targets_export_name}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}") diff --git a/security/libhydrogen/pkg-descr b/security/libhydrogen/pkg-descr new file mode 100644 index 000000000000..65f344c1b1a6 --- /dev/null +++ b/security/libhydrogen/pkg-descr @@ -0,0 +1,21 @@ +The Hydrogen library is a small, easy-to-use, hard-to-misuse cryptographic +library. + +Features: +- Consistent high-level API, inspired by libsodium. Instead of low-level + primitives, it exposes simple functions to solve common problems that + cryptography can solve. +- 100% built using just two cryptographic building blocks: the Curve25519 + elliptic curve, and the Gimli permutation. +- Small and easy to audit. Implemented as one tiny file for every set of + operation, and adding a single .c file to your project is all it takes to use + libhydrogen in your project. +- The whole code is released under a single, very liberal license (ISC). +- Zero dynamic memory allocations and low stack requirements (median: 32 bytes, + max: 128 bytes). This makes it usable in constrained environments such as + microcontrollers. +- Portable: written in standard C99. Supports Linux, *BSD, MacOS, Windows, and + the Arduino IDE out of the box. +- Can generate cryptographically-secure random numbers, even on Arduino boards. +- Attempts to mitigate the implications of accidental misuse, even on systems + with an unreliable PRG and/or no clock. diff --git a/security/libhydrogen/pkg-plist b/security/libhydrogen/pkg-plist new file mode 100644 index 000000000000..6c6eab7a85ee --- /dev/null +++ b/security/libhydrogen/pkg-plist @@ -0,0 +1,6 @@ +include/hydrogen.h +lib/libhydrogen.a +lib/libhydrogen.so +share/cmake/hydrogen/hydrogen-config.cmake +share/cmake/hydrogen/hydrogen-targets-%%CMAKE_BUILD_TYPE%%.cmake +share/cmake/hydrogen/hydrogen-targets.cmake