From 70524f1ba5e636e31bc185cbedcf49ac7cdd97e6 Mon Sep 17 00:00:00 2001 From: rwx403335 Date: Thu, 1 Sep 2022 17:16:34 +0800 Subject: [PATCH] add the sm3 method for obtaining the salt value --- ...-method-for-obtaining-the-salt-value.patch | 34 +++++++++++++++++++ python3.spec | 12 ++++++- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 add-the-sm3-method-for-obtaining-the-salt-value.patch diff --git a/add-the-sm3-method-for-obtaining-the-salt-value.patch b/add-the-sm3-method-for-obtaining-the-salt-value.patch new file mode 100644 index 0000000..e267562 --- /dev/null +++ b/add-the-sm3-method-for-obtaining-the-salt-value.patch @@ -0,0 +1,34 @@ +From 537c5000a4014c79192c32d3b879c07b32f99893 Mon Sep 17 00:00:00 2001 +From: hanxinke +Date: Tue, 3 Aug 2021 09:34:30 +0800 +Subject: [PATCH] add the sm3 method for obtaining the salt value + +Signed-off-by: hanxinke +--- + Lib/crypt.py | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/Lib/crypt.py b/Lib/crypt.py +index 33dbc46..3a7cea1 100644 +--- a/Lib/crypt.py ++++ b/Lib/crypt.py +@@ -55,7 +55,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') +@@ -117,4 +117,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 + diff --git a/python3.spec b/python3.spec index 7b11ed9..3b21ce0 100644 --- a/python3.spec +++ b/python3.spec @@ -3,7 +3,7 @@ Summary: Interpreter of the Python3 programming language URL: https://www.python.org/ Version: 3.7.9 -Release: 25 +Release: 26 License: Python-2.0 %global branchversion 3.7 @@ -163,6 +163,8 @@ Patch6052: backport-bpo-46811-Make-test-suite-support-Expat-2.4.5.patch Patch6053: backport-CVE-2015-20107.patch Patch6054: backport-CVE-2021-28861.patch +Patch9000: add-the-sm3-method-for-obtaining-the-salt-value.patch + Recommends: %{name}-help = %{version}-%{release} Provides: python%{branchversion} = %{version}-%{release} Provides: python(abi) = %{branchversion} @@ -311,6 +313,8 @@ rm Lib/ensurepip/_bundled/*.whl %patch6053 -p1 %patch6054 -p1 +%patch9000 -p1 + sed -i "s/generic_os/%{_vendor}/g" Lib/platform.py rm configure pyconfig.h.in @@ -911,6 +915,12 @@ export BEP_GTDLIST="$BEP_GTDLIST_TMP" %{_mandir}/*/* %changelog +* Thu Sep 01 2022 Hongxun Ren - 3.7.9-26 +- Type:enhancement +- CVE:NA +- SUG:NA +- DESC:add the sm3 method for obtaining the salt value + * Thu Aug 25 2022 shixuantong - 3.7.9-25 - Type:CVE - CVE:CVE-2021-28861 -- Gitee