Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Enable aesni (#10756)
Browse files Browse the repository at this point in the history
* Run cargo fix

* Optimize imports

* compiles

* cleanup

* Use Secret to store mac-key
Truncate payload properly

* cleanup

* Reorg imports

* brwchk hand waving

* Review feedback

* whitespace

* error chain is dead

* Build parity-ethereum with SSE2, SSSE3 and AES enabled

This enables the `aesni` crate for 50x faster AES crypto.

* Correct rustflag setting

* List all target triples because [target.'cfg(…)'] is broken

* whitespace

* Enable hardware aes for CI builds

* Add note about synchronizing changes

* Remove "Linker" printout

* Build artefacts to check hardware aesni

* Skip signing windows binaries

* Build windows like before

* address grumble
  • Loading branch information
dvdplm authored Jun 18, 2019
1 parent 1786b6e commit be5db14
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 5 deletions.
26 changes: 25 additions & 1 deletion .cargo/config
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
# NOTE: if you make changes here, remember to also update:
# scripts/test-linux.sh
# scripts/build-linux.sh
# scripts/build-windows.sh

# Using 'cfg` is broken, see https://github.com/rust-lang/cargo/issues/6858
#[target.'cfg(target_arch = "x86_64")']
#rustflags = ["-Ctarget-feature=+aes,+sse2,+ssse3"]

# …so instead we list all target triples (Tier 1 64-bit platforms)
[target.x86_64-unknown-linux-gnu]
# Enables the aes-ni instructions for RustCrypto dependency.
rustflags = ["-Ctarget-feature=+aes,+sse2,+ssse3"]

[target.x86_64-pc-windows-gnu]
# Enables the aes-ni instructions for RustCrypto dependency.
rustflags = ["-Ctarget-feature=+aes,+sse2,+ssse3"]

[target.x86_64-pc-windows-msvc]
# Enables the aes-ni instructions for RustCrypto dependency.
# Link the C runtime statically ; https://github.com/paritytech/parity-ethereum/issues/6643
rustflags = ["-Ctarget-feature=+crt-static"]
rustflags = ["-Ctarget-feature=+aes,+sse2,+ssse3", "-Ctarget-feature=+crt-static"]

[target.x86_64-apple-darwin]
# Enables the aes-ni instructions for RustCrypto dependency.
rustflags = ["-Ctarget-feature=+aes,+sse2,+ssse3"]

9 changes: 6 additions & 3 deletions scripts/gitlab/build-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,18 @@ echo "CC: " $CC
echo "CXX: " $CXX
#strip ON
export RUSTFLAGS=" -C link-arg=-s"
# Linker for crosscomile
echo "_____ Linker _____"
cat .cargo/config

echo "_____ Building target: "$CARGO_TARGET" _____"
if [ "${CARGO_TARGET}" = "armv7-linux-androideabi" ]
then
time cargo build --target $CARGO_TARGET --verbose --color=always --release -p parity-clib --features final
else
if [ "${CARGO_TARGET}" = "x86_64-unknown-linux-gnu" ] || [ "${CARGO_TARGET}" = "x86_64-apple-darwin" ]
then
# NOTE: Enables the aes-ni instructions for RustCrypto dependency.
# If you change this please remember to also update .cargo/config
export RUSTFLAGS="$RUSTFLAGS -Ctarget-feature=+aes,+sse2,+ssse3"
fi
time cargo build --target $CARGO_TARGET --verbose --color=always --release --features final
time cargo build --target $CARGO_TARGET --verbose --color=always --release -p evmbin
time cargo build --target $CARGO_TARGET --verbose --color=always --release -p ethstore-cli
Expand Down
4 changes: 4 additions & 0 deletions scripts/gitlab/build-windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ echo "RUSTC_WRAPPER: " $RUSTC_WRAPPER
echo "SCCACHE_DIR: " $SCCACHE_DIR

echo "_____ Building target: "$CARGO_TARGET" _____"
# NOTE: Enables the aes-ni instructions for RustCrypto dependency.
# If you change this please remember to also update .cargo/config
export RUSTFLAGS=" -Ctarget-feature=+aes,+sse2,+ssse3 -Ctarget-feature=+crt-static"

time cargo build --target $CARGO_TARGET --verbose --release --features final
time cargo build --target $CARGO_TARGET --verbose --release -p evmbin
time cargo build --target $CARGO_TARGET --verbose --release -p ethstore-cli
Expand Down
2 changes: 1 addition & 1 deletion scripts/gitlab/test-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ rustup show

echo "________Running Parity Full Test Suite________"
# Why are we using RUSTFLAGS? See https://github.com/paritytech/parity-ethereum/pull/10719
CARGO_INCREMENTAL=0 RUSTFLAGS="-C opt-level=3 -C overflow-checks=on -C debuginfo=2" time cargo test $OPTIONS --features "$FEATURES" --locked --all --target $CARGO_TARGET --verbose --color=never -- --test-threads $THREADS
CARGO_INCREMENTAL=0 RUSTFLAGS="-C opt-level=3 -C overflow-checks=on -C debuginfo=2 -Ctarget-feature=+aes,+sse2,+ssse3" time cargo test $OPTIONS --features "$FEATURES" --locked --all --target $CARGO_TARGET --verbose --color=never -- --test-threads $THREADS

0 comments on commit be5db14

Please sign in to comment.