diff --git a/backport-Fix-mem-leaks-on-PKCS-12-read-error-in-PKCS12_key_ge.patch b/backport-Fix-mem-leaks-on-PKCS-12-read-error-in-PKCS12_key_ge.patch new file mode 100644 index 0000000000000000000000000000000000000000..42f8fb7ebec2fce2b1e7c646c00bac9fa6830d08 --- /dev/null +++ b/backport-Fix-mem-leaks-on-PKCS-12-read-error-in-PKCS12_key_ge.patch @@ -0,0 +1,43 @@ +From ed4faae00cdab23244704660c099e41ec64f5dc0 Mon Sep 17 00:00:00 2001 +From: "Dr. David von Oheimb" +Date: Wed, 12 Aug 2020 17:37:50 +0200 +Subject: [PATCH] Fix mem leaks on PKCS#12 read error in + PKCS12_key_gen_{asc,utf8} + +Reviewed-by: Richard Levitte +Reviewed-by: Tomas Mraz +(Merged from https://github.com/openssl/openssl/pull/12639) +--- + crypto/pkcs12/p12_key.c | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) + +diff --git a/crypto/pkcs12/p12_key.c b/crypto/pkcs12/p12_key.c +index a40ae4cbe8..bbe212d125 100644 +--- a/crypto/pkcs12/p12_key.c ++++ b/crypto/pkcs12/p12_key.c +@@ -44,10 +44,8 @@ int PKCS12_key_gen_asc(const char *pass, int passlen, unsigned char *salt, + } + ret = PKCS12_key_gen_uni(unipass, uniplen, salt, saltlen, + id, iter, n, out, md_type); +- if (ret <= 0) +- return 0; + OPENSSL_clear_free(unipass, uniplen); +- return ret; ++ return ret > 0; + } + + int PKCS12_key_gen_utf8(const char *pass, int passlen, unsigned char *salt, +@@ -67,10 +65,8 @@ int PKCS12_key_gen_utf8(const char *pass, int passlen, unsigned char *salt, + } + ret = PKCS12_key_gen_uni(unipass, uniplen, salt, saltlen, + id, iter, n, out, md_type); +- if (ret <= 0) +- return 0; + OPENSSL_clear_free(unipass, uniplen); +- return ret; ++ return ret > 0; + } + + int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, +-- +2.27.0 diff --git a/backport-apps-passwd.c-free-before-error-exiting.patch b/backport-apps-passwd.c-free-before-error-exiting.patch new file mode 100644 index 0000000000000000000000000000000000000000..7c9e7cdbf9760890124342fb1f861171ac03bb64 --- /dev/null +++ b/backport-apps-passwd.c-free-before-error-exiting.patch @@ -0,0 +1,61 @@ +From dd05385e36582f34e691b1350dd7daf74df5cc90 Mon Sep 17 00:00:00 2001 +From: Peiwei Hu +Date: Tue, 4 Jan 2022 09:10:32 +0800 +Subject: [PATCH] apps/passwd.c: free before error exiting + +use goto instead of returning directly while error handling + +Signed-off-by: Peiwei Hu + +Reviewed-by: Ben Kaduk +Reviewed-by: Paul Dale +Reviewed-by: Tomas Mraz +(Merged from https://github.com/openssl/openssl/pull/17404) + +(cherry picked from commit ea4d16bc60dee53feb71997c1e78379eeb69b7ac) +--- + apps/passwd.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/apps/passwd.c b/apps/passwd.c +index d741d05335..2a4199d080 100644 +--- a/apps/passwd.c ++++ b/apps/passwd.c +@@ -407,7 +407,7 @@ static char *md5crypt(const char *passwd, const char *magic, const char *salt) + n >>= 1; + } + if (!EVP_DigestFinal_ex(md, buf, NULL)) +- return NULL; ++ goto err; + + for (i = 0; i < 1000; i++) { + if (!EVP_DigestInit_ex(md2, EVP_md5(), NULL)) +@@ -633,7 +633,7 @@ static char *shacrypt(const char *passwd, const char *magic, const char *salt) + n >>= 1; + } + if (!EVP_DigestFinal_ex(md, buf, NULL)) +- return NULL; ++ goto err; + + /* P sequence */ + if (!EVP_DigestInit_ex(md2, sha, NULL)) +@@ -644,7 +644,7 @@ static char *shacrypt(const char *passwd, const char *magic, const char *salt) + goto err; + + if (!EVP_DigestFinal_ex(md2, temp_buf, NULL)) +- return NULL; ++ goto err; + + if ((p_bytes = OPENSSL_zalloc(passwd_len)) == NULL) + goto err; +@@ -661,7 +661,7 @@ static char *shacrypt(const char *passwd, const char *magic, const char *salt) + goto err; + + if (!EVP_DigestFinal_ex(md2, temp_buf, NULL)) +- return NULL; ++ goto err; + + if ((s_bytes = OPENSSL_zalloc(salt_len)) == NULL) + goto err; +-- +2.33.0 diff --git a/openssl.spec b/openssl.spec index 11b08d596023303067987c9ccaa46e6ada3b4016..4c807c7ede8955236cc69c5e4e41a3f9325ac1ad 100644 --- a/openssl.spec +++ b/openssl.spec @@ -2,7 +2,7 @@ Name: openssl Epoch: 1 Version: 1.1.1m -Release: 29 +Release: 30 Summary: Cryptography and SSL/TLS Toolkit License: OpenSSL and SSLeay URL: https://www.openssl.org/ @@ -72,6 +72,8 @@ Patch61: backport-A-null-pointer-dereference-occurs-when-memory-alloca.patch Patch62: backport-Make-DH_check-set-some-error-bits-in-recently-added-.patch Patch63: backport-CVE-2023-5678-Make-DH_check_pub_key-and-DH_generate_key-safer-yet.patch Patch64: backport-CVE-2024-0727-fix-pkcs12-decoding-crashes.patch +Patch65: backport-apps-passwd.c-free-before-error-exiting.patch +Patch66: backport-Fix-mem-leaks-on-PKCS-12-read-error-in-PKCS12_key_ge.patch BuildRequires: gcc perl make lksctp-tools-devel coreutils util-linux zlib-devel Requires: coreutils %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release} @@ -280,6 +282,9 @@ make test || : %ldconfig_scriptlets libs %changelog +* Tue Mar 26 2024 wangjiang - 1:1.1.1m-30 +- fix some bugs + * Mon Feb 5 2024 lixiao - 1:1.1.1m-29 - add openssl-SMx-perl rpm provides