mirror of https://github.com/openwrt/packages.git
34 lines
966 B
Diff
34 lines
966 B
Diff
From 02eb5c100c8462823ea19df6af637be97570ccdb Mon Sep 17 00:00:00 2001
|
|
From: Jeffery To <jeffery.to@gmail.com>
|
|
Date: Mon, 22 May 2023 23:26:19 +0800
|
|
Subject: [PATCH] Fix hashlib module not compiled for host Python
|
|
|
|
--- a/Modules/_hashopenssl.c
|
|
+++ b/Modules/_hashopenssl.c
|
|
@@ -44,7 +44,9 @@
|
|
|
|
#define MUNCH_SIZE INT_MAX
|
|
|
|
+#ifdef NID_id_scrypt
|
|
#define PY_OPENSSL_HAS_SCRYPT 1
|
|
+#endif
|
|
#if defined(NID_sha3_224) && defined(NID_sha3_256) && defined(NID_sha3_384) && defined(NID_sha3_512)
|
|
#define PY_OPENSSL_HAS_SHA3 1
|
|
#endif
|
|
@@ -981,11 +983,15 @@ _hashlib_HASH(PyObject *module, const ch
|
|
goto exit;
|
|
}
|
|
|
|
+#ifndef EVP_MD_FLAG_XOF
|
|
+ type = get_hashlib_state(module)->EVPtype;
|
|
+#else
|
|
if ((EVP_MD_flags(digest) & EVP_MD_FLAG_XOF) == EVP_MD_FLAG_XOF) {
|
|
type = get_hashlib_state(module)->EVPXOFtype;
|
|
} else {
|
|
type = get_hashlib_state(module)->EVPtype;
|
|
}
|
|
+#endif
|
|
|
|
self = newEVPobject(type);
|
|
if (self == NULL) {
|