openssl/crypto/asn1
Todd Short 2aa2beb06c Fix d2i_PublicKey() for EC keys
o2i_ECPublicKey() requires an EC_KEY structure filled with an EC_GROUP.

o2i_ECPublicKey() is called by d2i_PublicKey(). In order to fulfill the
o2i_ECPublicKey()'s requirement, d2i_PublicKey() needs to be called with
an EVP_PKEY with an EC_KEY containing an EC_GROUP.

However, the call to EVP_PKEY_set_type() frees any existing key structure
inside the EVP_PKEY, thus freeing the EC_KEY with the EC_GROUP that
o2i_ECPublicKey() needs.

This means you can't d2i_PublicKey() for an EC key...

The fix is to check to see if the type is already set appropriately, and
if so, not call EVP_PKEY_set_type().

Reviewed-by: Paul Yang <yang.yang@baishancloud.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8168)
2019-02-08 09:57:26 +00:00
..
a_bitstr.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
a_d2i_fp.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
a_digest.c Coverity fix in some crypto/asn1 code 2018-12-22 18:11:42 +01:00
a_dup.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
a_gentm.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
a_i2d_fp.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
a_int.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
a_mbstr.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
a_object.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
a_octet.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
a_print.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
a_sign.c Coverity fix in some crypto/asn1 code 2018-12-22 18:11:42 +01:00
a_strex.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
a_strnid.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
a_time.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
a_type.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
a_utctm.c typo ANS1 -> ASN1 2018-12-11 20:57:31 +10:00
a_utf8.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
a_verify.c Coverity fix in some crypto/asn1 code 2018-12-22 18:11:42 +01:00
ameth_lib.c Make EVP_PKEY_asn1_add0() stricter about its input 2018-12-07 11:57:04 +01:00
asn1_err.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
asn1_gen.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
asn1_item_list.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
asn1_item_list.h Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
asn1_lib.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
asn1_locl.h Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
asn1_par.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
asn_mime.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
asn_moid.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
asn_mstbl.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
asn_pack.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
bio_asn1.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
bio_ndef.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
build.info Implement internal ASN.1 types INT32, UINT32, INT64, UINT64 2017-04-04 11:29:23 +02:00
charmap.h make update 2019-01-03 09:21:39 +00:00
charmap.pl Update generator copyright year. 2019-01-07 14:01:58 -05:00
d2i_pr.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
d2i_pu.c Fix d2i_PublicKey() for EC keys 2019-02-08 09:57:26 +00:00
evp_asn1.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
f_int.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
f_string.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
i2d_pr.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
i2d_pu.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
n_pkey.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
nsseq.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
p5_pbe.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
p5_pbev2.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
p5_scrypt.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
p8_pkey.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
standard_methods.h Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
t_bitst.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
t_pkey.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
t_spki.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
tasn_dec.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
tasn_enc.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
tasn_fre.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
tasn_new.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
tasn_prn.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
tasn_scn.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
tasn_typ.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
tasn_utl.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
tbl_standard.h Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
x_algor.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
x_bignum.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
x_info.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
x_int64.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
x_long.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
x_pkey.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
x_sig.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
x_spki.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00
x_val.c Following the license change, modify the boilerplates in crypto/asn1/ 2018-12-06 14:24:40 +01:00