summaryrefslogtreecommitdiffstats
path: root/fips/openssl_fips_fingerprint
blob: e20b38d43c3b690e95425cd801872ceca22483c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
#
# Check the library fingerprint and generate an executable fingerprint, or
# return an error

lib=$1
exe=$2

# deal with the case where we're run from within the build and OpenSSL is
# not yet installed.  Also, make sure LD_LIBRARY_PATH is properly set in
# case shared libraries are built.
if [ "X$TOP" != "X" ]
then
    PATH=$TOP/apps:$PATH
    LD_LIBRARY_PATH=$TOP; export LD_LIBRARY_PATH
else
    LD_LIBRARY_PATH=.; export LD_LIBRARY_PATH
fi

elib=`echo $lib| sed 's/\//\\\\\//g'`
echo "Checking library fingerprint for $lib"
openssl sha1 -hmac etaonrishdlcupfm $lib | sed "s/$elib/libcrypto.a/" | diff ${lib%.a}.sha1 - || { echo "$libs fingerprint mismatch"; exit 1; }

echo "Making fingerprint for $exe"
openssl sha1 -hmac etaonrishdlcupfm -binary $exe > $exe.sha1