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)
25static_assert(
false,
"botan module 'kyber_common' is useful only when enabling modules 'kyber', 'kyber_90s' or both");
53 OID object_identifier()
const;
54 std::string to_string()
const;
64 bool operator==(const
KyberMode& other)
const {
return m_mode == other.m_mode; }
72class Kyber_PublicKeyInternal;
73class Kyber_PrivateKeyInternal;
87 std::string
algo_name()
const override {
return "Kyber"; }
91 OID object_identifier()
const override;
93 size_t key_length()
const override;
95 size_t estimated_strength()
const override;
97 std::vector<uint8_t> public_key_bits()
const override;
104 return (op == PublicKeyOperation::KeyEncapsulation);
107 std::unique_ptr<PK_Ops::KEM_Encryption> create_kem_encryption_op(std::string_view params,
108 std::string_view provider)
const override;
115 static std::shared_ptr<Kyber_PublicKeyInternal> initialize_from_encoding(std::span<const uint8_t> pub_key,
118 const std::vector<uint8_t>& public_key_bits_raw()
const;
119 const std::vector<uint8_t>& H_public_key_bits_raw()
const;
122 friend class Kyber_KEM_Encryptor;
123 friend class Kyber_KEM_Decryptor;
140 std::unique_ptr<Public_Key> public_key()
const override;
147 std::string_view params,
148 std::string_view provider)
const override;
151 friend class Kyber_KEM_Decryptor;
153 std::shared_ptr<Kyber_PrivateKeyInternal> m_private;
bool operator!=(const KyberMode &other) const
Kyber_PublicKey & operator=(const Kyber_PublicKey &other)=default
std::string algo_name() const override
std::shared_ptr< Kyber_PublicKeyInternal > m_public
Kyber_PublicKey()=default
~Kyber_PublicKey() override=default
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