diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2018-07-31 06:50:16 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-31 06:50:16 (GMT) |
commit | f1d36d8efaecd5c84cb35e35119b283f37d83c40 (patch) | |
tree | 055434182e3f7859d01386eac0766fc7a1d69193 /Modules/_hashopenssl.c | |
parent | 4b8a7f51da224d1a0ad8159935f78ba4e6e16037 (diff) | |
download | cpython-f1d36d8efaecd5c84cb35e35119b283f37d83c40.zip cpython-f1d36d8efaecd5c84cb35e35119b283f37d83c40.tar.gz cpython-f1d36d8efaecd5c84cb35e35119b283f37d83c40.tar.bz2 |
bpo-33729: Fix issues with arguments parsing in hashlib. (GH-8346)
* help(hashlib) didn't work because of incorrect module name in blake2b and
blake2s classes.
* Constructors blake2*(), sha3_*(), shake_*() and keccak_*() incorrectly
accepted keyword argument "string" for binary data, but documented as
accepting the "data" keyword argument. Now this parameter is positional-only.
* Keyword-only parameters in blake2b() and blake2s() were not documented as
keyword-only.
* Default value for some parameters of blake2b() and blake2s() was None,
which is not acceptable value.
* The length argument for shake_*.digest() was wrapped out to 32 bits.
* The argument for shake_128.digest() and shake_128.hexdigest() was not
positional-only as intended.
* TypeError messages for incorrect arguments in all constructors sha3_*(),
shake_*() and keccak_*() incorrectly referred to sha3_224.
Also made the following enhancements:
* More accurately specified input and result types for strings, bytes and
bytes-like objects.
* Unified positional parameter names for update() and constructors.
* Improved formatting.
Diffstat (limited to 'Modules/_hashopenssl.c')
-rw-r--r-- | Modules/_hashopenssl.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c index b6dcc06..40cd632 100644 --- a/Modules/_hashopenssl.c +++ b/Modules/_hashopenssl.c @@ -729,6 +729,10 @@ pbkdf2_hmac(PyObject *self, PyObject *args, PyObject *kwdict) #if OPENSSL_VERSION_NUMBER > 0x10100000L && !defined(OPENSSL_NO_SCRYPT) && !defined(LIBRESSL_VERSION_NUMBER) #define PY_SCRYPT 1 +/* XXX: Parameters salt, n, r and p should be required keyword-only parameters. + They are optional in the Argument Clinic declaration only due to a + limitation of PyArg_ParseTupleAndKeywords. */ + /*[clinic input] _hashlib.scrypt @@ -858,13 +862,13 @@ _hashlib.hmac_digest msg: Py_buffer digest: str -Single-shot HMAC +Single-shot HMAC. [clinic start generated code]*/ static PyObject * _hashlib_hmac_digest_impl(PyObject *module, Py_buffer *key, Py_buffer *msg, const char *digest) -/*[clinic end generated code: output=75630e684cdd8762 input=10e964917921e2f2]*/ +/*[clinic end generated code: output=75630e684cdd8762 input=562d2f4249511bd3]*/ { unsigned char md[EVP_MAX_MD_SIZE] = {0}; unsigned int md_len = 0; |