summaryrefslogtreecommitdiffstats
path: root/Modules/sha1module.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2019-09-13 00:30:00 (GMT)
committerGregory P. Smith <greg@krypto.org>2019-09-13 00:30:00 (GMT)
commit7cad53e6b084435a220e6604010f1fa5778bd0b1 (patch)
treea54b4906b9e9fc18bd5319fe87ad8a7fc071b3a7 /Modules/sha1module.c
parent3a4f66707e824ef3a8384827590ebaa6ca463dc0 (diff)
downloadcpython-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/sha1module.c')
-rw-r--r--Modules/sha1module.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/sha1module.c b/Modules/sha1module.c
index ce2ad26..4d191c3 100644
--- a/Modules/sha1module.c
+++ b/Modules/sha1module.c
@@ -480,13 +480,15 @@ static PyTypeObject SHA1type = {
_sha1.sha1
string: object(c_default="NULL") = b''
+ *
+ usedforsecurity: bool = True
Return a new SHA1 hash object; optionally initialized with a string.
[clinic start generated code]*/
static PyObject *
-_sha1_sha1_impl(PyObject *module, PyObject *string)
-/*[clinic end generated code: output=e5982830d1dece51 input=27ea54281d995ec2]*/
+_sha1_sha1_impl(PyObject *module, PyObject *string, int usedforsecurity)
+/*[clinic end generated code: output=6f8b3af05126e18e input=bd54b68e2bf36a8a]*/
{
SHA1object *new;
Py_buffer buf;