Skip to content

Commit

Permalink
feat: allow both boring and RustCrypto RSA via flags (#71)
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Zak <richard@profian.com>
  • Loading branch information
rjzak authored Aug 3, 2022
1 parent 9b3a408 commit 53f6d8f
Show file tree
Hide file tree
Showing 8 changed files with 457 additions and 8 deletions.
13 changes: 10 additions & 3 deletions implementations/hostcalls/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repository = "https://github.com/webassembly/wasi-crypto"
aes-gcm = "0.9.4"
anyhow = "1.0.58"
bincode = "1.3.3"
boring = "2.0.0"
boring = {version = "2.0.0", optional = true }
byteorder = "1.4.3"
chacha20poly1305 = "0.9.1"
curve25519-dalek = "=3.2.0" # updating is impossible due to a dependency on an older `zeroize` version
Expand All @@ -40,10 +40,16 @@ p384 = { version = "0.11.1", features = [
"pkcs8",
"pem",
] }
rsa = { version = "0.6.1", features = [
"expose-internals",
"serde",
"std",
"pem"
], optional = true }
pqcrypto-traits = { version = "0.3.4", optional = true }
pqcrypto-kyber = { version = "0.7.6", optional = true }

rand_core = { version = "0.6.3", default-features = false, package = "rand_core" }
rand_core = { version = "0.6.3", features = ["getrandom"], package = "rand_core" }
rand_core_05 = { package = "rand_core", version = "0.5", default-features = false }
serde = { version = "1.0.140", features = ["derive"] }
sha2 = "0.10.2"
Expand All @@ -53,8 +59,9 @@ xoodyak = "0.7.3"
zeroize = "1.5.7"

[features]
default = ["pqcrypto"]
default = ["pqcrypto", "boring"]
pqcrypto = ["pqcrypto-traits", "pqcrypto-kyber"]
rcrypto = ["dep:rsa"]

[badges]
maintenance = { status = "experimental" }
2 changes: 1 addition & 1 deletion implementations/hostcalls/rust/src/signatures/keypair.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::ecdsa::*;
use super::eddsa::*;
use super::publickey::*;
use super::rsa::*;
use super::rsa_impl::*;
use super::*;
use crate::asymmetric_common::*;
use crate::error::*;
Expand Down
6 changes: 5 additions & 1 deletion implementations/hostcalls/rust/src/signatures/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ mod ecdsa;
mod eddsa;
mod keypair;
mod publickey;
mod rsa;

#[cfg_attr(feature = "boring", path = "rsa_boring.rs")]
#[cfg_attr(feature = "rcrypto", path = "rsa_rcrypto.rs")]
mod rsa_impl;

mod secretkey;
mod signature;

Expand Down
2 changes: 1 addition & 1 deletion implementations/hostcalls/rust/src/signatures/publickey.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::ecdsa::*;
use super::eddsa::*;
use super::rsa::*;
use super::rsa_impl::*;
use super::*;
use crate::asymmetric_common::*;
use crate::error::*;
Expand Down
Loading

0 comments on commit 53f6d8f

Please sign in to comment.