From 493c128f07fe48decbf94467a31d79fc4bf383ee Mon Sep 17 00:00:00 2001 From: weiwei_tiantian Date: Fri, 1 Jul 2022 14:26:16 +0800 Subject: [PATCH] provide openssl apis related to SM for python (cherry picked from commit f0e0451aa2175fe3e1969ccfa84e73bb5cf590c8) --- ...penssl-apis-related-to-SM-for-python.patch | 45 +++++++++++++++++++ python-cryptography.spec | 9 +++- 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 backport-provide-openssl-apis-related-to-SM-for-python.patch diff --git a/backport-provide-openssl-apis-related-to-SM-for-python.patch b/backport-provide-openssl-apis-related-to-SM-for-python.patch new file mode 100644 index 0000000..08c3b88 --- /dev/null +++ b/backport-provide-openssl-apis-related-to-SM-for-python.patch @@ -0,0 +1,45 @@ +From 52325495900f1bd9e1f228f24c81c0746520dc85 Mon Sep 17 00:00:00 2001 +From: hanxinke +Date: Tue, 3 Aug 2021 10:45:22 +0800 +Subject: [PATCH] provide openssl apis related to SM for python + +Signed-off-by: hanxinke +--- + src/_cffi_src/openssl/evp.py | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/src/_cffi_src/openssl/evp.py b/src/_cffi_src/openssl/evp.py +index ab7cfeb..0fa817d 100644 +--- a/src/_cffi_src/openssl/evp.py ++++ b/src/_cffi_src/openssl/evp.py +@@ -37,6 +37,7 @@ static const int Cryptography_HAS_EVP_PKEY_get_set_tls_encodedpoint; + static const int Cryptography_HAS_ONESHOT_EVP_DIGEST_SIGN_VERIFY; + static const long Cryptography_HAS_RAW_KEY; + static const long Cryptography_HAS_EVP_DIGESTFINAL_XOF; ++static const int EVP_PKEY_SM2; + """ + + FUNCTIONS = """ +@@ -89,6 +90,9 @@ int EVP_DigestSignFinal(EVP_MD_CTX *, unsigned char *, size_t *); + int EVP_DigestVerifyInit(EVP_MD_CTX *, EVP_PKEY_CTX **, const EVP_MD *, + ENGINE *, EVP_PKEY *); + ++int EVP_DigestVerifyUpdate(EVP_MD_CTX *, const void *, size_t); ++int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sig, ++ size_t siglen); + + + EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *, ENGINE *); +@@ -165,6 +169,9 @@ EVP_PKEY *EVP_PKEY_new_raw_public_key(int, ENGINE *, const unsigned char *, + size_t); + int EVP_PKEY_get_raw_private_key(const EVP_PKEY *, unsigned char *, size_t *); + int EVP_PKEY_get_raw_public_key(const EVP_PKEY *, unsigned char *, size_t *); ++int EVP_PKEY_set_alias_type(EVP_PKEY *pkey, int type); ++void EVP_MD_CTX_set_pkey_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pctx); ++const EVP_MD *EVP_sm3(void); + """ + + CUSTOMIZATIONS = """ +-- +2.27.0 + diff --git a/python-cryptography.spec b/python-cryptography.spec index 06a732f..65d7418 100644 --- a/python-cryptography.spec +++ b/python-cryptography.spec @@ -1,7 +1,7 @@ %global srcname cryptography Name: python-%{srcname} Version: 3.3.1 -Release: 3 +Release: 4 Summary: PyCA's cryptography library License: ASL 2.0 or BSD URL: https://cryptography.io/en/latest/ @@ -9,6 +9,7 @@ Source0: %{pypi_source} Patch6000: backport-CVE-2020-36242.patch Patch6001: backport-add-SM4-symmetric-block-cipher-5834.patch +Patch6002: backport-provide-openssl-apis-related-to-SM-for-python.patch BuildRequires: openssl-devel BuildRequires: gcc @@ -72,6 +73,12 @@ PYTHONPATH=%{buildroot}%{python3_sitearch} %{__python3} -m pytest -k "not (test_ %doc README.rst docs %changelog +* Fri Jul 01 2022 tianwei -3.3.1-4 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC: provide openssl apis related to SM for python + * Thu Jun 30 2022 tianwei -3.3.1-3 - Type:bugfix - ID:NA -- Gitee