Skip to content

Commit 80f445d

Browse files
committed
consistency fixes
1 parent db57278 commit 80f445d

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Modules/blake2module.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,8 @@ py_blake2_new(PyTypeObject *type, PyObject *data, int digest_size,
642642
if (data != NULL) {
643643
Py_buffer buf;
644644
GET_BUFFER_VIEW_OR_ERROR(data, &buf, goto error);
645+
/* Do not use self->mutex here as this is the constructor
646+
* where it is not yet possible to have concurrent access. */
645647
Py_BEGIN_ALLOW_THREADS
646648
blake2_update_state_unlocked(self, buf.buf, buf.len);
647649
Py_END_ALLOW_THREADS

Modules/sha3module.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ newSHA3object(PyTypeObject *type)
8181
}
8282

8383
static void
84-
sha3_update(Hacl_Hash_SHA3_state_t *state, uint8_t *buf, Py_ssize_t len)
84+
_hacl_sha3_state_update(Hacl_Hash_SHA3_state_t *state,
85+
uint8_t *buf, Py_ssize_t len)
8586
{
8687
/*
8788
* Note: we explicitly ignore the error code on the basis that it would
@@ -163,7 +164,7 @@ py_sha3_new_impl(PyTypeObject *type, PyObject *data_obj, int usedforsecurity,
163164
/* Do not use self->mutex here as this is the constructor
164165
* where it is not yet possible to have concurrent access. */
165166
Py_BEGIN_ALLOW_THREADS
166-
sha3_update(self->hash_state, buf.buf, buf.len);
167+
_hacl_sha3_state_update(self->hash_state, buf.buf, buf.len);
167168
Py_END_ALLOW_THREADS
168169
}
169170

@@ -298,7 +299,7 @@ _sha3_sha3_224_update_impl(SHA3object *self, PyObject *data)
298299
GET_BUFFER_VIEW_OR_ERROUT(data, &buf);
299300
Py_BEGIN_ALLOW_THREADS
300301
HASHLIB_ACQUIRE_LOCK(self);
301-
sha3_update(self->hash_state, buf.buf, buf.len);
302+
_hacl_sha3_state_update(self->hash_state, buf.buf, buf.len);
302303
HASHLIB_RELEASE_LOCK(self);
303304
Py_END_ALLOW_THREADS
304305
PyBuffer_Release(&buf);

0 commit comments

Comments
 (0)