From: Joel Rosdahl Date: Fri, 9 Jun 2023 14:21:47 +0000 (+0200) Subject: bump: Upgrade to BLAKE3 1.4.0 X-Git-Tag: v4.8.2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=90d902b311f31889b5aeb1bb032936e2175dcdf0;p=thirdparty%2Fccache.git bump: Upgrade to BLAKE3 1.4.0 --- diff --git a/LICENSE.adoc b/LICENSE.adoc index af8eee67d..778e4c5ed 100644 --- a/LICENSE.adoc +++ b/LICENSE.adoc @@ -72,9 +72,8 @@ along with this program. If not, see . === src/third_party/blake3/blake3_* -This is a subset of https://github.com/BLAKE3-team/BLAKE3[BLAKE3] (git SHA: -https://github.com/BLAKE3-team/BLAKE3/commit/71a2646180c787e22f8681c5fec7655a0ad51e99[71a2646]) -with the following license: +This is a subset of https://github.com/BLAKE3-team/BLAKE3[BLAKE3] 1.4.0 with the +following license: ---- This work is released into the public domain with CC0 1.0. Alternatively, it is diff --git a/src/third_party/blake3/blake3.h b/src/third_party/blake3/blake3.h index b280db388..aa4bfa6f3 100644 --- a/src/third_party/blake3/blake3.h +++ b/src/third_party/blake3/blake3.h @@ -4,11 +4,33 @@ #include #include +#if !defined(BLAKE3_API) +# if defined(_WIN32) || defined(__CYGWIN__) +# if defined(BLAKE3_DLL) +# if defined(BLAKE3_DLL_EXPORTS) +# define BLAKE3_API __declspec(dllexport) +# else +# define BLAKE3_API __declspec(dllimport) +# endif +# define BLAKE3_PRIVATE +# else +# define BLAKE3_API +# define BLAKE3_PRIVATE +# endif +# elif __GNUC__ >= 4 +# define BLAKE3_API __attribute__((visibility("default"))) +# define BLAKE3_PRIVATE __attribute__((visibility("hidden"))) +# else +# define BLAKE3_API +# define BLAKE3_PRIVATE +# endif +#endif + #ifdef __cplusplus extern "C" { #endif -#define BLAKE3_VERSION_STRING "1.3.3" +#define BLAKE3_VERSION_STRING "1.4.0" #define BLAKE3_KEY_LEN 32 #define BLAKE3_OUT_LEN 32 #define BLAKE3_BLOCK_LEN 64 @@ -38,20 +60,20 @@ typedef struct { uint8_t cv_stack[(BLAKE3_MAX_DEPTH + 1) * BLAKE3_OUT_LEN]; } blake3_hasher; -const char *blake3_version(void); -void blake3_hasher_init(blake3_hasher *self); -void blake3_hasher_init_keyed(blake3_hasher *self, - const uint8_t key[BLAKE3_KEY_LEN]); -void blake3_hasher_init_derive_key(blake3_hasher *self, const char *context); -void blake3_hasher_init_derive_key_raw(blake3_hasher *self, const void *context, - size_t context_len); -void blake3_hasher_update(blake3_hasher *self, const void *input, - size_t input_len); -void blake3_hasher_finalize(const blake3_hasher *self, uint8_t *out, - size_t out_len); -void blake3_hasher_finalize_seek(const blake3_hasher *self, uint64_t seek, - uint8_t *out, size_t out_len); -void blake3_hasher_reset(blake3_hasher *self); +BLAKE3_API const char *blake3_version(void); +BLAKE3_API void blake3_hasher_init(blake3_hasher *self); +BLAKE3_API void blake3_hasher_init_keyed(blake3_hasher *self, + const uint8_t key[BLAKE3_KEY_LEN]); +BLAKE3_API void blake3_hasher_init_derive_key(blake3_hasher *self, const char *context); +BLAKE3_API void blake3_hasher_init_derive_key_raw(blake3_hasher *self, const void *context, + size_t context_len); +BLAKE3_API void blake3_hasher_update(blake3_hasher *self, const void *input, + size_t input_len); +BLAKE3_API void blake3_hasher_finalize(const blake3_hasher *self, uint8_t *out, + size_t out_len); +BLAKE3_API void blake3_hasher_finalize_seek(const blake3_hasher *self, uint64_t seek, + uint8_t *out, size_t out_len); +BLAKE3_API void blake3_hasher_reset(blake3_hasher *self); #ifdef __cplusplus } diff --git a/src/third_party/blake3/blake3_avx2.c b/src/third_party/blake3/blake3_avx2.c index e76aa1a3a..381e7c422 100644 --- a/src/third_party/blake3/blake3_avx2.c +++ b/src/third_party/blake3/blake3_avx2.c @@ -167,7 +167,7 @@ INLINE void transpose_vecs(__m256i vecs[DEGREE]) { __m256i gh_0145 = _mm256_unpacklo_epi32(vecs[6], vecs[7]); __m256i gh_2367 = _mm256_unpackhi_epi32(vecs[6], vecs[7]); - // Interleave 64-bit lates. The low unpack is lanes 00/22 and the high is + // Interleave 64-bit lanes. The low unpack is lanes 00/22 and the high is // 11/33. __m256i abcd_04 = _mm256_unpacklo_epi64(ab_0145, cd_0145); __m256i abcd_15 = _mm256_unpackhi_epi64(ab_0145, cd_0145); diff --git a/src/third_party/blake3/blake3_avx512.c b/src/third_party/blake3/blake3_avx512.c index 334d82dc7..d6b1ae9b1 100644 --- a/src/third_party/blake3/blake3_avx512.c +++ b/src/third_party/blake3/blake3_avx512.c @@ -429,7 +429,7 @@ INLINE void round_fn4(__m128i v[16], __m128i m[16], size_t r) { } INLINE void transpose_vecs_128(__m128i vecs[4]) { - // Interleave 32-bit lates. The low unpack is lanes 00/11 and the high is + // Interleave 32-bit lanes. The low unpack is lanes 00/11 and the high is // 22/33. Note that this doesn't split the vector into two lanes, as the // AVX2 counterparts do. __m128i ab_01 = _mm_unpacklo_epi32(vecs[0], vecs[1]); @@ -684,7 +684,7 @@ INLINE void transpose_vecs_256(__m256i vecs[8]) { __m256i gh_0145 = _mm256_unpacklo_epi32(vecs[6], vecs[7]); __m256i gh_2367 = _mm256_unpackhi_epi32(vecs[6], vecs[7]); - // Interleave 64-bit lates. The low unpack is lanes 00/22 and the high is + // Interleave 64-bit lanes. The low unpack is lanes 00/22 and the high is // 11/33. __m256i abcd_04 = _mm256_unpacklo_epi64(ab_0145, cd_0145); __m256i abcd_15 = _mm256_unpackhi_epi64(ab_0145, cd_0145); @@ -959,7 +959,7 @@ INLINE void transpose_vecs_512(__m512i vecs[16]) { __m512i op_0 = _mm512_unpacklo_epi32(vecs[14], vecs[15]); __m512i op_2 = _mm512_unpackhi_epi32(vecs[14], vecs[15]); - // Interleave 64-bit lates. The _0 unpack is lanes + // Interleave 64-bit lanes. The _0 unpack is lanes // 0/0/0/0/4/4/4/4/8/8/8/8/12/12/12/12, the _1 unpack is lanes // 1/1/1/1/5/5/5/5/9/9/9/9/13/13/13/13, the _2 unpack is lanes // 2/2/2/2/6/6/6/6/10/10/10/10/14/14/14/14, and the _3 unpack is lanes diff --git a/src/third_party/blake3/blake3_sse2.c b/src/third_party/blake3/blake3_sse2.c index f4449ac0b..691e1c680 100644 --- a/src/third_party/blake3/blake3_sse2.c +++ b/src/third_party/blake3/blake3_sse2.c @@ -396,7 +396,7 @@ INLINE void round_fn(__m128i v[16], __m128i m[16], size_t r) { } INLINE void transpose_vecs(__m128i vecs[DEGREE]) { - // Interleave 32-bit lates. The low unpack is lanes 00/11 and the high is + // Interleave 32-bit lanes. The low unpack is lanes 00/11 and the high is // 22/33. Note that this doesn't split the vector into two lanes, as the // AVX2 counterparts do. __m128i ab_01 = _mm_unpacklo_epi32(vecs[0], vecs[1]); diff --git a/src/third_party/blake3/blake3_sse41.c b/src/third_party/blake3/blake3_sse41.c index 87a8dae15..4653a856f 100644 --- a/src/third_party/blake3/blake3_sse41.c +++ b/src/third_party/blake3/blake3_sse41.c @@ -390,7 +390,7 @@ INLINE void round_fn(__m128i v[16], __m128i m[16], size_t r) { } INLINE void transpose_vecs(__m128i vecs[DEGREE]) { - // Interleave 32-bit lates. The low unpack is lanes 00/11 and the high is + // Interleave 32-bit lanes. The low unpack is lanes 00/11 and the high is // 22/33. Note that this doesn't split the vector into two lanes, as the // AVX2 counterparts do. __m128i ab_01 = _mm_unpacklo_epi32(vecs[0], vecs[1]);