xref: /freebsd/crypto/openssl/util/fips-checksums.sh (revision e0c4386e7e71d93b0edc0c8fa156263fc4a8b0b6)
1*e0c4386eSCy Schubert#! /bin/sh
2*e0c4386eSCy Schubert
3*e0c4386eSCy SchubertHERE=`dirname $0`
4*e0c4386eSCy Schubert
5*e0c4386eSCy Schubertfor f in "$@"; do
6*e0c4386eSCy Schubert    # It's worth nothing that 'openssl sha256 -r' assumes that all input
7*e0c4386eSCy Schubert    # is binary.  This isn't quite true, and we know better, so we convert
8*e0c4386eSCy Schubert    # the '*stdin' marker to the filename preceded by a space.  See the
9*e0c4386eSCy Schubert    # sha1sum manual for a specification of the format.
10*e0c4386eSCy Schubert    case "$f" in
11*e0c4386eSCy Schubert        *.c | *.c.in | *.h | *.h.in | *.inc)
12*e0c4386eSCy Schubert            cat "$f" \
13*e0c4386eSCy Schubert                | $HERE/lang-compress.pl 'C' \
14*e0c4386eSCy Schubert                | unifdef -DFIPS_MODULE=1 \
15*e0c4386eSCy Schubert                | openssl sha256 -r \
16*e0c4386eSCy Schubert                | sed -e "s| \\*stdin|  $f|"
17*e0c4386eSCy Schubert            ;;
18*e0c4386eSCy Schubert        *.pl )
19*e0c4386eSCy Schubert            cat "$f" \
20*e0c4386eSCy Schubert                | $HERE/lang-compress.pl 'perl' \
21*e0c4386eSCy Schubert                | openssl sha256 -r \
22*e0c4386eSCy Schubert                | sed -e "s| \\*stdin|  $f|"
23*e0c4386eSCy Schubert            ;;
24*e0c4386eSCy Schubert        *.S )
25*e0c4386eSCy Schubert            cat "$f" \
26*e0c4386eSCy Schubert                | $HERE/lang-compress.pl 'S' \
27*e0c4386eSCy Schubert                | openssl sha256 -r \
28*e0c4386eSCy Schubert                | sed -e "s| \\*stdin|  $f|"
29*e0c4386eSCy Schubert            ;;
30*e0c4386eSCy Schubert    esac
31*e0c4386eSCy Schubertdone
32