Made unnecessarily pub contents of field.rs pub(crate)
This commit is contained in:
parent
cd9378e6fd
commit
81d0756bdc
2
.github/workflows/curve25519-dalek.yml
vendored
2
.github/workflows/curve25519-dalek.yml
vendored
@ -127,7 +127,7 @@ jobs:
|
||||
# This should automatically pick up the simd backend in a x86_64 runner
|
||||
# It should pick AVX2 due to stable toolchain used since AVX512 requires nigthly
|
||||
RUSTFLAGS: '-C target_feature=+avx2'
|
||||
run: cargo test --no-default-features --features alloc,precomputed-tables,zeroize --target x86_64-unknown-linux-gnu
|
||||
run: cargo test --no-default-features --features alloc,precomputed-tables,zeroize,group-bits --target x86_64-unknown-linux-gnu
|
||||
|
||||
msrv:
|
||||
name: Current MSRV is 1.60.0
|
||||
|
@ -47,7 +47,7 @@ cfg_if! {
|
||||
///
|
||||
/// Using formally-verified field arithmetic from fiat-crypto.
|
||||
#[cfg(curve25519_dalek_bits = "32")]
|
||||
pub type FieldElement = backend::serial::fiat_u32::field::FieldElement2625;
|
||||
pub(crate) type FieldElement = backend::serial::fiat_u32::field::FieldElement2625;
|
||||
|
||||
/// A `FieldElement` represents an element of the field
|
||||
/// \\( \mathbb Z / (2\^{255} - 19)\\).
|
||||
@ -57,21 +57,21 @@ cfg_if! {
|
||||
///
|
||||
/// Using formally-verified field arithmetic from fiat-crypto.
|
||||
#[cfg(curve25519_dalek_bits = "64")]
|
||||
pub type FieldElement = backend::serial::fiat_u64::field::FieldElement51;
|
||||
pub(crate) type FieldElement = backend::serial::fiat_u64::field::FieldElement51;
|
||||
} else if #[cfg(curve25519_dalek_bits = "64")] {
|
||||
/// A `FieldElement` represents an element of the field
|
||||
/// \\( \mathbb Z / (2\^{255} - 19)\\).
|
||||
///
|
||||
/// The `FieldElement` type is an alias for one of the platform-specific
|
||||
/// implementations.
|
||||
pub type FieldElement = backend::serial::u64::field::FieldElement51;
|
||||
pub(crate) type FieldElement = backend::serial::u64::field::FieldElement51;
|
||||
} else {
|
||||
/// A `FieldElement` represents an element of the field
|
||||
/// \\( \mathbb Z / (2\^{255} - 19)\\).
|
||||
///
|
||||
/// The `FieldElement` type is an alias for one of the platform-specific
|
||||
/// implementations.
|
||||
type FieldElement = backend::serial::u32::field::FieldElement2625;
|
||||
pub(crate) type FieldElement = backend::serial::u32::field::FieldElement2625;
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,7 +100,7 @@ impl FieldElement {
|
||||
/// # Return
|
||||
///
|
||||
/// If negative, return `Choice(1)`. Otherwise, return `Choice(0)`.
|
||||
pub fn is_negative(&self) -> Choice {
|
||||
pub(crate) fn is_negative(&self) -> Choice {
|
||||
let bytes = self.as_bytes();
|
||||
(bytes[0] & 1).into()
|
||||
}
|
||||
@ -110,7 +110,7 @@ impl FieldElement {
|
||||
/// # Return
|
||||
///
|
||||
/// If zero, return `Choice(1)`. Otherwise, return `Choice(0)`.
|
||||
pub fn is_zero(&self) -> Choice {
|
||||
pub(crate) fn is_zero(&self) -> Choice {
|
||||
let zero = [0u8; 32];
|
||||
let bytes = self.as_bytes();
|
||||
|
||||
@ -156,11 +156,11 @@ impl FieldElement {
|
||||
(t19, t3)
|
||||
}
|
||||
|
||||
/// Given a slice of public `FieldElements`, replace each with its inverse.
|
||||
/// Given a slice of pub(crate)lic `FieldElements`, replace each with its inverse.
|
||||
///
|
||||
/// When an input `FieldElement` is zero, its value is unchanged.
|
||||
#[cfg(feature = "alloc")]
|
||||
pub fn batch_invert(inputs: &mut [FieldElement]) {
|
||||
pub(crate) fn batch_invert(inputs: &mut [FieldElement]) {
|
||||
// Montgomery’s Trick and Fast Implementation of Masked AES
|
||||
// Genelle, Prouff and Quisquater
|
||||
// Section 3.2
|
||||
@ -205,7 +205,7 @@ impl FieldElement {
|
||||
/// This function returns zero on input zero.
|
||||
#[rustfmt::skip] // keep alignment of explanatory comments
|
||||
#[allow(clippy::let_and_return)]
|
||||
pub fn invert(&self) -> FieldElement {
|
||||
pub(crate) fn invert(&self) -> FieldElement {
|
||||
// The bits of p-2 = 2^255 -19 -2 are 11010111111...11.
|
||||
//
|
||||
// nonzero bits of exponent
|
||||
@ -242,7 +242,7 @@ impl FieldElement {
|
||||
/// - `(Choice(0), zero) ` if `v` is zero and `u` is nonzero;
|
||||
/// - `(Choice(0), +sqrt(i*u/v))` if `u/v` is nonsquare (so `i*u/v` is square).
|
||||
///
|
||||
pub fn sqrt_ratio_i(u: &FieldElement, v: &FieldElement) -> (Choice, FieldElement) {
|
||||
pub(crate) fn sqrt_ratio_i(u: &FieldElement, v: &FieldElement) -> (Choice, FieldElement) {
|
||||
// Using the same trick as in ed25519 decoding, we merge the
|
||||
// inversion, the square root, and the square test as follows.
|
||||
//
|
||||
@ -302,7 +302,7 @@ impl FieldElement {
|
||||
/// - `(Choice(0), zero) ` if `self` is zero;
|
||||
/// - `(Choice(0), +sqrt(i/self)) ` if `self` is a nonzero nonsquare;
|
||||
///
|
||||
pub fn invsqrt(&self) -> (Choice, FieldElement) {
|
||||
pub(crate) fn invsqrt(&self) -> (Choice, FieldElement) {
|
||||
FieldElement::sqrt_ratio_i(&FieldElement::ONE, self)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user