14#ifndef BOTAN_KYBER_COMMON_H_
15#define BOTAN_KYBER_COMMON_H_
17#include <botan/module_lattice_keys.h>
18#include <botan/pk_keys.h>
21#if !defined(BOTAN_HAS_KYBER_90S) && !defined(BOTAN_HAS_KYBER) && !defined(BOTAN_HAS_ML_KEM)
24 "botan module 'kyber_common' is useful only when enabling at least one of those modules: 'kyber', 'kyber_90s', 'ml_kem'");
58 OID object_identifier()
const;
67 bool is_ml_kem() const;
69 bool is_kyber_round3() const;
71 bool is_available() const;
73 bool operator==(const
KyberMode& other)
const {
return m_mode == other.m_mode; }
81class Kyber_PublicKeyInternal;
82class Kyber_PrivateKeyInternal;
119 std::unique_ptr<PK_Ops::KEM_Encryption> _create_kem_encryption_op(
134 std::shared_ptr<const Kyber_PublicKeyInternal>
m_public;
169 std::unique_ptr<Public_Key>
public_key()
const override;
218 std::shared_ptr<const Kyber_PrivateKeyInternal> m_private;
#define BOTAN_DIAGNOSTIC_POP
#define BOTAN_DIAGNOSTIC_PUSH
#define BOTAN_DIAGNOSTIC_IGNORE_INHERITED_VIA_DOMINANCE
#define BOTAN_PUBLIC_API(maj, min)
#define BOTAN_DEPRECATED(msg)
bool operator!=(const KyberMode &other) const
secure_vector< uint8_t > private_key_bits_with_format(MlPrivateKeyFormat format) const
std::unique_ptr< PK_Ops::KEM_Decryption > _create_kem_decryption_op(RandomNumberGenerator &rng, const PK_KEM_Options_Reader &options) const override
secure_vector< uint8_t > formatted_private_key_bits(MlPrivateKeyFormat format) const override
std::unique_ptr< Public_Key > public_key() const override
bool check_key(RandomNumberGenerator &rng, bool strong) const override
Kyber_PrivateKey(RandomNumberGenerator &rng, KyberMode mode)
MlPrivateKeyFormat private_key_format() const override
secure_vector< uint8_t > formatted_raw_private_key_bits(MlPrivateKeyFormat format) const override
friend class Kyber_KEM_Decryptor
Kyber_PublicKey & operator=(const Kyber_PublicKey &other)=default
std::vector< uint8_t > public_key_bits() const override
Kyber_PublicKey(Kyber_PublicKey &&other)=default
std::vector< uint8_t > raw_public_key_bits() const override
bool check_key(RandomNumberGenerator &rng, bool strong) const override
std::string algo_name() const override
friend class Kyber_KEM_Encryptor
size_t key_length() const override
AlgorithmIdentifier algorithm_identifier() const override
Kyber_PublicKey()=default
~Kyber_PublicKey() override=default
static std::shared_ptr< Kyber_PublicKeyInternal > initialize_from_encoding(std::span< const uint8_t > pub_key, KyberMode m)
bool supports_operation(PublicKeyOperation op) const override
std::shared_ptr< const Kyber_PublicKeyInternal > m_public
OID object_identifier() const override
friend class Kyber_KEM_Decryptor
std::unique_ptr< Private_Key > generate_another(RandomNumberGenerator &rng) const final
Kyber_PublicKey(std::span< const uint8_t > pub_key, KyberMode mode)
Kyber_PublicKey & operator=(Kyber_PublicKey &&other)=default
size_t estimated_strength() const override
std::vector< T, secure_allocator< T > > secure_vector
std::string to_string(ErrorType type)
Convert an ErrorType to string.