Skip to content

Commit

Permalink
Recrypt 0.7.0 (#73)
Browse files Browse the repository at this point in the history
* Api naming and visibility changes (#57)

* Api naming and visibility changes
* api::Api -> api::Recrypt
* api_480::Api480 -> api_480::Recrypt480
* ApiErr -> RecryptErr; RecryptErr is now publicly exported from the api/api_480 namespace
* api and api_480 PrivateKey::ENCODED_SIZE_BYTES now public

* [#63] Add prelude for easier importing (#64)

* [#65] update CI to rust 1.33.0; update proptest to ~0.9 (#66)

* Add to_private_key to DerivedSymmetricKey (#70)

* * added `to_private_key` to `DerivedSymmetricKey`
* make `PublicKey` arguments in public API borrows

* Update 480 bit api, tests and benches

* * added to_private_key to Recrypt480

* remove to_private_key from Recrypt480

* Move derive_private_key onto the apis

* Add as_vec function to make it easier to get to vec iterators

* Throw away the most significant bytes instead of the least, because it seems to make more sense to me

* Add known private key test for api480

* formatting

* Remove printlns

* Address Clint's concerns

* The hashable instance was unused. Remove it and add a different one. (#71)

* Change bytes property on SigningKeypair to return a borrow of the internal bytes (#72)

* releasing v0.7.0
  • Loading branch information
clintfred authored and coltfred committed Apr 30, 2019
1 parent f95bb3e commit 525e58d
Show file tree
Hide file tree
Showing 19 changed files with 364 additions and 213 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

## 0.7.0

### Public API changes
- [[#57](#57)]
- `api::Api` renamed to `api::Recrypt`
- `api_480::Api480` renamed to `api_480::Recrypt480`
- `ApiErr` renamed to `RecryptErr` and `RecryptErr` is now publicly exported
- `PrivateKey::ENCODED_SIZE_BYTES` is now pub
- [[#63](#63)] Added a prelude for easier importing of common types and traits
- `use recrypt::prelude::*`
- [[#70](#70)]
- `DerivedSymmetricKey` now has a `to_private_key`
- `PublicKey` APIs now take all arguments as borrows
- [[#71](#71)]
- provide `From<SigningKeyPair>` instance for `[u8; 64]`
- provide `Clone` for `PrivateKey`
- many wrapped byte types can be consumed to get the underlying bytes out without copying
- [[#72](#72)] `PublicSigningKey`'s `bytes()` method now returns a reference instead of copying

## 0.6.2

### Notable Internal Changes
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "recrypt"
version = "0.6.2"
version = "0.7.0"
authors = ["IroncCore Labs <info at ironcorelabs.com>"]
readme = "README.md"
license = "AGPL-3.0-only"
Expand Down Expand Up @@ -43,7 +43,7 @@ debug = false
lto = true

[dev-dependencies]
proptest = "~0.8"
proptest = "~0.9"
rand_chacha = "~0.1"
criterion = "~0.2"

Expand Down
34 changes: 17 additions & 17 deletions benches/api_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ extern crate criterion;
extern crate recrypt;

use criterion::Criterion;
use recrypt::api::Api as Api256;
use recrypt::api::CryptoOps;
use recrypt::api::Ed25519Ops;
use recrypt::api::KeyGenOps;
use recrypt::api_480::Api480;
use recrypt::api::Recrypt;
use recrypt::api_480::CryptoOps as CryptoOps480;
use recrypt::api_480::Ed25519Ops as Ed25519Ops480;
use recrypt::api_480::KeyGenOps as KeyGenOps480;
use recrypt::api_480::Recrypt480;
use std::cell::RefCell;

macro_rules! recrypt_bench {
Expand Down Expand Up @@ -44,7 +44,7 @@ macro_rules! recrypt_bench {
},
|(from, to)| {
api.borrow_mut()
.generate_transform_key(&from, to, &signing_keypair)
.generate_transform_key(&from, &to, &signing_keypair)
.unwrap();
},
);
Expand Down Expand Up @@ -77,7 +77,7 @@ macro_rules! recrypt_bench {
|| api.borrow_mut().gen_plaintext(),
|pt| {
api.borrow_mut()
.encrypt(&pt, pbk, &signing_keypair)
.encrypt(&pt, &pbk, &signing_keypair)
.unwrap();
},
);
Expand All @@ -88,7 +88,7 @@ macro_rules! recrypt_bench {
let (pvk, pbk) = api.generate_key_pair().unwrap();
let signing_keypair = api.generate_ed25519_key_pair();
let pt = api.gen_plaintext();
let encrypted_value = api.encrypt(&pt, pbk, &signing_keypair).unwrap();
let encrypted_value = api.encrypt(&pt, &pbk, &signing_keypair).unwrap();
b.iter(|| api.decrypt(encrypted_value.clone(), &pvk).unwrap());
});

Expand All @@ -99,13 +99,13 @@ macro_rules! recrypt_bench {
let signing_keypair = api.borrow_mut().generate_ed25519_key_pair();
let tk = api
.borrow_mut()
.generate_transform_key(&level_0_pvk, level_1_pbk, &signing_keypair)
.generate_transform_key(&level_0_pvk, &level_1_pbk, &signing_keypair)
.unwrap();
b.iter_with_setup(
|| {
let pt = api.borrow_mut().gen_plaintext();
api.borrow_mut()
.encrypt(&pt, level_0_pbk, &signing_keypair)
.encrypt(&pt, &level_0_pbk, &signing_keypair)
.unwrap()
},
|ev| {
Expand All @@ -123,14 +123,14 @@ macro_rules! recrypt_bench {
let (level_1_pvk, level_1_pbk) = api.borrow_mut().generate_key_pair().unwrap();
let tk = api
.borrow_mut()
.generate_transform_key(&level_0_pvk, level_1_pbk, &signing_keypair)
.generate_transform_key(&level_0_pvk, &level_1_pbk, &signing_keypair)
.unwrap();
b.iter_with_setup(
|| {
let pt = api.borrow_mut().gen_plaintext();
let ev = api
.borrow_mut()
.encrypt(&pt, level_0_pbk, &signing_keypair)
.encrypt(&pt, &level_0_pbk, &signing_keypair)
.unwrap();
api.borrow_mut()
.transform(ev, tk.clone(), &signing_keypair)
Expand All @@ -150,17 +150,17 @@ macro_rules! recrypt_bench {
let signing_keypair = api.borrow_mut().generate_ed25519_key_pair();
let tk_0_to_1 = api
.borrow_mut()
.generate_transform_key(&level_0_pvk, level_1_pbk, &signing_keypair)
.generate_transform_key(&level_0_pvk, &level_1_pbk, &signing_keypair)
.unwrap();
let tk_1_to_2 = api
.borrow_mut()
.generate_transform_key(&level_1_pvk, level_2_pbk, &signing_keypair)
.generate_transform_key(&level_1_pvk, &level_2_pbk, &signing_keypair)
.unwrap();
b.iter_with_setup(
|| {
let pt = api.borrow_mut().gen_plaintext();
api.borrow_mut()
.encrypt(&pt, level_0_pbk, &signing_keypair)
.encrypt(&pt, &level_0_pbk, &signing_keypair)
.unwrap()
},
|ev| {
Expand All @@ -183,18 +183,18 @@ macro_rules! recrypt_bench {
let (level_2_pvk, level_2_pbk) = api.borrow_mut().generate_key_pair().unwrap();
let tk_0_to_1 = api
.borrow_mut()
.generate_transform_key(&level_0_pvk, level_1_pbk, &signing_keypair)
.generate_transform_key(&level_0_pvk, &level_1_pbk, &signing_keypair)
.unwrap();
let tk_1_to_2 = api
.borrow_mut()
.generate_transform_key(&level_1_pvk, level_2_pbk, &signing_keypair)
.generate_transform_key(&level_1_pvk, &level_2_pbk, &signing_keypair)
.unwrap();
b.iter_with_setup(
|| {
let pt = api.borrow_mut().gen_plaintext();
let ev_to_0 = api
.borrow_mut()
.encrypt(&pt, level_0_pbk, &signing_keypair)
.encrypt(&pt, &level_0_pbk, &signing_keypair)
.unwrap();
let ev_to_1 = api
.borrow_mut()
Expand All @@ -213,8 +213,8 @@ macro_rules! recrypt_bench {
};
}

recrypt_bench! {api = Api480; suite_desc = criterion_benchmark_fp480; bits = "480"}
recrypt_bench! {api = Api256; suite_desc = criterion_benchmark_fp256; bits = "256"}
recrypt_bench! {api = Recrypt480; suite_desc = criterion_benchmark_fp480; bits = "480"}
recrypt_bench! {api = Recrypt; suite_desc = criterion_benchmark_fp256; bits = "256"}

criterion_group! {
name = benches;
Expand Down
Loading

0 comments on commit 525e58d

Please sign in to comment.