Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:mod:`hmac` computations were not releasing the GIL while calling the
OpenSSL ``HMAC_Update`` C API (a new feature in 3.9). This unintentionally
prevented parallel computation as other :mod:`hashlib` algorithms support.
6 changes: 4 additions & 2 deletions Modules/_hashopenssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1496,9 +1496,11 @@ _hmac_update(HMACobject *self, PyObject *obj)
}

if (self->lock != NULL) {
ENTER_HASHLIB(self);
Py_BEGIN_ALLOW_THREADS
PyThread_acquire_lock(self->lock, 1);
r = HMAC_Update(self->ctx, (const unsigned char*)view.buf, view.len);
LEAVE_HASHLIB(self);
PyThread_release_lock(self->lock);
Py_END_ALLOW_THREADS
} else {
r = HMAC_Update(self->ctx, (const unsigned char*)view.buf, view.len);
}
Expand Down