◐ Shell
clean mode source ↗

gh-127298: When in FIPS mode ensure builtin hashes check for usedforsecurity=False by xnox · Pull Request #127301 · python/cpython

This was referenced

Nov 26, 2024

gpshead

gpshead previously approved these changes Nov 27, 2024

xnox

techalchemy added a commit to techalchemy/os that referenced this pull request

Apr 28, 2025

techalchemy added a commit to techalchemy/os that referenced this pull request

Apr 28, 2025

techalchemy added a commit to techalchemy/os that referenced this pull request

Apr 29, 2025

xnox and others added 13 commits

September 8, 2025 01:16
…edforsecurity=False

When _hashlib/OpenSSL is available, and OpenSSL is in FIPS mode,
ensure that builtin (fallback) hash implementations are wrapped with a
check for usedforsecurity=False. It is likely that buitin
implementations are FIPS unapproved (either algorithm disallowed; or
the implementation not certified by NIST).

This enables strict approved-only compliance when usedforsecurity=True
on FIPS systems only.

And yet it also enables fallback access with usedforsecurity=False for
any missing (historical, disallowed or missing certified
implementation) algorithms (i.e. blake2, md5, shake/sha3) depending on
the runtime configuration of OpenSSL.
FIPS mode is an OpenSSL feature and we don't require OpenSSL. So anyone wanting to rely on this will need to ensure their build includes Modules/_hashopenssl.c as `_hashlib` linked appropriately.