From 46462cc99c24e9eb5d4abbcb3abc6e459e2a836b Mon Sep 17 00:00:00 2001 From: Darin Morrison Date: Mon, 12 Feb 2024 10:41:14 -0700 Subject: [PATCH] Fix kuznyechik 32bit build (#406) --- .github/workflows/kuznyechik.yml | 32 ++++++++++++++++++++++++++++++++ kuznyechik/src/sse2/backends.rs | 4 ++++ 2 files changed, 36 insertions(+) diff --git a/.github/workflows/kuznyechik.yml b/.github/workflows/kuznyechik.yml index 00b97ba7..a77983ec 100644 --- a/.github/workflows/kuznyechik.yml +++ b/.github/workflows/kuznyechik.yml @@ -45,6 +45,38 @@ jobs: with: working-directory: ${{ github.workflow }} + sse2: + runs-on: ubuntu-latest + strategy: + matrix: + rust: + - 1.65.0 # MSRV + - stable + target: + - i686-unknown-linux-gnu + - x86_64-unknown-linux-gnu + include: + - target: i686-unknown-linux-gnu + deps: sudo apt update && sudo apt install gcc-multilib + steps: + - uses: actions/checkout@v3 + - uses: RustCrypto/actions/cargo-cache@master + - uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ matrix.rust }} + targets: ${{ matrix.target }} + - run: ${{ matrix.deps }} + - env: + RUSTFLAGS: "-Dwarnings -C target-feature=+sse2" + run: | + cargo test --target ${{ matrix.target }} + cargo test --target ${{ matrix.target }} --all-features + - env: + RUSTFLAGS: "-Dwarnings -C target-feature=+sse2 --cfg kuznyechik_force_soft" + run: | + cargo test --target ${{ matrix.target }} + cargo test --target ${{ matrix.target }} --all-features + test: runs-on: ubuntu-latest strategy: diff --git a/kuznyechik/src/sse2/backends.rs b/kuznyechik/src/sse2/backends.rs index 541fdece..091c3691 100644 --- a/kuznyechik/src/sse2/backends.rs +++ b/kuznyechik/src/sse2/backends.rs @@ -9,6 +9,10 @@ use cipher::{ typenum::Unsigned, BlockBackend, BlockSizeUser, ParBlocks, ParBlocksSizeUser, }; + +#[cfg(target_arch = "x86")] +use core::arch::x86::*; +#[cfg(target_arch = "x86_64")] use core::arch::x86_64::*; pub(super) type RoundKeys = [__m128i; 10];