diff options
author | Mike Gilbert <floppym@gentoo.org> | 2017-04-29 20:17:52 -0400 |
---|---|---|
committer | Mike Gilbert <floppym@gentoo.org> | 2017-04-29 20:18:55 -0400 |
commit | 8833b6036e93d62259f75ab97b74f28d4314c071 (patch) | |
tree | 8a141ad334ae24c0f11689bd619bb2a23284dc16 /dev-lang | |
parent | 4eecb6564211d3fcd2ad7063f53ac04c2da41bf3 (diff) | |
download | gentoo-8833b6036e93d62259f75ab97b74f28d4314c071.tar.gz gentoo-8833b6036e93d62259f75ab97b74f28d4314c071.tar.xz |
dev-lang/python: backport test fix
Bug: https://bugs.gentoo.org/617028
Package-Manager: Portage-2.3.5_p31, Repoman-2.3.2_p61
Diffstat (limited to 'dev-lang')
-rw-r--r-- | dev-lang/python/files/3.6.1-test_socket-AEAD.patch | 75 | ||||
-rw-r--r-- | dev-lang/python/python-3.6.1-r1.ebuild | 1 |
2 files changed, 76 insertions, 0 deletions
diff --git a/dev-lang/python/files/3.6.1-test_socket-AEAD.patch b/dev-lang/python/files/3.6.1-test_socket-AEAD.patch new file mode 100644 index 00000000000..426e3371441 --- /dev/null +++ b/dev-lang/python/files/3.6.1-test_socket-AEAD.patch @@ -0,0 +1,75 @@ +From 4ac01f0ff3e3c9c02f5cc8c55f2fbe4639808f5e Mon Sep 17 00:00:00 2001 +From: Mariatta <Mariatta@users.noreply.github.com> +Date: Thu, 16 Mar 2017 20:58:42 -0700 +Subject: [PATCH] update test_socket AEAD test for kernel 4.9 and up (GH-133) + (GH-548) + +(cherry picked from commit 9764c151c51480a7ca6042b1ccd69be2620ff360) +--- + Lib/test/test_socket.py | 15 +++++++-------- + 1 file changed, 7 insertions(+), 8 deletions(-) + +diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py +index 5315d475df..1508f20c9f 100644 +--- a/Lib/test/test_socket.py ++++ b/Lib/test/test_socket.py +@@ -5479,7 +5479,7 @@ class LinuxKernelCryptoAPI(unittest.TestCase): + self.assertEqual(len(dec), msglen * multiplier) + self.assertEqual(dec, msg * multiplier) + +- @support.requires_linux_version(4, 3) # see test_aes_cbc ++ @support.requires_linux_version(4, 9) # see issue29324 + def test_aead_aes_gcm(self): + key = bytes.fromhex('c939cc13397c1d37de6ae0e1cb7c423c') + iv = bytes.fromhex('b3d8cc017cbb89b39e0f67e2') +@@ -5502,8 +5502,7 @@ class LinuxKernelCryptoAPI(unittest.TestCase): + op.sendmsg_afalg(op=socket.ALG_OP_ENCRYPT, iv=iv, + assoclen=assoclen, flags=socket.MSG_MORE) + op.sendall(assoc, socket.MSG_MORE) +- op.sendall(plain, socket.MSG_MORE) +- op.sendall(b'\x00' * taglen) ++ op.sendall(plain) + res = op.recv(assoclen + len(plain) + taglen) + self.assertEqual(expected_ct, res[assoclen:-taglen]) + self.assertEqual(expected_tag, res[-taglen:]) +@@ -5511,7 +5510,7 @@ class LinuxKernelCryptoAPI(unittest.TestCase): + # now with msg + op, _ = algo.accept() + with op: +- msg = assoc + plain + b'\x00' * taglen ++ msg = assoc + plain + op.sendmsg_afalg([msg], op=socket.ALG_OP_ENCRYPT, iv=iv, + assoclen=assoclen) + res = op.recv(assoclen + len(plain) + taglen) +@@ -5522,7 +5521,7 @@ class LinuxKernelCryptoAPI(unittest.TestCase): + pack_uint32 = struct.Struct('I').pack + op, _ = algo.accept() + with op: +- msg = assoc + plain + b'\x00' * taglen ++ msg = assoc + plain + op.sendmsg( + [msg], + ([socket.SOL_ALG, socket.ALG_SET_OP, pack_uint32(socket.ALG_OP_ENCRYPT)], +@@ -5530,7 +5529,7 @@ class LinuxKernelCryptoAPI(unittest.TestCase): + [socket.SOL_ALG, socket.ALG_SET_AEAD_ASSOCLEN, pack_uint32(assoclen)], + ) + ) +- res = op.recv(len(msg)) ++ res = op.recv(len(msg) + taglen) + self.assertEqual(expected_ct, res[assoclen:-taglen]) + self.assertEqual(expected_tag, res[-taglen:]) + +@@ -5540,8 +5539,8 @@ class LinuxKernelCryptoAPI(unittest.TestCase): + msg = assoc + expected_ct + expected_tag + op.sendmsg_afalg([msg], op=socket.ALG_OP_DECRYPT, iv=iv, + assoclen=assoclen) +- res = op.recv(len(msg)) +- self.assertEqual(plain, res[assoclen:-taglen]) ++ res = op.recv(len(msg) - taglen) ++ self.assertEqual(plain, res[assoclen:]) + + @support.requires_linux_version(4, 3) # see test_aes_cbc + def test_drbg_pr_sha256(self): +-- +2.12.2 + diff --git a/dev-lang/python/python-3.6.1-r1.ebuild b/dev-lang/python/python-3.6.1-r1.ebuild index 979354ebcf7..eef0e26c7dc 100644 --- a/dev-lang/python/python-3.6.1-r1.ebuild +++ b/dev-lang/python/python-3.6.1-r1.ebuild @@ -64,6 +64,7 @@ src_prepare() { EPATCH_SUFFIX="patch" epatch "${WORKDIR}/patches" epatch "${FILESDIR}/${PN}-3.5-distutils-OO-build.patch" + epatch "${FILESDIR}/3.6.1-test_socket-AEAD.patch" epatch_user |