14#ifndef BOTAN_KYBER_COMMON_H_
15#define BOTAN_KYBER_COMMON_H_
17#include <botan/asn1_obj.h>
18#include <botan/der_enc.h>
19#include <botan/exceptn.h>
20#include <botan/pk_keys.h>
24#if !defined(BOTAN_HAS_KYBER_90S) && !defined(BOTAN_HAS_KYBER) && !defined(BOTAN_HAS_ML_KEM)
27 "botan module 'kyber_common' is useful only when enabling at least one of those modules: 'kyber', 'kyber_90s', 'ml_kem'");
59 OID object_identifier()
const;
60 std::string to_string()
const;
68 bool is_ml_kem() const;
70 bool is_kyber_round3() const;
72 bool is_available() const;
74 bool operator==(const
KyberMode& other)
const {
return m_mode == other.m_mode; }
82class Kyber_PublicKeyInternal;
83class Kyber_PrivateKeyInternal;
97 std::string algo_name()
const override;
101 OID object_identifier()
const override;
103 size_t key_length()
const override;
105 size_t estimated_strength()
const override;
107 std::vector<uint8_t> raw_public_key_bits()
const override;
109 std::vector<uint8_t> public_key_bits()
const override;
116 return (op == PublicKeyOperation::KeyEncapsulation);
119 std::unique_ptr<PK_Ops::KEM_Encryption> create_kem_encryption_op(std::string_view params,
120 std::string_view provider)
const override;
149 std::unique_ptr<Public_Key> public_key()
const override;
158 std::string_view params,
159 std::string_view provider)
const override;
164 std::shared_ptr<Kyber_PrivateKeyInternal> m_private;
bool operator!=(const KyberMode &other) const
Kyber_PublicKey & operator=(const Kyber_PublicKey &other)=default
std::shared_ptr< Kyber_PublicKeyInternal > m_public
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
int(* final)(unsigned char *, CTX *)
#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)
std::vector< T, secure_allocator< T > > secure_vector