summaryrefslogtreecommitdiff
path: root/Modules/_blake2/blake2b_impl.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2022-03-26 21:52:24 +0200
committerGitHub <noreply@github.com>2022-03-26 20:52:24 +0100
commitb16b6bb8dacc41e9e569783890b0c88fcd3b24e8 (patch)
tree5e3c08a7bd917d3f45ddc4a8e195023e3d482731 /Modules/_blake2/blake2b_impl.c
parentc23ddf5ec229b7302437a1cf32d366df5cc5b837 (diff)
downloadcpython-git-b16b6bb8dacc41e9e569783890b0c88fcd3b24e8.tar.gz
bpo-47095: Use libb2 to provide blake2 implementation (GH-32059)
Diffstat (limited to 'Modules/_blake2/blake2b_impl.c')
-rw-r--r--Modules/_blake2/blake2b_impl.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/Modules/_blake2/blake2b_impl.c b/Modules/_blake2/blake2b_impl.c
index e1421dd8ff..c2cac98c75 100644
--- a/Modules/_blake2/blake2b_impl.c
+++ b/Modules/_blake2/blake2b_impl.c
@@ -21,14 +21,9 @@
#include "pycore_strhex.h" // _Py_strhex()
#include "../hashlib.h"
-#include "blake2ns.h"
-
-#define HAVE_BLAKE2B 1
-#define BLAKE2_LOCAL_INLINE(type) Py_LOCAL_INLINE(type)
-
-#include "impl/blake2.h"
-#include "impl/blake2-impl.h" /* for secure_zero_memory() and store48() */
+#include "blake2module.h"
+#ifndef HAVE_LIBB2
/* pure SSE2 implementation is very slow, so only use the more optimized SSSE3+
* https://bugs.python.org/issue31834 */
#if defined(__SSSE3__) || defined(__SSE4_1__) || defined(__AVX__) || defined(__XOP__)
@@ -36,10 +31,13 @@
#else
#include "impl/blake2b-ref.c"
#endif
+#endif // !HAVE_LIBB2
+#define HAVE_BLAKE2B 1
extern PyType_Spec blake2b_type_spec;
+
typedef struct {
PyObject_HEAD
blake2b_param param;