mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-07 20:50:39 +00:00
Merge branch 'feature/add-sub-assign' into develop
This commit is contained in:
commit
00f3a20329
2 changed files with 30 additions and 0 deletions
17
src/curve.rs
17
src/curve.rs
|
|
@ -83,6 +83,7 @@ use collections::Vec;
|
||||||
use core::fmt::Debug;
|
use core::fmt::Debug;
|
||||||
use core::iter::Iterator;
|
use core::iter::Iterator;
|
||||||
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 core::ops::Index;
|
use core::ops::Index;
|
||||||
|
|
||||||
|
|
@ -802,6 +803,12 @@ impl<'a,'b> Add<&'b ExtendedPoint> for &'a ExtendedPoint {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'b> AddAssign<&'b ExtendedPoint> for ExtendedPoint {
|
||||||
|
fn add_assign(&mut self, _rhs: &'b ExtendedPoint) {
|
||||||
|
*self = (self as &ExtendedPoint) + _rhs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'a,'b> Sub<&'b ExtendedPoint> for &'a ExtendedPoint {
|
impl<'a,'b> Sub<&'b ExtendedPoint> for &'a ExtendedPoint {
|
||||||
type Output = ExtendedPoint;
|
type Output = ExtendedPoint;
|
||||||
fn sub(self, other: &'b ExtendedPoint) -> ExtendedPoint {
|
fn sub(self, other: &'b ExtendedPoint) -> ExtendedPoint {
|
||||||
|
|
@ -809,6 +816,16 @@ impl<'a,'b> Sub<&'b ExtendedPoint> for &'a ExtendedPoint {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'b> SubAssign<&'b ExtendedPoint> for ExtendedPoint {
|
||||||
|
fn sub_assign(&mut self, _rhs: &'b ExtendedPoint) {
|
||||||
|
*self = (self as &ExtendedPoint) - _rhs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
// Negation
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
impl<'a> Neg for &'a ExtendedPoint {
|
impl<'a> Neg for &'a ExtendedPoint {
|
||||||
type Output = ExtendedPoint;
|
type Output = ExtendedPoint;
|
||||||
|
|
||||||
|
|
|
||||||
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;
|
||||||
|
|
@ -432,6 +433,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;
|
||||||
|
|
||||||
|
|
@ -440,6 +447,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