summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Bar-Lev <alonbl@gentoo.org>2019-01-04 10:36:03 +0200
committerAlon Bar-Lev <alonbl@gentoo.org>2019-01-04 10:37:02 +0200
commita66b106e25440d56b008371c60cb347c6fc62fe7 (patch)
treee40fd46bc1fe8654e0ec4d034e45a71738b05226 /app-crypt
parentmedia-libs/libsoundtouch: version bump to 2.1.1 (diff)
downloadgentoo-a66b106e25440d56b008371c60cb347c6fc62fe7.tar.gz
gentoo-a66b106e25440d56b008371c60cb347c6fc62fe7.tar.bz2
gentoo-a66b106e25440d56b008371c60cb347c6fc62fe7.zip
app-crypt/tpm2-tools: fix libressl support
Closes: https://bugs.gentoo.org/show_bug.cgi?id=674158 Thanks: Toralf Förster Signed-off-by: Alon Bar-Lev <alonbl@gentoo.org> Package-Manager: Portage-2.3.51, Repoman-2.3.11
Diffstat (limited to 'app-crypt')
-rw-r--r--app-crypt/tpm2-tools/files/tpm2-tools-3.1.3-libressl.patch81
-rw-r--r--app-crypt/tpm2-tools/tpm2-tools-3.1.3.ebuild6
2 files changed, 86 insertions, 1 deletions
diff --git a/app-crypt/tpm2-tools/files/tpm2-tools-3.1.3-libressl.patch b/app-crypt/tpm2-tools/files/tpm2-tools-3.1.3-libressl.patch
new file mode 100644
index 000000000000..7c26d6e14f8c
--- /dev/null
+++ b/app-crypt/tpm2-tools/files/tpm2-tools-3.1.3-libressl.patch
@@ -0,0 +1,81 @@
+From a3447989483e09638e6ebeab7eabe6273aa5f3db Mon Sep 17 00:00:00 2001
+From: Alon Bar-Lev <alon.barlev@gmail.com>
+Date: Fri, 4 Jan 2019 10:33:15 +0200
+Subject: [PATCH] build: fixup libressl support and add libressl-2.7
+
+Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
+Backport: 5d4cc4ee
+---
+ lib/conversion.c | 6 +++++-
+ lib/tpm_kdfa.c | 10 +++++++---
+ 2 files changed, 12 insertions(+), 4 deletions(-)
+
+diff --git a/lib/conversion.c b/lib/conversion.c
+index ce0f5b3..f55af6f 100644
+--- a/lib/conversion.c
++++ b/lib/conversion.c
+@@ -45,6 +45,10 @@
+ #include "tpm2_alg_util.h"
+ #include "tpm2_util.h"
+
++#if (OPENSSL_VERSION_NUMBER < 0x1010000fL && !defined(LIBRESSL_VERSION_NUMBER)) || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L) /* OpenSSL 1.1.0 */
++#define LIB_TPM2_OPENSSL_OPENSSL_PRE11
++#endif
++
+ static bool tpm2_convert_pubkey_ssl(TPMT_PUBLIC *public, pubkey_format format, const char *path);
+
+ pubkey_format tpm2_parse_pubkey_format(const char *label) {
+@@ -134,7 +138,7 @@ static bool tpm2_convert_pubkey_ssl(TPMT_PUBLIC *public, pubkey_format format, c
+ goto error;
+ }
+
+-#if OPENSSL_VERSION_NUMBER < 0x1010000fL /* OpenSSL 1.1.0 */
++#if defined(LIB_TPM2_OPENSSL_OPENSSL_PRE11)
+ ssl_rsa_key->e = e;
+ ssl_rsa_key->n = n;
+ #else
+diff --git a/lib/tpm_kdfa.c b/lib/tpm_kdfa.c
+index 3d1ed50..fc03af8 100644
+--- a/lib/tpm_kdfa.c
++++ b/lib/tpm_kdfa.c
+@@ -34,6 +34,10 @@
+ #include "log.h"
+ #include "tpm2_util.h"
+
++#if (OPENSSL_VERSION_NUMBER < 0x1010000fL && !defined(LIBRESSL_VERSION_NUMBER)) || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L) /* OpenSSL 1.1.0 */
++#define LIB_TPM2_OPENSSL_OPENSSL_PRE11
++#endif
++
+ static const EVP_MD *tpm_algorithm_to_openssl_digest(TPMI_ALG_HASH algorithm) {
+
+ switch(algorithm) {
+@@ -54,7 +58,7 @@ static const EVP_MD *tpm_algorithm_to_openssl_digest(TPMI_ALG_HASH algorithm) {
+ static HMAC_CTX *hmac_alloc()
+ {
+ HMAC_CTX *ctx;
+-#if OPENSSL_VERSION_NUMBER < 0x1010000fL /* OpenSSL 1.1.0 */
++#if defined(LIB_TPM2_OPENSSL_OPENSSL_PRE11)
+ ctx = malloc(sizeof(*ctx));
+ #else
+ ctx = HMAC_CTX_new();
+@@ -62,7 +66,7 @@ static HMAC_CTX *hmac_alloc()
+ if (!ctx)
+ return NULL;
+
+-#if OPENSSL_VERSION_NUMBER < 0x1010000fL
++#if defined(LIB_TPM2_OPENSSL_OPENSSL_PRE11)
+ HMAC_CTX_init(ctx);
+ #endif
+
+@@ -71,7 +75,7 @@ static HMAC_CTX *hmac_alloc()
+
+ static void hmac_del(HMAC_CTX *ctx)
+ {
+-#if OPENSSL_VERSION_NUMBER < 0x1010000fL
++#if defined(LIB_TPM2_OPENSSL_OPENSSL_PRE11)
+ HMAC_CTX_cleanup(ctx);
+ free(ctx);
+ #else
+--
+2.19.2
+
diff --git a/app-crypt/tpm2-tools/tpm2-tools-3.1.3.ebuild b/app-crypt/tpm2-tools/tpm2-tools-3.1.3.ebuild
index a23c0b4d9a6a..df27445aa2b5 100644
--- a/app-crypt/tpm2-tools/tpm2-tools-3.1.3.ebuild
+++ b/app-crypt/tpm2-tools/tpm2-tools-3.1.3.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Authors
+# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
@@ -20,6 +20,10 @@ DEPEND="${RDEPEND}
test? ( dev-util/cmocka )"
BDEPEND="virtual/pkgconfig"
+PATCHES=(
+ "${FILESDIR}/${P}-libressl.patch"
+)
+
src_configure() {
econf \
--disable-hardening \