Botan
3.7.1
Crypto and TLS for C&
Toggle main menu visibility
Main Page
Related Pages
Topics
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Variables
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
Enumerations
a
c
d
e
f
g
h
k
l
m
n
o
p
r
s
t
u
v
w
Enumerator
c
d
f
i
m
n
r
s
t
Concepts
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
f
h
i
m
n
o
p
r
s
t
u
v
w
Enumerations
b
c
d
e
k
m
n
o
p
s
t
x
Enumerator
_
a
b
c
d
e
f
h
k
l
m
n
p
q
r
s
t
u
w
x
Related Symbols
b
c
d
e
f
k
o
p
s
t
x
Files
File List
File Members
All
_
a
b
c
d
e
f
i
k
m
n
o
p
q
s
t
u
w
x
y
z
Functions
b
c
Variables
Typedefs
b
c
e
p
t
Enumerations
Enumerator
b
c
d
e
k
n
Macros
_
a
b
c
f
m
n
q
s
t
w
src
lib
pubkey
classic_mceliece
cmce_encaps.h
Go to the documentation of this file.
1
/*
2
* Classic McEliece Encapsulation
3
* (C) 2023 Jack Lloyd
4
* 2023,2024 Fabian Albert, Amos Treiber - Rohde & Schwarz Cybersecurity
5
*
6
* Botan is released under the Simplified BSD License (see license.txt)
7
**/
8
9
#ifndef BOTAN_CMCE_ENCAPS_H_
10
#define BOTAN_CMCE_ENCAPS_H_
11
12
#include <botan/cmce.h>
13
#include <botan/pk_keys.h>
14
#include <botan/pk_ops.h>
15
#include <botan/internal/cmce_field_ordering.h>
16
#include <botan/internal/cmce_keys_internal.h>
17
#include <botan/internal/cmce_matrix.h>
18
#include <botan/internal/cmce_parameters.h>
19
#include <botan/internal/cmce_poly.h>
20
#include <botan/internal/cmce_types.h>
21
#include <botan/internal/pk_ops_impl.h>
22
23
namespace
Botan
{
24
25
/**
26
* Classic McEliece Encapsulation Operation
27
*/
28
class
BOTAN_TEST_API
Classic_McEliece_Encryptor
final
:
public
PK_Ops::KEM_Encryption_with_KDF
{
29
public
:
30
Classic_McEliece_Encryptor
(std::shared_ptr<Classic_McEliece_PublicKeyInternal> key, std::string_view kdf) :
31
KEM_Encryption_with_KDF(kdf), m_key(std::move(key)) {}
30
Classic_McEliece_Encryptor
(std::shared_ptr<Classic_McEliece_PublicKeyInternal> key, std::string_view kdf) : {
…
}
32
33
size_t
raw_kem_shared_key_length
()
const override
{
return
m_key->params().hash_out_bytes(); }
34
35
size_t
encapsulated_key_length
()
const override
{
return
m_key->params().ciphertext_size(); }
36
37
void
raw_kem_encrypt(std::span<uint8_t> out_encapsulated_key,
38
std::span<uint8_t> out_shared_key,
39
RandomNumberGenerator
& rng)
override
;
40
41
private
:
42
std::shared_ptr<Classic_McEliece_PublicKeyInternal> m_key;
43
44
/**
45
* @brief Encodes an error vector by multiplying it with the Classic McEliece matrix.
46
*/
47
CmceCodeWord
encode(
const
Classic_McEliece_Parameters
& params,
48
const
CmceErrorVector
& e,
49
const
Classic_McEliece_Matrix
& mat)
const
;
50
51
/**
52
* @brief Fixed-weight-vector generation algorithm according to ISO McEliece.
53
*/
54
std::optional<CmceErrorVector> fixed_weight_vector_gen(
const
Classic_McEliece_Parameters
& params,
55
RandomNumberGenerator
& rng)
const
;
56
};
28
class
BOTAN_TEST_API
Classic_McEliece_Encryptor
final
:
public
PK_Ops::KEM_Encryption_with_KDF
{
…
};
57
58
}
// namespace Botan
59
60
#endif
// BOTAN_CMCE_ENCAPS_H_
BOTAN_TEST_API
#define BOTAN_TEST_API
Definition
api.h:39
Botan::Classic_McEliece_Encryptor
Definition
cmce_encaps.h:28
Botan::Classic_McEliece_Encryptor::Classic_McEliece_Encryptor
Classic_McEliece_Encryptor(std::shared_ptr< Classic_McEliece_PublicKeyInternal > key, std::string_view kdf)
Definition
cmce_encaps.h:30
Botan::Classic_McEliece_Encryptor::encapsulated_key_length
size_t encapsulated_key_length() const override
Definition
cmce_encaps.h:35
Botan::Classic_McEliece_Encryptor::raw_kem_shared_key_length
size_t raw_kem_shared_key_length() const override
Definition
cmce_encaps.h:33
Botan::Classic_McEliece_Matrix
Representation of the binary Classic McEliece matrix H, with H = (I_mt | T).
Definition
cmce_matrix.h:26
Botan::Classic_McEliece_Parameters
Definition
cmce_parameters.h:29
Botan::PK_Ops::KEM_Encryption_with_KDF
Definition
pk_ops_impl.h:122
Botan::RandomNumberGenerator
Definition
rng.h:31
Botan::Strong
Definition
strong_type.h:196
final
int(* final)(unsigned char *, CTX *)
Definition
commoncrypto_hash.cpp:29
Botan
Definition
alg_id.cpp:13
Generated by
1.12.0