From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 76231138350 for ; Wed, 15 Jan 2020 14:45:04 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8B8F9E0866; Wed, 15 Jan 2020 14:45:03 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 578DCE0866 for ; Wed, 15 Jan 2020 14:45:03 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D754434E0BC for ; Wed, 15 Jan 2020 14:45:01 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id DB55A7B for ; Wed, 15 Jan 2020 14:44:59 +0000 (UTC) From: "Craig Andrews" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Craig Andrews" Message-ID: <1579099444.9c50acec16bc7c33d6dc122c007d713e7fbecf9c.candrews@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: net-wireless/crda/, net-wireless/crda/files/ X-VCS-Repository: repo/gentoo X-VCS-Files: net-wireless/crda/Manifest net-wireless/crda/crda-3.18-r3.ebuild net-wireless/crda/crda-4.14.ebuild net-wireless/crda/files/crda-3.18-cflags.patch net-wireless/crda/files/crda-3.18-ldflags.patch net-wireless/crda/files/crda-3.18-libreg-link.patch net-wireless/crda/files/crda-3.18-libressl.patch net-wireless/crda/files/crda-3.18-no-ldconfig.patch net-wireless/crda/files/crda-3.18-no-werror.patch net-wireless/crda/files/crda-4.14-do-not-compress-doc.patch net-wireless/crda/files/crda-4.14-openssl-1.1.0-compatibility.patch net-wireless/crda/files/crda-4.14-python-3.patch net-wireless/crda/files/crda-cflags.patch net-wireless/crda/files/crda-ldflags.patch net-wireless/crda/files/crda-libreg-link.patch net-wireless/crda/files/crda-libressl.patch net-wireless/crda/files/crda-no-ldconfig.patch net-wireless/crda/files/crda-no-werror.patch X-VCS-Directories: net-wireless/crda/ net-wireless/crda/files/ X-VCS-Committer: candrews X-VCS-Committer-Name: Craig Andrews X-VCS-Revision: 9c50acec16bc7c33d6dc122c007d713e7fbecf9c X-VCS-Branch: master Date: Wed, 15 Jan 2020 14:44:59 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 2b43423a-f5cd-4ea8-9ff5-3f29c4585b84 X-Archives-Hash: 0268e0e430e5ca5139dd2d3d84931e23 commit: 9c50acec16bc7c33d6dc122c007d713e7fbecf9c Author: Vjaceslavs Klimovs gmail com> AuthorDate: Mon Jan 6 00:46:08 2020 +0000 Commit: Craig Andrews gentoo org> CommitDate: Wed Jan 15 14:44:04 2020 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9c50acec net-wireless/crda: Bump to 4.14 * Bump to 4.14 per availability from upstream * Support Python 3 * Add patch to not compress docs Closes: https://bugs.gentoo.org/669076 Closes: https://bugs.gentoo.org/693728 Closes: https://bugs.gentoo.org/669578 Signed-off-by: Vjaceslavs Klimovs gmail.com> Closes: https://github.com/gentoo/gentoo/pull/14254 Signed-off-by: Craig Andrews gentoo.org> net-wireless/crda/Manifest | 1 + net-wireless/crda/crda-3.18-r3.ebuild | 14 +- .../crda/{crda-3.18-r3.ebuild => crda-4.14.ebuild} | 25 +- .../crda/files/crda-4.14-do-not-compress-doc.patch | 36 +++ .../crda-4.14-openssl-1.1.0-compatibility.patch | 314 +++++++++++++++++++++ net-wireless/crda/files/crda-4.14-python-3.patch | 93 ++++++ .../{crda-3.18-cflags.patch => crda-cflags.patch} | 0 ...{crda-3.18-ldflags.patch => crda-ldflags.patch} | 0 ...18-libreg-link.patch => crda-libreg-link.patch} | 0 ...rda-3.18-libressl.patch => crda-libressl.patch} | 0 ...18-no-ldconfig.patch => crda-no-ldconfig.patch} | 0 ...a-3.18-no-werror.patch => crda-no-werror.patch} | 0 12 files changed, 464 insertions(+), 19 deletions(-) diff --git a/net-wireless/crda/Manifest b/net-wireless/crda/Manifest index ff0b741ae87..03e01bcb648 100644 --- a/net-wireless/crda/Manifest +++ b/net-wireless/crda/Manifest @@ -1 +1,2 @@ DIST crda-3.18.tar.xz 61516 BLAKE2B 76feac7fcf85b03b39bfe78de444515f54cd513041f81f7588cd7866e5bf072d000ad0c8df181ccacde7fc8125ed04ece00d5d9d3013df759b5f9fd05f8cfd56 SHA512 57ae6309159f396448f052c127f401c2f63d47f4193e87dca231c4b7bbbd7e69b5e5666f356fc76dfc8a6ae58ffa55c3794428d6eb34d9937df77c4276036588 +DIST crda-4.14.tar.gz 72753 BLAKE2B 79e96bc41103eb221d841c74081c2abf507c46ae7790d5d8201dbc49260bc833630b95f74da5500817e07f1b4108713867071bd82ecc4c46d202d1e0ea865675 SHA512 0d52cf62589ec2debfd66de95b82b03a1c15048d8425cf5ef43c3e1f51ce1311a6d898fd5f69badcceb3181d35c836db197c6f070654dab351b01e96a1dd1053 diff --git a/net-wireless/crda/crda-3.18-r3.ebuild b/net-wireless/crda/crda-3.18-r3.ebuild index c1fa8bd32e4..42a8e00147a 100644 --- a/net-wireless/crda/crda-3.18-r3.ebuild +++ b/net-wireless/crda/crda-3.18-r3.ebuild @@ -1,4 +1,4 @@ -# Copyright 2008-2019 Gentoo Authors +# Copyright 2008-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=6 @@ -33,13 +33,13 @@ python_check_deps() { } PATCHES=( - "${FILESDIR}"/${PN}-3.18-no-ldconfig.patch - "${FILESDIR}"/${PN}-3.18-no-werror.patch - "${FILESDIR}"/${PN}-3.18-cflags.patch - "${FILESDIR}"/${PN}-3.18-libreg-link.patch #542436 + "${FILESDIR}"/${PN}-no-ldconfig.patch + "${FILESDIR}"/${PN}-no-werror.patch + "${FILESDIR}"/${PN}-cflags.patch + "${FILESDIR}"/${PN}-libreg-link.patch #542436 "${FILESDIR}"/${PN}-3.18-openssl-1.1.0-compatibility.patch #652428 - "${FILESDIR}"/${PN}-3.18-libressl.patch - "${FILESDIR}"/${PN}-3.18-ldflags.patch + "${FILESDIR}"/${PN}-libressl.patch + "${FILESDIR}"/${PN}-ldflags.patch ) src_prepare() { diff --git a/net-wireless/crda/crda-3.18-r3.ebuild b/net-wireless/crda/crda-4.14.ebuild similarity index 71% copy from net-wireless/crda/crda-3.18-r3.ebuild copy to net-wireless/crda/crda-4.14.ebuild index c1fa8bd32e4..380cc3d2f08 100644 --- a/net-wireless/crda/crda-3.18-r3.ebuild +++ b/net-wireless/crda/crda-4.14.ebuild @@ -1,19 +1,18 @@ -# Copyright 2008-2019 Gentoo Authors +# Copyright 1999-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=6 -PYTHON_COMPAT=( python2_7 ) +PYTHON_COMPAT=( python2_7 python3_{6,7,8} ) inherit toolchain-funcs python-any-r1 udev DESCRIPTION="Central Regulatory Domain Agent for wireless networks" HOMEPAGE="https://wireless.wiki.kernel.org/en/developers/regulatory/crda" -SRC_URI="http://linuxwireless.org/download/crda/${P}.tar.xz - https://www.kernel.org/pub/software/network/crda/${P}.tar.xz" +SRC_URI="https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/crda.git/snapshot/${P}.tar.gz" LICENSE="ISC" SLOT="0" -KEYWORDS="alpha amd64 arm arm64 ia64 ~mips ppc ppc64 sparc x86" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86" IUSE="gcrypt libressl" RDEPEND="!gcrypt? ( @@ -33,13 +32,15 @@ python_check_deps() { } PATCHES=( - "${FILESDIR}"/${PN}-3.18-no-ldconfig.patch - "${FILESDIR}"/${PN}-3.18-no-werror.patch - "${FILESDIR}"/${PN}-3.18-cflags.patch - "${FILESDIR}"/${PN}-3.18-libreg-link.patch #542436 - "${FILESDIR}"/${PN}-3.18-openssl-1.1.0-compatibility.patch #652428 - "${FILESDIR}"/${PN}-3.18-libressl.patch - "${FILESDIR}"/${PN}-3.18-ldflags.patch + "${FILESDIR}"/${PN}-no-ldconfig.patch + "${FILESDIR}"/${PN}-no-werror.patch + "${FILESDIR}"/${PN}-cflags.patch + "${FILESDIR}"/${PN}-libreg-link.patch #542436 + "${FILESDIR}"/${PN}-4.14-python-3.patch + "${FILESDIR}"/${PN}-4.14-openssl-1.1.0-compatibility.patch #652428 + "${FILESDIR}"/${PN}-libressl.patch + "${FILESDIR}"/${PN}-ldflags.patch + "${FILESDIR}"/${PN}-4.14-do-not-compress-doc.patch ) src_prepare() { diff --git a/net-wireless/crda/files/crda-4.14-do-not-compress-doc.patch b/net-wireless/crda/files/crda-4.14-do-not-compress-doc.patch new file mode 100644 index 00000000000..428bafbde44 --- /dev/null +++ b/net-wireless/crda/files/crda-4.14-do-not-compress-doc.patch @@ -0,0 +1,36 @@ +diff --git a/Makefile b/Makefile +index 335d17d..683a379 100644 +--- a/Makefile ++++ b/Makefile +@@ -157,11 +157,7 @@ verify: $(REG_BIN) regdbdump + LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) \ + ./regdbdump $(REG_BIN) >/dev/null + +-%.gz: % +- @$(NQ) ' GZIP' $< +- $(Q)gzip < $< > $@ +- +-install: install-libreg install-libreg-headers crda crda.8.gz regdbdump.8.gz ++install: install-libreg install-libreg-headers crda crda.8 regdbdump.8 + $(NQ) ' INSTALL crda' + $(Q)$(MKDIR) $(DESTDIR)/$(SBINDIR) + $(Q)$(INSTALL) -m 755 -t $(DESTDIR)/$(SBINDIR) crda +@@ -177,13 +173,13 @@ install: install-libreg install-libreg-headers crda crda.8.gz regdbdump.8.gz + $(Q)$(INSTALL) -m 644 -t \ + $(DESTDIR)/$(UDEV_RULE_DIR)/ \ + udev/$(UDEV_LEVEL)regulatory.rules +- $(NQ) ' INSTALL crda.8.gz' ++ $(NQ) ' INSTALL crda.8' + $(Q)$(MKDIR) $(DESTDIR)$(MANDIR)/man8/ +- $(Q)$(INSTALL) -m 644 -t $(DESTDIR)/$(MANDIR)/man8/ crda.8.gz +- $(NQ) ' INSTALL regdbdump.8.gz' +- $(Q)$(INSTALL) -m 644 -t $(DESTDIR)/$(MANDIR)/man8/ regdbdump.8.gz ++ $(Q)$(INSTALL) -m 644 -t $(DESTDIR)/$(MANDIR)/man8/ crda.8 ++ $(NQ) ' INSTALL regdbdump.8' ++ $(Q)$(INSTALL) -m 644 -t $(DESTDIR)/$(MANDIR)/man8/ regdbdump.8 + + clean: + $(Q)rm -f $(LIBREG) crda regdbdump intersect db2rd optimize \ +- *.o *~ *.pyc keys.c *.gz \ ++ *.o *~ *.pyc keys.c \ + udev/$(UDEV_LEVEL)regulatory.rules udev/regulatory.rules.parsed diff --git a/net-wireless/crda/files/crda-4.14-openssl-1.1.0-compatibility.patch b/net-wireless/crda/files/crda-4.14-openssl-1.1.0-compatibility.patch new file mode 100644 index 00000000000..a9999da239f --- /dev/null +++ b/net-wireless/crda/files/crda-4.14-openssl-1.1.0-compatibility.patch @@ -0,0 +1,314 @@ +From 338637ac08c19708eb35523894b44bbe3c726cfa Mon Sep 17 00:00:00 2001 +From: quentin +Date: Mon, 2 Apr 2018 18:07:50 +0200 +Subject: [PATCH] crda: Fix for OpenSSL 1.1.0: BIGNUM now opaque + +OpenSSL 1.1.0 makes most of OpenSSL's structures opaque, and provides +functions to manipulate them. This means it's no longer possible to +construct an OpenSSL BIGNUM directly from scratch, as was done in +keys-ssl.c. + +Use BN_bin2bn() (available since OpenSSL 0.9.8) to build the bignum from +its big-endian representation as a byte array. + +This also allows factoring the code in utils/key2pub.py as it's now the +same mechanism as with libgcrypt. + +This was tested with OpenSSL 1.1.0g. + +Signed-off-by: Quentin Minster +--- + Makefile | 12 +++---- + reglib.c | 44 +++++++++++++++++------ + utils/key2pub.py | 107 ++++++------------------------------------------------- + 3 files changed, 49 insertions(+), 114 deletions(-) + +diff --git a/Makefile b/Makefile +index a3ead30..a4e7373 100644 +--- a/Makefile ++++ b/Makefile +@@ -38,18 +38,16 @@ all: all_noverify verify + + all_noverify: $(LIBREG) crda intersect regdbdump db2rd optimize + ++$(LIBREG): keys.c ++ + ifeq ($(USE_OPENSSL),1) + CFLAGS += -DUSE_OPENSSL -DPUBKEY_DIR=\"$(RUNTIME_PUBKEY_DIR)\" `pkg-config --cflags openssl` + LDLIBS += `pkg-config --libs openssl` + +-$(LIBREG): keys-ssl.c +- + else + CFLAGS += -DUSE_GCRYPT + LDLIBS += -lgcrypt + +-$(LIBREG): keys-gcrypt.c +- + endif + MKDIR ?= mkdir -p + INSTALL ?= install +@@ -109,10 +107,10 @@ $(REG_BIN): + $(NQ) + $(Q) exit 1 + +-keys-%.c: utils/key2pub.py $(wildcard $(PUBKEY_DIR)/*.pem) ++keys.c: utils/key2pub.py $(wildcard $(PUBKEY_DIR)/*.pem) + $(NQ) ' GEN ' $@ + $(NQ) ' Trusted pubkeys:' $(wildcard $(PUBKEY_DIR)/*.pem) +- $(Q)./utils/key2pub.py --$* $(wildcard $(PUBKEY_DIR)/*.pem) $@ ++ $(Q)./utils/key2pub.py $(wildcard $(PUBKEY_DIR)/*.pem) $@ + + $(LIBREG): regdb.h reglib.h reglib.c + $(NQ) ' CC ' $@ +@@ -187,5 +185,5 @@ install: install-libreg install-libreg-headers crda crda.8.gz regdbdump.8.gz + + clean: + $(Q)rm -f $(LIBREG) crda regdbdump intersect db2rd optimize \ +- *.o *~ *.pyc keys-*.c *.gz \ ++ *.o *~ *.pyc keys.c *.gz \ + udev/$(UDEV_LEVEL)regulatory.rules udev/regulatory.rules.parsed +diff --git a/reglib.c b/reglib.c +index e00e9b8..00f7f56 100644 +--- a/reglib.c ++++ b/reglib.c +@@ -22,6 +22,7 @@ + #include + #include + #include ++#include + #endif + + #ifdef USE_GCRYPT +@@ -30,12 +31,8 @@ + + #include "reglib.h" + +-#ifdef USE_OPENSSL +-#include "keys-ssl.c" +-#endif +- +-#ifdef USE_GCRYPT +-#include "keys-gcrypt.c" ++#if defined(USE_OPENSSL) || defined(USE_GCRYPT) ++#include "keys.c" + #endif + + int debug = 0; +@@ -81,7 +78,8 @@ reglib_array_len(size_t baselen, unsigned int elemcount, size_t elemlen) + #ifdef USE_OPENSSL + int reglib_verify_db_signature(uint8_t *db, size_t dblen, size_t siglen) + { +- RSA *rsa; ++ RSA *rsa = NULL; ++ BIGNUM *rsa_e = NULL, *rsa_n = NULL; + uint8_t hash[SHA_DIGEST_LENGTH]; + unsigned int i; + int ok = 0; +@@ -102,15 +100,35 @@ int reglib_verify_db_signature(uint8_t *db, size_t dblen, size_t siglen) + goto out; + } + +- rsa->e = &keys[i].e; +- rsa->n = &keys[i].n; ++ rsa_e = BN_bin2bn(keys[i].e, keys[i].len_e, NULL); ++ if (!rsa_e) { ++ fprintf(stderr, "Failed to convert value for RSA e.\n"); ++ goto out; ++ } ++ rsa_n = BN_bin2bn(keys[i].n, keys[i].len_n, NULL); ++ if (!rsa_n) { ++ fprintf(stderr, "Failed to convert value for RSA n.\n"); ++ goto out; ++ } ++ ++#if OPENSSL_VERSION_NUMBER < 0x10100000L ++ rsa->e = rsa_e; ++ rsa->n = rsa_n; ++#else ++ if (RSA_set0_key(rsa, rsa_n, rsa_e, NULL) != 1) { ++ fprintf(stderr, "Failed to set RSA key.\n"); ++ goto out; ++ } ++#endif ++ /* BIGNUMs now owned by the RSA object */ ++ rsa_e = NULL; ++ rsa_n = NULL; + + ok = RSA_verify(NID_sha1, hash, SHA_DIGEST_LENGTH, + db + dblen, siglen, rsa) == 1; + +- rsa->e = NULL; +- rsa->n = NULL; + RSA_free(rsa); ++ rsa = NULL; + } + if (!ok && (pubkey_dir = opendir(PUBKEY_DIR))) { + while (!ok && (nextfile = readdir(pubkey_dir))) { +@@ -123,6 +141,7 @@ int reglib_verify_db_signature(uint8_t *db, size_t dblen, size_t siglen) + ok = RSA_verify(NID_sha1, hash, SHA_DIGEST_LENGTH, + db + dblen, siglen, rsa) == 1; + RSA_free(rsa); ++ rsa = NULL; + fclose(keyfile); + } + } +@@ -133,6 +152,9 @@ int reglib_verify_db_signature(uint8_t *db, size_t dblen, size_t siglen) + fprintf(stderr, "Database signature verification failed.\n"); + + out: ++ RSA_free(rsa); ++ BN_free(rsa_e); ++ BN_free(rsa_n); + return ok; + } + #endif /* USE_OPENSSL */ +diff --git a/utils/key2pub.py b/utils/key2pub.py +index 9bb04cd..1919270 100755 +--- a/utils/key2pub.py ++++ b/utils/key2pub.py +@@ -9,84 +9,7 @@ except ImportError as e: + sys.stderr.write('On Debian GNU/Linux the package is called "python-m2crypto".\n') + sys.exit(1) + +-def print_ssl_64(output, name, val): +- while val[0:1] == b'\0': +- val = val[1:] +- while len(val) % 8: +- val = b'\0' + val +- vnew = [] +- while len(val): +- vnew.append((val[0:1], val[1:2], val[2:3], val[3:4], val[4:5], val[5:6], val[6:7], val[7:8])) +- val = val[8:] +- vnew.reverse() +- output.write('static BN_ULONG %s[%d] = {\n' % (name, len(vnew))) +- idx = 0 +- for v1, v2, v3, v4, v5, v6, v7, v8 in vnew: +- if not idx: +- output.write('\t') +- output.write('0x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x, ' % (ord(v1), ord(v2), ord(v3), ord(v4), ord(v5), ord(v6), ord(v7), ord(v8))) +- idx += 1 +- if idx == 2: +- idx = 0 +- output.write('\n') +- if idx: +- output.write('\n') +- output.write('};\n\n') +- +-def print_ssl_32(output, name, val): +- while val[0:1] == b'\0': +- val = val[1:] +- while len(val) % 4: +- val = b'\0' + val +- vnew = [] +- while len(val): +- vnew.append((val[0:1], val[1:2], val[2:3], val[3:4])) +- val = val[4:] +- vnew.reverse() +- output.write('static BN_ULONG %s[%d] = {\n' % (name, len(vnew))) +- idx = 0 +- for v1, v2, v3, v4 in vnew: +- if not idx: +- output.write('\t') +- output.write('0x%.2x%.2x%.2x%.2x, ' % (ord(v1), ord(v2), ord(v3), ord(v4))) +- idx += 1 +- if idx == 4: +- idx = 0 +- output.write('\n') +- if idx: +- output.write('\n') +- output.write('};\n\n') +- +-def print_ssl(output, name, val): +- import struct +- output.write('#include \n') +- if len(struct.pack('@L', 0)) == 8: +- return print_ssl_64(output, name, val) +- else: +- return print_ssl_32(output, name, val) +- +-def print_ssl_keys(output, n): +- output.write(r''' +-struct pubkey { +- struct bignum_st e, n; +-}; +- +-#define KEY(data) { \ +- .d = data, \ +- .top = sizeof(data)/sizeof(data[0]), \ +-} +- +-#define KEYS(e,n) { KEY(e), KEY(n), } +- +-static struct pubkey keys[] = { +-''') +- for n in range(n + 1): +- output.write(' KEYS(e_%d, n_%d),\n' % (n, n)) +- output.write('};\n') +- pass +- +-def print_gcrypt(output, name, val): +- output.write('#include \n') ++def print_bignum(output, name, val): + while val[0:1] == b'\0': + val = val[1:] + output.write('static const uint8_t %s[%d] = {\n' % (name, len(val))) +@@ -103,11 +26,11 @@ def print_gcrypt(output, name, val): + output.write('\n') + output.write('};\n\n') + +-def print_gcrypt_keys(output, n): ++def print_keys(output, n): + output.write(r''' + struct key_params { + const uint8_t *e, *n; +- uint32_t len_e, len_n; ++ const uint32_t len_e, len_n; + }; + + #define KEYS(_e, _n) { \ +@@ -120,25 +43,17 @@ static const struct key_params __attribute__ ((unused)) keys[] = { + for n in range(n + 1): + output.write(' KEYS(e_%d, n_%d),\n' % (n, n)) + output.write('};\n') +- + +-modes = { +- '--ssl': (print_ssl, print_ssl_keys), +- '--gcrypt': (print_gcrypt, print_gcrypt_keys), +-} + +-try: +- mode = sys.argv[1] +- files = sys.argv[2:-1] +- outfile = sys.argv[-1] +-except IndexError: +- mode = None ++files = sys.argv[1:-1] ++outfile = sys.argv[-1] + +-if not mode in modes: +- print('Usage: %s [%s] input-file... output-file' % (sys.argv[0], '|'.join(modes.keys()))) ++if len(files) == 0: ++ print('Usage: %s input-file... output-file' % sys.argv[0]) + sys.exit(2) + + output = open(outfile, 'w') ++output.write('#include \n\n\n') + + # load key + idx = 0 +@@ -148,10 +63,10 @@ for f in files: + except RSA.RSAError: + key = RSA.load_key(f) + +- modes[mode][0](output, 'e_%d' % idx, key.e[4:]) +- modes[mode][0](output, 'n_%d' % idx, key.n[4:]) ++ print_bignum(output, 'e_%d' % idx, key.e[4:]) ++ print_bignum(output, 'n_%d' % idx, key.n[4:]) + idx += 1 + +-modes[mode][1](output, idx - 1) ++print_keys(output, idx - 1) + + output.close() diff --git a/net-wireless/crda/files/crda-4.14-python-3.patch b/net-wireless/crda/files/crda-4.14-python-3.patch new file mode 100644 index 00000000000..97db1ac0529 --- /dev/null +++ b/net-wireless/crda/files/crda-4.14-python-3.patch @@ -0,0 +1,93 @@ +--- /utils/key2pub.py ++++ /utils/key2pub.py +@@ -3,20 +3,20 @@ + import sys + try: + from M2Crypto import RSA +-except ImportError, e: ++except ImportError as e: + sys.stderr.write('ERROR: Failed to import the "M2Crypto" module: %s\n' % e.message) + sys.stderr.write('Please install the "M2Crypto" Python module.\n') + sys.stderr.write('On Debian GNU/Linux the package is called "python-m2crypto".\n') + sys.exit(1) + + def print_ssl_64(output, name, val): +- while val[0] == '\0': ++ while val[0:1] == b'\0': + val = val[1:] + while len(val) % 8: +- val = '\0' + val ++ val = b'\0' + val + vnew = [] + while len(val): +- vnew.append((val[0], val[1], val[2], val[3], val[4], val[5], val[6], val[7])) ++ vnew.append((val[0:1], val[1:2], val[2:3], val[3:4], val[4:5], val[5:6], val[6:7], val[7:8])) + val = val[8:] + vnew.reverse() + output.write('static BN_ULONG %s[%d] = {\n' % (name, len(vnew))) +@@ -34,13 +34,13 @@ + output.write('};\n\n') + + def print_ssl_32(output, name, val): +- while val[0] == '\0': ++ while val[0:1] == b'\0': + val = val[1:] + while len(val) % 4: +- val = '\0' + val ++ val = b'\0' + val + vnew = [] + while len(val): +- vnew.append((val[0], val[1], val[2], val[3], )) ++ vnew.append((val[0:1], val[1:2], val[2:3], val[3:4])) + val = val[4:] + vnew.reverse() + output.write('static BN_ULONG %s[%d] = {\n' % (name, len(vnew))) +@@ -80,21 +80,21 @@ + + static struct pubkey keys[] = { + ''') +- for n in xrange(n + 1): ++ for n in range(n + 1): + output.write(' KEYS(e_%d, n_%d),\n' % (n, n)) + output.write('};\n') + pass + + def print_gcrypt(output, name, val): + output.write('#include \n') +- while val[0] == '\0': ++ while val[0:1] == b'\0': + val = val[1:] + output.write('static const uint8_t %s[%d] = {\n' % (name, len(val))) + idx = 0 + for v in val: + if not idx: + output.write('\t') +- output.write('0x%.2x, ' % ord(v)) ++ output.write('0x%.2x, ' % (v if sys.version_info[0] >=3 else ord(v))) + idx += 1 + if idx == 8: + idx = 0 +@@ -117,7 +117,7 @@ + + static const struct key_params keys[] = { + ''') +- for n in xrange(n + 1): ++ for n in range(n + 1): + output.write(' KEYS(e_%d, n_%d),\n' % (n, n)) + output.write('};\n') + +@@ -135,7 +135,7 @@ + mode = None + + if not mode in modes: +- print 'Usage: %s [%s] input-file... output-file' % (sys.argv[0], '|'.join(modes.keys())) ++ print('Usage: %s [%s] input-file... output-file' % (sys.argv[0], '|'.join(modes.keys()))) + sys.exit(2) + + output = open(outfile, 'w') +@@ -153,3 +153,5 @@ + idx += 1 + + modes[mode][1](output, idx - 1) ++ ++output.close() diff --git a/net-wireless/crda/files/crda-3.18-cflags.patch b/net-wireless/crda/files/crda-cflags.patch similarity index 100% rename from net-wireless/crda/files/crda-3.18-cflags.patch rename to net-wireless/crda/files/crda-cflags.patch diff --git a/net-wireless/crda/files/crda-3.18-ldflags.patch b/net-wireless/crda/files/crda-ldflags.patch similarity index 100% rename from net-wireless/crda/files/crda-3.18-ldflags.patch rename to net-wireless/crda/files/crda-ldflags.patch diff --git a/net-wireless/crda/files/crda-3.18-libreg-link.patch b/net-wireless/crda/files/crda-libreg-link.patch similarity index 100% rename from net-wireless/crda/files/crda-3.18-libreg-link.patch rename to net-wireless/crda/files/crda-libreg-link.patch diff --git a/net-wireless/crda/files/crda-3.18-libressl.patch b/net-wireless/crda/files/crda-libressl.patch similarity index 100% rename from net-wireless/crda/files/crda-3.18-libressl.patch rename to net-wireless/crda/files/crda-libressl.patch diff --git a/net-wireless/crda/files/crda-3.18-no-ldconfig.patch b/net-wireless/crda/files/crda-no-ldconfig.patch similarity index 100% rename from net-wireless/crda/files/crda-3.18-no-ldconfig.patch rename to net-wireless/crda/files/crda-no-ldconfig.patch diff --git a/net-wireless/crda/files/crda-3.18-no-werror.patch b/net-wireless/crda/files/crda-no-werror.patch similarity index 100% rename from net-wireless/crda/files/crda-3.18-no-werror.patch rename to net-wireless/crda/files/crda-no-werror.patch