From 894b44d0347253bdf3235a17a5dff64eb328e619 Mon Sep 17 00:00:00 2001 From: Sean Bowe Date: Thu, 28 Sep 2017 08:12:37 -0600 Subject: [PATCH] These structures are no longer exported outside the crate, and these assertions are unnecessary now that the external API can enforce them. --- src/lib.rs | 1 + src/wnaf.rs | 16 +++------------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index ae67b99..8b6c4b0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,6 +12,7 @@ #![cfg_attr(feature = "clippy", allow(inline_always))] #![cfg_attr(feature = "clippy", allow(too_many_arguments))] #![cfg_attr(feature = "clippy", allow(unreadable_literal))] +#![cfg_attr(feature = "clippy", allow(new_without_default_derive))] // Force public structures to implement Debug #![deny(missing_debug_implementations)] diff --git a/src/wnaf.rs b/src/wnaf.rs index d4061aa..9b00989 100644 --- a/src/wnaf.rs +++ b/src/wnaf.rs @@ -1,13 +1,8 @@ use super::{CurveProjective, PrimeFieldRepr, PrimeField}; /// Replaces the contents of `table` with a w-NAF window table for the given window size. -/// -/// This function will panic if provided a window size below two, or above 22. -pub fn wnaf_table(table: &mut Vec, mut base: G, window: usize) +pub(crate) fn wnaf_table(table: &mut Vec, mut base: G, window: usize) { - assert!(window < 23); - assert!(window > 1); - table.truncate(0); table.reserve(1 << (window-1)); @@ -21,13 +16,8 @@ pub fn wnaf_table(table: &mut Vec, mut base: G, window: u } /// Replaces the contents of `wnaf` with the w-NAF representation of a scalar. -/// -/// This function will panic if provided a window size below two, or above 22. -pub fn wnaf_form(wnaf: &mut Vec, mut c: S, window: usize) +pub(crate) fn wnaf_form(wnaf: &mut Vec, mut c: S, window: usize) { - assert!(window < 23); - assert!(window > 1); - wnaf.truncate(0); while !c.is_zero() { @@ -58,7 +48,7 @@ pub fn wnaf_form(wnaf: &mut Vec, mut c: S, window: usize /// /// This function must be provided a `table` and `wnaf` that were constructed with /// the same window size; otherwise, it may panic or produce invalid results. -pub fn wnaf_exp(table: &[G], wnaf: &[i64]) -> G +pub(crate) fn wnaf_exp(table: &[G], wnaf: &[i64]) -> G { let mut result = G::zero();