mirror of
https://github.com/python/cpython.git
synced 2025-07-19 01:05:26 +00:00
bpo-9216: hashlib usedforsecurity fixes (GH-20258)
func:`hashlib.new` passed ``usedforsecurity`` to OpenSSL EVP constructor
``_hashlib.new()``. test_hashlib and test_smtplib handle strict security
policy better.
Signed-off-by: Christian Heimes <christian@python.org>
Automerge-Triggered-By: @tiran
(cherry picked from commit 909b5714e1
)
Co-authored-by: Christian Heimes <christian@python.org>
This commit is contained in:
parent
983b17ca13
commit
a08b7c3bb0
6 changed files with 90 additions and 34 deletions
|
@ -154,7 +154,7 @@ def __hash_new(name, data=b'', **kwargs):
|
|||
# salt, personal, tree hashing or SSE.
|
||||
return __get_builtin_constructor(name)(data, **kwargs)
|
||||
try:
|
||||
return _hashlib.new(name, data)
|
||||
return _hashlib.new(name, data, **kwargs)
|
||||
except ValueError:
|
||||
# If the _hashlib module (OpenSSL) doesn't support the named
|
||||
# hash, try using our builtin implementations.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue