|
Botan 3.14.1
Crypto and TLS for C&
|
#include <dilithium_polynomial.h>
Public Types | |
| using | T |
Static Public Member Functions | |
| static constexpr void | barrett_reduce (std::span< T, N > poly) |
| static constexpr void | inverse_ntt (std::span< T, N > coeffs) |
| static constexpr void | ntt (std::span< T, N > coeffs) |
| static constexpr void | poly_add (std::span< T, N > result, std::span< const T, N > lhs, std::span< const T, N > rhs) |
| static constexpr void | poly_cadd_q (std::span< T, N > coeffs) |
| Adds Q if the coefficient is negative. | |
| static constexpr void | poly_pointwise_montgomery (std::span< T, N > result, std::span< const T, N > lhs, std::span< const T, N > rhs) |
| static constexpr void | poly_sub (std::span< T, N > result, std::span< const T, N > lhs, std::span< const T, N > rhs) |
| static constexpr void | polyvec_pointwise_acc_montgomery (std::span< T, N > w, std::span< const T > u, std::span< const T > v) |
Multiplication and accumulation of 2 polynomial vectors u and v. | |
| static constexpr T | to_montgomery (T a) |
Static Public Attributes | |
| static constexpr T | BARRETT_V |
| static constexpr T | N |
| static constexpr T | Q |
Protected Types | |
| using | T2 |
Static Protected Member Functions | |
| static constexpr T | fqmul (T a, T b) |
| static constexpr std::span< U, N > | poly_in_polyvec (std::span< U > polyvec, size_t index) |
| static constexpr size_t | polys_in_polyvec (std::span< const T > polyvec) |
Static Protected Attributes | |
Pre-computed algorithm constants | |
| static constexpr T | Q_inverse |
| static constexpr T | MONTY |
| static constexpr T | MONTY_SQUARED |
| static constexpr T | F_WITH_MONTY_SQUARED |
| static constexpr auto | zetas |
Friends | |
| class | CRYSTALS::Trait_Base< DilithiumConstants, DilithiumPolyTraits > |
Definition at line 20 of file dilithium_polynomial.h.
|
inherited |
Definition at line 51 of file pqcrystals.h.
|
protectedinherited |
Definition at line 58 of file pqcrystals.h.
|
inlinestaticconstexprinherited |
Definition at line 124 of file pqcrystals.h.
|
inlinestaticconstexprprotectedinherited |
Definition at line 98 of file pqcrystals.h.
Referenced by Botan::DilithiumPolyTraits::inverse_ntt(), Botan::DilithiumPolyTraits::ntt(), and Botan::DilithiumPolyTraits::poly_pointwise_montgomery().
|
inlinestaticconstexpr |
NIST FIPS 204, Algorithm 42 (NTT^-1).
The output is effectively multiplied by the montgomery parameter 2^32 mod q so that the input factors 2^(-32) mod q are eliminated. Note that factors 2^(-32) mod q are introduced by multiplication and reduction of values not in montgomery domain.
Produces the result of the inverse NTT transformation with a montgomery factor of (2^32 mod q) added (!). See above.
Definition at line 76 of file dilithium_polynomial.h.
References Botan::CRYSTALS::Trait_Base< DilithiumConstants, DilithiumPolyTraits >::F_WITH_MONTY_SQUARED, Botan::CRYSTALS::Trait_Base< DilithiumConstants, DilithiumPolyTraits >::fqmul(), Botan::CRYSTALS::Trait_Base< DilithiumConstants, DilithiumPolyTraits >::N, and Botan::CRYSTALS::Trait_Base< DilithiumConstants, DilithiumPolyTraits >::zetas.
NIST FIPS 204, Algorithm 41 (NTT)
Note: ntt(), inverse_ntt() and operator* have side effects on the montgomery factor of the involved coefficients! It is assumed that EXACTLY ONE vector or matrix multiplication is performed between transforming in and out of NTT domain.
Produces the result of the NTT transformation without any montgomery factors in the coefficients.
Definition at line 48 of file dilithium_polynomial.h.
References Botan::CRYSTALS::Trait_Base< DilithiumConstants, DilithiumPolyTraits >::fqmul(), Botan::CRYSTALS::Trait_Base< DilithiumConstants, DilithiumPolyTraits >::N, and Botan::CRYSTALS::Trait_Base< DilithiumConstants, DilithiumPolyTraits >::zetas.
|
inlinestaticconstexprinherited |
|
inlinestaticconstexprinherited |
Adds Q if the coefficient is negative.
Definition at line 114 of file pqcrystals.h.
|
inlinestaticconstexprprotectedinherited |
index-th polynomial in the polynomial vector polyvec. Definition at line 91 of file pqcrystals.h.
|
inlinestaticconstexpr |
Multiplication of two polynomials lhs and rhs in NTT domain.
Produces the result of the multiplication in NTT domain, with a factor of (2^-32 mod q) in each element due to montgomery reduction.
Definition at line 103 of file dilithium_polynomial.h.
References Botan::CRYSTALS::Trait_Base< DilithiumConstants, DilithiumPolyTraits >::fqmul(), and Botan::CRYSTALS::Trait_Base< DilithiumConstants, DilithiumPolyTraits >::N.
|
inlinestaticconstexprinherited |
|
inlinestaticconstexprprotectedinherited |
polyvec. Definition at line 83 of file pqcrystals.h.
|
inlinestaticconstexprinherited |
Multiplication and accumulation of 2 polynomial vectors u and v.
Definition at line 131 of file pqcrystals.h.
|
inlinestaticconstexprinherited |
Definition at line 122 of file pqcrystals.h.
|
friend |
Definition at line 20 of file dilithium_polynomial.h.
References Botan::CRYSTALS::Trait_Base< DilithiumConstants, DilithiumPolyTraits >::Q, and Botan::CRYSTALS::Trait_Base< DilithiumConstants, DilithiumPolyTraits >::Q_inverse.
|
staticconstexprinherited |
Definition at line 55 of file pqcrystals.h.
|
staticconstexprprotectedinherited |
Definition at line 73 of file pqcrystals.h.
Referenced by Botan::DilithiumPolyTraits::inverse_ntt().
|
staticconstexprprotectedinherited |
Definition at line 64 of file pqcrystals.h.
|
staticconstexprprotectedinherited |
Definition at line 65 of file pqcrystals.h.
|
staticconstexprinherited |
Definition at line 52 of file pqcrystals.h.
Referenced by Botan::DilithiumPolyTraits::inverse_ntt(), Botan::DilithiumPolyTraits::ntt(), and Botan::DilithiumPolyTraits::poly_pointwise_montgomery().
|
staticconstexprinherited |
Definition at line 53 of file pqcrystals.h.
Referenced by Botan::DilithiumPolyTraits::CRYSTALS::Trait_Base< DilithiumConstants, DilithiumPolyTraits >.
|
staticconstexprprotectedinherited |
Definition at line 63 of file pqcrystals.h.
Referenced by Botan::DilithiumPolyTraits::CRYSTALS::Trait_Base< DilithiumConstants, DilithiumPolyTraits >.
|
staticconstexprprotectedinherited |
Definition at line 75 of file pqcrystals.h.
Referenced by Botan::DilithiumPolyTraits::inverse_ntt(), and Botan::DilithiumPolyTraits::ntt().