diff options
author | Christian Heimes <christian@python.org> | 2019-09-13 02:30:00 +0200 |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2019-09-12 19:30:00 -0500 |
commit | 7cad53e6b084435a220e6604010f1fa5778bd0b1 (patch) | |
tree | a54b4906b9e9fc18bd5319fe87ad8a7fc071b3a7 /Modules/sha512module.c | |
parent | 3a4f66707e824ef3a8384827590ebaa6ca463dc0 (diff) | |
download | cpython-git-7cad53e6b084435a220e6604010f1fa5778bd0b1.tar.gz |
bpo-9216: Add usedforsecurity to hashlib constructors (GH-16044)
The usedforsecurity keyword only argument added to the hash constructors is useful for FIPS builds and similar restrictive environment with non-technical requirements that legacy algorithms be forbidden by their implementations without being explicitly annotated as not being used for any security related purposes. Linux distros with FIPS support benefit from this being standard rather than making up their own way(s) to do it.
Contributed and Signed-off-by: Christian Heimes christian@python.org
Diffstat (limited to 'Modules/sha512module.c')
-rw-r--r-- | Modules/sha512module.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Modules/sha512module.c b/Modules/sha512module.c index 98b97917f4..df4f9d2d74 100644 --- a/Modules/sha512module.c +++ b/Modules/sha512module.c @@ -666,13 +666,15 @@ static PyTypeObject SHA512type = { _sha512.sha512 string: object(c_default="NULL") = b'' + * + usedforsecurity: bool = True Return a new SHA-512 hash object; optionally initialized with a string. [clinic start generated code]*/ static PyObject * -_sha512_sha512_impl(PyObject *module, PyObject *string) -/*[clinic end generated code: output=8b865a2df73bd387 input=e69bad9ae9b6a308]*/ +_sha512_sha512_impl(PyObject *module, PyObject *string, int usedforsecurity) +/*[clinic end generated code: output=a8d9e5f9e6a0831c input=23b4daebc2ebb9c9]*/ { SHAobject *new; Py_buffer buf; @@ -706,13 +708,15 @@ _sha512_sha512_impl(PyObject *module, PyObject *string) _sha512.sha384 string: object(c_default="NULL") = b'' + * + usedforsecurity: bool = True Return a new SHA-384 hash object; optionally initialized with a string. [clinic start generated code]*/ static PyObject * -_sha512_sha384_impl(PyObject *module, PyObject *string) -/*[clinic end generated code: output=ae4b2e26decf81e8 input=c9327788d4ea4545]*/ +_sha512_sha384_impl(PyObject *module, PyObject *string, int usedforsecurity) +/*[clinic end generated code: output=da7d594a08027ac3 input=59ef72f039a6b431]*/ { SHAobject *new; Py_buffer buf; |