Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 611594 - dev-python/flask-restful: support dev-python/pycryptodome
Summary: dev-python/flask-restful: support dev-python/pycryptodome
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks: pycryptodome-tracker
  Show dependency tree
 
Reported: 2017-03-03 23:15 UTC by Michał Górny
Modified: 2020-04-17 10:12 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2017-03-03 23:15:44 UTC
See tracker.
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2017-03-27 15:26:36 UTC
Looks like it has some str/bytes problems with Python 3.


======================================================================
ERROR: test_encrypt_decrypt (tests.test_crypto.CryptoTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/portage/dev-python/flask-restful-0.3.5-r1/work/flask-restful-0.3.5/tests/test_crypto.py", line 10, in test_encrypt_decrypt
    self.assertEqual(decrypt(encrypt(message, key, seed), key, seed), message)
  File "/tmp/portage/dev-python/flask-restful-0.3.5-r1/work/flask-restful-0.3.5/flask_restful/utils/crypto.py", line 31, in encrypt
    return b64encode(create_cipher(key, seed).encrypt(pad(plaintext_data)))
  File "/tmp/portage/dev-python/flask-restful-0.3.5-r1/work/flask-restful-0.3.5/flask_restful/utils/crypto.py", line 26, in create_cipher
    return AES.new(key, AES.MODE_CBC, seed)
  File "/usr/lib64/python3.4/site-packages/Crypto/Cipher/AES.py", line 264, in new
    return _create_cipher(sys.modules[__name__], key, mode, *args, **kwargs)
  File "/usr/lib64/python3.4/site-packages/Crypto/Cipher/__init__.py", line 130, in _create_cipher
    return modes[mode](factory, **kwargs)
  File "/usr/lib64/python3.4/site-packages/Crypto/Cipher/_mode_cbc.py", line 232, in _create_cbc_cipher
    cipher_state = factory._create_base_cipher(kwargs)
  File "/usr/lib64/python3.4/site-packages/Crypto/Cipher/AES.py", line 131, in _create_base_cipher
    expect_byte_string(key)
  File "/usr/lib64/python3.4/site-packages/Crypto/Util/_raw_api.py", line 175, in expect_byte_string
    raise TypeError("Only byte strings can be passed to C code")
TypeError: Only byte strings can be passed to C code

======================================================================
ERROR: test_bookmark_paging (tests.test_paging.PagingTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/portage/dev-python/flask-restful-0.3.5-r1/work/flask-restful-0.3.5/tests/test_paging.py", line 19, in test_bookmark_paging
    result, filter, approx_result_size = retrieve_next_page(key, seed, filter, fetch_data)
  File "/tmp/portage/dev-python/flask-restful-0.3.5-r1/work/flask-restful-0.3.5/flask_restful/paging.py", line 26, in retrieve_next_page
    filter['pager_info'] = encrypt(new_bookmark, key, seed)
  File "/tmp/portage/dev-python/flask-restful-0.3.5-r1/work/flask-restful-0.3.5/flask_restful/utils/crypto.py", line 31, in encrypt
    return b64encode(create_cipher(key, seed).encrypt(pad(plaintext_data)))
  File "/tmp/portage/dev-python/flask-restful-0.3.5-r1/work/flask-restful-0.3.5/flask_restful/utils/crypto.py", line 26, in create_cipher
    return AES.new(key, AES.MODE_CBC, seed)
  File "/usr/lib64/python3.4/site-packages/Crypto/Cipher/AES.py", line 264, in new
    return _create_cipher(sys.modules[__name__], key, mode, *args, **kwargs)
  File "/usr/lib64/python3.4/site-packages/Crypto/Cipher/__init__.py", line 130, in _create_cipher
    return modes[mode](factory, **kwargs)
  File "/usr/lib64/python3.4/site-packages/Crypto/Cipher/_mode_cbc.py", line 232, in _create_cbc_cipher
    cipher_state = factory._create_base_cipher(kwargs)
  File "/usr/lib64/python3.4/site-packages/Crypto/Cipher/AES.py", line 131, in _create_base_cipher
    expect_byte_string(key)
  File "/usr/lib64/python3.4/site-packages/Crypto/Util/_raw_api.py", line 175, in expect_byte_string
    raise TypeError("Only byte strings can be passed to C code")
TypeError: Only byte strings can be passed to C code
Comment 2 Daniel Robbins 2017-12-23 00:45:04 UTC
Flask-restful only has a tiny bit of pycrypto code, and it is compatible with pycryptodome. So it should be sufficient just to update deps in the ebuild to get flask-restful working with pycryptodome. Also note that flask-restful will use crypto if available but also runs OK without pycrypto(dome) installed.
Comment 3 Virgil Dupras (RETIRED) gentoo-dev 2018-11-18 23:45:07 UTC
pycrypto dependency has been dropped upstream[1] but there isn't a release for it yet. We can either wait for a release or, if in a hurry, apply the patch in 3.6.

[1]: https://github.com/flask-restful/flask-restful/pull/743
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2020-03-30 17:18:29 UTC
Has old version, no fixed version in tree, paging and hence crypto dependency has been removed upstream: https://github.com/flask-restful/flask-restful/pull/743).
Comment 5 Larry the Git Cow gentoo-dev 2020-04-17 10:12:58 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=45201f64cd1f8ccf027064af765d1d7c965f264e

commit 45201f64cd1f8ccf027064af765d1d7c965f264e
Author:     Alessandro Barbieri <lssndrbarbieri@gmail.com>
AuthorDate: 2020-03-30 20:14:14 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2020-04-17 10:05:30 +0000

    dev-python/flask-restful: drop paging useflag and pycrypto dep
    
    https://github.com/flask-restful/flask-restful/commit/517ccfdfadb018f08fc77e484c9448b9715aa06c
    
    Closes: https://bugs.gentoo.org/611594
    Package-Manager: Portage-2.3.96, Repoman-2.3.22
    Signed-off-by: Alessandro Barbieri <lssndrbarbieri@gmail.com>
    Closes: https://github.com/gentoo/gentoo/pull/15179
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 dev-python/flask-restful/flask-restful-0.3.7.ebuild | 4 +---
 dev-python/flask-restful/metadata.xml               | 3 ---
 2 files changed, 1 insertion(+), 6 deletions(-)