23#include "ext_headers.h"
25#if defined __has_include
26#if __has_include("lc_hqc_256.h")
27#include "lc_hqc_256.h"
28#define LC_HQC_256_ENABLED
30#if __has_include("lc_hqc_192.h")
31#include "lc_hqc_192.h"
32#define LC_HQC_192_ENABLED
34#if __has_include("lc_hqc_128.h")
35#include "lc_hqc_128.h"
36#define LC_HQC_128_ENABLED
39#error "Compiler misses __has_include"
84#ifdef LC_HQC_256_ENABLED
85 struct lc_hqc_256_sk sk_256;
87#ifdef LC_HQC_192_ENABLED
88 struct lc_hqc_192_sk sk_192;
90#ifdef LC_HQC_128_ENABLED
91 struct lc_hqc_128_sk sk_128;
102#ifdef LC_HQC_256_ENABLED
103 struct lc_hqc_256_pk pk_256;
105#ifdef LC_HQC_192_ENABLED
106 struct lc_hqc_192_pk pk_192;
108#ifdef LC_HQC_128_ENABLED
109 struct lc_hqc_128_pk pk_128;
120#ifdef LC_HQC_256_ENABLED
121 struct lc_hqc_256_ct ct_256;
123#ifdef LC_HQC_192_ENABLED
124 struct lc_hqc_192_ct ct_192;
126#ifdef LC_HQC_128_ENABLED
127 struct lc_hqc_128_ct ct_128;
138#ifdef LC_HQC_256_ENABLED
139 struct lc_hqc_256_ss ss_256;
141#ifdef LC_HQC_192_ENABLED
142 struct lc_hqc_192_ss ss_192;
144#ifdef LC_HQC_128_ENABLED
145 struct lc_hqc_128_ss ss_128;
369 struct lc_rng_ctx *rng_ctx,
enum lc_hqc_type hqc_type);
393 const uint8_t *seed,
size_t seedlen,
int lc_hqc_dec(struct lc_hqc_ss *ss, const struct lc_hqc_ct *ct, const struct lc_hqc_sk *sk)
Key decapsulation.
int lc_hqc_keypair_from_seed(struct lc_hqc_pk *pk, struct lc_hqc_sk *sk, const uint8_t *seed, size_t seedlen, enum lc_hqc_type hqc_type)
Generates HQC public and private key from a given seed.
int lc_hqc_enc(struct lc_hqc_ct *ct, struct lc_hqc_ss *ss, const struct lc_hqc_pk *pk)
Key encapsulation.
enum lc_hqc_type lc_hqc_ss_type(const struct lc_hqc_ss *ss)
Obtain HQC type from shared secret.
LC_PURE unsigned int lc_hqc_pk_size(enum lc_hqc_type hqc_type)
Return the size of the HQC public key.
int lc_hqc_sk_load(struct lc_hqc_sk *sk, const uint8_t *src_key, size_t src_key_len)
Load a HQC secret key provided with a buffer into the leancrypto data structure.
LC_PURE unsigned int lc_hqc_ct_size(enum lc_hqc_type hqc_type)
Return the size of the HQC ciphertext.
int lc_hqc_ct_ptr(uint8_t **hqc_ct, size_t *hqc_ct_len, struct lc_hqc_ct *ct)
Obtain the reference to the HQC ciphertext and its length.
int lc_hqc_pk_ptr(uint8_t **hqc_key, size_t *hqc_key_len, struct lc_hqc_pk *pk)
Obtain the reference to the HQC key and its length.
int lc_hqc_ct_load(struct lc_hqc_ct *ct, const uint8_t *src_key, size_t src_key_len)
Load a HQC ciphertext key provided with a buffer into the leancrypto data structure.
int lc_hqc_pk_load(struct lc_hqc_pk *pk, const uint8_t *src_key, size_t src_key_len)
Load a HQC public key provided with a buffer into the leancrypto data structure.
int lc_hqc_ss_load(struct lc_hqc_ss *ss, const uint8_t *src_key, size_t src_key_len)
Load a HQC shared secret provided with a buffer into the leancrypto data structure.
LC_PURE unsigned int lc_hqc_sk_size(enum lc_hqc_type hqc_type)
Return the size of the HQC secret key.
int lc_hqc_enc_kdf(struct lc_hqc_ct *ct, uint8_t *ss, size_t ss_len, const struct lc_hqc_pk *pk)
Key encapsulation with KDF applied to shared secret.
LC_PURE unsigned int lc_hqc_ss_size(enum lc_hqc_type hqc_type)
Return the size of the HQC shared secret.
int lc_hqc_sk_ptr(uint8_t **hqc_key, size_t *hqc_key_len, struct lc_hqc_sk *sk)
Obtain the reference to the HQC key and its length.
enum lc_hqc_type lc_hqc_ct_type(const struct lc_hqc_ct *ct)
Obtain HQC type from HQC ciphertext.
enum lc_hqc_type lc_hqc_sk_type(const struct lc_hqc_sk *sk)
Obtain HQC type from secret key.
int lc_hqc_dec_kdf(uint8_t *ss, size_t ss_len, const struct lc_hqc_ct *ct, const struct lc_hqc_sk *sk)
Key decapsulation with KDF applied to shared secret.
enum lc_hqc_type lc_hqc_pk_type(const struct lc_hqc_pk *pk)
Obtain HQC type from public key.
int lc_hqc_ss_ptr(uint8_t **hqc_ss, size_t *hqc_ss_len, struct lc_hqc_ss *ss)
Obtain the reference to the HQC shared secret and its length.
int lc_hqc_keypair(struct lc_hqc_pk *pk, struct lc_hqc_sk *sk, struct lc_rng_ctx *rng_ctx, enum lc_hqc_type hqc_type)
Generates public and private key for IND-CCA2-secure HQC key encapsulation mechanism.
enum lc_hqc_type hqc_type
union lc_hqc_pk::@035140023341273367341066260121114102352303165040 key
union lc_hqc_sk::@277011270306077302103004123166265263064060374206 key
enum lc_hqc_type hqc_type
union lc_hqc_ss::@300214321151341161115047234062220323136301166037 key
enum lc_hqc_type hqc_type
enum lc_hqc_type hqc_type
union lc_hqc_ct::@131304226346244126225011227345330032163170154262 key