Gentoo Archives: gentoo-commits

From: Alon Bar-Lev <alonbl@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-crypt/tpm2-tools/, app-crypt/tpm2-tools/files/
Date: Fri, 04 Jan 2019 08:37:21
Message-Id: 1546591022.a66b106e25440d56b008371c60cb347c6fc62fe7.alonbl@gentoo
1 commit: a66b106e25440d56b008371c60cb347c6fc62fe7
2 Author: Alon Bar-Lev <alonbl <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jan 4 08:36:03 2019 +0000
4 Commit: Alon Bar-Lev <alonbl <AT> gentoo <DOT> org>
5 CommitDate: Fri Jan 4 08:37:02 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a66b106e
7
8 app-crypt/tpm2-tools: fix libressl support
9
10 Closes: https://bugs.gentoo.org/show_bug.cgi?id=674158
11 Thanks: Toralf Förster
12 Signed-off-by: Alon Bar-Lev <alonbl <AT> gentoo.org>
13 Package-Manager: Portage-2.3.51, Repoman-2.3.11
14
15 .../files/tpm2-tools-3.1.3-libressl.patch | 81 ++++++++++++++++++++++
16 app-crypt/tpm2-tools/tpm2-tools-3.1.3.ebuild | 6 +-
17 2 files changed, 86 insertions(+), 1 deletion(-)
18
19 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
20 new file mode 100644
21 index 00000000000..7c26d6e14f8
22 --- /dev/null
23 +++ b/app-crypt/tpm2-tools/files/tpm2-tools-3.1.3-libressl.patch
24 @@ -0,0 +1,81 @@
25 +From a3447989483e09638e6ebeab7eabe6273aa5f3db Mon Sep 17 00:00:00 2001
26 +From: Alon Bar-Lev <alon.barlev@×××××.com>
27 +Date: Fri, 4 Jan 2019 10:33:15 +0200
28 +Subject: [PATCH] build: fixup libressl support and add libressl-2.7
29 +
30 +Signed-off-by: Alon Bar-Lev <alon.barlev@×××××.com>
31 +Backport: 5d4cc4ee
32 +---
33 + lib/conversion.c | 6 +++++-
34 + lib/tpm_kdfa.c | 10 +++++++---
35 + 2 files changed, 12 insertions(+), 4 deletions(-)
36 +
37 +diff --git a/lib/conversion.c b/lib/conversion.c
38 +index ce0f5b3..f55af6f 100644
39 +--- a/lib/conversion.c
40 ++++ b/lib/conversion.c
41 +@@ -45,6 +45,10 @@
42 + #include "tpm2_alg_util.h"
43 + #include "tpm2_util.h"
44 +
45 ++#if (OPENSSL_VERSION_NUMBER < 0x1010000fL && !defined(LIBRESSL_VERSION_NUMBER)) || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L) /* OpenSSL 1.1.0 */
46 ++#define LIB_TPM2_OPENSSL_OPENSSL_PRE11
47 ++#endif
48 ++
49 + static bool tpm2_convert_pubkey_ssl(TPMT_PUBLIC *public, pubkey_format format, const char *path);
50 +
51 + pubkey_format tpm2_parse_pubkey_format(const char *label) {
52 +@@ -134,7 +138,7 @@ static bool tpm2_convert_pubkey_ssl(TPMT_PUBLIC *public, pubkey_format format, c
53 + goto error;
54 + }
55 +
56 +-#if OPENSSL_VERSION_NUMBER < 0x1010000fL /* OpenSSL 1.1.0 */
57 ++#if defined(LIB_TPM2_OPENSSL_OPENSSL_PRE11)
58 + ssl_rsa_key->e = e;
59 + ssl_rsa_key->n = n;
60 + #else
61 +diff --git a/lib/tpm_kdfa.c b/lib/tpm_kdfa.c
62 +index 3d1ed50..fc03af8 100644
63 +--- a/lib/tpm_kdfa.c
64 ++++ b/lib/tpm_kdfa.c
65 +@@ -34,6 +34,10 @@
66 + #include "log.h"
67 + #include "tpm2_util.h"
68 +
69 ++#if (OPENSSL_VERSION_NUMBER < 0x1010000fL && !defined(LIBRESSL_VERSION_NUMBER)) || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L) /* OpenSSL 1.1.0 */
70 ++#define LIB_TPM2_OPENSSL_OPENSSL_PRE11
71 ++#endif
72 ++
73 + static const EVP_MD *tpm_algorithm_to_openssl_digest(TPMI_ALG_HASH algorithm) {
74 +
75 + switch(algorithm) {
76 +@@ -54,7 +58,7 @@ static const EVP_MD *tpm_algorithm_to_openssl_digest(TPMI_ALG_HASH algorithm) {
77 + static HMAC_CTX *hmac_alloc()
78 + {
79 + HMAC_CTX *ctx;
80 +-#if OPENSSL_VERSION_NUMBER < 0x1010000fL /* OpenSSL 1.1.0 */
81 ++#if defined(LIB_TPM2_OPENSSL_OPENSSL_PRE11)
82 + ctx = malloc(sizeof(*ctx));
83 + #else
84 + ctx = HMAC_CTX_new();
85 +@@ -62,7 +66,7 @@ static HMAC_CTX *hmac_alloc()
86 + if (!ctx)
87 + return NULL;
88 +
89 +-#if OPENSSL_VERSION_NUMBER < 0x1010000fL
90 ++#if defined(LIB_TPM2_OPENSSL_OPENSSL_PRE11)
91 + HMAC_CTX_init(ctx);
92 + #endif
93 +
94 +@@ -71,7 +75,7 @@ static HMAC_CTX *hmac_alloc()
95 +
96 + static void hmac_del(HMAC_CTX *ctx)
97 + {
98 +-#if OPENSSL_VERSION_NUMBER < 0x1010000fL
99 ++#if defined(LIB_TPM2_OPENSSL_OPENSSL_PRE11)
100 + HMAC_CTX_cleanup(ctx);
101 + free(ctx);
102 + #else
103 +--
104 +2.19.2
105 +
106
107 diff --git a/app-crypt/tpm2-tools/tpm2-tools-3.1.3.ebuild b/app-crypt/tpm2-tools/tpm2-tools-3.1.3.ebuild
108 index a23c0b4d9a6..df27445aa2b 100644
109 --- a/app-crypt/tpm2-tools/tpm2-tools-3.1.3.ebuild
110 +++ b/app-crypt/tpm2-tools/tpm2-tools-3.1.3.ebuild
111 @@ -1,4 +1,4 @@
112 -# Copyright 1999-2018 Gentoo Authors
113 +# Copyright 1999-2019 Gentoo Authors
114 # Distributed under the terms of the GNU General Public License v2
115
116 EAPI=7
117 @@ -20,6 +20,10 @@ DEPEND="${RDEPEND}
118 test? ( dev-util/cmocka )"
119 BDEPEND="virtual/pkgconfig"
120
121 +PATCHES=(
122 + "${FILESDIR}/${P}-libressl.patch"
123 +)
124 +
125 src_configure() {
126 econf \
127 --disable-hardening \