Control: tags 929903 + patch Dear maintainer,
please find attached a proposed NMU to address this problem. Regards. Sebastian
diff -Nru m2crypto-0.31.0/debian/changelog m2crypto-0.31.0/debian/changelog --- m2crypto-0.31.0/debian/changelog 2019-03-11 19:44:01.000000000 +0100 +++ m2crypto-0.31.0/debian/changelog 2019-06-08 12:35:11.000000000 +0200 @@ -1,3 +1,11 @@ +m2crypto (0.31.0-3.1) unstable; urgency=medium + + * Non-maintainer upload. + * Add a few patches from upstream to avoid a testsuite regression while + testing for bug which was fixed in OpenSSL 1.1.1c (Closes: #929903). + + -- Sebastian Andrzej Siewior <sebast...@breakpoint.cc> Sat, 08 Jun 2019 12:35:11 +0200 + m2crypto (0.31.0-3) unstable; urgency=medium * add 0002-tests-test_ssl-use-ciphercuites-for-TLS1.3-cipher-in.patch diff -Nru m2crypto-0.31.0/debian/patches/0003-Remove-duplicate-call-of-the-error-code.patch m2crypto-0.31.0/debian/patches/0003-Remove-duplicate-call-of-the-error-code.patch --- m2crypto-0.31.0/debian/patches/0003-Remove-duplicate-call-of-the-error-code.patch 1970-01-01 01:00:00.000000000 +0100 +++ m2crypto-0.31.0/debian/patches/0003-Remove-duplicate-call-of-the-error-code.patch 2019-06-08 12:34:05.000000000 +0200 @@ -0,0 +1,25 @@ +From 83d4d9bc3aa4466e540fa00f8cc6891c0301ec82 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= <mc...@cepl.eu> +Date: Fri, 31 May 2019 17:00:14 +0200 +Subject: [PATCH] Remove duplicate call of the error code. + +--- + tests/test_rsa.py | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/tests/test_rsa.py b/tests/test_rsa.py +index 308b1b180445d..875b59c6844b5 100644 +--- a/tests/test_rsa.py ++++ b/tests/test_rsa.py +@@ -126,8 +126,6 @@ log = logging.getLogger('test_RSA') + ctxt = priv.public_encrypt(self.data, RSA.sslv23_padding) + with self.assertRaises(RSA.RSAError): + priv.private_decrypt(ctxt, RSA.sslv23_padding) +- with self.assertRaises(RSA.RSAError): +- priv.private_decrypt(ctxt, RSA.sslv23_padding) + + # no_padding + with self.assertRaises(RSA.RSAError): +-- +2.20.1 + diff -Nru m2crypto-0.31.0/debian/patches/0004-Limit-tests.test_rsa.RSATestCase.test_public_encrypt.patch m2crypto-0.31.0/debian/patches/0004-Limit-tests.test_rsa.RSATestCase.test_public_encrypt.patch --- m2crypto-0.31.0/debian/patches/0004-Limit-tests.test_rsa.RSATestCase.test_public_encrypt.patch 1970-01-01 01:00:00.000000000 +0100 +++ m2crypto-0.31.0/debian/patches/0004-Limit-tests.test_rsa.RSATestCase.test_public_encrypt.patch 2019-06-08 12:33:53.000000000 +0200 @@ -0,0 +1,42 @@ +From 0b22d79082afd7c564b2ac07fb0ef5d76d692586 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= <mc...@cepl.eu> +Date: Fri, 7 Jun 2019 11:43:03 +0200 +Subject: [PATCH] Limit tests.test_rsa.RSATestCase.test_public_encrypt just + to OpenSSL which sustains it. + +Fixes #258 +--- + tests/test_rsa.py | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/tests/test_rsa.py b/tests/test_rsa.py +index 875b59c6844b5..7028b6085788e 100644 +--- a/tests/test_rsa.py ++++ b/tests/test_rsa.py +@@ -113,6 +113,8 @@ log = logging.getLogger('test_RSA') + with self.assertRaises(TypeError): + priv.private_encrypt(self.gen_callback, RSA.pkcs1_padding) + ++ @unittest.skipIf(m2.OPENSSL_VERSION_NUMBER < 0x1010103f, ++ 'Relies on fix which happened only in OpenSSL 1.1.1c') + def test_public_encrypt(self): + priv = RSA.load_key(self.privkey) + # pkcs1_padding, pkcs1_oaep_padding +@@ -124,11 +126,11 @@ log = logging.getLogger('test_RSA') + + # sslv23_padding + ctxt = priv.public_encrypt(self.data, RSA.sslv23_padding) +- with self.assertRaises(RSA.RSAError): +- priv.private_decrypt(ctxt, RSA.sslv23_padding) ++ res = priv.private_decrypt(ctxt, RSA.sslv23_padding) ++ self.assertEqual(res, self.data) + + # no_padding +- with self.assertRaises(RSA.RSAError): ++ with six.assertRaisesRegex(self, TypeError, 'data too small'): + priv.public_encrypt(self.data, RSA.no_padding) + + # Type-check the data to be encrypted. +-- +2.20.1 + diff -Nru m2crypto-0.31.0/debian/patches/0005-tests.test_rsa-Fix-typo-to-match-for-proper-exceptio.patch m2crypto-0.31.0/debian/patches/0005-tests.test_rsa-Fix-typo-to-match-for-proper-exceptio.patch --- m2crypto-0.31.0/debian/patches/0005-tests.test_rsa-Fix-typo-to-match-for-proper-exceptio.patch 1970-01-01 01:00:00.000000000 +0100 +++ m2crypto-0.31.0/debian/patches/0005-tests.test_rsa-Fix-typo-to-match-for-proper-exceptio.patch 2019-06-08 12:35:11.000000000 +0200 @@ -0,0 +1,25 @@ +From: Sebastian Andrzej Siewior <sebast...@breakpoint.cc> +Date: Sat, 8 Jun 2019 14:13:59 +0000 +Subject: [PATCH] tests.test_rsa: Fix typo to match for proper exception + +Signed-off-by: Sebastian Andrzej Siewior <sebast...@breakpoint.cc> +--- + tests/test_rsa.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/test_rsa.py b/tests/test_rsa.py +index 7028b6085788e..a1d0805fc04e4 100644 +--- a/tests/test_rsa.py ++++ b/tests/test_rsa.py +@@ -130,7 +130,7 @@ log = logging.getLogger('test_RSA') + self.assertEqual(res, self.data) + + # no_padding +- with six.assertRaisesRegex(self, TypeError, 'data too small'): ++ with six.assertRaisesRegex(self, RSA.RSAError, 'data too small'): + priv.public_encrypt(self.data, RSA.no_padding) + + # Type-check the data to be encrypted. +-- +2.20.1 + diff -Nru m2crypto-0.31.0/debian/patches/0006-Be-resilient-against-the-situation-when-no-erorr-hap.patch m2crypto-0.31.0/debian/patches/0006-Be-resilient-against-the-situation-when-no-erorr-hap.patch --- m2crypto-0.31.0/debian/patches/0006-Be-resilient-against-the-situation-when-no-erorr-hap.patch 1970-01-01 01:00:00.000000000 +0100 +++ m2crypto-0.31.0/debian/patches/0006-Be-resilient-against-the-situation-when-no-erorr-hap.patch 2019-06-08 12:35:11.000000000 +0200 @@ -0,0 +1,106 @@ +From f287d7145b5fd28f630f2b823ad45a44cf635b35 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= <mc...@cepl.eu> +Date: Thu, 30 May 2019 16:01:36 +0200 +Subject: [PATCH] Be resilient against the situation when no erorr happened. + +Fixes #258. +--- + M2Crypto/Err.py | 20 ++++++++++++-------- + tests/alltests.py | 1 + + tests/test_err.py | 28 ++++++++++++++++++++++++++++ + 3 files changed, 41 insertions(+), 8 deletions(-) + create mode 100644 tests/test_err.py + +diff --git a/M2Crypto/Err.py b/M2Crypto/Err.py +index dcee587712200..70974c94ac1e2 100644 +--- a/M2Crypto/Err.py ++++ b/M2Crypto/Err.py +@@ -29,18 +29,21 @@ from M2Crypto import BIO, m2, py27plus, util, six # noqa + + + def get_error_lib(err): +- # type: (int) -> str +- return six.ensure_text(m2.err_lib_error_string(err)) ++ # type: (Optional[int]) -> str ++ err_str = m2.err_lib_error_string(err) ++ return six.ensure_text(err_str) if err_str else '' + + + def get_error_func(err): +- # type: (int) -> str +- return six.ensure_text(m2.err_func_error_string(err)) ++ # type: (Optional[int]) -> str ++ err_str = m2.err_func_error_string(err) ++ return six.ensure_text(err_str) if err_str else '' + + + def get_error_reason(err): +- # type: (int) -> str +- return six.ensure_text(m2.err_reason_error_string(err)) ++ # type: (Optional[int]) -> str ++ err_str = m2.err_reason_error_string(err) ++ return six.ensure_text(err_str) if err_str else '' + + + def get_error_message(): +@@ -49,8 +52,9 @@ from M2Crypto import BIO, m2, py27plus, util, six # noqa + + + def get_x509_verify_error(err): +- # type: (int) -> str +- return six.ensure_text(m2.x509_get_verify_error(err)) ++ # type: (Optional[int]) -> str ++ err_str = m2.x509_get_verify_error(err) ++ return six.ensure_text(err_str) if err_str else '' + + + class SSLError(Exception): +diff --git a/tests/alltests.py b/tests/alltests.py +index a0e773933ee93..141cd8882b0c4 100644 +--- a/tests/alltests.py ++++ b/tests/alltests.py +@@ -32,6 +32,7 @@ from __future__ import absolute_import, print_function + 'tests.test_dh', + 'tests.test_dsa', + 'tests.test_engine', ++ 'tests.test_err', + 'tests.test_evp', + 'tests.test_obj', + 'tests.test_rand', +diff --git a/tests/test_err.py b/tests/test_err.py +new file mode 100644 +index 0000000000000..05fe425e73c91 +--- /dev/null ++++ b/tests/test_err.py +@@ -0,0 +1,28 @@ ++#!/usr/bin/env python ++# -*- coding: utf-8 -*- ++"""Unit tests for M2Crypto.Err. ++ ++Copyright (C) 2019 Matěj Cepl ++Released under the terms of MIT/X11 License, ++see the file LICENCE for more. ++""" ++from M2Crypto import Err ++from tests import unittest ++ ++ ++class ErrTestCase(unittest.TestCase): ++ ++ def test_no_error(self): ++ # Protection against gl#m2crypto/m2crypto#258 ++ self.assertEqual(Err.get_error_reason(0), '') ++ ++ ++ ++def suite(): ++ suite = unittest.TestSuite() ++ suite.addTest(unittest.makeSuite(ErrTestCase)) ++ return suite ++ ++ ++if __name__ == '__main__': ++ unittest.TextTestRunner().run(suite()) +-- +2.20.1 + diff -Nru m2crypto-0.31.0/debian/patches/series m2crypto-0.31.0/debian/patches/series --- m2crypto-0.31.0/debian/patches/series 2019-03-11 19:43:58.000000000 +0100 +++ m2crypto-0.31.0/debian/patches/series 2019-06-08 12:35:11.000000000 +0200 @@ -1,2 +1,6 @@ 0001-import-inspect-in-urllib-2.patch 0002-tests-test_ssl-use-ciphercuites-for-TLS1.3-cipher-in.patch +0003-Remove-duplicate-call-of-the-error-code.patch +0004-Limit-tests.test_rsa.RSATestCase.test_public_encrypt.patch +0005-tests.test_rsa-Fix-typo-to-match-for-proper-exceptio.patch +0006-Be-resilient-against-the-situation-when-no-erorr-hap.patch