1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-18 00:10:04 +00:00

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.
This commit is contained in:
Po-Chuan Hsieh 2024-09-16 03:08:08 +08:00
parent 9bcaea9b3c
commit 2177ea1bb7
No known key found for this signature in database
GPG Key ID: 9A4BD10F002DD04B
6 changed files with 85 additions and 0 deletions

View File

@ -295,6 +295,7 @@
SUBDIR += libgpg-error
SUBDIR += libgsasl
SUBDIR += libhijack
SUBDIR += libhydrogen
SUBDIR += libident
SUBDIR += libkleo
SUBDIR += libkpass

View File

@ -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>

View File

@ -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

View File

@ -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}")

View File

@ -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.

View File

@ -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