mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-06 20:41:14 +00:00
Update subtle and curve25519-dalek dependencies.
This commit is contained in:
parent
ac3d974f70
commit
f790bd2ce1
3 changed files with 20 additions and 19 deletions
10
Cargo.toml
10
Cargo.toml
|
|
@ -16,11 +16,11 @@ exclude = [ ".gitignore", "TESTVECTORS", "res/*" ]
|
||||||
travis-ci = { repository = "dalek-cryptography/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"]
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
|
|
|
||||||
|
|
@ -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.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue