openssl_fips_fingerprint 898 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/sh
  2. #
  3. # Check the library fingerprint and generate an executable fingerprint, or
  4. # return an error
  5. lib=$1
  6. exe=$2
  7. ext=${HMAC_EXT:-sha1}
  8. # deal with the case where we're run from within the build and OpenSSL is
  9. # not yet installed. Also, make sure LD_LIBRARY_PATH is properly set in
  10. # case shared libraries are built.
  11. if [ "X$TOP" != "X" ]
  12. then
  13. if test "$OSTYPE" = msdosdjgpp; then
  14. PATH="$TOP/apps;$TOP;$PATH"
  15. else
  16. PATH="$TOP/apps:$TOP:$PATH"
  17. fi
  18. LD_LIBRARY_PATH=$TOP; export LD_LIBRARY_PATH
  19. else
  20. LD_LIBRARY_PATH=.; export LD_LIBRARY_PATH
  21. fi
  22. echo "Checking library fingerprint for $lib"
  23. openssl sha1 -hmac etaonrishdlcupfm $lib | sed "s/(.*\//(/" | diff -w $lib.sha1 - || { echo "$libs fingerprint mismatch"; exit 1; }
  24. [ -x $exe.exe ] && exe=$exe.exe
  25. echo "Making fingerprint for $exe"
  26. openssl sha1 -hmac etaonrishdlcupfm -binary $exe > $exe.$ext || rm $exe.$ext