Skip to content

Commit 7b8a99f

Browse files
committed
Use only the first 64 bytes of hash output in fips-hash.sh
1 parent 50c5028 commit 7b8a99f

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

fips-check.sh

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,19 @@ Usage() {
3131
cat <<usageText
3232
Usage: $0 [flavor] [keep] [nomakecheck] [nodoconfigure] [noautogen]
3333
Flavor is one of:
34-
linuxv2 (FIPSv2, use for Win10)
35-
fipsv2-OE-ready (ready FIPSv2)
34+
linuxv2 (FIPSv2, use for Win10)
35+
fipsv2-OE-ready (ready FIPSv2)
3636
solaris
3737
netbsd-selftest
3838
marvell-linux-selftest
39-
linuxv5 (current FIPS 140-3)
40-
fips-ready (ready FIPS 140-3)
41-
fips-dev (dev FIPS 140-3)
39+
linuxv5 (current FIPS 140-3 [v5.2.1])
40+
linuxv5-RC12 (current FIPS 140-3 [v5.2.0.1])
41+
fips-ready (ready FIPS 140-3)
42+
fips-dev (dev FIPS 140-3)
4243
wolfrand
4344
wolfentropy
44-
v6.0.0
45+
v6.0.0 (pending FIPS 140-3 [v6.0.0])
46+
4547
keep: (default off) retains the temp dir $TEST_DIR for inspection.
4648
nomakecheck: (default off) don't run make check
4749
nodoconfigure: (default off) don't run configure
@@ -669,13 +671,9 @@ if [ "$DOCONFIGURE" = "yes" ]; then
669671
exit 3
670672
fi
671673

672-
if [ -s wolfcrypt/src/fips_test.c ]; then
673-
NEWHASH=$(./wolfcrypt/test/testwolfcrypt | sed -n 's/hash = \(.*\)/\1/p')
674-
if [ -n "$NEWHASH" ]; then
675-
cp wolfcrypt/src/fips_test.c wolfcrypt/src/fips_test.c.bak
676-
sed "s/^\".*\";/\"${NEWHASH}\";/" wolfcrypt/src/fips_test.c.bak >wolfcrypt/src/fips_test.c
677-
make clean
678-
fi
674+
if [ -s fips-hash.sh ]; then
675+
./fips-hash.sh
676+
make clean
679677
fi
680678

681679
if [ "$MAKECHECK" = "yes" ]; then

fips-hash.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ then
1212
exit 1
1313
fi
1414

15-
NEWHASH=$(./wolfcrypt/test/testwolfcrypt | sed -n 's/hash = \(.*\)/\1/p')
15+
OUT=$(./wolfcrypt/test/testwolfcrypt | sed -n 's/hash = \(.*\)/\1/p')
16+
NEWHASH="${OUT:0:64}"
1617
if test -n "$NEWHASH"
1718
then
1819
cp wolfcrypt/src/fips_test.c wolfcrypt/src/fips_test.c.bak

0 commit comments

Comments
 (0)