Browse Source

docs: fix warnings

km/mkdocs-impl
Augusto F. Hack 1 year ago
committed by Bobbin Threadbare
parent
commit
dae9de9068
7 changed files with 25 additions and 25 deletions
  1. +2
    -2
      src/dsa/rpo_falcon512/mod.rs
  2. +12
    -12
      src/dsa/rpo_falcon512/polynomial.rs
  3. +2
    -2
      src/dsa/rpo_falcon512/signature.rs
  4. +3
    -3
      src/merkle/delta.rs
  5. +3
    -3
      src/merkle/mmr/delta.rs
  6. +2
    -2
      src/merkle/path.rs
  7. +1
    -1
      src/rand/rpo.rs

+ 2
- 2
src/dsa/rpo_falcon512/mod.rs

@ -39,10 +39,10 @@ const NONCE_LEN: usize = 40;
const NONCE_ELEMENTS: usize = 8; const NONCE_ELEMENTS: usize = 8;
/// Public key length as a u8 vector. /// Public key length as a u8 vector.
const PK_LEN: usize = 897;
pub const PK_LEN: usize = 897;
/// Secret key length as a u8 vector. /// Secret key length as a u8 vector.
const SK_LEN: usize = 1281;
pub const SK_LEN: usize = 1281;
/// Signature length as a u8 vector. /// Signature length as a u8 vector.
const SIG_LEN: usize = 626; const SIG_LEN: usize = 626;

+ 12
- 12
src/dsa/rpo_falcon512/polynomial.rs

@ -4,7 +4,7 @@ use core::ops::{Add, Mul, Sub};
// FALCON POLYNOMIAL // FALCON POLYNOMIAL
// ================================================================================================ // ================================================================================================
/// A polynomial over Z_p[x]/(phi) where phi := x^512 + 1
/// A polynomial over Z_p\[x\]/(phi) where phi := x^512 + 1
#[derive(Debug, Copy, Clone, PartialEq)] #[derive(Debug, Copy, Clone, PartialEq)]
pub struct Polynomial([u16; N]); pub struct Polynomial([u16; N]);
@ -24,7 +24,7 @@ impl Polynomial {
Self(data) Self(data)
} }
/// Decodes raw bytes representing a public key into a polynomial in Z_p[x]/(phi).
/// Decodes raw bytes representing a public key into a polynomial in Z_p\[x\]/(phi).
/// ///
/// # Errors /// # Errors
/// Returns an error if: /// Returns an error if:
@ -69,14 +69,14 @@ impl Polynomial {
} }
} }
/// Decodes the signature into the coefficients of a polynomial in Z_p[x]/(phi). It assumes
/// Decodes the signature into the coefficients of a polynomial in Z_p\[x\]/(phi). It assumes
/// that the signature has been encoded using the uncompressed format. /// that the signature has been encoded using the uncompressed format.
/// ///
/// # Errors /// # Errors
/// Returns an error if: /// Returns an error if:
/// - The signature has been encoded using a different algorithm than the reference compressed /// - The signature has been encoded using a different algorithm than the reference compressed
/// encoding algorithm. /// encoding algorithm.
/// - The encoded signature polynomial is in Z_p[x]/(phi') where phi' = x^N' + 1 and N' != 512.
/// - The encoded signature polynomial is in Z_p\[x\]/(phi') where phi' = x^N' + 1 and N' != 512.
/// - While decoding the high bits of a coefficient, the current accumulated value of its /// - While decoding the high bits of a coefficient, the current accumulated value of its
/// high bits is larger than 2048. /// high bits is larger than 2048.
/// - The decoded coefficient is -0. /// - The decoded coefficient is -0.
@ -149,12 +149,12 @@ impl Polynomial {
// POLYNOMIAL OPERATIONS // POLYNOMIAL OPERATIONS
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
/// Multiplies two polynomials over Z_p[x] without reducing modulo p. Given that the degrees
/// Multiplies two polynomials over Z_p\[x\] without reducing modulo p. Given that the degrees
/// of the input polynomials are less than 512 and their coefficients are less than the modulus /// of the input polynomials are less than 512 and their coefficients are less than the modulus
/// q equal to 12289, the resulting product polynomial is guaranteed to have coefficients less /// q equal to 12289, the resulting product polynomial is guaranteed to have coefficients less
/// than the Miden prime. /// than the Miden prime.
/// ///
/// Note that this multiplication is not over Z_p[x]/(phi).
/// Note that this multiplication is not over Z_p\[x\]/(phi).
pub fn mul_modulo_p(a: &Self, b: &Self) -> [u64; 1024] { pub fn mul_modulo_p(a: &Self, b: &Self) -> [u64; 1024] {
let mut c = [0; 2 * N]; let mut c = [0; 2 * N];
for i in 0..N { for i in 0..N {
@ -166,8 +166,8 @@ impl Polynomial {
c c
} }
/// Reduces a polynomial, that is the product of two polynomials over Z_p[x], modulo
/// the irreducible polynomial phi. This results in an element in Z_p[x]/(phi).
/// Reduces a polynomial, that is the product of two polynomials over Z_p\[x\], modulo
/// the irreducible polynomial phi. This results in an element in Z_p\[x\]/(phi).
pub fn reduce_negacyclic(a: &[u64; 1024]) -> Self { pub fn reduce_negacyclic(a: &[u64; 1024]) -> Self {
let mut c = [0; N]; let mut c = [0; N];
for i in 0..N { for i in 0..N {
@ -181,7 +181,7 @@ impl Polynomial {
Self(c) Self(c)
} }
/// Computes the norm squared of a polynomial in Z_p[x]/(phi) after normalizing its
/// Computes the norm squared of a polynomial in Z_p\[x\]/(phi) after normalizing its
/// coefficients to be in the interval (-p/2, p/2]. /// coefficients to be in the interval (-p/2, p/2].
pub fn sq_norm(&self) -> u64 { pub fn sq_norm(&self) -> u64 {
let mut res = 0; let mut res = 0;
@ -203,7 +203,7 @@ impl Default for Polynomial {
} }
} }
/// Multiplication over Z_p[x]/(phi)
/// Multiplication over Z_p\[x\]/(phi)
impl Mul for Polynomial { impl Mul for Polynomial {
type Output = Self; type Output = Self;
@ -227,7 +227,7 @@ impl Mul for Polynomial {
} }
} }
/// Addition over Z_p[x]/(phi)
/// Addition over Z_p\[x\]/(phi)
impl Add for Polynomial { impl Add for Polynomial {
type Output = Self; type Output = Self;
@ -239,7 +239,7 @@ impl Add for Polynomial {
} }
} }
/// Subtraction over Z_p[x]/(phi)
/// Subtraction over Z_p\[x\]/(phi)
impl Sub for Polynomial { impl Sub for Polynomial {
type Output = Self; type Output = Self;

+ 2
- 2
src/dsa/rpo_falcon512/signature.rs

@ -11,7 +11,7 @@ use core::cell::OnceCell;
/// An RPO Falcon512 signature over a message. /// An RPO Falcon512 signature over a message.
/// ///
/// The signature is a pair of polynomials (s1, s2) in (Z_p[x]/(phi))^2, where:
/// The signature is a pair of polynomials (s1, s2) in (Z_p\[x\]/(phi))^2, where:
/// - p := 12289 /// - p := 12289
/// - phi := x^512 + 1 /// - phi := x^512 + 1
/// - s1 = c - s2 * h /// - s1 = c - s2 * h
@ -86,7 +86,7 @@ impl Signature {
// HASH-TO-POINT // HASH-TO-POINT
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
/// Returns a polynomial in Z_p[x]/(phi) representing the hash of the provided message.
/// Returns a polynomial in Z_p\[x\]/(phi) representing the hash of the provided message.
pub fn hash_to_point(&self, message: Word) -> Polynomial { pub fn hash_to_point(&self, message: Word) -> Polynomial {
hash_to_point(message, &self.nonce()) hash_to_point(message, &self.nonce())
} }

+ 3
- 3
src/merkle/delta.rs

@ -19,7 +19,7 @@ pub struct MerkleStoreDelta(pub Vec<(RpoDigest, MerkleTreeDelta)>);
// MERKLE TREE DELTA // MERKLE TREE DELTA
// ================================================================================================ // ================================================================================================
/// [MerkleDelta] stores the differences between the initial and final Merkle tree states.
/// [MerkleTreeDelta] stores the differences between the initial and final Merkle tree states.
/// ///
/// The differences are represented as follows: /// The differences are represented as follows:
/// - depth: the depth of the merkle tree. /// - depth: the depth of the merkle tree.
@ -47,7 +47,7 @@ impl MerkleTreeDelta {
// ACCESSORS // ACCESSORS
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
/// Returns the depth of the Merkle tree the [MerkleDelta] is associated with.
/// Returns the depth of the Merkle tree the [MerkleTreeDelta] is associated with.
pub fn depth(&self) -> u8 { pub fn depth(&self) -> u8 {
self.depth self.depth
} }
@ -75,7 +75,7 @@ impl MerkleTreeDelta {
} }
} }
/// Extracts a [MerkleDelta] object by comparing the leaves of two Merkle trees specifies by
/// Extracts a [MerkleTreeDelta] object by comparing the leaves of two Merkle trees specifies by
/// their roots and depth. /// their roots and depth.
pub fn merkle_tree_delta<T: KvMap<RpoDigest, StoreNode>>( pub fn merkle_tree_delta<T: KvMap<RpoDigest, StoreNode>>(
tree_root_1: RpoDigest, tree_root_1: RpoDigest,

+ 3
- 3
src/merkle/mmr/delta.rs

@ -1,16 +1,16 @@
use super::super::{RpoDigest, Vec}; use super::super::{RpoDigest, Vec};
/// Container for the update data of a [PartialMmr]
/// Container for the update data of a [super::PartialMmr]
#[derive(Debug)] #[derive(Debug)]
pub struct MmrDelta { pub struct MmrDelta {
/// The new version of the [Mmr]
/// The new version of the [super::Mmr]
pub forest: usize, pub forest: usize,
/// Update data. /// Update data.
/// ///
/// The data is packed as follows: /// The data is packed as follows:
/// 1. All the elements needed to perform authentication path updates. These are the right /// 1. All the elements needed to perform authentication path updates. These are the right
/// siblings required to perform tree merges on the [PartialMmr].
/// siblings required to perform tree merges on the [super::PartialMmr].
/// 2. The new peaks. /// 2. The new peaks.
pub data: Vec<RpoDigest>, pub data: Vec<RpoDigest>,
} }

+ 2
- 2
src/merkle/path.rs

@ -163,7 +163,7 @@ impl<'a> Iterator for InnerNodeIterator<'a> {
// MERKLE PATH CONTAINERS // MERKLE PATH CONTAINERS
// ================================================================================================ // ================================================================================================
/// A container for a [Word] value and its [MerklePath] opening.
/// A container for a [crate::Word] value and its [MerklePath] opening.
#[derive(Clone, Debug, Default, PartialEq, Eq)] #[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct ValuePath { pub struct ValuePath {
/// The node value opening for `path`. /// The node value opening for `path`.
@ -179,7 +179,7 @@ impl ValuePath {
} }
} }
/// A container for a [MerklePath] and its [Word] root.
/// A container for a [MerklePath] and its [crate::Word] root.
/// ///
/// This structure does not provide any guarantees regarding the correctness of the path to the /// This structure does not provide any guarantees regarding the correctness of the path to the
/// root. For more information, check [MerklePath::verify]. /// root. For more information, check [MerklePath::verify].

+ 1
- 1
src/rand/rpo.rs

@ -19,7 +19,7 @@ const HALF_RATE_WIDTH: usize = (Rpo256::RATE_RANGE.end - Rpo256::RATE_RANGE.star
// RPO RANDOM COIN // RPO RANDOM COIN
// ================================================================================================ // ================================================================================================
/// A simplified version of the `SPONGE_PRG` reseedable pseudo-random number generator algorithm /// A simplified version of the `SPONGE_PRG` reseedable pseudo-random number generator algorithm
/// described in https://eprint.iacr.org/2011/499.pdf.
/// described in <https://eprint.iacr.org/2011/499.pdf>.
/// ///
/// The simplification is related to the following facts: /// The simplification is related to the following facts:
/// 1. A call to the reseed method implies one and only one call to the permutation function. /// 1. A call to the reseed method implies one and only one call to the permutation function.

Loading…
Cancel
Save