mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-04 20:24:10 +00:00
Add ScalarMult and BasepointMult impls for DecafPoint
This commit is contained in:
parent
084c29c4ed
commit
bf19df64f0
1 changed files with 19 additions and 0 deletions
19
src/decaf.rs
19
src/decaf.rs
|
|
@ -28,6 +28,9 @@ use subtle::CTAssignable;
|
|||
use core::ops::{Add, Sub, Neg};
|
||||
|
||||
use curve::ExtendedPoint;
|
||||
use curve::BasepointMult;
|
||||
use curve::ScalarMult;
|
||||
use scalar::Scalar;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Compressed points
|
||||
|
|
@ -181,6 +184,22 @@ impl<'a> Neg for &'a DecafPoint {
|
|||
}
|
||||
}
|
||||
|
||||
impl ScalarMult<Scalar> for DecafPoint {
|
||||
fn scalar_mult(&self, scalar: &Scalar) -> DecafPoint {
|
||||
DecafPoint(self.0.scalar_mult(scalar))
|
||||
}
|
||||
}
|
||||
|
||||
impl BasepointMult<Scalar> for DecafPoint {
|
||||
fn basepoint() -> DecafPoint {
|
||||
DecafPoint(constants::BASEPOINT)
|
||||
}
|
||||
|
||||
fn basepoint_mult(scalar: &Scalar) -> DecafPoint {
|
||||
DecafPoint(ExtendedPoint::basepoint_mult(scalar))
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Debug traits
|
||||
// ------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Reference in a new issue