commit:     19114816f2468b127302df95af1ba3ec1f577136
Author:     Stefan Strogin <stefan.strogin <AT> gmail <DOT> com>
AuthorDate: Sun Apr  7 21:15:02 2019 +0000
Commit:     Stefan Strogin <stefan.strogin <AT> gmail <DOT> com>
CommitDate: Sun Apr  7 21:15:02 2019 +0000
URL:        https://gitweb.gentoo.org/repo/proj/libressl.git/commit/?id=19114816

app-crypt/qca: add package from gentoo.git; patch for LibreSSL

Bug: https://bugs.gentoo.org/657720
Package-Manager: Portage-2.3.62, Repoman-2.3.12
Signed-off-by: Stefan Strogin <stefan.strogin <AT> gmail.com>

 app-crypt/qca/Manifest                             |  1 +
 .../qca/files/qca-2.2.0_pre20180606-libressl.patch | 81 +++++++++++++++++++
 app-crypt/qca/files/qca-disable-pgp-test.patch     | 13 ++++
 app-crypt/qca/metadata.xml                         | 26 +++++++
 app-crypt/qca/qca-2.2.0_pre20180606.ebuild         | 90 ++++++++++++++++++++++
 5 files changed, 211 insertions(+)

diff --git a/app-crypt/qca/Manifest b/app-crypt/qca/Manifest
new file mode 100644
index 0000000..f525059
--- /dev/null
+++ b/app-crypt/qca/Manifest
@@ -0,0 +1 @@
+DIST qca-2.2.0_pre20180606.tar.xz 700756 BLAKE2B 
0204854a664f211e9289cd4609938fd21e62de5bec5d7f5a99843a12483c960b6f8cc7392dc84bcf0676220411106bf7f23c5059d4f7031791fe9a3259d21d2c
 SHA512 
78f9f8ebc726e95768034c580d5ac30933f7c06e026b7daad04f11477dc623e4267895e409f7830c5149e620876dcc524278ef569956d03820b0864d629c4df8

diff --git a/app-crypt/qca/files/qca-2.2.0_pre20180606-libressl.patch 
b/app-crypt/qca/files/qca-2.2.0_pre20180606-libressl.patch
new file mode 100644
index 0000000..2f6d461
--- /dev/null
+++ b/app-crypt/qca/files/qca-2.2.0_pre20180606-libressl.patch
@@ -0,0 +1,81 @@
+From 32e4f55732e42103cd7ba5e84ddd086bf8103948 Mon Sep 17 00:00:00 2001
+From: Stefan Strogin <[email protected]>
+Date: Fri, 5 Apr 2019 09:57:14 +0300
+Subject: [PATCH] Fix build with LibreSSL
+
+Provide RSA_meth_set_{sign,verify} for LibreSSL.
+Do not redefine M_ASN1_IA5STRING_new and RSA_F_RSA_EAY_PRIVATE_DECRYPT.
+
+Upstream-Status: Submitted [https://phabricator.kde.org/D20259]
+Signed-off-by: Stefan Strogin <[email protected]>
+---
+ plugins/qca-ossl/ossl110-compat.h | 34 ++++++++++++++++---------------
+ plugins/qca-ossl/qca-ossl.cpp     |  2 +-
+ 2 files changed, 19 insertions(+), 17 deletions(-)
+
+diff --git a/plugins/qca-ossl/ossl110-compat.h 
b/plugins/qca-ossl/ossl110-compat.h
+index ec15475..2d47835 100644
+--- a/plugins/qca-ossl/ossl110-compat.h
++++ b/plugins/qca-ossl/ossl110-compat.h
+@@ -213,22 +213,6 @@ static int RSA_meth_set_priv_dec(RSA_METHOD *rsa, int 
(*priv_dec) (int flen, con
+     return 1;
+ }
+ 
+-static int RSA_meth_set_sign(RSA_METHOD *meth, int (*sign) (int type, const 
unsigned char *m,
+-    unsigned int m_length, unsigned char *sigret, unsigned int *siglen, const 
RSA *rsa))
+-{
+-    if (!meth) return 0;
+-    meth->rsa_sign = sign;
+-    return 1;
+-}
+-
+-static int RSA_meth_set_verify(RSA_METHOD *meth, int (*verify) (int dtype, 
const unsigned char *m,
+-    unsigned int m_length, const unsigned char *sigbuf, unsigned int siglen, 
const RSA *rsa))
+-{
+-    if (!meth) return 0;
+-    meth->rsa_verify = verify;
+-    return 1;
+-}
+-
+ static int RSA_meth_set_finish(RSA_METHOD *meth, int (*finish) (RSA *rsa))
+ {
+     if (!meth) return 0;
+@@ -280,4 +264,22 @@ static void HMAC_CTX_free(HMAC_CTX *ctx)
+ 
+ #endif // OPENSSL_VERSION_NUMBER < 0x10100000L
+ 
++#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER)
++static int RSA_meth_set_sign(RSA_METHOD *meth, int (*sign) (int type, const 
unsigned char *m,
++    unsigned int m_length, unsigned char *sigret, unsigned int *siglen, const 
RSA *rsa))
++{
++    if (!meth) return 0;
++    meth->rsa_sign = sign;
++    return 1;
++}
++
++static int RSA_meth_set_verify(RSA_METHOD *meth, int (*verify) (int dtype, 
const unsigned char *m,
++    unsigned int m_length, const unsigned char *sigbuf, unsigned int siglen, 
const RSA *rsa))
++{
++    if (!meth) return 0;
++    meth->rsa_verify = verify;
++    return 1;
++}
++#endif // (OPENSSL_VERSION_NUMBER < 0x10100000L) || 
defined(LIBRESSL_VERSION_NUMBER)
++
+ #endif // OSSL110COMPAT_H
+diff --git a/plugins/qca-ossl/qca-ossl.cpp b/plugins/qca-ossl/qca-ossl.cpp
+index 39dbc2b..1216bef 100644
+--- a/plugins/qca-ossl/qca-ossl.cpp
++++ b/plugins/qca-ossl/qca-ossl.cpp
+@@ -61,7 +61,7 @@
+ #endif
+ 
+ // OpenSSL 1.1.0 compatibility macros
+-#ifdef OSSL_110
++#if defined(OSSL_110) && !defined(LIBRESSL_VERSION_NUMBER)
+ #define M_ASN1_IA5STRING_new() ASN1_IA5STRING_new()
+ #define RSA_F_RSA_EAY_PRIVATE_DECRYPT RSA_F_RSA_OSSL_PRIVATE_DECRYPT
+ #endif
+-- 
+2.21.0
+

diff --git a/app-crypt/qca/files/qca-disable-pgp-test.patch 
b/app-crypt/qca/files/qca-disable-pgp-test.patch
new file mode 100644
index 0000000..7944e3c
--- /dev/null
+++ b/app-crypt/qca/files/qca-disable-pgp-test.patch
@@ -0,0 +1,13 @@
+diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt
+index f4d9eb9..67ef281 100644
+--- a/unittest/CMakeLists.txt
++++ b/unittest/CMakeLists.txt
+@@ -23,7 +23,7 @@ add_subdirectory(keylengthunittest)
+ add_subdirectory(keystore)
+ add_subdirectory(macunittest)
+ add_subdirectory(metatype)
+-add_subdirectory(pgpunittest)
++# add_subdirectory(pgpunittest)
+ add_subdirectory(pipeunittest)
+ add_subdirectory(pkits)
+ add_subdirectory(rsaunittest)

diff --git a/app-crypt/qca/metadata.xml b/app-crypt/qca/metadata.xml
new file mode 100644
index 0000000..dff1320
--- /dev/null
+++ b/app-crypt/qca/metadata.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+<maintainer type="project">
+       <email>[email protected]</email>
+       <name>Crypto</name>
+</maintainer>
+<maintainer type="project">
+       <email>[email protected]</email>
+       <name>Gentoo Qt Project</name>
+</maintainer>
+<maintainer type="project">
+       <email>[email protected]</email>
+       <name>Gentoo KDE Project</name>
+</maintainer>
+<use>
+       <flag name="botan">Enable botan plugin</flag>
+       <flag name="gcrypt">Enable gcrypt plugin</flag>
+       <flag name="gpg">Enable GnuPG plugin</flag>
+       <flag name="logger">Enable logger plugin</flag>
+       <flag name="nss">Enable NSS plugin</flag>
+       <flag name="pkcs11">Enable PKCS#11 plugin</flag>
+       <flag name="sasl">Enable SASL plugin</flag>
+       <flag name="softstore">Enable softstore plugin</flag>
+</use>
+</pkgmetadata>

diff --git a/app-crypt/qca/qca-2.2.0_pre20180606.ebuild 
b/app-crypt/qca/qca-2.2.0_pre20180606.ebuild
new file mode 100644
index 0000000..9aaf988
--- /dev/null
+++ b/app-crypt/qca/qca-2.2.0_pre20180606.ebuild
@@ -0,0 +1,90 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit cmake-utils qmake-utils
+
+DESCRIPTION="Qt Cryptographic Architecture (QCA)"
+HOMEPAGE="https://userbase.kde.org/QCA";
+SRC_URI="https://dev.gentoo.org/~asturm/distfiles/${P}.tar.xz";
+
+LICENSE="LGPL-2.1"
+SLOT="2"
+KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd 
~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~sparc-solaris"
+
+IUSE="botan debug doc examples gcrypt gpg libressl logger nss pkcs11 sasl 
softstore +ssl test"
+
+BDEPEND="
+       doc? ( app-doc/doxygen )
+"
+RDEPEND="
+       dev-qt/qtcore:5
+       botan? ( dev-libs/botan:= )
+       gcrypt? ( dev-libs/libgcrypt:= )
+       gpg? ( app-crypt/gnupg )
+       nss? ( dev-libs/nss )
+       pkcs11? (
+               !libressl? ( dev-libs/openssl:0 )
+               libressl? ( dev-libs/libressl )
+               dev-libs/pkcs11-helper
+       )
+       sasl? ( dev-libs/cyrus-sasl:2 )
+       ssl? (
+               !libressl? ( >=dev-libs/openssl-1.0.1:0= )
+               libressl? ( dev-libs/libressl:= )
+       )
+"
+DEPEND="${RDEPEND}
+       test? (
+               dev-qt/qtnetwork:5
+               dev-qt/qttest:5
+       )
+"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-disable-pgp-test.patch"
+       "${FILESDIR}/${P}-libressl.patch"
+)
+
+qca_plugin_use() {
+       echo -DWITH_${2:-$1}_PLUGIN=$(usex "$1")
+}
+
+src_configure() {
+       local mycmakeargs=(
+               
-DQCA_FEATURE_INSTALL_DIR="${EPREFIX}$(qt5_get_mkspecsdir)/features"
+               -DQCA_PLUGINS_INSTALL_DIR="${EPREFIX}$(qt5_get_plugindir)"
+               $(qca_plugin_use botan)
+               $(qca_plugin_use gcrypt)
+               $(qca_plugin_use gpg gnupg)
+               $(qca_plugin_use logger)
+               $(qca_plugin_use nss)
+               $(qca_plugin_use pkcs11)
+               $(qca_plugin_use sasl cyrus-sasl)
+               $(qca_plugin_use softstore)
+               $(qca_plugin_use ssl ossl)
+               -DBUILD_TESTS=$(usex test)
+       )
+       cmake-utils_src_configure
+}
+
+src_test() {
+       local -x QCA_PLUGIN_PATH="${BUILD_DIR}/lib/qca"
+       cmake-utils_src_test
+}
+
+src_install() {
+       cmake-utils_src_install
+
+       if use doc; then
+               pushd "${BUILD_DIR}" >/dev/null || die
+               doxygen Doxyfile || die
+               dodoc -r apidocs/html
+               popd >/dev/null || die
+       fi
+
+       if use examples; then
+               dodoc -r "${S}"/examples
+       fi
+}

Reply via email to