Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[3.12] gh-109396: Fix test_socket.test_hmac_sha1() in FIPS mode (GH-109423)#109426

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Yhg1s merged 1 commit intopython:3.12frommiss-islington:backport-e091b9f-3.12
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-109396: Fix test_socket.test_hmac_sha1() in FIPS mode (GH-109423)
Use a longer key: FIPS mode requires at least of at least 112 bits.The previous key was only 32 bits.(cherry picked from commite091b9f)Co-authored-by: Victor Stinner <vstinner@python.org>
  • Loading branch information
@vstinner@miss-islington
vstinner authored andmiss-islington committedSep 14, 2023
commit5be685e87c727d96c736a908343463a4154bd1dc
10 changes: 7 additions & 3 deletionsLib/test/test_socket.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6474,12 +6474,16 @@ def test_sha256(self):
self.assertEqual(op.recv(512), expected)

def test_hmac_sha1(self):
expected = bytes.fromhex("effcdf6ae5eb2fa2d27416d5f184df9c259a7c79")
# gh-109396: In FIPS mode, Linux 6.5 requires a key
# of at least 112 bits. Use a key of 152 bits.
key = b"Python loves AF_ALG"
data = b"what do ya want for nothing?"
expected = bytes.fromhex("193dbb43c6297b47ea6277ec0ce67119a3f3aa66")
with self.create_alg('hash', 'hmac(sha1)') as algo:
algo.setsockopt(socket.SOL_ALG, socket.ALG_SET_KEY,b"Jefe")
algo.setsockopt(socket.SOL_ALG, socket.ALG_SET_KEY,key)
op, _ = algo.accept()
with op:
op.sendall(b"what do ya want for nothing?")
op.sendall(data)
self.assertEqual(op.recv(512), expected)

# Although it should work with 3.19 and newer the test blocks on
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
Fix ``test_socket.test_hmac_sha1()`` in FIPS mode. Use a longer key: FIPS
mode requires at least of at least 112 bits. The previous key was only 32
bits. Patch by Victor Stinner.

[8]ページ先頭

©2009-2025 Movatter.jp