#ifndef AWSLC_HEADER_KEM_INTERNAL_H
#define AWSLC_HEADER_KEM_INTERNAL_H
#include <openssl/base.h>
#if defined(__cplusplus)
extern "C" {
#endif
typedef struct {
int (*keygen_deterministic)(uint8_t *ctx,
size_t *ctx_len,
uint8_t *pkey,
size_t *pkey_len,
const uint8_t *seed);
int (*keygen)(uint8_t *public_key,
size_t *public_key_len,
uint8_t *secret_key,
size_t *secret_key_len);
int (*encaps_deterministic)(uint8_t *ciphertext,
size_t *ciphertext_len,
uint8_t *shared_secret,
size_t *shared_secret_len,
const uint8_t *public_key,
const uint8_t *seed);
int (*encaps)(uint8_t *ciphertext,
size_t *ciphertext_len,
uint8_t *shared_secret,
size_t *shared_secret_len,
const uint8_t *public_key);
int (*decaps)(uint8_t *shared_secret,
size_t *shared_secret_len,
const uint8_t *ciphertext,
const uint8_t *secret_key);
} KEM_METHOD;
typedef struct {
int nid;
const uint8_t *oid;
uint8_t oid_len;
const char *comment;
size_t public_key_len;
size_t secret_key_len;
size_t ciphertext_len;
size_t shared_secret_len;
size_t keygen_seed_len;
size_t encaps_seed_len;
const KEM_METHOD *method;
} KEM;
struct kem_key_st {
const KEM *kem;
uint8_t *public_key;
uint8_t *secret_key;
};
const KEM *KEM_find_kem_by_nid(int nid);
const EVP_PKEY_ASN1_METHOD *KEM_find_asn1_by_nid(int nid);
int EVP_PKEY_kem_set_params(EVP_PKEY *pkey, int nid);
KEM_KEY *KEM_KEY_new(void);
int KEM_KEY_init(KEM_KEY *key, const KEM *kem);
void KEM_KEY_free(KEM_KEY *key);
const KEM *KEM_KEY_get0_kem(KEM_KEY* key);
int KEM_KEY_set_raw_public_key(KEM_KEY *key, const uint8_t *in);
int KEM_KEY_set_raw_secret_key(KEM_KEY *key, const uint8_t *in);
int KEM_KEY_set_raw_key(KEM_KEY *key, const uint8_t *in_public,
const uint8_t *in_secret);
#if defined(__cplusplus)
} #endif
#endif