summaryrefslogtreecommitdiffstats
path: root/Modules/clinic
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-09-12 13:03:50 (GMT)
committerStéphane Wirtel <stephane@wirtel.be>2019-09-12 13:03:50 (GMT)
commit67b90a079c39066aa9d51690fe5678c36ccbc258 (patch)
tree1773f0f00663e811be925e03c03f1b80388da93b /Modules/clinic
parent345bfc990f5f3e873774051d43136b06bfed82cb (diff)
downloadcpython-67b90a079c39066aa9d51690fe5678c36ccbc258.zip
cpython-67b90a079c39066aa9d51690fe5678c36ccbc258.tar.gz
cpython-67b90a079c39066aa9d51690fe5678c36ccbc258.tar.bz2
bpo-38132: Simplify _hashopenssl code (GH-16023) (#16040)
Signed-off-by: Christian Heimes <christian@python.org> (cherry picked from commit 5a4f82f457049b5b07b6fba4ca42bc1ecf597976) Co-authored-by: Christian Heimes <christian@python.org>
Diffstat (limited to 'Modules/clinic')
-rw-r--r--Modules/clinic/_hashopenssl.c.h224
1 files changed, 223 insertions, 1 deletions
diff --git a/Modules/clinic/_hashopenssl.c.h b/Modules/clinic/_hashopenssl.c.h
index 854d925..9aaea47 100644
--- a/Modules/clinic/_hashopenssl.c.h
+++ b/Modules/clinic/_hashopenssl.c.h
@@ -109,6 +109,228 @@ exit:
return return_value;
}
+PyDoc_STRVAR(_hashlib_openssl_md5__doc__,
+"openssl_md5($module, /, string=b\'\')\n"
+"--\n"
+"\n"
+"Returns a md5 hash object; optionally initialized with a string");
+
+#define _HASHLIB_OPENSSL_MD5_METHODDEF \
+ {"openssl_md5", (PyCFunction)(void(*)(void))_hashlib_openssl_md5, METH_FASTCALL|METH_KEYWORDS, _hashlib_openssl_md5__doc__},
+
+static PyObject *
+_hashlib_openssl_md5_impl(PyObject *module, PyObject *data_obj);
+
+static PyObject *
+_hashlib_openssl_md5(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+ PyObject *return_value = NULL;
+ static const char * const _keywords[] = {"string", NULL};
+ static _PyArg_Parser _parser = {NULL, _keywords, "openssl_md5", 0};
+ PyObject *argsbuf[1];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
+ PyObject *data_obj = NULL;
+
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ data_obj = args[0];
+skip_optional_pos:
+ return_value = _hashlib_openssl_md5_impl(module, data_obj);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_hashlib_openssl_sha1__doc__,
+"openssl_sha1($module, /, string=b\'\')\n"
+"--\n"
+"\n"
+"Returns a sha1 hash object; optionally initialized with a string");
+
+#define _HASHLIB_OPENSSL_SHA1_METHODDEF \
+ {"openssl_sha1", (PyCFunction)(void(*)(void))_hashlib_openssl_sha1, METH_FASTCALL|METH_KEYWORDS, _hashlib_openssl_sha1__doc__},
+
+static PyObject *
+_hashlib_openssl_sha1_impl(PyObject *module, PyObject *data_obj);
+
+static PyObject *
+_hashlib_openssl_sha1(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+ PyObject *return_value = NULL;
+ static const char * const _keywords[] = {"string", NULL};
+ static _PyArg_Parser _parser = {NULL, _keywords, "openssl_sha1", 0};
+ PyObject *argsbuf[1];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
+ PyObject *data_obj = NULL;
+
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ data_obj = args[0];
+skip_optional_pos:
+ return_value = _hashlib_openssl_sha1_impl(module, data_obj);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_hashlib_openssl_sha224__doc__,
+"openssl_sha224($module, /, string=b\'\')\n"
+"--\n"
+"\n"
+"Returns a sha224 hash object; optionally initialized with a string");
+
+#define _HASHLIB_OPENSSL_SHA224_METHODDEF \
+ {"openssl_sha224", (PyCFunction)(void(*)(void))_hashlib_openssl_sha224, METH_FASTCALL|METH_KEYWORDS, _hashlib_openssl_sha224__doc__},
+
+static PyObject *
+_hashlib_openssl_sha224_impl(PyObject *module, PyObject *data_obj);
+
+static PyObject *
+_hashlib_openssl_sha224(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+ PyObject *return_value = NULL;
+ static const char * const _keywords[] = {"string", NULL};
+ static _PyArg_Parser _parser = {NULL, _keywords, "openssl_sha224", 0};
+ PyObject *argsbuf[1];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
+ PyObject *data_obj = NULL;
+
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ data_obj = args[0];
+skip_optional_pos:
+ return_value = _hashlib_openssl_sha224_impl(module, data_obj);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_hashlib_openssl_sha256__doc__,
+"openssl_sha256($module, /, string=b\'\')\n"
+"--\n"
+"\n"
+"Returns a sha256 hash object; optionally initialized with a string");
+
+#define _HASHLIB_OPENSSL_SHA256_METHODDEF \
+ {"openssl_sha256", (PyCFunction)(void(*)(void))_hashlib_openssl_sha256, METH_FASTCALL|METH_KEYWORDS, _hashlib_openssl_sha256__doc__},
+
+static PyObject *
+_hashlib_openssl_sha256_impl(PyObject *module, PyObject *data_obj);
+
+static PyObject *
+_hashlib_openssl_sha256(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+ PyObject *return_value = NULL;
+ static const char * const _keywords[] = {"string", NULL};
+ static _PyArg_Parser _parser = {NULL, _keywords, "openssl_sha256", 0};
+ PyObject *argsbuf[1];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
+ PyObject *data_obj = NULL;
+
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ data_obj = args[0];
+skip_optional_pos:
+ return_value = _hashlib_openssl_sha256_impl(module, data_obj);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_hashlib_openssl_sha384__doc__,
+"openssl_sha384($module, /, string=b\'\')\n"
+"--\n"
+"\n"
+"Returns a sha384 hash object; optionally initialized with a string");
+
+#define _HASHLIB_OPENSSL_SHA384_METHODDEF \
+ {"openssl_sha384", (PyCFunction)(void(*)(void))_hashlib_openssl_sha384, METH_FASTCALL|METH_KEYWORDS, _hashlib_openssl_sha384__doc__},
+
+static PyObject *
+_hashlib_openssl_sha384_impl(PyObject *module, PyObject *data_obj);
+
+static PyObject *
+_hashlib_openssl_sha384(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+ PyObject *return_value = NULL;
+ static const char * const _keywords[] = {"string", NULL};
+ static _PyArg_Parser _parser = {NULL, _keywords, "openssl_sha384", 0};
+ PyObject *argsbuf[1];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
+ PyObject *data_obj = NULL;
+
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ data_obj = args[0];
+skip_optional_pos:
+ return_value = _hashlib_openssl_sha384_impl(module, data_obj);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_hashlib_openssl_sha512__doc__,
+"openssl_sha512($module, /, string=b\'\')\n"
+"--\n"
+"\n"
+"Returns a sha512 hash object; optionally initialized with a string");
+
+#define _HASHLIB_OPENSSL_SHA512_METHODDEF \
+ {"openssl_sha512", (PyCFunction)(void(*)(void))_hashlib_openssl_sha512, METH_FASTCALL|METH_KEYWORDS, _hashlib_openssl_sha512__doc__},
+
+static PyObject *
+_hashlib_openssl_sha512_impl(PyObject *module, PyObject *data_obj);
+
+static PyObject *
+_hashlib_openssl_sha512(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+ PyObject *return_value = NULL;
+ static const char * const _keywords[] = {"string", NULL};
+ static _PyArg_Parser _parser = {NULL, _keywords, "openssl_sha512", 0};
+ PyObject *argsbuf[1];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
+ PyObject *data_obj = NULL;
+
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ data_obj = args[0];
+skip_optional_pos:
+ return_value = _hashlib_openssl_sha512_impl(module, data_obj);
+
+exit:
+ return return_value;
+}
+
PyDoc_STRVAR(pbkdf2_hmac__doc__,
"pbkdf2_hmac($module, /, hash_name, password, salt, iterations,\n"
" dklen=None)\n"
@@ -401,4 +623,4 @@ exit:
#ifndef _HASHLIB_SCRYPT_METHODDEF
#define _HASHLIB_SCRYPT_METHODDEF
#endif /* !defined(_HASHLIB_SCRYPT_METHODDEF) */
-/*[clinic end generated code: output=cfe686cb2fa042e1 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=38c2637f67e9bb79 input=a9049054013a1b77]*/