From 2d2be530a7eb10997721619ba782bffdc0677b05e235c7eecafa38e85d090494 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Sat, 5 Dec 2020 17:16:13 +0000 Subject: [PATCH] Accepting request 850542 from home:vitezslav_cizek:branches:security:tls - Don't forward to Factory yet, the policy needs more testing. - Use the centralized crypto policy profile (jsc#SLE-15832) - FIPS: Use 2048 bit prime in DH selftest (bsc#1176086) * add gnutls-FIPS-use_2048_bit_prime_in_DH_selftest.patch - FIPS: Add TLS KDF selftest (bsc#1176671) * add gnutls-FIPS-TLS_KDF_selftest.patch OBS-URL: https://build.opensuse.org/request/show/850542 OBS-URL: https://build.opensuse.org/package/show/security:tls/gnutls?expand=0&rev=43 --- gnutls-FIPS-TLS_KDF_selftest.patch | 33 ++++++ ...PS-use_2048_bit_prime_in_DH_selftest.patch | 106 ++++++++++++++++++ gnutls.changes | 13 +++ gnutls.spec | 16 ++- 4 files changed, 164 insertions(+), 4 deletions(-) create mode 100644 gnutls-FIPS-TLS_KDF_selftest.patch create mode 100644 gnutls-FIPS-use_2048_bit_prime_in_DH_selftest.patch diff --git a/gnutls-FIPS-TLS_KDF_selftest.patch b/gnutls-FIPS-TLS_KDF_selftest.patch new file mode 100644 index 0000000..baa8106 --- /dev/null +++ b/gnutls-FIPS-TLS_KDF_selftest.patch @@ -0,0 +1,33 @@ +Index: gnutls-3.6.15/lib/fips.c +=================================================================== +--- gnutls-3.6.15.orig/lib/fips.c 2020-09-03 16:59:05.000000000 +0200 ++++ gnutls-3.6.15/lib/fips.c 2020-11-10 12:51:40.420071675 +0100 +@@ -398,6 +398,28 @@ int _gnutls_fips_perform_self_checks2(vo + goto error; + } + ++ /* KDF */ ++ ++ char derived[512]; ++ ++ gnutls_datum_t secret = { (void *)"\x04\x50\xb0\xea\x9e\xcd\x36\x02\xee\x0d\x76\xc5\xc3\xc8\x6f\x4a", 16 }; ++ gnutls_datum_t seed = { (void *)"\x20\x7a\xcc\x02\x54\xb8\x67\xf5\xb9\x25\xb4\x5a\x33\x60\x1d\x8b", 16 }; ++ gnutls_datum_t label = { (void *)"test label", 10 }; ++ gnutls_datum_t expected = { (void *)"\xae\x67\x9e\x0e\x71\x4f\x59\x75\x76\x37\x68\xb1\x66\x97\x9e\x1d", 16 }; ++ ++ ret = _gnutls_prf_raw(GNUTLS_MAC_SHA256, secret.size, secret.data, ++ label.size, (char*)label.data, seed.size, seed.data, expected.size, derived); ++ if (ret < 0) { ++ gnutls_assert(); ++ goto error; ++ } ++ ++ ret = memcmp(derived, expected.data, expected.size); ++ if (ret != 0) { ++ gnutls_assert(); ++ goto error; ++ } ++ + /* PK */ + ret = gnutls_pk_self_test(0, GNUTLS_PK_RSA); + if (ret < 0) { diff --git a/gnutls-FIPS-use_2048_bit_prime_in_DH_selftest.patch b/gnutls-FIPS-use_2048_bit_prime_in_DH_selftest.patch new file mode 100644 index 0000000..e722a08 --- /dev/null +++ b/gnutls-FIPS-use_2048_bit_prime_in_DH_selftest.patch @@ -0,0 +1,106 @@ +Index: gnutls-3.6.15/lib/crypto-selftests-pk.c +=================================================================== +--- gnutls-3.6.15.orig/lib/crypto-selftests-pk.c 2020-09-04 07:36:34.000000000 +0200 ++++ gnutls-3.6.15/lib/crypto-selftests-pk.c 2020-11-10 12:51:40.432071735 +0100 +@@ -614,18 +614,93 @@ static int test_dh(void) + gnutls_pk_params_st pub; + gnutls_datum_t out = {NULL, 0}; + static const uint8_t known_dh_k[] = { +- 0x10, 0x25, 0x04, 0xb5, 0xc6, 0xc2, 0xcb, +- 0x0c, 0xe9, 0xc5, 0x58, 0x0d, 0x22, 0x62}; ++ 0x62, 0x68, 0x15, 0xbd, 0xc4, 0x9a, 0x3c, 0xfc, ++ 0xda, 0x5d, 0xc5, 0x81, 0xc9, 0xe7, 0x1b, 0xbb, ++ 0x94, 0x19, 0xb0, 0x5d, 0x95, 0xc3, 0x98, 0xd0, ++ 0xc6, 0x8b, 0x05, 0x34, 0xa5, 0xe2, 0xe4, 0xa8, ++ 0x7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, 0x3D, 0xE2, ++ 0x4E, 0xE1, 0x49, 0x25, 0x99, 0x5F, 0x32, 0x16, 0x33, 0x32, 0x1B, 0x7A, ++ 0xA5, 0x5C, 0x6B, 0x34, 0x0D, 0x39, 0x99, 0xDC, 0xF0, 0x76, 0xE5, 0x5A, ++ 0xD4, 0x71, 0x00, 0xED, 0x5A, 0x73, 0xFB, 0xC8, 0x01, 0xAD, 0x99, 0xCF, ++ 0x99, 0x52, 0x7C, 0x9C, 0x64, 0xC6, 0x76, 0x40, 0x57, 0xAF, 0x59, 0xD7, ++ 0x38, 0x0B, 0x40, 0xDE, 0x33, 0x0D, 0xB8, 0x76, 0xEC, 0xA9, 0xD8, 0x73, ++ 0xF8, 0xEF, 0x26, 0x66, 0x06, 0x27, 0xDD, 0x7C, 0xA4, 0x10, 0x9C, 0xA6, ++ 0xAA, 0xF9, 0x53, 0x62, 0x73, 0x1D, 0xBA, 0x1C, 0xF1, 0x67, 0xF4, 0x35, ++ 0xED, 0x6F, 0x37, 0x92, 0xE8, 0x4F, 0x6C, 0xBA, 0x52, 0x6E, 0xA1, 0xED, ++ 0xDA, 0x9F, 0x85, 0x11, 0x82, 0x52, 0x62, 0x08, 0x44, 0xF1, 0x30, 0x03, ++ 0xC3, 0x38, 0x2C, 0x79, 0xBD, 0xD4, 0x43, 0x45, 0xEE, 0x8E, 0x50, 0xFC, ++ 0x29, 0x46, 0x9A, 0xFE, 0x54, 0x1A, 0x19, 0x8F, 0x4B, 0x84, 0x08, 0xDE, ++ 0x20, 0x62, 0x73, 0xCC, 0xDD, 0x7E, 0xF0, 0xEF, 0xA2, 0xFD, 0x86, 0x58, ++ 0x4B, 0xD8, 0x37, 0xEB ++ }; + static const uint8_t test_g[] = { 0x02 }; + static const uint8_t test_x[] = { +- 0x06, 0x2c, 0x96, 0xae, 0x0e, 0x9e, 0x9b, +- 0xbb, 0x41, 0x51, 0x7a, 0xa7, 0xc5, 0xfe }; ++ 0x0C, 0x4B, 0x30, 0x89, 0xD1, 0xB8, 0x62, 0xCB, 0x3C, 0x43, 0x64, 0x91, ++ 0xF0, 0x91, 0x54, 0x70, 0xC5, 0x27, 0x96, 0xE3, 0xAC, 0xBE, 0xE8, 0x00, ++ 0xEC, 0x55, 0xF6, 0xCC ++ }; + static const uint8_t test_y[] = { /* y=g^x mod p */ +- 0x1e, 0xca, 0x23, 0x2a, 0xfd, 0x34, 0xe1, +- 0x10, 0x7a, 0xff, 0xaf, 0x2d, 0xaa, 0x53 }; ++ 0xA0, 0x39, 0x11, 0x77, 0x9A, 0xC1, 0x30, 0x1F, 0xBE, 0x48, 0xA7, 0xAA, ++ 0xA0, 0x84, 0x54, 0x64, 0xAD, 0x1B, 0x70, 0xFA, 0x13, 0x55, 0x63, 0xD2, ++ 0x1F, 0x62, 0x32, 0x93, 0x8E, 0xC9, 0x3E, 0x09, 0xA7, 0x64, 0xE4, 0x12, ++ 0x6E, 0x1B, 0xF2, 0x92, 0x3B, 0xB9, 0xCB, 0x56, 0xEA, 0x07, 0x88, 0xB5, ++ 0xA6, 0xBC, 0x16, 0x1F, 0x27, 0xFE, 0xD8, 0xAA, 0x40, 0xB2, 0xB0, 0x2D, ++ 0x37, 0x76, 0xA6, 0xA4, 0x82, 0x2C, 0x0E, 0x22, 0x64, 0x9D, 0xCB, 0xD1, ++ 0x00, 0xB7, 0x89, 0x14, 0x72, 0x4E, 0xBE, 0x48, 0x41, 0xF8, 0xB2, 0x51, ++ 0x11, 0x09, 0x4B, 0x22, 0x01, 0x23, 0x39, 0x96, 0xE0, 0x15, 0xD7, 0x9F, ++ 0x60, 0xD1, 0xB7, 0xAE, 0xFE, 0x5F, 0xDB, 0xE7, 0x03, 0x17, 0x97, 0xA6, ++ 0x16, 0x74, 0xBD, 0x53, 0x81, 0x19, 0xC5, 0x47, 0x5E, 0xCE, 0x8D, 0xED, ++ 0x45, 0x5D, 0x3C, 0x00, 0xA0, 0x0A, 0x68, 0x6A, 0xE0, 0x8E, 0x06, 0x46, ++ 0x6F, 0xD7, 0xF9, 0xDF, 0x31, 0x7E, 0x77, 0x44, 0x0D, 0x98, 0xE0, 0xCA, ++ 0x98, 0x09, 0x52, 0x04, 0x90, 0xEA, 0x6D, 0xF4, 0x30, 0x69, 0x8F, 0xB1, ++ 0x9B, 0xC1, 0x43, 0xDB, 0xD5, 0x8D, 0xC8, 0x8E, 0xB6, 0x0B, 0x05, 0xBE, ++ 0x0E, 0xC5, 0x99, 0xC8, 0x6E, 0x4E, 0xF3, 0xCB, 0xC3, 0x5E, 0x9B, 0x53, ++ 0xF7, 0x06, 0x1C, 0x4F, 0xC7, 0xB8, 0x6E, 0x30, 0x18, 0xCA, 0x9B, 0xB9, ++ 0xBC, 0x5F, 0x17, 0x72, 0x29, 0x5A, 0xE5, 0xD9, 0x96, 0xB7, 0x0B, 0xF3, ++ 0x2D, 0x8C, 0xF1, 0xE1, 0x0E, 0x0D, 0x74, 0xD5, 0x9D, 0xF0, 0x06, 0xA9, ++ 0xB4, 0x95, 0x63, 0x76, 0x46, 0x55, 0x48, 0x82, 0x39, 0x90, 0xEF, 0x56, ++ 0x75, 0x34, 0xB8, 0x34, 0xC3, 0x18, 0x6E, 0x1E, 0xAD, 0xE3, 0x48, 0x7E, ++ 0x93, 0x2C, 0x23, 0xE7, 0xF8, 0x90, 0x73, 0xB1, 0x77, 0x80, 0x67, 0xA9, ++ 0x36, 0x9E, 0xDA, 0xD2 ++ }; + + gnutls_pk_params_init(&priv); + gnutls_pk_params_init(&pub); diff --git a/gnutls.changes b/gnutls.changes index 424fa54..a9d8332 100644 --- a/gnutls.changes +++ b/gnutls.changes @@ -1,3 +1,16 @@ +------------------------------------------------------------------- +Tue Nov 24 15:43:02 UTC 2020 - Vítězslav Čížek + +- Use the centralized crypto policy profile (jsc#SLE-15832) + +------------------------------------------------------------------- +Tue Nov 10 11:25:02 UTC 2020 - Vítězslav Čížek + +- FIPS: Use 2048 bit prime in DH selftest (bsc#1176086) + * add gnutls-FIPS-use_2048_bit_prime_in_DH_selftest.patch +- FIPS: Add TLS KDF selftest (bsc#1176671) + * add gnutls-FIPS-TLS_KDF_selftest.patch + ------------------------------------------------------------------- Mon Oct 12 11:54:00 UTC 2020 - Dominique Leuenberger diff --git a/gnutls.spec b/gnutls.spec index f9a206a..2c0d5d1 100644 --- a/gnutls.spec +++ b/gnutls.spec @@ -38,9 +38,11 @@ Source0: ftp://ftp.gnutls.org/gcrypt/gnutls/v3.6/%{name}-%{version}.tar.x Source1: ftp://ftp.gnutls.org/gcrypt/gnutls/v3.6/%{name}-%{version}.tar.xz.sig Source2: %{name}.keyring Source3: baselibs.conf -Patch1: gnutls-3.5.11-skip-trust-store-tests.patch -Patch4: gnutls-3.6.6-set_guile_site_dir.patch -Patch6: gnutls-temporarily_disable_broken_guile_reauth_test.patch +Patch0: gnutls-3.5.11-skip-trust-store-tests.patch +Patch1: gnutls-3.6.6-set_guile_site_dir.patch +Patch2: gnutls-temporarily_disable_broken_guile_reauth_test.patch +Patch3: gnutls-FIPS-TLS_KDF_selftest.patch +Patch4: gnutls-FIPS-use_2048_bit_prime_in_DH_selftest.patch BuildRequires: autogen BuildRequires: automake BuildRequires: datefudge @@ -183,6 +185,8 @@ export CXXFLAGS="%{optflags} -fPIE" --disable-rpath \ --disable-silent-rules \ --with-default-trust-store-dir=%{_localstatedir}/lib/ca-certificates/pem \ + --with-system-priority-file=%{_sysconfdir}/crypto-policies/back-ends/gnutls.config \ + --with-default-priority-string="@SYSTEM" \ --with-sysroot=/%{?_sysroot} \ %if %{without tpm} --without-tpm \ @@ -194,6 +198,9 @@ export CXXFLAGS="%{optflags} -fPIE" %endif --enable-fips140-mode \ %{nil} + +echo "SYSTEM=NORMAL" >> tests/system.prio + make %{?_smp_mflags} # the hmac hashes: @@ -235,7 +242,8 @@ rm -rf %{buildroot}%{_datadir}/doc/gnutls %check %if ! 0%{?qemu_user_space_build} -make %{?_smp_mflags} check || { +#make %{?_smp_mflags} check || { +make check %{?_smp_mflags} GNUTLS_SYSTEM_PRIORITY_FILE=/dev/null || { find -name test-suite.log -print -exec cat {} + exit 1 }