diff options
author | Nicholas Fish <gentoo@seaofdirac.net> | 2018-07-01 20:13:25 +0200 |
---|---|---|
committer | Nicholas Fish <gentoo@seaofdirac.net> | 2018-07-01 20:13:25 +0200 |
commit | 9d14a1d91e8a0e76c7161f72e9f784ec1bd08424 (patch) | |
tree | 634efd7a243c1b0e7fe45ca264f160c0b248a1fc | |
parent | media-libs/mesa: version bump to 18.1.1, update ebuild to match Gentoo in-tree (diff) | |
download | ennui-9d14a1d91e8a0e76c7161f72e9f784ec1bd08424.tar.gz ennui-9d14a1d91e8a0e76c7161f72e9f784ec1bd08424.tar.bz2 ennui-9d14a1d91e8a0e76c7161f72e9f784ec1bd08424.zip |
app-crypt/sbsigntool(s): add back support for LibreSSL in addition to OpenSSL >= 1.1.0
-rw-r--r-- | app-crypt/sbsigntool/Manifest | 4 | ||||
-rw-r--r-- | app-crypt/sbsigntool/files/sbsigntool-0.9.1-openssl-1.1.0-libressl-compat.patch | 168 | ||||
-rw-r--r-- | app-crypt/sbsigntool/sbsigntool-0.9.1-r1.ebuild | 52 |
3 files changed, 224 insertions, 0 deletions
diff --git a/app-crypt/sbsigntool/Manifest b/app-crypt/sbsigntool/Manifest new file mode 100644 index 0000000..48d9be6 --- /dev/null +++ b/app-crypt/sbsigntool/Manifest @@ -0,0 +1,4 @@ +AUX sbsigntool-0.9.1-openssl-1.1.0-libressl-compat.patch 5678 BLAKE2B 81367f388cb62e8f39dd114102c1a71ed5e5222bd0560738d47f5437f8abeeefbe6a020e01d85f3b474a28c71edcc86542b19ee879d6ccf69ce237a73d542e36 SHA512 7d78a26320691965490acd8f14c5e0e5e41d0aeed40062f1281317c3a56324d3b20af6619da1d10f6f7f08d116076f06e37685f871d6de4f935f50f35d45a9c1 +DIST sbsigntool-0.8-ccan.tar.gz 113537 BLAKE2B 8fbf27463d30c1895930628a145be2d521ae4f6adb7af3299bf2f5f4319fd643df0a07347ef6851bd41d233af4c3fc5f77002771af1c43aa0f20665aef2390b8 SHA512 6857096879f116f1802eb6b44789cbea7bb24440bc0f16503aeadf5f276fa45943f322f844dbb9abee717655205d82b830143be3a7f4424fd4146b9360674a09 +DIST sbsigntool-0.9.1.tar.gz 56497 BLAKE2B 22791bd4b490f36963a19e82da3ce7b93a56d948bf44d1ffdb62fa3291a3f815b2c19d68f9180b607c2b1438f656367ec1f9002f0b1225734d16a9aadc6d20ec SHA512 ae16232327c098bbc60a9701185d856d851cb7fa8f62be64d3c8f75c8b274b8521fcc4212226189def05db980690878ee6ac9a9b418166c92442aaf35e790d29 +EBUILD sbsigntool-0.9.1-r1.ebuild 1402 BLAKE2B eab80939e3cfeeda32f514cd271dc558ec99b3dd35e93917acac426dabd3bcb38e44282eb1f834ef131e33220b05d0353dbaba3c47619f39a3a112516b9f6c15 SHA512 c421ab0029e1ed42a50c4e66e7cb769ef04a46a32214ca629045e83d595b82a17ccdbc4cd42c2fd0475b0c6f4c7092e908ea09d5bd740d0562f4ef50ccf251ac diff --git a/app-crypt/sbsigntool/files/sbsigntool-0.9.1-openssl-1.1.0-libressl-compat.patch b/app-crypt/sbsigntool/files/sbsigntool-0.9.1-openssl-1.1.0-libressl-compat.patch new file mode 100644 index 0000000..ca58911 --- /dev/null +++ b/app-crypt/sbsigntool/files/sbsigntool-0.9.1-openssl-1.1.0-libressl-compat.patch @@ -0,0 +1,168 @@ +diff --git a/src/fileio.c b/src/fileio.c +index 032eb1e..09bc3aa 100644 +--- a/src/fileio.c ++++ b/src/fileio.c +@@ -40,6 +40,7 @@ + #include <openssl/pem.h> + #include <openssl/err.h> + #include <openssl/engine.h> ++#include <openssl/ui.h> + + #include <ccan/talloc/talloc.h> + #include <ccan/read_write_all/read_write_all.h> +diff --git a/src/idc.c b/src/idc.c +index 236cefd..18c670a 100644 +--- a/src/idc.c ++++ b/src/idc.c +@@ -238,7 +238,11 @@ struct idc *IDC_get(PKCS7 *p7, BIO *bio) + + /* extract the idc from the signed PKCS7 'other' data */ + str = p7->d.sign->contents->d.other->value.asn1_string; ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) + idcbuf = buf = ASN1_STRING_data(str); ++#else ++ idcbuf = buf = ASN1_STRING_get0_data(str); ++#endif + idc = d2i_IDC(NULL, &buf, ASN1_STRING_length(str)); + + /* If we were passed a BIO, write the idc data, minus type and length, +@@ -289,7 +293,11 @@ int IDC_check_hash(struct idc *idc, struct image *image) + } + + /* check hash against the one we calculated from the image */ ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) + buf = ASN1_STRING_data(str); ++#else ++ buf = ASN1_STRING_get0_data(str); ++#endif + if (memcmp(buf, sha, sizeof(sha))) { + fprintf(stderr, "Hash doesn't match image\n"); + fprintf(stderr, " got: %s\n", sha256_str(buf)); +diff --git a/src/sbattach.c b/src/sbattach.c +index a0c01b8..fe5a18e 100644 +--- a/src/sbattach.c ++++ b/src/sbattach.c +@@ -231,6 +231,7 @@ int main(int argc, char **argv) + return EXIT_FAILURE; + } + ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) + ERR_load_crypto_strings(); + OpenSSL_add_all_digests(); + OPENSSL_config(NULL); +@@ -239,6 +240,7 @@ int main(int argc, char **argv) + * module isn't present). In either case ignore the errors + * (malloc will cause other failures out lower down */ + ERR_clear_error(); ++#endif + + image = image_load(image_filename); + if (!image) { +diff --git a/src/sbkeysync.c b/src/sbkeysync.c +index 7b17f40..753ca52 100644 +--- a/src/sbkeysync.c ++++ b/src/sbkeysync.c +@@ -208,7 +208,11 @@ static int x509_key_parse(struct key *key, uint8_t *data, size_t len) + goto out; + + key->id_len = ASN1_STRING_length(serial); ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) + key->id = talloc_memdup(key, ASN1_STRING_data(serial), key->id_len); ++#else ++ key->id = talloc_memdup(key, ASN1_STRING_get0_data(serial), key->id_len); ++#endif + + key->description = talloc_array(key, char, description_len); + X509_NAME_oneline(X509_get_subject_name(x509), +@@ -927,6 +931,7 @@ int main(int argc, char **argv) + return EXIT_FAILURE; + } + ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) + ERR_load_crypto_strings(); + OpenSSL_add_all_digests(); + OpenSSL_add_all_ciphers(); +@@ -936,6 +941,7 @@ int main(int argc, char **argv) + * module isn't present). In either case ignore the errors + * (malloc will cause other failures out lower down */ + ERR_clear_error(); ++#endif + + ctx->filesystem_keys = init_keyset(ctx); + ctx->firmware_keys = init_keyset(ctx); +diff --git a/src/sbsign.c b/src/sbsign.c +index ff1fdfd..5754113 100644 +--- a/src/sbsign.c ++++ b/src/sbsign.c +@@ -188,6 +188,7 @@ int main(int argc, char **argv) + + talloc_steal(ctx, ctx->image); + ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) + ERR_load_crypto_strings(); + OpenSSL_add_all_digests(); + OpenSSL_add_all_ciphers(); +@@ -197,6 +198,7 @@ int main(int argc, char **argv) + * module isn't present). In either case ignore the errors + * (malloc will cause other failures out lower down */ + ERR_clear_error(); ++#endif + if (engine) + pkey = fileio_read_engine_key(engine, keyfilename); + else +diff --git a/src/sbvarsign.c b/src/sbvarsign.c +index 7dcbe51..f39b640 100644 +--- a/src/sbvarsign.c ++++ b/src/sbvarsign.c +@@ -509,6 +509,7 @@ int main(int argc, char **argv) + return EXIT_FAILURE; + } + ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) + /* initialise openssl */ + OpenSSL_add_all_digests(); + OpenSSL_add_all_ciphers(); +@@ -519,6 +520,7 @@ int main(int argc, char **argv) + * module isn't present). In either case ignore the errors + * (malloc will cause other failures out lower down */ + ERR_clear_error(); ++#endif + + /* set up the variable signing context */ + varname = argv[optind]; +diff --git a/src/sbverify.c b/src/sbverify.c +index 3920d91..5b0bacb 100644 +--- a/src/sbverify.c ++++ b/src/sbverify.c +@@ -56,13 +56,13 @@ + #include <openssl/pem.h> + #include <openssl/x509v3.h> + +-#if OPENSSL_VERSION_NUMBER < 0x10100000L ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) + #define X509_OBJECT_get0_X509(obj) ((obj)->data.x509) + #define X509_OBJECT_get_type(obj) ((obj)->type) + #define X509_STORE_CTX_get0_cert(ctx) ((ctx)->cert) + #define X509_STORE_get0_objects(certs) ((certs)->objs) + #define X509_get_extended_key_usage(cert) ((cert)->ex_xkusage) +-#if OPENSSL_VERSION_NUMBER < 0x10020000L ++#if OPENSSL_VERSION_NUMBER < 0x10020000L || defined(LIBRESSL_VERSION_NUMBER) + #define X509_STORE_CTX_get0_store(ctx) ((ctx)->ctx) + #endif + #endif +@@ -250,6 +250,7 @@ int main(int argc, char **argv) + verbose = false; + detached_sig_filename = NULL; + ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) + OpenSSL_add_all_digests(); + ERR_load_crypto_strings(); + OPENSSL_config(NULL); +@@ -258,6 +259,7 @@ int main(int argc, char **argv) + * module isn't present). In either case ignore the errors + * (malloc will cause other failures out lower down */ + ERR_clear_error(); ++#endif + + for (;;) { + int idx; diff --git a/app-crypt/sbsigntool/sbsigntool-0.9.1-r1.ebuild b/app-crypt/sbsigntool/sbsigntool-0.9.1-r1.ebuild new file mode 100644 index 0000000..7bb20f1 --- /dev/null +++ b/app-crypt/sbsigntool/sbsigntool-0.9.1-r1.ebuild @@ -0,0 +1,52 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI="6" + +inherit eutils autotools + +DESCRIPTION="Utilities for signing and verifying files for UEFI Secure Boot" +HOMEPAGE="https://git.kernel.org/cgit/linux/kernel/git/jejb/sbsigntools.git/" +SRC_URI="https://git.kernel.org/pub/scm/linux/kernel/git/jejb/${PN}s.git/snapshot/${PN}s-${PV}.tar.gz -> ${P}.tar.gz + https://dev.gentoo.org/~tamiko/distfiles/${PN}-0.8-ccan.tar.gz" + +LICENSE="GPL-3 LGPL-3 LGPL-2.1 CC0-1.0" +SLOT="0" +KEYWORDS="~amd64 ~arm64 ~x86" +IUSE="libressl" + +RDEPEND=" + !libressl? ( dev-libs/openssl:0= ) + libressl? ( dev-libs/libressl:0= ) + sys-apps/util-linux" +DEPEND="${RDEPEND} + sys-apps/help2man + sys-boot/gnu-efi + sys-libs/binutils-libs + virtual/pkgconfig" + +S="${WORKDIR}/${PN}s-${PV}" + +PATCHES=( + "${FILESDIR}"/${P}-openssl-1.1.0-libressl-compat.patch +) + +src_prepare() { + mv "${WORKDIR}"/lib/ccan "${S}"/lib || die "mv failed" + rmdir "${WORKDIR}"/lib || die "rmdir failed" + + local iarch + case ${ARCH} in + amd64) iarch=x86_64 ;; + arm64) iarch=aarch64 ;; + ia64) iarch=ia64 ;; + x86) iarch=ia32 ;; + *) die "unsupported architecture: ${ARCH}" ;; + esac + sed -i "/^EFI_ARCH=/s:=.*:=${iarch}:" configure.ac || die + sed -i 's/-m64$/& -march=x86-64/' tests/Makefile.am || die + sed -i "/^AR /s:=.*:= $(tc-getAR):" lib/ccan/Makefile.in || die #481480 + + default + eautoreconf +} |