mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-05 20:30:57 +00:00
Feature-gate box syntax on both std and basepoint_table_creation.
This commit is contained in:
parent
2610ab872a
commit
26a77cd7f3
2 changed files with 7 additions and 3 deletions
|
|
@ -90,9 +90,9 @@ use subtle::CTAssignable;
|
||||||
use subtle::CTEq;
|
use subtle::CTEq;
|
||||||
use subtle::CTNegatable;
|
use subtle::CTNegatable;
|
||||||
|
|
||||||
#[cfg(not(feature = "std"))]
|
#[cfg(all(not(feature = "std"), feature = "basepoint_table_creation"))]
|
||||||
use collections::boxed::Box;
|
use collections::boxed::Box;
|
||||||
#[cfg(feature = "std")]
|
#[cfg(all(feature = "std", feature = "basepoint_table_creation"))]
|
||||||
use std::boxed::Box;
|
use std::boxed::Box;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,9 @@ use subtle::CTNegatable;
|
||||||
|
|
||||||
use core::ops::{Add, Sub, Neg};
|
use core::ops::{Add, Sub, Neg};
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(all(not(feature = "std"), feature = "basepoint_table_creation"))]
|
||||||
|
use collections::boxed::Box;
|
||||||
|
#[cfg(all(feature = "std", feature = "basepoint_table_creation"))]
|
||||||
use std::boxed::Box;
|
use std::boxed::Box;
|
||||||
|
|
||||||
use curve::ExtendedPoint;
|
use curve::ExtendedPoint;
|
||||||
|
|
@ -272,6 +274,7 @@ pub struct DecafBasepointTable(EdwardsBasepointTable);
|
||||||
|
|
||||||
impl DecafBasepointTable {
|
impl DecafBasepointTable {
|
||||||
/// Create a precomputed table of multiples of the given `basepoint`.
|
/// Create a precomputed table of multiples of the given `basepoint`.
|
||||||
|
#[cfg(feature = "basepoint_table_creation")]
|
||||||
pub fn create(basepoint: &DecafPoint) -> Box<DecafBasepointTable> {
|
pub fn create(basepoint: &DecafPoint) -> Box<DecafBasepointTable> {
|
||||||
let edwards_table = EdwardsBasepointTable::create(&basepoint.0);
|
let edwards_table = EdwardsBasepointTable::create(&basepoint.0);
|
||||||
box DecafBasepointTable(*edwards_table)
|
box DecafBasepointTable(*edwards_table)
|
||||||
|
|
@ -381,6 +384,7 @@ mod test {
|
||||||
|
|
||||||
/// Test basepoint_mult versus a newly-generated DecafBasepointTable
|
/// Test basepoint_mult versus a newly-generated DecafBasepointTable
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(feature = "basepoint_table_creation")]
|
||||||
fn basepoint_mult_vs_decafbasepointtable() {
|
fn basepoint_mult_vs_decafbasepointtable() {
|
||||||
let table = DecafBasepointTable::create(&DecafPoint::basepoint());
|
let table = DecafBasepointTable::create(&DecafPoint::basepoint());
|
||||||
let mut rng = OsRng::new().unwrap();
|
let mut rng = OsRng::new().unwrap();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue