import rng-tools-6.6-2.el8

This commit is contained in:
CentOS Sources 2019-05-07 05:48:11 -04:00 committed by Andrew Lukoshko
commit 96ee372812
8 changed files with 291 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
SOURCES/jitterentropy-library-2.1.2.tar.gz
SOURCES/rng-tools-6.6.tar.gz

2
.rng-tools.metadata Normal file
View File

@ -0,0 +1,2 @@
2fed101132b55f9d5008ed22fde54ef9e4cfc75d SOURCES/jitterentropy-library-2.1.2.tar.gz
2d1a03fdbed9ee00ea1f610037c626d995a4a697 SOURCES/rng-tools-6.6.tar.gz

View File

@ -0,0 +1,34 @@
From d2b4876231ac9c2e26880ebe428bfb41e60e098e Mon Sep 17 00:00:00 2001
From: Neil Horman <nhorman@tuxdriver.com>
Date: Wed, 19 Dec 2018 10:10:44 -0500
Subject: [PATCH] Default to one thread if getaffinity returns an error
Its possible on virt systems, for sched_getaffinity to return an error
if the vm has cpus, but cgroup placement restricts that set to 0
physical processors. In that event, just default to 1 thread on cpu 0
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
rngd_jitter.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/rngd_jitter.c b/rngd_jitter.c
index 4e4b348..d14a3ba 100644
--- a/rngd_jitter.c
+++ b/rngd_jitter.c
@@ -421,7 +421,11 @@ int init_jitter_entropy_source(struct rng *ent_src)
cpus = CPU_ALLOC(i);
cpusize = CPU_ALLOC_SIZE(i);
CPU_ZERO_S(cpusize, cpus);
- sched_getaffinity(0, cpusize, cpus);
+ if (sched_getaffinity(0, cpusize, cpus) < 0) {
+ message(LOG_DAEMON|LOG_DEBUG, "Can not determine affinity of process, defaulting to 1 thread\n");
+ CPU_SET(0,cpus);
+ }
+
num_threads = CPU_COUNT_S(cpusize, cpus);
if (num_threads >= ent_src->rng_options[JITTER_OPT_THREADS].int_val)
--
2.17.2

View File

@ -0,0 +1,29 @@
diff -up ./Makefile.am.build ./Makefile.am
--- ./Makefile.am.build 2018-10-20 11:38:30.000000000 -0400
+++ ./Makefile.am 2018-11-20 12:03:08.367191838 -0500
@@ -1,7 +1,7 @@
##
## Toplevel Makefile.am for rng-tools
##
-SUBDIRS = contrib tests
+SUBDIRS = contrib tests jitterentropy-library
sbin_PROGRAMS = rngd
bin_PROGRAMS = rngtest
@@ -23,14 +23,12 @@ if DARN
rngd_SOURCES += rngd_darn.c
endif
-if JITTER
rngd_SOURCES += rngd_jitter.c
-endif
-rngd_LDADD = librngd.a -lsysfs $(LIBS) ${libcurl_LIBS} ${libxml2_LIBS} ${openssl_LIBS} $(PTHREAD_LIBS)
+rngd_LDADD = librngd.a -lsysfs $(LIBS) jitterentropy-library/libjitterentropy.a ${libcurl_LIBS} ${libxml2_LIBS} ${openssl_LIBS} $(PTHREAD_LIBS)
-rngd_CFLAGS = ${libxml2_CFLAGS} ${openssl_CFLAGS} $(PTHREAD_CFLAGS)
+rngd_CFLAGS = ${libxml2_CFLAGS} ${openssl_CFLAGS} $(PTHREAD_CFLAGS) -DHAVE_JITTER -I./jitterentropy-library/
rngd_LDFLAGS = $(PTHREAD_CFLAGS)
rngtest_SOURCES = exits.h stats.h stats.c rngtest.c

View File

@ -0,0 +1,22 @@
diff -up ./jitterentropy-library/Makefile.remove ./jitterentropy-library/Makefile
--- ./jitterentropy-library/Makefile.remove 2018-11-20 10:34:18.350397594 -0500
+++ ./jitterentropy-library/Makefile 2018-11-20 10:35:27.023144673 -0500
@@ -46,18 +46,6 @@ $(NAME): $(OBJS)
scan: $(OBJS)
scan-build --use-analyzer=/usr/bin/clang $(CC) -shared -Wl,-soname,lib$(NAME).so.$(LIBMAJOR) -o lib$(NAME).so.$(LIBVERSION) $(OBJS) $(LDFLAGS)
-install:
- install -d -m 0755 $(DESTDIR)$(PREFIX)/share/man/man3
- install -m 644 doc/$(NAME).3 $(DESTDIR)$(PREFIX)/share/man/man3/
- gzip -9 $(DESTDIR)$(PREFIX)/share/man/man3/$(NAME).3
- install -d -m 0755 $(DESTDIR)$(PREFIX)/$(LIBDIR)
- install -m 0755 -s lib$(NAME).so.$(LIBVERSION) $(DESTDIR)$(PREFIX)/$(LIBDIR)/
- install -m 0644 jitterentropy.h $(DESTDIR)$(PREFIX)/$(INCDIR)/
- install -m 0644 jitterentropy-base-user.h $(DESTDIR)$(PREFIX)/$(INCDIR)/
- $(RM) $(DESTDIR)$(PREFIX)/$(LIBDIR)/lib$(NAME).so.$(LIBMAJOR)
- ln -s lib$(NAME).so.$(LIBVERSION) $(DESTDIR)$(PREFIX)/$(LIBDIR)/lib$(NAME).so.$(LIBMAJOR)
- ln -s lib$(NAME).so.$(LIBMAJOR) $(DESTDIR)$(PREFIX)/$(LIBDIR)/lib$(NAME).so
-
clean:
@- $(RM) $(NAME)
@- $(RM) $(OBJS)

View File

@ -0,0 +1,23 @@
commit 901468598270db9c9f19f63f9812a94f5a44a487
Author: Neil Horman <nhorman@tuxdriver.com>
Date: Tue Nov 20 11:31:29 2018 -0500
Fix build break on ppc
didn't update the rng options properly for rng_darn.c
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
diff --git a/rngd_darn.c b/rngd_darn.c
index 45c81c7..abd34b0 100644
--- a/rngd_darn.c
+++ b/rngd_darn.c
@@ -126,7 +126,7 @@ static int refill_rand(struct rng *ent_src)
if (darn_buf_avail)
return 0;
- if (ent_src->options[DARN_USE_AES].int_val) {
+ if (ent_src->rng_options[DARN_OPT_AES].int_val) {
if (rand_bytes_served >= rekey_thresh) {
message(LOG_DAEMON|LOG_DEBUG, "rekeying DARN rng\n");
gcry_cipher_close(gcry_cipher_hd);

8
SOURCES/rngd.service Normal file
View File

@ -0,0 +1,8 @@
[Unit]
Description=Hardware RNG Entropy Gatherer Daemon
[Service]
ExecStart=/sbin/rngd -f
[Install]
WantedBy=sysinit.target

171
SPECS/rng-tools.spec Normal file
View File

@ -0,0 +1,171 @@
%global _hardened_build 1
%global _sbindir /sbin
Summary: Random number generator related utilities
Name: rng-tools
Version: 6.6
Release: 2%{?dist}
Group: System Environment/Base
License: GPLv2+
URL: https://github.com/nhorman/rng-tools
Source0: https://github.com/nhorman/rng-tools/archive/rng-tools-%{version}.tar.gz
Source1: rngd.service
Source2: jitterentropy-library-2.1.2.tar.gz
Patch0: jitterentropy-remove-install.patch
Patch1: jitterentropy-build-static.patch
Patch2: rng-tools-darn.patch
Patch3: 0001-Default-to-one-thread-if-getaffinity-returns-an-erro.patch
# https://sourceforge.net/p/gkernel/patches/111/
BuildRequires: gettext
BuildRequires: systemd-units
BuildRequires: libgcrypt-devel
BuildRequires: autoconf automake
BuildRequires: libsysfs-devel libcurl-devel
BuildRequires: libxml2-devel openssl-devel
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
Requires: libgcrypt libsysfs
Requires: openssl libxml2 libcurl
%description
Hardware random number generation tools.
%prep
%setup
tar xvf %{SOURCE2}
mv jitterentropy-library-2.1.2 jitterentropy-library
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%build
./autogen.sh
%configure
%make_build
%install
%make_install
# install systemd unit file
install -Dt %{buildroot}%{_unitdir} -m0644 %{SOURCE1}
%post
%systemd_post rngd.service
%preun
%systemd_preun rngd.service
%postun
%systemd_postun_with_restart rngd.service
%files
%{!?_licensedir:%global license %%doc}
%license COPYING
%doc AUTHORS NEWS README
%{_bindir}/rngtest
%{_sbindir}/rngd
%{_mandir}/man1/rngtest.1.*
%{_mandir}/man8/rngd.8.*
%attr(0644,root,root) %{_unitdir}/rngd.service
%changelog
* Mon Dec 17 2018 Neil Horman <nhorman@redhat.com> 6.2-2
- default to 1 thread on cpu 0 if getaffinty returns error (bz 1658855)
* Thu May 17 2018 Neil Horman <nhorman@redhat.com> 6.2-1
- Update to latest upstream
- Add CI self tests
* Thu Feb 15 2018 Adam Williamson <awilliam@redhat.com> - 6.1-4
- Drop all attempts to 'fix' #1490632, revert spec to same as 6.1-1
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 6.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Thu Nov 02 2017 Neil Horman <nhorman@redhat.com> - 6.1-2
- Enable rngd on entropy src availability (bz 1490632)
* Tue Oct 10 2017 Neil Horman <nhorman@redhat.com> - 6.1-1
- update to latest upstream
* Fri Jul 28 2017 Neil Horman <nhorman@redhat.com> - 6-1
- Update to latest upstream
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 5-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 5-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Tue Oct 18 2016 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 5-8
- If device is not found exit immediately (#892178)
* Sun Mar 6 2016 Peter Robinson <pbrobinson@fedoraproject.org> 5-7
- Use %%license
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 5-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Wed Dec 10 2014 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 5-4
- Build with hardening flags (#1051344)
- Fail nicely if no hardware generator is found (#892178)
- Drop unneeded dependency
* Mon Aug 18 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Wed Apr 23 2014 Luke Macken <lmacken@redhat.com> - 5-1
- Update to release version 5.
- Remove rng-tools-man.patch
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Tue Sep 25 2012 Jaromir Capik <jcapik@redhat.com> - 4-2
- Migration to new systemd macros
* Mon Aug 6 2012 Jeff Garzik <jgarzik@redhat.com> - 4-1
- Update to release version 4.
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Thu Jan 12 2012 Jiri Popelka <jpopelka@redhat.com> - 3-4
- 2 patches from RHEL-6
- systemd service
- man page fixes
- modernize spec file
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Sat Jul 3 2010 Jeff Garzik <jgarzik@redhat.com> - 3-2
- comply with renaming guidelines, by Providing rng-utils = 1:2.0-4.2
* Sat Jul 3 2010 Jeff Garzik <jgarzik@redhat.com> - 3-1
- Update to release version 3.
* Fri Mar 26 2010 Jeff Garzik <jgarzik@redhat.com> - 2-3
- more minor updates for package review
* Thu Mar 25 2010 Jeff Garzik <jgarzik@redhat.com> - 2-2
- several minor updates for package review
* Wed Mar 24 2010 Jeff Garzik <jgarzik@redhat.com> - 2-1
- initial revision (as rng-tools)