Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ring and lamport_sigs #9

Merged
merged 6 commits into from
Sep 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
language: rust
cache: cargo # https://docs.travis-ci.com/user/caching/#Rust-Cargo-cache

cache:
directories:
- $HOME/.cargo
- $HOME/protobuf
- $TRAVIS_BUILD_DIR/target

rust:
- stable
Expand All @@ -20,16 +25,13 @@ matrix:
before_script:
- rustup component add rustfmt-preview
script:
- cargo fmt --all -- --write-mode=diff
- env:
- NAME='clippy'
# use env so updating versions causes cache invalidation
- CLIPPY_VERSION=0.0.200
rust: nightly-2018-05-14
- cargo fmt --all -- --check
- env: NAME='clippy'
rust: nightly-2018-07-22
before_script:
- cargo install clippy --version $CLIPPY_VERSION || echo "clippy already installed"
- rustup component add clippy-preview
script:
- cargo clippy --all -- -D clippy
- cargo clippy --all --all-features -- -D clippy
- env: NAME='kcov'
sudo: required # travis-ci/travis-ci#9061
before_script:
Expand Down Expand Up @@ -57,3 +59,8 @@ script:
- cargo build --verbose --all-features
- cargo test --verbose --all-features
- cargo doc --verbose --all-features --no-deps

before_install:
- export PATH=$PATH:$HOME/protobuf/bin
- export PROTOC_VERSION=$(cat PROTOC_VERSION)
- bash install_protobuf.sh
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ homepage = "https://github.com/SpinResearch/merkle_sigs.rs"
repository = "https://github.com/SpinResearch/merkle_sigs.rs"

[dependencies]
ring = "^0.12.0"
lamport_sigs = "^0.5.0"
ring = "^0.13.0"
lamport_sigs = "^0.6.0"

[dependencies.merkle]
version = "^1.7.0"
version = "^1.10.0"
features = ["serialization-protobuf"]

[package.metadata.release]
Expand Down
1 change: 1 addition & 0 deletions PROTOC_VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.5.1
18 changes: 18 additions & 0 deletions install_protobuf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -e

PROTOC_VERSION=$(cat PROTOC_VERSION)

check_protoc_version () {
this_version=`protoc --version`
return `[ "libprotoc $PROTOC_VERSION" = "$this_version" ]`
}

if check_protoc_version; then
echo $PROTOC_VERSION detected.
exit
fi

wget https://github.com/google/protobuf/archive/v$PROTOC_VERSION.tar.gz
tar -xzvf v$PROTOC_VERSION.tar.gz
cd protobuf-$PROTOC_VERSION && ./autogen.sh && ./configure --prefix=$HOME/protobuf && make && make install
19 changes: 14 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
#![deny(missing_docs, missing_debug_implementations, missing_copy_implementations, trivial_casts,
trivial_numeric_casts, unsafe_code, unstable_features, unused_import_braces,
unused_qualifications)]
#![deny(
missing_docs,
missing_debug_implementations,
missing_copy_implementations,
trivial_casts,
trivial_numeric_casts,
unsafe_code,
unstable_features,
unused_import_braces,
unused_qualifications
)]

//! `merkle_sigs` implements Merkle signatures in Rust.

Expand All @@ -13,8 +21,9 @@ mod signatures;
pub use merkle::Proof;

pub use lamport_sigs::PublicKey;
pub use signatures::{sign_data_vec, verify_data_vec_signature, MerklePublicKey, MerkleSignature,
MerkleSignedData};
pub use signatures::{
sign_data_vec, verify_data_vec_signature, MerklePublicKey, MerkleSignature, MerkleSignedData,
};

#[cfg(test)]
mod tests;
4 changes: 2 additions & 2 deletions src/signatures.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use lamport_sigs::{LamportSignatureData, PrivateKey, PublicKey};
use lamport_sigs::{PrivateKey, PublicKey};
use merkle::{Hashable, MerkleTree, Proof};
use ring::digest::{Algorithm, Context};
use std::io;
Expand Down Expand Up @@ -31,7 +31,7 @@ impl Into<Vec<u8>> for MerklePublicKey {
}

/// A type alias defining a Merkle signature. That includes both the Lamport leaf signature and inclusion proof.
pub type MerkleSignature = (LamportSignatureData, Proof<MerklePublicKey>);
pub type MerkleSignature = (Vec<Vec<u8>>, Proof<MerklePublicKey>);

/// A type alias defining Merkle signed data. That includes the data being signed along with the signature.
pub type MerkleSignedData<T> = (Vec<T>, MerkleSignature);
Expand Down
4 changes: 2 additions & 2 deletions src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#![cfg(test)]
use Proof;
use PublicKey;
use ring::digest::{Algorithm, SHA512};
use signatures::{sign_data_vec, verify_data_vec_signature, MerklePublicKey};
use std::collections::HashSet;
use Proof;
use PublicKey;

#[allow(non_upper_case_globals)]
static digest: &'static Algorithm = &SHA512;
Expand Down