tdev-libs/opensc: Add 0.19.0 with libressl patches. - parlay - yet another gentoo overlay HTML git clone https://git.parazyd.org/parlay DIR Log DIR Files DIR Refs DIR README --- DIR commit fe4d6b20b42f10933a1ebd3ba696bf3d8d3e83eb DIR parent 05253d635403fd644d161a5039e250bde237c84a HTML Author: parazyd <parazyd@dyne.org> Date: Mon, 26 Nov 2018 15:37:07 +0100 dev-libs/opensc: Add 0.19.0 with libressl patches. Diffstat: A dev-libs/opensc/Manifest | 1 + A dev-libs/opensc/files/libressl.pat… | 44 +++++++++++++++++++++++++++++++ A dev-libs/opensc/files/opensc-0.19.… | 108 +++++++++++++++++++++++++++++++ A dev-libs/opensc/metadata.xml | 29 +++++++++++++++++++++++++++++ A dev-libs/opensc/opensc-0.19.0-r2.e… | 62 +++++++++++++++++++++++++++++++ 5 files changed, 244 insertions(+), 0 deletions(-) --- DIR diff --git a/dev-libs/opensc/Manifest b/dev-libs/opensc/Manifest t@@ -0,0 +1 @@ +DIST opensc-0.19.0.tar.gz 2080320 BLAKE2B c07df317f26562107680ed586e9a1ea83252c10a7dd227cffe51de709d9c888874963f6835a68f83f212d83f264b0231ea7428ed8d3ecce74cb9265d8191040a SHA512 90659133fb593cbf82ed6502e3858f34119bff051e3090489b7622659dcb1c26d389a4715892aa60a5606bc0ce115bd6c504521abfb965de9ad46441e4ed2b8e DIR diff --git a/dev-libs/opensc/files/libressl.patch b/dev-libs/opensc/files/libressl.patch t@@ -0,0 +1,44 @@ +diff --git a/src/libopensc/sc-ossl-compat.h b/src/libopensc/sc-ossl-compat.h +index 8ef5a94..2124eb5 100644 +--- a/src/libopensc/sc-ossl-compat.h ++++ b/src/libopensc/sc-ossl-compat.h +@@ -97,7 +97,7 @@ extern "C" { + #if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x2050300fL + #define X509_up_ref(cert) CRYPTO_add(&cert->references, 1, CRYPTO_LOCK_X509) + #endif +-#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x20700000L ++#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER + #define OPENSSL_malloc_init CRYPTO_malloc_init + #define EVP_PKEY_get0_RSA(x) (x->pkey.rsa) + #define EVP_PKEY_get0_EC_KEY(x) (x->pkey.ec) +@@ -138,7 +138,7 @@ extern "C" { + # endif + #endif + +-#if OPENSSL_VERSION_NUMBER < 0x10100000L || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x2050300fL) ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || (defined(LIBRESSL_VERSION_NUMBER)) + + #define RSA_bits(R) (BN_num_bits(R->n)) + +diff --git a/src/tools/sc-hsm-tool.c b/src/tools/sc-hsm-tool.c +index 9c1d7c1..2111caf 100644 +--- a/src/tools/sc-hsm-tool.c ++++ b/src/tools/sc-hsm-tool.c +@@ -1761,16 +1761,10 @@ int main(int argc, char *argv[]) + } + } + +-#if OPENSSL_VERSION_NUMBER >= 0x10100000L || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x20700000L) +- OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS +- | OPENSSL_INIT_ADD_ALL_CIPHERS +- | OPENSSL_INIT_ADD_ALL_DIGESTS, +- NULL); +-#else ++ + CRYPTO_malloc_init(); + ERR_load_crypto_strings(); + OpenSSL_add_all_algorithms(); +-#endif + + memset(&ctx_param, 0, sizeof(sc_context_param_t)); + ctx_param.app_name = app_name; DIR diff --git a/dev-libs/opensc/files/opensc-0.19.0-p11test_common.h.patch b/dev-libs/opensc/files/opensc-0.19.0-p11test_common.h.patch t@@ -0,0 +1,108 @@ +From d1e4f4879b8d0a7423afc1c9a3632da4763ee31c Mon Sep 17 00:00:00 2001 +From: Alon Bar-Lev <alon.barlev@gmail.com> +Date: Sat, 15 Sep 2018 11:04:13 +0300 +Subject: [PATCH] missing include + +--- + src/tests/p11test/p11test_common.h | 89 ++++++++++++++++++++++++++++++++++++++ + 1 file changed, 89 insertions(+) + create mode 100644 src/tests/p11test/p11test_common.h + +diff --git a/src/tests/p11test/p11test_common.h b/src/tests/p11test/p11test_common.h +new file mode 100644 +index 0000000..d3ca304 +--- /dev/null ++++ b/src/tests/p11test/p11test_common.h +@@ -0,0 +1,89 @@ ++/* ++ * p11test_common.h: Test suite shared declarations for PKCS#11 API ++ * ++ * Copyright (C) 2016 Martin Strhársky <strharsky.martin@gmail.com> ++ * Copyright (C) 2016, 2017 Red Hat, Inc. ++ * ++ * Author: Jakub Jelen <jjelen@redhat.com> ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program. If not, see <http://www.gnu.org/licenses/>. ++ */ ++ ++#ifndef P11TEST_COMMON_H ++#define P11TEST_COMMON_H ++#include "config.h" ++#include <stdio.h> ++#include <stdlib.h> ++#include <string.h> ++#include <setjmp.h> ++#include <cmocka.h> ++#include "pkcs11/pkcs11.h" ++#include "libopensc/sc-ossl-compat.h" ++ ++#define MAX_MECHS 200 ++ ++#ifndef NDEBUG ++ #define debug_print(fmt, ...) \ ++ { fprintf(stderr, fmt "\n", ##__VA_ARGS__); } while (0) ++#else ++ #define debug_print(fmt, ...) ++#endif ++ ++#define FLAGS_SIGN 0x01 ++#define FLAGS_SIGN_OPENSSL 0x02 ++#define FLAGS_SIGN_ANY ( FLAGS_SIGN | FLAGS_SIGN_OPENSSL ) ++#define FLAGS_DECRYPT 0x04 ++#define FLAGS_DECRYPT_OPENSSL 0x08 ++#define FLAGS_DECRYPT_ANY ( FLAGS_DECRYPT | FLAGS_DECRYPT_OPENSSL ) ++ ++typedef struct { ++ char *outfile; ++ FILE *fd; ++ int in_test; ++ int first; ++ int in_data; ++ int first_data; ++} log_context_t; ++ ++typedef struct { ++ CK_MECHANISM_TYPE mech; ++ CK_MECHANISM_TYPE hash; ++ CK_RSA_PKCS_MGF_TYPE mgf; ++ int salt; ++ int usage_flags; ++ int result_flags; ++} test_mech_t; ++ ++typedef struct { ++ CK_FUNCTION_LIST_PTR function_pointer; ++ CK_SLOT_ID slot_id; ++ CK_SESSION_HANDLE session_handle; ++ CK_UTF8CHAR* pin; ++ size_t pin_length; ++ char *library_path; ++ unsigned int interactive; ++ log_context_t log; ++ ++ test_mech_t rsa_mechs[MAX_MECHS]; ++ size_t num_rsa_mechs; ++ test_mech_t ec_mechs[MAX_MECHS]; ++ size_t num_ec_mechs; ++ test_mech_t keygen_mechs[MAX_MECHS]; ++ size_t num_keygen_mechs; ++} token_info_t; ++ ++token_info_t token; ++ ++#endif /* P11TEST_COMMON_H */ ++ +-- +2.16.4 + DIR diff --git a/dev-libs/opensc/metadata.xml b/dev-libs/opensc/metadata.xml t@@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="project"> + <email>crypto@gentoo.org</email> + <name>Crypto</name> + </maintainer> + <longdescription> + OpenSC is a library for accessing SmartCard devices. It is also + the core library of the OpenSC project. + + Basic functionality (e.g. SELECT FILE, READ BINARY) should work on + any ISO 7816-4 compatible SmartCard. Encryption and decryption + using private keys on the SmartCard is possible with PKCS #15 + compatible cards, such as the FINEID (Finnish Electronic IDentity) + card. + </longdescription> + <use> + <flag name="ctapi">Use CT-API for accessing Smartcard hardware</flag> + <flag name="notify">Enable notifications</flag> + <flag name="openct">Use <pkg>dev-libs/openct</pkg> (and CT-API) for accessing Smartcard hardware</flag> + <flag name="pcsc-lite">Use <pkg>sys-apps/pcsc-lite</pkg> (and PC/SC API) for accessing Smartcard hardware</flag> + <flag name="secure-messaging">Enable secure messaging</flag> + </use> + <upstream> + <remote-id type="github">OpenSC/OpenSC</remote-id> + <remote-id type="sourceforge">opensc</remote-id> + </upstream> +</pkgmetadata> DIR diff --git a/dev-libs/opensc/opensc-0.19.0-r2.ebuild b/dev-libs/opensc/opensc-0.19.0-r2.ebuild t@@ -0,0 +1,62 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit bash-completion-r1 + +DESCRIPTION="Libraries and applications to access smartcards" +HOMEPAGE="https://github.com/OpenSC/OpenSC/wiki" +SRC_URI="https://github.com/OpenSC/OpenSC/releases/download/${PV}/${P}.tar.gz" + +LICENSE="LGPL-2.1" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" +IUSE="ctapi doc libressl openct notify +pcsc-lite readline secure-messaging ssl test zlib" + +RDEPEND="zlib? ( sys-libs/zlib ) + readline? ( sys-libs/readline:0= ) + libressl? ( dev-libs/libressl:0= ) + openct? ( >=dev-libs/openct-0.5.0 ) + pcsc-lite? ( >=sys-apps/pcsc-lite-1.3.0 ) + notify? ( dev-libs/glib:2= )" +DEPEND="${RDEPEND} + app-text/docbook-xsl-stylesheets + dev-libs/libxslt + test? ( dev-util/cmocka )" +BDEPEND="virtual/pkgconfig" + +REQUIRED_USE=" + pcsc-lite? ( !openct !ctapi ) + openct? ( !pcsc-lite !ctapi ) + ctapi? ( !pcsc-lite !openct ) + || ( pcsc-lite openct ctapi )" + +PATCHES=( + "${FILESDIR}/${P}-p11test_common.h.patch" + "${FILESDIR}/libressl.patch" +) + +src_configure() { + econf \ + --with-completiondir="$(get_bashcompdir)" \ + --disable-openpace \ + --disable-static \ + --enable-man \ + $(use_enable ctapi) \ + $(use_enable doc) \ + $(use_enable notify ) \ + $(use_enable openct) \ + $(use_enable openct) \ + $(use_enable pcsc-lite pcsc) \ + $(use_enable readline) \ + $(use_enable secure-messaging sm) \ + $(use_enable ssl openssl) \ + $(use_enable test tests) \ + $(use_enable zlib) +} + +src_install() { + default + find "${D}" -name '*.la' -delete || die +}