Oregami
Repositories/oxedyne/fe2o3

oxedyne/fe2o3/fe2o3_crypto/Cargo.toml

5.1 KiB, 63 runs

created by r1870400018:134, which is this file's identity for as long as the history lasts, whatever it is later renamed to

download · who wrote it · its history

1[package]
2name = "oxedyne_fe2o3_crypto"
3version = "0.5.0"
4authors = ["h00gs <hello@oxedyne.io>"]
5edition = "2021"
6license = "BSD-2-Clause/Apache-2.0"
7description = "Hematite cryptographic library."
8repository = "https://github.com/oxedyne-io/fe2o3"
9
10build = "build.rs"
11
12[lib]
13crate-type = ["lib", "cdylib"]
14
15[features]
16default = [ "mode2", "pq", "batch" ]
17mode0 = []
18mode1 = []
19mode2 = []
20mode3 = []
21
22# Ed25519 batch verification, which checks a whole set of signatures for far
23# less than the sum of the parts: one multi-scalar equation, the cofactored sum
24# of each signature's own equation under a 128-bit coefficient (`sign.rs`,
25# `holds`). The coefficients are drawn by hashing the inputs themselves rather
26# than by asking the operating system for randomness, so this compiles to wasm32
27# along with the rest of the pure-Rust subset, and a reader in a browser verifies
28# a history rather than trusting a server to have done it. It needs nothing
29# beyond `curve25519-dalek` and `sha2`, already here.
30#
31# Turn it off and `SignatureScheme::verify_batch` still decompresses each public
32# key once and then checks the set one signature at a time. The set of
33# signatures accepted is the same either way; only the cost differs.
34batch = []
35
36# ECDSA P-256 (NIST secp256r1) signature *verification*, pure Rust and wasm-clean.
37# Verify only: signing and key generation stay host-side (WebCrypto, Secure
38# Enclave, Android Keystore), so nothing on this path asks the operating system
39# for randomness and it compiles to wasm32-unknown-unknown. It rests on the
40# RustCrypto `p256` crate, the NIST-curve peer of the `ed25519-dalek` this crate
41# already carries. Off by default, so a native build is unchanged; a browser
42# build turns it on to check a device's P-256 signature on-device rather than
43# trusting a server to have checked it. The message digest is taken from
44# `fe2o3_hash`, so no separate hasher is compiled in on the verify path.
45p256 = [ "dep:p256" ]
46
47# The post-quantum schemes that rest on C: the SABER key exchange, whose reference implementation
48# this crate compiles and binds with bindgen, and the C wrapper behind `SignatureScheme::Dilithium2`.
49# They need a C toolchain, OpenSSL and bindgen, none of which exist in a browser.
50#
51# Turn this off and what remains is pure Rust: Ed25519, AES-GCM, SHA3, and the pure-Rust Dilithium
52# of `SignatureScheme::Dilithium2_fe2o3`. That subset compiles to wasm32, which is what lets a
53# reader verify a signature in a browser instead of trusting a server to have done it. On by
54# default, so a native build is unchanged.
55pq = [
56 "dep:pqcrypto-dilithium",
57 "dep:pqcrypto-traits",
58 "dep:bindgen",
59]
60
61[dependencies]
62oxedyne_fe2o3_core = { path = "../fe2o3_core" }
63oxedyne_fe2o3_data = { path = "../fe2o3_data" }
64oxedyne_fe2o3_hash = { path = "../fe2o3_hash" }
65oxedyne_fe2o3_iop_crypto = { path = "../fe2o3_iop_crypto" }
66oxedyne_fe2o3_iop_hash = { path = "../fe2o3_iop_hash" }
67oxedyne_fe2o3_jdat = { path = "../fe2o3_jdat" }
68oxedyne_fe2o3_namex = { path = "../fe2o3_namex" }
69oxedyne_fe2o3_text = { path = "../fe2o3_text" }
70
71# std reqd to activate impl std::error::Error for aead::Error
72aes-gcm = { version = "0.10.3", features = ["std"] }
73
74console_error_panic_hook= "0.1.6"
75# Already in the graph through ed25519-dalek, and named here so that
76# `agree` can reach MontgomeryPoint and `sign` can verify Ed25519 strictly
77# with its own equations. Nothing new is compiled for it.
78curve25519-dalek = "4.1.3"
79ed25519-dalek = { version = "2.0.0", features = ["rand_core"] }
80# P-256 ECDSA verification only; see the `p256` feature. `default-features` is off
81# so no `std`, and only the `ecdsa` surface is compiled, keeping `getrandom` off
82# the verify path so the crate still builds for wasm32-unknown-unknown.
83p256 = { version = "0.13", default-features = false, features = ["ecdsa"], optional = true }
84pqcrypto-dilithium = { version = "0.4.5", optional = true }
85pqcrypto-traits = { version = "0.3.4", optional = true }
86rand_core = { version = "0.6.3", features = ["std"] }
87rand = { version = "0.8.4" }
88secrecy = "0.8.0"
89# SHA-512 for linkring's RFC 9380 hash to ristretto255 and for the Ed25519
90# challenge in strict verification. Already compiled for ed25519-dalek, so
91# nothing new is built.
92sha2 = { version = "0.10", default-features = false }
93tiny-keccak = { version = "2.0.2", features = ["sha3", "shake"] }
94wasm-bindgen = "0.2.71"
95zeroize = { version = "1.4.2", features = ["zeroize_derive"] }
96
97###### Dilithium
98arrayref = "0.3"
99itertools = "0.7"
100byteorder = "1"
101sha3 = "0.7"
102digest = "0.7"
103# Needed for Dilithium _and_ ed25519-dalek
104rand_core_old = { package = "rand_core", version = "0.5.0", features = ["std"] }
105rand_old = { package = "rand", version = "0.7.0" }
106
107[dev-dependencies]
108oxedyne_fe2o3_data = { path = "../fe2o3_data" }
109oxedyne_fe2o3_text = { path = "../fe2o3_text" }
110libc = "0.2"
111# Dilithium
112hex = "0.3"
113# The P-256 differential oracle. `ring` is the backend of `fe2o3_net::ecdsa`, so
114# checking against `ring` directly is the same test as checking against that
115# module, without a dev-dependency cycle (fe2o3_net depends on this crate). Test
116# only, native only.
117ring = "0.17"
118
119[build-dependencies]
120bindgen = { version = "0.66.1", optional = true }