_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.
Activity
gh-155843: properly initialize HMAC objects to prevent crashes after …
pythongh-155843: properly initialize HMAC objects to prevent crashes …
[3.15] gh-155843: properly initialize HMAC objects to prevent crashes…
[3.14] gh-155843: properly initialize HMAC objects to prevent crashes…