!20 fix algorithm flag for sm2 and sm3

From: @HuaxinLuGitee 
Reviewed-by: @zhuchunyi 
Signed-off-by: @zhuchunyi
This commit is contained in:
openeuler-ci-bot 2022-11-01 03:03:59 +00:00 committed by Gitee
commit 1feb6d1bdf
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 9 additions and 6 deletions

View File

@ -16,7 +16,7 @@ index afa00e2..4aabf5d 100644
return -1; return -1;
} }
+#if defined(CKM_SM2_WITH_SM3) +#if defined(CKM_SM2_WITH_SM3) || defined(CKM_NSS_SM2_WITH_SM3)
+static int sm2_sign(SECItem *sig, cms_context *cms, SECKEYPrivateKey *privkey, +static int sm2_sign(SECItem *sig, cms_context *cms, SECKEYPrivateKey *privkey,
+ SECItem *content, SECOidData *oid) + SECItem *content, SECOidData *oid)
+{ +{
@ -92,7 +92,7 @@ index afa00e2..4aabf5d 100644
memset (&tmp, '\0', sizeof (tmp)); memset (&tmp, '\0', sizeof (tmp));
SECStatus status; SECStatus status;
+#if defined(CKM_SM2_WITH_SM3) +#if defined(CKM_SM2_WITH_SM3) || defined(CKM_NSS_SM2_WITH_SM3)
+ if (oidt == SEC_OID_SM2_WITH_SM3) { + if (oidt == SEC_OID_SM2_WITH_SM3) {
+ status = sm2_sign(&tmp, cms, privkey, sign_content, oid) ? + status = sm2_sign(&tmp, cms, privkey, sign_content, oid) ?
+ SECFailure : SECSuccess; + SECFailure : SECSuccess;

View File

@ -15,7 +15,7 @@ index d13b2cb..7b6dc0e 100644
.size = 20 .size = 20
}, },
#endif #endif
+#if defined(CKM_SM2_WITH_SM3) +#if defined(CKM_SM2_WITH_SM3) || defined(CKM_NSS_SM2_WITH_SM3)
+ {.name = "sm3", + {.name = "sm3",
+ .digest_tag = SEC_OID_SM3, + .digest_tag = SEC_OID_SM3,
+ .signature_tag = SEC_OID_SM2_WITH_SM3, + .signature_tag = SEC_OID_SM2_WITH_SM3,

View File

@ -2,7 +2,7 @@
Name: pesign Name: pesign
Summary: Signing utility for UEFI binaries Summary: Signing utility for UEFI binaries
Version: 0.113 Version: 0.113
Release: 6 Release: 7
License: GPLv2 License: GPLv2
URL: https://github.com/vathpela/pesign URL: https://github.com/vathpela/pesign
Source0: https://github.com/rhboot/pesign/archive/113.tar.gz Source0: https://github.com/rhboot/pesign/archive/113.tar.gz
@ -20,8 +20,8 @@ Patch0001: Fix-the-build-with-nss-3.44.patch
Patch0002: remove-superfluous-type-settings.patch Patch0002: remove-superfluous-type-settings.patch
# Feature: support SM2 and SM3 # Feature: support SM2 and SM3
Patch9000: pesign-support-SM3-digest-algorithm.patch Patch9000: Feature-pesign-support-SM3-digest-algorithm.patch
Patch9001: pesign-support-SM2-signature-algorithm.patch Patch9001: Feature-pesign-support-SM2-signature-algorithm.patch
%description %description
pesign is a command line tool for manipulating signatures and pesign is a command line tool for manipulating signatures and
@ -98,6 +98,9 @@ exit 0
%{_mandir}/man*/* %{_mandir}/man*/*
%changelog %changelog
* Mon Oct 31 2022 luhuaxin <luhuaxin1@huawei.com> - 0.113-7
- fix the algorithm flag for sm2,sm3
* Mon Oct 10 2022 godcansee <liu332084460@foxmail.com> - 0.113-6 * Mon Oct 10 2022 godcansee <liu332084460@foxmail.com> - 0.113-6
- add feature to support for sm2,sm3 - add feature to support for sm2,sm3