Bug report
Bug description:
This affects the following situations:
_hmac.new() frees an uninitialized HACL pointer when the key exceeds UINT32_MAX
_hmac_HMAC_copy_impl runs HASHLIB_INIT_MUTEX(copy) after the fallible hmac_copy_state
The solution is simply to always entirely initialize the HMAC object before working with it. We also change the usage of PyObject_New to tp->tp_alloc directly so that we only alter fields for which the 0-value would not be suitable.
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
Bug report
Bug description:
This affects the following situations:
_hmac.new()frees an uninitialized HACL pointer when the key exceedsUINT32_MAX_hmac_HMAC_copy_implrunsHASHLIB_INIT_MUTEX(copy)after the falliblehmac_copy_stateThe solution is simply to always entirely initialize the HMAC object before working with it. We also change the usage of
PyObject_Newtotp->tp_allocdirectly so that we only alter fields for which the 0-value would not be suitable.CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs