Merge branch 'release/0.6.2'

This commit is contained in:
Isis Lovecruft 2018-03-26 02:36:18 +00:00
commit 93149bc071
Failed to extract signature
4 changed files with 22 additions and 23 deletions

View file

@ -1,6 +1,6 @@
[package] [package]
name = "ed25519-dalek" name = "ed25519-dalek"
version = "0.6.1" version = "0.6.2"
authors = ["Isis Lovecruft <isis@patternsinthevoid.net>"] authors = ["Isis Lovecruft <isis@patternsinthevoid.net>"]
readme = "README.md" readme = "README.md"
license = "BSD-3-Clause" license = "BSD-3-Clause"
@ -13,14 +13,14 @@ description = "Fast and efficient ed25519 EdDSA key generations, signing, and ve
exclude = [ ".gitignore", "TESTVECTORS", "res/*" ] exclude = [ ".gitignore", "TESTVECTORS", "res/*" ]
[badges] [badges]
travis-ci = { repository = "isislovecruft/ed25519-dalek", branch = "master"} travis-ci = { repository = "dalek-cryptography/ed25519-dalek", branch = "master"}
[dependencies.curve25519-dalek] [dependencies.curve25519-dalek]
version = "0.14" version = "0.16"
default-features = false default-features = false
[dependencies.subtle] [dependencies.subtle]
version = "0.5" version = "0.6"
default-features = false default-features = false
[dependencies.rand] [dependencies.rand]
@ -53,8 +53,8 @@ bincode = "^0.9"
[features] [features]
default = ["std"] default = ["std"]
std = ["rand", "curve25519-dalek/std", "failure/std"] std = ["rand", "subtle/std", "curve25519-dalek/std", "failure/std"]
bench = [] bench = []
nightly = ["curve25519-dalek/nightly"] nightly = ["curve25519-dalek/nightly", "subtle/nightly"]
asm = ["sha2/asm"] asm = ["sha2/asm"]
yolocrypto = ["curve25519-dalek/yolocrypto"]

View file

@ -151,8 +151,6 @@ To enable [serde](https://serde.rs) support, build `ed25519-dalek` with:
# TODO # TODO
* Maybe add methods to make exporting keys for backup easier. Maybe using
serde?
* We can probably make this go even faster if we implement SHA512, * We can probably make this go even faster if we implement SHA512,
rather than using the rust-crypto implementation whose API requires rather than using the rust-crypto implementation whose API requires
that we allocate memory and memzero it before mutating to store the that we allocate memory and memzero it before mutating to store the

View file

@ -33,10 +33,10 @@ use generic_array::typenum::U64;
use curve25519_dalek::constants; use curve25519_dalek::constants;
use curve25519_dalek::edwards::CompressedEdwardsY; use curve25519_dalek::edwards::CompressedEdwardsY;
use curve25519_dalek::edwards::ExtendedPoint; use curve25519_dalek::edwards::EdwardsPoint;
use curve25519_dalek::scalar::Scalar; use curve25519_dalek::scalar::Scalar;
use subtle::slices_equal; use subtle::ConstantTimeEq;
use errors::DecodingError; use errors::DecodingError;
use errors::InternalError; use errors::InternalError;
@ -72,7 +72,7 @@ pub const EXPANDED_SECRET_KEY_LENGTH: usize = EXPANDED_SECRET_KEY_KEY_LENGTH + E
#[derive(Copy)] #[derive(Copy)]
#[repr(C)] #[repr(C)]
pub struct Signature { pub struct Signature {
/// `r` is an `ExtendedPoint`, formed by using an hash function with /// `r` is an `EdwardsPoint`, formed by using an hash function with
/// 512-bits output to produce the digest of: /// 512-bits output to produce the digest of:
/// ///
/// - the nonce half of the `ExpandedSecretKey`, and /// - the nonce half of the `ExpandedSecretKey`, and
@ -80,7 +80,7 @@ pub struct Signature {
/// ///
/// This digest is then interpreted as a `Scalar` and reduced into an /// This digest is then interpreted as a `Scalar` and reduced into an
/// element in /l. The scalar is then multiplied by the distinguished /// element in /l. The scalar is then multiplied by the distinguished
/// basepoint to produce `r`, and `ExtendedPoint`. /// basepoint to produce `r`, and `EdwardsPoint`.
pub (crate) r: CompressedEdwardsY, pub (crate) r: CompressedEdwardsY,
/// `s` is a `Scalar`, formed by using an hash function with 512-bits output /// `s` is a `Scalar`, formed by using an hash function with 512-bits output
@ -561,7 +561,7 @@ impl ExpandedSecretKey {
let mut hash: [u8; 64] = [0u8; 64]; let mut hash: [u8; 64] = [0u8; 64];
let mesg_digest: Scalar; let mesg_digest: Scalar;
let hram_digest: Scalar; let hram_digest: Scalar;
let r: ExtendedPoint; let r: EdwardsPoint;
let s: Scalar; let s: Scalar;
h.input(&self.nonce); h.input(&self.nonce);
@ -687,7 +687,7 @@ impl PublicKey {
/// Convert this public key to its underlying extended twisted Edwards coordinate. /// Convert this public key to its underlying extended twisted Edwards coordinate.
#[inline] #[inline]
fn decompress(&self) -> Option<ExtendedPoint> { fn decompress(&self) -> Option<EdwardsPoint> {
self.0.decompress() self.0.decompress()
} }
@ -726,8 +726,8 @@ impl PublicKey {
use curve25519_dalek::edwards::vartime; use curve25519_dalek::edwards::vartime;
let mut h: D = D::default(); let mut h: D = D::default();
let mut a: ExtendedPoint; let mut a: EdwardsPoint;
let ao: Option<ExtendedPoint>; let ao: Option<EdwardsPoint>;
let mut digest: [u8; 64] = [0u8; 64]; let mut digest: [u8; 64] = [0u8; 64];
ao = self.decompress(); ao = self.decompress();
@ -746,9 +746,9 @@ impl PublicKey {
digest.copy_from_slice(h.fixed_result().as_slice()); digest.copy_from_slice(h.fixed_result().as_slice());
let digest_reduced: Scalar = Scalar::from_bytes_mod_order_wide(&digest); let digest_reduced: Scalar = Scalar::from_bytes_mod_order_wide(&digest);
let r: ExtendedPoint = vartime::double_scalar_mult_basepoint(&digest_reduced, &a, &signature.s); let r: EdwardsPoint = vartime::double_scalar_mul_basepoint(&digest_reduced, &a, &signature.s);
slices_equal(signature.r.as_bytes(), r.compress().as_bytes()) == 1 (signature.r.as_bytes()).ct_eq(r.compress().as_bytes()).unwrap_u8() == 1
} }
} }
@ -937,7 +937,7 @@ mod test {
use std::fs::File; use std::fs::File;
use std::string::String; use std::string::String;
use std::vec::Vec; use std::vec::Vec;
use curve25519_dalek::edwards::ExtendedPoint; use curve25519_dalek::edwards::EdwardsPoint;
use rand::OsRng; use rand::OsRng;
use hex::FromHex; use hex::FromHex;
use sha2::Sha512; use sha2::Sha512;
@ -973,8 +973,8 @@ mod test {
fn unmarshal_marshal() { // TestUnmarshalMarshal fn unmarshal_marshal() { // TestUnmarshalMarshal
let mut cspring: OsRng; let mut cspring: OsRng;
let mut keypair: Keypair; let mut keypair: Keypair;
let mut x: Option<ExtendedPoint>; let mut x: Option<EdwardsPoint>;
let a: ExtendedPoint; let a: EdwardsPoint;
let public: PublicKey; let public: PublicKey;
cspring = OsRng::new().unwrap(); cspring = OsRng::new().unwrap();

View file

@ -16,10 +16,11 @@
use core::fmt; use core::fmt;
use core::fmt::Display; use core::fmt::Display;
/// Internal errors. Most application-level developer will likely not /// Internal errors. Most application-level developers will likely not
/// need to pay any attention to these. /// need to pay any attention to these.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)] #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub (crate) enum InternalError { pub (crate) enum InternalError {
#[allow(dead_code)]
PointDecompressionError, PointDecompressionError,
ScalarFormatError, ScalarFormatError,
/// An error in the length of bytes handed to a constructor. /// An error in the length of bytes handed to a constructor.