Commit graph

16 commits

Author SHA1 Message Date
Sergey Miryanov
1588413ca7
gh-116946: remove unnecessary gc from immutable types (#139073) 2025-10-01 13:15:58 +05:30
Peter Bierma
4f6ecd10c2
gh-138342: Use a common utility for visiting an object's type (GH-138343)
Add `_PyObject_VisitType` in place of `tp_traverse` functions that only visit the object's type.
2025-09-01 16:20:33 +00:00
Adam Turner
918e3ba6c0
GH-137623: Use an AC decorator for docstring line length enforcement (#137690) 2025-08-18 18:29:00 +01:00
Bénédikt Tran
fe0e921817
gh-131876: Revert "gh-131876: extract _hashlib helpers into a separate directory (#136995) (#137307)
Revert "gh-131876: extract `_hashlib` helpers into a separate directory (#136995)"

This reverts commit 45138d3584.
2025-08-01 10:45:40 -07:00
Bénédikt Tran
45138d3584
gh-131876: extract _hashlib helpers into a separate directory (#136995)
The `Modules/hashlib.h` helper file is now removed and split into multiple files:

* `Modules/_hashlib/hashlib_buffer.[ch]` -- Utilities for getting a buffer view and handling buffer inputs.
* `Modules/_hashlib/hashlib_fetch.h` -- Utilities used when fetching a message digest from a digest-like identifier.
  Currently, this file only contains common error messages as the fetching API is not yet implemented.
* `Modules/_hashlib/hashlib_mutex.h` -- Utilities for managing the lock on cryptographic hash objects.
2025-07-28 11:28:48 +02:00
Bénédikt Tran
eefd70f0ed
gh-136968: fortify macro usage in cryptographic modules (#136973)
Macros used in cryptographic extension modules are partially rewritten
to use `static inline` functions when possible to help code completion.
2025-07-28 07:36:15 +00:00
Bénédikt Tran
6be49ee517
gh-136787: improve exception messages for invalid hash algorithms (#136802) 2025-07-20 08:49:34 +00:00
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
e7295a89b8
gh-135239: simpler use of mutexes in cryptographic modules (#135267) 2025-06-22 16:59:57 +02:00
Bénédikt Tran
2dbada179f
gh-135532: simplify handling of HACL* errors in _hmac (#135740) 2025-06-20 10:57:16 +02:00
Bénédikt Tran
c765683398
gh-135561: ensure that the GIL is held when handling an HACL* error in _hmac (#135562) 2025-06-19 17:27:19 +00: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
1b7470f8cb
gh-133061: do not mention UINT32_MAX in HMAC user-facing messages (#133062) 2025-04-28 01:14:12 +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
b865871486
gh-99108: add support for SIMD-accelerated HMAC-BLAKE2 (#132120) 2025-04-07 09:31:17 +02:00
Bénédikt Tran
0a97427ee5
gh-99108: Implement HACL* HMAC (#130157)
A new extension module, `_hmac`, now exposes the HACL* HMAC (formally verified) implementation.

The HACL* implementation is used as a fallback implementation when the OpenSSL implementation of HMAC
is not available or disabled. For now, only named hash algorithms are recognized and SIMD support provided
by HACL* for the BLAKE2 hash functions is not yet used.
2025-04-04 19:04:00 +02:00