Gentoo Archives: gentoo-commits

From: David Seifert <soap@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/openpace/, dev-libs/openpace/files/
Date: Fri, 23 Sep 2022 10:00:34
Message-Id: 1663927220.74eda8cbca56e0d786fef6caf55ce318ad9d701a.soap@gentoo
1 commit: 74eda8cbca56e0d786fef6caf55ce318ad9d701a
2 Author: David Seifert <soap <AT> gentoo <DOT> org>
3 AuthorDate: Fri Sep 23 10:00:20 2022 +0000
4 Commit: David Seifert <soap <AT> gentoo <DOT> org>
5 CommitDate: Fri Sep 23 10:00:20 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=74eda8cb
7
8 dev-libs/openpace: new package, add 1.1.2
9
10 Bug: https://bugs.gentoo.org/861545
11 Signed-off-by: David Seifert <soap <AT> gentoo.org>
12
13 dev-libs/openpace/Manifest | 1 +
14 .../files/openpace-1.1.2-openssl-3.0.patch | 76 ++++++++++++++++++++++
15 .../openpace/files/openpace-1.1.2-openssl.patch | 25 +++++++
16 dev-libs/openpace/metadata.xml | 11 ++++
17 dev-libs/openpace/openpace-1.1.2.ebuild | 51 +++++++++++++++
18 5 files changed, 164 insertions(+)
19
20 diff --git a/dev-libs/openpace/Manifest b/dev-libs/openpace/Manifest
21 new file mode 100644
22 index 000000000000..6354998f89d6
23 --- /dev/null
24 +++ b/dev-libs/openpace/Manifest
25 @@ -0,0 +1 @@
26 +DIST openpace-1.1.2.tar.gz 3040254 BLAKE2B 4320b0ec01e80379f8c6b1812af6e7b09a8305a448caf432735554d05380b2f29133e92bffab62ad31077c410eceb5d0c68d65343394ebc24aa92dbefe321549 SHA512 812852300cee2ba021809b6c1caa686ecb7fe3eb23bcc7f4c0ce34258460f685bd70027f62f046643710bc549c0037af80d26d7089dd71341818ec7ec1db8d94
27
28 diff --git a/dev-libs/openpace/files/openpace-1.1.2-openssl-3.0.patch b/dev-libs/openpace/files/openpace-1.1.2-openssl-3.0.patch
29 new file mode 100644
30 index 000000000000..d2ac244a1a7d
31 --- /dev/null
32 +++ b/dev-libs/openpace/files/openpace-1.1.2-openssl-3.0.patch
33 @@ -0,0 +1,76 @@
34 +From 2d94a152dd36543d2a713f1abe20717fdaafae0a Mon Sep 17 00:00:00 2001
35 +From: Frank Morgner <frankmorgner@×××××.com>
36 +Date: Sat, 18 Dec 2021 00:15:04 +0100
37 +Subject: [PATCH] added basic compatibility with OpenSSL 3.0
38 +
39 +deprecated warnings are not handled for now
40 +
41 +fixes https://github.com/frankmorgner/openpace/issues/53
42 +---
43 + src/eac/cv_cert.h | 6 +++++-
44 + src/eac_util.c | 14 ++++++++++++++
45 + 2 files changed, 19 insertions(+), 1 deletion(-)
46 +
47 +diff --git a/src/eac/cv_cert.h b/src/eac/cv_cert.h
48 +index f8c6565..595eb9c 100644
49 +--- a/src/eac/cv_cert.h
50 ++++ b/src/eac/cv_cert.h
51 +@@ -341,7 +341,11 @@ CVC_CERT *CVC_d2i_CVC_CERT(CVC_CERT **cert, const unsigned char **in, long len);
52 + * @return Number of bytes successfully encoded or a negative value if an
53 + * error occured.
54 + */
55 +-int i2d_CVC_CERT(CVC_CERT *a, unsigned char **out);
56 ++int i2d_CVC_CERT(
57 ++#if OPENSSL_VERSION_NUMBER >= 0x30000000L
58 ++ const
59 ++#endif
60 ++ CVC_CERT *a, unsigned char **out);
61 +
62 + /**
63 + * @brief Duplicate a CV certificate
64 +diff --git a/src/eac_util.c b/src/eac_util.c
65 +index e87293c..6e518e0 100644
66 +--- a/src/eac_util.c
67 ++++ b/src/eac_util.c
68 +@@ -321,6 +321,8 @@ randb(int numbytes)
69 + return NULL;
70 + }
71 +
72 ++#include <openssl/provider.h>
73 ++
74 + BUF_MEM *
75 + retail_mac_des(const BUF_MEM * key, const BUF_MEM * in)
76 + {
77 +@@ -331,6 +333,11 @@ retail_mac_des(const BUF_MEM * key, const BUF_MEM * in)
78 +
79 + check(key, "Invalid arguments");
80 +
81 ++#if OPENSSL_VERSION_NUMBER >= 0x30000000L
82 ++ OSSL_PROVIDER *legacy;
83 ++ legacy = OSSL_PROVIDER_load(NULL, "legacy");
84 ++#endif
85 ++
86 + len = EVP_CIPHER_block_size(EVP_des_cbc());
87 + check(key->length >= 2*len, "Key too short");
88 +
89 +@@ -369,6 +376,9 @@ retail_mac_des(const BUF_MEM * key, const BUF_MEM * in)
90 + BUF_MEM_free(c_tmp);
91 + BUF_MEM_free(d_tmp);
92 + EVP_CIPHER_CTX_free(ctx);
93 ++#if OPENSSL_VERSION_NUMBER >= 0x30000000L
94 ++ OSSL_PROVIDER_unload(legacy);
95 ++#endif
96 +
97 + return mac;
98 +
99 +@@ -381,6 +391,10 @@ retail_mac_des(const BUF_MEM * key, const BUF_MEM * in)
100 + BUF_MEM_free(d_tmp);
101 + if (ctx)
102 + EVP_CIPHER_CTX_free(ctx);
103 ++#if OPENSSL_VERSION_NUMBER >= 0x30000000L
104 ++ if (legacy)
105 ++ OSSL_PROVIDER_unload(legacy);
106 ++#endif
107 +
108 + return NULL;
109 + }
110
111 diff --git a/dev-libs/openpace/files/openpace-1.1.2-openssl.patch b/dev-libs/openpace/files/openpace-1.1.2-openssl.patch
112 new file mode 100644
113 index 000000000000..8802c2528f18
114 --- /dev/null
115 +++ b/dev-libs/openpace/files/openpace-1.1.2-openssl.patch
116 @@ -0,0 +1,25 @@
117 +From 8b2c8a76873da4862dbf4240c901f3e6d4bc040a Mon Sep 17 00:00:00 2001
118 +From: Frank Morgner <frankmorgner@×××××.com>
119 +Date: Sat, 18 Dec 2021 00:15:39 +0100
120 +Subject: [PATCH] fixed outdated API usage of BN_zero
121 +
122 +returns void since 0.9.8
123 +---
124 + src/eac.c | 4 +++-
125 + 1 file changed, 3 insertions(+), 1 deletion(-)
126 +
127 +diff --git a/src/eac.c b/src/eac.c
128 +index ea84253..9dccd79 100644
129 +--- a/src/eac.c
130 ++++ b/src/eac.c
131 +@@ -105,7 +105,9 @@ int EAC_reset_ssc(const EAC_CTX *ctx)
132 + if (!ctx)
133 + return 0;
134 +
135 +- return BN_zero(ctx->ssc);
136 ++ BN_zero(ctx->ssc);
137 ++
138 ++ return 1;
139 + }
140 +
141 + int EAC_set_ssc(const EAC_CTX *ctx, unsigned long ssc)
142
143 diff --git a/dev-libs/openpace/metadata.xml b/dev-libs/openpace/metadata.xml
144 new file mode 100644
145 index 000000000000..c762dd72a1de
146 --- /dev/null
147 +++ b/dev-libs/openpace/metadata.xml
148 @@ -0,0 +1,11 @@
149 +<?xml version="1.0" encoding="UTF-8"?>
150 +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
151 +<pkgmetadata>
152 + <maintainer type="person">
153 + <email>soap@g.o</email>
154 + <name>David Seifert</name>
155 + </maintainer>
156 + <upstream>
157 + <remote-id type="github">frankmorgner/openpace</remote-id>
158 + </upstream>
159 +</pkgmetadata>
160
161 diff --git a/dev-libs/openpace/openpace-1.1.2.ebuild b/dev-libs/openpace/openpace-1.1.2.ebuild
162 new file mode 100644
163 index 000000000000..308f5d566c47
164 --- /dev/null
165 +++ b/dev-libs/openpace/openpace-1.1.2.ebuild
166 @@ -0,0 +1,51 @@
167 +# Copyright 1999-2022 Gentoo Authors
168 +# Distributed under the terms of the GNU General Public License v2
169 +
170 +EAPI=8
171 +
172 +inherit autotools
173 +
174 +DESCRIPTION="Cryptographic library for EAC version 2"
175 +HOMEPAGE="https://frankmorgner.github.io/openpace"
176 +SRC_URI="https://github.com/frankmorgner/${PN}/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz"
177 +
178 +LICENSE="GPL-3"
179 +SLOT="0/3"
180 +KEYWORDS="~amd64 ~x86"
181 +
182 +BDEPEND="
183 + dev-util/gengetopt
184 + sys-apps/help2man
185 + virtual/pkgconfig"
186 +DEPEND="dev-libs/openssl:="
187 +RDEPEND="${DEPEND}"
188 +
189 +PATCHES=(
190 + "${FILESDIR}"/${P}-openssl.patch
191 + "${FILESDIR}"/${P}-openssl-3.0.patch
192 +)
193 +
194 +src_prepare() {
195 + default
196 + eautoreconf
197 +}
198 +
199 +src_configure() {
200 + econf \
201 + --disable-openssl-install \
202 + --disable-go \
203 + --disable-java \
204 + --disable-python \
205 + --disable-ruby
206 +}
207 +
208 +src_compile() {
209 + # not running just 1 job causes a race condition that causes a linking error
210 + emake -j1
211 +}
212 +
213 +src_install() {
214 + default
215 +
216 + find "${ED}" -type f -name '*.la' -delete || die
217 +}