mirror of
https://github.com/saymrwulf/risc0-curve25519-dalek-source.git
synced 2026-09-08 20:40:32 +00:00
Merge branch 'fix/166-scalar-random-nostd' into develop
This commit is contained in:
commit
16f00cac16
4 changed files with 12 additions and 2 deletions
|
|
@ -119,7 +119,10 @@ use scalar_mul::window::LookupTable;
|
||||||
|
|
||||||
use traits::{Identity, IsIdentity};
|
use traits::{Identity, IsIdentity};
|
||||||
use traits::ValidityCheck;
|
use traits::ValidityCheck;
|
||||||
|
|
||||||
|
#[cfg(any(feature = "alloc", feature = "std"))]
|
||||||
use traits::MultiscalarMul;
|
use traits::MultiscalarMul;
|
||||||
|
#[cfg(any(feature = "alloc", feature = "std"))]
|
||||||
use traits::VartimeMultiscalarMul;
|
use traits::VartimeMultiscalarMul;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,9 @@ use scalar::Scalar;
|
||||||
|
|
||||||
use curve_models::CompletedPoint;
|
use curve_models::CompletedPoint;
|
||||||
|
|
||||||
use traits::{Identity, MultiscalarMul, VartimeMultiscalarMul};
|
use traits::Identity;
|
||||||
|
#[cfg(any(feature = "alloc", feature = "std"))]
|
||||||
|
use traits::{MultiscalarMul, VartimeMultiscalarMul};
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
// Compressed points
|
// Compressed points
|
||||||
|
|
|
||||||
|
|
@ -516,7 +516,6 @@ impl Scalar {
|
||||||
/// let mut csprng: OsRng = OsRng::new().unwrap();
|
/// let mut csprng: OsRng = OsRng::new().unwrap();
|
||||||
/// let a: Scalar = Scalar::random(&mut csprng);
|
/// let a: Scalar = Scalar::random(&mut csprng);
|
||||||
/// # }
|
/// # }
|
||||||
#[cfg(feature = "std")]
|
|
||||||
pub fn random<T: Rng + CryptoRng>(rng: &mut T) -> Self {
|
pub fn random<T: Rng + CryptoRng>(rng: &mut T) -> Self {
|
||||||
let mut scalar_bytes = [0u8; 64];
|
let mut scalar_bytes = [0u8; 64];
|
||||||
rng.fill(&mut scalar_bytes);
|
rng.fill(&mut scalar_bytes);
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,16 @@
|
||||||
|
|
||||||
#![allow(non_snake_case)]
|
#![allow(non_snake_case)]
|
||||||
|
|
||||||
|
#[cfg(any(feature = "alloc", feature = "std"))]
|
||||||
use core::borrow::Borrow;
|
use core::borrow::Borrow;
|
||||||
|
|
||||||
|
#[cfg(any(feature = "alloc", feature = "std"))]
|
||||||
use edwards::EdwardsPoint;
|
use edwards::EdwardsPoint;
|
||||||
|
#[cfg(any(feature = "alloc", feature = "std"))]
|
||||||
use scalar::Scalar;
|
use scalar::Scalar;
|
||||||
|
#[cfg(any(feature = "alloc", feature = "std"))]
|
||||||
use traits::MultiscalarMul;
|
use traits::MultiscalarMul;
|
||||||
|
#[cfg(any(feature = "alloc", feature = "std"))]
|
||||||
use traits::VartimeMultiscalarMul;
|
use traits::VartimeMultiscalarMul;
|
||||||
|
|
||||||
/// Perform multiscalar multiplication by the interleaved window
|
/// Perform multiscalar multiplication by the interleaved window
|
||||||
|
|
@ -40,6 +45,7 @@ use traits::VartimeMultiscalarMul;
|
||||||
///
|
///
|
||||||
/// [solution]: https://www.jstor.org/stable/2310929
|
/// [solution]: https://www.jstor.org/stable/2310929
|
||||||
/// [problem]: https://www.jstor.org/stable/2312273
|
/// [problem]: https://www.jstor.org/stable/2312273
|
||||||
|
#[cfg(any(feature = "alloc", feature = "std"))]
|
||||||
pub struct Straus {}
|
pub struct Straus {}
|
||||||
|
|
||||||
#[cfg(any(feature = "alloc", feature = "std"))]
|
#[cfg(any(feature = "alloc", feature = "std"))]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue