GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Ensure builtin hashlib implementations honor usedforsecurity=True when _hashlib is in FIPS mode · Issue #127298 · python/cpython

Ensure builtin hashlib implementations honor usedforsecurity=True when _hashlib is in FIPS mode #127298

New issue
Copy link
New issue
Copy link
Open
Open
Ensure builtin hashlib implementations honor usedforsecurity=True when _hashlib is in FIPS mode#127298
Copy link
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirtopic-SSLtype-featureA feature request or enhancementA feature request or enhancementtype-securityA security issueA security issue

Description

@xnox
xnox
opened on Nov 26, 2024
Issue body actions

Feature or enhancement

Proposal:

When OpenSSL is not available, or is not in FIPS mode:

  • no change of behaviour

When OpenSSL is available and is in FIPS mode:

  • ensure that only OpenSSL implementations are used when usedforsecurity=True
  • ensure that all built-in (fallback) implementations require usedforsecurity=False

This addresses all needs of FIPS users that expect approved only cryptography from hashlib by default.
It satisfies Python guarantees of always available algorithms, as built-in fallbacks remain accessible with an explicit consent from the user that unapproved (an FIPS/ISO term) implementation is acceptable to the user.

In FIPS mode it means that all users can gain access to blake2/shake/md5, even when these algorithms are either blocked or unavailable from the runtime OpenSSL in FIPS mode. As long as usedforsecurity=False is used.

This also removes need to recompile or configure python somehow different for a non-fips & fips build, specifically one can safely compile python with all with-builtin-hashlib-hashes enabled.

Diagrams and full details of the current state of hashlib; and FIPS user desires are documented in this issue is opened as a reference for potential implementations to resolve all needs and desires listed there.

This issue will be used as a reference for potential implementations.

Has this already been discussed elsewhere?

I have already discussed this feature proposal on Discourse

Links to previous discussion of this feature:

Discuss:

  • https://discuss.python.org/t/python-and-openssl-fips-mode/51389/12

(note there are some off-topic messages there)

Linked PRs

  • gh-127298: When in FIPS mode ensure builtin hashes check for usedforsecurity=False #127301
  • gh-127298: Refactor test_hashlib for better usedforsecurity & openssl fips mode env support. #127492

Activity

  1. xnox
    added
    type-featureA feature request or enhancementA feature request or enhancement
    on Nov 26, 2024
  2. picnixz commented on Nov 26, 2024

    @picnixz
    picnixz
    on Nov 26, 2024
    Member
    More actions

    Didn't we have a similar feature request for that? cc @encukou (I can't find it on mobile but I remember you participated in a similar discussion)

  3. xnox commented on Nov 26, 2024

    @xnox
    xnox
    on Nov 26, 2024
    Author
    More actions

    Didn't we have a similar feature request for that? cc @encukou (I can't find it on mobile but I remember you participated in a similar discussion)

    I previously opened #118224 but this issue is related; but is a different approach / design / end-goal. I don't know if you meant that one or something else.

  4. xnox
    added 7 commits that reference this issue on Nov 26, 2024

    pythongh-127298: When in FIPS mode ensure builtin hashes check for us…

    8e5d01f

    pythongh-127298: When in FIPS mode ensure builtin hashes check for us…

    82e72d9

    pythongh-127298: When in FIPS mode ensure builtin hashes check for us…

    9d6fd91

    pythongh-127298: When in FIPS mode ensure builtin hashes check for us…

    756cd93

    pythongh-127298: When in FIPS mode ensure builtin hashes check for us…

    db5c976

    pythongh-127298: When in FIPS mode ensure builtin hashes check for us…

    ad0fab8

    pythongh-127298: When in FIPS mode ensure builtin hashes check for us…

    28d8035
  5. picnixz
    added
    type-securityA security issueA security issue
    extension-modulesC modules in the Modules dirC modules in the Modules dir
    topic-SSL
    on Nov 27, 2024
  6. picnixz commented on Nov 27, 2024

    @picnixz
    picnixz
    on Nov 27, 2024
    Member
    More actions

    Yes, I think that's the issue I had in mind. Good to know it's not a duplicate.

  7. xnox
    added 2 commits that reference this issue on Dec 12, 2024

    python-3.13: cherry-pick proposed change to block blake2

    91c52c5

    python-3.13: cherry-pick proposed change to block blake2 (#36503)

    21c2bdd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirC modules in the Modules dirtopic-SSLtype-featureA feature request or enhancementA feature request or enhancementtype-securityA security issueA security issue

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.