Update dependencies

This commit is contained in:
Romain Ruetschi
2019-07-23 19:20:52 +02:00
parent 3e8b0fd554
commit a03e88aa00
3 changed files with 15 additions and 18 deletions

View File

@ -6,8 +6,6 @@ rust:
- beta
matrix:
# Since this item is allowed to fail, don't wait for it's result to mark the
# build complete.
fast_finish: true
allow_failures:
- env: NAME='nightly'
@ -15,12 +13,14 @@ matrix:
include:
- env: NAME='nightly'
rust: nightly
- env: NAME='rustfmt'
rust: nightly
- env: NAME='clippy'
rust: nightly-2019-07-19
before_script:
- rustup component add rustfmt-preview
- rustup component add clippy
script:
- cargo fmt --all -- --check
- cargo clippy --all --all-features -- -D clippy::all
- env: NAME='kcov'
sudo: required # travis-ci/travis-ci#9061
before_script:
@ -48,3 +48,4 @@ script:
- cargo build --verbose --all-features
- cargo test --verbose --all-features
- cargo doc --verbose --all-features --no-deps

View File

@ -12,8 +12,7 @@ categories = ["cryptography", "algorithms"]
readme = "README.md"
[dependencies]
ring = "^0.13.0"
rand = "^0.5.0"
ring = "^0.16.1"
[package.metadata.release]
sign-commit = true

View File

@ -12,12 +12,10 @@
unused_qualifications
)]
extern crate rand;
extern crate ring;
use rand::OsRng;
use rand::RngCore;
use ring::digest::{Algorithm, Context};
use ring::rand::{SecureRandom, SystemRandom};
use std::cmp::Ordering;
use std::hash::{Hash, Hasher};
@ -176,15 +174,14 @@ impl PrivateKey {
/// Generates a new random one-time signing key. This method can panic if OS RNG fails
pub fn new(algorithm: &'static Algorithm) -> PrivateKey {
let generate_bit_hash_values = || -> Vec<Vec<u8>> {
let mut rng = match OsRng::new() {
Ok(g) => g,
Err(e) => panic!("Failed to obtain OS RNG: {}", e),
};
let rng = SystemRandom::new();
let buffer_byte = vec![0u8; algorithm.output_len];
let mut buffer = vec![buffer_byte; algorithm.output_len * 8];
for hash in &mut buffer {
rng.fill_bytes(hash)
rng.fill(hash)
.expect("Unable to fill buffer with random data");
}
buffer
@ -274,7 +271,7 @@ impl Drop for PrivateKey {
}
impl PartialEq for PrivateKey {
// ⚠️ This is not a constant-time implementation
// ⚠️ This is not a constant-time implementation
fn eq(&self, other: &PrivateKey) -> bool {
if self.algorithm != other.algorithm {
return false;
@ -310,7 +307,7 @@ impl PartialOrd for PrivateKey {
}
impl Ord for PrivateKey {
// ⚠️ This is not a constant-time implementation
// ⚠️ This is not a constant-time implementation
fn cmp(&self, other: &PrivateKey) -> Ordering {
self.one_values
.cmp(&other.one_values)