Commit 78568d28 authored by Huaxin Lu's avatar Huaxin Lu
Browse files

scripts: Fix issue of module signing with openssl 3.x

openEuler inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7BZZ1


CVE: NA

--------------------------------------------------------

The SM2 signature for module signing is only supported
with openEuler openssl 1.1.1. Fix the compile option to
avoid compilation failure with openssl 3.x.

Fixes: c1ad2f07 ("sign-file: Support SM signature")
Signed-off-by: default avatarHuaxin Lu <luhuaxin1@huawei.com>
parent 38ded397
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -206,7 +206,7 @@ static X509 *read_x509(const char *x509_name)
	return x509;
}

#if defined(EVP_PKEY_SM2)
#if defined(EVP_PKEY_SM2) && OPENSSL_VERSION_NUMBER < 0x10200000L
static int pkey_is_sm2(EVP_PKEY *pkey)
{
	EC_KEY *eckey = NULL;
@@ -242,7 +242,7 @@ int main(int argc, char **argv)
	unsigned int use_signed_attrs;
	const EVP_MD *digest_algo;
	EVP_PKEY *private_key;
#if defined(EVP_PKEY_SM2)
#if defined(EVP_PKEY_SM2) && OPENSSL_VERSION_NUMBER < 0x10200000L
	EVP_PKEY *public_key;
#endif

@@ -329,7 +329,7 @@ int main(int argc, char **argv)
		digest_algo = EVP_get_digestbyname(hash_algo);
		ERR(!digest_algo, "EVP_get_digestbyname");

#if defined(EVP_PKEY_SM2)
#if defined(EVP_PKEY_SM2) && OPENSSL_VERSION_NUMBER < 0x10200000L
	if (pkey_is_sm2(private_key))
		EVP_PKEY_set_alias_type(private_key, EVP_PKEY_SM2);