Install OneRNG driver
This commit is contained in:
parent
0b36287289
commit
2eec544b49
|
@ -110,6 +110,12 @@ KERNEL_VERSION="v3.15.10-bone8"
|
|||
# This can be empty, "beaglebone" or "onerng"
|
||||
HWRNG_TYPE=
|
||||
|
||||
# Download location for OneRNG driver
|
||||
ONERNG_PACKAGE="onerng_3.3-1_all.deb"
|
||||
ONERNG_PACKAGE_DOWNLOAD="https://github.com/OneRNG/onerng.github.io/blob/master/sw/$ONERNG_PACKAGE?raw=true"
|
||||
# Hash for OneRNG driver
|
||||
ONERNG_PACKAGE_HASH='a9801993ffef1cc19778f5613f1837aca4212a0d299d75bd524134f865774928'
|
||||
|
||||
# Whether this system is being installed within a docker container
|
||||
INSTALLED_WITHIN_DOCKER="no"
|
||||
|
||||
|
@ -4731,7 +4737,41 @@ function enable_zram {
|
|||
}
|
||||
|
||||
function install_onerng {
|
||||
# TODO
|
||||
apt-get -y install rng-tools at python-gnupg
|
||||
|
||||
# Move to the installation directory
|
||||
if [ ! -d $INSTALL_DIR ]; then
|
||||
mkdir $INSTALL_DIR
|
||||
fi
|
||||
cd $INSTALL_DIR
|
||||
|
||||
# Download the package
|
||||
if [ ! -f $ONERNG_PACKAGE ]; then
|
||||
wget $ONERNG_PACKAGE_DOWNLOAD
|
||||
fi
|
||||
if [ ! -f $ONERNG_PACKAGE ]; then
|
||||
echo "OneRNG package could not be downloaded"
|
||||
exit 59249
|
||||
fi
|
||||
|
||||
# Check the hash
|
||||
hash=$(sha256sum $ONERNG_PACKAGE)
|
||||
if [[ $hash != $ONERNG_PACKAGE_HASH ]]; then
|
||||
echo "OneRNG package: $ONERNG_PACKAGE"
|
||||
echo "Hash does not match. This could indicate that the package has been tampered with."
|
||||
echo "OneRNG expected package hash: $ONERNG_PACKAGE_HASH"
|
||||
echo "OneRNG actual hash: $hash"
|
||||
exit 25934
|
||||
fi
|
||||
|
||||
# install the package
|
||||
dpkg -i $ONERNG_PACKAGE
|
||||
|
||||
# Check that the install worked
|
||||
if [ ! -f /etc/onerng.conf ]; then
|
||||
echo 'OneRNG configuration file not found. The package may not have installed successfully.'
|
||||
exit 42904
|
||||
fi
|
||||
}
|
||||
|
||||
function random_number_generator {
|
||||
|
|
|
@ -327,11 +327,19 @@ function interactive_configuration {
|
|||
|
||||
data=$(tempfile 2>/dev/null)
|
||||
trap "rm -f $data" 0 1 2 5 15
|
||||
dialog --backtitle "Random Number Generation" \
|
||||
--radiolist "Type of RNG:" 17 40 3 \
|
||||
1 Haveged on \
|
||||
2 Beaglebone built-in HRNG off \
|
||||
3 OneRNG off 2> $data
|
||||
if [[ $INSTALLING_ON_BBB == "no" ]]; then
|
||||
dialog --backtitle "Random Number Generation" \
|
||||
--radiolist "Type of RNG:" 17 40 3 \
|
||||
1 Haveged on \
|
||||
2 Beaglebone built-in HRNG off \
|
||||
3 OneRNG off 2> $data
|
||||
else
|
||||
dialog --backtitle "Random Number Generation" \
|
||||
--radiolist "Type of RNG:" 17 40 3 \
|
||||
1 Haveged off \
|
||||
2 Beaglebone built-in HRNG on \
|
||||
3 OneRNG off 2> $data
|
||||
fi
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) exit 0;;
|
||||
|
|
Loading…
Reference in New Issue