Add ScalarMult and BasepointMult impls for DecafPoint

This commit is contained in:
Henry & Isis 2017-02-20 03:06:16 -08:00 committed by Henry de Valence
parent 084c29c4ed
commit bf19df64f0

View file

@ -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
// ------------------------------------------------------------------------