-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
hashlib should probably load "default" OpenSSL provider on OpenSSL 3.x explicitly #92876
Comments
On the other hand, if the system in in FIPS mode, lack of default provider may instead be conscious and deliberate action by the system administrator. Necessity to explicitly load both default and legacy providers if you want to use legacy algorithms is a deliberate choice by openssl. |
I don't think FIPS mode should be a concern here. I doubt that python itself can run (unmodified) in a FIPS environment, and the vast, vast majority of users are not affected by rules for USG agencies and contractors. Said otherwise, someone trying to use this in a FIPS environment will have bigger issues than whether the legacy provider is loaded (which wouldn't be present on their system anyway). While it could ostensibly be wrapped with a |
|
In any case, an easy way to load it would be nice, even if it's not default in Python. |
…WHIRLPOOL Bug: python/cpython#91257 Bug: python/cpython#92876 Bug: https://bugs.gentoo.org/846389 Signed-off-by: Sam James <[email protected]>
…WHIRLPOOL Bug: python/cpython#91257 Bug: python/cpython#92876 Bug: https://bugs.gentoo.org/846389 Signed-off-by: Sam James <[email protected]>
…WHIRLPOOL Bug: python/cpython#91257 Bug: python/cpython#92876 Bug: https://bugs.gentoo.org/846389 Signed-off-by: Sam James <[email protected]>
…WHIRLPOOL Bug: python/cpython#91257 Bug: python/cpython#92876 Bug: https://bugs.gentoo.org/846389 Signed-off-by: Sam James <[email protected]>
…WHIRLPOOL Bug: python/cpython#91257 Bug: python/cpython#92876 Bug: https://bugs.gentoo.org/846389 Signed-off-by: Sam James <[email protected]>
If algorithms are not provided at all in usedforsecurity=False mode by OpenSSL, hashlib falls back to our built-ins: https://github.com/python/cpython/blob/main/Lib/hashlib.py#L126-L141 per |
If there are openssl providers people configure via whatever means rather than whatever a "default" was for the past 20 years that, for example, do not provide sha1 and md5 at all, hashlib will quite happily do its job and provide those itself. This is working as intended as far as I'm concerned. |
Bug report
FWIU OpenSSL 3.x disables loading the
default
provider automatically if one loads a provider explicitly before calling any MD-related function. Sincehashlib
normally relies on the MDs provided by thedefault
OpenSSL provider, perhaps it should load them explicitly to ensure that they are present. This would also ensure that the loaded OpenSSL providers are consistent whetherhashlib
is loaded prior to the script loading other providers or not.By default:
But if I load the
legacy
provider first:but if I load both
default
andlegacy
providers, I get the full set:Your environment
The text was updated successfully, but these errors were encountered: