]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix no-ec
authorMatt Caswell <matt@openssl.org>
Thu, 6 Feb 2020 15:17:28 +0000 (15:17 +0000)
committerMatt Caswell <matt@openssl.org>
Fri, 7 Feb 2020 23:26:43 +0000 (23:26 +0000)
Recent SM2 related changes were not properly guarded with OPENSSL_NO_EC

Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/11029)

crypto/evp/p_lib.c
crypto/x509/x_all.c

index 95dd96e86bce03b1071a30d263f073602210dbbc..76b4df1dc34cc4c993ed28c0801b2c0d782d6abb 100644 (file)
@@ -403,12 +403,14 @@ int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key)
 {
     int alias = type;
 
+#ifndef OPENSSL_NO_EC
     if (EVP_PKEY_type(type) == EVP_PKEY_EC) {
         const EC_GROUP *group = EC_KEY_get0_group(key);
 
         if (group != NULL && EC_GROUP_get_curve_name(group) == NID_sm2)
             alias = EVP_PKEY_SM2;
     }
+#endif
 
     if (pkey == NULL || !EVP_PKEY_set_type(pkey, type))
         return 0;
index 5a5f09855896525eb7e38b6c99f6dcf0708ec069..89940a0cc905a34966738e1e37a5279b8d61c086 100644 (file)
@@ -44,12 +44,14 @@ static EVP_MD_CTX *make_id_ctx(EVP_PKEY *r, ASN1_OCTET_STRING *id)
         goto error;
     }
 
+#ifndef OPENSSL_NO_EC
     if (id != NULL) {
         if (EVP_PKEY_CTX_set1_id(pctx, id->data, id->length) <= 0) {
             X509err(0, ERR_R_MALLOC_FAILURE);
             goto error;
         }
     }
+#endif
 
     EVP_MD_CTX_set_pkey_ctx(ctx, pctx);