dingjian / rpms / kernel-rt

Forked from rpms/kernel-rt 4 years ago
Clone

Blame SOURCES/sign-modules

19f436
#! /bin/bash
19f436
19f436
moddir=$1
19f436
19f436
modules=`find $moddir -name *.ko`
19f436
19f436
MODSECKEY="./signing_key.priv"
19f436
MODPUBKEY="./signing_key.x509"
19f436
19f436
for mod in $modules
19f436
do
19f436
    dir=`dirname $mod`
19f436
    file=`basename $mod`
19f436
19f436
    ./scripts/sign-file sha256 ${MODSECKEY} ${MODPUBKEY} ${dir}/${file}
19f436
    rm -f ${dir}/${file}.{sig,dig}
19f436
done
19f436
19f436
RANDOMMOD=$(find $moddir -type f -name '*.ko' | sort -R | tail -n 1)
19f436
if [ "~Module signature appended~" != "$(tail -c 28 $RANDOMMOD)" ]; then
19f436
	echo "*** Modules are unsigned! ***"
19f436
	exit 1
19f436
fi
19f436
19f436
exit 0