Botan 3.6.1
Crypto and TLS for C&
|
Namespaces | |
namespace | detail |
Classes | |
struct | BitPackingTrait |
class | Polynomial |
class | PolynomialMatrix |
class | PolynomialVector |
class | Trait_Base |
Concepts | |
concept | crystals_constants |
concept | crystals_trait |
concept | byte_source |
concept | coeff_map_fn |
concept | coeff_unmap_fn |
Enumerations | |
enum class | Domain { Normal , NTT } |
Functions | |
template<crystals_trait Trait> | |
Polynomial< Trait, Domain::Normal > | inverse_ntt (Polynomial< Trait, Domain::NTT > p_ntt) |
template<crystals_trait Trait> | |
PolynomialVector< Trait, Domain::Normal > | inverse_ntt (PolynomialVector< Trait, Domain::NTT > polyvec_ntt) |
template<crystals_trait Trait, Domain D> | |
Polynomial< Trait, D > | montgomery (Polynomial< Trait, D > p) |
template<crystals_trait Trait, Domain D> | |
PolynomialVector< Trait, D > | montgomery (PolynomialVector< Trait, D > polyvec) |
template<crystals_trait Trait> | |
Polynomial< Trait, Domain::NTT > | ntt (Polynomial< Trait, Domain::Normal > p) |
template<crystals_trait Trait> | |
PolynomialVector< Trait, Domain::NTT > | ntt (PolynomialVector< Trait, Domain::Normal > polyvec) |
template<crystals_trait Trait> | |
Polynomial< Trait, Domain::NTT > | operator* (const Polynomial< Trait, Domain::NTT > &a, const Polynomial< Trait, Domain::NTT > &b) |
template<crystals_trait Trait> | |
PolynomialVector< Trait, Domain::NTT > | operator* (const Polynomial< Trait, Domain::NTT > &p, const PolynomialVector< Trait, Domain::NTT > &pv) |
template<crystals_trait Trait> | |
PolynomialVector< Trait, Domain::NTT > | operator* (const PolynomialMatrix< Trait > &mat, const PolynomialVector< Trait, Domain::NTT > &vec) |
template<crystals_trait Trait> | |
Polynomial< Trait, Domain::NTT > | operator* (const PolynomialVector< Trait, Domain::NTT > &a, const PolynomialVector< Trait, Domain::NTT > &b) |
template<crystals_trait Trait> | |
PolynomialVector< Trait, Domain::Normal > | operator+ (const PolynomialVector< Trait, Domain::Normal > &a, const PolynomialVector< Trait, Domain::Normal > &b) |
template<crystals_trait Trait> | |
PolynomialVector< Trait, Domain::Normal > | operator<< (const PolynomialVector< Trait, Domain::Normal > &pv, size_t shift) |
template<int32_t range, crystals_trait PolyTrait, Domain D> | |
constexpr void | pack (const Polynomial< PolyTrait, D > &p, BufferStuffer &stuffer) |
Overload for packing polynomials with a NOOP map function. | |
template<int32_t range, crystals_trait PolyTrait, Domain D, coeff_map_fn< typename PolyTrait::T > MapFnT> | |
constexpr void | pack (const Polynomial< PolyTrait, D > &p, BufferStuffer &stuffer, MapFnT map) |
template<int32_t range, byte_source ByteSourceT, crystals_trait PolyTrait, Domain D> | |
constexpr void | unpack (Polynomial< PolyTrait, D > &p, ByteSourceT &byte_source) |
Overload for unpacking polynomials with a NOOP unmap function. | |
template<int32_t range, byte_source ByteSourceT, crystals_trait PolyTrait, Domain D, coeff_unmap_fn< typename PolyTrait::T > UnmapFnT> | |
constexpr void | unpack (Polynomial< PolyTrait, D > &p, ByteSourceT &byte_source, UnmapFnT unmap) |
|
strong |
Enumerator | |
---|---|
Normal | |
NTT |
Definition at line 28 of file pqcrystals.h.
Polynomial< Trait, Domain::Normal > Botan::CRYSTALS::inverse_ntt | ( | Polynomial< Trait, Domain::NTT > | p_ntt | ) |
Definition at line 564 of file pqcrystals.h.
References Botan::CRYSTALS::detail::domain_cast().
PolynomialVector< Trait, Domain::Normal > Botan::CRYSTALS::inverse_ntt | ( | PolynomialVector< Trait, Domain::NTT > | polyvec_ntt | ) |
Definition at line 580 of file pqcrystals.h.
References Botan::CRYSTALS::detail::domain_cast().
Polynomial< Trait, D > Botan::CRYSTALS::montgomery | ( | Polynomial< Trait, D > | p | ) |
Definition at line 589 of file pqcrystals.h.
References Botan::CRYSTALS::detail::montgomery().
PolynomialVector< Trait, D > Botan::CRYSTALS::montgomery | ( | PolynomialVector< Trait, D > | polyvec | ) |
Definition at line 595 of file pqcrystals.h.
References Botan::CRYSTALS::detail::montgomery().
Polynomial< Trait, Domain::NTT > Botan::CRYSTALS::ntt | ( | Polynomial< Trait, Domain::Normal > | p | ) |
Definition at line 557 of file pqcrystals.h.
References Botan::CRYSTALS::detail::domain_cast().
PolynomialVector< Trait, Domain::NTT > Botan::CRYSTALS::ntt | ( | PolynomialVector< Trait, Domain::Normal > | polyvec | ) |
Definition at line 571 of file pqcrystals.h.
References Botan::CRYSTALS::detail::domain_cast().
Polynomial< Trait, Domain::NTT > Botan::CRYSTALS::operator* | ( | const Polynomial< Trait, Domain::NTT > & | a, |
const Polynomial< Trait, Domain::NTT > & | b ) |
Definition at line 642 of file pqcrystals.h.
References Botan::b, and Botan::CRYSTALS::Polynomial< Trait, D >::coefficients().
PolynomialVector< Trait, Domain::NTT > Botan::CRYSTALS::operator* | ( | const Polynomial< Trait, Domain::NTT > & | p, |
const PolynomialVector< Trait, Domain::NTT > & | pv ) |
Definition at line 632 of file pqcrystals.h.
References Botan::CRYSTALS::Polynomial< Trait, D >::coefficients(), Botan::CRYSTALS::PolynomialVector< Trait, D >::coefficients(), and Botan::CRYSTALS::PolynomialVector< Trait, D >::size().
PolynomialVector< Trait, Domain::NTT > Botan::CRYSTALS::operator* | ( | const PolynomialMatrix< Trait > & | mat, |
const PolynomialVector< Trait, Domain::NTT > & | vec ) |
Definition at line 614 of file pqcrystals.h.
References Botan::CRYSTALS::PolynomialVector< Trait, D >::coefficients(), and Botan::CRYSTALS::PolynomialMatrix< Trait >::size().
Polynomial< Trait, Domain::NTT > Botan::CRYSTALS::operator* | ( | const PolynomialVector< Trait, Domain::NTT > & | a, |
const PolynomialVector< Trait, Domain::NTT > & | b ) |
Definition at line 624 of file pqcrystals.h.
References Botan::b, and Botan::CRYSTALS::detail::dot_product().
PolynomialVector< Trait, Domain::Normal > Botan::CRYSTALS::operator+ | ( | const PolynomialVector< Trait, Domain::Normal > & | a, |
const PolynomialVector< Trait, Domain::Normal > & | b ) |
Definition at line 603 of file pqcrystals.h.
References Botan::b, BOTAN_DEBUG_ASSERT, and Botan::CRYSTALS::PolynomialVector< Trait, D >::size().
PolynomialVector< Trait, Domain::Normal > Botan::CRYSTALS::operator<< | ( | const PolynomialVector< Trait, Domain::Normal > & | pv, |
size_t | shift ) |
Definition at line 642 of file pqcrystals.h.
|
constexpr |
Overload for packing polynomials with a NOOP map function.
Definition at line 222 of file pqcrystals_encoding.h.
References pack().
|
constexpr |
Base implementation of NIST FIPS 203 Algorithm 5 (ByteEncode) and NIST FIPS 204 Algorithms 16 (SimpleBitPack) and 17 (BitPack).
This takes a polynomial p
and packs its coefficients into the buffer represented by stuffer
. Optionally, the coefficients can be transformed using the map
function before packing them. Kyber uses map
to compress the coefficients as needed, Dilithium to transform coefficients to unsigned.
The implementation assumes that the values returned from the custom map
transformation are in the range [0, range]. No assumption is made about the value range of the coefficients in the polynomial p
.
Note that this bit-packing algorithm is inefficient if the bit-length of the coefficients is a multiple of 8. In that case, a byte-level encoding (that might need to take endianess into account) would be more efficient. However, neither Kyber nor Dilithium instantiate bit-packings with such a value range.
range | the upper bound of the coefficient range. |
Definition at line 116 of file pqcrystals_encoding.h.
References Botan::BufferStuffer::append(), BOTAN_DEBUG_ASSERT, Botan::BufferStuffer::remaining_capacity(), Botan::CRYSTALS::Polynomial< Trait, D >::size(), and Botan::store_le().
Referenced by pack().
|
constexpr |
Overload for unpacking polynomials with a NOOP unmap function.
Definition at line 229 of file pqcrystals_encoding.h.
References unpack().
|
constexpr |
Base implementation of NIST FIPS 203 Algorithm 6 (ByteDecode) and NIST FIPS 204 Algorithms 18 (SimpleBitUnpack) and 19 (BitUnpack).
This takes a byte sequence represented by byte_source
and unpacks its coefficients into the polynomial p
. Optionally, the coefficients can be transformed using the unmap
function after unpacking them. Note that the unmap
function must be able to deal with out-of-range values, as the input to unpack()
may be untrusted data.
Kyber uses unmap
to decompress the coefficients as needed, Dilithium uses it to convert the coefficients back to signed integers.
range | the upper bound of the coefficient range. |
Definition at line 190 of file pqcrystals_encoding.h.
References Botan::CRYSTALS::detail::as_byte_source(), Botan::load_le(), and Botan::CRYSTALS::Polynomial< Trait, D >::size().
Referenced by unpack().