!106 python3: add the sm3 method for obtaining the salt value

From: @hanxinke
Reviewed-by: @xiezhipeng1
Signed-off-by: @xiezhipeng1
This commit is contained in:
openeuler-ci-bot 2021-10-28 13:06:45 +00:00 committed by Gitee
commit 1174a273a4
2 changed files with 44 additions and 1 deletions

View File

@ -0,0 +1,34 @@
From 1e245b53ec5ae96ca6ad11edd72b812f9ae0d141 Mon Sep 17 00:00:00 2001
From: hanxinke <hanxinke@huawei.com>
Date: Tue, 3 Aug 2021 09:34:30 +0800
Subject: [PATCH] add the sm3 method for obtaining the salt value
Signed-off-by: hanxinke <hanxinke@huawei.com>
---
Lib/crypt.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/Lib/crypt.py b/Lib/crypt.py
index 8846602..4c62280 100644
--- a/Lib/crypt.py
+++ b/Lib/crypt.py
@@ -54,7 +54,7 @@ def mksalt(method=None, *, rounds=None):
if not 4 <= log_rounds <= 31:
raise ValueError('rounds out of the range 2**4 to 2**31')
s += f'{log_rounds:02d}$'
- elif method.ident in ('5', '6'): # SHA-2
+ elif method.ident in ('5', '6', 'sm3'): # SHA-2 and sm3
if rounds is not None:
if not 1000 <= rounds <= 999_999_999:
raise ValueError('rounds out of the range 1000 to 999_999_999')
@@ -109,4 +109,7 @@ for _v in 'b', 'y', 'a', '':
_add_method('MD5', '1', 8, 34)
_add_method('CRYPT', None, 2, 13)
+# support the sm3 method
+_add_method('SM3', 'sm3', 16, 63)
+
del _v, _add_method
--
2.23.0

View File

@ -3,7 +3,7 @@ Summary: Interpreter of the Python3 programming language
URL: https://www.python.org/ URL: https://www.python.org/
Version: 3.8.5 Version: 3.8.5
Release: 13 Release: 14
License: Python License: Python
%global branchversion 3.8 %global branchversion 3.8
@ -105,6 +105,8 @@ Patch6002: backport-CVE-2021-3733.patch
Patch6003: backport-CVE-2021-3737.patch Patch6003: backport-CVE-2021-3737.patch
Patch6004: backport-bpo-44022-Improve-the-regression-test.patch Patch6004: backport-bpo-44022-Improve-the-regression-test.patch
Patch9000: add-the-sm3-method-for-obtaining-the-salt-value.patch
Provides: python%{branchversion} = %{version}-%{release} Provides: python%{branchversion} = %{version}-%{release}
Provides: python(abi) = %{branchversion} Provides: python(abi) = %{branchversion}
Provides: python(abi) = 3.7 Provides: python(abi) = 3.7
@ -206,6 +208,7 @@ rm Lib/ensurepip/_bundled/*.whl
%patch6002 -p1 %patch6002 -p1
%patch6003 -p1 %patch6003 -p1
%patch6004 -p1 %patch6004 -p1
%patch9000 -p1
rm configure pyconfig.h.in rm configure pyconfig.h.in
@ -813,6 +816,12 @@ export BEP_GTDLIST="$BEP_GTDLIST_TMP"
%{_mandir}/*/* %{_mandir}/*/*
%changelog %changelog
* Thu Oct 28 2021 hanxinke<hanxinke@huawei.com> - 3.8.5-14
- Type:requirement
- CVE:NA
- SUG:NA
- DESC:add the sm3 method for obtaining the salt value
* Mon Sep 27 2021 shixuantong<shixuantong@huawei.com> - 3.8.5-13 * Mon Sep 27 2021 shixuantong<shixuantong@huawei.com> - 3.8.5-13
- Type:CVE - Type:CVE
- CVE:CVE-2021-3733 CVE-2021-3737 - CVE:CVE-2021-3733 CVE-2021-3737