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)
{
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;
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);