diff options
author | Christian Heimes <christian@python.org> | 2019-09-13 00:30:00 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2019-09-13 00:30:00 (GMT) |
commit | 7cad53e6b084435a220e6604010f1fa5778bd0b1 (patch) | |
tree | a54b4906b9e9fc18bd5319fe87ad8a7fc071b3a7 /Modules/sha256module.c | |
parent | 3a4f66707e824ef3a8384827590ebaa6ca463dc0 (diff) | |
download | cpython-7cad53e6b084435a220e6604010f1fa5778bd0b1.zip cpython-7cad53e6b084435a220e6604010f1fa5778bd0b1.tar.gz cpython-7cad53e6b084435a220e6604010f1fa5778bd0b1.tar.bz2 |
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/sha256module.c')
-rw-r--r-- | Modules/sha256module.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Modules/sha256module.c b/Modules/sha256module.c index b8d6c4c..245f4c0 100644 --- a/Modules/sha256module.c +++ b/Modules/sha256module.c @@ -601,13 +601,15 @@ static PyTypeObject SHA256type = { _sha256.sha256 string: object(c_default="NULL") = b'' + * + usedforsecurity: bool = True Return a new SHA-256 hash object; optionally initialized with a string. [clinic start generated code]*/ static PyObject * -_sha256_sha256_impl(PyObject *module, PyObject *string) -/*[clinic end generated code: output=fa644436dcea5c31 input=09cce3fb855056b2]*/ +_sha256_sha256_impl(PyObject *module, PyObject *string, int usedforsecurity) +/*[clinic end generated code: output=a1de327e8e1185cf input=9be86301aeb14ea5]*/ { SHAobject *new; Py_buffer buf; @@ -641,13 +643,15 @@ _sha256_sha256_impl(PyObject *module, PyObject *string) _sha256.sha224 string: object(c_default="NULL") = b'' + * + usedforsecurity: bool = True Return a new SHA-224 hash object; optionally initialized with a string. [clinic start generated code]*/ static PyObject * -_sha256_sha224_impl(PyObject *module, PyObject *string) -/*[clinic end generated code: output=21e3ba22c3404f93 input=27a04ba24c353a73]*/ +_sha256_sha224_impl(PyObject *module, PyObject *string, int usedforsecurity) +/*[clinic end generated code: output=08be6b36569bc69c input=9fcfb46e460860ac]*/ { SHAobject *new; Py_buffer buf; |