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

157 Commits

Author SHA1 Message Date
Jack O'Connor 5b9af1c347 test_miri_smoketest 2024-03-10 09:54:03 -07:00
Jack O'Connor d57818afdc avoid using NamedTempFile under Miri 2024-03-09 16:57:14 -08:00
Jack O'Connor 2435e29dbe avoid using constant_time_eq under Miri 2024-03-09 16:57:14 -08:00
Ryo Onodera e6e7f27336 Support running inside miri 2024-03-09 16:56:59 -08:00
Jack O'Connor 3d921ae703 allow(unreachable_code) in all the *_detected functions
Previously we only disabled these warnings for SSE2, which is assumed
enabled on x86-64, but it looks like new nightly compilers are also
assuming SSE4.1 on macOS. Disabling these warnings across all the
detection functions accounts for that, and it also gets rid of some
warnings that you'd see if you used RUSTFLAGS='-C target-cpu=native'.
2023-10-02 08:36:29 -07:00
Jack O'Connor d7e9365be1 add a test for the new serde feature 2023-09-19 23:43:47 -07:00
Ralph Minderhoud 5e3eb949a7 Add serde support for Hash behind optional feature
Added a new cargo feature `serde` that when enabled will derive
`serde::Serialize` and `serde::Deserialize` for the `blake3::Hash`
struct.
2023-09-19 21:54:44 -04:00
Jack O'Connor 8cdfaa41ea minor cleanup in Hasher docs 2023-09-19 12:47:27 -07:00
Jack O'Connor b754033a21 make update_reader/mmap/mmap_rayon return self
This makes them consistent with how the existing update() and
update_rayon() methods work, with the difference being that it's it's
io::Result<&mut Self> instead of just &mut Self.
2023-09-16 19:22:36 -07:00
Jack O'Connor cb32f0bd14 replace the new file module with inherent methods on Hasher
New methods:
- update_reader
- update_mmap
- update_mmap_rayon

These are more discoverable, more convenient, and safer.

There are two problems I want to avoid by taking a `Path` instead of a
`File`. First, exposing `Mmap` objects to the caller is fundamentally
unsafe, and making `maybe_mmap_file` private avoids that issue. Second,
taking a `File` raises questions about whether memory mapped reads
should behave like regular file reads. (Should they respect the current
seek position? Should they update the seek position?) Taking a `Path`
from the caller and opening the `File` internally avoids these
questions.
2023-09-16 17:04:27 -07:00
Banyc e0bb915641 move file operations from b3sum to blake3 2023-09-16 14:20:39 -07:00
Jack O'Connor 12b368541f document the `zeroize` Cargo feature
As part of this change, I don't think we need the `zeroize_crate`
workaround anymore if we use the relateively new `dep:` syntax in
Cargo.toml.
2023-09-16 14:11:27 -07:00
Elichai Turkel f18e19092b Add tests for Zeroize 2023-07-16 13:29:47 -04:00
Elichai Turkel 8e92fc6929 Implement Zeroize on exported types 2023-07-16 13:29:47 -04:00
1f604 e47e570691 Fix typo exendable -> extendable 2023-06-27 11:31:51 -04:00
Joel Rosdahl 2dd4e57f68 Fix typos 2023-05-23 14:39:27 -07:00
Jack O'Connor e6e32bc2b1 small doc tweak 2023-05-01 01:28:01 -07:00
Eduardo Leegwater Simões 8176a2202d add `from_bytes` for conversions from `[u8; 32]`
The function is `const`, so it is fundamentally different from the
`From` trait implementation by allowing compile-time instantiation of a
`Hash`.
2023-05-01 03:23:16 -05:00
Eduardo Leegwater Simões ce48d79f38 make `Hash::as_bytes` const 2023-05-01 03:23:16 -05:00
Jack O'Connor 5dad698d3f test multiple initial counter values for hash_many
I'm adding the i32::MAX test case here because I personally screwed it
up while I was working on
https://github.com/BLAKE3-team/BLAKE3/issues/271. The correct
implementation of the carry bit is the ANDNOT of old high bit (1) and
the new high bit (0). Using XOR instead of ANDNOT gives the correct
answer in the overflow case, but it also reports an incorrect "extra"
overflow when the high bit goes from 0 to 1.
2022-11-22 23:31:29 -08:00
Ricardo Fernández Serrata 0fb6410c90 Fix doc typo 2022-07-28 14:14:39 -07:00
Jack O'Connor 46cf7b7315 simplify a line in the docs example code
The same change was previously made in README.md.
2022-06-07 21:52:51 -07:00
Jack O'Connor 48c4621edc add "(if any)" regarding keying in the security notes 2022-03-04 10:19:14 -05:00
Jack O'Connor d295410aad simplify a bit more 2022-03-03 11:52:58 -05:00
Jack O'Connor b3c06e46ed simplify the security notes, avoid referring to entropy 2022-03-02 19:05:15 -05: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 540f708a94 check the HMAC output bytes 2022-01-24 20:52:22 -05:00
jbis9051 509e97ed90 Adds test 2022-01-24 19:29:33 -05:00
jbis9051 e069e46116 Add blocksize trait 2022-01-23 15:46:04 -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 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 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
rsdy 0a0bb7126e Implement better target detection for NEON 2021-10-07 12:41:53 +01: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
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 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
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
Jack O'Connor 7155e5bb71 Rayon-related doc fixes 2021-03-20 15:25:14 -04:00
Jack O'Connor b228f46e03 add *_rayon methods 2021-03-14 00:26:18 -05:00
Jack O'Connor ea72822620 re-privatize the Join trait 2021-03-14 00:08:21 -05:00
Jack O'Connor 71d67e0810 make derive_key() return an array 2021-02-28 18:10:59 -05:00