openssl-1_1/openssl-1.1.1-fips-fix-memory-leaks.patch

81 lines
2.2 KiB
Diff
Raw Normal View History

Accepting request 1111331 from home:ohollmann:branches:security:tls - Update to 1.1.1w: * Fix POLY1305 MAC implementation corrupting XMM registers on Windows. The POLY1305 MAC (message authentication code) implementation in OpenSSL does not save the contents of non-volatile XMM registers on Windows 64 platform when calculating the MAC of data larger than 64 bytes. Before returning to the caller all the XMM registers are set to zero rather than restoring their previous content. The vulnerable code is used only on newer x86_64 processors supporting the AVX512-IFMA instructions. The consequences of this kind of internal application state corruption can be various - from no consequences, if the calling application does not depend on the contents of non-volatile XMM registers at all, to the worst consequences, where the attacker could get complete control of the application process. However given the contents of the registers are just zeroized so the attacker cannot put arbitrary values inside, the most likely consequence, if any, would be an incorrect result of some application dependent calculations or a crash leading to a denial of service. (CVE-2023-4807) - Add missing FIPS patches from SLE: * Add patches: - bsc1185319-FIPS-KAT-for-ECDSA.patch - bsc1198207-FIPS-add-hash_hmac-drbg-kat.patch - openssl-1.1.1-fips-fix-memory-leaks.patch - openssl-1_1-FIPS-PBKDF2-KAT-requirements.patch - openssl-1_1-FIPS_drbg-rewire.patch - openssl-1_1-Zeroization.patch - openssl-1_1-fips-drbg-selftest.patch - openssl-1_1-fips-list-only-approved-digest-and-pubkey-algorithms.patch - openssl-1_1-jitterentropy-3.4.0.patch - openssl-1_1-ossl-sli-000-fix-build-error.patch OBS-URL: https://build.opensuse.org/request/show/1111331 OBS-URL: https://build.opensuse.org/package/show/security:tls/openssl-1_1?expand=0&rev=144
2023-09-14 21:44:42 +02:00
---
crypto/fips/fips.c | 8 ++++++++
crypto/fips/fips_drbg_rand.c | 6 ++++++
crypto/init.c | 4 ++++
include/crypto/fips_int.h | 1 +
include/openssl/fips_rand.h | 1 +
5 files changed, 20 insertions(+)
--- a/crypto/fips/fips.c
+++ b/crypto/fips/fips.c
@@ -93,6 +93,14 @@ DEFINE_RUN_ONCE_STATIC(do_fips_lock_init
return fips_lock != NULL && fips_owning_lock != NULL;
}
+void FIPS_owning_thread_lock_cleanup(void)
+{
+ CRYPTO_THREAD_lock_free(fips_lock);
+ fips_lock = NULL;
+ CRYPTO_THREAD_lock_free(fips_owning_lock);
+ fips_owning_lock = NULL;
+}
+
# define fips_w_lock() CRYPTO_THREAD_write_lock(fips_lock)
# define fips_w_unlock() CRYPTO_THREAD_unlock(fips_lock)
# define fips_r_lock() CRYPTO_THREAD_read_lock(fips_lock)
--- a/crypto/fips/fips_drbg_rand.c
+++ b/crypto/fips/fips_drbg_rand.c
@@ -84,6 +84,12 @@ DRBG_CTX *FIPS_get_default_drbg(void)
return &ossl_dctx;
}
+void FIPS_drbg_lock_cleanup(void)
+{
+ CRYPTO_THREAD_lock_free(fips_rand_lock);
+ fips_rand_lock = NULL;
+}
+
static int fips_drbg_bytes(unsigned char *out, int count)
{
DRBG_CTX *dctx = &ossl_dctx;
--- a/crypto/init.c
+++ b/crypto/init.c
@@ -28,6 +28,8 @@
#include "internal/dso.h"
#include "crypto/store.h"
#include "openssl/fips.h"
+#include "openssl/fips_rand.h"
+#include "crypto/fips_int.h"
static int stopped = 0;
@@ -591,6 +593,8 @@ void OPENSSL_cleanup(void)
conf_modules_free_int();
#ifdef OPENSSL_FIPS
FIPS_entropy_cleanup();
+ FIPS_drbg_lock_cleanup();
+ FIPS_owning_thread_lock_cleanup();
#endif
#ifndef OPENSSL_NO_ENGINE
engine_cleanup_int();
--- a/include/crypto/fips_int.h
+++ b/include/crypto/fips_int.h
@@ -56,6 +56,7 @@
#ifdef OPENSSL_FIPS
+void FIPS_owning_thread_lock_cleanup(void);
int FIPS_module_mode_set(int onoff);
int FIPS_module_mode(void);
int FIPS_module_installed(void);
--- a/include/openssl/fips_rand.h
+++ b/include/openssl/fips_rand.h
@@ -125,6 +125,7 @@ extern "C" {
DRBG_CTX *FIPS_get_default_drbg(void);
const RAND_METHOD *FIPS_drbg_method(void);
+ void FIPS_drbg_lock_cleanup(void);
int FIPS_rand_set_method(const RAND_METHOD *meth);
const RAND_METHOD *FIPS_rand_get_method(void);