all.sh: support variable seedfile size
The size of the seedfile used by the entropy module when MBEDTLS_ENTROPY_NV_SEED is enabled is 32 byte when MBEDTLS_ENTROPY_FORCE_SHA256 is enabled or MBEDTLS_SHA512_C is disabled, and 64 bytes otherwise. A larger seedfile is ok on entry (the code just grabs the first N bytes), but a smaller seedfile is not ok. Therefore, if you run a component with a 32-byte seedfile and then a component with a 64-byte seedfile, the second component fails in the unit tests (up to test_suite_entropy which erases the seedfile and creates a fresh one). This is ok up to now because we only enable MBEDTLS_ENTROPY_NV_SEED together with MBEDTLS_ENTROPY_FORCE_SHA256. But it prevents enabling MBEDTLS_ENTROPY_NV_SEED without MBEDTLS_ENTROPY_FORCE_SHA256. To fix this, unconditionally create a seedfile before each component.
This commit is contained in:
parent
80a607171a
commit
2ef377d56d
1 changed files with 9 additions and 7 deletions
|
@ -403,12 +403,6 @@ pre_check_git () {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
pre_check_seedfile () {
|
|
||||||
if [ ! -f "./tests/seedfile" ]; then
|
|
||||||
dd if=/dev/urandom of=./tests/seedfile bs=32 count=1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
pre_setup_keep_going () {
|
pre_setup_keep_going () {
|
||||||
failure_summary=
|
failure_summary=
|
||||||
failure_count=0
|
failure_count=0
|
||||||
|
@ -1272,7 +1266,16 @@ run_component () {
|
||||||
cp -p "$CONFIG_H" "$CONFIG_BAK"
|
cp -p "$CONFIG_H" "$CONFIG_BAK"
|
||||||
current_component="$1"
|
current_component="$1"
|
||||||
export MBEDTLS_TEST_CONFIGURATION="$current_component"
|
export MBEDTLS_TEST_CONFIGURATION="$current_component"
|
||||||
|
|
||||||
|
# Unconditionally create a seedfile that's sufficiently long.
|
||||||
|
# Do this before each component, because a previous component may
|
||||||
|
# have messed it up or shortened it.
|
||||||
|
dd if=/dev/urandom of=./tests/seedfile bs=64 count=1
|
||||||
|
|
||||||
|
# Run the component code.
|
||||||
"$@"
|
"$@"
|
||||||
|
|
||||||
|
# Restore the build tree to a clean state.
|
||||||
cleanup
|
cleanup
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1282,7 +1285,6 @@ pre_initialize_variables
|
||||||
pre_parse_command_line "$@"
|
pre_parse_command_line "$@"
|
||||||
|
|
||||||
pre_check_git
|
pre_check_git
|
||||||
pre_check_seedfile
|
|
||||||
|
|
||||||
build_status=0
|
build_status=0
|
||||||
if [ $KEEP_GOING -eq 1 ]; then
|
if [ $KEEP_GOING -eq 1 ]; then
|
||||||
|
|
Loading…
Reference in a new issue