Skip to content

Commit

Permalink
Add nostd support (#42)
Browse files Browse the repository at this point in the history
This change implements nostd support for the merlin library. It mostly consists of config directives, and some remapping of std:: to core::.
  • Loading branch information
xoloki authored and hdevalence committed Jul 3, 2019
1 parent 0d00b31 commit 6165fc4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
8 changes: 7 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@ matrix:
- rust: stable
script:
- cargo test
- rust: nightly-2018-12-04
- rust: nightly
before_script:
- rustup component add rustfmt-preview
script:
- cargo test
- cargo fmt --all -- --check
# Test if crate can be truly built without std, cargo-nono 0.1.5 now works against clear_on_drop and has been released
- rust: nightly
script:
- cargo nono check --no-default-features --features nightly
install:
- cargo install --force cargo-nono || true

notifications:
slack:
Expand Down
12 changes: 7 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ exclude = [".travis.yml", ".gitignore"]
features = ["nightly"]

[dependencies]
keccak = "0.1.0"
byteorder = "1.2.4"
clear_on_drop = "0.2.3"
rand_core = "0.3"
hex = {version = "0.3", optional = true}
keccak = { version = "0.1.0", default-features = false }
byteorder = { version = "1.2.4", default-features = false }
clear_on_drop = { version = "0.2.3", default-features = false }
rand_core = { version = "0.4", default-features = false }
hex = {version = "0.3", default-features = false, optional = true}

[dev-dependencies]
strobe-rs = "0.3"
Expand All @@ -31,5 +31,7 @@ rand_chacha = "0.1"
rand = "0.6"

[features]
default = ["std"]
nightly = ["clear_on_drop/nightly"]
debug-transcript = ["hex"]
std = ["rand_core/std", "byteorder/std"]
5 changes: 4 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(feature = "nightly", feature(external_doc))]
#![cfg_attr(feature = "nightly", doc(include = "../README.md"))]
#![doc(html_logo_url = "https://doc.dalek.rs/assets/dalek-logo-clear.png")]
Expand All @@ -16,10 +17,12 @@ please file an issue!

extern crate byteorder;
extern crate clear_on_drop;
extern crate core;
extern crate keccak;
extern crate rand_core;

#[cfg(feature = "std")]
extern crate core;

#[cfg(test)]
extern crate curve25519_dalek;
#[cfg(feature = "hex")]
Expand Down
2 changes: 1 addition & 1 deletion src/strobe.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Minimal implementation of (parts of) Strobe.
use core::ops::{Deref, DerefMut};
use keccak;
use std::ops::{Deref, DerefMut};

/// Strobe R value; security level 128 is hardcoded
const STROBE_R: u8 = 166;
Expand Down

0 comments on commit 6165fc4

Please sign in to comment.