summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGöktürk Yüksek <gokturk@gentoo.org>2018-04-19 05:40:12 -0400
committerGöktürk Yüksek <gokturk@gentoo.org>2018-04-19 05:40:12 -0400
commit9bbc0187db3923e17e93801acd2879ef59965548 (patch)
treea6eae13c46f991f72114b5020e8976d06c2df161 /sys-apps/rng-tools
parentRevert "sys-cluster/keepalived: fix building with linux-headers-4.15" (diff)
downloadgentoo-9bbc0187db3923e17e93801acd2879ef59965548.tar.gz
gentoo-9bbc0187db3923e17e93801acd2879ef59965548.tar.bz2
gentoo-9bbc0187db3923e17e93801acd2879ef59965548.zip
sys-apps/rng-tools: fix nistbeacon block validation on 32-bit x86
Package-Manager: Portage-2.3.19, Repoman-2.3.6
Diffstat (limited to 'sys-apps/rng-tools')
-rw-r--r--sys-apps/rng-tools/files/rng-tools-6.1-fix-nistbeacon-validation-on-x86.patch45
-rw-r--r--sys-apps/rng-tools/rng-tools-6.1-r2.ebuild (renamed from sys-apps/rng-tools/rng-tools-6.1-r1.ebuild)3
2 files changed, 47 insertions, 1 deletions
diff --git a/sys-apps/rng-tools/files/rng-tools-6.1-fix-nistbeacon-validation-on-x86.patch b/sys-apps/rng-tools/files/rng-tools-6.1-fix-nistbeacon-validation-on-x86.patch
new file mode 100644
index 000000000000..1872444bc4a8
--- /dev/null
+++ b/sys-apps/rng-tools/files/rng-tools-6.1-fix-nistbeacon-validation-on-x86.patch
@@ -0,0 +1,45 @@
+From e8d7ea04e39f1209a79c003f3b62c9f1761dec0e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?G=C3=B6kt=C3=BCrk=20Y=C3=BCksek?= <gokturk@gentoo.org>
+Date: Thu, 19 Apr 2018 05:29:01 -0400
+Subject: [PATCH] rngd_nistbeacon: fix the size of frequency and timestamp on
+ x86_32
+
+The members "frequency" and "timestamp" of struct nist_data_block are
+defined as int and long, respectively. On x86_64, their sizes
+correctly correspond to 4 and 8 bytes. However, on 32-bit x86
+architectures, both int and long are defined as 4 bytes, causing the
+digest verification to fail. Fix it by using uint32_t and uint64_t
+explicitly.
+---
+ rngd_nistbeacon.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/rngd_nistbeacon.c b/rngd_nistbeacon.c
+index fbebc53..eadde39 100644
+--- a/rngd_nistbeacon.c
++++ b/rngd_nistbeacon.c
+@@ -97,8 +97,8 @@ BIO *bfp;
+
+ struct nist_data_block {
+ char *version;
+- int frequency;
+- long timestamp;
++ uint32_t frequency;
++ uint64_t timestamp;
+ char *seedvalue;
+ size_t seedvaluelen;
+ char *previoushash;
+@@ -355,8 +355,8 @@ static int validate_nist_block()
+
+
+ EVP_VerifyUpdate(mdctx, block.version, strlen(block.version));
+- EVP_VerifyUpdate(mdctx, &block.frequency, sizeof(int));
+- EVP_VerifyUpdate(mdctx, &block.timestamp, sizeof(long));
++ EVP_VerifyUpdate(mdctx, &block.frequency, sizeof(uint32_t));
++ EVP_VerifyUpdate(mdctx, &block.timestamp, sizeof(uint64_t));
+ EVP_VerifyUpdate(mdctx, block.seedvalue, block.seedvaluelen);
+ EVP_VerifyUpdate(mdctx, block.previoushash, block.previoushashlen);
+ EVP_VerifyUpdate(mdctx, &block.errorcode, block.errorcodelen);
+--
+2.13.6
+
diff --git a/sys-apps/rng-tools/rng-tools-6.1-r1.ebuild b/sys-apps/rng-tools/rng-tools-6.1-r2.ebuild
index 2c149789b757..607a19b11e2b 100644
--- a/sys-apps/rng-tools/rng-tools-6.1-r1.ebuild
+++ b/sys-apps/rng-tools/rng-tools-6.1-r2.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
@@ -34,6 +34,7 @@ DEPEND="${DEPEND}
PATCHES=(
"${FILESDIR}"/test-for-argp.patch
"${FILESDIR}"/${PN}-5-fix-textrels-on-PIC-x86.patch #469962
+ "${FILESDIR}"/${PN}-6.1-fix-nistbeacon-validation-on-x86.patch
)
src_prepare() {