openssl/crypto/evp
slontis 78c44b0594 Add HPKE DHKEM provider support for EC, X25519 and X448.
The code is derived from @sftcd's work in PR #17172.
This PR puts the DHKEM algorithms into the provider layer as
KEM algorithms for EC and ECX.

This PR only implements the DHKEM component of HPKE as specified in
RFC 9180.

crypto/hpke/hpke_util.c has been added for fuctions that will
be shared between DHKEM and HPKE.

API's for EVP_PKEY_auth_encapsulate_init() and EVP_PKEY_auth_decapsulate_init()
have been added to support authenticated encapsulation. auth_init() functions
were chosen rather that a EVP_PKEY_KEM_set_auth() interface to support
future algorithms that could possibly need different init functions.

Internal code has been refactored, so that it can be shared between the DHKEM
and other systems. Since DHKEM operates on low level keys it needs to be
able to do low level ECDH and ECXDH calls without converting the keys
back into EVP_PKEY/EVP_PKEY_CTX form. See ossl_ecx_compute_key(),
ossl_ec_public_from_private()

DHKEM requires API's to derive a key using a seed (IKM). This did not sit
well inside the DHKEM itself as dispatch functions. This functionality
fits better inside the EC and ECX keymanagers keygen, since
they are just variations of keygen where the private key is generated
in a different manner. This should mainly be used for testing purposes.
See ossl_ec_generate_key_dhkem().
It supports this by allowing a settable param to be passed to keygen
(See OSSL_PKEY_PARAM_DHKEM_IKM).
The keygen calls code within ec and ecx dhkem implementation to handle this.
See ossl_ecx_dhkem_derive_private() and ossl_ec_dhkem_derive_private().
These 2 functions are also used by the EC/ECX DHKEM implementations to generate
the sender ephemeral keys.

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19068)
2022-09-23 09:24:47 +01:00
..
asymcipher.c
bio_b64.c crypto/evp/bio_b64.c: improve coding style 2022-07-14 07:22:34 +01:00
bio_enc.c
bio_md.c
bio_ok.c
build.info
c_allc.c Update copyright year 2022-05-03 13:34:51 +01:00
c_alld.c
cmeth_lib.c
ctrl_params_translate.c Update copyright year 2022-05-03 13:34:51 +01:00
dh_ctrl.c
dh_support.c
digest.c evp_md: assert digest is provided for algctx reuse 2022-05-08 23:48:34 -07:00
dsa_ctrl.c
e_aes_cbc_hmac_sha1.c Update copyright year 2022-05-03 13:34:51 +01:00
e_aes_cbc_hmac_sha256.c
e_aes.c evp: Use functions instead of direct structure field references 2022-08-22 10:14:39 +02:00
e_aria.c evp: Simplify ARIA aead cipher definition 2022-08-22 10:14:39 +02:00
e_bf.c
e_camellia.c
e_cast.c
e_chacha20_poly1305.c evp: Use functions instead of direct structure field references 2022-08-22 10:14:39 +02:00
e_des3.c Fix Coverity 1201740 & 1201712: uninitialised values 2022-05-08 17:50:04 +10:00
e_des.c Fix Coverity 1201740 & 1201712: uninitialised values 2022-05-08 17:50:04 +10:00
e_idea.c
e_null.c
e_old.c
e_rc2.c
e_rc4_hmac_md5.c
e_rc4.c
e_rc5.c
e_seed.c
e_sm4.c Update copyright year 2022-05-03 13:34:51 +01:00
e_xcbc_d.c
ec_ctrl.c
ec_support.c Update copyright year 2022-05-03 13:34:51 +01:00
encode.c
evp_cnf.c
evp_enc.c Fix check of EVP_CIPHER_CTX_ctrl 2022-05-24 08:57:37 +02:00
evp_err.c
evp_fetch.c "Reserve" the method store when constructing methods 2022-07-20 07:28:17 +01:00
evp_key.c
evp_lib.c Fix bug in EVP_CIPHER_CTX_get_iv_length() 2022-08-03 12:25:24 +10:00
evp_local.h Add HPKE DHKEM provider support for EC, X25519 and X448. 2022-09-23 09:24:47 +01:00
evp_pbe.c Add support for PBE using hmacWithSM3 2022-09-15 17:03:56 +02:00
evp_pkey.c
evp_rand.c evp: make all _is_a functions accept and handle a NULL argument 2022-07-17 17:51:13 +10:00
evp_utils.c
exchange.c evp: make all _is_a functions accept and handle a NULL argument 2022-07-17 17:51:13 +10:00
kdf_lib.c evp: make all _is_a functions accept and handle a NULL argument 2022-07-17 17:51:13 +10:00
kdf_meth.c
kem.c Add HPKE DHKEM provider support for EC, X25519 and X448. 2022-09-23 09:24:47 +01:00
keymgmt_lib.c Update copyright year 2022-05-03 13:34:51 +01:00
keymgmt_meth.c evp: make all _is_a functions accept and handle a NULL argument 2022-07-17 17:51:13 +10:00
legacy_blake2.c
legacy_md2.c
legacy_md4.c
legacy_md5_sha1.c
legacy_md5.c
legacy_mdc2.c
legacy_meth.h
legacy_ripemd.c
legacy_sha.c
legacy_wp.c
m_null.c
m_sigver.c Update copyright year 2022-05-03 13:34:51 +01:00
mac_lib.c evp: make all _is_a functions accept and handle a NULL argument 2022-07-17 17:51:13 +10:00
mac_meth.c Fix copyrights 2022-02-03 13:56:38 +01:00
names.c
p5_crpt2.c Update copyright year 2022-05-03 13:34:51 +01:00
p5_crpt.c
p_dec.c Fix possible null pointer dereference of evp_pkey_get_legacy() 2022-06-02 12:06:08 +02:00
p_enc.c Fix possible null pointer dereference of evp_pkey_get_legacy() 2022-06-02 12:06:08 +02:00
p_legacy.c
p_lib.c EVP_PKEY_eq: regain compatibility with the 3.0.0 FIPS provider 2022-09-16 08:34:53 +10:00
p_open.c Fix the incorrect checks of EVP_CIPHER_CTX_set_key_length 2022-05-27 07:57:43 +02:00
p_seal.c Remove duplicated #include headers 2022-05-04 13:46:10 +10:00
p_sign.c
p_verify.c
pbe_scrypt.c
pmeth_check.c
pmeth_gn.c Update copyright year 2022-05-03 13:34:51 +01:00
pmeth_lib.c int_ctx_new(): Revert extra OPENSSL_init_crypto() call 2022-05-13 08:30:41 +02:00
signature.c evp: make all _is_a functions accept and handle a NULL argument 2022-07-17 17:51:13 +10:00