Skip to content

Commit

Permalink
Squash of PR#42 from @xoloki (dalek-cryptography#42)
Browse files Browse the repository at this point in the history
first pass nostd, turn off default features and add std/alloc features

Update Cargo.toml

Update Cargo.toml

use core ops when in alloc mode

chain features

remove std::ops entirely since we always have core anyway

remove hex and debug transcript to get rid of std errors

alloc default

set no_std config attribute

remove core crate extern

import core crate before use

don't add extern crate core; use global namespace when referring to core

include core explicitly if we're in std mode

re-enable debug-transcript feature

re-enable debug-transcript feature

fmt fixes
  • Loading branch information
xoloki authored and isislovecruft committed May 29, 2019
1 parent 0d00b31 commit ade5a76
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
13 changes: 8 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.3", default-features = false }
hex = {version = "0.3", default-features = false, optional = true}

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

[features]
default = ["std"]
nightly = ["clear_on_drop/nightly"]
debug-transcript = ["hex"]
std = ["rand_core/std", "byteorder/std"]
alloc = ["rand_core/alloc"]
6 changes: 5 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(feature = "alloc", feature(alloc))]
#![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 +18,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 keccak;
use std::ops::{Deref, DerefMut};
use ::core::ops::{Deref, DerefMut};

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

0 comments on commit ade5a76

Please sign in to comment.