1
0
Fork 0
mirror of https://github.com/BLAKE3-team/BLAKE3 synced 2024-05-04 23:26:15 +02:00
Commit Graph

603 Commits

Author SHA1 Message Date
Jack O'Connor 43ce77aaaf add Samuel Neves as a listed author of the Rust crate
Samuel wrote all of the assembly implementations, with the sole
exception of the SSE2 port.
2022-01-08 00:08:53 -05:00
Jack O'Connor 81c8640410 update clap to v3 2022-01-07 23:57:15 -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 c7b5881928 a few more comment tweaks 2021-12-30 13:34:13 -05:00
Matthias Schiffer 61d6621ba5 Update digest crate to 0.10 for traits-preview feature
Adjust to the following changes that happened in digest:

- The crypto-mac crate has been merged into digest (with "mac" feature
  enabled)
- Various traits have been split up
- The Digest and Mac traits now share their update/finalize/reset
  implementations
- The BlockInput trait was dropped without replacement apparently (as
  long as the low-level core API is not used)
2021-12-30 13:31:20 -05:00
Jack O'Connor 8dcba1514b check in the Cargo.lock for b3sum
We'll need to make sure to update this when we do a version bump. Adding
an explicit `!Cargo.lock` line to b3sum/.gitignore helps with this, by
making sure Cargo.lock shows up by defauls in searches like:

    rg "1\.2\.0"

Closes https://github.com/BLAKE3-team/BLAKE3/issues/210.
2021-12-18 15:27:57 -05:00
Jack O'Connor da4c792d80 add an assert and remove an iter_mut in reference_impl
Suggested in https://github.com/rust-lang/rust-clippy/issues/8039.
2021-11-30 14:05:08 -05:00
Jack O'Connor 315e44f875 fix a typo in the check doc 2021-11-13 09:24:15 -05:00
Jack O'Connor c61c663ec5 version 1.2.0
Changes since 1.1.0:
- SECURITY FIX: Fixed an instance of undefined behavior in the Windows
  SSE2 assembly implementations, which affected both the Rust and C
  libraries in their default build configurations. See
  https://github.com/BLAKE3-team/BLAKE3/issues/206. The cause was a
  vector register that wasn't properly saved and restored. This bug has
  been present since SSE2 support was initially added in v0.3.7. The
  effects of this bug depend on surrounding code and compiler
  optimizations; see test_issue_206_windows_sse2 for an example of this
  bug causing incorrect hash output. Note that even when surrounding
  code is arranged to trigger this bug, the SSE2 implementation is
  normally only invoked on CPUs where SSE4.1 (introduced in 2007) isn't
  supported. One notable exception, however, is if the Rust library is
  built in `no_std` mode, with `default_features = false` or similar. In
  that case, runtime CPU feature detection is disabled, and since LLVM
  assumes that all x86-64 targets support SSE2, the SSE2 implementation
  will be invoked. For that reason, Rust callers who build `blake3` in
  `no_std` mode for x86-64 Windows targets are the most likely to
  trigger this bug. We found this bug in internal testing, and we aren't
  aware of any callers encountering it in practice.
- Added the Hasher::count() method.
2021-11-05 14:38:36 -04:00
Jack O'Connor 371b5483c9 fix incorrect output / undefined behavior in Windows SSE2 assembly
The SSE2 patch introduced xmm10 as a temporary register for one of the
rotations, but xmm6-xmm15 are callee-save registers on Windows, and
SSE4.1 was only saving the registers it used. The minimal fix is to use
one of the saved registers instead of xmm10.

See https://github.com/BLAKE3-team/BLAKE3/issues/206.
2021-11-05 12:25:44 -04:00
Jack O'Connor 04571021fb add Hasher::count 2021-11-04 20:37:05 -04:00
Jack O'Connor 1042917e16 make field ordering more consistent in the reference impl 2021-10-29 14:44:42 -04:00
Jack O'Connor 600f0b51fe distinguish between key and key_words in the reference impl 2021-10-29 14:04:22 -04:00
Jack O'Connor f35d031578 remove an incorrect comment 2021-10-29 12:07:28 -04:00
Jack O'Connor 1f2010d79e update NEON docs in lib.rs 2021-10-23 13:09:52 -04:00
Jack O'Connor 197ad57261 add aarch64-apple-darwin builds to GitHub CI
I'm not sure how to build for Apple Silicon from a Linux host, but it
seems to work as-is from an x86_64 macOS host. Alas, GitHub doesn't yet
provide Apple Silicon hosts to run these binaries, and Cross doesn't yet
support virtualizing them either.
2021-10-21 18:58:32 -04:00
Jack O'Connor 4d6dfc4eed version 1.1.0
Changes since 1.0.0:
- The NEON implementation is now enabled by default on AArch64 targets.
  Previously it was disabled without the "neon" Cargo feature in Rust or
  the "BLAKE3_USE_NEON=1" preprocessor flag in C. This is still the case
  on ARM targets other than AArch64, because of the lack of dynamic CPU
  feature detection on ARM. Contributed by @rsdy.
- The previous change leads to some build incompatibilities,
  particularly in C. If you build the C implementation for AArch64
  targets, you now need to include blake3_neon.c, or else you'll get a
  linker error like "undefined reference to `blake3_hash_many_neon'". If
  you don't want the NEON implementation, you need to explicitly set
  "BLAKE3_USE_NEON=0". On the Rust side, AArch64 targets now require the
  C toolchain by default. build.rs includes workarounds for missing or
  very old C compilers for x86, but it doesn't currently include such
  workarounds for AArch64. If we hear about build breaks related to
  this, we can add more workarounds as appropriate.
- C-specific Git tags ("c-0.3.7" etc.) have been removed, and all the
  projects in this repo (Rust "blake3", Rust "b3sum", and the C
  implementation) will continue to be versioned in lockstep for the
  foreseeable future.
2021-10-21 17:23:51 -04:00
Jack O'Connor ea37dbd4b0 a small capitalization change 2021-10-21 17:23:51 -04:00
Jack O'Connor 3c107b7dd2 fix a comment typo 2021-10-21 16:36:32 -04:00
Jack O'Connor 5957d7d48f
Merge pull request #201 from symmetree-labs/master
Improve compile-time target detection for NEON
2021-10-14 21:48:02 -04:00
rsdy 2aa7c963be Use BLAKE3_USE_NEON=0 instead of BLAKE3_NO_NEON def 2021-10-12 23:23:25 +01:00
rsdy f4d5c6e785 Disable no_neon feature for C bindings as we can't propagate from cargo build 2021-10-12 16:54:12 +01:00
rsdy ed09e45e7a Include MSVC naming of aarch64 arch 2021-10-12 16:23:28 +01:00
rsdy 6b9cbe5e23 Match the C binding's target arch detection with the root crate's 2021-10-11 20:45:01 +01:00
rsdy c5941a2731 Make the C implementation default to using NEON on aarch64 2021-10-08 12:45:04 +01:00
rsdy faddc5af5c Add no_neon feature tests to CI 2021-10-08 11:51:18 +01:00
rsdy 20fd56ac0f Add `no_neon` feature to disable NEON on aarch64 2021-10-08 11:34:35 +01:00
rsdy 0a0bb7126e Implement better target detection for NEON 2021-10-07 12:41:53 +01:00
JP Aumasson db436a50c2
linkfix 2021-09-17 10:40:59 +02:00
Jack O'Connor 7d8f7101f1 replace an assert!(... != ...) with an assert_ne! 2021-09-10 13:16:53 -04:00
Jack O'Connor c4582c9779 clarify that OutputReader::position is equivalent to Seek::stream_position 2021-09-10 12:59:13 -04:00
Jack O'Connor 3baa54476a link to the paper in the derive_key docs 2021-09-10 12:48:58 -04:00
David Burkett 038be4571a check length arg (out_len_ll) instead of default value (out_len) 2021-09-01 13:41:24 -04:00
Jack O'Connor 080b333015 explicitly #error on big-endian ARM 2021-08-24 15:00:15 -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 32758e34a4 handle IO errors in example.c 2021-08-24 12:15:46 -04:00
Jack O'Connor 4032a51a32 update the version number in the b3sum readme 2021-07-27 16:37:57 -04:00
Jack O'Connor b404c851c2 version 1.0.0
Changes since 0.3.8:
- Add Hash::from_hex() and implement FromStr for Hash.
- Implement Display for Hash, equivalent to Hash::to_hex().
- Implement PartialEq<[u8]> for Hash, using constant_time_eq.
- Change derive_key() to return a 32-byte array. As with hash() and
  keyed_hash(), callers who want a non-default output length can use
  Hasher::finalize_xof().
- Replace Hasher::update_with_join() with Hasher::update_rayon(). The
  former was excessively generic, and the Join trait leaked
  implementation details. As part of this change, the Join trait is no
  longer public.
- Upgraded arrayvec to 0.7.0, which uses const generics. This bumps the
  minimum supported Rust compiler version to 1.51.
- Gate the digest and crypto-mac trait implementations behind an
  unstable feature, "traits-preview". As part of this change upgrade
  crypto-mac to 0.11.0.
2021-07-25 12:42:09 -04:00
Jack O'Connor 5aef6849bb update README examples 2021-07-25 12:42:09 -04:00
Jack O'Connor 037de38bfe upgrade to arrayvec 0.7.0
This version uses const generics, which bumps our minimum supported
compiler version to 1.51.
2021-05-18 12:28:29 -04:00
Jack O'Connor aa52ce3a4b upgrade crypto-mac to 0.11.0 2021-05-18 12:28:09 -04:00
Jack O'Connor 7cd208afcf explicitly document the properties of short outputs
Suggested by @joshtriplett at:
https://github.com/BLAKE3-team/BLAKE3/issues/168#issuecomment-829609667
2021-05-18 11:02:05 -04:00
Jack O'Connor 4b7babbe99 more cleaup of undocumented API 2021-03-28 20:04:51 -04:00
Jack O'Connor dab97de401 update doc comments on guts module 2021-03-28 15:21:02 -04:00
P.M f7088f24f8
comment cleanup in build.rs (#164) 2021-03-22 11:33:54 -04:00
Jack O'Connor 9ef2f4d9a8 implement Display for Hash 2021-03-21 21:14:44 -04:00
Jack O'Connor 05292a018b get rid of the standalone "*_rayon" functions
These clutter the toplevel API, and their prominence might lead callers
to prefer them as a first resort, which probably isn't a good idea.
Restricting multithreading to `Hasher::update_rayon` feels better,
similar to what we've done with `Hasher::finalize_xof`. (But I think
`update_rayon` is still an improvement over the trait-based interface
that it replaced.)
2021-03-21 21:14:13 -04:00
Jack O'Connor 07b746b1b4 gate digest and crypto-mac implementations behind "traits-preview"
This approach was suggested by @tarcieri at
https://github.com/BLAKE3-team/BLAKE3/pull/157.
2021-03-21 15:53:26 -04:00
Paul Grandperrin 421745b033 Cargo.toml: update crypto-mac to 0.10.0 2021-03-21 15:50:30 -04:00
Jack O'Connor 7155e5bb71 Rayon-related doc fixes 2021-03-20 15:25:14 -04:00