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

Remove auto-generated schemata #69

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
603882f
Small Rustfmt formatting fix to build.rs
psivesely Mar 15, 2018
5263953
Initial barycentric Langrange interpolation
psivesely Mar 16, 2018
be20e77
Use barycentric Lagrange interpolation in all cases.
romac Mar 19, 2018
e39bdaf
Ensure there is at least one point in QuickCheck tests
romac Mar 19, 2018
a2dafcf
Use Horner's method for evaluating polynomials
psivesely Mar 15, 2018
0b42b6b
Note algorithm in encode_secret_byte docstring
psivesely Mar 15, 2018
5a9bfb9
Update rand to ^0.4.2
psivesely Mar 16, 2018
b34a209
Add TODO note on unreleased Rng::try_fill_bytes
psivesely Mar 21, 2018
ecb22aa
Remove `ShareIdentifierTooBig` error and validation
psivesely Mar 26, 2018
2baa8ab
Remove `DuplicateShareData` error and validation
psivesely Mar 26, 2018
10209b6
Add ErrorKind::ShareParsingInvalidShareThreshold
psivesely Mar 27, 2018
b48a74a
Simplify threshold consistency validation
psivesely Mar 27, 2018
c7f2742
Fix arg order missing shares validation
psivesely Mar 27, 2018
6d04a58
MissingShares should take `u8` for `required` arg
psivesely Mar 27, 2018
8ab91bb
More specific validation error when share thresholds mismatch
psivesely Mar 27, 2018
fefd5ab
Validate shares have the same data length
psivesely Mar 27, 2018
51f77fa
Disable `dss` benchmarks until we expose the module.
romac Mar 28, 2018
5ee3cf2
Change signatures of share validation fns
psivesely Mar 29, 2018
2df49c5
Standardize validation var identifier on
psivesely Mar 29, 2018
8813418
Simplify share threshold and secret length consistency validation
psivesely Mar 29, 2018
07de9be
Validation consistency between format & validation modules
psivesely Mar 29, 2018
463d42b
Minor improvement to validation
psivesely Mar 29, 2018
a6ff8a7
Adds `no_more_than_five` formatter
psivesely Mar 29, 2018
12cefb1
Rustfmt updates + refactor Travis configuration (#60)
psivesely Apr 2, 2018
a96c806
Add rust-toolchain file
romac Apr 16, 2018
3d7bf8d
Add EditorConfig configuration file
romac Apr 16, 2018
288d704
Add back Cargo.lock
romac Apr 16, 2018
625f5e3
Add @nvesely to the list of authors
romac Apr 16, 2018
c5ac23a
Add license name to README, and update year
romac Apr 16, 2018
4cdf06d
Add support for custom RNGs in SSS and WrappedSecrets (#64)
ebkalderon May 4, 2018
83651a2
Correct copy-pasted doc comment for split_secret_rng
ebkalderon May 4, 2018
cbf6dcc
Fix wrong validation of threshold
romac May 11, 2018
380af14
* Remove auto-generated schemata
dingxiangfei2009 May 17, 2018
a7fb57f
pin protoc version to 3.5.1
dingxiangfei2009 May 17, 2018
badb04d
another attempt to fix build with the new protobuf, but blocked by me…
Jun 19, 2018
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
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4

[*.md]
trim_trailing_whitespace = false
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
# Will have compiled files and executables
/target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

Expand Down
66 changes: 45 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,62 @@

sudo: required

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

rust:
- stable
- beta
- nightly

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:
- rust: nightly
- env: NAME='nightly'
- env: NAME='kcov'
- env: NAME='rustfmt'
include:
- env: NAME='nightly'
rust: nightly
- env: NAME='rustfmt'
rust: nightly
before_script:
- rustup component add rustfmt-preview
- touch src/proto/version.rs
- touch src/proto/dss/metadata.rs src/proto/dss/secret.rs src/proto/dss/share.rs
- touch src/proto/wrapped/secret.rs src/proto/wrapped/share.rs
script:
- cargo fmt --all -- --check
- env: NAME='kcov'
sudo: required # travis-ci/travis-ci#9061
before_script:
- cargo install cargo-update || echo "cargo-update already installed"
- cargo install cargo-kcov || echo "cargo-kcov already installed"
- cargo install-update -a
script:
- cargo kcov --print-install-kcov-sh | sh
- cargo update # Creates `Cargo.lock` needed by next command
- cargo kcov --verbose --features dss --coveralls -- --verify --exclude-pattern=/.cargo,/usr/lib,src/proto
addons:
apt:
packages:
- libcurl4-openssl-dev
- libdw-dev
- binutils-dev
- libiberty-dev
- zlib1g-dev

env:
global:
- RUSTFLAGS="-C link-dead-code"

addons:
apt:
packages:
- libcurl4-openssl-dev
- libdw-dev
- cmake
- g++
- pkg-config
- binutils-dev
- libiberty-dev

script:
- export PATH=$PATH:$HOME/protobuf/bin
- cargo build --verbose --all-features
- cargo test --verbose --all-features
- cargo doc --verbose --all-features

after_success:
- cargo install cargo-kcov
- cargo kcov --print-install-kcov-sh | sh
- cargo kcov --verbose --features dss --coveralls -- --verify --exclude-pattern=/.cargo,/usr/lib,src/proto

before_install:
- bash install_protobuf.sh
14 changes: 10 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ authors = [
"Frederic Jacobs <[email protected]>",
"Romain Ruetschi <[email protected]>",
"Dylan Bourgeois <[email protected]>",
"Noah Vesely <[email protected]>",
"sellibitze"
]
description = "Implementation of threshold Shamir's secret sharing in the Rust programming language."
Expand All @@ -13,6 +14,8 @@ license = "BSD-3-Clause"
readme = "README.md"
build = "build.rs"

exclude = ["Cargo.lock"]

[badges]
travis-ci = { repository = "SpinResearch/RustySecrets", branch = "master" }
coveralls = { repository = "SpinResearch/RustySecrets", branch = "master", service = "github" }
Expand All @@ -23,10 +26,13 @@ dss = []

[dependencies]
base64 = "0.9.0"
rand = "^0.3"
rand = "^0.4.2"
ring = "^0.12"
merkle_sigs = "^1.4"
protobuf = "^1.4"
merkle_sigs = "1.5.0"
protobuf = "^2.0.2"

[build-dependencies]
protoc-rust = "^2.0.2"

[dependencies.error-chain]
version = "0.11.0"
Expand All @@ -36,6 +42,7 @@ default-features = false
itertools = "^0.7"
quickcheck = "^0.4"
flate2 = "^0.2"
rand = "^0.4.2"

[profile.bench]
opt-level = 3
Expand Down Expand Up @@ -63,4 +70,3 @@ tag-prefix = "v"
tag-message = "Release version {{version}}."
doc-commit-message = "Update documentation."
dev-version-ext = "pre"

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2016, Spin Research
Copyright (c) 2016-2018, Spin Research
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ any security vulnerability in this code privately to anybody.**

## License

See [LICENSE](LICENSE).
RustySecrets is distributed under the BSD 3-Clause license. See the [LICENSE](LICENSE) file for more information.

## Vocabulary

Expand Down
23 changes: 16 additions & 7 deletions benches/ss1.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![cfg(test)]
#![feature(test)]
#![cfg(feature = "dss")]

extern crate rusty_secrets;
extern crate test;
Expand All @@ -9,37 +10,45 @@ mod shared;
mod ss1 {

use rusty_secrets::dss::ss1;
use test::{black_box, Bencher};
use shared;
use test::{black_box, Bencher};

macro_rules! bench_generate {
($name:ident, $k:expr, $n:expr, $secret:ident) => (
($name:ident, $k:expr, $n:expr, $secret:ident) => {
#[bench]
fn $name(b: &mut Bencher) {
let secret = shared::$secret();

b.iter(move || {
let shares = ss1::split_secret($k, $n, &secret, ss1::Reproducibility::reproducible(), &None).unwrap();
let shares = ss1::split_secret(
$k,
$n,
&secret,
ss1::Reproducibility::reproducible(),
&None,
).unwrap();
black_box(shares);
});
}
)
};
}

macro_rules! bench_recover {
($name:ident, $k:expr, $n:expr, $secret:ident) => (
($name:ident, $k:expr, $n:expr, $secret:ident) => {
#[bench]
fn $name(b: &mut Bencher) {
let secret = shared::$secret();
let all_shares = ss1::split_secret($k, $n, &secret, ss1::Reproducibility::reproducible(), &None).unwrap();
let all_shares =
ss1::split_secret($k, $n, &secret, ss1::Reproducibility::reproducible(), &None)
.unwrap();
let shares = &all_shares.into_iter().take($k).collect::<Vec<_>>().clone();

b.iter(|| {
let result = ss1::recover_secret(&shares.to_vec()).unwrap();
black_box(result);
});
}
)
};
}

bench_generate!(generate_1kb_3_5, 3, 5, secret_1kb);
Expand Down
10 changes: 5 additions & 5 deletions benches/sss.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ mod shared;

mod sss {

use test::{black_box, Bencher};
use rusty_secrets::sss;
use shared;
use test::{black_box, Bencher};

macro_rules! bench_generate {
($name:ident, $k:expr, $n:expr, $secret:ident, $signed:expr) => (
($name:ident, $k:expr, $n:expr, $secret:ident, $signed:expr) => {
#[bench]
fn $name(b: &mut Bencher) {
let secret = shared::$secret();
Expand All @@ -23,11 +23,11 @@ mod sss {
black_box(shares);
});
}
)
};
}

macro_rules! bench_recover {
($name:ident, $k:expr, $n:expr, $secret:ident, $signed:expr) => (
($name:ident, $k:expr, $n:expr, $secret:ident, $signed:expr) => {
#[bench]
fn $name(b: &mut Bencher) {
let secret = shared::$secret();
Expand All @@ -39,7 +39,7 @@ mod sss {
black_box(result);
});
}
)
};
}

bench_generate!(generate_1kb_3_5, 3, 5, secret_1kb, false);
Expand Down
11 changes: 6 additions & 5 deletions benches/thss.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![cfg(test)]
#![feature(test)]
#![cfg(feature = "dss")]

extern crate rusty_secrets;
extern crate test;
Expand All @@ -9,11 +10,11 @@ mod shared;
mod thss {

use rusty_secrets::dss::thss;
use test::{black_box, Bencher};
use shared;
use test::{black_box, Bencher};

macro_rules! bench_generate {
($name:ident, $k:expr, $n:expr, $secret:ident) => (
($name:ident, $k:expr, $n:expr, $secret:ident) => {
#[bench]
fn $name(b: &mut Bencher) {
let secret = shared::$secret();
Expand All @@ -23,11 +24,11 @@ mod thss {
black_box(shares);
});
}
)
};
}

macro_rules! bench_recover {
($name:ident, $k:expr, $n:expr, $secret:ident) => (
($name:ident, $k:expr, $n:expr, $secret:ident) => {
#[bench]
fn $name(b: &mut Bencher) {
let secret = shared::$secret();
Expand All @@ -39,7 +40,7 @@ mod thss {
black_box(result);
});
}
)
};
}

bench_generate!(generate_1kb_3_5, 3, 5, secret_1kb);
Expand Down
16 changes: 9 additions & 7 deletions benches/wrapped_secrets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,40 @@ mod shared;

mod wrapped_secrets {

use test::{black_box, Bencher};
use rusty_secrets::wrapped_secrets;
use shared;
use test::{black_box, Bencher};

macro_rules! bench_generate {
($name:ident, $k:expr, $n:expr, $secret:ident, $signed:expr) => (
($name:ident, $k:expr, $n:expr, $secret:ident, $signed:expr) => {
#[bench]
fn $name(b: &mut Bencher) {
let secret = shared::$secret();

b.iter(move || {
let shares = wrapped_secrets::split_secret($k, $n, secret, None, $signed).unwrap();
let shares =
wrapped_secrets::split_secret($k, $n, secret, None, $signed).unwrap();
black_box(shares);
});
}
)
};
}

macro_rules! bench_recover {
($name:ident, $k:expr, $n:expr, $secret:ident, $signed:expr) => (
($name:ident, $k:expr, $n:expr, $secret:ident, $signed:expr) => {
#[bench]
fn $name(b: &mut Bencher) {
let secret = shared::$secret();
let all_shares = wrapped_secrets::split_secret($k, $n, &secret, None, $signed).unwrap();
let all_shares =
wrapped_secrets::split_secret($k, $n, &secret, None, $signed).unwrap();
let shares = all_shares.into_iter().take($k).collect::<Vec<_>>();

b.iter(|| {
let result = wrapped_secrets::recover_secret(&shares, $signed).unwrap();
black_box(result);
});
}
)
};
}

bench_generate!(generate_1kb_3_5, 3, 5, secret_1kb, false);
Expand Down
Loading