openssl-1_1/openssl-fips-DH_selftest_shared_secret_KAT.patch

83 lines
3.1 KiB
Diff
Raw Permalink 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
Index: openssl-1.1.1d/crypto/fips/fips_dh_selftest.c
===================================================================
--- openssl-1.1.1d.orig/crypto/fips/fips_dh_selftest.c 2020-09-08 20:40:41.313074570 +0200
+++ openssl-1.1.1d/crypto/fips/fips_dh_selftest.c 2020-09-08 20:41:05.337219024 +0200
@@ -119,6 +119,41 @@ static const unsigned char dh_test_2048_
0xEC, 0x55, 0xF6, 0xCC
};
+static const unsigned char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
+ 0xe6, 0xe2, 0x13, 0xb1, 0x90, 0xd3, 0x0f, 0x87,
+ 0x2a, 0x0f, 0xf5, 0x17, 0x61, 0x15, 0x05, 0x31,
+ 0x5f, 0xdf, 0xb4, 0x8e, 0xf3, 0x21, 0x27, 0x6a,
+ 0x69, 0xdc, 0x52, 0x79, 0x64, 0x51, 0x1f, 0xc0,
+ 0xed, 0x55, 0x57, 0xd9, 0x5c, 0x6f, 0xdb, 0xaa,
+ 0x08, 0x44, 0xb9, 0x71, 0x71, 0x15, 0x27, 0xe8,
+ 0xe9, 0x42, 0x78, 0xc1, 0xc4, 0xc0, 0xbd, 0x28,
+ 0x23, 0xa1, 0x30, 0x57, 0xf0, 0x2e, 0x24, 0xf0,
+ 0x34, 0x17, 0x97, 0x1c, 0x4c, 0x2a, 0x98, 0x76,
+ 0x3d, 0x50, 0x7f, 0x32, 0xa2, 0x25, 0x94, 0x9e,
+ 0x1e, 0xbc, 0x97, 0x96, 0xd6, 0x14, 0x61, 0x5b
+};
+
int FIPS_selftest_dh()
{
DH *dh = NULL;
@@ -127,6 +162,7 @@ int FIPS_selftest_dh()
int len;
BIGNUM *p = NULL, *g = NULL, *priv_key = NULL, *tmp_pub_key = NULL;
const BIGNUM *pub_key;
+ unsigned char *shared_secret = NULL;
fips_load_key_component(p, dh_test_2048);
fips_load_key_component(g, dh_test_2048);
@@ -162,6 +198,19 @@ int FIPS_selftest_dh()
memcmp(pub_key_bin, dh_test_2048_pub_key, len) != 0)
goto err;
+ /* Shared secret KAT test */
+ len = DH_size(dh);
+ if ((shared_secret = OPENSSL_malloc(len)) == NULL)
+ goto err;
+
+ if ((len = DH_compute_key(shared_secret, pub_key, dh)) == -1)
+ goto err;
+
+ if (len != sizeof(dh_test_2048_shared_secret) ||
+ (memcmp(shared_secret, dh_test_2048_shared_secret, len) != 0)) {
+ goto err;
+ }
+
ret = 1;
err:
@@ -175,6 +224,7 @@ int FIPS_selftest_dh()
}
OPENSSL_free(pub_key_bin);
+ OPENSSL_free(shared_secret);
return ret;
}
#endif