python / python/cpython

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

オープン
#127,298 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

extension-modules topic-SSL type-feature type-security
主要言語
Python
スター
77.2k
フォーク
35.9k
PR マージ指標
PR 指標を取得中

説明

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:

(note there are some off-topic messages there)

Linked PRs
  • gh-127301
  • gh-127492

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、リンクされている PR gh-127301 と gh-127492 を確認し、次にコンテキストを把握するため、issue にリンクされている Discourse の議論を読んでください。OpenSSL FIPS モードの内外で、要求されている hashlib の動作を比較してください。OpenSSL の実装が usedforsecurity=True に使用され、FIPS モードではフォールバック実装に usedforsecurity=False が必要になれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
cryptography, security
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
20/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。