1
0
Fork 0
mirror of https://github.com/BLAKE3-team/BLAKE3 synced 2024-05-05 16:06:28 +02:00
Commit Graph

25 Commits

Author SHA1 Message Date
Jack O'Connor 8fc36186b8 comment cleanup 2024-02-04 13:32:30 -08:00
divinity76 2918c51bc6 silenc gcc Werror=logical-op
```
/home/travis/build/php/php-src/ext/hash/blake3/upstream_blake3/c/blake3.c: In function ‘compress_subtree_to_parent_node’:
/home/travis/build/php/php-src/ext/hash/blake3/upstream_blake3/c/blake3.c:354:22: error: logical ‘and’ of mutually exclusive tests is always false [-Werror=logical-op]
  354 |   while (num_cvs > 2 && num_cvs <= MAX_SIMD_DEGREE_OR_2) {
      |                      ^~
cc1: all warnings being treated as errors
make: *** [Makefile:1910: ext/hash/blake3/upstream_blake3/c/blake3.lo] Error 1
```

Fixes https://github.com/BLAKE3-team/BLAKE3/issues/379.
Closes https://github.com/BLAKE3-team/BLAKE3/pull/380.
2024-02-04 13:31:55 -08:00
1f604 e47e570691 Fix typo exendable -> extendable 2023-06-27 11:31:51 -04:00
Jack O'Connor e733e5ac98 fix another instance of the same typo 2022-07-28 14:15:13 -07:00
Jack O'Connor ea3bc782d8 document the extended output security issue found by Aldo Gunsing
https://eprint.iacr.org/2022/283
2022-03-02 17:39:25 -05:00
Jack O'Connor 7d8c005071 add blake3_hasher_reset to the C API 2022-01-07 15:51:35 -05:00
Jack O'Connor 3c107b7dd2 fix a comment typo 2021-10-21 16:36:32 -04:00
Jack O'Connor b8e2dda186 add a redundant loop condition to silence GCC warnings
See:
https://github.com/BLAKE3-team/BLAKE3/issues/94
https://github.com/BLAKE3-team/BLAKE3/issues/183
https://github.com/BLAKE3-team/BLAKE3/issues/189
2021-08-24 14:05:42 -04:00
Jack O'Connor 8969cdd2f8 clang-format a few files
Some of the SIMD code is still unformatted, so for now I'm only touching
the files that just have a couple small changes.
2021-02-15 14:24:37 -05:00
Hans Henrik Bergan a2f9515785 add blake3_version(void) / BLAKE3_VERSION_STRING
related discussion here: https://github.com/BLAKE3-team/BLAKE3/issues/130
2020-10-29 23:18:34 +01:00
Jack O'Connor 0b13637ae3 fix a couple of big-endianness mistakes in blake3.c
Kudos to @pascal-cuoq and @jakub-zwolakowski from TrustInSoft for
catching these bugs.

Original report: https://github.com/BLAKE3-team/BLAKE3/pull/118
2020-09-29 16:09:28 -04:00
Renzo Carbonara b205e0efa1 C: rename blake3_hasher_init_derive_key_raw and documentation 2020-09-01 13:20:16 +03:00
Renzo Carbonara 31e4080aa2 C: Add blake3_hasher_init_derive_key_len
blake3_hasher_init_derive_key_len is an alternative version of
blake3_hasher_init_derive_key which takes the context and its
length as separate parameters, and not together as a C string.

The motivation for this addition is making it easier for
bindings to this C library to call this function without
having to first copy over the context bytes just to add
one 0x00 byte at the end.

Notice that contrary to blake3_hasher_init_derive_key,
blake3_hasher_init_derive_key_len allows the inclusion of a
0x00 byte in the context. Given the rules about context string
selection, this byte is unlikely to be used as part of a context
string. But if for some reason it is ever given, it will be
included in the context string and processed like any other
non-alphanumeric byte would. For compatibility with
blake3_hasher_init_derive_key, bindings should still check for
the absence of 0x00 bytes.
2020-08-30 12:27:33 +03:00
Jack O'Connor c908847c3f shrink a stack array that's twice as big as it needs to be
It looks like I originally made this mistake when I was copying code
from the baokeshed prototype (a274a9b0fa),
and then it got replicated into the C implementation later.
2020-06-26 16:16:55 -04:00
Samuel Neves eec458d03e move prototypes to shared header file, and make all local functions static. 2020-03-31 21:21:08 +01:00
Jack O'Connor a4ceef3932 add blake3_hasher_finalize_seek to the C API 2020-03-25 17:11:36 -04:00
Jack O'Connor 9d77bd6958 correct a comment 2020-03-17 14:26:39 -04:00
Jack O'Connor 0432f9c7a3 some comment typos 2020-02-27 09:52:46 -05:00
Jack O'Connor 8d84cfc0af remove a mis-optimization that hurt performance for uneven updates
If the total number of chunks hashed so far is e.g. 1, and update() is
called with e.g. 8 more chunks, we can't compress all 8 together. We
have to break the input up, to make sure that that 1 lone chunk CV gets
merged with its proper sibling, and that in general the correct layout
of the tree is preserved. What we should do is hash 1-2-4-1 chunks of
input, using increasing powers of 2 (with some cleanup at the end). What
we were doing was 2-2-2-2 chunks. This was the result of a mistaken
optimization that got us stuck with an always-odd number of chunks so
far.

Fixes https://github.com/BLAKE3-team/BLAKE3/issues/69.
2020-02-25 11:40:37 -05:00
Samuel Neves 37ea737c16 more robust bit-trickery functions 2020-01-23 10:58:45 +00:00
Jack O'Connor 163f52245d port compress_subtree_to_parent_node from Rust to C
This recursive function performs parallel parent node hashing, which is
an important optimization.
2020-01-22 21:32:39 -05:00
Jack O'Connor 087d72e08f clang-format 2020-01-22 21:32:35 -05:00
Jack O'Connor d7d71b2c5f move 0-length checks to the top-level C API functions 2020-01-10 10:49:33 -05:00
Guido Vranken 253e830c26 C impl: Prevent memcpy undefined behavior 2020-01-10 10:41:35 -05:00
Jack O'Connor a7579d30ad merge BLAKE3-c into this repo
This is commit 4476d9da0e370993823e7ad17592b84e905afd76 of
https://github.com/veorq/BLAKE3-c.
2020-01-09 09:48:52 -05:00