|
Botan 3.12.0
Crypto and TLS for C&
|
Classes | |
| class | PolynomialSampler |
|
constexpr |
NIST FIPS 203, Formula 4.7 (Compress)
Definition at line 33 of file kyber_helpers.h.
References BOTAN_DEBUG_ASSERT, compress(), and Botan::KyberConstants::Q.
Referenced by compress().
| void Botan::Kyber_Algos::compress_ciphertext | ( | StrongSpan< KyberCompressedCiphertext > | out, |
| const KyberPolyVec & | u, | ||
| const KyberPoly & | v, | ||
| const KyberConstants & | m_mode ) |
Definition at line 354 of file kyber_algos.cpp.
References BOTAN_ASSERT_NOMSG, compress_ciphertext(), Botan::BufferStuffer::full(), Botan::BufferStuffer::next(), Botan::KyberConstants::polynomial_compressed_bytes(), and Botan::KyberConstants::polynomial_vector_compressed_bytes().
Referenced by compress_ciphertext(), and Botan::Kyber_PublicKeyInternal::indcpa_encrypt().
| KyberPolyVecNTT Botan::Kyber_Algos::decode_polynomial_vector | ( | std::span< const uint8_t > | a, |
| const KyberConstants & | mode ) |
Definition at line 194 of file kyber_algos.cpp.
References BOTAN_ASSERT_NOMSG, decode_polynomial_vector(), Botan::BufferSlicer::empty(), and Botan::KyberConstants::k().
Referenced by Botan::Expanded_Keypair_Codec::decode_keypair(), and decode_polynomial_vector().
|
constexpr |
NIST FIPS 203, Formula 4.8 (Decompress)
Definition at line 64 of file kyber_helpers.h.
References BOTAN_DEBUG_ASSERT, decompress(), and Botan::KyberConstants::Q.
Referenced by decompress().
| std::pair< KyberPolyVec, KyberPoly > Botan::Kyber_Algos::decompress_ciphertext | ( | StrongSpan< const KyberCompressedCiphertext > | ct, |
| const KyberConstants & | mode ) |
Definition at line 364 of file kyber_algos.cpp.
References BOTAN_ASSERT_NOMSG, Botan::Decoding_Error::Decoding_Error(), decompress_ciphertext(), Botan::BufferSlicer::empty(), Botan::KyberConstants::polynomial_compressed_bytes(), Botan::KyberConstants::polynomial_vector_compressed_bytes(), Botan::StrongSpan< T >::size(), and Botan::BufferSlicer::take().
Referenced by decompress_ciphertext(), and Botan::Kyber_PrivateKeyInternal::indcpa_decrypt().
| T Botan::Kyber_Algos::encode_polynomial_vector | ( | const KyberPolyVecNTT & | vec, |
| const KyberConstants & | mode ) |
Definition at line 48 of file kyber_algos.h.
References encode_polynomial_vector(), and Botan::KyberConstants::polynomial_vector_bytes().
| void Botan::Kyber_Algos::encode_polynomial_vector | ( | std::span< uint8_t > | out, |
| const KyberPolyVecNTT & | vec ) |
Definition at line 186 of file kyber_algos.cpp.
References BOTAN_ASSERT_NOMSG, encode_polynomial_vector(), and Botan::BufferStuffer::full().
Referenced by Botan::Kyber_PublicKey::check_key(), Botan::Expanded_Keypair_Codec::encode_keypair(), encode_polynomial_vector(), and encode_polynomial_vector().
| KyberInternalKeypair Botan::Kyber_Algos::expand_keypair | ( | KyberPrivateKeySeed | seed, |
| KyberConstants | mode ) |
NIST FIPS 203, Algorithms 16 (ML-KEM.KeyGen_internal), and 13 (K-PKE.KeyGen)
In contrast to the specification, the expansion of rho and sigma is inlined with the actual PKE key generation. The sampling loops spelled out in FIPS 203 are hidden in the sample_* functions. The keys are kept in memory without serialization, which is deferred until requested.
Definition at line 323 of file kyber_algos.cpp.
References BOTAN_ARG_CHECK, Botan::KyberPrivateKeySeed::d, expand_keypair(), Botan::Kyber_Symmetric_Primitives::G(), Botan::CT::poison(), Botan::rho(), sample_matrix(), Botan::Kyber_Algos::PolynomialSampler< SeedT >::sample_polynomial_vector_cbd_eta1(), Botan::sigma(), Botan::KyberConstants::symmetric_primitives(), Botan::CT::unpoison(), and Botan::CT::unpoison_all().
Referenced by Botan::Seed_Expanding_Keypair_Codec::decode_keypair(), expand_keypair(), and Botan::Kyber_PrivateKey::Kyber_PrivateKey().
|
inline |
Special load_le<> that takes 3 bytes and returns a 32-bit integer.
Definition at line 24 of file kyber_helpers.h.
References Botan::load_le(), and load_le3().
Referenced by load_le3().
| KyberPoly Botan::Kyber_Algos::polynomial_from_message | ( | StrongSpan< const KyberMessage > | msg | ) |
Definition at line 206 of file kyber_algos.cpp.
References BOTAN_ASSERT, Botan::KyberConstants::N, polynomial_from_message(), and Botan::StrongSpan< T >::size().
Referenced by Botan::Kyber_PublicKeyInternal::indcpa_encrypt(), and polynomial_from_message().
| KyberMessage Botan::Kyber_Algos::polynomial_to_message | ( | const KyberPoly & | p | ) |
Definition at line 214 of file kyber_algos.cpp.
References polynomial_to_message(), and Botan::CRYSTALS::Polynomial< Trait, D >::size().
Referenced by Botan::Kyber_PrivateKeyInternal::indcpa_decrypt(), and polynomial_to_message().
| Botan::Kyber_Algos::PolynomialSampler | ( | T | , |
| const KyberConstants & | ) -> PolynomialSampler< T > |
| KyberPolyMat Botan::Kyber_Algos::sample_matrix | ( | StrongSpan< const KyberSeedRho > | seed, |
| bool | transposed, | ||
| const KyberConstants & | mode ) |
Definition at line 382 of file kyber_algos.cpp.
References BOTAN_ASSERT, Botan::KyberConstants::k(), sample_matrix(), Botan::KyberConstants::SEED_BYTES, Botan::StrongSpan< T >::size(), and Botan::KyberConstants::symmetric_primitives().
Referenced by expand_keypair(), and sample_matrix().
| void Botan::Kyber_Algos::sample_polynomial_from_cbd | ( | KyberPoly & | poly, |
| KyberConstants::KyberEta | eta, | ||
| const KyberSamplingRandomness & | randomness ) |
NIST FIPS 203, Algorithm 8 (SamplePolyCBD)
The actual implementation is above. This just dispatches to the correct specialization based on the eta of the chosen mode.
Definition at line 407 of file kyber_algos.cpp.
References Botan::KyberConstants::_2, Botan::KyberConstants::_3, BOTAN_ASSERT_UNREACHABLE, and sample_polynomial_from_cbd().
Referenced by sample_polynomial_from_cbd().