123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- #ifndef OSSL_INTERNAL_HPKE_UTIL_H
- # define OSSL_INTERNAL_HPKE_UTIL_H
- # pragma once
- # define OSSL_HPKE_MAX_SECRET 64
- # define OSSL_HPKE_MAX_PUBLIC 133
- # define OSSL_HPKE_MAX_PRIVATE 66
- # define OSSL_HPKE_MAX_KDF_INPUTLEN 64
- # define OSSL_HPKE_MAX_NONCELEN 12
- typedef struct {
- uint16_t kem_id;
- const char *keytype;
- const char *groupname;
- const char *mdname;
- size_t Nsecret;
- size_t Nenc;
- size_t Npk;
- size_t Nsk;
- uint8_t bitmask;
- } OSSL_HPKE_KEM_INFO;
- typedef struct {
- uint16_t kdf_id;
- const char *mdname;
- size_t Nh;
- } OSSL_HPKE_KDF_INFO;
- typedef struct {
- uint16_t aead_id;
- const char *name;
- size_t taglen;
- size_t Nk;
- size_t Nn;
- } OSSL_HPKE_AEAD_INFO;
- const OSSL_HPKE_KEM_INFO *ossl_HPKE_KEM_INFO_find_curve(const char *curve);
- const OSSL_HPKE_KEM_INFO *ossl_HPKE_KEM_INFO_find_id(uint16_t kemid);
- const OSSL_HPKE_KEM_INFO *ossl_HPKE_KEM_INFO_find_random(OSSL_LIB_CTX *ctx);
- const OSSL_HPKE_KDF_INFO *ossl_HPKE_KDF_INFO_find_id(uint16_t kdfid);
- const OSSL_HPKE_KDF_INFO *ossl_HPKE_KDF_INFO_find_random(OSSL_LIB_CTX *ctx);
- const OSSL_HPKE_AEAD_INFO *ossl_HPKE_AEAD_INFO_find_id(uint16_t aeadid);
- const OSSL_HPKE_AEAD_INFO *ossl_HPKE_AEAD_INFO_find_random(OSSL_LIB_CTX *ctx);
- int ossl_hpke_kdf_extract(EVP_KDF_CTX *kctx,
- unsigned char *prk, size_t prklen,
- const unsigned char *salt, size_t saltlen,
- const unsigned char *ikm, size_t ikmlen);
- int ossl_hpke_kdf_expand(EVP_KDF_CTX *kctx,
- unsigned char *okm, size_t okmlen,
- const unsigned char *prk, size_t prklen,
- const unsigned char *info, size_t infolen);
- int ossl_hpke_labeled_extract(EVP_KDF_CTX *kctx,
- unsigned char *prk, size_t prklen,
- const unsigned char *salt, size_t saltlen,
- const char *protocol_label,
- const unsigned char *suiteid, size_t suiteidlen,
- const char *label,
- const unsigned char *ikm, size_t ikmlen);
- int ossl_hpke_labeled_expand(EVP_KDF_CTX *kctx,
- unsigned char *okm, size_t okmlen,
- const unsigned char *prk, size_t prklen,
- const char *protocol_label,
- const unsigned char *suiteid, size_t suiteidlen,
- const char *label,
- const unsigned char *info, size_t infolen);
- EVP_KDF_CTX *ossl_kdf_ctx_create(const char *kdfname, const char *mdname,
- OSSL_LIB_CTX *libctx, const char *propq);
- int ossl_hpke_str2suite(const char *suitestr, OSSL_HPKE_SUITE *suite);
- #endif
|