public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: net-wireless/crda/, net-wireless/crda/files/
@ 2019-06-05 21:19 Andreas Sturmlechner
  0 siblings, 0 replies; 6+ messages in thread
From: Andreas Sturmlechner @ 2019-06-05 21:19 UTC (permalink / raw
  To: gentoo-commits

commit:     535949b048ada95807d0faa132befd6064f3ce08
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sun May 26 11:46:49 2019 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Wed Jun  5 21:18:19 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=535949b0

net-wireless/crda: Drop 1.1.3-r1 and 3.18-r1

Package-Manager: Portage-2.3.66, Repoman-2.3.13
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 net-wireless/crda/Manifest                         |  1 -
 net-wireless/crda/crda-1.1.3-r1.ebuild             | 66 -------------------
 net-wireless/crda/crda-3.18-r1.ebuild              | 77 ----------------------
 .../crda/files/crda-1.1.3-missing-include.patch    | 11 ----
 net-wireless/crda/files/crda-3.18-openssl.patch    | 44 -------------
 5 files changed, 199 deletions(-)

diff --git a/net-wireless/crda/Manifest b/net-wireless/crda/Manifest
index c3914b4fa17..ff0b741ae87 100644
--- a/net-wireless/crda/Manifest
+++ b/net-wireless/crda/Manifest
@@ -1,2 +1 @@
-DIST crda-1.1.3.tar.bz2 38697 BLAKE2B 5ca68362a134e6f5fad1a450edc3cfc083686d45750dbfdd04821f30e18873f86870d97fd796d1ea4dfc79f74f65dc548562890dcfc21f224ac76006878aea41 SHA512 4ec37d3d51f5988af79c2eaadc1bce344f20d4d9833533838d308533ee02cb12d5ed193391679ae1231c8afe61b21defdb368614a6238f99fdc5824f6819cfed
 DIST crda-3.18.tar.xz 61516 BLAKE2B 76feac7fcf85b03b39bfe78de444515f54cd513041f81f7588cd7866e5bf072d000ad0c8df181ccacde7fc8125ed04ece00d5d9d3013df759b5f9fd05f8cfd56 SHA512 57ae6309159f396448f052c127f401c2f63d47f4193e87dca231c4b7bbbd7e69b5e5666f356fc76dfc8a6ae58ffa55c3794428d6eb34d9937df77c4276036588

diff --git a/net-wireless/crda/crda-1.1.3-r1.ebuild b/net-wireless/crda/crda-1.1.3-r1.ebuild
deleted file mode 100644
index 89fd5c5fa4d..00000000000
--- a/net-wireless/crda/crda-1.1.3-r1.ebuild
+++ /dev/null
@@ -1,66 +0,0 @@
-# Copyright 1999-2018 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=5
-
-PYTHON_COMPAT=( python2_7 )
-inherit eutils toolchain-funcs python-any-r1 udev
-
-DESCRIPTION="Central Regulatory Domain Agent for wireless networks"
-HOMEPAGE="https://wireless.kernel.org/en/developers/Regulatory"
-SRC_URI="http://linuxwireless.org/download/crda/${P}.tar.bz2"
-
-LICENSE="ISC"
-SLOT="0"
-KEYWORDS="alpha amd64 arm ~arm64 ia64 ~mips ppc ppc64 sparc x86"
-IUSE=""
-
-RDEPEND="dev-libs/openssl:0=
-	dev-libs/libnl:3
-	net-wireless/wireless-regdb"
-DEPEND="${RDEPEND}
-	${PYTHON_DEPS}
-	$(python_gen_any_dep 'dev-python/m2crypto[${PYTHON_USEDEP}]')
-	virtual/pkgconfig"
-
-python_check_deps() {
-	has_version --host-root "dev-python/m2crypto[${PYTHON_USEDEP}]"
-}
-
-src_prepare() {
-	epatch "${FILESDIR}"/${P}-missing-include.patch
-	sed -i \
-		-e "s:\<pkg-config\>:$(tc-getPKG_CONFIG):" \
-		Makefile || die
-}
-
-_emake() {
-	# The source hardcodes /usr/lib/crda/ paths (ignoring all make vars
-	# that look like it should change it).  We want to use /usr/lib/
-	# anyways as this file is not ABI specific and we want to share it
-	# among all ABIs rather than pointlessly duplicate it.
-	#
-	# The trailing slash on SBINDIR is required by the source.
-	emake \
-		PREFIX="${EPREFIX}/usr" \
-		SBINDIR='$(PREFIX)/sbin/' \
-		UDEV_RULE_DIR="$(get_udevdir)/rules.d" \
-		REG_BIN=/usr/lib/crda/regulatory.bin \
-		USE_OPENSSL=1 \
-		CC="$(tc-getCC)" \
-		V=1 \
-		"$@"
-}
-
-src_compile() {
-	_emake all_noverify
-}
-
-src_test() {
-	_emake verify
-}
-
-src_install() {
-	_emake DESTDIR="${D}" install
-	keepdir /etc/wireless-regdb/pubkeys
-}

diff --git a/net-wireless/crda/crda-3.18-r1.ebuild b/net-wireless/crda/crda-3.18-r1.ebuild
deleted file mode 100644
index b5394b975e7..00000000000
--- a/net-wireless/crda/crda-3.18-r1.ebuild
+++ /dev/null
@@ -1,77 +0,0 @@
-# Copyright 1999-2018 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=5
-
-PYTHON_COMPAT=( python2_7 )
-inherit eutils 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
-	mirror://kernel/software/network/crda/${P}.tar.xz"
-
-LICENSE="ISC"
-SLOT="0"
-KEYWORDS="alpha amd64 arm ~arm64 ia64 ~mips ppc ppc64 sparc x86"
-IUSE="gcrypt libressl"
-
-RDEPEND="!gcrypt? (
-		!libressl? ( dev-libs/openssl:0= )
-		libressl? ( dev-libs/libressl:= )
-	)
-	gcrypt? ( dev-libs/libgcrypt:0 )
-	dev-libs/libnl:3
-	net-wireless/wireless-regdb"
-DEPEND="${RDEPEND}
-	${PYTHON_DEPS}
-	$(python_gen_any_dep 'dev-python/m2crypto[${PYTHON_USEDEP}]')
-	virtual/pkgconfig"
-
-python_check_deps() {
-	has_version --host-root "dev-python/m2crypto[${PYTHON_USEDEP}]"
-}
-
-src_prepare() {
-	epatch "${FILESDIR}"/${PN}-3.18-no-ldconfig.patch
-	epatch "${FILESDIR}"/${PN}-3.18-no-werror.patch
-	epatch "${FILESDIR}"/${PN}-3.18-openssl.patch
-	epatch "${FILESDIR}"/${PN}-3.18-cflags.patch
-	epatch "${FILESDIR}"/${PN}-3.18-libreg-link.patch #542436
-	sed -i \
-		-e "s:\<pkg-config\>:$(tc-getPKG_CONFIG):" \
-		Makefile || die
-}
-
-_emake() {
-	# The source hardcodes /usr/lib/crda/ paths (ignoring all make vars
-	# that look like it should change it).  We want to use /usr/lib/
-	# anyways as this file is not ABI specific and we want to share it
-	# among all ABIs rather than pointlessly duplicate it.
-	#
-	# The trailing slash on SBINDIR is required by the source.
-	emake \
-		PREFIX="${EPREFIX}/usr" \
-		SBINDIR='$(PREFIX)/sbin/' \
-		LIBDIR='$(PREFIX)/'"$(get_libdir)" \
-		UDEV_RULE_DIR="$(get_udevdir)/rules.d" \
-		REG_BIN="${SYSROOT}"/usr/lib/crda/regulatory.bin \
-		USE_OPENSSL=$(usex gcrypt 0 1) \
-		CC="$(tc-getCC)" \
-		V=1 \
-		WERROR= \
-		"$@"
-}
-
-src_compile() {
-	_emake all_noverify
-}
-
-src_test() {
-	_emake verify
-}
-
-src_install() {
-	_emake DESTDIR="${D}" install
-	keepdir /etc/wireless-regdb/pubkeys
-}

diff --git a/net-wireless/crda/files/crda-1.1.3-missing-include.patch b/net-wireless/crda/files/crda-1.1.3-missing-include.patch
deleted file mode 100644
index a472e238f66..00000000000
--- a/net-wireless/crda/files/crda-1.1.3-missing-include.patch
+++ /dev/null
@@ -1,11 +0,0 @@
-diff --git a/reglib.c b/reglib.c
-index bc81974..1fafd37 100644
---- a/reglib.c
-+++ b/reglib.c
-@@ -9,6 +9,7 @@
- #include <fcntl.h>
- #include <stdbool.h>
- #include <unistd.h>
-+#include <string.h>
- 
- #include <arpa/inet.h> /* ntohl */

diff --git a/net-wireless/crda/files/crda-3.18-openssl.patch b/net-wireless/crda/files/crda-3.18-openssl.patch
deleted file mode 100644
index 9147e862ee5..00000000000
--- a/net-wireless/crda/files/crda-3.18-openssl.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From af009b7599d705a1023d7bc95c485e5a8776d2b8 Mon Sep 17 00:00:00 2001
-From: Mike Frysinger <vapier@chromium.org>
-Date: Wed, 4 Mar 2015 14:07:37 -0500
-Subject: [PATCH] fix openssl generation
-
-This file uses BN_ULONG but doesn't include the openssl headers leading
-to build failures:
-keys-ssl.c:2:8: error: unknown type name 'BN_ULONG'
- static BN_ULONG e_0[1] = {
-
-The large unqualified constants also break building:
-keys-ssl.c:8:2: warning: overflow in implicit constant conversion [-Woverflow]
-  0x63a2705416a0d8e1, 0xdc9fca11c8ba757b,
-  ^
-
-Signed-off-by: Mike Frysinger <vapier@gentoo.org>
----
- utils/key2pub.py | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/utils/key2pub.py b/utils/key2pub.py
-index 3e84cd2..c504aca 100755
---- a/utils/key2pub.py
-+++ b/utils/key2pub.py
-@@ -24,7 +24,7 @@ def print_ssl_64(output, name, val):
-     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)))
-+        output.write('0x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2xULL, ' % (ord(v1), ord(v2), ord(v3), ord(v4), ord(v5), ord(v6), ord(v7), ord(v8)))
-         idx += 1
-         if idx == 2:
-             idx = 0
-@@ -60,6 +60,7 @@ def print_ssl_32(output, name, val):
- def print_ssl(output, name, val):
-     import struct
-     output.write('#include <stdint.h>\n')
-+    output.write('#include <openssl/bn.h>\n')
-     if len(struct.pack('@L', 0)) == 8:
-         return print_ssl_64(output, name, val)
-     else:
--- 
-2.3.1
-


^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: net-wireless/crda/, net-wireless/crda/files/
@ 2020-09-19 12:29 Michał Górny
  0 siblings, 0 replies; 6+ messages in thread
From: Michał Górny @ 2020-09-19 12:29 UTC (permalink / raw
  To: gentoo-commits

commit:     5c9fd565323f6de88d2de6d2ed8a85374b41027d
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 19 11:47:59 2020 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Sep 19 12:29:07 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5c9fd565

net-wireless/crda: Remove old

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 net-wireless/crda/Manifest                         |   1 -
 net-wireless/crda/crda-3.18-r3.ebuild              |  83 ------
 .../crda-3.18-openssl-1.1.0-compatibility.patch    | 315 ---------------------
 3 files changed, 399 deletions(-)

diff --git a/net-wireless/crda/Manifest b/net-wireless/crda/Manifest
index 03e01bcb648..ea5835025eb 100644
--- a/net-wireless/crda/Manifest
+++ b/net-wireless/crda/Manifest
@@ -1,2 +1 @@
-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
deleted file mode 100644
index a121648be71..00000000000
--- a/net-wireless/crda/crda-3.18-r3.ebuild
+++ /dev/null
@@ -1,83 +0,0 @@
-# Copyright 2008-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-PYTHON_COMPAT=( python2_7 )
-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"
-
-LICENSE="ISC"
-SLOT="0"
-KEYWORDS="~alpha amd64 arm arm64 ~ia64 ~mips ppc ppc64 sparc x86"
-IUSE="gcrypt libressl"
-
-RDEPEND="!gcrypt? (
-		!libressl? ( dev-libs/openssl:0= )
-		libressl? ( dev-libs/libressl:0= )
-	)
-	gcrypt? ( dev-libs/libgcrypt:0= )
-	dev-libs/libnl:3
-	net-wireless/wireless-regdb"
-DEPEND="${RDEPEND}
-	${PYTHON_DEPS}
-	$(python_gen_any_dep 'dev-python/m2crypto[${PYTHON_USEDEP}]')
-	virtual/pkgconfig"
-
-python_check_deps() {
-	has_version --host-root "dev-python/m2crypto[${PYTHON_USEDEP}]"
-}
-
-PATCHES=(
-	"${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}-libressl.patch
-	"${FILESDIR}"/${PN}-ldflags.patch
-)
-
-src_prepare() {
-	default
-	sed -i \
-		-e "s:\<pkg-config\>:$(tc-getPKG_CONFIG):" \
-		Makefile || die
-}
-
-_emake() {
-	# The source hardcodes /usr/lib/crda/ paths (ignoring all make vars
-	# that look like it should change it).  We want to use /usr/lib/
-	# anyways as this file is not ABI specific and we want to share it
-	# among all ABIs rather than pointlessly duplicate it.
-	#
-	# The trailing slash on SBINDIR is required by the source.
-	emake \
-		PREFIX="${EPREFIX}/usr" \
-		SBINDIR='$(PREFIX)/sbin/' \
-		LIBDIR='$(PREFIX)/'"$(get_libdir)" \
-		UDEV_RULE_DIR="$(get_udevdir)/rules.d" \
-		REG_BIN="${SYSROOT}"/usr/lib/crda/regulatory.bin \
-		USE_OPENSSL=$(usex gcrypt 0 1) \
-		CC="$(tc-getCC)" \
-		V=1 \
-		WERROR= \
-		"$@"
-}
-
-src_compile() {
-	_emake all_noverify
-}
-
-src_test() {
-	_emake verify
-}
-
-src_install() {
-	_emake DESTDIR="${D}" install
-	keepdir /etc/wireless-regdb/pubkeys
-}

diff --git a/net-wireless/crda/files/crda-3.18-openssl-1.1.0-compatibility.patch b/net-wireless/crda/files/crda-3.18-openssl-1.1.0-compatibility.patch
deleted file mode 100644
index 00a9b5570d2..00000000000
--- a/net-wireless/crda/files/crda-3.18-openssl-1.1.0-compatibility.patch
+++ /dev/null
@@ -1,315 +0,0 @@
-From 338637ac08c19708eb35523894b44bbe3c726cfa Mon Sep 17 00:00:00 2001
-From: quentin <quentin@minster.io>
-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 <quentin@minster.io>
----
- 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 <openssl/rsa.h>
- #include <openssl/sha.h>
- #include <openssl/pem.h>
-+#include <openssl/bn.h>
- #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, 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] == '\0':
--        val = val[1:]
--    while len(val) % 8:
--        val = '\0' + val
--    vnew = []
--    while len(val):
--        vnew.append((val[0], val[1], val[2], val[3], val[4], val[5], val[6], val[7]))
--        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] == '\0':
--        val = val[1:]
--    while len(val) % 4:
--        val = '\0' + val
--    vnew = []
--    while len(val):
--        vnew.append((val[0], val[1], val[2], val[3], ))
--        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 <stdint.h>\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 xrange(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 <stdint.h>\n')
-+def print_bignum(output, name, val):
-     while val[0] == '\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 xrange(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 <stdint.h>\n\n\n')
- 
- # load key
- idx = 0
-@@ -148,8 +63,8 @@ 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)
--- 
-2.16.2
-


^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: net-wireless/crda/, net-wireless/crda/files/
@ 2020-01-15 14:44 Craig Andrews
  0 siblings, 0 replies; 6+ messages in thread
From: Craig Andrews @ 2020-01-15 14:44 UTC (permalink / raw
  To: gentoo-commits

commit:     9c50acec16bc7c33d6dc122c007d713e7fbecf9c
Author:     Vjaceslavs Klimovs <vklimovs <AT> gmail <DOT> com>
AuthorDate: Mon Jan  6 00:46:08 2020 +0000
Commit:     Craig Andrews <candrews <AT> gentoo <DOT> 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 <vklimovs <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/14254
Signed-off-by: Craig Andrews <candrews <AT> 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 <quentin@minster.io>
+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 <quentin@minster.io>
+---
+ 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 <openssl/rsa.h>
+ #include <openssl/sha.h>
+ #include <openssl/pem.h>
++#include <openssl/bn.h>
+ #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 <stdint.h>\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 <stdint.h>\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 <stdint.h>\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 <stdint.h>\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


^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: net-wireless/crda/, net-wireless/crda/files/
@ 2019-02-16 18:28 Aaron Bauman
  0 siblings, 0 replies; 6+ messages in thread
From: Aaron Bauman @ 2019-02-16 18:28 UTC (permalink / raw
  To: gentoo-commits

commit:     24d747741061e9a86d4d56b953f55577ddd2e55f
Author:     Stefan Strogin <stefan.strogin <AT> gmail <DOT> com>
AuthorDate: Wed Dec 12 00:01:04 2018 +0000
Commit:     Aaron Bauman <bman <AT> gentoo <DOT> org>
CommitDate: Sat Feb 16 18:28:23 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=24d74774

net-wireless/crda: fix build with LibreSSL

Closes: https://bugs.gentoo.org/669596
Package-Manager: Portage-2.3.52, Repoman-2.3.12
Signed-off-by: Stefan Strogin <stefan.strogin <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/10617
Signed-off-by: Aaron Bauman <bman <AT> gentoo.org>

 .../crda/{crda-3.18-r2.ebuild => crda-3.18-r3.ebuild}         |  3 ++-
 net-wireless/crda/files/crda-3.18-libressl.patch              | 11 +++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/net-wireless/crda/crda-3.18-r2.ebuild b/net-wireless/crda/crda-3.18-r3.ebuild
similarity index 96%
rename from net-wireless/crda/crda-3.18-r2.ebuild
rename to net-wireless/crda/crda-3.18-r3.ebuild
index c8ed53fe48e..231bcd48e07 100644
--- a/net-wireless/crda/crda-3.18-r2.ebuild
+++ b/net-wireless/crda/crda-3.18-r3.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=6
@@ -38,6 +38,7 @@ PATCHES=(
 	"${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
 )
 
 src_prepare() {

diff --git a/net-wireless/crda/files/crda-3.18-libressl.patch b/net-wireless/crda/files/crda-3.18-libressl.patch
new file mode 100644
index 00000000000..817f2e0328c
--- /dev/null
+++ b/net-wireless/crda/files/crda-3.18-libressl.patch
@@ -0,0 +1,11 @@
+--- crda-3.18/reglib.c	2018-10-26 12:39:19.128083735 +1100
++++ crda-3.18.a/reglib.c	2018-10-26 12:42:39.737916626 +1100
+@@ -111,7 +111,7 @@ int reglib_verify_db_signature(uint8_t *
+ 			goto out;
+ 		}
+ 
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x2070000fL)
+ 		rsa->e = rsa_e;
+ 		rsa->n = rsa_n;
+ #else


^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: net-wireless/crda/, net-wireless/crda/files/
@ 2018-10-24 21:09 Lars Wendler
  0 siblings, 0 replies; 6+ messages in thread
From: Lars Wendler @ 2018-10-24 21:09 UTC (permalink / raw
  To: gentoo-commits

commit:     7b3d816ab59a4e9a0b213743555f869141f0a071
Author:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 24 21:09:00 2018 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Wed Oct 24 21:09:34 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7b3d816a

net-wireless/crda: Revbump to fix openssl-1.1 build failure.

Also bumped ebuild to EAPI-6.

Closes: https://bugs.gentoo.org/652428
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
Package-Manager: Portage-2.3.51, Repoman-2.3.11

 net-wireless/crda/crda-3.18-r2.ebuild              |  81 ++++++
 .../crda-3.18-openssl-1.1.0-compatibility.patch    | 315 +++++++++++++++++++++
 2 files changed, 396 insertions(+)

diff --git a/net-wireless/crda/crda-3.18-r2.ebuild b/net-wireless/crda/crda-3.18-r2.ebuild
new file mode 100644
index 00000000000..db7d191eab6
--- /dev/null
+++ b/net-wireless/crda/crda-3.18-r2.ebuild
@@ -0,0 +1,81 @@
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python2_7 )
+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
+	mirror://kernel/software/network/crda/${P}.tar.xz"
+
+LICENSE="ISC"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
+IUSE="gcrypt libressl"
+
+RDEPEND="!gcrypt? (
+		!libressl? ( dev-libs/openssl:0 )
+		libressl? ( dev-libs/libressl )
+	)
+	gcrypt? ( dev-libs/libgcrypt:0 )
+	dev-libs/libnl:3
+	net-wireless/wireless-regdb"
+DEPEND="${RDEPEND}
+	${PYTHON_DEPS}
+	$(python_gen_any_dep 'dev-python/m2crypto[${PYTHON_USEDEP}]')
+	virtual/pkgconfig"
+
+python_check_deps() {
+	has_version --host-root "dev-python/m2crypto[${PYTHON_USEDEP}]"
+}
+
+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
+)
+
+src_prepare() {
+	default
+	sed -i \
+		-e "s:\<pkg-config\>:$(tc-getPKG_CONFIG):" \
+		Makefile || die
+}
+
+_emake() {
+	# The source hardcodes /usr/lib/crda/ paths (ignoring all make vars
+	# that look like it should change it).  We want to use /usr/lib/
+	# anyways as this file is not ABI specific and we want to share it
+	# among all ABIs rather than pointlessly duplicate it.
+	#
+	# The trailing slash on SBINDIR is required by the source.
+	emake \
+		PREFIX="${EPREFIX}/usr" \
+		SBINDIR='$(PREFIX)/sbin/' \
+		LIBDIR='$(PREFIX)/'"$(get_libdir)" \
+		UDEV_RULE_DIR="$(get_udevdir)/rules.d" \
+		REG_BIN="${SYSROOT}"/usr/lib/crda/regulatory.bin \
+		USE_OPENSSL=$(usex gcrypt 0 1) \
+		CC="$(tc-getCC)" \
+		V=1 \
+		WERROR= \
+		"$@"
+}
+
+src_compile() {
+	_emake all_noverify
+}
+
+src_test() {
+	_emake verify
+}
+
+src_install() {
+	_emake DESTDIR="${D}" install
+	keepdir /etc/wireless-regdb/pubkeys
+}

diff --git a/net-wireless/crda/files/crda-3.18-openssl-1.1.0-compatibility.patch b/net-wireless/crda/files/crda-3.18-openssl-1.1.0-compatibility.patch
new file mode 100644
index 00000000000..00a9b5570d2
--- /dev/null
+++ b/net-wireless/crda/files/crda-3.18-openssl-1.1.0-compatibility.patch
@@ -0,0 +1,315 @@
+From 338637ac08c19708eb35523894b44bbe3c726cfa Mon Sep 17 00:00:00 2001
+From: quentin <quentin@minster.io>
+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 <quentin@minster.io>
+---
+ 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 <openssl/rsa.h>
+ #include <openssl/sha.h>
+ #include <openssl/pem.h>
++#include <openssl/bn.h>
+ #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, 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] == '\0':
+-        val = val[1:]
+-    while len(val) % 8:
+-        val = '\0' + val
+-    vnew = []
+-    while len(val):
+-        vnew.append((val[0], val[1], val[2], val[3], val[4], val[5], val[6], val[7]))
+-        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] == '\0':
+-        val = val[1:]
+-    while len(val) % 4:
+-        val = '\0' + val
+-    vnew = []
+-    while len(val):
+-        vnew.append((val[0], val[1], val[2], val[3], ))
+-        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 <stdint.h>\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 xrange(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 <stdint.h>\n')
++def print_bignum(output, name, val):
+     while val[0] == '\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 xrange(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 <stdint.h>\n\n\n')
+ 
+ # load key
+ idx = 0
+@@ -148,8 +63,8 @@ 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)
+-- 
+2.16.2
+


^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: net-wireless/crda/, net-wireless/crda/files/
@ 2015-11-14 13:12 Bjarke Istrup Pedersen
  0 siblings, 0 replies; 6+ messages in thread
From: Bjarke Istrup Pedersen @ 2015-11-14 13:12 UTC (permalink / raw
  To: gentoo-commits

commit:     a00a55bf6f2cd45565484802af1ab4cd12830f2f
Author:     Bjarke Istrup Pedersen <gurligebis <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 14 13:09:34 2015 +0000
Commit:     Bjarke Istrup Pedersen <gurligebis <AT> gentoo <DOT> org>
CommitDate: Sat Nov 14 13:12:10 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a00a55bf

net-wireless/crda: Removing old versions

Package-Manager: portage-2.2.24

 net-wireless/crda/Manifest                   |  1 -
 net-wireless/crda/crda-1.1.2-r3.ebuild       | 48 ----------------------
 net-wireless/crda/crda-1.1.2-r4.ebuild       | 58 ---------------------------
 net-wireless/crda/crda-1.1.3.ebuild          | 56 --------------------------
 net-wireless/crda/files/libnl31-support.diff | 60 ----------------------------
 5 files changed, 223 deletions(-)

diff --git a/net-wireless/crda/Manifest b/net-wireless/crda/Manifest
index 30890a7..88cc0c2 100644
--- a/net-wireless/crda/Manifest
+++ b/net-wireless/crda/Manifest
@@ -1,3 +1,2 @@
-DIST crda-1.1.2.tar.bz2 21754 SHA256 e469348a5d0bb933df31995869130f68901de9be02e666437f52125698851864 SHA512 cd0997fdafc63640cbac5cff57b617177c3693a6d05e2138f23ed8273502d5f485f8f60309ed4fec97fe2cd2d51ee4b7e2d9535efc1de44c08b9cc9d6fb7ecf3 WHIRLPOOL 35ef76fcb7f3760613135caba5b9c6b0c781bc560f948a60f6b09eaeb75f3538461d90ce353decc17795995795b63c124a282903d41a8e25680fda0b6498bea4
 DIST crda-1.1.3.tar.bz2 38697 SHA256 aa8a7fe92f0765986c421a5b6768a185375ac210393df0605ee132f6754825f0 SHA512 4ec37d3d51f5988af79c2eaadc1bce344f20d4d9833533838d308533ee02cb12d5ed193391679ae1231c8afe61b21defdb368614a6238f99fdc5824f6819cfed WHIRLPOOL bbcb31277b664243f9e494c494152cf0ebcb187360ba48aa07c8e96c83dd91098bc49f1edf0b196a9bf4071565ac389b2907fcc73e348780aa890e066895c282
 DIST crda-3.18.tar.xz 61516 SHA256 43fcb9679f8b75ed87ad10944a506292def13e4afb194afa7aa921b01e8ecdbf SHA512 57ae6309159f396448f052c127f401c2f63d47f4193e87dca231c4b7bbbd7e69b5e5666f356fc76dfc8a6ae58ffa55c3794428d6eb34d9937df77c4276036588 WHIRLPOOL f2ee46b8e25509b6f78e508e62de3f1d0d85303b173b38d653f69f4f6e8f77ada2bc3330cd62646a1ce3819b0db834d9aecc9751cf3e7d35e2a67d3ffdfb1503

diff --git a/net-wireless/crda/crda-1.1.2-r3.ebuild b/net-wireless/crda/crda-1.1.2-r3.ebuild
deleted file mode 100644
index 6c1aaf8..0000000
--- a/net-wireless/crda/crda-1.1.2-r3.ebuild
+++ /dev/null
@@ -1,48 +0,0 @@
-# Copyright 1999-2014 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI=4
-inherit eutils toolchain-funcs python
-
-DESCRIPTION="Central Regulatory Domain Agent for wireless networks"
-HOMEPAGE="https://wireless.kernel.org/en/developers/Regulatory"
-SRC_URI="http://linuxwireless.org/download/crda/${P}.tar.bz2"
-
-LICENSE="ISC"
-SLOT="0"
-KEYWORDS="amd64 arm ~mips ppc ppc64 x86"
-IUSE=""
-
-RDEPEND="dev-libs/openssl
-	dev-libs/libnl
-	net-wireless/wireless-regdb"
-DEPEND="${RDEPEND}
-	dev-python/m2crypto
-	=dev-lang/python-2*
-	virtual/pkgconfig"
-RDEPEND="${RDEPEND}
-	>=virtual/udev-171"
-
-src_prepare() {
-	epatch "${FILESDIR}"/libnl31-support.diff
-
-	python_convert_shebangs 2 utils/key2pub.py
-
-	sed -i \
-		-e "s:\<pkg-config\>:$(tc-getPKG_CONFIG):" \
-		Makefile || die
-}
-
-src_compile() {
-	emake UDEV_RULE_DIR=/lib/udev/rules.d/ REG_BIN=/usr/$(get_libdir)/crda/regulatory.bin USE_OPENSSL=1 CC="$(tc-getCC)" all_noverify
-}
-
-src_test() {
-	emake USE_OPENSSL=1 CC="$(tc-getCC)" verify
-}
-
-src_install() {
-	emake UDEV_RULE_DIR=/lib/udev/rules.d/ REG_BIN=/usr/$(get_libdir)/crda/regulatory.bin USE_OPENSSL=1 DESTDIR="${D}" install
-	keepdir /etc/wireless-regdb/pubkeys
-}

diff --git a/net-wireless/crda/crda-1.1.2-r4.ebuild b/net-wireless/crda/crda-1.1.2-r4.ebuild
deleted file mode 100644
index eb63f6d..0000000
--- a/net-wireless/crda/crda-1.1.2-r4.ebuild
+++ /dev/null
@@ -1,58 +0,0 @@
-# Copyright 1999-2014 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI=4
-inherit eutils toolchain-funcs python
-
-DESCRIPTION="Central Regulatory Domain Agent for wireless networks"
-HOMEPAGE="https://wireless.kernel.org/en/developers/Regulatory"
-SRC_URI="http://linuxwireless.org/download/crda/${P}.tar.bz2"
-
-LICENSE="ISC"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
-IUSE=""
-
-RDEPEND="dev-libs/openssl:0
-	dev-libs/libnl:3
-	net-wireless/wireless-regdb
-	>=virtual/udev-171"
-DEPEND="${RDEPEND}
-	dev-python/m2crypto
-	=dev-lang/python-2*
-	virtual/pkgconfig"
-
-src_prepare() {
-	epatch "${FILESDIR}"/libnl31-support.diff
-
-	python_convert_shebangs 2 utils/key2pub.py
-
-	sed -i \
-		-e "s:\<pkg-config\>:$(tc-getPKG_CONFIG):" \
-		Makefile || die
-}
-
-src_compile() {
-	emake \
-		UDEV_RULE_DIR="$($(tc-getPKG_CONFIG) --variable=udevdir udev)/rules.d" \
-		REG_BIN=/usr/$(get_libdir)/crda/regulatory.bin \
-		USE_OPENSSL=1 \
-		CC="$(tc-getCC)" \
-		all_noverify V=1
-}
-
-src_test() {
-	emake USE_OPENSSL=1 CC="$(tc-getCC)" verify
-}
-
-src_install() {
-	emake \
-		UDEV_RULE_DIR="$($(tc-getPKG_CONFIG) --variable=udevdir udev)/rules.d" \
-		REG_BIN=/usr/$(get_libdir)/crda/regulatory.bin \
-		USE_OPENSSL=1 \
-		DESTDIR="${D}" \
-		install
-
-	keepdir /etc/wireless-regdb/pubkeys
-}

diff --git a/net-wireless/crda/crda-1.1.3.ebuild b/net-wireless/crda/crda-1.1.3.ebuild
deleted file mode 100644
index ce468ed..0000000
--- a/net-wireless/crda/crda-1.1.3.ebuild
+++ /dev/null
@@ -1,56 +0,0 @@
-# Copyright 1999-2014 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI=4
-inherit eutils toolchain-funcs python udev
-
-DESCRIPTION="Central Regulatory Domain Agent for wireless networks"
-HOMEPAGE="https://wireless.kernel.org/en/developers/Regulatory"
-SRC_URI="http://linuxwireless.org/download/crda/${P}.tar.bz2"
-
-LICENSE="ISC"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
-IUSE=""
-
-RDEPEND="dev-libs/openssl:0
-	dev-libs/libnl:3
-	net-wireless/wireless-regdb"
-DEPEND="${RDEPEND}
-	dev-python/m2crypto
-	=dev-lang/python-2*
-	virtual/pkgconfig"
-
-src_prepare() {
-	python_convert_shebangs 2 utils/key2pub.py
-
-	epatch "${FILESDIR}"/${P}-missing-include.patch
-	sed -i \
-		-e "s:\<pkg-config\>:$(tc-getPKG_CONFIG):" \
-		Makefile || die
-}
-
-src_compile() {
-	emake \
-		UDEV_RULE_DIR="$(get_udevdir)/rules.d" \
-		REG_BIN=/usr/$(get_libdir)/crda/regulatory.bin \
-		USE_OPENSSL=1 \
-		CC="$(tc-getCC)" \
-		all_noverify V=1
-}
-
-src_test() {
-	emake USE_OPENSSL=1 CC="$(tc-getCC)" verify
-}
-
-src_install() {
-	emake \
-		UDEV_RULE_DIR="$(get_udevdir)/rules.d" \
-		REG_BIN=/usr/$(get_libdir)/crda/regulatory.bin \
-		USE_OPENSSL=1 \
-		DESTDIR="${D}" \
-		install
-
-	keepdir /etc/wireless-regdb/pubkeys
-}

diff --git a/net-wireless/crda/files/libnl31-support.diff b/net-wireless/crda/files/libnl31-support.diff
deleted file mode 100644
index 56243ee..0000000
--- a/net-wireless/crda/files/libnl31-support.diff
+++ /dev/null
@@ -1,60 +0,0 @@
-diff -aurp a/crda-1.1.2/crda.c b/crda-1.1.2/crda.c
---- a/crda-1.1.2/crda.c	2011-11-07 19:52:28.884873650 +0000
-+++ b/crda-1.1.2/crda.c	2011-11-07 19:53:30.501874372 +0000
-@@ -21,7 +21,7 @@
- #include "regdb.h"
- #include "reglib.h"
- 
--#if !defined(CONFIG_LIBNL20) && !defined(CONFIG_LIBNL30)
-+#if !defined(CONFIG_LIBNL20) && !defined(CONFIG_LIBNL30) && !defined(CONFIG_LIBNL31)
- /* libnl 2.0 compatibility code */
- static inline struct nl_handle *nl_socket_alloc(void)
- {
-@@ -44,7 +44,7 @@ static inline int __genl_ctrl_alloc_cach
- 
- #define genl_ctrl_alloc_cache __genl_ctrl_alloc_cache
- #define nl_sock nl_handle
--#endif /* CONFIG_LIBNL20 && CONFIG_LIBNL30 */
-+#endif /* CONFIG_LIBNL20 && CONFIG_LIBNL30 && CONFIG_LIBNL31 */
- 
- struct nl80211_state {
- 	struct nl_sock *nl_sock;
-diff -aurp a/crda-1.1.2/Makefile b/crda-1.1.2/Makefile
---- a/crda-1.1.2/Makefile	2011-11-07 19:52:28.884873650 +0000
-+++ b/crda-1.1.2/Makefile	2011-11-07 19:54:25.906872386 +0000
-@@ -48,19 +48,26 @@ INSTALL ?= install
- NL1FOUND := $(shell pkg-config --atleast-version=1 libnl-1 && echo Y)
- NL2FOUND := $(shell pkg-config --atleast-version=2 libnl-2.0 && echo Y)
- NL3FOUND := $(shell pkg-config --atleast-version=3 libnl-3.0 && echo Y)
-+NL31FOUND := $(shell pkg-config --atleast-version=3 libnl-3.1 && echo Y)
- 
--ifeq ($(NL3FOUND),Y)
-+ifeq ($(NL31FOUND),Y)
- CFLAGS += -DCONFIG_LIBNL30
--NLLIBS += -lnl-genl
--NLLIBNAME = libnl-3.0
-+NLLIBS += $(shell pkg-config --libs libnl-genl-3.1)
-+NLLIBNAME = libnl-3.1
- else
--	ifeq ($(NL2FOUND),Y)
--	CFLAGS += -DCONFIG_LIBNL20
--	NLLIBS += -lnl-genl
--	NLLIBNAME = libnl-2.0
-+	ifeq ($(NL3FOUND),Y)
-+	CFLAGS += -DCONFIG_LIBNL30
-+	NLLIBS += $(shell pkg-config --libs libnl-genl-3.0)
-+	NLLIBNAME = libnl-3.0
- 	else
--		ifeq ($(NL1FOUND),Y)
--		NLLIBNAME = libnl-1
-+		ifeq ($(NL2FOUND),Y)
-+		CFLAGS += -DCONFIG_LIBNL20
-+		NLLIBS += -lnl-genl
-+		NLLIBNAME = libnl-2.0
-+		else
-+			ifeq ($(NL1FOUND),Y)
-+			NLLIBNAME = libnl-1
-+			endif
- 		endif
- 	endif
- endif


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-09-19 12:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-05 21:19 [gentoo-commits] repo/gentoo:master commit in: net-wireless/crda/, net-wireless/crda/files/ Andreas Sturmlechner
  -- strict thread matches above, loose matches on Subject: below --
2020-09-19 12:29 Michał Górny
2020-01-15 14:44 Craig Andrews
2019-02-16 18:28 Aaron Bauman
2018-10-24 21:09 Lars Wendler
2015-11-14 13:12 Bjarke Istrup Pedersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox