]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
sm2: fix {i2d,d2i}_PublicKey EC_KEY is EVP_PKEY_SM2
authorzhaozg <zhaozg@gmail.com>
Sat, 1 Jan 2022 14:45:12 +0000 (22:45 +0800)
committerTomas Mraz <tomas@openssl.org>
Wed, 5 Jan 2022 09:07:48 +0000 (10:07 +0100)
CLA: trivial

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17389)

crypto/asn1/d2i_pu.c
crypto/asn1/i2d_evp.c

index 1be114b8a2a21c03de5dc77171989db7d7d7f757..6d5dd1bc603eb30597f1b86ac663662531cd8b75 100644 (file)
@@ -54,7 +54,7 @@ EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp,
         goto err;
     }
 
-    switch (EVP_PKEY_get_id(ret)) {
+    switch (EVP_PKEY_get_base_id(ret)) {
     case EVP_PKEY_RSA:
         if ((ret->pkey.rsa = d2i_RSAPublicKey(NULL, pp, length)) == NULL) {
             ERR_raise(ERR_LIB_ASN1, ERR_R_ASN1_LIB);
index 8b36388263c35fe786f2a04f5690a1628e12d663..070ac83376aef981dfb9a0ef68a89c86eea8e271 100644 (file)
@@ -131,7 +131,7 @@ int i2d_PublicKey(const EVP_PKEY *a, unsigned char **pp)
 
         return i2d_provided(a, EVP_PKEY_PUBLIC_KEY, output_info, pp);
     }
-    switch (EVP_PKEY_get_id(a)) {
+    switch (EVP_PKEY_get_base_id(a)) {
     case EVP_PKEY_RSA:
         return i2d_RSAPublicKey(EVP_PKEY_get0_RSA(a), pp);
 #ifndef OPENSSL_NO_DSA