Use box syntax instead of an unsafe block

This commit is contained in:
Henry de Valence 2017-03-06 22:08:32 -08:00
parent 640f40287f
commit a4ed8e2b81
2 changed files with 2 additions and 7 deletions

View file

@ -834,13 +834,7 @@ impl BasepointTable {
pub fn create(basepoint: &ExtendedPoint) -> Box<BasepointTable> {
// Create the table storage
// XXX this is a dirty hack, does placement new work here?
let mut table: Box<[[AffineNielsPoint; 8]; 32]> = unsafe {
Box::from_raw(
Box::into_raw( // 8 * 32 = 256
vec![AffineNielsPoint::identity(); 256].into_boxed_slice()
) as *mut [[AffineNielsPoint; 8]; 32]
)
};
let mut table = box [[AffineNielsPoint::identity(); 8]; 32];
let mut P = basepoint.clone();
for i in 0..32 {
// P = (16^2)^i * B

View file

@ -13,6 +13,7 @@
#![cfg_attr(not(feature = "std"), feature(collections))]
#![allow(unused_features)]
#![feature(test)]
#![feature(box_syntax)]
#![deny(missing_docs)] // refuse to compile if documentation is missing
//! # curve25519-dalek