Feature-gate box syntax on both std and basepoint_table_creation.

This commit is contained in:
Isis Lovecruft 2017-03-14 03:21:32 +00:00
parent 2610ab872a
commit 26a77cd7f3
Failed to extract signature
2 changed files with 7 additions and 3 deletions

View file

@ -90,9 +90,9 @@ use subtle::CTAssignable;
use subtle::CTEq;
use subtle::CTNegatable;
#[cfg(not(feature = "std"))]
#[cfg(all(not(feature = "std"), feature = "basepoint_table_creation"))]
use collections::boxed::Box;
#[cfg(feature = "std")]
#[cfg(all(feature = "std", feature = "basepoint_table_creation"))]
use std::boxed::Box;
// ------------------------------------------------------------------------

View file

@ -31,7 +31,9 @@ use subtle::CTNegatable;
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 curve::ExtendedPoint;
@ -272,6 +274,7 @@ pub struct DecafBasepointTable(EdwardsBasepointTable);
impl DecafBasepointTable {
/// Create a precomputed table of multiples of the given `basepoint`.
#[cfg(feature = "basepoint_table_creation")]
pub fn create(basepoint: &DecafPoint) -> Box<DecafBasepointTable> {
let edwards_table = EdwardsBasepointTable::create(&basepoint.0);
box DecafBasepointTable(*edwards_table)
@ -381,6 +384,7 @@ mod test {
/// Test basepoint_mult versus a newly-generated DecafBasepointTable
#[test]
#[cfg(feature = "basepoint_table_creation")]
fn basepoint_mult_vs_decafbasepointtable() {
let table = DecafBasepointTable::create(&DecafPoint::basepoint());
let mut rng = OsRng::new().unwrap();