fixes
This commit is contained in:
parent
3c61f6f043
commit
59c2e1e6dd
5 changed files with 8 additions and 10 deletions
|
|
@ -4,9 +4,7 @@ extern crate test;
|
|||
|
||||
mod benches {
|
||||
use test::{black_box, Bencher};
|
||||
use crypto_bigint::U448;
|
||||
use diffie_hellman::{Public, Secret, U256};
|
||||
use diffie_hellman::edwards::{ed448_clamp, ED448_GOLDILOCKS};
|
||||
use diffie_hellman::montgomery::{clamp_u256, CURVE_25519};
|
||||
use diffie_hellman::traits::{Curve, Point};
|
||||
|
||||
|
|
|
|||
|
|
@ -156,6 +156,7 @@ where
|
|||
}
|
||||
|
||||
fn double(&self) -> Self {
|
||||
/*
|
||||
let a = self.x.add_mod(&self.y, &self.curve.p);
|
||||
let b = a.mul_mod(&a, &self.curve.p);
|
||||
let c = self.x.mul_mod(&self.x, &self.curve.p);
|
||||
|
|
@ -174,6 +175,9 @@ where
|
|||
z,
|
||||
curve: self.curve,
|
||||
}
|
||||
*/
|
||||
|
||||
self.add(self, self)
|
||||
}
|
||||
|
||||
fn mul(&self, x: &N) -> Self {
|
||||
|
|
@ -200,7 +204,7 @@ where
|
|||
+ ConstZero
|
||||
+ crypto_bigint::subtle::ConstantTimeEq,
|
||||
{
|
||||
fn get_y(self) -> N {
|
||||
pub fn get_y(self) -> N {
|
||||
self.y
|
||||
.mul_mod(&self.z.inv_mod(&self.curve.p).unwrap(), &self.curve.p)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,9 +75,6 @@ impl From<U256> for Secret {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
const BIG_VALID_VALUE: U256 = U256::ONE
|
||||
.shl(251)
|
||||
.add_mod(&U256::from_u64(1232039487203 * 8), &CURVE_25519.p);
|
||||
|
||||
#[test]
|
||||
fn public_key_derivation() {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
use crate::traits::{Curve, Point};
|
||||
use crypto_bigint::subtle::{Choice, ConstantTimeEq};
|
||||
use crypto_bigint::{AddMod, ConstChoice, Encoding, NonZero, SubMod, U256};
|
||||
use crypto_bigint::{AddMod, Encoding, NonZero, SubMod, U256};
|
||||
use crypto_bigint::{Integer, InvMod, MulMod};
|
||||
use std::fmt::{Display, Formatter};
|
||||
use std::ops::{Add, Div, Mul};
|
||||
use std::ops::{Div, Mul};
|
||||
|
||||
/// A curve of the form `By^2 = x^3 + Ax^2 + x`
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use crypto_bigint::{AddMod, InvMod, MulMod, SubMod, U256};
|
||||
use crypto_bigint::{AddMod, InvMod, MulMod, SubMod};
|
||||
|
||||
pub trait Curve<T, N>
|
||||
where
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue