openssl/crypto/evp
Matt Caswell fc52ae8c4b Don't copy parameters on setting a key in libssl
Whenever we set a private key in libssl, we first found the certificate
that matched the key algorithm. Then we copied the key parameters from the
private key into the public key for the certficate before finally checking
that the private key matched the public key in the certificate. This makes
no sense! Part of checking the private key is to make sure that the
parameters match. It seems that this code has been present since SSLeay.
Perhaps at some point it made sense to do this - but it doesn't any more.

We remove that piece of code altogether. The previous code also had the
undocumented side effect of removing the certificate if the key didn't
match. This makes sense if you've just overwritten the parameters in the
certificate with bad values - but doesn't seem to otherwise. I've also
removed that error logic.

Due to issue #13893, the public key associated with the certificate is
always a legacy key. EVP_PKEY_copy_parameters will downgrade the "from"
key to legacy if the target is legacy, so this means that in libssl all
private keys were always downgraded to legacy when they are first set
in the SSL/SSL_CTX. Removing the EVP_PKEY_copy_parameters code has the
added benefit of removing that downgrade.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13899)
2021-01-22 09:30:53 +00:00
..
asymcipher.c
bio_b64.c
bio_enc.c
bio_md.c
bio_ok.c
build.info EVP_PKEY & EC_KEY: Make EC EVP_PKEY_CTX parameter ctrls / setters more available 2020-12-16 11:56:38 +01:00
c_allc.c
c_alld.c
cmeth_lib.c
dh_ctrl.c Fixes related to broken DH support in CMS 2021-01-21 18:08:02 +01:00
dh_support.c EVP_PKEY & DH: Make DH EVP_PKEY_CTX parameter ctrls / setters more available 2020-12-16 11:55:39 +01:00
digest.c Cache Digest constants 2020-12-23 21:12:18 +01:00
dsa_ctrl.c EVP_PKEY & DSA: Make DSA EVP_PKEY_CTX parameter ctrls / setters more available 2020-11-27 15:30:51 +01:00
e_aes_cbc_hmac_sha1.c remove unused assignments 2020-12-03 11:21:33 +10:00
e_aes_cbc_hmac_sha256.c remove unused assignments 2020-12-03 11:21:33 +10:00
e_aes.c
e_aria.c
e_bf.c
e_camellia.c
e_cast.c
e_chacha20_poly1305.c
e_des3.c
e_des.c
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
e_xcbc_d.c
ec_ctrl.c EVP_PKEY & EC_KEY: Make EC EVP_PKEY_CTX parameter ctrls / setters more available 2020-12-16 11:56:38 +01:00
ec_support.c EVP_PKEY & EC_KEY: Make EC EVP_PKEY_CTX parameter ctrls / setters more available 2020-12-16 11:56:38 +01:00
encode.c
evp_cnf.c
evp_enc.c Don't call EVP_CIPHER_CTX_block_size() to find the block size 2020-12-30 09:32:14 +01:00
evp_err.c Enable locking on the primary DRBG when we create it 2021-01-14 17:30:46 +00:00
evp_fetch.c Use centralized fetching errors 2021-01-12 19:02:11 +01:00
evp_key.c
evp_lib.c Rename EVP_CIPHER_CTX_get_iv and EVP_CIPHER_CTX_get_iv_state for clarity 2021-01-18 14:27:44 +01:00
evp_local.h
evp_pbe.c
evp_pkey.c Adapt everything else to the updated OSSL_ENCODER_CTX_new_by_EVP_PKEY() 2020-12-02 13:37:20 +01:00
evp_rand.c Enable locking on the primary DRBG when we create it 2021-01-14 17:30:46 +00:00
evp_utils.c
exchange.c Pass correct maximum output length to provider derive operation 2021-01-21 18:08:02 +01:00
kdf_lib.c
kdf_meth.c
kem.c
keymgmt_lib.c
keymgmt_meth.c
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
mac_lib.c
mac_meth.c
names.c
p5_crpt2.c
p5_crpt.c
p_dec.c Drop OPENSSL_NO_RSA everywhere 2020-12-20 12:19:42 +01:00
p_enc.c Drop OPENSSL_NO_RSA everywhere 2020-12-20 12:19:42 +01:00
p_legacy.c
p_lib.c Don't copy parameters on setting a key in libssl 2021-01-22 09:30:53 +00:00
p_open.c
p_seal.c
p_sign.c
p_verify.c
pbe_scrypt.c
pmeth_check.c
pmeth_gn.c
pmeth_lib.c Drop OPENSSL_NO_RSA everywhere 2020-12-20 12:19:42 +01:00
signature.c