* Fixes #94 * add slow-hash testing to CI
This commit is contained in:
+36
-20
@@ -35,26 +35,6 @@ jobs:
|
|||||||
command: test
|
command: test
|
||||||
args: --no-default-features --features ${{ matrix.backend_feature }}
|
args: --no-default-features --features ${{ matrix.backend_feature }}
|
||||||
|
|
||||||
simple-login-test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
name: test simple_login command-line example
|
|
||||||
steps:
|
|
||||||
- name: install expect
|
|
||||||
run: sudo apt-get install expect
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: install rust
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
profile: minimal
|
|
||||||
toolchain: nightly
|
|
||||||
override: true
|
|
||||||
components: rustfmt, clippy
|
|
||||||
- name: Run expect (which then runs cargo run)
|
|
||||||
run: expect -f scripts/simple_login.exp
|
|
||||||
|
|
||||||
cross-test:
|
cross-test:
|
||||||
name: Test on ${{ matrix.target }} (using cross)
|
name: Test on ${{ matrix.target }} (using cross)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -75,6 +55,42 @@ jobs:
|
|||||||
# pass the `--target=${{ matrix.target }}` arg. (Yes, really).
|
# pass the `--target=${{ matrix.target }}` arg. (Yes, really).
|
||||||
- run: cross test --verbose --target=${{ matrix.target }} --no-default-features --features ${{ matrix.backend_feature }}
|
- run: cross test --verbose --target=${{ matrix.target }} --no-default-features --features ${{ matrix.backend_feature }}
|
||||||
|
|
||||||
|
|
||||||
|
slow-hash-test:
|
||||||
|
name: Test on ${{ matrix.target }} with slow hash
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
backend_feature:
|
||||||
|
- u64_backend
|
||||||
|
- u32_backend
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: hecrj/setup-rust-action@v1
|
||||||
|
- run: cargo test --verbose --features slow-hash --no-default-features --features ${{ matrix.backend_feature }}
|
||||||
|
|
||||||
|
|
||||||
|
simple-login-test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
name: test simple_login command-line example
|
||||||
|
steps:
|
||||||
|
- name: install expect
|
||||||
|
run: sudo apt-get install expect
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: install rust
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: nightly
|
||||||
|
override: true
|
||||||
|
components: rustfmt, clippy
|
||||||
|
- name: Run expect (which then runs cargo run)
|
||||||
|
run: expect -f scripts/simple_login.exp
|
||||||
|
|
||||||
benches:
|
benches:
|
||||||
name: cargo bench compilation
|
name: cargo bench compilation
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
+4
-2
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
use crate::{errors::InternalPakeError, hash::Hash};
|
use crate::{errors::InternalPakeError, hash::Hash};
|
||||||
use digest::Digest;
|
use digest::Digest;
|
||||||
|
#[cfg(feature = "slow-hash")]
|
||||||
|
use generic_array::typenum::Unsigned;
|
||||||
use generic_array::GenericArray;
|
use generic_array::GenericArray;
|
||||||
|
|
||||||
/// Used for the slow hashing function in OPAQUE
|
/// Used for the slow hashing function in OPAQUE
|
||||||
@@ -34,9 +36,9 @@ impl<D: Hash> SlowHash<D> for scrypt::ScryptParams {
|
|||||||
input: GenericArray<u8, <D as Digest>::OutputSize>,
|
input: GenericArray<u8, <D as Digest>::OutputSize>,
|
||||||
) -> Result<Vec<u8>, InternalPakeError> {
|
) -> Result<Vec<u8>, InternalPakeError> {
|
||||||
let params = scrypt::ScryptParams::new(15, 8, 1).unwrap();
|
let params = scrypt::ScryptParams::new(15, 8, 1).unwrap();
|
||||||
let mut output = [0u8; <D as Digest>::OutputSize::to_usize()];
|
let mut output = vec![0u8; <D as Digest>::OutputSize::to_usize()];
|
||||||
scrypt::scrypt(&input, &[], ¶ms, &mut output)
|
scrypt::scrypt(&input, &[], ¶ms, &mut output)
|
||||||
.map_err(|_| InternalPakeError::SlowHashError)?;
|
.map_err(|_| InternalPakeError::SlowHashError)?;
|
||||||
Ok(output.to_vec())
|
Ok(output)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user