From cd26bfb33290f171535e5437df2daa6fd5383bba Mon Sep 17 00:00:00 2001 From: Andreas Billmeier Date: Sat, 22 Dec 2018 23:43:30 +0100 Subject: [PATCH] firetv & fix some RDEPEND --- app-misc/homeassistant/Manifest | 2 +- .../homeassistant/homeassistant-0.84.6.ebuild | 7 +- dev-python/adb-homeassistant/Manifest | 2 + .../adb-homeassistant-1.3.1.ebuild | 28 +++++ dev-python/firetv/Manifest | 2 + dev-python/firetv/firetv-1.0.7.ebuild | 32 ++++++ dev-python/libusb1/Manifest | 2 + dev-python/libusb1/libusb1-1.7.ebuild | 28 +++++ dev-python/pyasn1/Manifest | 2 + dev-python/pyasn1/pyasn1-0.4.4.ebuild | 40 +++++++ dev-python/pytradfri/Manifest | 2 +- dev-python/pytradfri/pytradfri-6.0.1.ebuild | 1 + dev-python/rsa/Manifest | 4 + .../rsa/files/rsa-3.2.3-CVE-2016-1494.patch | 104 ++++++++++++++++++ dev-python/rsa/metadata.xml | 11 ++ dev-python/rsa/rsa-4.0.ebuild | 33 ++++++ 16 files changed, 297 insertions(+), 3 deletions(-) create mode 100644 dev-python/adb-homeassistant/Manifest create mode 100644 dev-python/adb-homeassistant/adb-homeassistant-1.3.1.ebuild create mode 100644 dev-python/firetv/Manifest create mode 100644 dev-python/firetv/firetv-1.0.7.ebuild create mode 100644 dev-python/libusb1/Manifest create mode 100644 dev-python/libusb1/libusb1-1.7.ebuild create mode 100644 dev-python/pyasn1/Manifest create mode 100644 dev-python/pyasn1/pyasn1-0.4.4.ebuild create mode 100644 dev-python/rsa/Manifest create mode 100644 dev-python/rsa/files/rsa-3.2.3-CVE-2016-1494.patch create mode 100644 dev-python/rsa/metadata.xml create mode 100644 dev-python/rsa/rsa-4.0.ebuild diff --git a/app-misc/homeassistant/Manifest b/app-misc/homeassistant/Manifest index cf31b1955..490877558 100644 --- a/app-misc/homeassistant/Manifest +++ b/app-misc/homeassistant/Manifest @@ -22,4 +22,4 @@ EBUILD homeassistant-0.81.6.ebuild 4704 BLAKE2B dac64a62a51e33ddd1ff95156faebd8a EBUILD homeassistant-0.82.1.ebuild 4749 BLAKE2B 70021551647ce81bdd1ddc3f5fa86a42d70e64eb77351a0eb400630b37135f38eb5bfadd212d65ee5737959e23561f0ea117d68a42e93bcdddfb0c8aa47886e6 SHA512 e02617cf6477111953711c8a046c313b61a4ac0d837ea3f3d87729133d952f95fc9eb3a0fff53498426994ecf4d3a73a6ec15578496a79081cdc07cdf69a6e93 EBUILD homeassistant-0.83.3.ebuild 5441 BLAKE2B 25cd5ee062fc903a4605400c808f9c8c8e8838f438dfa76bd49a5ad869942425baed302fe99d0cc9e3923587351f1e55f0950a7fdb1614d4fb8eed7062acce03 SHA512 f7b4cbcf821db88f4709bfb76b392f99b01d9df88f4705c77be0a17f769d3f2e11f1a26ae6a4b4fb61331a0716aa54c2c393ae8546fca68a772ecb71df0166d5 EBUILD homeassistant-0.84.4.ebuild 5442 BLAKE2B 62e95bda77596978d5bdc0b52e86824f8b0d6f0fd49418e31c85ffa8e62d43c56d0d1033f416e90f892c61e2de16f4d89bc24e2f75f8e48536272a0070a2e496 SHA512 3fc207f4f980683371ef557ae1eac709653704589d5abcf68acfdffae2c39f51065be1639ffe04f6440c0b91c722cde70617cb2c8986a49398232f51e00e1d2d -EBUILD homeassistant-0.84.6.ebuild 5442 BLAKE2B 62e95bda77596978d5bdc0b52e86824f8b0d6f0fd49418e31c85ffa8e62d43c56d0d1033f416e90f892c61e2de16f4d89bc24e2f75f8e48536272a0070a2e496 SHA512 3fc207f4f980683371ef557ae1eac709653704589d5abcf68acfdffae2c39f51065be1639ffe04f6440c0b91c722cde70617cb2c8986a49398232f51e00e1d2d +EBUILD homeassistant-0.84.6.ebuild 5662 BLAKE2B 5acccb1a3b3e30ada05bd1a28b8c8d6874e93d965de12e96ae80242d66f65ad7c2a625214a247c2d19b22676fa3e4607fd48f7c1986029684b9444d7913ddb8a SHA512 190ae75a9653331c000f16dedb855efccd130a76f5e3af31256adfcf398f1d00831798bc9dfb3f770c574c4061dd59ddc7ea14aa0e9a9eeb34e1a82b45b65fe0 diff --git a/app-misc/homeassistant/homeassistant-0.84.6.ebuild b/app-misc/homeassistant/homeassistant-0.84.6.ebuild index 085345314..d89f2f32f 100644 --- a/app-misc/homeassistant/homeassistant-0.84.6.ebuild +++ b/app-misc/homeassistant/homeassistant-0.84.6.ebuild @@ -15,7 +15,7 @@ RESTRICT="mirror" LICENSE="Apache-2.0" SLOT="0" KEYWORDS="amd64" -IUSE="atv hs100 dropbox tradfri wemo mysql musiccast samsungtv sonos ssl" +IUSE="atv hs100 dropbox tradfri wemo mysql musiccast samsungtv sonos ssl firetv" DEPEND=" ${PYTHON_DEPS} @@ -95,6 +95,11 @@ DEPEND=" ssl? ( dev-libs/openssl app-crypt/certbot net-proxy/haproxy ) + firetv? ( =dev-python/firetv-1.0.7[${PYTHON_USEDEP}] ) + >=dev-python/jsonrpc-async-0.6[${PYTHON_USEDEP}] + >=dev-python/pyjwt-1.6.4[${PYTHON_USEDEP}] + >=dev-libs/xerces-c-3.1.4-r1 + >=dev-libs/xml-security-c-1.7.3 " RDEPEND=" diff --git a/dev-python/adb-homeassistant/Manifest b/dev-python/adb-homeassistant/Manifest new file mode 100644 index 000000000..af4cf9b98 --- /dev/null +++ b/dev-python/adb-homeassistant/Manifest @@ -0,0 +1,2 @@ +DIST adb-homeassistant-1.3.1.tar.gz 27740 BLAKE2B 2a4ac59acca2d5995299678427133421f82b5c3193b03969bb529bb25c727adb5a1e8d0ee949b346d4c6ecfac562a08283d9f2cb3bde5dfb7a1b1b1d1d7e03e4 SHA512 b7e0d259086bd6b21da0ae66f96e49f629e9c7a7eb4219f2bb2280e698d0a14021c955fa6be0e49dd63d1c3104eb313be3f000381e8474031d066a5550c21f50 +EBUILD adb-homeassistant-1.3.1.ebuild 805 BLAKE2B d6dae74de1c0aed78de15cfa02de7aca3bfe6801d6fd2a0c67e1f677149d7848ee459ac716e0936932830058ce1ce5e5456cc47f26c7c358da1cc86437bfdb4e SHA512 3f1161a85bacc43dff48109507c8ca9a8028210575155b1dbdd57e23c9b88eea91933f003f1e389e2e115334d8394ebcdac5cd6da7d70401499ce1c2c3473310 diff --git a/dev-python/adb-homeassistant/adb-homeassistant-1.3.1.ebuild b/dev-python/adb-homeassistant/adb-homeassistant-1.3.1.ebuild new file mode 100644 index 000000000..c8069cb14 --- /dev/null +++ b/dev-python/adb-homeassistant/adb-homeassistant-1.3.1.ebuild @@ -0,0 +1,28 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +PYTHON_COMPAT=( python2_7 python3_{4,5,6} ) + +inherit distutils-r1 + +DESCRIPTION="A pure python implementation of the Android ADB and Fastboot protocols" +HOMEPAGE="https://github.com/google/python-adb" +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.zip" +SRC_URI="https://files.pythonhosted.org/packages/54/82/cb640008d741b15e0206d5a6b36ba7304b9c0a821c1e8bdd7165680a8e34/adb-homeassistant-1.3.1.tar.gz" + +LICENSE="Apache" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-fbsd ~amd64-linux ~x86-linux" +IUSE="test" + +DEPEND=" + test? ( + dev-python/pytest[${PYTHON_USEDEP}] + ) +" + +python_test() { + py.test -v || die "Tests failed under ${EPYTHON}" +} diff --git a/dev-python/firetv/Manifest b/dev-python/firetv/Manifest new file mode 100644 index 000000000..374178413 --- /dev/null +++ b/dev-python/firetv/Manifest @@ -0,0 +1,2 @@ +DIST firetv-1.0.7.tar.gz 8336 BLAKE2B ca278981ca301b04bb199eacbd43d2f1ed316b1858fff0f925a626b647b308a234e8b5dd198a436c1d7239eee061fd3a4e3b4c1f0c05609ff669cfca04ee9634 SHA512 8d49185d315482fbdbd98725dd85ad3846d9fabe5dc43541e7956e12b6d9aa2753284174237393dbbd8d2b656f2cba1c8e9448dda74b701a7cdf42239a1cd0ab +EBUILD firetv-1.0.7.ebuild 893 BLAKE2B 6520f635958d978d9e26c773ca6d4e8d19ac84f4ad06a3169ab12791b0184c28eade36aa1b2d3a88aebd4da1fa4a79ba523758f6b2d8136c7083c4d78df81b59 SHA512 8ee9d80845fe77e437cd607ddf73a46d48f660dbbbaffb16f5dfd281dc336f343800f43cf1d5dd4a86174e689259f2c1d309d404ef901c47710f1e85505c1d34 diff --git a/dev-python/firetv/firetv-1.0.7.ebuild b/dev-python/firetv/firetv-1.0.7.ebuild new file mode 100644 index 000000000..d681ee353 --- /dev/null +++ b/dev-python/firetv/firetv-1.0.7.ebuild @@ -0,0 +1,32 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +PYTHON_COMPAT=( python2_7 python3_{4,5,6} ) + +inherit distutils-r1 + +DESCRIPTION="Communicate with an Amazon Fire TV device via ADB over a network." +HOMEPAGE="https://github.com/happyleavesaoc/python-firetv/" +SRC_URI="https://files.pythonhosted.org/packages/1d/12/e3787d5c8d9096ace333973d7f0a7a4918587ef9fa152819bee98162896c/firetv-1.0.7.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="alpha amd64 ~arm arm64 hppa ~ia64 ~mips ppc ppc64 s390 ~sparc x86 ~amd64-fbsd ~amd64-linux ~x86-linux" +IUSE="test" + +DEPEND=" + test? ( + dev-python/pytest[${PYTHON_USEDEP}] + ) +" +RDEPEND=" + >=dev-python/rsa-4.0[${PYTHON_USEDEP}] + >=dev-python/adb-homeassistant-1.3.1[${PYTHON_USEDEP}] + >=dev-python/libusb1-1.7[${PYTHON_USEDEP}] +" + +python_test() { + py.test -v || die "Tests failed under ${EPYTHON}" +} diff --git a/dev-python/libusb1/Manifest b/dev-python/libusb1/Manifest new file mode 100644 index 000000000..cff5064b2 --- /dev/null +++ b/dev-python/libusb1/Manifest @@ -0,0 +1,2 @@ +DIST libusb1-1.7.tar.gz 56605 BLAKE2B f57b8468552ef687235baf64dacb42a3dddd92e354929e6bd31553fdf75d632bd69824e66bc019f813021127faa8336e991ae091de690b9b3273a51bab1d148d SHA512 ff7912ad3b7ee8fe49132f63263e87bd5a8210111de419740a286428e2af6a3d26c192f0ce571973dd89095dcdf716f2dd07a34206844a5650ebb00d62eccd95 +EBUILD libusb1-1.7.ebuild 765 BLAKE2B 7d458d590dbdab47f5debfdb810d8ab7a5b9cbcf5da65df9d225fbd4b5da3dbb9497218ae1004fb7b4880806010fe9ccf3e0058dc959c734e258c36880e31789 SHA512 a2df91573ccda772796f4256327d95b643a6fdaff78d5384ec6e1e517583a1b9fc74c58c9248517b1b7137cd8dadb0ee2a4aad888e9e20b30e5209b7b68f9b53 diff --git a/dev-python/libusb1/libusb1-1.7.ebuild b/dev-python/libusb1/libusb1-1.7.ebuild new file mode 100644 index 000000000..46bc4bc90 --- /dev/null +++ b/dev-python/libusb1/libusb1-1.7.ebuild @@ -0,0 +1,28 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +PYTHON_COMPAT=( python2_7 python3_{4,5,6} ) + +inherit distutils-r1 + +DESCRIPTION="Pure-python wrapper for libusb-1.0" +HOMEPAGE="http://github.com/vpelletier/python-libusb1" +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.zip" +SRC_URI="https://files.pythonhosted.org/packages/9c/51/25f5218d9e21bac3e36bb7167d7d9dfe899cd48bebfe60a54cd39c5db585/libusb1-1.7.tar.gz" + +LICENSE="LGPLv2+" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-fbsd ~amd64-linux ~x86-linux" +IUSE="test" + +DEPEND=" + test? ( + dev-python/pytest[${PYTHON_USEDEP}] + ) +" + +python_test() { + py.test -v || die "Tests failed under ${EPYTHON}" +} diff --git a/dev-python/pyasn1/Manifest b/dev-python/pyasn1/Manifest new file mode 100644 index 000000000..bc06c1a71 --- /dev/null +++ b/dev-python/pyasn1/Manifest @@ -0,0 +1,2 @@ +DIST pyasn1-0.4.4.tar.gz 118725 BLAKE2B 1e489106c675cd0b770195959ce99a70fe7faf12cade2f06ac4120597480ef27b1f3dc6742938e2a2d5996a4b2816d629f3ace6423bda08fde5cdcccc774297f SHA512 ea2b73586a356aa9ea8cc9694328c2658da0f04cafceb0d13e278facf0870258391d595181932d294b6242cfedf2e82aea225580c4055ea3b1f47b930ba921d4 +EBUILD pyasn1-0.4.4.ebuild 934 BLAKE2B 5749d52813cf8b8d3d54c57f4530b4cebfa2dd7194d5db6ad0347857e777c390e9202cee7c9158e352cd3b386a0fef919f7047ea07c49884d80101c08bcec9b0 SHA512 5412c7a1654dff11db4984caeddeb505e2319d08a30264acd99cec9e61dbc9b71b732692913cef8728e8ac6dbe6a4d3621cdc2d99e8045580d042b4841438e7e diff --git a/dev-python/pyasn1/pyasn1-0.4.4.ebuild b/dev-python/pyasn1/pyasn1-0.4.4.ebuild new file mode 100644 index 000000000..209197697 --- /dev/null +++ b/dev-python/pyasn1/pyasn1-0.4.4.ebuild @@ -0,0 +1,40 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI="6" + +PYTHON_COMPAT=( python2_7 python3_{4,5,6,7} pypy pypy3 ) + +inherit distutils-r1 + +DESCRIPTION="ASN.1 library for Python" +HOMEPAGE="http://snmplabs.com/pyasn1/" +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" + +LICENSE="BSD-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~x64-macos ~x86-macos" +IUSE="doc" + +RDEPEND="" +DEPEND="dev-python/setuptools[${PYTHON_USEDEP}] + doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )" + +python_test() { + esetup.py test || die "Tests fail with ${EPYTHON}" +} + +src_compile() { + if use doc; then + python_setup + esetup.py build_sphinx + fi + distutils-r1_src_compile +} + +src_install() { + local HTML_DOCS + use doc && HTML_DOCS=( build/sphinx/html/. ) + + distutils-r1_src_install +} diff --git a/dev-python/pytradfri/Manifest b/dev-python/pytradfri/Manifest index 8c53175b9..d571df750 100644 --- a/dev-python/pytradfri/Manifest +++ b/dev-python/pytradfri/Manifest @@ -1,2 +1,2 @@ DIST pytradfri-6.0.1.tar.gz 140959 BLAKE2B e3803eff468307eebbe6a9b5ada32ca364de92e13ec39249d6c49af546ae1504d6307c3f83ba081e8221306e1ed463c37a71206021438c530450876d62a7b842 SHA512 1eac80f9043fbd7a182f577de731373252bc31161bcb5e31a897fb00c0613c00ecf254ca6b8b672bf02d759a345be6544bff6702f297400e52210fe4ed767438 -EBUILD pytradfri-6.0.1.ebuild 633 BLAKE2B 6de746068b3362ef1dd49fbf0b63ae381531b2c54c897e6166d73868a1ae3e6ad690b69107266da8d105943535734036a9459b6609673d4e981baabf574f1cbf SHA512 12ee4d986ec7ea37877fcec44060320ac61a82108b1ccdd6a6ae7df01f7072e00975ef890e48ecf35c84cd2246caf2c519d19209327bb4ed018b5913a26d94a6 +EBUILD pytradfri-6.0.1.ebuild 674 BLAKE2B 600da03d8ee5fb27af0a73bb9d4e688ce88edb937d616b219b73a4f15260d5d4bca4856ba2aa4ddd2e8e25afa77d82af1171c7edac2672a636da7e7070df0085 SHA512 ee0106c9d1e52503175dbd8fb7c6e7a0e5c39600fdbc99e42b89fed72ce307c396fa8f6f029a0c62d19e3281e0af14e899b8d4fc55cf0bc69a4cff5280b159ea diff --git a/dev-python/pytradfri/pytradfri-6.0.1.ebuild b/dev-python/pytradfri/pytradfri-6.0.1.ebuild index a94cd6bdb..df3b1e9e0 100644 --- a/dev-python/pytradfri/pytradfri-6.0.1.ebuild +++ b/dev-python/pytradfri/pytradfri-6.0.1.ebuild @@ -23,6 +23,7 @@ DEPEND=" >=dev-python/aiocoap-0.4_alpha1[${PYTHON_USEDEP}] >=dev-python/dtlssocket-0.1.4[${PYTHON_USEDEP}] dev-python/setuptools[${PYTHON_USEDEP}] + dev-python/setuptools[${PYTHON_USEDEP}] ${RDEPEND} " diff --git a/dev-python/rsa/Manifest b/dev-python/rsa/Manifest new file mode 100644 index 000000000..e66ef0e83 --- /dev/null +++ b/dev-python/rsa/Manifest @@ -0,0 +1,4 @@ +AUX rsa-3.2.3-CVE-2016-1494.patch 3843 BLAKE2B 94721282f4079aa0a77813dd8ad1c0aefd0924272d4e2b3e8a6ad745375bafb6b6fe5e50af621232df632a1f2261be097fde92b5ad3f57b74ff7976c22daa9bc SHA512 9150b25bc1a9dacc8eee0fb93d46b9d024c868d540097b9166be9a7879fe116d8fd47cacaaf5614b86cd44e7cd10602a0ad290eb2ef116539683101d4057a231 +DIST rsa-4.0.tar.gz 37385 BLAKE2B 2621ee732f15ea12283b723efb5e88847d3e030e8115bb4a3e986099fc94adc3409202d54b4350b0888deefd8dc801d8d3e57fef9e85f386ead53e4412da6d05 SHA512 e11106741cc4275246c986d39b3f028b5a4df6fbffdd08a78072ac3d3a9a7ade7a39789c504a2705f54d858a9bdbf03981251f32f9c45baba71e4a986e14b24e +EBUILD rsa-4.0.ebuild 734 BLAKE2B c5a3e8a16df0e3436b23f5e618a9e78c857bc5858fdf0ef4f94b281db019e08e38ba2baad6a80bd595a425d9fd40db0f66b12ff9230f8698a03a3aee1e60987d SHA512 02480e21887fa3b4aac5c10b13eace48d11440fcb668c7cfd9d816ecb3d0a4303c11ac4ed92afbbe8b8c7bf30adcd08d56e2d2c07ee95196788ed896989a88ea +MISC metadata.xml 316 BLAKE2B fd1e4f7bdee45f5ab99e67cc3918634b9ac5ecfad75167aad5f2ee33cea308f99d8d03aab5b5e0c01e8c1bf41ca8a45f67146c5126f84af4b6d914f58af0ea38 SHA512 4d8c48ae8e4360727f5c4b83e426f42a597a175dfa2a965c9f966e5824a83291c78d3e8e636d21b4f28d73f7e912abc7db1b09078baaa0e3a1b25713abd3d0a1 diff --git a/dev-python/rsa/files/rsa-3.2.3-CVE-2016-1494.patch b/dev-python/rsa/files/rsa-3.2.3-CVE-2016-1494.patch new file mode 100644 index 000000000..bfcfc33ed --- /dev/null +++ b/dev-python/rsa/files/rsa-3.2.3-CVE-2016-1494.patch @@ -0,0 +1,104 @@ +# HG changeset patch +# User Filippo Valsorda +# Date 1450226563 0 +# Node ID 0cbcc529926afd61c6df4f50cfc29971beafd2c2 +# Parent 2baab06c8b867b01ec82b02118d4872a931a0437 +Fix BB'06 attack in verify() by switching from parsing to comparison + +diff --git a/rsa/pkcs1.py b/rsa/pkcs1.py +--- a/rsa/pkcs1.py ++++ b/rsa/pkcs1.py +@@ -22,10 +22,10 @@ + At least 8 bytes of random padding is used when encrypting a message. This makes + these methods much more secure than the ones in the ``rsa`` module. + +-WARNING: this module leaks information when decryption or verification fails. +-The exceptions that are raised contain the Python traceback information, which +-can be used to deduce where in the process the failure occurred. DO NOT PASS +-SUCH INFORMATION to your users. ++WARNING: this module leaks information when decryption fails. The exceptions ++that are raised contain the Python traceback information, which can be used to ++deduce where in the process the failure occurred. DO NOT PASS SUCH INFORMATION ++to your users. + ''' + + import hashlib +@@ -288,37 +288,23 @@ + :param pub_key: the :py:class:`rsa.PublicKey` of the person signing the message. + :raise VerificationError: when the signature doesn't match the message. + +- .. warning:: +- +- Never display the stack trace of a +- :py:class:`rsa.pkcs1.VerificationError` exception. It shows where in +- the code the exception occurred, and thus leaks information about the +- key. It's only a tiny bit of information, but every bit makes cracking +- the keys easier. +- + ''' + +- blocksize = common.byte_size(pub_key.n) ++ keylength = common.byte_size(pub_key.n) + encrypted = transform.bytes2int(signature) + decrypted = core.decrypt_int(encrypted, pub_key.e, pub_key.n) +- clearsig = transform.int2bytes(decrypted, blocksize) +- +- # If we can't find the signature marker, verification failed. +- if clearsig[0:2] != b('\x00\x01'): +- raise VerificationError('Verification failed') ++ clearsig = transform.int2bytes(decrypted, keylength) + +- # Find the 00 separator between the padding and the payload +- try: +- sep_idx = clearsig.index(b('\x00'), 2) +- except ValueError: +- raise VerificationError('Verification failed') +- +- # Get the hash and the hash method +- (method_name, signature_hash) = _find_method_hash(clearsig[sep_idx+1:]) ++ # Get the hash method ++ method_name = _find_method_hash(clearsig) + message_hash = _hash(message, method_name) + +- # Compare the real hash to the hash in the signature +- if message_hash != signature_hash: ++ # Reconstruct the expected padded hash ++ cleartext = HASH_ASN1[method_name] + message_hash ++ expected = _pad_for_signing(cleartext, keylength) ++ ++ # Compare with the signed one ++ if expected != clearsig: + raise VerificationError('Verification failed') + + return True +@@ -351,24 +337,20 @@ + return hasher.digest() + + +-def _find_method_hash(method_hash): +- '''Finds the hash method and the hash itself. ++def _find_method_hash(clearsig): ++ '''Finds the hash method. + +- :param method_hash: ASN1 code for the hash method concatenated with the +- hash itself. ++ :param clearsig: full padded ASN1 and hash. + +- :return: tuple (method, hash) where ``method`` is the used hash method, and +- ``hash`` is the hash itself. ++ :return: the used hash method. + + :raise VerificationFailed: when the hash method cannot be found + + ''' + + for (hashname, asn1code) in HASH_ASN1.items(): +- if not method_hash.startswith(asn1code): +- continue +- +- return (hashname, method_hash[len(asn1code):]) ++ if asn1code in clearsig: ++ return hashname + + raise VerificationError('Verification failed') + diff --git a/dev-python/rsa/metadata.xml b/dev-python/rsa/metadata.xml new file mode 100644 index 000000000..35bbfa239 --- /dev/null +++ b/dev-python/rsa/metadata.xml @@ -0,0 +1,11 @@ + + + + + python@gentoo.org + Python + + + rsa + + diff --git a/dev-python/rsa/rsa-4.0.ebuild b/dev-python/rsa/rsa-4.0.ebuild new file mode 100644 index 000000000..5c01179ff --- /dev/null +++ b/dev-python/rsa/rsa-4.0.ebuild @@ -0,0 +1,33 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=5 + +PYTHON_COMPAT=( python2_7 python3_{4,5,6} pypy ) + +inherit distutils-r1 + +DESCRIPTION="Pure-Python RSA implementation" +HOMEPAGE="https://stuvel.eu/rsa https://pypi.org/project/rsa/" +SRC_URI="mirror://pypi/${P:0:1}/${PN}/${P}.tar.gz" + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~x86" +IUSE="test" + +RDEPEND=" + >=dev-python/pyasn1-0.4.4[${PYTHON_USEDEP}] + dev-python/traceback2[${PYTHON_USEDEP}] + " +DEPEND="${RDEPEND} + >=dev-python/setuptools-0.6.10[${PYTHON_USEDEP}] + test? ( + dev-python/nose[${PYTHON_USEDEP}] + dev-python/unittest2[${PYTHON_USEDEP}] + ) + " + +python_test() { + nosetests --verbose || die +}