diff --git a/libxcrypt-4.4.5-make_unalignment_test_really_unaligned.patch b/libxcrypt-4.4.5-make_unalignment_test_really_unaligned.patch new file mode 100644 index 0000000..07a0df9 --- /dev/null +++ b/libxcrypt-4.4.5-make_unalignment_test_really_unaligned.patch @@ -0,0 +1,47 @@ +From 9b2e9bd79cb91f50dd713899544423808f932b09 Mon Sep 17 00:00:00 2001 +From: Vitaly Chikunov +Date: Sat, 4 May 2019 21:19:06 +0300 +Subject: [PATCH] crypt-kat: Make unalignment test really unaligned. + +As noted and suggested by Solar. +--- + test/crypt-kat.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/test/crypt-kat.c b/test/crypt-kat.c +index 4402e24..19a79b1 100644 +--- a/test/crypt-kat.c ++++ b/test/crypt-kat.c +@@ -200,24 +200,27 @@ static void * + calc_hashes_crypt_r_rn (ARG_UNUSED (void *unused)) + { + char *hash; +- char pass[CRYPT_MAX_PASSPHRASE_SIZE]; ++ union { ++ char pass[CRYPT_MAX_PASSPHRASE_SIZE + 1]; ++ int aligned; ++ } u; + size_t i; + struct crypt_data data; + int status = 0; + + memset (&data, 0, sizeof data); +- memset (pass, 0, CRYPT_MAX_PASSPHRASE_SIZE); ++ memset (u.pass, 0, CRYPT_MAX_PASSPHRASE_SIZE + 1); + for (i = 0; i < ntests; i++) + { +- strncpy(pass + 1, tests[i].input, CRYPT_MAX_PASSPHRASE_SIZE - 1); ++ strncpy(u.pass + 1, tests[i].input, CRYPT_MAX_PASSPHRASE_SIZE); + printf("[%d]: %s %s\n", strlen(tests[i].input), tests[i].input, tests[i].salt); + errno = 0; +- hash = crypt_r (pass + 1, tests[i].salt, &data); ++ hash = crypt_r (u.pass + 1, tests[i].salt, &data); + status |= report_result ("crypt_r", hash, errno, &tests[i], + ENABLE_FAILURE_TOKENS); + + errno = 0; +- hash = crypt_rn (pass + 1, tests[i].salt, &data, (int)sizeof data); ++ hash = crypt_rn (u.pass + 1, tests[i].salt, &data, (int)sizeof data); + status |= report_result ("crypt_rn", hash, errno, &tests[i], false); + } + diff --git a/libxcrypt.spec b/libxcrypt.spec index 53d8d4e..8c0feba 100644 --- a/libxcrypt.spec +++ b/libxcrypt.spec @@ -153,6 +153,7 @@ Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz # Patch 0000 - 2999: Backported patches from upstream. Patch0000: %{url}/commit/5cce1ebe4e8e303bab593af694c9d30c51cf5eb4.patch#/%{name}-4.4.5-remove_unneeded_union_keyword.patch +Patch0001: %{url}/commit/9b2e9bd79cb91f50dd713899544423808f932b09.patch#/%{name}-4.4.5-make_unalignment_test_really_unaligned.patch # Patch 3000 - 5999: Backported patches from pull requests. @@ -463,6 +464,7 @@ done * Sat May 04 2019 Björn Esser - 4.4.5-1 - New upstream release (#1706419) - Add patch to remove an unneeded union keyword +- Add patch to make unalignment test really unaligned * Fri Mar 15 2019 Björn Esser - 4.4.4-2 - Change Recommends: whois-mkpasswd to Fedora 30 and later (#1687870)