aboutsummaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorArthur W. Green <awg@posteo.us>2016-11-02 22:51:11 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2016-11-02 22:53:15 +0700
commitf362866181391ed9baa3846125841900c15aac2f (patch)
tree35c1141650a3e28cb505217605cf4e16a72971ce /system
parentbd115573f690340db79b91991f1b6bb8bfc34850 (diff)
system/bit-babbler: Added (Hardware True Random Number generator).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system')
-rw-r--r--system/bit-babbler/README29
-rw-r--r--system/bit-babbler/bit-babbler.SlackBuild109
-rw-r--r--system/bit-babbler/bit-babbler.info10
-rw-r--r--system/bit-babbler/rc.seedd41
-rw-r--r--system/bit-babbler/slack-desc19
5 files changed, 208 insertions, 0 deletions
diff --git a/system/bit-babbler/README b/system/bit-babbler/README
new file mode 100644
index 0000000000000..81e5a69cbe30e
--- /dev/null
+++ b/system/bit-babbler/README
@@ -0,0 +1,29 @@
+The BitBabbler is a hardware-based True Random Number generator
+(TRNG). It is offered in both "White" and "Black" varieties that are
+functionally almost identical apart from throughput and cost. This
+package installs the software necessary to control and perform basic
+health checks on connected BB devices.
+
+After installing the package, "groupadd bit-babbler", or adjust
+/etc/udev/rules.d/90-bit-babbler.rules to use an existing group (e.g.,
+wheel or adm) that will have permissions for the BB devices in your
+system.
+
+Typically, you'll probably want your BitBabbler device(s) to start
+feeding entropy to the kernel at boot. Include these lines in
+/etc/rc.d/rc.local:
+
+# Start BitBabbler TRNG.
+if [ -x /etc/rc.d/rc.seedd ]; then
+ . /etc/rc.d/rc.seedd start
+fi
+
+It is also a good idea to stop your BB device from feeding entropy to
+the kernel before capturing the random number seed on shutdown/reboot.
+Put these lines in /etc/rc.d/rc.local_shutdown, which you'll need to
+create if it doesn't already exist:
+
+# Stop BitBabbler TRNG.
+if [ -x /etc/rc.d/rc.seedd ]; then
+ . /etc/rc.d/rc.seedd stop
+fi
diff --git a/system/bit-babbler/bit-babbler.SlackBuild b/system/bit-babbler/bit-babbler.SlackBuild
new file mode 100644
index 0000000000000..739d560a07ba6
--- /dev/null
+++ b/system/bit-babbler/bit-babbler.SlackBuild
@@ -0,0 +1,109 @@
+#!/bin/sh -e
+
+# SlackBuild for BitBabbler TRNG software, 1 November 2016
+# Arthur W. Green <awg@posteo.us>
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification,
+# is permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# The BitBabbler software itself remains a copyrighted work under the
+# terms of the GNU GPL v2. Please see the file "copyright" in the
+# bit-babbler source distribution for more on this.
+
+PRGNAM=bit-babbler
+VERSION=${VERSION:-0.5}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i586 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM\_$VERSION.tar.gz
+cd $PRGNAM-$VERSION
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+CFLAGS="$SLKCFLAGS" \
+CXXFLAGS="$SLKCFLAGS" \
+./configure \
+ --prefix=/usr \
+ --libdir=/usr/lib${LIBDIRSUFFIX} \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --mandir=/usr/man \
+ --enable-shared \
+ --build=$ARCH-slackware-linux
+
+make
+make install DESTDIR=$PKG
+
+find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+
+find $PKG/usr/man -type f -exec gzip -9 {} \;
+for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a debian/copyright debian/changelog doc/virtual_machines $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+# install sysctl setting, udev rules, and init script.
+install -D -m 0644 debian/bit-babbler-sysctl.conf $PKG/etc/sysctl.d/bit-babbler-sysctl.conf
+install -D -m 0644 debian/bit-babbler.udev $PKG/etc/udev/rules.d/90-bit-babbler.rules
+install -D -m 0644 $CWD/rc.seedd $PKG/etc/rc.d/rc.seedd
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/system/bit-babbler/bit-babbler.info b/system/bit-babbler/bit-babbler.info
new file mode 100644
index 0000000000000..e958362cb84d3
--- /dev/null
+++ b/system/bit-babbler/bit-babbler.info
@@ -0,0 +1,10 @@
+PRGNAM="bit-babbler"
+VERSION="0.5"
+HOMEPAGE="http://bit-babbler.org/"
+DOWNLOAD="http://bit-babbler.org/downloads/bit-babbler_0.5.tar.gz"
+MD5SUM="f4d49fd768b90eea50dbf75146de8856"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES=""
+MAINTAINER="Arthur W. Green"
+EMAIL="awg@posteo.us"
diff --git a/system/bit-babbler/rc.seedd b/system/bit-babbler/rc.seedd
new file mode 100644
index 0000000000000..de304c37b6ae9
--- /dev/null
+++ b/system/bit-babbler/rc.seedd
@@ -0,0 +1,41 @@
+#!/bin/sh
+# /etc/rc.d/rc.seedd: start and stop BitBabbler TRNG(s).
+#
+# Revised 2 October 2015, AWG
+
+seedd_start() {
+ if [ -S /var/run/bit-babbler/seedd.socket ]; then
+ echo 'seedd appears to be already running!'
+ else
+ echo 'Checking for BitBabbler(s)...'
+ /usr/bin/seedd --scan
+ echo 'Starting seedd: /usr/bin/seedd --daemon --kernel'
+ /usr/bin/seedd --daemon --kernel
+ fi
+}
+
+seedd_stop() {
+ echo 'Stopping seedd...'
+ killall -w seedd
+ rm -f /var/run/bit-babbler/seedd.socket.lock
+}
+
+seedd_restart() {
+ seedd_stop
+ sleep 2
+ seedd_start
+}
+
+case "$1" in
+'start')
+ seedd_start
+ ;;
+'stop')
+ seedd_stop
+ ;;
+'restart')
+ seedd_restart
+ ;;
+*)
+ echo "usage $0 start|stop|restart"
+esac
diff --git a/system/bit-babbler/slack-desc b/system/bit-babbler/slack-desc
new file mode 100644
index 0000000000000..227822110b9f7
--- /dev/null
+++ b/system/bit-babbler/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+bit-babbler: bit-babbler (Hardware True Random Number generator)
+bit-babbler:
+bit-babbler: The BitBabbler is a hardware True Random Number generator (TRNG).
+bit-babbler: This package installs the software necessary to control and perform
+bit-babbler: basic health checks on BitBabbler devices.
+bit-babbler:
+bit-babbler: http://bitbabbler.org/
+bit-babbler:
+bit-babbler:
+bit-babbler:
+bit-babbler: