summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Bar-Lev <alonbl@gentoo.org>2019-02-07 23:02:46 +0200
committerAlon Bar-Lev <alonbl@gentoo.org>2019-02-07 23:03:18 +0200
commit132ea93627a905045caf6a6227b7f0c65b49f24c (patch)
treecb667fd389683381e26b6adf46c6ecb6992346a7 /app-crypt
parentnet-ftp/proftpd: expose USE=sodium (diff)
downloadgentoo-132ea93627a905045caf6a6227b7f0c65b49f24c.tar.gz
gentoo-132ea93627a905045caf6a6227b7f0c65b49f24c.tar.bz2
gentoo-132ea93627a905045caf6a6227b7f0c65b49f24c.zip
app-crypt/dieharder: fix random on 64bit
Closes: https://bugs.gentoo.org/show_bug.cgi?id=677386 Thanks: vm666 Signed-off-by: Alon Bar-Lev <alonbl@gentoo.org> Package-Manager: Portage-2.3.51, Repoman-2.3.11
Diffstat (limited to 'app-crypt')
-rw-r--r--app-crypt/dieharder/dieharder-3.31.1-r2.ebuild56
-rw-r--r--app-crypt/dieharder/files/dieharder-3.31.1-urandom-64bit.patch87
2 files changed, 143 insertions, 0 deletions
diff --git a/app-crypt/dieharder/dieharder-3.31.1-r2.ebuild b/app-crypt/dieharder/dieharder-3.31.1-r2.ebuild
new file mode 100644
index 00000000000..5a949f9d035
--- /dev/null
+++ b/app-crypt/dieharder/dieharder-3.31.1-r2.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="An advanced suite for testing the randomness of RNG's"
+HOMEPAGE="http://www.phy.duke.edu/~rgb/General/dieharder.php"
+SRC_URI="http://www.phy.duke.edu/~rgb/General/${PN}/${P}.tgz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
+IUSE="doc"
+RESTRICT="test"
+
+RDEPEND="sci-libs/gsl"
+DEPEND="${RDEPEND}
+ doc? ( dev-tex/latex2html )"
+
+DOCS=(
+ NOTES
+)
+HTML_DOCS=()
+
+PATCHES=(
+ "${FILESDIR}/${P}-build.patch"
+ "${FILESDIR}/${P}-urandom-64bit.patch"
+)
+
+pkg_setup() {
+ use doc && DOCS+=(
+ ChangeLog
+ manual/dieharder.pdf manual/dieharder.ps
+ )
+ use doc && HTML_DOCS+=(
+ dieharder.html
+ )
+}
+
+src_compile() {
+ emake -j1
+ use doc && emake -C manual
+}
+
+src_test() {
+ "${S}/dieharder/dieharder" -g 501 -a
+}
+
+src_install() {
+ default
+
+ docinto "dieharder"
+ dodoc dieharder/README dieharder/NOTES
+ docinto "libdieharder"
+ dodoc libdieharder/README libdieharder/NOTES
+}
diff --git a/app-crypt/dieharder/files/dieharder-3.31.1-urandom-64bit.patch b/app-crypt/dieharder/files/dieharder-3.31.1-urandom-64bit.patch
new file mode 100644
index 00000000000..c5615b673fd
--- /dev/null
+++ b/app-crypt/dieharder/files/dieharder-3.31.1-urandom-64bit.patch
@@ -0,0 +1,87 @@
+diff -ru dieharder-3.31.1/libdieharder/rng_dev_arandom.c dieharder-3.31.1_fixed/libdieharder/rng_dev_arandom.c
+--- dieharder-3.31.1/libdieharder/rng_dev_arandom.c 2011-10-14 15:41:37.000000000 +0200
++++ dieharder-3.31.1_fixed/libdieharder/rng_dev_arandom.c 2014-01-03 22:51:30.010534418 +0100
+@@ -6,6 +6,7 @@
+ */
+
+ #include <dieharder/libdieharder.h>
++#include <stdint.h>
+
+ static unsigned long int dev_arandom_get (void *vstate);
+ static double dev_arandom_get_double (void *vstate);
+@@ -21,7 +22,7 @@
+ dev_arandom_get (void *vstate)
+ {
+ dev_arandom_state_t *state = (dev_arandom_state_t *) vstate;
+- unsigned long int j;
++ uint32_t j;
+
+ if(state->fp != NULL) {
+ fread(&j,sizeof(j),1,state->fp);
+@@ -36,7 +37,7 @@
+ static double
+ dev_arandom_get_double (void *vstate)
+ {
+- return dev_arandom_get (vstate) / (double) UINT_MAX;
++ return dev_arandom_get (vstate) / (double) UINT32_MAX;
+ }
+
+ static void
+diff -ru dieharder-3.31.1/libdieharder/rng_dev_random.c dieharder-3.31.1_fixed/libdieharder/rng_dev_random.c
+--- dieharder-3.31.1/libdieharder/rng_dev_random.c 2011-10-14 15:41:37.000000000 +0200
++++ dieharder-3.31.1_fixed/libdieharder/rng_dev_random.c 2014-01-03 22:50:57.852321485 +0100
+@@ -6,6 +6,7 @@
+ */
+
+ #include <dieharder/libdieharder.h>
++#include <stdint.h>
+
+ static unsigned long int dev_random_get (void *vstate);
+ static double dev_random_get_double (void *vstate);
+@@ -21,7 +22,7 @@
+ dev_random_get (void *vstate)
+ {
+ dev_random_state_t *state = (dev_random_state_t *) vstate;
+- unsigned long int j;
++ uint32_t j;
+
+ if(state->fp != NULL) {
+ fread(&j,sizeof(j),1,state->fp);
+@@ -36,7 +37,7 @@
+ static double
+ dev_random_get_double (void *vstate)
+ {
+- return dev_random_get (vstate) / (double) UINT_MAX;
++ return dev_random_get (vstate) / (double) UINT32_MAX;
+ }
+
+ static void
+diff -ru dieharder-3.31.1/libdieharder/rng_dev_urandom.c dieharder-3.31.1_fixed/libdieharder/rng_dev_urandom.c
+--- dieharder-3.31.1/libdieharder/rng_dev_urandom.c 2011-10-14 15:41:37.000000000 +0200
++++ dieharder-3.31.1_fixed/libdieharder/rng_dev_urandom.c 2014-01-03 23:06:24.124239582 +0100
+@@ -3,6 +3,7 @@
+ */
+
+ #include <dieharder/libdieharder.h>
++#include <stdint.h>
+
+ /*
+ * This is a wrapping of the /dev/random hardware rng
+@@ -21,7 +22,7 @@
+ dev_urandom_get (void *vstate)
+ {
+ dev_urandom_state_t *state = (dev_urandom_state_t *) vstate;
+- unsigned long int j;
++ uint32_t j;
+
+ if(state->fp != NULL) {
+ fread(&j,sizeof(j),1,state->fp);
+@@ -36,7 +37,7 @@
+ static double
+ dev_urandom_get_double (void *vstate)
+ {
+- return dev_urandom_get (vstate) / (double) UINT_MAX;
++ return dev_urandom_get (vstate) / (double) UINT32_MAX;
+ }
+
+ static void