From e94d07c580641ab63b7103ab92ded89042941346 Mon Sep 17 00:00:00 2001 From: Gleb Popov Date: Sun, 7 Jan 2024 22:12:42 +0300 Subject: [PATCH] security/tpm2-pkcs11: New port Sponsored by: Serenity Cybersecurity, LLC --- security/Makefile | 1 + security/tpm2-pkcs11/Makefile | 29 +++++++++++++++++++ security/tpm2-pkcs11/distinfo | 3 ++ security/tpm2-pkcs11/files/patch-src_lib_db.c | 11 +++++++ .../tpm2-pkcs11/files/patch-src_lib_twist.c | 10 +++++++ security/tpm2-pkcs11/pkg-descr | 3 ++ security/tpm2-pkcs11/pkg-plist | 4 +++ 7 files changed, 61 insertions(+) create mode 100644 security/tpm2-pkcs11/Makefile create mode 100644 security/tpm2-pkcs11/distinfo create mode 100644 security/tpm2-pkcs11/files/patch-src_lib_db.c create mode 100644 security/tpm2-pkcs11/files/patch-src_lib_twist.c create mode 100644 security/tpm2-pkcs11/pkg-descr create mode 100644 security/tpm2-pkcs11/pkg-plist diff --git a/security/Makefile b/security/Makefile index 24e5ef2f8ead..ceb39475fa1b 100644 --- a/security/Makefile +++ b/security/Makefile @@ -1327,6 +1327,7 @@ SUBDIR += tpm-quote-tools SUBDIR += tpm-tools SUBDIR += tpm2-abrmd + SUBDIR += tpm2-pkcs11 SUBDIR += tpm2-tools SUBDIR += tpm2-tss SUBDIR += transcrypt diff --git a/security/tpm2-pkcs11/Makefile b/security/tpm2-pkcs11/Makefile new file mode 100644 index 000000000000..56d347a40460 --- /dev/null +++ b/security/tpm2-pkcs11/Makefile @@ -0,0 +1,29 @@ +PORTNAME= tpm2-pkcs11 +PORTVERSION= 1.9.0 +CATEGORIES= security +MASTER_SITES= https://github.com/tpm2-software/tpm2-pkcs11/releases/download/${PORTVERSION}/ + +MAINTAINER= arrowd@FreeBSD.org +COMMENT= PKCS\#11 interface for TPM2 hardware +WWW= https://tpm2-software.github.io/software/ + +LICENSE= BSD2CLAUSE +LICENSE_FILE= ${WRKSRC}/LICENSE + +LIB_DEPENDS= libyaml.so:textproc/libyaml \ + libtss2-esys.so:security/tpm2-tss + +USES= libtool pkgconfig sqlite:3 ssl + +GNU_CONFIGURE= yes +INSTALL_TARGET= install-strip +TEST_TARGET= check-TESTS + +OPTIONS_DEFINE= TEST + +TEST_USES= python:3.9+ +TEST_CONFIGURE_ENABLE= ptool-checks unit +TEST_LIB_DEPENDS= libcmocka.so:sysutils/cmocka +TEST_RUN_DEPENDS= dbus-run-session:devel/dbus + +.include diff --git a/security/tpm2-pkcs11/distinfo b/security/tpm2-pkcs11/distinfo new file mode 100644 index 000000000000..1ca135b2ffc3 --- /dev/null +++ b/security/tpm2-pkcs11/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1704652212 +SHA256 (tpm2-pkcs11-1.9.0.tar.gz) = 35bf06c30cfa76fc0eba2c5f503cf7dd0d34a66afb2d292fee896b90362f633b +SIZE (tpm2-pkcs11-1.9.0.tar.gz) = 1396590 diff --git a/security/tpm2-pkcs11/files/patch-src_lib_db.c b/security/tpm2-pkcs11/files/patch-src_lib_db.c new file mode 100644 index 000000000000..1dafaa2e68ba --- /dev/null +++ b/security/tpm2-pkcs11/files/patch-src_lib_db.c @@ -0,0 +1,11 @@ +--- src/lib/db.c.orig 2023-01-20 15:32:09 UTC ++++ src/lib/db.c +@@ -12,8 +12,6 @@ + #include + #include + +-#include +- + #include + #include + #include diff --git a/security/tpm2-pkcs11/files/patch-src_lib_twist.c b/security/tpm2-pkcs11/files/patch-src_lib_twist.c new file mode 100644 index 000000000000..382fc6c85f60 --- /dev/null +++ b/security/tpm2-pkcs11/files/patch-src_lib_twist.c @@ -0,0 +1,10 @@ +--- src/lib/twist.c.orig 2021-09-29 17:04:30 UTC ++++ src/lib/twist.c +@@ -2,7 +2,6 @@ + + #include + +-#include + #include + #include + #include diff --git a/security/tpm2-pkcs11/pkg-descr b/security/tpm2-pkcs11/pkg-descr new file mode 100644 index 000000000000..e8e4f820f83d --- /dev/null +++ b/security/tpm2-pkcs11/pkg-descr @@ -0,0 +1,3 @@ +PKCS #11 is a Public-Key Cryptography Standard that defines a standard method to +access cryptographic services from tokens/devices. This package allows to use +a TPM2 device as the cryptographic token. diff --git a/security/tpm2-pkcs11/pkg-plist b/security/tpm2-pkcs11/pkg-plist new file mode 100644 index 000000000000..102440d169b2 --- /dev/null +++ b/security/tpm2-pkcs11/pkg-plist @@ -0,0 +1,4 @@ +lib/libtpm2_pkcs11.so +lib/libtpm2_pkcs11.so.0 +lib/libtpm2_pkcs11.so.0.0.0 +libdata/pkgconfig/tpm2-pkcs11.pc