Skip to content

Conversation

@tiran
Copy link
Member

@tiran tiran commented May 27, 2020

:func:hashlib.compare_digest uses OpenSSL's CRYPTO_memcmp() function
when OpenSSL is available.

Note: The _operator module is a builtin module. I don't want to add
libcrypto dependency to libpython. Therefore I duplicated the wrapper
function and added a copy to _hashopenssl.c.

Signed-off-by: Christian Heimes [email protected]

https://bugs.python.org/issue40791

:func:`hashlib.compare_digest` uses OpenSSL's ``CRYPTO_memcmp()`` function
when OpenSSL is available.

Note: The ``_operator`` module is a builtin module. I don't want to add
libcrypto dependency to libpython. Therefore I duplicated the wrapper
function and added a copy to ``_hashopenssl.c``.

Signed-off-by: Christian Heimes <[email protected]>
@gpshead gpshead added type-feature A feature request or enhancement type-security A security issue labels May 27, 2020
@tiran
Copy link
Member Author

tiran commented May 27, 2020

@gpshead 3.10-only or do you want to handle this as a security fix with backport to 3.7 to 3.9?

@tiran tiran merged commit db5aed9 into python:master May 27, 2020
@miss-islington
Copy link
Contributor

Thanks @tiran for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9.
🐍🍒⛏🤖

@bedevere-bot
Copy link

@tiran: Please replace # with GH- in the commit message next time. Thanks!

@tiran tiran deleted the bpo-40791-openssl-compare-digest branch May 27, 2020 19:50
@miss-islington
Copy link
Contributor

Sorry, @tiran, I could not cleanly backport this to 3.9 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker db5aed931f8a617f7b63e773f62db468fe9c5ca1 3.9

tiran added a commit to tiran/cpython that referenced this pull request May 27, 2020
hashlib.compare_digest uses OpenSSL's CRYPTO_memcmp() function
when OpenSSL is available.

Note: The _operator module is a builtin module. I don't want to add
libcrypto dependency to libpython. Therefore I duplicated the wrapper
function and added a copy to _hashopenssl.c..
(cherry picked from commit db5aed9)

Co-authored-by: Christian Heimes <[email protected]>
@bedevere-bot
Copy link

GH-20461 is a backport of this pull request to the 3.9 branch.

miss-islington pushed a commit that referenced this pull request May 28, 2020
…H-20461)

hashlib.compare_digest uses OpenSSL's CRYPTO_memcmp() function
when OpenSSL is available.

Note: The _operator module is a builtin module. I don't want to add
libcrypto dependency to libpython. Therefore I duplicated the wrapper
function and added a copy to _hashopenssl.c..
(cherry picked from commit db5aed9)

Co-authored-by: Christian Heimes <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type-feature A feature request or enhancement type-security A security issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants