mirror of
https://github.com/saymrwulf/risc0-curve25519-dalek-source.git
synced 2026-09-06 20:20:39 +00:00
Merge branch 'develop' into release/4.0
This commit is contained in:
commit
62e38cd050
3 changed files with 112 additions and 8 deletions
102
.github/workflows/rust.yml
vendored
Normal file
102
.github/workflows/rust.yml
vendored
Normal file
|
|
@ -0,0 +1,102 @@
|
||||||
|
name: Rust
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ '*' ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ main, develop ]
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test-u32:
|
||||||
|
name: Test u32 backend
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: stable
|
||||||
|
override: true
|
||||||
|
- uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: test
|
||||||
|
args: --no-default-features --features "std u32_backend"
|
||||||
|
|
||||||
|
test-u64:
|
||||||
|
name: Test u64 backend
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: stable
|
||||||
|
override: true
|
||||||
|
- uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: test
|
||||||
|
args: --no-default-features --features "std u64_backend"
|
||||||
|
|
||||||
|
test-simd:
|
||||||
|
name: Test simd backend (nightly)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: nightly
|
||||||
|
override: true
|
||||||
|
- uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: test
|
||||||
|
args: --no-default-features --features "std simd_backend"
|
||||||
|
|
||||||
|
test-defaults-serde:
|
||||||
|
name: Test default feature selection and serde
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: stable
|
||||||
|
override: true
|
||||||
|
- uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: test
|
||||||
|
args: --features "serde"
|
||||||
|
|
||||||
|
test-alloc-u32:
|
||||||
|
name: Test no_std+alloc with u32 backend
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: stable
|
||||||
|
override: true
|
||||||
|
- uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: test
|
||||||
|
args: --lib --no-default-features --features "alloc u32_backend"
|
||||||
|
|
||||||
|
bench:
|
||||||
|
name: Check that benchmarks compile
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: stable
|
||||||
|
override: true
|
||||||
|
- uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: bench
|
||||||
|
# This filter selects no benchmarks, so we don't run any, only build them.
|
||||||
|
args: "DONTRUNBENCHMARKS"
|
||||||
|
|
@ -33,7 +33,7 @@ travis-ci = { repository = "dalek-cryptography/curve25519-dalek", branch = "mast
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
sha2 = { version = "0.9", default-features = false }
|
sha2 = { version = "0.9", default-features = false }
|
||||||
bincode = "1"
|
bincode = "1"
|
||||||
criterion = "0.3.0"
|
criterion = { version = "0.3.0", features = ["html_reports"] }
|
||||||
hex = "0.4.2"
|
hex = "0.4.2"
|
||||||
rand = "0.8"
|
rand = "0.8"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -180,12 +180,12 @@ mod multiscalar_benches {
|
||||||
dynamic_fraction: f64,
|
dynamic_fraction: f64,
|
||||||
) {
|
) {
|
||||||
for multiscalar_size in &MULTISCALAR_SIZES {
|
for multiscalar_size in &MULTISCALAR_SIZES {
|
||||||
c.bench_with_input(
|
let bench_id = BenchmarkId::new(
|
||||||
BenchmarkId::new(
|
"Variable-time mixed-base",
|
||||||
"Variable-time mixed-base multiscalar multiplication ({:.0}pct dyn)",
|
format!("(size: {:?}), ({:.0}pct dyn)", multiscalar_size, 100.0 * dynamic_fraction),
|
||||||
format!("({:.0}pct dyn)", 100.0 * dynamic_fraction),
|
);
|
||||||
),
|
|
||||||
&multiscalar_size,
|
c.bench_with_input(bench_id, &multiscalar_size,
|
||||||
move |b, &&total_size| {
|
move |b, &&total_size| {
|
||||||
let dynamic_size = ((total_size as f64) * dynamic_fraction) as usize;
|
let dynamic_size = ((total_size as f64) * dynamic_fraction) as usize;
|
||||||
let static_size = total_size - dynamic_size;
|
let static_size = total_size - dynamic_size;
|
||||||
|
|
@ -221,16 +221,18 @@ mod multiscalar_benches {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn multiscalar_multiplications(c: &mut Criterion) {
|
fn multiscalar_multiplications(c: &mut Criterion) {
|
||||||
let mut group: BenchmarkGroup<_> = c.benchmark_group("Multiscalar muls");
|
let mut group: BenchmarkGroup<_> = c.benchmark_group("Multiscalar multiplications");
|
||||||
|
|
||||||
consttime_multiscalar_mul(&mut group);
|
consttime_multiscalar_mul(&mut group);
|
||||||
vartime_multiscalar_mul(&mut group);
|
vartime_multiscalar_mul(&mut group);
|
||||||
vartime_precomputed_pure_static(&mut group);
|
vartime_precomputed_pure_static(&mut group);
|
||||||
|
|
||||||
let dynamic_fracs = [0.0, 0.2, 0.5];
|
let dynamic_fracs = [0.0, 0.2, 0.5];
|
||||||
|
|
||||||
for frac in dynamic_fracs.iter() {
|
for frac in dynamic_fracs.iter() {
|
||||||
vartime_precomputed_helper(&mut group, *frac);
|
vartime_precomputed_helper(&mut group, *frac);
|
||||||
}
|
}
|
||||||
|
|
||||||
group.finish();
|
group.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue