FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-155835: fix `digest_size` data race on BLAKE-2 objects by picnixz · Pull Request #155839 · python/cpython · GitHub

Repository navigation

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

Filter by extension

Filter by extension .c  (1) .py  (1) .rst  (1) All 3 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
6 changes: 6 additions & 0 deletions Lib/test/test_hashlib.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1505,6 +1505,12 @@ def test_HACL_sha3_attributes(self, size, attrname):
def test_HACL_shake_attributes(self, size, attrname):
self.check_HACL_attribute(_sha3, f"shake_{size}", attrname)

@requires_blake2
@support.subTests("version", ["blake2s", "blake2b"])
@support.subTests("attrname", ["block_size", "digest_size"])
def test_HACL_blake2_attributes(self, version, attrname):
self.check_HACL_attribute(_blake2, version, attrname)


if __name__ == "__main__":
unittest.main()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
:mod:`hashlib`: Fix a data race when accessing :attr:`~hashlib.hash.digest_size`
on BLAKE-2 objects. Patch by Bénédikt Tran.
2 changes: 2 additions & 0 deletions Modules/blake2module.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,9 @@ static PyObject *
py_blake2b_get_digest_size(PyObject *op, void *Py_UNUSED(closure))
{
Blake2Object *self = _Blake2Object_CAST(op);
HASHLIB_ACQUIRE_LOCK(self);
Hacl_Hash_Blake2b_index info = hacl_get_blake2_info(self);
HASHLIB_RELEASE_LOCK(self);
return PyLong_FromLong(info.digest_length);
}

Expand Down
Loading

Back | FazBrowse Home | New Git URL