Skip to content

gh-162219: Provide explicit SIMD defaults for HACL streaming HMAC - #162393

Open
tamaki0575-cloud wants to merge 1 commit into
python:mainfrom
tamaki0575-cloud:gh-162219-hacl-hmac-simd-defaults
Open

tamaki0575-cloud wants to merge 1 commit into
python:mainfrom
tamaki0575-cloud:gh-162219-hacl-hmac-simd-defaults

Conversation

@tamaki0575-cloud

@tamaki0575-cloud tamaki0575-cloud commented Nov 21, 2026 •

Copy link
Copy Markdown

Compile the vendored HACL* streaming HMAC implementation through a CPython wrapper. The wrapper defaults HACL_CAN_COMPILE_VEC128 and HACL_CAN_COMPILE_VEC256 to 0 only when they are undefined. The Makefile and Windows project both use the wrapper, so the vendored source stays untouched.

Fixes #162219.

Testing

  • Debian Bookworm (Docker), GCC 12.2: make Modules/_hacl/Hacl_Streaming_HMAC.o CC='gcc -Wundef' reproduced both warnings before the patch and emitted neither after it.
  • Built CPython from main at 1822ff5 and ran ./python -m test test_hmac test_hashlib. Both test modules passed (241 tests run, 17 skipped).
  • Checked the compile entries in both Windows project files. No Windows build was run.

Codex was used to verify the patch and prepare this PR description.

@python-cla-bot

python-cla-bot Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@bedevere-app

bedevere-app Bot commented Nov 21, 2026

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

Comment thread Modules/_hmac_hacl.c
@@ -0,0 +1,11 @@
/* Compile the HACL* streaming HMAC implementation with explicit SIMD defaults. */
#include "_hacl/internal/Hacl_Streaming_HMAC.h"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather prefer that this file is put in the _hacl folder next to refresh.sh or update the sh script instead if necessary. We already have some namespace hacking for HACL

@bedevere-app

bedevere-app Bot commented Nov 21, 2026

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

And if you don't make the requested changes, you will be poked with soft cushions!

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.

[HACL] The HACL_CAN_COMPILE_VEC128 macro is not defined when building Python with -Wundef

2 participants