create seedfile in compat.sh

And remove configuration option dependency.
It only depends on if `MBEDTLS_PLATFORM_STD_NV_SEED_FILE` now.

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
This commit is contained in:
Jerry Yu 2022-10-20 02:02:19 +00:00
parent 4070b42cda
commit e579a4d6d5
2 changed files with 19 additions and 15 deletions

View File

@ -33,6 +33,7 @@ SRVMEM=0
: ${M_SRV:=../programs/ssl/ssl_server2}
: ${M_CLI:=../programs/ssl/ssl_client2}
: ${OPENSSL:=openssl}
: ${M_QUERY:=../programs/test/query_compile_time_config}
: ${GNUTLS_CLI:=gnutls-cli}
: ${GNUTLS_SERV:=gnutls-serv}
@ -1089,6 +1090,15 @@ else
DOG_DELAY=10
fi
# `$M_QUERY MBEDTLS_PLATFORM_STD_NV_SEED_FILE` will return `"seedfile"` and
# `dd` will create file with double quotes. That's not expected, with `eval`
# we can remove double quotes
NV_SEED_FILE=$(eval "echo `$M_QUERY MBEDTLS_PLATFORM_STD_NV_SEED_FILE`")
if [ -n "$NV_SEED_FILE" ] && [ ! -f $NV_SEED_FILE ]
then
dd if=/dev/urandom of=$NV_SEED_FILE bs=64 count=1 2>/dev/null
fi
SKIP_NEXT="NO"
trap cleanup INT TERM HUP

View File

@ -2004,23 +2004,17 @@ CLI_OUT="cli_out.$$"
PXY_OUT="pxy_out.$$"
SESSION="session.$$"
# If MBEDTLS_ENTROPY_C && MBEDTLS_ENTROPY_NV_SEED && !MBEDTLS_NO_PLATFORM_ENTROPY
# create seedfile to fix test fail.
SKIP_NEXT="NO"
requires_config_enabled MBEDTLS_ENTROPY_C
requires_config_enabled MBEDTLS_ENTROPY_NV_SEED
requires_config_disabled MBEDTLS_NO_PLATFORM_ENTROPY
create_seedfile()
{
dd if=/dev/urandom of=$1 bs=64 count=1 2>/dev/null
}
if [ "${SKIP_NEXT:-}" != "YES" ]; then
# `$P_QUERY MBEDTLS_PLATFORM_STD_NV_SEED_FILE` will return `"seedfile"` and
# `dd` will create file with double quotes. That's not expected, with `eval`
# we can remove double quotes
eval "create_seedfile `$P_QUERY MBEDTLS_PLATFORM_STD_NV_SEED_FILE`"
# `$P_QUERY MBEDTLS_PLATFORM_STD_NV_SEED_FILE` will return `"seedfile"` and
# `dd` will create file with double quotes. That's not expected, with `eval`
# we can remove double quotes
NV_SEED_FILE=$(eval "echo `$P_QUERY MBEDTLS_PLATFORM_STD_NV_SEED_FILE`")
if [ -n "$NV_SEED_FILE" ] && [ ! -f $NV_SEED_FILE ]
then
dd if=/dev/urandom of=$NV_SEED_FILE bs=64 count=1 2>/dev/null
fi
SKIP_NEXT="NO"
trap cleanup INT TERM HUP