mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-07 20:50:39 +00:00
parent
9154e59ec1
commit
51f59565f5
3 changed files with 4 additions and 4 deletions
|
|
@ -87,7 +87,7 @@ use field::FieldElement;
|
||||||
use scalar::Scalar;
|
use scalar::Scalar;
|
||||||
use util::bytes_equal_ct;
|
use util::bytes_equal_ct;
|
||||||
use util::CTAssignable;
|
use util::CTAssignable;
|
||||||
use util::CTNegateable;
|
use util::CTNegatable;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
// Compressed points
|
// Compressed points
|
||||||
|
|
|
||||||
|
|
@ -803,7 +803,7 @@ impl FieldElement {
|
||||||
mod test {
|
mod test {
|
||||||
use field::*;
|
use field::*;
|
||||||
use test::Bencher;
|
use test::Bencher;
|
||||||
use util::CTNegateable;
|
use util::CTNegatable;
|
||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
fn bench_fieldelement_a_mul_a(b: &mut Bencher) {
|
fn bench_fieldelement_a_mul_a(b: &mut Bencher) {
|
||||||
|
|
|
||||||
|
|
@ -25,13 +25,13 @@ pub trait CTAssignable {
|
||||||
///
|
///
|
||||||
/// Note: it is not necessary to implement this trait, as a generic
|
/// Note: it is not necessary to implement this trait, as a generic
|
||||||
/// implementation is provided.
|
/// implementation is provided.
|
||||||
pub trait CTNegateable
|
pub trait CTNegatable
|
||||||
{
|
{
|
||||||
/// Conditionally negate an element if `choice == 1u8`.
|
/// Conditionally negate an element if `choice == 1u8`.
|
||||||
fn conditional_negate(&mut self, choice: u8);
|
fn conditional_negate(&mut self, choice: u8);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> CTNegateable for T
|
impl<T> CTNegatable for T
|
||||||
where T: CTAssignable, for<'a> &'a T: Neg<Output=T>
|
where T: CTAssignable, for<'a> &'a T: Neg<Output=T>
|
||||||
{
|
{
|
||||||
fn conditional_negate(&mut self, choice: u8) {
|
fn conditional_negate(&mut self, choice: u8) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue