Skip to content

Commit

Permalink
[WIP] blake2: integrate blake2b_simd/blake2s_simd crates
Browse files Browse the repository at this point in the history
Integrates original sources from these crates, which provide
AVX2-accelerated SIMD backends:

https://github.com/oconnor663/blake2_simd

Taken from this commit:

Hash:   7bf791e67245bb84132d1ee0e6a893bb8c85c093
Author: Jack O'Connor <[email protected]>
Date:   Fri Nov 13 15:50:16 2020 -0500
Title:  AES-CTR benchmarks
  • Loading branch information
tarcieri committed Feb 4, 2021
1 parent 864b6e3 commit e086b47
Show file tree
Hide file tree
Showing 116 changed files with 169,908 additions and 1,369 deletions.
47 changes: 25 additions & 22 deletions .github/workflows/blake2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,30 @@ env:
RUSTFLAGS: "-Dwarnings"

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- 1.41.0 # MSRV
- stable
target:
- thumbv7em-none-eabi
- wasm32-unknown-unknown
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
override: true
- run: cargo build --no-default-features --release --target ${{ matrix.target }}
# TODO(tarcieri): re-enable these when failures are addressed:
# <https://github.com/RustCrypto/hashes/pull/228/checks?check_run_id=1831937705>
# build:
# runs-on: ubuntu-latest
# strategy:
# matrix:
# rust:
# - 1.41.0 # MSRV
# - stable
# target:
# - thumbv7em-none-eabi
# - wasm32-unknown-unknown
# steps:
# - uses: actions/checkout@v1
# - uses: actions-rs/toolchain@v1
# with:
# profile: minimal
# toolchain: ${{ matrix.rust }}
# target: ${{ matrix.target }}
# override: true
# - run: cargo build --target ${{ matrix.target }} --release --no-default-features
# - run: cargo build --target ${{ matrix.target }} --release --no-default-features --features blake2b
# - run: cargo build --target ${{ matrix.target }} --release --no-default-features --features blake2s
# - run: cargo build --target ${{ matrix.target }} --release --no-default-features --features blake2b,blake2s

test:
runs-on: ubuntu-latest
Expand All @@ -62,6 +67,4 @@ jobs:
profile: minimal
toolchain: nightly
override: true
- run: cargo test --features simd
- run: cargo test --features simd_opt
- run: cargo test --features simd_asm
- run: cargo test --release
196 changes: 178 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 23 additions & 11 deletions blake2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,30 @@ keywords = ["crypto", "blake2", "hash", "digest"]
categories = ["cryptography", "no-std"]

[dependencies]
digest = "0.9"
crypto-mac = "0.8"
opaque-debug = "0.3"
arrayref = "0.3"
arrayvec = { version = "0.5", default-features = false }
constant_time_eq = "0.1"
#digest = "0.9"
#crypto-mac = "0.8"
#opaque-debug = "0.3"

[dev-dependencies]
digest = { version = "0.9", features = ["dev"] }
crypto-mac = { version = "0.8", features = ["dev"] }
hex-literal = "0.2"
hex = "0.4"
lazy_static = "1.3.0"
rand = "0.7.0"
rand_chacha = "0.2.0"
serde = { version = "1.0.91", features = ["derive"] }
serde_json = "1.0.39"
#digest = { version = "0.9", features = ["dev"] }
#crypto-mac = { version = "0.8", features = ["dev"] }
#hex-literal = "0.2"

[features]
default = ["std"]
std = ["digest/std", "crypto-mac/std"]
simd = []
simd_opt = ["simd"]
simd_asm = ["simd_opt"]
default = ["blake2b", "blake2s"]
blake2b = []
blake2s = []
# This crate does a lot of #[inline(always)]. For BLAKE2b on ARM Cortex-M0 (and
# presumably other tiny chips), some of that inlining actually hurts
# performance. This feature disables some inlining, improving the performance
# of the portable implementation in that specific case.
uninline_portable = []
3 changes: 3 additions & 0 deletions blake2/benches/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Stop GitHub from thinking the majority of the repo is Objective-C :-D
blake2-avx2-sneves/* linguist-vendored
kangarootwelve/* linguist-vendored
Loading

0 comments on commit e086b47

Please sign in to comment.