Skip to content

gh-135532: simplify handling of HACL* errors in _hmac #135740

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

Merged

Conversation

picnixz
Copy link
Member

@picnixz picnixz commented Jun 20, 2025

When I first wrote this module, I wanted to be as pedantic as possible. However, the code became overly complex and having a better traceback when getting Hacl_Streaming_Types_InvalidAlgorithm is not really interesting because it should, in practice, never happen.

Hacl_Streaming_Types_InvalidAlgorithm is only returned when we allocate HMAC with BLAKE-2 but... that shouldn't be possible because we're not supporting HMAC-BLAKE (BLAKE is already playing the role of a keyed hash function).

@picnixz
Copy link
Member Author

picnixz commented Jun 20, 2025

!buildbot FIPS only

@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @picnixz for commit b7a132f 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F135740%2Fmerge

The command will test the builders whose names match following regular expression: FIPS only

The builders matched are:

  • AMD64 RHEL8 FIPS Only Blake2 Builtin Hash PR
  • AMD64 CentOS9 FIPS Only Blake2 Builtin Hash PR

@picnixz picnixz merged commit 2dbada1 into python:main Jun 20, 2025
49 checks passed
@picnixz picnixz deleted the refactor/hmac/convert-hacl-errno-135532 branch June 20, 2025 08:57
@miss-islington-app
Copy link

Thanks @picnixz for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 20, 2025
@bedevere-app
Copy link

bedevere-app bot commented Jun 20, 2025

GH-135743 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Jun 20, 2025
@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot aarch64 Fedora Stable 3.x (tier-2) has failed when building commit 2dbada1.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/125/builds/7834) and take a look at the build logs.
  4. Check if the failure is related to this commit (2dbada1) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/125/builds/7834

Failed tests:

  • test_perf_profiler

Failed subtests:

  • test_python_calls_appear_in_the_stack_if_perf_activated - test.test_perf_profiler.TestPerfProfilerWithDwarf.test_python_calls_appear_in_the_stack_if_perf_activated

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64/build/Lib/test/test_perf_profiler.py", line 373, in test_python_calls_appear_in_the_stack_if_perf_activated
    self.assertEqual(stderr, "")
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^
AssertionError: 'Warning:\nProcessed 726 events and lost 1[34 chars]\n\n' != ''
- Warning:
- Processed 726 events and lost 1 chunks!
- 
- Check IO/CPU overload!
- 


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64/build/Lib/test/test_perf_profiler.py", line 373, in test_python_calls_appear_in_the_stack_if_perf_activated
    self.assertEqual(stderr, "")
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^
AssertionError: 'Warning:\nProcessed 674 events and lost 1[34 chars]\n\n' != ''
- Warning:
- Processed 674 events and lost 1 chunks!
- 
- Check IO/CPU overload!
- 

picnixz added a commit that referenced this pull request Jun 20, 2025
…5740) (#135743)

gh-135532: simplify handling of HACL* errors in `_hmac` (GH-135740)
(cherry picked from commit 2dbada1)

Co-authored-by: Bénédikt Tran <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants