Repository navigation
gh-162219: Provide explicit SIMD defaults for HACL streaming HMAC - #162393
tamaki0575-cloud wants to merge 2 commits into
Conversation
|
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 |
| @@ -0,0 +1,11 @@ | |||
| /* Compile the HACL* streaming HMAC implementation with explicit SIMD defaults. */ | |||
| #include "_hacl/internal/Hacl_Streaming_HMAC.h" | |||
There was a problem hiding this comment.
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
|
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 And if you don't make the requested changes, you will be poked with soft cushions! |
|
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 |
|
I moved On Linux, I have made the requested changes; please review again. |
|
Thanks for making the requested changes! @picnixz: please review the changes made to this pull request. |
| exclude=[ | ||
| "Modules/_hacl/refresh.sh", | ||
| "Modules/_hacl/README.md", | ||
| "Modules/_hacl/_hmac_hacl.c", |
There was a problem hiding this comment.
You can name it hmac_defines.c I guess. But i wonder if this is the right solution eventually. Why not changing the non-vendored sources to specify explicitly the values of the defines and ignore the -Wundef flag for _hacl sources?
If necessary, we can also add some .h file instead of a .c file which defines the macros and is included by .c files in hacl. I think it is cleaner than creating this fake .c file (I alao think the approach is wrong actually; the .c files looks like a ugly hack)
|
Thanks, that makes sense. I tested an alternative that removes the wrapper,
sets explicit defaults in `hmacmodule.c` and `blake2module.c`, and applies
`-Wno-undef` only when compiling `Hacl_Streaming_HMAC.c`. The affected
objects compiled on Linux with SIMD enabled and disabled, and `test_hmac`
and `test_hashlib` passed. Would you be happy with limiting `-Wno-undef` to
that one source file?
Bénédikt Tran ***@***.***> 于2026年11月22日周日 21:03写道:
… ***@***.**** commented on this pull request.
------------------------------
In Tools/build/generate_sbom.py
<#162393 (comment)>:
> @@ -77,6 +77,7 @@ class PackageFiles(typing.NamedTuple):
exclude=[
"Modules/_hacl/refresh.sh",
"Modules/_hacl/README.md",
+ "Modules/_hacl/_hmac_hacl.c",
You can name it hmac_defines.c I guess. But i wonder if this is the right
solution eventually. Why not changing the non-vendored sources to specify
explicitly the values of the defines and ignore the -Wundef flag for _hacl
sources?
If necessary, we can also add some .h file instead of a .c file which
defines the macros and is included by .c files in hacl. I think it is
cleaner than creating this fake .c file (I alao think the approach is wrong
actually; the .c files looks like a ugly hack)
—
Reply to this email directly, view it on GitHub
<#162393?email_source=notifications&email_token=B7LCUX3QKN5DXTKBBQSLRQT52K2XJA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTMMBRGE3DCMJXGM22M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#pullrequestreview-6011611735>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/B7LCUX3UOVDDG3H75YY4PCT52K2XJAVCNFSNUABEKJSXA33TNF2G64TZHM4DCNJZHA4TMMJ3JFZXG5LFHM3DKMZRGU2DOMBRG2QXMAQ>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/B7LCUX62NLOFSW3ZDYLCM6T52K2XJA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTMMBRGE3DCMJXGM22M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KUZTPN52GK4S7NFXXG>
and Android
<https://github.com/notifications/mobile/android/B7LCUX5SDQFZXJG76GUV25T52K2XJA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTMMBRGE3DCMJXGM22M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA>.
Download it today!
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Compile the vendored HACL* streaming HMAC implementation through a CPython wrapper. The wrapper defaults
HACL_CAN_COMPILE_VEC128andHACL_CAN_COMPILE_VEC256to0only when they are undefined. The Makefile and Windows project both use the wrapper, so the vendored source stays untouched.Fixes #162219.
Testing
make Modules/_hacl/Hacl_Streaming_HMAC.o CC='gcc -Wundef'reproduced both warnings before the patch and emitted neither after it.mainat1822ff5and ran./python -m test test_hmac test_hashlib. Both test modules passed (241 tests run, 17 skipped).Codex was used to verify the patch and prepare this PR description.
HACL_CAN_COMPILE_VEC128macro is not defined when building Python with-Wundef#162219