Add no_std support to transcript, dalek-ff-group, ed448, ciphersuite, multiexp, schnorr, and monero-generators

transcript, dalek-ff-group, ed449, and ciphersuite are all usable with no_std
alone. The rest additionally require alloc.

Part of #279.
This commit is contained in:
Luke Parker
2023-04-22 04:38:47 -04:00
parent ef0c901455
commit 1e448dec21
38 changed files with 445 additions and 76 deletions

View File

@@ -13,17 +13,27 @@ all-features = true
rustdoc-args = ["--cfg", "docsrs"]
[dependencies]
rand_core = "0.6"
std-shims = { path = "../../common/std-shims", version = "0.1", default-features = false }
rand_core = { version = "0.6", default-features = false }
zeroize = { version = "^1.5", features = ["zeroize_derive"] }
transcript = { package = "flexible-transcript", path = "../transcript", version = "0.3" }
transcript = { package = "flexible-transcript", path = "../transcript", version = "0.3", default-features = false }
ciphersuite = { path = "../ciphersuite", version = "0.3" }
multiexp = { path = "../multiexp", version = "0.3", features = ["batch"] }
ciphersuite = { path = "../ciphersuite", version = "0.3", default-features = false, features = ["alloc"] }
multiexp = { path = "../multiexp", version = "0.3", default-features = false, features = ["batch"] }
[dev-dependencies]
hex = "0.4"
rand_core = { version = "0.6", features = ["std"] }
sha2 = "0.10"
dalek-ff-group = { path = "../dalek-ff-group", version = "0.3" }
ciphersuite = { path = "../ciphersuite", version = "0.3", features = ["ed25519"] }
[features]
std = ["std-shims/std", "ciphersuite/std"]
default = ["std"]

View File

@@ -14,3 +14,6 @@ This library was
culminating in commit
[669d2dbffc1dafb82a09d9419ea182667115df06](https://github.com/serai-dex/serai/tree/669d2dbffc1dafb82a09d9419ea182667115df06).
Any subsequent changes have not undergone auditing.
This library is usable under no_std, via alloc, when the default features are
disabled.

View File

@@ -1,4 +1,7 @@
use std::io::{self, Read, Write};
use std_shims::{
vec::Vec,
io::{self, Read, Write},
};
use zeroize::Zeroize;

View File

@@ -1,8 +1,15 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![doc = include_str!("../README.md")]
#![cfg_attr(not(feature = "std"), no_std)]
use core::ops::Deref;
use std::io::{self, Read, Write};
#[cfg(not(feature = "std"))]
#[macro_use]
extern crate alloc;
use std_shims::{
vec::Vec,
io::{self, Read, Write},
};
use rand_core::{RngCore, CryptoRng};