mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-06 20:41:14 +00:00
Implement {AddAssign, SubAssign} for DecafPoint.
This commit is contained in:
parent
27e4ea5181
commit
e374451249
1 changed files with 13 additions and 0 deletions
13
src/decaf.rs
13
src/decaf.rs
|
|
@ -36,6 +36,7 @@ use subtle::CTAssignable;
|
||||||
use subtle::CTNegatable;
|
use subtle::CTNegatable;
|
||||||
|
|
||||||
use core::ops::{Add, Sub, Neg};
|
use core::ops::{Add, Sub, Neg};
|
||||||
|
use core::ops::{AddAssign, SubAssign};
|
||||||
use core::ops::{Mul, MulAssign};
|
use core::ops::{Mul, MulAssign};
|
||||||
|
|
||||||
use curve;
|
use curve;
|
||||||
|
|
@ -427,6 +428,12 @@ impl<'a, 'b> Add<&'b DecafPoint> for &'a DecafPoint {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'b> AddAssign<&'b DecafPoint> for DecafPoint {
|
||||||
|
fn add_assign(&mut self, _rhs: &DecafPoint) {
|
||||||
|
*self = (self as &DecafPoint) + _rhs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'a, 'b> Sub<&'b DecafPoint> for &'a DecafPoint {
|
impl<'a, 'b> Sub<&'b DecafPoint> for &'a DecafPoint {
|
||||||
type Output = DecafPoint;
|
type Output = DecafPoint;
|
||||||
|
|
||||||
|
|
@ -435,6 +442,12 @@ impl<'a, 'b> Sub<&'b DecafPoint> for &'a DecafPoint {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'b> SubAssign<&'b DecafPoint> for DecafPoint {
|
||||||
|
fn sub_assign(&mut self, _rhs: &DecafPoint) {
|
||||||
|
*self = (self as &DecafPoint) - _rhs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'a> Neg for &'a DecafPoint {
|
impl<'a> Neg for &'a DecafPoint {
|
||||||
type Output = DecafPoint;
|
type Output = DecafPoint;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue