mirror of
https://github.com/mii443/lamport_sigs.rs.git
synced 2025-08-22 15:05:49 +00:00
Update dependencies
This commit is contained in:
13
.travis.yml
13
.travis.yml
@ -6,8 +6,6 @@ rust:
|
|||||||
- beta
|
- beta
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
# Since this item is allowed to fail, don't wait for it's result to mark the
|
|
||||||
# build complete.
|
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
allow_failures:
|
allow_failures:
|
||||||
- env: NAME='nightly'
|
- env: NAME='nightly'
|
||||||
@ -15,12 +13,14 @@ matrix:
|
|||||||
include:
|
include:
|
||||||
- env: NAME='nightly'
|
- env: NAME='nightly'
|
||||||
rust: nightly
|
rust: nightly
|
||||||
- env: NAME='rustfmt'
|
|
||||||
rust: nightly
|
- env: NAME='clippy'
|
||||||
|
rust: nightly-2019-07-19
|
||||||
before_script:
|
before_script:
|
||||||
- rustup component add rustfmt-preview
|
- rustup component add clippy
|
||||||
script:
|
script:
|
||||||
- cargo fmt --all -- --check
|
- cargo clippy --all --all-features -- -D clippy::all
|
||||||
|
|
||||||
- env: NAME='kcov'
|
- env: NAME='kcov'
|
||||||
sudo: required # travis-ci/travis-ci#9061
|
sudo: required # travis-ci/travis-ci#9061
|
||||||
before_script:
|
before_script:
|
||||||
@ -48,3 +48,4 @@ script:
|
|||||||
- cargo build --verbose --all-features
|
- cargo build --verbose --all-features
|
||||||
- cargo test --verbose --all-features
|
- cargo test --verbose --all-features
|
||||||
- cargo doc --verbose --all-features --no-deps
|
- cargo doc --verbose --all-features --no-deps
|
||||||
|
|
||||||
|
@ -12,8 +12,7 @@ categories = ["cryptography", "algorithms"]
|
|||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ring = "^0.13.0"
|
ring = "^0.16.1"
|
||||||
rand = "^0.5.0"
|
|
||||||
|
|
||||||
[package.metadata.release]
|
[package.metadata.release]
|
||||||
sign-commit = true
|
sign-commit = true
|
||||||
|
17
src/lib.rs
17
src/lib.rs
@ -12,12 +12,10 @@
|
|||||||
unused_qualifications
|
unused_qualifications
|
||||||
)]
|
)]
|
||||||
|
|
||||||
extern crate rand;
|
|
||||||
extern crate ring;
|
extern crate ring;
|
||||||
|
|
||||||
use rand::OsRng;
|
|
||||||
use rand::RngCore;
|
|
||||||
use ring::digest::{Algorithm, Context};
|
use ring::digest::{Algorithm, Context};
|
||||||
|
use ring::rand::{SecureRandom, SystemRandom};
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
use std::hash::{Hash, Hasher};
|
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
|
/// Generates a new random one-time signing key. This method can panic if OS RNG fails
|
||||||
pub fn new(algorithm: &'static Algorithm) -> PrivateKey {
|
pub fn new(algorithm: &'static Algorithm) -> PrivateKey {
|
||||||
let generate_bit_hash_values = || -> Vec<Vec<u8>> {
|
let generate_bit_hash_values = || -> Vec<Vec<u8>> {
|
||||||
let mut rng = match OsRng::new() {
|
let rng = SystemRandom::new();
|
||||||
Ok(g) => g,
|
|
||||||
Err(e) => panic!("Failed to obtain OS RNG: {}", e),
|
|
||||||
};
|
|
||||||
let buffer_byte = vec![0u8; algorithm.output_len];
|
let buffer_byte = vec![0u8; algorithm.output_len];
|
||||||
let mut buffer = vec![buffer_byte; algorithm.output_len * 8];
|
let mut buffer = vec![buffer_byte; algorithm.output_len * 8];
|
||||||
|
|
||||||
for hash in &mut buffer {
|
for hash in &mut buffer {
|
||||||
rng.fill_bytes(hash)
|
rng.fill(hash)
|
||||||
|
.expect("Unable to fill buffer with random data");
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer
|
buffer
|
||||||
@ -274,7 +271,7 @@ impl Drop for PrivateKey {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl PartialEq 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 {
|
fn eq(&self, other: &PrivateKey) -> bool {
|
||||||
if self.algorithm != other.algorithm {
|
if self.algorithm != other.algorithm {
|
||||||
return false;
|
return false;
|
||||||
@ -310,7 +307,7 @@ impl PartialOrd for PrivateKey {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Ord 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 {
|
fn cmp(&self, other: &PrivateKey) -> Ordering {
|
||||||
self.one_values
|
self.one_values
|
||||||
.cmp(&other.one_values)
|
.cmp(&other.one_values)
|
||||||
|
Reference in New Issue
Block a user