From 78568d28ad62c586e32e3989de5354fcb014c09f Mon Sep 17 00:00:00 2001 From: Huaxin Lu Date: Wed, 31 May 2023 10:35:41 +0800 Subject: [PATCH] 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: c1ad2f078e89 ("sign-file: Support SM signature") Signed-off-by: Huaxin Lu --- scripts/sign-file.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/sign-file.c b/scripts/sign-file.c index acc9e5f2eb04..68e709f46c72 100644 --- a/scripts/sign-file.c +++ b/scripts/sign-file.c @@ -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); -- GitLab