Commit graph

16 commits

Author SHA1 Message Date
Bénédikt Tran
1e975aee28
gh-135755: rename undocumented HACL_CAN_COMPILE_SIMD{128,256} macros (#135847)
Rename undocumented `HACL_CAN_COMPILE_SIMD{128,256}` macros
to `_Py_HACL_CAN_COMPILE_VEC{128,256}`. These macros are private.
2025-06-27 17:12:21 +02:00
Bénédikt Tran
ef4fc86afa
gh-135532: use defining_class for copying BLAKE-2 and SHA-3 objects (#135838) 2025-06-24 09:58:07 +02:00
Bénédikt Tran
621a8bd6a8
gh-135532: cleanup clinic module directives for cryptographic modules (#135822)
Some checks are pending
Tests / (push) Blocked by required conditions
Tests / Windows MSI (push) Blocked by required conditions
Tests / Change detection (push) Waiting to run
Tests / Docs (push) Blocked by required conditions
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / Undefined behavior sanitizer (push) Blocked by required conditions
Tests / Cross build Linux (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Tests / All required checks pass (push) Blocked by required conditions
Lint / lint (push) Waiting to run
mypy / Run mypy on Lib/_pyrepl (push) Waiting to run
mypy / Run mypy on Lib/test/libregrtest (push) Waiting to run
mypy / Run mypy on Lib/tomllib (push) Waiting to run
mypy / Run mypy on Tools/build (push) Waiting to run
mypy / Run mypy on Tools/cases_generator (push) Waiting to run
mypy / Run mypy on Tools/clinic (push) Waiting to run
mypy / Run mypy on Tools/jit (push) Waiting to run
mypy / Run mypy on Tools/peg_generator (push) Waiting to run
2025-06-22 20:04:38 +00:00
Bénédikt Tran
e7295a89b8
gh-135239: simpler use of mutexes in cryptographic modules (#135267) 2025-06-22 16:59:57 +02:00
Bénédikt Tran
3cb109796d
gh-135004: rewrite and cleanup blake2module.c (#135006)
* Cleanup imports and update module docstring.
* Simplify detection of SIMD support.
* Correctly guard `update()` cases.
* Rewrite `py_blake2b_or_s_new` and rename it to `py_blake2_new`.
* Rewrite `blake2_blake2b_copy_locked` and `py_blake2_clear`.
* Refactor computations of `digest` and `hexdigest`.
* Simplify `py_blake2b_get_name` and `py_blake2b_get_block_size`.
* Add `hacl_get_blake2_info` to extract static BLAKE-2 information.
   This new helper is used by `py_blake2b_get_digest_size`, but can
   be later used to expose `key_length` more easily.
2025-06-09 09:17:43 +02:00
Bénédikt Tran
c6e63d9d35
gh-134696: align OpenSSL and HACL*-based hash functions constructors AC signatures (#134713)
OpenSSL and HACL*-based hash functions constructors now support both `data` and `string` parameters.
Previously these constructor functions inconsistently supported sometimes `data` and sometimes `string`,
while the documentation expected `data` to be given in all cases.
2025-05-31 09:37:47 +02:00
Bénédikt Tran
3695ba93d5
gh-132993: expose HASHLIB_GIL_MINSIZE to private extension modules (#132999) 2025-04-27 22:20:15 +00:00
Bénédikt Tran
261633bd3f
gh-131316: handle NULL values returned by HACL* functions (#131324)
- Handle NULL returned by allocation functions.
- Handle NULL returned by copy functions.
- Suppress unused impossible return codes.
2025-03-17 11:10:39 +01:00
Chris Eibl
faa80fcf46
GH-131296: fix clang-cl warnings on Windows in blake2module.c (#131299)
work around unimportant clang-cl warnings in blake2module.c
2025-03-15 11:37:53 -07:00
Victor Stinner
9d759b63d8
gh-111178: Change Argument Clinic signature for METH_O (#130682)
Use "PyObject*" for METH_O functions to fix an undefined behavior.
2025-03-11 16:33:36 +01:00
Bénédikt Tran
922cfecbce
gh-111178: fix UBSan failures in Modules/{blake2,md5,sha1,sha2,sha3}module.c (GH-128248)
- fix UBSan failures in `blake2module.c`
- fix UBSan failures in `md5module.c`
- fix UBSan failures in `sha1module.c`
- fix UBSan failures in `sha2module.c`
- fix UBSan failures in `sha3module.c`

Cosmetics:

- suppress unused return values
- remove redundant casts in constructors
- suppress unused parameters in `{md5,sha*,blake2}module.c`
2025-01-27 14:50:58 +01:00
Bénédikt Tran
fb0b94223d
gh-87138: convert blake2b/2s types to heap types (#127669) 2024-12-26 20:33:57 +05:30
Victor Stinner
0b67ce930a
gh-126433: Fix compiler warnings on 32-bit Windows (#126444) 2024-11-05 16:05:13 +01:00
Russell Keith-Magee
ef530ce7c6
gh-123748: Add conditional compilation rules for HACL SIMD256 and SIMD128 on macOS (#123989)
Add conditional compilation rules to allow HACL SIMD256 and SIMD128 to be ignored on the ARM64 pass of universal2 macOS builds.
2024-09-16 12:23:05 +08:00
Kirill Podoprigora
8aaf7525ab
gh-123189: [Modules/blake2module.c]: Move function definitions and their usage under the macros (#123190) 2024-08-30 13:28:32 +03:00
Jonathan Protzenko
325e9b8ef4
gh-99108: Add HACL* Blake2 implementation to hashlib (GH-119316)
This replaces the existing hashlib Blake2 module with a single implementation that uses HACL\*'s Blake2b/Blake2s implementations. We added support for all the modes exposed by the Python API, including tree hashing, leaf nodes, and so on. We ported and merged all of these changes upstream in HACL\*, added test vectors based on Python's existing implementation, and exposed everything needed for hashlib.

This was joint work done with @R1kM.

See the PR for much discussion and benchmarking details.   TL;DR: On many systems, 8-50% faster (!) than `libb2`, on some systems it appeared 10-20% slower than `libb2`.
2024-08-13 21:42:19 +00:00