From 96ee37281245f7fe766d179782ac4edb994ed829 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 7 May 2019 05:48:11 -0400 Subject: [PATCH] import rng-tools-6.6-2.el8 --- .gitignore | 2 + .rng-tools.metadata | 2 + ...hread-if-getaffinity-returns-an-erro.patch | 34 ++++ SOURCES/jitterentropy-build-static.patch | 29 +++ SOURCES/jitterentropy-remove-install.patch | 22 +++ SOURCES/rng-tools-darn.patch | 23 +++ SOURCES/rngd.service | 8 + SPECS/rng-tools.spec | 171 ++++++++++++++++++ 8 files changed, 291 insertions(+) create mode 100644 .gitignore create mode 100644 .rng-tools.metadata create mode 100644 SOURCES/0001-Default-to-one-thread-if-getaffinity-returns-an-erro.patch create mode 100644 SOURCES/jitterentropy-build-static.patch create mode 100644 SOURCES/jitterentropy-remove-install.patch create mode 100644 SOURCES/rng-tools-darn.patch create mode 100644 SOURCES/rngd.service create mode 100644 SPECS/rng-tools.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7cbb0b2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +SOURCES/jitterentropy-library-2.1.2.tar.gz +SOURCES/rng-tools-6.6.tar.gz diff --git a/.rng-tools.metadata b/.rng-tools.metadata new file mode 100644 index 0000000..5421395 --- /dev/null +++ b/.rng-tools.metadata @@ -0,0 +1,2 @@ +2fed101132b55f9d5008ed22fde54ef9e4cfc75d SOURCES/jitterentropy-library-2.1.2.tar.gz +2d1a03fdbed9ee00ea1f610037c626d995a4a697 SOURCES/rng-tools-6.6.tar.gz diff --git a/SOURCES/0001-Default-to-one-thread-if-getaffinity-returns-an-erro.patch b/SOURCES/0001-Default-to-one-thread-if-getaffinity-returns-an-erro.patch new file mode 100644 index 0000000..1cf5f07 --- /dev/null +++ b/SOURCES/0001-Default-to-one-thread-if-getaffinity-returns-an-erro.patch @@ -0,0 +1,34 @@ +From d2b4876231ac9c2e26880ebe428bfb41e60e098e Mon Sep 17 00:00:00 2001 +From: Neil Horman +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 +--- + 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 + diff --git a/SOURCES/jitterentropy-build-static.patch b/SOURCES/jitterentropy-build-static.patch new file mode 100644 index 0000000..84d21db --- /dev/null +++ b/SOURCES/jitterentropy-build-static.patch @@ -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 diff --git a/SOURCES/jitterentropy-remove-install.patch b/SOURCES/jitterentropy-remove-install.patch new file mode 100644 index 0000000..cb840e1 --- /dev/null +++ b/SOURCES/jitterentropy-remove-install.patch @@ -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) diff --git a/SOURCES/rng-tools-darn.patch b/SOURCES/rng-tools-darn.patch new file mode 100644 index 0000000..bfdf2ec --- /dev/null +++ b/SOURCES/rng-tools-darn.patch @@ -0,0 +1,23 @@ +commit 901468598270db9c9f19f63f9812a94f5a44a487 +Author: Neil Horman +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 + +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); diff --git a/SOURCES/rngd.service b/SOURCES/rngd.service new file mode 100644 index 0000000..ceead29 --- /dev/null +++ b/SOURCES/rngd.service @@ -0,0 +1,8 @@ +[Unit] +Description=Hardware RNG Entropy Gatherer Daemon + +[Service] +ExecStart=/sbin/rngd -f + +[Install] +WantedBy=sysinit.target diff --git a/SPECS/rng-tools.spec b/SPECS/rng-tools.spec new file mode 100644 index 0000000..1ff17a8 --- /dev/null +++ b/SPECS/rng-tools.spec @@ -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 6.2-2 +- default to 1 thread on cpu 0 if getaffinty returns error (bz 1658855) + +* Thu May 17 2018 Neil Horman 6.2-1 +- Update to latest upstream +- Add CI self tests + +* Thu Feb 15 2018 Adam Williamson - 6.1-4 +- Drop all attempts to 'fix' #1490632, revert spec to same as 6.1-1 + +* Fri Feb 09 2018 Fedora Release Engineering - 6.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Thu Nov 02 2017 Neil Horman - 6.1-2 +- Enable rngd on entropy src availability (bz 1490632) + +* Tue Oct 10 2017 Neil Horman - 6.1-1 +- update to latest upstream + +* Fri Jul 28 2017 Neil Horman - 6-1 +- Update to latest upstream + +* Thu Jul 27 2017 Fedora Release Engineering - 5-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Sat Feb 11 2017 Fedora Release Engineering - 5-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Tue Oct 18 2016 Zbigniew Jędrzejewski-Szmek - 5-8 +- If device is not found exit immediately (#892178) + +* Sun Mar 6 2016 Peter Robinson 5-7 +- Use %%license + +* Thu Feb 04 2016 Fedora Release Engineering - 5-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Thu Jun 18 2015 Fedora Release Engineering - 5-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Wed Dec 10 2014 Zbigniew Jędrzejewski-Szmek - 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 - 5-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Sun Jun 08 2014 Fedora Release Engineering - 5-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Wed Apr 23 2014 Luke Macken - 5-1 +- Update to release version 5. +- Remove rng-tools-man.patch + +* Sun Aug 04 2013 Fedora Release Engineering - 4-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Thu Feb 14 2013 Fedora Release Engineering - 4-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Tue Sep 25 2012 Jaromir Capik - 4-2 +- Migration to new systemd macros + +* Mon Aug 6 2012 Jeff Garzik - 4-1 +- Update to release version 4. + +* Sat Jul 21 2012 Fedora Release Engineering - 3-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Thu Jan 12 2012 Jiri Popelka - 3-4 +- 2 patches from RHEL-6 +- systemd service +- man page fixes +- modernize spec file + +* Wed Feb 09 2011 Fedora Release Engineering - 3-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Sat Jul 3 2010 Jeff Garzik - 3-2 +- comply with renaming guidelines, by Providing rng-utils = 1:2.0-4.2 + +* Sat Jul 3 2010 Jeff Garzik - 3-1 +- Update to release version 3. + +* Fri Mar 26 2010 Jeff Garzik - 2-3 +- more minor updates for package review + +* Thu Mar 25 2010 Jeff Garzik - 2-2 +- several minor updates for package review + +* Wed Mar 24 2010 Jeff Garzik - 2-1 +- initial revision (as rng-tools) +