Skip to content

Commit

Permalink
Interim crate (#3)
Browse files Browse the repository at this point in the history
Implement elligator2 tranform from point to representative, compatible with agl/ed25519 with the subgroup issue fixed, the kleshni-C / Signal implementations, and rfc9380.
  • Loading branch information
jmwample authored Jun 26, 2024
1 parent 5b7082b commit a642c8a
Show file tree
Hide file tree
Showing 76 changed files with 38,073 additions and 68 deletions.
44 changes: 44 additions & 0 deletions .github/disabled/cross.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Cross

on:
push:
branches: [ '**' ]
pull_request:
branches: [ '**' ]

env:
CARGO_TERM_COLOR: always
RUSTFLAGS: '-D warnings'

jobs:

test-cross:
name: Test
strategy:
matrix:
include:
# ARM32
- target: armv7-unknown-linux-gnueabihf
rust: stable

# ARM64
- target: aarch64-unknown-linux-gnu
rust: stable

# PPC32
- target: powerpc-unknown-linux-gnu
rust: stable

# TODO: We only test x/ed/curve for cross as derive is platform specifics
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: ${{ matrix.deps }}
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
targets: ${{ matrix.target }}
- uses: RustCrypto/actions/cross-install@master
- run: cross test -p curve25519-dalek --release --target ${{ matrix.target }}
- run: cross test -p ed25519-dalek --release --target ${{ matrix.target }}
- run: cross test -p x25519-dalek --release --target ${{ matrix.target }}
File renamed without changes.
111 changes: 111 additions & 0 deletions .github/disabled/workspace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: All

on:
push:
branches: [ '**' ]
pull_request:
branches: [ '**' ]

env:
CARGO_TERM_COLOR: always
RUSTFLAGS: '-D warnings'

jobs:
test-stable:
name: Test 32/64 bit stable
runs-on: ubuntu-latest
strategy:
matrix:
include:
# 32-bit target
- target: i686-unknown-linux-gnu
deps: sudo apt update && sudo apt install gcc-multilib

# 64-bit target
- target: x86_64-unknown-linux-gnu
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: rustup target add ${{ matrix.target }}
- run: ${{ matrix.deps }}
- run: cargo test --target ${{ matrix.target }} --no-default-features
- run: cargo test --target ${{ matrix.target }}
- run: cargo test --target ${{ matrix.target }} --all-features

test-nightly:
name: Test Nightly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
- run: cargo test

bench:
name: Check that benchmarks compile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: Build u32 bench
env:
RUSTFLAGS: '--cfg curve25519_dalek_bits="32"'
run: cargo build --benches
- name: Build u64 bench
env:
RUSTFLAGS: '--cfg curve25519_dalek_bits="64"'
run: cargo build --benches
- name: Build default (host native) bench
run: cargo build --benches

# Test no_std with serial (default)
build-nostd-serial:
name: Build serial on no_std target (thumbv7em-none-eabi)
runs-on: ubuntu-latest
strategy:
matrix:
include:
- crate: curve25519-dalek
- crate: ed25519-dalek
- crate: x25519-dalek
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: thumbv7em-none-eabi
- uses: taiki-e/install-action@cargo-hack
# No default features build
- name: no_std / no feat ${{ matrix.crate }}
run: cargo build -p ${{ matrix.crate }} --target thumbv7em-none-eabi --release --no-default-features
- name: no_std / cargo hack ${{ matrix.crate }}
run: cargo hack build -p ${{ matrix.crate }} --target thumbv7em-none-eabi --release --each-feature --exclude-features default,std,getrandom

clippy:
name: Check that clippy is happy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/[email protected]
with:
components: clippy
- run: cargo clippy --target x86_64-unknown-linux-gnu --all-features

rustfmt:
name: Check formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --all -- --check

doc:
name: Check docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- run: cargo doc --all-features
File renamed without changes.
6 changes: 2 additions & 4 deletions .github/workflows/cross.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,11 @@ jobs:
# TODO: We only test x/ed/curve for cross as derive is platform specifics
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: ${{ matrix.deps }}
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
targets: ${{ matrix.target }}
- uses: RustCrypto/actions/cross-install@master
- run: cross test -p curve25519-dalek --release --target ${{ matrix.target }}
- run: cross test -p ed25519-dalek --release --target ${{ matrix.target }}
- run: cross test -p x25519-dalek --release --target ${{ matrix.target }}
- run: cross test -p curve25519-elligator2 --release --target ${{ matrix.target }}
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ on:
push:
branches: [ '**' ]
paths:
- 'curve25519-dalek/**'
- '.github/workflows/curve25519-dalek.yml'
- 'curve25519-elligator2/**'
- '.github/workflows/curve25519-elligator2.yml'
pull_request:
branches: [ '**' ]
paths:
- 'curve25519-dalek/**'
- '.github/workflows/curve25519-dalek.yml'
- 'curve25519-elligator2/**'
- '.github/workflows/curve25519-elligator2.yml'

defaults:
run:
working-directory: curve25519-dalek
working-directory: curve25519-elligator2

env:
CARGO_TERM_COLOR: always
Expand All @@ -35,7 +35,7 @@ jobs:
# 64-bit target
- target: x86_64-unknown-linux-gnu
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: rustup target add ${{ matrix.target }}
- run: ${{ matrix.deps }}
Expand All @@ -50,9 +50,9 @@ jobs:
strategy:
matrix:
include:
- crate: curve25519-dalek
- crate: curve25519-elligator2
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
# 64-bit target
- target: x86_64-unknown-linux-gnu
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: rustup target add ${{ matrix.target }}
- run: ${{ matrix.deps }}
Expand All @@ -93,7 +93,7 @@ jobs:
name: Test Build Script
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
Expand All @@ -104,7 +104,7 @@ jobs:
name: Test simd backend (nightly)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- env:
# This will:
Expand All @@ -119,7 +119,7 @@ jobs:
name: Test simd backend (stable)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- env:
# This will run AVX2-specific tests and run all of the normal tests
Expand All @@ -133,7 +133,7 @@ jobs:
name: Current MSRV is 1.60.0
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
# Re-resolve Cargo.lock with minimal versions
- uses: dtolnay/rust-toolchain@nightly
- run: cargo update -Z minimal-versions
Expand Down
100 changes: 49 additions & 51 deletions .github/workflows/workspace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,51 +11,51 @@ env:
RUSTFLAGS: '-D warnings'

jobs:
test-stable:
name: Test 32/64 bit stable
runs-on: ubuntu-latest
strategy:
matrix:
include:
# 32-bit target
- target: i686-unknown-linux-gnu
deps: sudo apt update && sudo apt install gcc-multilib

# 64-bit target
- target: x86_64-unknown-linux-gnu
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: rustup target add ${{ matrix.target }}
- run: ${{ matrix.deps }}
- run: cargo test --target ${{ matrix.target }} --no-default-features
- run: cargo test --target ${{ matrix.target }}
- run: cargo test --target ${{ matrix.target }} --all-features

test-nightly:
name: Test Nightly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
- run: cargo test

bench:
name: Check that benchmarks compile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: Build u32 bench
env:
RUSTFLAGS: '--cfg curve25519_dalek_bits="32"'
run: cargo build --benches
- name: Build u64 bench
env:
RUSTFLAGS: '--cfg curve25519_dalek_bits="64"'
run: cargo build --benches
- name: Build default (host native) bench
run: cargo build --benches
# test-stable:
# name: Test 32/64 bit stable
# runs-on: ubuntu-latest
# strategy:
# matrix:
# include:
# # 32-bit target
# - target: i686-unknown-linux-gnu
# deps: sudo apt update && sudo apt install gcc-multilib
#
# # 64-bit target
# - target: x86_64-unknown-linux-gnu
# steps:
# - uses: actions/checkout@v3
# - uses: dtolnay/rust-toolchain@stable
# - run: rustup target add ${{ matrix.target }}
# - run: ${{ matrix.deps }}
# - run: cargo test --target ${{ matrix.target }} --no-default-features
# - run: cargo test --target ${{ matrix.target }}
# - run: cargo test --target ${{ matrix.target }} --all-features
#
# test-nightly:
# name: Test Nightly
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: dtolnay/rust-toolchain@nightly
# - run: cargo test
#
# bench:
# name: Check that benchmarks compile
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: dtolnay/rust-toolchain@stable
# - name: Build u32 bench
# env:
# RUSTFLAGS: '--cfg curve25519_dalek_bits="32"'
# run: cargo build --benches
# - name: Build u64 bench
# env:
# RUSTFLAGS: '--cfg curve25519_dalek_bits="64"'
# run: cargo build --benches
# - name: Build default (host native) bench
# run: cargo build --benches

# Test no_std with serial (default)
build-nostd-serial:
Expand All @@ -64,9 +64,7 @@ jobs:
strategy:
matrix:
include:
- crate: curve25519-dalek
- crate: ed25519-dalek
- crate: x25519-dalek
- crate: curve25519-elligator2
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
Expand All @@ -88,7 +86,7 @@ jobs:
- uses: dtolnay/[email protected]
with:
components: clippy
- run: cargo clippy --target x86_64-unknown-linux-gnu --all-features
- run: cargo clippy --target x86_64-unknown-linux-gnu --all-features -p curve25519-elligator2

rustfmt:
name: Check formatting
Expand All @@ -98,7 +96,7 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --all -- --check
- run: cargo fmt --all -p curve25519-elligator2 -- --check

doc:
name: Check docs
Expand All @@ -108,4 +106,4 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- run: cargo doc --all-features
- run: cargo doc --all-features -p curve25519-elligator2
Loading

0 comments on commit a642c8a

Please sign in to comment.