diff options
author | arcadia-devtools <arcadia-devtools@yandex-team.ru> | 2022-06-09 19:02:01 +0300 |
---|---|---|
committer | arcadia-devtools <arcadia-devtools@yandex-team.ru> | 2022-06-09 19:02:01 +0300 |
commit | 4a29d649866ff133e0b8f8a1009e1000a44d7279 (patch) | |
tree | 547229aded91b3760628c646a144af604f1c3e2b /contrib/tools/python3/src/Modules/_hashopenssl.c | |
parent | 782f2445a283aed9a66e699137b3349af1689c29 (diff) | |
download | ydb-4a29d649866ff133e0b8f8a1009e1000a44d7279.tar.gz |
intermediate changes
ref:478170c7a5a1c0788ddd0d6513ce4ed86d7d7c99
Diffstat (limited to 'contrib/tools/python3/src/Modules/_hashopenssl.c')
-rw-r--r-- | contrib/tools/python3/src/Modules/_hashopenssl.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/contrib/tools/python3/src/Modules/_hashopenssl.c b/contrib/tools/python3/src/Modules/_hashopenssl.c index 65538f63f7..75063fa153 100644 --- a/contrib/tools/python3/src/Modules/_hashopenssl.c +++ b/contrib/tools/python3/src/Modules/_hashopenssl.c @@ -1836,15 +1836,21 @@ typedef struct _internal_name_mapper_state { /* A callback function to pass to OpenSSL's OBJ_NAME_do_all(...) */ static void +#if OPENSSL_VERSION_NUMBER >= 0x30000000L +_openssl_hash_name_mapper(EVP_MD *md, void *arg) +#else _openssl_hash_name_mapper(const EVP_MD *md, const char *from, const char *to, void *arg) +#endif { _InternalNameMapperState *state = (_InternalNameMapperState *)arg; PyObject *py_name; assert(state != NULL); - if (md == NULL) + // ignore all undefined providers + if ((md == NULL) || (EVP_MD_nid(md) == NID_undef)) { return; + } py_name = py_digest_name(md); if (py_name == NULL) { @@ -1870,7 +1876,12 @@ hashlib_md_meth_names(PyObject *module) return -1; } +#if OPENSSL_VERSION_NUMBER >= 0x30000000L + // get algorithms from all activated providers in default context + EVP_MD_do_all_provided(NULL, &_openssl_hash_name_mapper, &state); +#else EVP_MD_do_all(&_openssl_hash_name_mapper, &state); +#endif if (state.error) { Py_DECREF(state.set); |