Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dsa: Add initial DSA implementation #471

Merged
merged 29 commits into from
May 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2333077
dsa: add DSA implementation
aumetra May 9, 2022
ef94e41
dsa: Add README
aumetra May 9, 2022
70f88ae
dsa: Add workflow, add to README
aumetra May 9, 2022
ac85e21
Merge branch 'master' into dsa-impl
aumetra May 9, 2022
955f25f
dsa: Update to pkcs8 0.9.0
aumetra May 9, 2022
9e2da39
dsa: Make signature conversion fallible, add example
aumetra May 9, 2022
e71fc26
dsa: Add signature feature, disable default features
aumetra May 9, 2022
3d7cd4a
dsa: Add feature documentation
aumetra May 9, 2022
84715de
dsa: Adjust MSRV in workflow
aumetra May 9, 2022
1c33224
dsa: Make compilation work on thumbv7em-none-eabi
aumetra May 9, 2022
6bc6cc1
dsa: Update sanity checks
aumetra May 9, 2022
7123e0f
dsa: Implement signature traits directly on the structures
aumetra May 10, 2022
62c4028
dsa: Add missing alloc feature
aumetra May 10, 2022
d7f2746
Merge branch 'master' into dsa-impl
aumetra May 10, 2022
f4df269
dsa: Add support for RFC6979 deterministic signatures
aumetra May 11, 2022
3b0fa03
dsa: Re-add no_std attribute
aumetra May 11, 2022
f1ec422
dsa: Update documentation
aumetra May 12, 2022
ea4caff
dsa: Reuse buffer
aumetra May 12, 2022
26379d8
dsa: Move tests into own directory, add all 1024-bit deterministic te…
aumetra May 13, 2022
630380f
dsa: Add 2048-bit key tests
aumetra May 13, 2022
080ab30
dsa: Fix RFC 6979 hash reduction function
aumetra May 13, 2022
68714fe
dsa: Update README
aumetra May 13, 2022
40e7fd2
dsa: Add signature tests
aumetra May 13, 2022
c2187f7
dsa: Add OpenSSL encoding/decoding tests
aumetra May 14, 2022
64d74cb
dsa: Use the OS native line ending
aumetra May 14, 2022
2f1f818
Revert "dsa: Use the OS native line ending"
aumetra May 14, 2022
7ef831b
dsa: Enforce LF on windows
aumetra May 14, 2022
4daff59
dsa: Adjust working directory
aumetra May 14, 2022
7009ede
dsa: filenames to snake case, use warn instead of forbid/deny
aumetra May 15, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/dsa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: dsa
on:
pull_request:
paths:
- "dsa/**"
- "Cargo.*"
push:
branches: master

defaults:
run:
working-directory: dsa

env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-Dwarnings"

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
target:
- thumbv7em-none-eabi
- wasm32-unknown-unknown
toolchain:
- 1.57.0 # MSRV
- stable
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
target: ${{ matrix.target }}
toolchain: ${{ matrix.toolchain }}
override: true
- run: cargo build --target ${{ matrix.target }} --release --no-default-features

test:
strategy:
matrix:
platform:
- ubuntu-latest
- macos-latest
- windows-latest
toolchain:
- 1.57.0 # MSRV
- stable
runs-on: ${{ matrix.platform }}
steps:
- name: Enforce LF
working-directory: .
run: |
git config --global core.autocrlf false
git config --global core.eol lf

- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
override: true
- run: cargo test --release --no-default-features
- run: cargo test --release
- run: cargo test --release --all-features
141 changes: 139 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[workspace]
resolver = "2"
members = [
"dsa",
"ecdsa",
"ed25519",
"rfc6979"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and can be easily used for bare-metal or lightweight WebAssembly programming.

| Name | Algorithm | Crates.io | Documentation | Build |
|-------------|-----------|-----------|---------------|-------|
| [`dsa`] | [DSA](https://en.wikipedia.org/wiki/Digital_Signature_Algorithm) | [![crates.io](https://img.shields.io/crates/v/dsa.svg)](https://crates.io/crates/dsa) | [![Documentation](https://docs.rs/dsa/badge.svg)](https://docs.rs/dsa) | [![dsa build](https://github.com/RustCrypto/signatures/workflows/dsa/badge.svg?branch=master&event=push)](https://github.com/RustCrypto/signatures/actions?query=workflow%3Adsa)
| [`ecdsa`] | [ECDSA](https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm) | [![crates.io](https://img.shields.io/crates/v/ecdsa.svg)](https://crates.io/crates/ecdsa) | [![Documentation](https://docs.rs/ecdsa/badge.svg)](https://docs.rs/ecdsa) | [![ecdsa build](https://github.com/RustCrypto/signatures/workflows/ecdsa/badge.svg?branch=master&event=push)](https://github.com/RustCrypto/signatures/actions?query=workflow%3Aecdsa) |
| [`ed25519`] | [Ed25519](https://en.wikipedia.org/wiki/EdDSA) | [![crates.io](https://img.shields.io/crates/v/ed25519.svg)](https://crates.io/crates/ed25519) | [![Documentation](https://docs.rs/ed25519/badge.svg)](https://docs.rs/ed25519) | [![ed25519 build](https://github.com/RustCrypto/signatures/workflows/ed25519/badge.svg?branch=master&event=push)](https://github.com/RustCrypto/signatures/actions?query=workflow%3Aed25519)
| [`rfc6979`] | [RFC6979](https://datatracker.ietf.org/doc/html/rfc6979) | [![crates.io](https://img.shields.io/crates/v/rfc6979.svg)](https://crates.io/crates/rfc6979) | [![Documentation](https://docs.rs/rfc6979/badge.svg)](https://docs.rs/rfc6979) | [![rfc6979 build](https://github.com/RustCrypto/signatures/actions/workflows/rfc6979.yml/badge.svg)](https://github.com/RustCrypto/signatures/actions/workflows/rfc6979.yml)
Expand Down
4 changes: 4 additions & 0 deletions dsa/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
target/
Cargo.lock
*.pem
*.der
31 changes: 31 additions & 0 deletions dsa/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[package]
name = "dsa"
version = "0.0.1"
edition = "2021"
license = "Apache-2.0 OR MIT"
readme = "README.md"
categories = ["cryptography"]
keywords = ["crypto", "nist", "signature"]
rust-version = "1.57"

[dependencies]
digest = "0.10.3"
num-bigint = { package = "num-bigint-dig", version = "0.8.1", default-features = false, features = ["prime", "rand", "zeroize"] }
num-traits = { version = "0.2.15", default-features = false }
opaque-debug = "0.3.0"
paste = "1.0.7"
pkcs8 = { version = "0.9.0", default-features = false, features = ["alloc"] }
rand = { version = "0.8.5", default-features = false }
rfc6979 = { version = "0.2.0", path = "../rfc6979" }
signature = { version = ">= 1.5.0, < 1.6.0", default-features = false, features = ["digest-preview", "rand-preview"] }
zeroize = { version = "1.5.5", default-features = false }

[features]
default = []

[dev-dependencies]
pkcs8 = { version = "0.9.0", default-features = false, features = ["pem"] }
rand = "0.8.5"
rand_chacha = "0.3.1"
sha1 = "0.10.1"
sha2 = "0.10.2"
Loading