liboqs
Loading...
Searching...
No Matches
kem.h
Go to the documentation of this file.
1
21#ifndef OQS_KEM_H
22#define OQS_KEM_H
23
24#include <stdbool.h>
25#include <stddef.h>
26#include <stdint.h>
27
28#include <oqs/oqs.h>
29
30#if defined(__cplusplus)
31extern "C" {
32#endif
33
35#define OQS_KEM_alg_bike_l1 "BIKE-L1"
37#define OQS_KEM_alg_bike_l3 "BIKE-L3"
39#define OQS_KEM_alg_bike_l5 "BIKE-L5"
41
42#define OQS_KEM_alg_classic_mceliece_348864 "Classic-McEliece-348864"
44#define OQS_KEM_alg_classic_mceliece_348864f "Classic-McEliece-348864f"
46#define OQS_KEM_alg_classic_mceliece_460896 "Classic-McEliece-460896"
48#define OQS_KEM_alg_classic_mceliece_460896f "Classic-McEliece-460896f"
50#define OQS_KEM_alg_classic_mceliece_6688128 "Classic-McEliece-6688128"
52#define OQS_KEM_alg_classic_mceliece_6688128f "Classic-McEliece-6688128f"
54#define OQS_KEM_alg_classic_mceliece_6960119 "Classic-McEliece-6960119"
56#define OQS_KEM_alg_classic_mceliece_6960119f "Classic-McEliece-6960119f"
58#define OQS_KEM_alg_classic_mceliece_8192128 "Classic-McEliece-8192128"
60#define OQS_KEM_alg_classic_mceliece_8192128f "Classic-McEliece-8192128f"
62#define OQS_KEM_alg_hqc_128 "HQC-128"
64#define OQS_KEM_alg_hqc_192 "HQC-192"
66#define OQS_KEM_alg_hqc_256 "HQC-256"
68#define OQS_KEM_alg_kyber_512 "Kyber512"
70#define OQS_KEM_alg_kyber_768 "Kyber768"
72#define OQS_KEM_alg_kyber_1024 "Kyber1024"
74#define OQS_KEM_alg_ml_kem_512 "ML-KEM-512"
76#define OQS_KEM_alg_ml_kem_768 "ML-KEM-768"
78#define OQS_KEM_alg_ml_kem_1024 "ML-KEM-1024"
80
81#define OQS_KEM_alg_ntruprime_sntrup761 "sntrup761"
83#define OQS_KEM_alg_frodokem_640_aes "FrodoKEM-640-AES"
85#define OQS_KEM_alg_frodokem_640_shake "FrodoKEM-640-SHAKE"
87#define OQS_KEM_alg_frodokem_976_aes "FrodoKEM-976-AES"
89#define OQS_KEM_alg_frodokem_976_shake "FrodoKEM-976-SHAKE"
91#define OQS_KEM_alg_frodokem_1344_aes "FrodoKEM-1344-AES"
93#define OQS_KEM_alg_frodokem_1344_shake "FrodoKEM-1344-SHAKE"
94// EDIT-WHEN-ADDING-KEM
96
98#define OQS_KEM_algs_length 29
100
110OQS_API const char *OQS_KEM_alg_identifier(size_t i);
111
121
128OQS_API int OQS_KEM_alg_is_enabled(const char *method_name);
129
133typedef struct OQS_KEM {
134
136 const char *method_name;
137
144 const char *alg_version;
145
148
151
160
172 OQS_STATUS (*keypair)(uint8_t *public_key, uint8_t *secret_key);
173
186 OQS_STATUS (*encaps)(uint8_t *ciphertext, uint8_t *shared_secret, const uint8_t *public_key);
187
200 OQS_STATUS (*decaps)(uint8_t *shared_secret, const uint8_t *ciphertext, const uint8_t *secret_key);
201
203
213OQS_API OQS_KEM *OQS_KEM_new(const char *method_name);
214
227OQS_API OQS_STATUS OQS_KEM_keypair(const OQS_KEM *kem, uint8_t *public_key, uint8_t *secret_key);
228
242OQS_API OQS_STATUS OQS_KEM_encaps(const OQS_KEM *kem, uint8_t *ciphertext, uint8_t *shared_secret, const uint8_t *public_key);
243
257OQS_API OQS_STATUS OQS_KEM_decaps(const OQS_KEM *kem, uint8_t *shared_secret, const uint8_t *ciphertext, const uint8_t *secret_key);
258
265
266#ifdef OQS_ENABLE_KEM_BIKE
267#include <oqs/kem_bike.h>
268#endif /* OQS_ENABLE_KEM_BIKE */
270#ifdef OQS_ENABLE_KEM_CLASSIC_MCELIECE
271#include <oqs/kem_classic_mceliece.h>
272#endif /* OQS_ENABLE_KEM_CLASSIC_MCELIECE */
273#ifdef OQS_ENABLE_KEM_HQC
274#include <oqs/kem_hqc.h>
275#endif /* OQS_ENABLE_KEM_HQC */
276#ifdef OQS_ENABLE_KEM_KYBER
277#include <oqs/kem_kyber.h>
278#endif /* OQS_ENABLE_KEM_KYBER */
279#ifdef OQS_ENABLE_KEM_ML_KEM
280#include <oqs/kem_ml_kem.h>
281#endif /* OQS_ENABLE_KEM_ML_KEM */
283#ifdef OQS_ENABLE_KEM_NTRUPRIME
284#include <oqs/kem_ntruprime.h>
285#endif /* OQS_ENABLE_KEM_NTRUPRIME */
286#ifdef OQS_ENABLE_KEM_FRODOKEM
287#include <oqs/kem_frodokem.h>
288#endif /* OQS_ENABLE_KEM_FRODOKEM */
289// EDIT-WHEN-ADDING-KEM
290
291#if defined(__cplusplus)
292} // extern "C"
293#endif
294
295#endif // OQS_KEM_H
#define OQS_API
Definition common.h:92
OQS_STATUS
Definition common.h:114
OQS_API OQS_STATUS OQS_KEM_decaps(const OQS_KEM *kem, uint8_t *shared_secret, const uint8_t *ciphertext, const uint8_t *secret_key)
OQS_API OQS_STATUS OQS_KEM_keypair(const OQS_KEM *kem, uint8_t *public_key, uint8_t *secret_key)
OQS_API OQS_KEM * OQS_KEM_new(const char *method_name)
OQS_API const char * OQS_KEM_alg_identifier(size_t i)
OQS_API int OQS_KEM_alg_count(void)
OQS_API OQS_STATUS OQS_KEM_encaps(const OQS_KEM *kem, uint8_t *ciphertext, uint8_t *shared_secret, const uint8_t *public_key)
OQS_API int OQS_KEM_alg_is_enabled(const char *method_name)
OQS_API void OQS_KEM_free(OQS_KEM *kem)
struct OQS_KEM OQS_KEM
Definition kem.h:133
const char * method_name
Definition kem.h:136
size_t length_shared_secret
Definition kem.h:159
size_t length_ciphertext
Definition kem.h:157
size_t length_secret_key
Definition kem.h:155
uint8_t claimed_nist_level
Definition kem.h:147
OQS_STATUS(* decaps)(uint8_t *shared_secret, const uint8_t *ciphertext, const uint8_t *secret_key)
Definition kem.h:200
OQS_STATUS(* encaps)(uint8_t *ciphertext, uint8_t *shared_secret, const uint8_t *public_key)
Definition kem.h:186
const char * alg_version
Definition kem.h:144
size_t length_public_key
Definition kem.h:153
bool ind_cca
Definition kem.h:150
OQS_STATUS(* keypair)(uint8_t *public_key, uint8_t *secret_key)
Definition kem.h:172