-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
43 changed files
with
807 additions
and
895 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
/target | ||
**/*.rs.bk | ||
Cargo.lock | ||
/venv | ||
**/*.o | ||
**/*.map | ||
**/.gdb_history | ||
/tests/x25519_test.json | ||
/tests/eddsa_test.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,77 @@ | ||
[package] | ||
name = "salty" | ||
version = "0.2.1" | ||
authors = ["Nicolas Stalder <n@stalder.io>"] | ||
[workspace] | ||
members = [ | ||
".", | ||
"c-api", | ||
"qemu-tests", | ||
"wycheproof", | ||
"wycheproof/macros", | ||
"wycheproof/types", | ||
] | ||
|
||
[workspace.package] | ||
authors = ["The Salty Engineers"] | ||
edition = "2021" | ||
description = "Small, sweet, swift Ed25519 signatures for microcontrollers" | ||
homepage = "https://salty.rs" | ||
repository = "https://github.com/nickray/salty" | ||
homepage = "https://github.com/ycrypto/salty" | ||
license = "Apache-2.0 OR MIT" | ||
readme = "README.md" | ||
repository = "https://github.com/ycrypto/salty" | ||
version = "0.2.1" | ||
|
||
[package] | ||
name = "salty" | ||
description = "Small, sweet, swift Ed25519 signatures for microcontrollers" | ||
keywords = ["no-std", "NaCl", "Ed25519", "cryptography", "signatures"] | ||
version.workspace = true | ||
authors.workspace = true | ||
edition.workspace = true | ||
homepage.workspace = true | ||
license.workspace = true | ||
readme.workspace = true | ||
repository.workspace = true | ||
|
||
[dependencies] | ||
cosey = { version = "0.3.0", optional = true } | ||
[workspace.dependencies] | ||
salty = { path = "." } | ||
wycheproof = { path = "wycheproof" } | ||
wycheproof-macros = { path = "wycheproof/macros" } | ||
wycheproof-types = { path = "wycheproof/types" } | ||
|
||
cosey = { version = "0.3.0" } | ||
ed25519 = { version = "2.2", default-features = false } | ||
hex = "0.4" | ||
hex-literal = "0.4" | ||
subtle = { version = "2.4.0", default-features = false } | ||
zeroize = { version = "1.2.0", default-features = false } | ||
ed25519 = { version = "2.2", default-features = false, optional = true } | ||
|
||
[dependencies] | ||
subtle.workspace = true | ||
zeroize.workspace = true | ||
|
||
cosey = { workspace = true, optional = true} | ||
ed25519 = { workspace = true, optional = true} | ||
|
||
[dev-dependencies] | ||
hex = "0.4" | ||
hex-literal = "0.4" | ||
wycheproof = { path = "wycheproof" } | ||
wycheproof-gen = { path = "wycheproof/wycheproof-gen" } | ||
hex.workspace = true | ||
hex-literal.workspace = true | ||
wycheproof-macros.workspace = true | ||
wycheproof-types.workspace = true | ||
|
||
[features] | ||
default = ["rustcrypto"] | ||
slow-motion = [] | ||
cose = ["cosey"] | ||
rustcrypto = ["ed25519"] | ||
# # doubt this will ever finish xD | ||
# very-long-x25519-test = [] | ||
|
||
[profile.release.package.salty-c-api] | ||
codegen-units = 1 | ||
debug = true | ||
# using `lto = true` leads to | ||
# warning: Linking globals named 'salty_public_key': symbol multiply defined! | ||
# error: failed to load bc of "salty.2a057q60-cgu.0": <Paste> | ||
# lto = "thin" | ||
opt-level = "s" | ||
|
||
[profile.release.package.qemu-tests] | ||
codegen-units = 1 | ||
debug = true | ||
# lto = true | ||
opt-level = "z" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,52 @@ | ||
TARGET ?= thumbv7em-none-eabihf | ||
WYCHEPROOF_EDDSA_TEST_JSON_URL ?= https://raw.githubusercontent.com/google/wycheproof/master/testvectors/eddsa_test.json | ||
WYCHEPROOF_X25519_TEST_JSON_URL ?= https://raw.githubusercontent.com/google/wycheproof/master/testvectors/x25519_test.json | ||
|
||
build build-release: | ||
build: | ||
cargo build --release | ||
cargo build --release --target thumbv7em-none-eabi | ||
cargo build --release --features slow-motion --target thumbv7em-none-eabi | ||
|
||
build-debug: | ||
cargo build | ||
|
||
local-docs: | ||
cargo doc --document-private-items | ||
|
||
fmt: | ||
cargo fmt | ||
|
||
rustup: | ||
rustup target add $(TARGET) | ||
rustup component add rustfmt | ||
|
||
tests/eddsa_test.json: | ||
curl -sSf "$(WYCHEPROOF_EDDSA_TEST_JSON_URL)" -o $@ | ||
|
||
tests/x25519_test.json: | ||
curl -sSf "$(WYCHEPROOF_X25519_TEST_JSON_URL)" -o $@ | ||
|
||
test: tests/eddsa_test.json tests/x25519_test.json | ||
test: | ||
# Test on PC | ||
cargo test | ||
# Test on QEMU | ||
make -C qemu-tests test | ||
|
||
.PHONY: venv | ||
# re-run as necessary | ||
venv: | ||
python3 -m venv venv | ||
venv/bin/pip install -U pip | ||
venv/bin/pip install -U -r requirements.txt | ||
fmt: | ||
cargo fmt --all | ||
|
||
fix: fmt | ||
cargo clippy --fix --workspace --allow-staged | ||
|
||
# used in CI | ||
check: | ||
# cargo check --all | ||
cargo check -p salty | ||
cargo check -p salty-c-api --target thumbv7em-none-eabi | ||
cargo check -p qemu-tests | ||
cargo check -p wycheproof | ||
cargo check -p wycheproof-macros | ||
cargo check -p wycheproof-types | ||
|
||
# used in CI | ||
lint: | ||
cargo fmt --check --all | ||
# cargo clippy --workspace | ||
cargo clippy -p salty | ||
cargo clippy -p salty-c-api --target thumbv7em-none-eabi | ||
cargo clippy -p qemu-tests | ||
cargo clippy -p wycheproof | ||
cargo clippy -p wycheproof-macros | ||
cargo clippy -p wycheproof-types | ||
|
||
watch: | ||
cargo watch -x 'build --release' | ||
local-docs: | ||
cargo doc --document-private-items | ||
|
||
clean: | ||
rm -f tests/eddsa_test.json | ||
rm -f tests/x25519_test.json | ||
cargo clean | ||
rustup-targets: | ||
rustup target add thumbv7em-none-eabi | ||
rustup target add thumbv8m.main-none-eabi | ||
|
||
WP_VECTOR_SOURCE = https://raw.githubusercontent.com/google/wycheproof/master/testvectors | ||
WP_SCHEMA_SOURCE = https://raw.githubusercontent.com/google/wycheproof/master/schemas | ||
WP_DATA = wycheproof/data | ||
update-wycheproof-data: | ||
curl -sSf $(WP_VECTOR_SOURCE)/eddsa_test.json -o $(WP_DATA)/eddsa_test.json | ||
curl -sSf $(WP_SCHEMA_SOURCE)/eddsa_verify_schema.json -o $(WP_DATA)/eddsa_verify_schema.json | ||
curl -sSf $(WP_VECTOR_SOURCE)/x25519_test.json -o $(WP_DATA)/x25519_test.json | ||
curl -sSf $(WP_SCHEMA_SOURCE)/xdh_comp_schema.json -o $(WP_DATA)/xdh_comp_schema.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[build] | ||
target = "thumbv7em-none-eabi" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
/target | ||
libsalty-debug.a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
[package] | ||
name = "salty-c-api" | ||
version = "0.2.0" | ||
authors = ["Nicolas Stalder <n@stalder.io>"] | ||
edition = "2021" | ||
description = "Small, sweet, swift Ed25519 signatures for microcontrollers" | ||
repository = "https://github.com/nickray/salty" | ||
license = "Apache-2.0 OR MIT" | ||
readme = "README.md" | ||
keywords = ["no-std", "NaCl", "cryptography", "signatures"] | ||
authors.workspace = true | ||
edition.workspace = true | ||
license.workspace = true | ||
readme.workspace = true | ||
repository.workspace = true | ||
version.workspace = true | ||
|
||
[lib] | ||
crate-type = ["staticlib"] | ||
|
||
[dependencies] | ||
salty = { path = ".." } | ||
salty.workspace = true | ||
panic-halt = "0.2" | ||
|
||
[features] | ||
slow-motion = ["salty/slow-motion"] | ||
|
||
[profile.release] | ||
codegen-units = 1 | ||
debug = true | ||
# using `lto = true` leads to | ||
# warning: Linking globals named 'salty_public_key': symbol multiply defined! | ||
# error: failed to load bc of "salty.2a057q60-cgu.0": <Paste> | ||
lto = "thin" | ||
opt-level = "s" | ||
# [profile.release] | ||
# codegen-units = 1 | ||
# debug = true | ||
# # using `lto = true` leads to | ||
# # warning: Linking globals named 'salty_public_key': symbol multiply defined! | ||
# # error: failed to load bc of "salty.2a057q60-cgu.0": <Paste> | ||
# lto = "thin" | ||
# opt-level = "s" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.