git: 3ebf55c3f3c6 - main - security/monocypher: NEW PORT - easy to use, deploy, auditable crypto library

From: Dave Cottlehuber <dch_at_FreeBSD.org>
Date: Mon, 17 Jul 2023 20:46:04 UTC
The branch main has been updated by dch:

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

commit 3ebf55c3f3c6f0245fc20eabd7956b4c9acb5511
Author:     Dave Cottlehuber <dch@FreeBSD.org>
AuthorDate: 2023-07-17 20:43:22 +0000
Commit:     Dave Cottlehuber <dch@FreeBSD.org>
CommitDate: 2023-07-17 20:45:41 +0000

    security/monocypher: NEW PORT - easy to use, deploy, auditable crypto library
    
    It is written in portable C, and approaches the size of TweetNaCl,
    and the speed of libsodium.
    
    Reviewed by:    zirias
    Sponsored by:   SkunkWerks, GmbH
---
 security/Makefile                        |  1 +
 security/monocypher/Makefile             | 20 ++++++++++
 security/monocypher/distinfo             |  3 ++
 security/monocypher/files/patch-makefile | 22 +++++++++++
 security/monocypher/pkg-descr            | 15 ++++++++
 security/monocypher/pkg-plist            | 66 ++++++++++++++++++++++++++++++++
 6 files changed, 127 insertions(+)

diff --git a/security/Makefile b/security/Makefile
index 1ca071f87b2e..e6b0233a393c 100644
--- a/security/Makefile
+++ b/security/Makefile
@@ -366,6 +366,7 @@
     SUBDIR += modsecurity3
     SUBDIR += modsecurity3-nginx
     SUBDIR += monkeysphere
+    SUBDIR += monocypher
     SUBDIR += munge
     SUBDIR += n2n
     SUBDIR += ncrack
diff --git a/security/monocypher/Makefile b/security/monocypher/Makefile
new file mode 100644
index 000000000000..86f5916f3566
--- /dev/null
+++ b/security/monocypher/Makefile
@@ -0,0 +1,20 @@
+PORTNAME=	monocypher
+DISTVERSION=	4.0.1
+CATEGORIES=	security
+MASTER_SITES=	https://monocypher.org/download/
+
+MAINTAINER=	dch@FreeBSD.org
+COMMENT=	Compact cryptographic library in C
+WWW=		https://monocypher.org/
+
+LICENSE=	BSD2CLAUSE
+LICENSE_FILE=	${WRKSRC}/LICENCE.md
+
+USE_CSTD=	c99
+USE_LDCONFIG=	yes
+
+MAKEFILE=	makefile
+ALL_TARGET=	all
+TEST_TARGET=	test
+
+.include <bsd.port.mk>
diff --git a/security/monocypher/distinfo b/security/monocypher/distinfo
new file mode 100644
index 000000000000..f958e5abb766
--- /dev/null
+++ b/security/monocypher/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1689253203
+SHA256 (monocypher-4.0.1.tar.gz) = 2f5796dba699cfdda5acd7721bf7df2c42e7e01d5cb843294a2a6e0a28cec0e9
+SIZE (monocypher-4.0.1.tar.gz) = 939452
diff --git a/security/monocypher/files/patch-makefile b/security/monocypher/files/patch-makefile
new file mode 100644
index 000000000000..97293d462930
--- /dev/null
+++ b/security/monocypher/files/patch-makefile
@@ -0,0 +1,22 @@
+--- makefile.orig	2023-07-17 16:11:09 UTC
++++ makefile
+@@ -52,14 +52,14 @@
+ .POSIX:
+ .SUFFIXES:
+ 
+-CC=gcc -std=c99
+-CFLAGS=-pedantic -Wall -Wextra -O3 -march=native
+-DESTDIR=
+-PREFIX=usr/local
++CC?=gcc -std=c99
++CFLAGS?=-pedantic -Wall -Wextra -O3 -march=native
++DESTDIR?=
++PREFIX?=usr/local
+ LIBDIR=$(PREFIX)/lib
+ INCLUDEDIR=$(PREFIX)/include
+ PKGCONFIGDIR=$(LIBDIR)/pkgconfig
+-MANDIR=$(PREFIX)/share/man/man3
++MANDIR?=$(PREFIX)/share/man/man3
+ SONAME=libmonocypher.so.4
+ 
+ .PHONY: all library static-library dynamic-library  \
diff --git a/security/monocypher/pkg-descr b/security/monocypher/pkg-descr
new file mode 100644
index 000000000000..94c075534ab6
--- /dev/null
+++ b/security/monocypher/pkg-descr
@@ -0,0 +1,15 @@
+Monocypher is an easy to use crypto library. It is:
+
+- Small. Sloccount counts about 1700 lines of code, small enough to
+allow audits. The binaries are under 65KB.
+
+- Easy to deploy. Just add monocypher.c and monocypher.h to your
+project. They compile as C99 or C++, have no dependency, and
+are dedicated to the public domain.
+
+- Easy to use. The API is small, consistent, and cannot fail
+on correct input.
+
+- Fast. The primitives are fast to begin with, and performance
+wasn't needlessly sacrificed. Monocypher holds up pretty well
+against Libsodium, despite being closer in size to TweetNaCl.
diff --git a/security/monocypher/pkg-plist b/security/monocypher/pkg-plist
new file mode 100644
index 000000000000..d49f542de844
--- /dev/null
+++ b/security/monocypher/pkg-plist
@@ -0,0 +1,66 @@
+include/monocypher-ed25519.h
+include/monocypher.h
+lib/libmonocypher.a
+lib/libmonocypher.so
+lib/libmonocypher.so.4
+libdata/pkgconfig/monocypher.pc
+share/man/man3/crypto_aead_init_djb.3monocypher.gz
+share/man/man3/crypto_aead_init_ietf.3monocypher.gz
+share/man/man3/crypto_aead_init_x.3monocypher.gz
+share/man/man3/crypto_aead_lock.3monocypher.gz
+share/man/man3/crypto_aead_read.3monocypher.gz
+share/man/man3/crypto_aead_unlock.3monocypher.gz
+share/man/man3/crypto_aead_write.3monocypher.gz
+share/man/man3/crypto_argon2.3monocypher.gz
+share/man/man3/crypto_blake2b_final.3monocypher.gz
+share/man/man3/crypto_blake2b_init.3monocypher.gz
+share/man/man3/crypto_blake2b_keyed_init.3monocypher.gz
+share/man/man3/crypto_blake2b_keyed.3monocypher.gz
+share/man/man3/crypto_blake2b_update.3monocypher.gz
+share/man/man3/crypto_blake2b.3monocypher.gz
+share/man/man3/crypto_chacha20_djb.3monocypher.gz
+share/man/man3/crypto_chacha20_h.3monocypher.gz
+share/man/man3/crypto_chacha20_ietf.3monocypher.gz
+share/man/man3/crypto_chacha20_x.3monocypher.gz
+share/man/man3/crypto_ed25519_check.3monocypher.gz
+share/man/man3/crypto_ed25519_key_pair.3monocypher.gz
+share/man/man3/crypto_ed25519_ph_check.3monocypher.gz
+share/man/man3/crypto_ed25519_ph_sign.3monocypher.gz
+share/man/man3/crypto_ed25519_sign.3monocypher.gz
+share/man/man3/crypto_eddsa_check_equation.3monocypher.gz
+share/man/man3/crypto_eddsa_check.3monocypher.gz
+share/man/man3/crypto_eddsa_key_pair.3monocypher.gz
+share/man/man3/crypto_eddsa_mul_add.3monocypher.gz
+share/man/man3/crypto_eddsa_reduce.3monocypher.gz
+share/man/man3/crypto_eddsa_scalarbase.3monocypher.gz
+share/man/man3/crypto_eddsa_sign.3monocypher.gz
+share/man/man3/crypto_eddsa_to_x25519.3monocypher.gz
+share/man/man3/crypto_eddsa_trim_scalar.3monocypher.gz
+share/man/man3/crypto_elligator_key_pair.3monocypher.gz
+share/man/man3/crypto_elligator_map.3monocypher.gz
+share/man/man3/crypto_elligator_rev.3monocypher.gz
+share/man/man3/crypto_poly1305_final.3monocypher.gz
+share/man/man3/crypto_poly1305_init.3monocypher.gz
+share/man/man3/crypto_poly1305_update.3monocypher.gz
+share/man/man3/crypto_poly1305.3monocypher.gz
+share/man/man3/crypto_sha512_final.3monocypher.gz
+share/man/man3/crypto_sha512_hkdf_expand.3monocypher.gz
+share/man/man3/crypto_sha512_hkdf.3monocypher.gz
+share/man/man3/crypto_sha512_hmac_final.3monocypher.gz
+share/man/man3/crypto_sha512_hmac_init.3monocypher.gz
+share/man/man3/crypto_sha512_hmac_update.3monocypher.gz
+share/man/man3/crypto_sha512_hmac.3monocypher.gz
+share/man/man3/crypto_sha512_init.3monocypher.gz
+share/man/man3/crypto_sha512_update.3monocypher.gz
+share/man/man3/crypto_sha512.3monocypher.gz
+share/man/man3/crypto_verify16.3monocypher.gz
+share/man/man3/crypto_verify32.3monocypher.gz
+share/man/man3/crypto_verify64.3monocypher.gz
+share/man/man3/crypto_wipe.3monocypher.gz
+share/man/man3/crypto_x25519_dirty_fast.3monocypher.gz
+share/man/man3/crypto_x25519_dirty_small.3monocypher.gz
+share/man/man3/crypto_x25519_inverse.3monocypher.gz
+share/man/man3/crypto_x25519_public_key.3monocypher.gz
+share/man/man3/crypto_x25519_to_eddsa.3monocypher.gz
+share/man/man3/crypto_x25519.3monocypher.gz
+share/man/man3/intro.3monocypher.gz