aboutsummaryrefslogtreecommitdiff
path: root/rand/rand_chacha
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2019-01-16 17:26:30 -0800
committerDaniel Mueller <deso@posteo.net>2019-01-16 17:26:30 -0800
commit8350ac6afb2d678b74581000a6aafe1994b72231 (patch)
tree2330da01a806921b3849c9e64d2b9f506495e2c0 /rand/rand_chacha
parentd6652b913b33e432a748187f9f5623cec1e9926e (diff)
downloadnitrocli-8350ac6afb2d678b74581000a6aafe1994b72231.tar.gz
nitrocli-8350ac6afb2d678b74581000a6aafe1994b72231.tar.bz2
Update nitrokey crate to 0.3.3
This change updates the nitrokey crate to version 0.3.3. Along with that change we update rand to 0.6.4 because rand 0.6.1 does not yet contain a publicly accessible rand_os. Note that we no longer require all crates in rand's workspace, but only rand_os and rand_core, which is a significant reduction in the number of lines of code compiled. Import subrepo nitrokey/:nitrokey at 7cf747d56ddc0b7eeedc3caf36dcc909907a171c Import subrepo rand/:rand at 4336232dda03323634b10ec72ddf27914aebc3a2
Diffstat (limited to 'rand/rand_chacha')
-rw-r--r--rand/rand_chacha/CHANGELOG.md4
-rw-r--r--rand/rand_chacha/Cargo.toml4
-rw-r--r--rand/rand_chacha/build.rs9
-rw-r--r--rand/rand_chacha/src/chacha.rs6
-rw-r--r--rand/rand_chacha/src/lib.rs2
5 files changed, 14 insertions, 11 deletions
diff --git a/rand/rand_chacha/CHANGELOG.md b/rand/rand_chacha/CHANGELOG.md
index d0c4a2f..a1979f6 100644
--- a/rand/rand_chacha/CHANGELOG.md
+++ b/rand/rand_chacha/CHANGELOG.md
@@ -4,5 +4,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [0.1.1] - 2019-01-04
+- Disable `i128` and `u128` if the `target_os` is `emscripten` (#671: work-around Emscripten limitation)
+- Update readme and doc links
+
## [0.1.0] - 2018-10-17
- Pulled out of the Rand crate
diff --git a/rand/rand_chacha/Cargo.toml b/rand/rand_chacha/Cargo.toml
index af70969..028428c 100644
--- a/rand/rand_chacha/Cargo.toml
+++ b/rand/rand_chacha/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rand_chacha"
-version = "0.1.0"
+version = "0.1.1"
authors = ["The Rand Project Developers", "The Rust Project Developers"]
license = "MIT/Apache-2.0"
readme = "README.md"
@@ -22,4 +22,4 @@ appveyor = { repository = "rust-random/rand" }
rand_core = { path = "../rand_core", version = ">=0.2, <0.4", default-features=false }
[build-dependencies]
-rustc_version = "0.2"
+autocfg = "0.1"
diff --git a/rand/rand_chacha/build.rs b/rand/rand_chacha/build.rs
index cb3ae20..06e12a4 100644
--- a/rand/rand_chacha/build.rs
+++ b/rand/rand_chacha/build.rs
@@ -1,8 +1,7 @@
-extern crate rustc_version;
-use rustc_version::{version, Version};
+extern crate autocfg;
fn main() {
- if version().unwrap() >= Version::parse("1.26.0").unwrap() {
- println!("cargo:rustc-cfg=rust_1_26");
- }
+ println!("cargo:rerun-if-changed=build.rs");
+ let ac = autocfg::new();
+ ac.emit_rustc_version(1, 26);
}
diff --git a/rand/rand_chacha/src/chacha.rs b/rand/rand_chacha/src/chacha.rs
index 3e90409..86f191e 100644
--- a/rand/rand_chacha/src/chacha.rs
+++ b/rand/rand_chacha/src/chacha.rs
@@ -114,7 +114,7 @@ impl ChaChaRng {
/// byte-offset.
///
/// Note: this function is currently only available with Rust 1.26 or later.
- #[cfg(rust_1_26)]
+ #[cfg(all(rustc_1_26, not(target_os = "emscripten")))]
pub fn get_word_pos(&self) -> u128 {
let mut c = (self.0.core.state[13] as u64) << 32
| (self.0.core.state[12] as u64);
@@ -135,7 +135,7 @@ impl ChaChaRng {
/// 60 bits.
///
/// Note: this function is currently only available with Rust 1.26 or later.
- #[cfg(rust_1_26)]
+ #[cfg(all(rustc_1_26, not(target_os = "emscripten")))]
pub fn set_word_pos(&mut self, word_offset: u128) {
let index = (word_offset as usize) & 0xF;
let counter = (word_offset >> 4) as u64;
@@ -330,7 +330,7 @@ mod test {
}
#[test]
- #[cfg(rust_1_26)]
+ #[cfg(all(rustc_1_26, not(target_os = "emscripten")))]
fn test_chacha_true_values_c() {
// Test vector 4 from
// https://tools.ietf.org/html/draft-nir-cfrg-chacha20-poly1305-04
diff --git a/rand/rand_chacha/src/lib.rs b/rand/rand_chacha/src/lib.rs
index 8cff03a..74ad466 100644
--- a/rand/rand_chacha/src/lib.rs
+++ b/rand/rand_chacha/src/lib.rs
@@ -18,7 +18,7 @@
#![no_std]
-extern crate rand_core;
+pub extern crate rand_core;
mod chacha;