mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-07 20:50:39 +00:00
Update to curve25519-dalek v0.3.0
Changes `curve25519_dalek::curve::CompressedPoint` -> `CompressedEdwardsY`
This commit is contained in:
parent
2084edef2c
commit
6269edb266
2 changed files with 8 additions and 8 deletions
|
|
@ -14,7 +14,7 @@ exclude = [ ".gitignore", "TESTVECTORS" ]
|
||||||
arrayref = "0.3.2"
|
arrayref = "0.3.2"
|
||||||
rust-crypto = "^0.2"
|
rust-crypto = "^0.2"
|
||||||
rand = "^0.3"
|
rand = "^0.3"
|
||||||
curve25519-dalek = "^0.1"
|
curve25519-dalek = "^0.3"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
rustc-serialize = "0.3"
|
rustc-serialize = "0.3"
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ use crypto::sha2::Sha512;
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
|
|
||||||
use curve25519_dalek::curve;
|
use curve25519_dalek::curve;
|
||||||
use curve25519_dalek::curve::CompressedPoint;
|
use curve25519_dalek::curve::CompressedEdwardsY;
|
||||||
use curve25519_dalek::curve::ExtendedPoint;
|
use curve25519_dalek::curve::ExtendedPoint;
|
||||||
use curve25519_dalek::curve::ProjectivePoint;
|
use curve25519_dalek::curve::ProjectivePoint;
|
||||||
use curve25519_dalek::scalar::Scalar;
|
use curve25519_dalek::scalar::Scalar;
|
||||||
|
|
@ -142,7 +142,7 @@ impl SecretKey {
|
||||||
let hram_digest: Scalar;
|
let hram_digest: Scalar;
|
||||||
let r: ExtendedPoint;
|
let r: ExtendedPoint;
|
||||||
let s: Scalar;
|
let s: Scalar;
|
||||||
let t: CompressedPoint;
|
let t: CompressedEdwardsY;
|
||||||
|
|
||||||
let secret_key: &[u8; 32] = array_ref!(&self.0, 0, 32);
|
let secret_key: &[u8; 32] = array_ref!(&self.0, 0, 32);
|
||||||
let public_key: &[u8; 32] = array_ref!(&self.0, 32, 32);
|
let public_key: &[u8; 32] = array_ref!(&self.0, 32, 32);
|
||||||
|
|
@ -182,11 +182,11 @@ impl SecretKey {
|
||||||
|
|
||||||
/// An ed25519 public key.
|
/// An ed25519 public key.
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
pub struct PublicKey(pub CompressedPoint);
|
pub struct PublicKey(pub CompressedEdwardsY);
|
||||||
|
|
||||||
impl Debug for PublicKey {
|
impl Debug for PublicKey {
|
||||||
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
||||||
write!(f, "PublicKey( CompressedPoint( {:?} ))", self.0)
|
write!(f, "PublicKey( CompressedEdwardsY( {:?} ))", self.0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -202,7 +202,7 @@ impl PublicKey {
|
||||||
/// # Warning
|
/// # Warning
|
||||||
///
|
///
|
||||||
/// The caller is responsible for ensuring that the bytes passed into this
|
/// The caller is responsible for ensuring that the bytes passed into this
|
||||||
/// method actually represent a `curve25519_dalek::curve::CompressedPoint`
|
/// method actually represent a `curve25519_dalek::curve::CompressedEdwardsY`
|
||||||
/// and that said compressed point is actually a point on the curve.
|
/// and that said compressed point is actually a point on the curve.
|
||||||
///
|
///
|
||||||
/// # Example
|
/// # Example
|
||||||
|
|
@ -224,7 +224,7 @@ impl PublicKey {
|
||||||
#[inline]
|
#[inline]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
fn from_bytes(bytes: &[u8]) -> PublicKey {
|
fn from_bytes(bytes: &[u8]) -> PublicKey {
|
||||||
PublicKey(CompressedPoint(*array_ref!(bytes, 0, 32)))
|
PublicKey(CompressedEdwardsY(*array_ref!(bytes, 0, 32)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Convert this public key to its underlying extended twisted Edwards coordinate.
|
/// Convert this public key to its underlying extended twisted Edwards coordinate.
|
||||||
|
|
@ -325,7 +325,7 @@ impl Keypair {
|
||||||
}
|
}
|
||||||
|
|
||||||
Keypair{
|
Keypair{
|
||||||
public: PublicKey(CompressedPoint(pk)),
|
public: PublicKey(CompressedEdwardsY(pk)),
|
||||||
secret: SecretKey(sk),
|
secret: SecretKey(sk),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue