Enable aesni (#10756)

* 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
This commit is contained in:
David 2019-06-18 20:24:21 +02:00 committed by GitHub
parent 1786b6eedd
commit be5db14160
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 5 deletions

View File

@ -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] [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 # 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"]

View File

@ -11,15 +11,18 @@ echo "CC: " $CC
echo "CXX: " $CXX echo "CXX: " $CXX
#strip ON #strip ON
export RUSTFLAGS=" -C link-arg=-s" export RUSTFLAGS=" -C link-arg=-s"
# Linker for crosscomile
echo "_____ Linker _____"
cat .cargo/config
echo "_____ Building target: "$CARGO_TARGET" _____" echo "_____ Building target: "$CARGO_TARGET" _____"
if [ "${CARGO_TARGET}" = "armv7-linux-androideabi" ] if [ "${CARGO_TARGET}" = "armv7-linux-androideabi" ]
then then
time cargo build --target $CARGO_TARGET --verbose --color=always --release -p parity-clib --features final time cargo build --target $CARGO_TARGET --verbose --color=always --release -p parity-clib --features final
else 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 --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 evmbin
time cargo build --target $CARGO_TARGET --verbose --color=always --release -p ethstore-cli time cargo build --target $CARGO_TARGET --verbose --color=always --release -p ethstore-cli

View File

@ -14,6 +14,10 @@ echo "RUSTC_WRAPPER: " $RUSTC_WRAPPER
echo "SCCACHE_DIR: " $SCCACHE_DIR echo "SCCACHE_DIR: " $SCCACHE_DIR
echo "_____ Building target: "$CARGO_TARGET" _____" 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 --features final
time cargo build --target $CARGO_TARGET --verbose --release -p evmbin time cargo build --target $CARGO_TARGET --verbose --release -p evmbin
time cargo build --target $CARGO_TARGET --verbose --release -p ethstore-cli time cargo build --target $CARGO_TARGET --verbose --release -p ethstore-cli

View File

@ -15,4 +15,4 @@ rustup show
echo "________Running Parity Full Test Suite________" echo "________Running Parity Full Test Suite________"
# Why are we using RUSTFLAGS? See https://github.com/paritytech/parity-ethereum/pull/10719 # 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