bpo-47095: Use libb2 to provide blake2 implementation (GH-32059)

This commit is contained in:
Christian Heimes 2022-03-26 21:52:24 +02:00 committed by GitHub
parent c23ddf5ec2
commit b16b6bb8da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 149 additions and 17791 deletions

View file

@ -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;