Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-40791: Use CRYPTO_memcmp() for compare_digest #20456

Merged
merged 1 commit into from
May 27, 2020

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 christian@python.org

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 <christian@python.org>
@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 added the needs backport to 3.9 only security fixes label May 27, 2020
@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 <christian@python.org>
@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label May 27, 2020
@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 <christian@python.org>
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