aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorKarl Zhang <karl.zhang@arm.com>2021-05-31 11:41:26 +0800
committerKen Liu <ken.liu@arm.com>2021-06-02 04:59:18 +0200
commit51546c2e8b6265838ccdc04053c528549592e804 (patch)
tree970ec288e8744ef470c821e8edf359227e084a83 /tools
parentb3b2cb6a723b237bfd1b4345cf463a9958a58ce7 (diff)
downloadtrusted-firmware-m-51546c2e8b6265838ccdc04053c528549592e804.tar.gz
Move tf_fuzz to tf-m-tools repo
Delete all tf_fuzz files from tf-m repo. Change-Id: I7d8ad69c783b6ede6792c83903ba4c7789b9563f Signed-off-by: Karl Zhang <karl.zhang@arm.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/index.rst3
-rw-r--r--tools/tf_fuzz/Makefile231
-rw-r--r--tools/tf_fuzz/README154
-rw-r--r--tools/tf_fuzz/assets/README10
-rw-r--r--tools/tf_fuzz/assets/crypto_asset.cpp106
-rw-r--r--tools/tf_fuzz/assets/crypto_asset.hpp94
-rw-r--r--tools/tf_fuzz/assets/psa_asset.cpp55
-rw-r--r--tools/tf_fuzz/assets/psa_asset.hpp69
-rw-r--r--tools/tf_fuzz/assets/sst_asset.cpp50
-rw-r--r--tools/tf_fuzz/assets/sst_asset.hpp42
-rw-r--r--tools/tf_fuzz/boilerplate/README10
-rw-r--r--tools/tf_fuzz/boilerplate/boilerplate.cpp101
-rw-r--r--tools/tf_fuzz/boilerplate/boilerplate.hpp268
-rw-r--r--tools/tf_fuzz/calls/README10
-rw-r--r--tools/tf_fuzz/calls/crypto_call.cpp1385
-rw-r--r--tools/tf_fuzz/calls/crypto_call.hpp582
-rw-r--r--tools/tf_fuzz/calls/psa_call.cpp350
-rw-r--r--tools/tf_fuzz/calls/psa_call.hpp158
-rw-r--r--tools/tf_fuzz/calls/security_call.cpp93
-rw-r--r--tools/tf_fuzz/calls/security_call.hpp48
-rw-r--r--tools/tf_fuzz/calls/sst_call.cpp492
-rw-r--r--tools/tf_fuzz/calls/sst_call.hpp96
-rw-r--r--tools/tf_fuzz/class_forwards.hpp114
-rw-r--r--tools/tf_fuzz/demo/12
-rw-r--r--tools/tf_fuzz/demo/102
-rw-r--r--tools/tf_fuzz/demo/112
-rw-r--r--tools/tf_fuzz/demo/122
-rw-r--r--tools/tf_fuzz/demo/12.52
-rw-r--r--tools/tf_fuzz/demo/134
-rw-r--r--tools/tf_fuzz/demo/143
-rw-r--r--tools/tf_fuzz/demo/153
-rw-r--r--tools/tf_fuzz/demo/166
-rw-r--r--tools/tf_fuzz/demo/178
-rw-r--r--tools/tf_fuzz/demo/189
-rw-r--r--tools/tf_fuzz/demo/194
-rw-r--r--tools/tf_fuzz/demo/22
-rw-r--r--tools/tf_fuzz/demo/2014
-rw-r--r--tools/tf_fuzz/demo/212
-rw-r--r--tools/tf_fuzz/demo/222
-rw-r--r--tools/tf_fuzz/demo/232
-rw-r--r--tools/tf_fuzz/demo/243
-rw-r--r--tools/tf_fuzz/demo/253
-rw-r--r--tools/tf_fuzz/demo/264
-rw-r--r--tools/tf_fuzz/demo/274
-rw-r--r--tools/tf_fuzz/demo/284
-rw-r--r--tools/tf_fuzz/demo/294
-rw-r--r--tools/tf_fuzz/demo/32
-rw-r--r--tools/tf_fuzz/demo/304
-rw-r--r--tools/tf_fuzz/demo/314
-rw-r--r--tools/tf_fuzz/demo/324
-rw-r--r--tools/tf_fuzz/demo/336
-rw-r--r--tools/tf_fuzz/demo/343
-rw-r--r--tools/tf_fuzz/demo/354
-rw-r--r--tools/tf_fuzz/demo/42
-rw-r--r--tools/tf_fuzz/demo/52
-rw-r--r--tools/tf_fuzz/demo/62
-rw-r--r--tools/tf_fuzz/demo/72
-rw-r--r--tools/tf_fuzz/demo/83
-rw-r--r--tools/tf_fuzz/demo/94
-rw-r--r--tools/tf_fuzz/demo/README10
-rw-r--r--tools/tf_fuzz/demo/chkgcc14
-rw-r--r--tools/tf_fuzz/demo/r18
-rw-r--r--tools/tf_fuzz/docs/asset_dir.rst30
-rw-r--r--tools/tf_fuzz/docs/boilerplate_dir.rst27
-rw-r--r--tools/tf_fuzz/docs/calls_dir.rst33
-rw-r--r--tools/tf_fuzz/docs/demo_dir.rst46
-rw-r--r--tools/tf_fuzz/docs/index.rst13
-rw-r--r--tools/tf_fuzz/docs/lib_dir.rst33
-rw-r--r--tools/tf_fuzz/docs/parser_dir.rst27
-rw-r--r--tools/tf_fuzz/docs/regression_dir.rst169
-rw-r--r--tools/tf_fuzz/docs/template_dir.rst23
-rw-r--r--tools/tf_fuzz/docs/tests_dir.rst21
-rw-r--r--tools/tf_fuzz/docs/tf_fuzz_dir.rst124
-rw-r--r--tools/tf_fuzz/docs/utility_dir.rst24
-rw-r--r--tools/tf_fuzz/docs/visualStudio_dir.rst26
-rw-r--r--tools/tf_fuzz/generate_test_suite.sh209
-rw-r--r--tools/tf_fuzz/lib/README10
-rw-r--r--tools/tf_fuzz/lib/human_boilerplate.txt194
-rw-r--r--tools/tf_fuzz/lib/tfm_boilerplate.txt289
-rw-r--r--tools/tf_fuzz/parser/README10
-rw-r--r--tools/tf_fuzz/parser/tf_fuzz_grammar.l165
-rw-r--r--tools/tf_fuzz/parser/tf_fuzz_grammar.y1423
-rw-r--r--tools/tf_fuzz/regression/000001_set_sst_uid_data_expect_pass/check.py119
-rw-r--r--tools/tf_fuzz/regression/000001_set_sst_uid_data_expect_pass/exp_stdout_stderr24
-rw-r--r--tools/tf_fuzz/regression/000001_set_sst_uid_data_expect_pass/exp_test.c61
-rw-r--r--tools/tf_fuzz/regression/000001_set_sst_uid_data_expect_pass/template2
-rw-r--r--tools/tf_fuzz/regression/000002_set_sst_name_data_expect_nothing/check.py119
-rw-r--r--tools/tf_fuzz/regression/000002_set_sst_name_data_expect_nothing/exp_stdout_stderr24
-rw-r--r--tools/tf_fuzz/regression/000002_set_sst_name_data_expect_nothing/exp_test.c58
-rw-r--r--tools/tf_fuzz/regression/000002_set_sst_name_data_expect_nothing/template2
-rw-r--r--tools/tf_fuzz/regression/000003_set_sst_name_data/check.py119
-rw-r--r--tools/tf_fuzz/regression/000003_set_sst_name_data/exp_stdout_stderr23
-rw-r--r--tools/tf_fuzz/regression/000003_set_sst_name_data/exp_test.c61
-rw-r--r--tools/tf_fuzz/regression/000003_set_sst_name_data/template2
-rw-r--r--tools/tf_fuzz/regression/000004_set_sst_name_rand_data/check.py119
-rw-r--r--tools/tf_fuzz/regression/000004_set_sst_name_rand_data/exp_stdout_stderr22
-rw-r--r--tools/tf_fuzz/regression/000004_set_sst_name_rand_data/exp_test.c61
-rw-r--r--tools/tf_fuzz/regression/000004_set_sst_name_rand_data/template2
-rw-r--r--tools/tf_fuzz/regression/000005_set_sst_rand_name_rand_data/check.py119
-rw-r--r--tools/tf_fuzz/regression/000005_set_sst_rand_name_rand_data/exp_stdout_stderr21
-rw-r--r--tools/tf_fuzz/regression/000005_set_sst_rand_name_rand_data/exp_test.c61
-rw-r--r--tools/tf_fuzz/regression/000005_set_sst_rand_name_rand_data/template2
-rw-r--r--tools/tf_fuzz/regression/000006_set_sst_multi_name_rand_data/check.py119
-rw-r--r--tools/tf_fuzz/regression/000006_set_sst_multi_name_rand_data/exp_stdout_stderr34
-rw-r--r--tools/tf_fuzz/regression/000006_set_sst_multi_name_rand_data/exp_test.c117
-rw-r--r--tools/tf_fuzz/regression/000006_set_sst_multi_name_rand_data/template2
-rw-r--r--tools/tf_fuzz/regression/000007_set_sst_multi_uid_rand_data/check.py119
-rw-r--r--tools/tf_fuzz/regression/000007_set_sst_multi_uid_rand_data/exp_stdout_stderr37
-rw-r--r--tools/tf_fuzz/regression/000007_set_sst_multi_uid_rand_data/exp_test.c131
-rw-r--r--tools/tf_fuzz/regression/000007_set_sst_multi_uid_rand_data/template2
-rw-r--r--tools/tf_fuzz/regression/000008_set_sst_name_rand_data_read_check_wrong/check.py119
-rw-r--r--tools/tf_fuzz/regression/000008_set_sst_name_rand_data_read_check_wrong/exp_stdout_stderr34
-rw-r--r--tools/tf_fuzz/regression/000008_set_sst_name_rand_data_read_check_wrong/exp_test.c76
-rw-r--r--tools/tf_fuzz/regression/000008_set_sst_name_rand_data_read_check_wrong/template3
-rw-r--r--tools/tf_fuzz/regression/000009_set_sst_name_rand_data_read_check_var_read_print/check.py119
-rw-r--r--tools/tf_fuzz/regression/000009_set_sst_name_rand_data_read_check_var_read_print/exp_stdout_stderr44
-rw-r--r--tools/tf_fuzz/regression/000009_set_sst_name_rand_data_read_check_var_read_print/exp_test.c83
-rw-r--r--tools/tf_fuzz/regression/000009_set_sst_name_rand_data_read_check_var_read_print/template4
-rw-r--r--tools/tf_fuzz/regression/000010_read_nonexistent_sst_check_string/check.py119
-rw-r--r--tools/tf_fuzz/regression/000010_read_nonexistent_sst_check_string/exp_stdout_stderr24
-rw-r--r--tools/tf_fuzz/regression/000010_read_nonexistent_sst_check_string/exp_test.c62
-rw-r--r--tools/tf_fuzz/regression/000010_read_nonexistent_sst_check_string/template2
-rw-r--r--tools/tf_fuzz/regression/000011_read_nonexistent_sst_check_string_expect_pass/check.py119
-rw-r--r--tools/tf_fuzz/regression/000011_read_nonexistent_sst_check_string_expect_pass/exp_stdout_stderr25
-rw-r--r--tools/tf_fuzz/regression/000011_read_nonexistent_sst_check_string_expect_pass/exp_test.c62
-rw-r--r--tools/tf_fuzz/regression/000011_read_nonexistent_sst_check_string_expect_pass/template2
-rw-r--r--tools/tf_fuzz/regression/000012_read_nonexistent_sst_check_string_expect_other/check.py119
-rw-r--r--tools/tf_fuzz/regression/000012_read_nonexistent_sst_check_string_expect_other/exp_stdout_stderr26
-rw-r--r--tools/tf_fuzz/regression/000012_read_nonexistent_sst_check_string_expect_other/exp_test.c62
-rw-r--r--tools/tf_fuzz/regression/000012_read_nonexistent_sst_check_string_expect_other/template2
-rw-r--r--tools/tf_fuzz/regression/000013_set_sst_name_rand_data_remove_twice/check.py119
-rw-r--r--tools/tf_fuzz/regression/000013_set_sst_name_rand_data_remove_twice/exp_stdout_stderr38
-rw-r--r--tools/tf_fuzz/regression/000013_set_sst_name_rand_data_remove_twice/exp_test.c66
-rw-r--r--tools/tf_fuzz/regression/000013_set_sst_name_rand_data_remove_twice/template4
-rw-r--r--tools/tf_fuzz/regression/000014_set_sst_name_rand_data_remove_other/check.py119
-rw-r--r--tools/tf_fuzz/regression/000014_set_sst_name_rand_data_remove_other/exp_stdout_stderr30
-rw-r--r--tools/tf_fuzz/regression/000014_set_sst_name_rand_data_remove_other/exp_test.c66
-rw-r--r--tools/tf_fuzz/regression/000014_set_sst_name_rand_data_remove_other/template3
-rw-r--r--tools/tf_fuzz/regression/000015_set_sst_name_only/check.py119
-rw-r--r--tools/tf_fuzz/regression/000015_set_sst_name_only/exp_stdout_stderr30
-rw-r--r--tools/tf_fuzz/regression/000015_set_sst_name_only/exp_test.c75
-rw-r--r--tools/tf_fuzz/regression/000015_set_sst_name_only/template3
-rw-r--r--tools/tf_fuzz/regression/000016_set_sst_single_asset_set_multiple_times/check.py119
-rw-r--r--tools/tf_fuzz/regression/000016_set_sst_single_asset_set_multiple_times/exp_stdout_stderr66
-rw-r--r--tools/tf_fuzz/regression/000016_set_sst_single_asset_set_multiple_times/exp_test.c97
-rw-r--r--tools/tf_fuzz/regression/000016_set_sst_single_asset_set_multiple_times/template6
-rw-r--r--tools/tf_fuzz/regression/000017_read_sst_check_single_asset_multiple_times/check.py119
-rw-r--r--tools/tf_fuzz/regression/000017_read_sst_check_single_asset_multiple_times/exp_stdout_stderr68
-rw-r--r--tools/tf_fuzz/regression/000017_read_sst_check_single_asset_multiple_times/exp_test.c109
-rw-r--r--tools/tf_fuzz/regression/000017_read_sst_check_single_asset_multiple_times/template7
-rw-r--r--tools/tf_fuzz/regression/000018_000016_and_000017/check.py119
-rw-r--r--tools/tf_fuzz/regression/000018_000016_and_000017/exp_stdout_stderr121
-rw-r--r--tools/tf_fuzz/regression/000018_000016_and_000017/exp_test.c154
-rw-r--r--tools/tf_fuzz/regression/000018_000016_and_000017/template11
-rw-r--r--tools/tf_fuzz/regression/000019_read_asset_to_variable_set_other_asset/check.py119
-rw-r--r--tools/tf_fuzz/regression/000019_read_asset_to_variable_set_other_asset/exp_stdout_stderr76
-rw-r--r--tools/tf_fuzz/regression/000019_read_asset_to_variable_set_other_asset/exp_test.c127
-rw-r--r--tools/tf_fuzz/regression/000019_read_asset_to_variable_set_other_asset/template7
-rw-r--r--tools/tf_fuzz/regression/000020_no_purpose/check.py119
-rw-r--r--tools/tf_fuzz/regression/000020_no_purpose/exp_stdout_stderr17
-rw-r--r--tools/tf_fuzz/regression/000020_no_purpose/exp_test.c0
-rw-r--r--tools/tf_fuzz/regression/000020_no_purpose/template2
-rw-r--r--tools/tf_fuzz/regression/000021_abbreviated_result_codes/check.py119
-rw-r--r--tools/tf_fuzz/regression/000021_abbreviated_result_codes/exp_stdout_stderr26
-rw-r--r--tools/tf_fuzz/regression/000021_abbreviated_result_codes/exp_test.c62
-rw-r--r--tools/tf_fuzz/regression/000021_abbreviated_result_codes/template2
-rw-r--r--tools/tf_fuzz/regression/000022_SST_offset/check.py119
-rw-r--r--tools/tf_fuzz/regression/000022_SST_offset/exp_stdout_stderr35
-rw-r--r--tools/tf_fuzz/regression/000022_SST_offset/exp_test.c70
-rw-r--r--tools/tf_fuzz/regression/000022_SST_offset/template3
-rw-r--r--tools/tf_fuzz/regression/000023_SST_creation_flags/check.py119
-rw-r--r--tools/tf_fuzz/regression/000023_SST_creation_flags/exp_stdout_stderr89
-rw-r--r--tools/tf_fuzz/regression/000023_SST_creation_flags/exp_test.c117
-rw-r--r--tools/tf_fuzz/regression/000023_SST_creation_flags/template6
-rw-r--r--tools/tf_fuzz/regression/000024_SST_write_once/check.py119
-rw-r--r--tools/tf_fuzz/regression/000024_SST_write_once/exp_stdout_stderr45
-rw-r--r--tools/tf_fuzz/regression/000024_SST_write_once/exp_test.c79
-rw-r--r--tools/tf_fuzz/regression/000024_SST_write_once/template4
-rw-r--r--tools/tf_fuzz/regression/README9
-rw-r--r--tools/tf_fuzz/regression/add_these_tests/000015_set_sst_multi_name_remove_rand_active/exp_stdout_stderr30
-rw-r--r--tools/tf_fuzz/regression/add_these_tests/000015_set_sst_multi_name_remove_rand_active/exp_test.c117
-rw-r--r--tools/tf_fuzz/regression/add_these_tests/000015_set_sst_multi_name_remove_rand_active/template3
-rw-r--r--tools/tf_fuzz/regression/add_these_tests/000016_set_sst_multi_name_remove_multi_rand_active_remove_rand_deleted/exp_stdout_stderr48
-rw-r--r--tools/tf_fuzz/regression/add_these_tests/000016_set_sst_multi_name_remove_multi_rand_active_remove_rand_deleted/exp_test.c123
-rw-r--r--tools/tf_fuzz/regression/add_these_tests/000016_set_sst_multi_name_remove_multi_rand_active_remove_rand_deleted/template6
-rw-r--r--tools/tf_fuzz/regression/regress22
-rw-r--r--tools/tf_fuzz/regression/regress_lib/line_by_line.py172
-rw-r--r--tools/tf_fuzz/template/README10
-rw-r--r--tools/tf_fuzz/template/crypto_template_line.cpp156
-rw-r--r--tools/tf_fuzz/template/crypto_template_line.hpp294
-rw-r--r--tools/tf_fuzz/template/secure_template_line.cpp73
-rw-r--r--tools/tf_fuzz/template/secure_template_line.hpp60
-rw-r--r--tools/tf_fuzz/template/sst_template_line.cpp110
-rw-r--r--tools/tf_fuzz/template/sst_template_line.hpp97
-rw-r--r--tools/tf_fuzz/template/template_line.cpp278
-rw-r--r--tools/tf_fuzz/template/template_line.hpp174
-rw-r--r--tools/tf_fuzz/tests/example_template20
-rw-r--r--tools/tf_fuzz/tests/sstReads87
-rw-r--r--tools/tf_fuzz/tests/sstSets59
-rw-r--r--tools/tf_fuzz/tf_fuzz.cpp512
-rw-r--r--tools/tf_fuzz/tf_fuzz.hpp202
-rw-r--r--tools/tf_fuzz/utility/README11
-rw-r--r--tools/tf_fuzz/utility/compute.cpp76
-rw-r--r--tools/tf_fuzz/utility/compute.hpp37
-rw-r--r--tools/tf_fuzz/utility/data_blocks.cpp383
-rw-r--r--tools/tf_fuzz/utility/data_blocks.hpp227
-rw-r--r--tools/tf_fuzz/utility/find_or_create_asset.hpp169
-rw-r--r--tools/tf_fuzz/utility/gibberish.cpp210
-rw-r--r--tools/tf_fuzz/utility/gibberish.hpp58
-rw-r--r--tools/tf_fuzz/utility/randomization.cpp140
-rw-r--r--tools/tf_fuzz/utility/randomization.hpp21
-rw-r--r--tools/tf_fuzz/utility/string_ops.cpp114
-rw-r--r--tools/tf_fuzz/utility/string_ops.hpp49
-rw-r--r--tools/tf_fuzz/utility/variables.cpp72
-rw-r--r--tools/tf_fuzz/utility/variables.hpp59
-rw-r--r--tools/tf_fuzz/visualStudio/README10
-rw-r--r--tools/tf_fuzz/visualStudio/unistd.c3
-rw-r--r--tools/tf_fuzz/visualStudio/unistd.h2
218 files changed, 1 insertions, 17731 deletions
diff --git a/tools/index.rst b/tools/index.rst
index bea6291d3..df940a934 100644
--- a/tools/index.rst
+++ b/tools/index.rst
@@ -6,8 +6,7 @@ Tools
:glob:
iat-verifier/*
- tf_fuzz/docs/index
--------------
-*Copyright (c) 2020, Arm Limited. All rights reserved.*
+*Copyright (c) 2020-2021, Arm Limited. All rights reserved.*
diff --git a/tools/tf_fuzz/Makefile b/tools/tf_fuzz/Makefile
deleted file mode 100644
index 0e98dc6b4..000000000
--- a/tools/tf_fuzz/Makefile
+++ /dev/null
@@ -1,231 +0,0 @@
-# Copyright (c) 2019-2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-.PHONY: default
-default: tfz;
-
-edit:
- $(EDITOR) template/template_line.hpp \
- template/sst_template_line.hpp template/crypto_template_line.hpp \
- template/secure_template_line.hpp calls/psa_call.hpp calls/sst_call.hpp \
- calls/crypto_call.hpp calls/security_call.hpp assets/psa_asset.hpp \
- assets/sst_asset.hpp assets/crypto_asset.hpp utility/data_blocks.hpp \
- utility/variables.hpp utility/gibberish.hpp utility/randomization.hpp \
- utility/find_or_create_asset.hpp utility/string_ops.hpp \
- utility/compute.hpp boilerplate/boilerplate.hpp \
- utility/find_or_create_asset.hpp class_forwards.hpp tf_fuzz.hpp \
- parser/tf_fuzz_grammar.l parser/tf_fuzz_grammar.y \
- template/template_line.cpp \
- template/sst_template_line.cpp template/crypto_template_line.cpp \
- template/secure_template_line.cpp calls/psa_call.cpp calls/sst_call.cpp \
- calls/crypto_call.cpp calls/security_call.cpp assets/psa_asset.cpp \
- assets/sst_asset.cpp assets/crypto_asset.cpp utility/data_blocks.cpp \
- utility/gibberish.cpp utility/randomization.cpp utility/string_ops.cpp \
- utility/compute.cpp \
- boilerplate/boilerplate.cpp tf_fuzz.cpp \
- tests/example_template tests/sstSets tests/sstReads \
- lib/tfm_boilerplate.txt boilerplate/boilerplate.hpp \
- Makefile README assets/README \
- boilerplate/README calls/README demo/README lib/README parser/README \
- template/README tests/README regression/README utility/README \
- visualStudio/README &
-
-edit3:
- $(EDITOR) template/template_line.hpp \
- template/sst_template_line.hpp template/crypto_template_line.hpp \
- template/secure_template_line.hpp calls/psa_call.hpp calls/sst_call.hpp \
- calls/crypto_call.hpp calls/security_call.hpp assets/psa_asset.hpp \
- assets/sst_asset.hpp assets/crypto_asset.hpp utility/data_blocks.hpp \
- utility/variables.hpp utility/gibberish.hpp utility/randomization.hpp \
- utility/find_or_create_asset.hpp utility/string_ops.hpp \
- utility/compute.hpp boilerplate/boilerplate.hpp \
- utility/find_or_create_asset.hpp class_forwards.hpp tf_fuzz.hpp &
- $(EDITOR) parser/tf_fuzz_grammar.l parser/tf_fuzz_grammar.y \
- template/template_line.cpp \
- template/sst_template_line.cpp template/crypto_template_line.cpp \
- template/secure_template_line.cpp calls/psa_call.cpp calls/sst_call.cpp \
- calls/crypto_call.cpp calls/security_call.cpp assets/psa_asset.cpp \
- assets/sst_asset.cpp assets/crypto_asset.cpp utility/data_blocks.cpp \
- utility/variables.cpp utility/gibberish.cpp utility/randomization.cpp \
- utility/string_ops.cpp utility/compute.cpp boilerplate/boilerplate.cpp \
- tf_fuzz.cpp &
- $(EDITOR) tests/example_template Makefile tests/sstSets tests/sstReads \
- lib/tfm_boilerplate.txt boilerplate/boilerplate.hpp &
-
-includes = -I . -I ./parser -I ./template -I ./assets -I ./calls -I ./boilerplate -I ./utility
-
-parser/tf_fuzz_grammar.tab.hpp: parser/tf_fuzz_grammar.y class_forwards.hpp \
-boilerplate/boilerplate.hpp utility/gibberish.hpp utility/string_ops.hpp \
-tf_fuzz.hpp utility/data_blocks.hpp utility/variables.hpp \
-utility/find_or_create_asset.hpp assets/psa_asset.hpp \
-assets/sst_asset.hpp assets/crypto_asset.hpp calls/psa_call.hpp \
-template/template_line.hpp Makefile
- rm -f parser/tf_fuzz_grammar.tab.hpp parser/tf_fuzz_grammar.tab.cpp \
- parser/tf_fuzz_grammar.tab.o
- bison --verbose -d parser/tf_fuzz_grammar.y -o \
- parser/tf_fuzz_grammar.tab.cpp
-
-parser/tf_fuzz_grammar.tab.cpp: parser/tf_fuzz_grammar.y class_forwards.hpp \
-boilerplate/boilerplate.hpp utility/gibberish.hpp utility/string_ops.hpp \
-tf_fuzz.hpp utility/data_blocks.hpp utility/variables.hpp \
-utility/find_or_create_asset.hpp assets/psa_asset.hpp \
-assets/sst_asset.hpp assets/crypto_asset.hpp calls/psa_call.hpp \
-template/template_line.hpp Makefile
- rm -f parser/tf_fuzz_grammar.tab.hpp parser/tf_fuzz_grammar.tab.cpp \
- parser/tf_fuzz_grammar.tab.o
- bison --verbose -d parser/tf_fuzz_grammar.y -o \
- parser/tf_fuzz_grammar.tab.cpp
-
-parser/tf_fuzz_grammar.lex.c: parser/tf_fuzz_grammar.l \
-parser/tf_fuzz_grammar.tab.hpp Makefile
- lex --outfile=parser/tf_fuzz_grammar.lex.c parser/tf_fuzz_grammar.l
-parser/tf_fuzz_grammar.lex.o: parser/tf_fuzz_grammar.lex.c Makefile
- g++ -std=gnu++11 -O0 -g -c -I /usr/include $(includes) -o parser/tf_fuzz_grammar.lex.o \
- parser/tf_fuzz_grammar.lex.c
-
-parser/tf_fuzz_grammar.tab.o: parser/tf_fuzz_grammar.lex.o \
-parser/tf_fuzz_grammar.tab.cpp parser/tf_fuzz_grammar.tab.hpp Makefile
- g++ -Wall -std=c++11 -O0 -g -c -I /usr/include $(includes) -o \
- parser/tf_fuzz_grammar.tab.o parser/tf_fuzz_grammar.tab.cpp
-
-utility/data_blocks.o: utility/data_blocks.hpp utility/data_blocks.cpp Makefile
- g++ -Wall -std=c++11 -O0 -g -c $(includes) -o utility/data_blocks.o \
- utility/data_blocks.cpp
-
-utility/variables.o: utility/find_or_create_asset.hpp \
-utility/variables.hpp utility/variables.cpp Makefile
- g++ -Wall -std=c++11 -O0 -g -c $(includes) -o utility/variables.o \
- utility/variables.cpp
-
-template/template_line.o: utility/randomization.hpp template/template_line.cpp \
-class_forwards.hpp boilerplate/boilerplate.hpp tf_fuzz.hpp calls/psa_call.hpp \
-assets/psa_asset.hpp utility/data_blocks.hpp template/template_line.hpp \
-assets/sst_asset.hpp assets/crypto_asset.hpp Makefile
- g++ -Wall -std=c++11 -O0 -g -c $(includes) -o template/template_line.o \
- template/template_line.cpp
-
-template/sst_template_line.o: template/sst_template_line.cpp class_forwards.hpp \
-boilerplate/boilerplate.hpp tf_fuzz.hpp calls/psa_call.hpp assets/psa_asset.hpp \
-utility/data_blocks.hpp template/template_line.hpp template/sst_template_line.hpp \
-assets/sst_asset.hpp assets/crypto_asset.hpp Makefile
- g++ -Wall -std=c++11 -O0 -g -c $(includes) -o template/sst_template_line.o \
- template/sst_template_line.cpp
-
-template/crypto_template_line.o: template/crypto_template_line.cpp \
-class_forwards.hpp boilerplate/boilerplate.hpp tf_fuzz.hpp calls/psa_call.hpp \
-assets/psa_asset.hpp utility/data_blocks.hpp template/template_line.hpp \
-assets/sst_asset.hpp assets/crypto_asset.hpp template/crypto_template_line.hpp Makefile
- g++ -Wall -std=c++11 -O0 -g -c $(includes) -o template/crypto_template_line.o \
- template/crypto_template_line.cpp
-
-template/secure_template_line.o: utility/randomization.hpp class_forwards.hpp \
-boilerplate/boilerplate.hpp tf_fuzz.hpp calls/psa_call.hpp \
-assets/psa_asset.hpp utility/data_blocks.hpp template/secure_template_line.hpp \
-assets/sst_asset.hpp assets/crypto_asset.hpp Makefile
- g++ -Wall -std=c++11 -O0 -g -c $(includes) -o template/secure_template_line.o \
- template/secure_template_line.cpp
-
-assets/psa_asset.o: assets/psa_asset.cpp class_forwards.hpp \
-boilerplate/boilerplate.hpp tf_fuzz.hpp utility/data_blocks.hpp calls/psa_call.hpp \
-assets/psa_asset.hpp template/template_line.hpp Makefile
- g++ -Wall -std=c++11 -O0 -g -c $(includes) -o assets/psa_asset.o \
- assets/psa_asset.cpp
-
-assets/sst_asset.o: assets/sst_asset.cpp class_forwards.hpp \
-boilerplate/boilerplate.hpp utility/data_blocks.hpp tf_fuzz.hpp calls/psa_call.hpp \
-assets/psa_asset.hpp template/template_line.hpp assets/sst_asset.hpp Makefile
- g++ -Wall -std=c++11 -O0 -g -c $(includes) -o assets/sst_asset.o \
- assets/sst_asset.cpp
-
-assets/crypto_asset.o: utility/randomization.hpp assets/crypto_asset.cpp \
-class_forwards.hpp boilerplate/boilerplate.hpp tf_fuzz.hpp utility/data_blocks.hpp \
-calls/psa_call.hpp assets/psa_asset.hpp assets/crypto_asset.hpp Makefile
- g++ -Wall -std=c++11 -O0 -g -c $(includes) -o assets/crypto_asset.o \
- assets/crypto_asset.cpp
-
-calls/psa_call.o: calls/psa_call.cpp class_forwards.hpp \
-boilerplate/boilerplate.hpp utility/data_blocks.hpp utility/variables.hpp tf_fuzz.hpp \
-calls/psa_call.hpp Makefile
- g++ -Wall -std=c++11 -O0 -g -c $(includes) -o calls/psa_call.o calls/psa_call.cpp
-
-calls/sst_call.o: calls/sst_call.cpp class_forwards.hpp \
-boilerplate/boilerplate.hpp tf_fuzz.hpp calls/psa_call.hpp assets/psa_asset.hpp \
-template/template_line.hpp utility/data_blocks.hpp utility/variables.hpp \
-calls/sst_call.hpp assets/sst_asset.hpp assets/crypto_asset.hpp utility/string_ops.hpp \
-Makefile
- g++ -Wall -std=c++11 -O0 -g -c $(includes) -o calls/sst_call.o \
- calls/sst_call.cpp
-
-calls/crypto_call.o: utility/randomization.hpp calls/crypto_call.cpp \
-class_forwards.hpp boilerplate/boilerplate.hpp utility/string_ops.hpp \
-tf_fuzz.hpp calls/psa_call.hpp utility/data_blocks.hpp utility/variables.hpp \
-assets/psa_asset.hpp template/template_line.hpp \
-calls/crypto_call.hpp assets/sst_asset.hpp assets/crypto_asset.hpp Makefile
- g++ -Wall -std=c++11 -O0 -g -c $(includes) -o calls/crypto_call.o \
- calls/crypto_call.cpp
-
-calls/security_call.o: utility/randomization.hpp calls/security_call.hpp \
-calls/security_call.cpp class_forwards.hpp boilerplate/boilerplate.hpp \
-utility/string_ops.hpp utility/data_blocks.hpp utility/variables.hpp tf_fuzz.hpp \
-calls/psa_call.hpp assets/psa_asset.hpp template/template_line.hpp \
-calls/security_call.hpp assets/sst_asset.hpp \
-Makefile
- g++ -Wall -std=c++11 -O0 -g -c $(includes) -o calls/security_call.o \
- calls/security_call.cpp
-
-boilerplate/boilerplate.o: boilerplate/boilerplate.cpp class_forwards.hpp \
-boilerplate/boilerplate.hpp tf_fuzz.hpp calls/psa_call.hpp assets/psa_asset.hpp \
-template/template_line.hpp Makefile
- g++ -Wall -std=c++11 -O0 -g -c $(includes) -o boilerplate/boilerplate.o \
- boilerplate/boilerplate.cpp
-
-utility/gibberish.o: utility/gibberish.cpp class_forwards.hpp \
-utility/gibberish.hpp Makefile
- g++ -Wall -std=c++11 -O0 -g -c $(includes) -o utility/gibberish.o \
- utility/gibberish.cpp
-
-utility/string_ops.o: utility/string_ops.cpp utility/string_ops.hpp Makefile
- g++ -Wall -std=c++11 -O0 -g -c $(includes) -o utility/string_ops.o \
- utility/string_ops.cpp
-
-utility/randomization.o: utility/randomization.cpp utility/randomization.hpp \
-Makefile
- g++ -Wall -std=c++11 -O0 -g -c $(includes) -o utility/randomization.o \
- utility/randomization.cpp
-
-utility/compute.o: utility/compute.cpp utility/compute.hpp Makefile
- g++ -Wall -std=c++11 -O0 -g -c $(includes) -o utility/compute.o \
- utility/compute.cpp
-
-tf_fuzz.o: tf_fuzz.cpp class_forwards.hpp boilerplate/boilerplate.hpp tf_fuzz.hpp \
-calls/psa_call.hpp assets/psa_asset.hpp utility/data_blocks.hpp utility/variables.hpp \
-template/template_line.hpp parser/tf_fuzz_grammar.tab.hpp Makefile
- g++ -Wall -std=c++11 -O0 -g -c $(includes) -o tf_fuzz.o tf_fuzz.cpp
-
-tfz: parser/tf_fuzz_grammar.lex.o parser/tf_fuzz_grammar.tab.o \
-template/secure_template_line.o template/template_line.o \
-template/sst_template_line.o template/crypto_template_line.o utility/data_blocks.o \
-utility/variables.o assets/psa_asset.o assets/sst_asset.o assets/crypto_asset.o \
-utility/gibberish.o utility/string_ops.o calls/psa_call.o calls/sst_call.o \
-calls/crypto_call.o utility/randomization.o utility/compute.o boilerplate/boilerplate.o \
-calls/security_call.o tf_fuzz.o \
-Makefile
- g++ -Wall -std=c++11 -O0 -g -o tfz parser/tf_fuzz_grammar.lex.o \
- parser/tf_fuzz_grammar.tab.o template/secure_template_line.o \
- template/template_line.o template/sst_template_line.o utility/data_blocks.o \
- utility/variables.o template/crypto_template_line.o assets/psa_asset.o \
- assets/sst_asset.o assets/crypto_asset.o utility/gibberish.o \
- utility/string_ops.o utility/randomization.o utility/compute.o \
- calls/psa_call.o calls/sst_call.o calls/crypto_call.o calls/security_call.o \
- boilerplate/boilerplate.o tf_fuzz.o
-
-clean:
- rm -f ./*.o parser/*.o assets/*.o calls/*.o template/*.o utility/*.o \
- boilerplate/*.o utility/gibberish.o tfz tfz.exe \
- parser/tf_fuzz_grammar.lex.* parser/tf_fuzz_grammar.tab.* \
- parser/tf_fuzz_grammar.output
- rm -f `find regression -name "stdout_stderr"`
- rm -f `find regression -name "test.c"`
- rm -f demo/tossThis*
diff --git a/tools/tf_fuzz/README b/tools/tf_fuzz/README
deleted file mode 100644
index 32754c216..000000000
--- a/tools/tf_fuzz/README
+++ /dev/null
@@ -1,154 +0,0 @@
-.../tf_fuzz directory contents:
-
-assets calls demo parser tests regression
-backupStuff class_forwards.hpp lib README tf_fuzz.cpp utility
-boilerplate commands Makefile template tf_fuzz.hpp visualStudio
-
-TF-Fuzz root directory.
-
---------------------------------------------------------------------------------
-
-TF-Fuzz is a TF-M fuzzing tool, at the PSA-call level. At the time of writing
-this at least, presentations available at:
- https://www.trustedfirmware.org/docs/TF-M_Fuzzing_Tool_TFOrg.pdf
- https://zoom.us/rec/share/1dxZcZit111IadadyFqFU7IoP5X5aaa8gXUdr_UInxmMbyLzEqEmXQdx79-IWQ9p
-(These presentation materials may not be viewable by all parties.)
-
---------------------------------------------------------------------------------
-
-To build TF-Fuzz, simply type "make" in this directory. Executable, called
-"tfz," is placed in this directory.
-
-To run tfz, two environment variables must first be assigned. In bash syntax:
-export TF_FUZZ_LIB_DIR=<path to this TF-M installation>/tools/tf_fuzz/lib
-export TF_FUZZ_BPLATE=tfm_boilerplate.txt
-
-Examples of usage can be found in the demo directory.
-
---------------------------------------------------------------------------------
-
-To generate a testsuite for TF-M from a set of template files, use
-generate_test_suite.sh.
-
-.. code-block:: bash
-
- Usage: generate_test_suite.sh <template_dir> <suites_dir>
-
- Where:
- template_dir: The directory containing template files for the
- fuzzing tool
- suites_dir: The suites directory in the TF-M working copy.
- i.e.: $TF-M_ROOT/test/suites
- Example:
- cd tools/tf_fuzz
- ./generate_test_suite.sh $TF-M_ROOT/tools/tf_fuzz/tests/ $TF-M_ROOT/../tf-m-tests/test/suites/
-
-
-After the test suite is generated, the new test suite needs to be added to the
-TF-M build by providing the following options to the CMake generate command
-(The path needs to be aligned with the test suite dir provided for the shell
-script above):
-
-.. code-block:: bash
-
- -DTFM_FUZZER_TOOL_TESTS=1
- -DTFM_FUZZER_TOOL_TESTS_CMAKE_INC_PATH=$TF-M_ROOT/test/suites/tf_fuzz
-
---------------------------------------------------------------------------------
-
-To help understand the code, below is a C++-class hierarchy used in this code
-base. They are explained further in the READMEs in their respective direc-
-tories, so the file names where the classes are defined is listed below (this,
-very roughly in order of functional interactions, of chronological usage during
-execution, and of most-to-least importance):
-
- template_line ./template/template_line.hpp
- sst_template_line ./template/template_line.hpp
- read_sst_template_line ./template/sst_template_line.hpp
- remove_sst_template_line ./template/sst_template_line.hpp
- set_sst_template_line ./template/sst_template_line.hpp
- policy_template_line ./template/template_line.hpp
- read_policy_template_line ./template/crypto_template_line.hpp
- set_policy_template_line ./template/crypto_template_line.hpp
- key_template_line ./template/template_line.hpp
- read_key_template_line ./template/crypto_template_line.hpp
- remove_key_template_line ./template/crypto_template_line.hpp
- set_key_template_line ./template/crypto_template_line.hpp
- security_template_line ./template/template_line.hpp
- security_hash_template_line ./template/secure_template_line.hpp
-
- psa_call ./calls/psa_call.hpp
- crypto_call ./calls/psa_call.hpp
- policy_call ./calls/crypto_call.hpp
- policy_get_call ./calls/crypto_call.hpp
- policy_set_call ./calls/crypto_call.hpp
- key_call ./calls/crypto_call.hpp
- get_key_info_call ./calls/crypto_call.hpp
- set_key_call ./calls/crypto_call.hpp
- destroy_key_call ./calls/crypto_call.hpp
- sst_call ./calls/psa_call.hpp
- sst_remove_call ./calls/sst_call.hpp
- sst_get_call ./calls/sst_call.hpp
- sst_set_call ./calls/sst_call.hpp
- security_call ./calls/psa_call.hpp
- hash_call ./calls/security_call.hpp
-
- boilerplate ./boilerplate/boilerplate.hpp
-
- psa_asset ./assets/psa_asset.hpp
- crypto_asset ./assets/crypto_asset.hpp
- policy_asset ./assets/crypto_asset.hpp
- key_asset ./assets/crypto_asset.hpp
- sst_asset ./assets/sst_asset.hpp
-
- tf_fuzz_info ./tf_fuzz.hpp
-
- crc32 ./utility/compute.hpp
-
- gibberish ./utility/gibberish.hpp
-
- expect_info ./utility/data_blocks.hpp
- set_data_info ./utility/data_blocks.hpp
- asset_name_id_info ./utility/data_blocks.hpp
-
---------------------------------------------------------------------------------
-
-There are currently two especially annoying warts on the design of TF-Fuzz:
-* Need better management of variables in the generated code. Currently,
- for example, upon "read"ing a value from a PSA asset more than once, it
- creates a same-named (i.e., duplicate) variable for each such time, which
- is obviously not right.
-* Upon adding the ability to do "do any N of these PSA calls at random,"
- in hindsight, a fundamental flaw was uncovered in the top-level flow of
- how TF-Fuzz generates the code. High-level summary:
- * It should have completely distinct Parse, Simulate, then Code-generation
- stages.
- * Currently, the Parse and Simulate stages aren't really completely
- distinct, so there's a bunch of complicated Boolean flags traffic-
- copping between what in hindsight should be completely-separate Parse
- vs. Code-generation functionality.
- The function, interpret_template_line(), currently in
- .../tf_fuzz/parser/tf_fuzz_grammar.y (which may be moved to the its own file
- with randomize_template_lines()), has the lion's share of such Booleans,
- such as fill_in_template, create_call_bool, and create_asset_bool.
- The way it *should* work is:
- * The parser in .../tf_fuzz_grammar.y should generate an STL vector (or
- list) of psa_call-subclass "tracker" objects. It should not generate
- PSA-asset tracker objects (subclasses of psa_asset).
- * There should then be an organized Simulate stage, that sequences through
- the psa_call-subclass list, creating and accumulating/maintaining current
- state in psa_asset-subclass objects, using that current state to
- determine expected results of each PSA call, which get annotated back
- into the psa_call-tracker objects.
- * Finally, there already is, and should continue to be, a Code-generation
- phase that writes out the code, based upon text substitutions of
- "boilerplate" code snippets.
- * Currently, (hindsight obvious) the Parse and Simulate phases got somewhat
- muddled together. This shouldn't be super-hard to fix.
- That final Code-generation phase, conceptually at least, could be replaced
- instead with simply executing those commands directly, for targets that
- sufficient space to run TF-Fuzz in real-time.
-
---------------
-
-*Copyright (c) 2019-2020, Arm Limited. All rights reserved.*
diff --git a/tools/tf_fuzz/assets/README b/tools/tf_fuzz/assets/README
deleted file mode 100644
index 870416e75..000000000
--- a/tools/tf_fuzz/assets/README
+++ /dev/null
@@ -1,10 +0,0 @@
-This directory contains C++ header and program files for classes of objects that
-track PSA assets, notably during the Simulate phase.
-
-For more information, please browse to:
-
- https://ci.trustedfirmware.org/job/tf-m-build-test-nightly/lastSuccessfulBuild/artifact/build-docs/tf-m_documents/install/doc/user_guide/html/docs/user_guides/tf_fuzz/asset_dir.html
-
---------------
-
-*Copyright (c) 2019-2020, Arm Limited. All rights reserved.*
diff --git a/tools/tf_fuzz/assets/crypto_asset.cpp b/tools/tf_fuzz/assets/crypto_asset.cpp
deleted file mode 100644
index 7918a794a..000000000
--- a/tools/tf_fuzz/assets/crypto_asset.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#include "class_forwards.hpp"
-
-#include "boilerplate.hpp"
-#include "randomization.hpp"
-#include "gibberish.hpp"
-#include "compute.hpp"
-#include "data_blocks.hpp"
-#include "psa_asset.hpp"
-#include "find_or_create_asset.hpp"
-#include "template_line.hpp"
-#include "tf_fuzz.hpp"
-#include "crypto_asset.hpp"
-#include "psa_call.hpp"
-
-
-
-/**********************************************************************************
- Methods of class crypto_asset follow:
-**********************************************************************************/
-
-crypto_asset::crypto_asset (void) // (default constructor)
-{
- return; // just to have something to pin a breakpoint onto
-}
-
-
-crypto_asset::~crypto_asset (void) // (destructor)
-{
- return; // just to have something to pin a breakpoint onto
-}
-
-/**********************************************************************************
- End of methods of class crypto_asset.
-**********************************************************************************/
-
-
-/**********************************************************************************
- Methods of class policy_asset follow:
-**********************************************************************************/
-
-policy_asset::policy_asset (void) // (default constructor)
-{
- // Randomize key-policy usage and algorithm:
- policy_usage = rand_key_usage();
- policy_algorithm = rand_key_algorithm();
- // keys: Should automatically come up as empby.
-}
-
-
-policy_asset::~policy_asset (void) // (destructor)
-{
- return; // just to have something to pin a breakpoint onto
-}
-
-/**********************************************************************************
- End of methods of class policy_asset.
-**********************************************************************************/
-
-
-/**********************************************************************************
- Methods of class key_asset follow:
-**********************************************************************************/
-
-bool key_asset::set_key_id (int id_n)
-{
- key_id = id_n;
- return true;
-}
-
-
-key_asset::key_asset (void)
-{
- // Note: Similar random initialization for asset and template
- // Randomize handle:
- // TODO: Key handles appear to be a lot more complex a question than the below
- gibberish *gib = new gibberish;
- char buffer[256];
- char *end;
- int buf_len = 5ULL + (uint64_t) (rand() % 10);
- end = gib->word (false, buffer, buffer + buf_len);
- *end = '\0';
- buffer[buf_len] = '\0';
- handle_str = buffer;
- // Randomize key type:
- key_type = rand_key_type();
- // Randomize lifetime:
- lifetime_str = ((rand() % 2) == 1)?
- "PSA_KEY_LIFETIME_VOLATILE" : "PSA_KEY_LIFETIME_PERSISTENT";
-}
-
-
-key_asset::~key_asset (void)
-{
- return; // just to have something to pin a breakpoint onto
-}
-
-/**********************************************************************************
- End of methods of class key_asset.
-**********************************************************************************/
diff --git a/tools/tf_fuzz/assets/crypto_asset.hpp b/tools/tf_fuzz/assets/crypto_asset.hpp
deleted file mode 100644
index bcee450c4..000000000
--- a/tools/tf_fuzz/assets/crypto_asset.hpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#ifndef CRYPTO_ASSET_HPP
-#define CRYPTO_ASSET_HPP
-
-#include <string>
-#include <vector>
-#include <cstddef>
-#include <cstdint>
-
-
-/* This project's header files #including other project headers quickly becomes
- unrealistically complicated. The only solution is for each .cpp to include
- the headers it needs.
-#include "psa_asset.hpp"
-*/
-
-
-using namespace std;
-
-class crypto_asset : public psa_asset
-{
-public:
- // Data members:
- key_policy_info policy;
- // Methods:
- crypto_asset (void); // (constructor)
- ~crypto_asset (void);
-
-protected:
- // Data members:
- // Methods:
-
-private:
- // Data members:
- // Methods:
-};
-
-class policy_asset : public crypto_asset
-{
-public:
- // Data members:
- string policy_usage; // for now just strings; maybe future tap TF-M(?) value list
- string key_type; // DES, AES, RAW, vendor, none, etc.
- string policy_algorithm;
- vector<key_asset*> keys; // keys that use this policy
- // Methods:
- policy_asset (void); // (constructor)
- ~policy_asset (void);
-
-protected:
- // Data members:
- // Methods:
-
-private:
- // Data members:
- // Methods:
-};
-
-class key_asset : public crypto_asset
-{
-public:
- // Data members:
- vector<policy_asset*>::iterator the_policy_asset;
- /* The policy for this key. Note that psa_make_key() lets us create
- a key without associating a policy with it. In that case, this will
- be null, and the attributes below apply. Later, psa_set_key_policy
- lets us associate a policy with a key, at which point this becomes
- non-null and the following attributes no longer apply. */
- string key_type; // DES, AES, RAW, vendor, none, etc.
- string usage; // for now just strings; maybe future tap TF-M(?) value list
- string alg; // these only apply if the string was created without a policy
- string lifetime_str; // similarly, the text representation of the key's lifetime
- // Methods:
- bool set_key_id (int id_n); // checks key-ID value, returns true==success
- key_asset (void); // (constructor)
- ~key_asset (void);
-
-protected:
- // Data members:
- uint64_t key_id;
- // Methods:
-
-private:
- // Data members:
- // Methods:
-};
-
-#endif // CRYPTO_ASSET_HPP
diff --git a/tools/tf_fuzz/assets/psa_asset.cpp b/tools/tf_fuzz/assets/psa_asset.cpp
deleted file mode 100644
index 2c230e7dd..000000000
--- a/tools/tf_fuzz/assets/psa_asset.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#include "class_forwards.hpp"
-
-#include "boilerplate.hpp"
-#include "gibberish.hpp"
-#include "compute.hpp"
-#include "data_blocks.hpp"
-#include "psa_asset.hpp"
-#include "find_or_create_asset.hpp"
-#include "template_line.hpp"
-#include "tf_fuzz.hpp"
-#include "crypto_asset.hpp"
-#include "psa_call.hpp"
-
-
-/**********************************************************************************
- Methods of class psa_asset follow:
-**********************************************************************************/
-
-void psa_asset::set_name (string set_val)
-{
- asset_info.name_specified = true;
- asset_name.assign (set_val);
-}
-
-string psa_asset::get_name (void)
-{
- return asset_name;
-}
-
-bool psa_asset::simulate (void) {
- return false;
- // by default, assume that nothing changed; derived classes may override.
-}
-
-psa_asset::psa_asset (void) // (default constructor)
-{
- asset_info.asset_ser_no = unique_id_counter++;
-}
-
-
-psa_asset::~psa_asset (void)
-{
- return; // just to have something to pin a breakpoint onto
-}
-
-/**********************************************************************************
- End of methods of class psa_asset.
-**********************************************************************************/
diff --git a/tools/tf_fuzz/assets/psa_asset.hpp b/tools/tf_fuzz/assets/psa_asset.hpp
deleted file mode 100644
index 9eb4d3f51..000000000
--- a/tools/tf_fuzz/assets/psa_asset.hpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#ifndef PSA_ASSET_HPP
-#define PSA_ASSET_HPP
-
-#include <string>
-#include <vector>
-#include <cstdint>
-
-/* This project's header files #including other project headers quickly becomes
- unrealistically complicated. The only solution is for each .cpp to include
- the headers it needs. */
-
-using namespace std;
-
-class psa_asset
-{
-public:
- /* Data members -- not all PSA assets have all of these, but they need to be
- accessible polymorphically via a psa_asset iterator: */
- set_data_info set_data;
- /* For a PSA-asset tracker, this is really more about an asset's
- on-going, real-time asset data value than about *setting* its data
- value. On a template_line or a psa_call, it's about setting its
- value at one particular time. */
- expect_info exp_data;
- /* For now at least, this is here only for its n_exp_vars member, to
- keep track of how many expected-data variables in the test. */
- asset_name_id_info asset_info; // everything about the asset(s) for this line
- key_policy_info policy; // (specific to crypto, but have to put this here)
- vector<int> template_ref;
- // list of template line #s that reference this asset
- vector<psa_call> call_ref; // list of PSA calls that reference this asset
- string handle_str; // the text name of the key's "handle"
- bool asset_name_specified;
- /* true if the template specified the asset_name, as opposed to us
- having inferred it. */
- // Methods:
- void set_name (string set_val);
- string get_name (void);
- virtual bool simulate (void);
- /* simulate() tells this asset to react to its current state information.
- Initially, this won't really do much, but will allow assets to react
- to each other, if that is relevant. It returns true if anything
- in the state of the asset changed, in which case all assets' simulate()
- methods will be invoked again to react again. That will repeat until
- all assets read a quiescent state. */
- psa_asset(); // (constructor)
- ~psa_asset();
-
-protected:
- // Data members:
- // These are initially copied over from the call (or possibly template line):
- string data; // String describing current data value.
- string asset_name; // human-meaningful name
- static long unique_id_counter; // counts off unique IDs for assets
- // Methods:
-
-private:
- // Data members:
- // Methods:
-};
-
-#endif // PSA_ASSET_HPP
diff --git a/tools/tf_fuzz/assets/sst_asset.cpp b/tools/tf_fuzz/assets/sst_asset.cpp
deleted file mode 100644
index ac4de6f05..000000000
--- a/tools/tf_fuzz/assets/sst_asset.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#include "class_forwards.hpp"
-
-#include "boilerplate.hpp"
-#include "gibberish.hpp"
-#include "compute.hpp"
-#include "data_blocks.hpp"
-#include "psa_asset.hpp"
-#include "find_or_create_asset.hpp"
-#include "template_line.hpp"
-#include "tf_fuzz.hpp"
-#include "crypto_asset.hpp"
-#include "psa_call.hpp"
-#include "sst_asset.hpp"
-
-
-
-/**********************************************************************************
- Methods of class sst_asset follow:
-**********************************************************************************/
-
-bool sst_asset::set_uid (uint64_t uid)
-{
- /* TODO: What are the limits upon UIDs? I don't necessarily not want to be
- able to set an illegal value, but if it is illegal, I might want to
- set some flag appropriately to generate expected results. */
- asset_info.set_id_n (uid);
- return true;
-}
-
-sst_asset::sst_asset (void) // (default constructor)
-{
- return; // just to have something to pin a breakpoint onto
-}
-
-
-sst_asset::~sst_asset (void) // (destructor)
-{
- return; // just to have something to pin a breakpoint onto
-}
-
-/**********************************************************************************
- End of methods of class sst_asset.
-**********************************************************************************/
diff --git a/tools/tf_fuzz/assets/sst_asset.hpp b/tools/tf_fuzz/assets/sst_asset.hpp
deleted file mode 100644
index 0fbd5b8b1..000000000
--- a/tools/tf_fuzz/assets/sst_asset.hpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#ifndef SST_ASSET_HPP
-#define SST_ASSET_HPP
-
-#include <string>
-
-/* This project's header files #including other project headers quickly becomes
- unrealistically complicated. The only solution is for each .cpp to include
- the headers it needs.
-#include "psa_asset.hpp"
-*/
-
-
-using namespace std;
-
-class sst_asset : public psa_asset
-{
-public: // (low value in hiding these behind setters and getters)
- // Data members:
- // Methods:
- bool set_uid (uint64_t uid); // checks input UID value, returns true==success
- void set_literal_data (string literal_data);
- // if literal data, this sets both "data" string and "data_length"
- sst_asset (void); // (constructor)
- ~sst_asset (void);
-
-protected:
- // Data members:
- // Methods:
-
-private:
- // Data members:
- // Methods:
-};
-
-#endif // SST_ASSET_HPP
diff --git a/tools/tf_fuzz/boilerplate/README b/tools/tf_fuzz/boilerplate/README
deleted file mode 100644
index 60c78faa5..000000000
--- a/tools/tf_fuzz/boilerplate/README
+++ /dev/null
@@ -1,10 +0,0 @@
-These are the C++ code to work with the customizable, "boilerplate" code
-snippets in the .../lib directory.
-
-For more information, please browse to:
-
- https://ci.trustedfirmware.org/job/tf-m-build-test-nightly/lastSuccessfulBuild/artifact/build-docs/tf-m_documents/install/doc/user_guide/html/docs/user_guides/tf_fuzz/boilerplate_dir.html
-
---------------
-
-*Copyright (c) 2019-2020, Arm Limited. All rights reserved.*
diff --git a/tools/tf_fuzz/boilerplate/boilerplate.cpp b/tools/tf_fuzz/boilerplate/boilerplate.cpp
deleted file mode 100644
index 60deab7a4..000000000
--- a/tools/tf_fuzz/boilerplate/boilerplate.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#include "class_forwards.hpp"
-
-#include "boilerplate.hpp"
-#include "gibberish.hpp"
-#include "compute.hpp"
-#include "data_blocks.hpp"
-#include "psa_asset.hpp"
-#include "find_or_create_asset.hpp"
-#include "template_line.hpp"
-#include "tf_fuzz.hpp"
-#include "crypto_asset.hpp"
-#include "psa_call.hpp"
-
-/**********************************************************************************
- Methods of class boilerplate follow:
-**********************************************************************************/
-
-void env_var_usage (void)
-{
- cerr << "Example, for typical TF-M usage, using bash syntax:" << endl
- << " export TF_FUZZ_LIB_DIR=<path to TF-M installation>/tools/tf_fuzz/lib"
- << endl
- << " export TF_FUZZ_BPLATE=tfm_boilerplate.txt" << endl;
-}
-
-void boilerplate::stuff_boilerplate_strings (void)
-{
- ifstream boilerplate_lib;
- string file_name; // boilerplate file name
- string holder;
- // temp string, e.g., holder for strings read from the boilerplate file
-
- /* User must point the environment variable $TF_FUZZ_BPLATE to the boilerplate
- file s/he wants to use, within a directory named by $TF_FUZZ_LIB_DIR. */
- string bpStringL, bpStringF;
- char *bpLibDir = getenv ("TF_FUZZ_LIB_DIR");
- if (bpLibDir == NULL) {
- cerr << "Error: Please point environment variable $TF_FUZZ_LIB_DIR to "
- << "TF-Fuzz's library directory." << endl;
- env_var_usage();
- exit (701);
- }
- bpStringL = bpLibDir;
- char *bpFName = getenv ("TF_FUZZ_BPLATE");
- if (bpFName == NULL) {
- cerr << "Error: Please set environment variable $TF_FUZZ_BPLATE to name the "
- << "\"boilerplate\" text-library file." << endl;
- env_var_usage();
- exit (702);
- }
- bpStringF = bpFName;
- file_name.assign (bpStringL + "/" + bpStringF);
- boilerplate_lib.open (file_name);
- if (!boilerplate_lib.is_open()) {
- cerr << "\nError: Unable to open boilerplate text-library file, at path "
- << file_name << "." << endl;
- env_var_usage();
- exit(200);
- }
-
- // Read the strings into the boilerplate vector:
- getline (boilerplate_lib, holder, '`');
- /* This first one is "not real." It's a README, in essence, explaining the
- library-text file, so skip past it. */
- for (int i = preamble_A; i < n_boilerplate_texts; i++) {
- if (!getline (boilerplate_lib, holder, '`')) {
- cerr << "\nError: Unable to read from boilerplate text-library file, at path "
- << file_name << "." << endl;
- cerr << " Please make sure the file is not empty." << endl;
- env_var_usage();
- exit(851);
- }
- if (holder.length() < 5) {
- cerr << "\nError: Read from boilerplate text-library file, at path "
- << file_name << ", was too short." << endl;
- cerr << " Please make sure the file has not been damaged "
- << "from the TF-Fuzz distribution." << endl;
- env_var_usage();
- exit(852);
- }
- // Shave off the three-character tag + \n from the front of the string:
- holder.erase(0, 4);
- bplate_string.push_back(holder);
- }
- boilerplate_lib.close();
-}
-
-boilerplate::boilerplate (void) {
- stuff_boilerplate_strings();
-}
-
-/**********************************************************************************
- End of methods of class boilerplate.
-**********************************************************************************/
diff --git a/tools/tf_fuzz/boilerplate/boilerplate.hpp b/tools/tf_fuzz/boilerplate/boilerplate.hpp
deleted file mode 100644
index 4bbf651c2..000000000
--- a/tools/tf_fuzz/boilerplate/boilerplate.hpp
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-/* boilerplate.*pp contains class(es) to read and store customizable code
- fragments used in realizing the pieces of a test. It's critical that
- these be customizable in external library files, so that TF-Fuzz can
- exercise TF-A as well as TF-M. Each TF-x has its own library of text
- pieces, which are read into these data structures upon program initial-
- ization. */
-
-#ifndef BOILERPLATE_HPP
-#define BOILERPLATE_HPP
-
-#include <iostream>
-#include <fstream>
-#include <string>
-#include <vector>
-
-
-using namespace std;
-
-// Constant mnemonics for entries in array of boilerplate texts:
-const int
- // Stuff around the test itself:
- preamble_A = 0, // setup stuff before PSA calls begin
- /* Strings to be substituted from template:
- $purpose: The purpose of the test */
- hashing_code = 1, // code to perform a simple hash of asset data
- /* Strings to be substituted from template: (none) */
- preamble_B = 2, // setup stuff before PSA calls begin
- /* Strings to be substituted from template:
- $purpose: The purpose of the test */
- preamble_C = 3, // setup stuff before PSA calls begin
- /* Strings to be substituted from template:
- $purpose: The purpose of the test */
- declare_int = 4, // declaration for an int
- /* Strings to be substituted from template:
- $var: The integer thing to declare
- $init: Its initialization */
- declare_string = 5, // declaration for a string
- /* Strings to be substituted from template:
- $var: The string variable to declare
- $init: Its initialization */
- declare_big_string = 6, // declaration for a string, sized large
- /* Strings to be substituted from template:
- $var: The string variable to declare
- $init: Its initialization */
- declare_size_t = 7, // declaration for a size_t
- /* Strings to be substituted from template:
- $var: The integer thing to declare
- $init: Its initialization */
- declare_policy = 8, // declaration for a policy (key attributes)
- /* Strings to be substituted from template:
- $var: The variable to declare */
- declare_policy_algorithm = 9, // declaration for a
- /* Strings to be substituted from template:
- $var: The variable to declare */
- declare_policy_lifetime = 10, // declaration for a
- /* Strings to be substituted from template:
- $var: The variable to declare */
- declare_policy_type = 11, // declaration for a
- /* Strings to be substituted from template:
- $var: The variable to declare */
- declare_policy_usage = 12, // declaration for a
- /* Strings to be substituted from template:
- $var: The variable to declare */
- declare_key = 13, // declaration for a
- /* Strings to be substituted from template:
- $var: The variable to declare */
- declare_generic = 14, // declaration for a some other type
- /* Strings to be substituted from template:
- $type: The type to declare the variable to
- $var: The string variable to declare
- $init: Its initialization */
- test_log = 15, // print a message to the test log
- /* Strings to be substituted from template:
- $message: What to print. */
- teardown_sst = 16, // call to delete SST resources after test completes
- /* Strings to be substituted from template:
- $uid: (Exactly that) */
- teardown_sst_check = 17, // boilerplate code to check success of previous;
- /* No strings to be substituted from template */
- teardown_key = 18, // call to delete crypto keys after test completes
- /* Strings to be substituted from template:
- $handle: The handle to the key */
- teardown_key_check = 19, // boilerplate code to check success of previous;
- /* No strings to be substituted from template */
- closeout = 20, // final code to close out the test.
- // No strings to substitute.
- sst_pass_string = 21, // passing SST expected result
- sst_fail_removed = 22, // SST expected result from having deleted the asset
- // SST calls:
- set_sst_call = 23, // boilerplate for setting up an SST asset;
- /* Strings to be substituted from template:
- $op: (for comment) either "Creating" or "Resetting"
- $description: its "human name" if given, or "UID=..." if not
- $data_source: either first ~10 chars of data or file path
- $uid: (Exactly that)
- $length: Data length
- $data: Pointer to data (C string)
- $flags: SST-asset creation flags */
- set_sst_check = 24, // boilerplate code to check success of previous;
- /* Strings to be substituted from template:
- $expect: Expected return status string */
- get_sst_call = 25, // boilerplate for retrieving data from an SST asset;
- /* Strings to be substituted from template:
- $uid: (Exactly that)
- $offset: Start positon in the "file" TO DO: ADD OFFSET
- $length: Data length
- $act_data: Pointer to actual data (C string) */
- get_sst_check = 26, // boilerplate code to check call result only;
- /* Strings to be substituted from template:
- $expect: Expected return status string */
- get_sst_check_all = 27, // boilerplate code to check call result and data;
- /* Strings to be substituted from template:
- $expect: Expected return status
- $exp_data: Expected read data
- $act_data: Actual read data
- $length: Data length */
- get_sst_hash = 28, // boilerplate code to invoke hasher;
- /* Strings to be substituted from template:
- $act_data_var: Actual read data, to be hashed
- $hash_var: Hash-result variable */
- remove_sst = 29, // boilerplate for removing an SST asset;
- /* Strings to be substituted from template:
- $uid: (Exactly that) */
- remove_sst_check = 30, // boilerplate code to check success of previous;
- /* Strings to be substituted from template:
- $expect: Expected return status */
- // Crypto-key-policy calls:
- init_policy = 31, // initialize a policy (key attributes);
- /* Strings to be substituted from template:
- $policy: The name of the policy */
- reset_policy = 32, // reset a policy (key attributes);
- /* Strings to be substituted from template:
- $policy: The name of the policy */
- add_policy_usage = 33, // add a usage flag to a policy;
- /* Strings to be substituted from template:
- $policy: The name of the policy
- $flag: usage-flag name */
- set_policy_lifetime = 34,
- /* Strings to be substituted from template:
- $policy: The name of the policy
- $life: Lifetime -- volatile or persistent */
- set_policy_size = 35,
- /* Strings to be substituted from template:
- $policy: The name of the policy
- $size: The key size, in bits */
- set_policy_type = 36,
- /* Strings to be substituted from template:
- $policy: The name of the policy
- $type: The key type -- RSA pair, AES, etc. */
- set_policy_algorithm = 37,
- /* Strings to be substituted from template:
- $policy: The name of the policy
- $algorithm: The algorithm -- AEAD, sign, hash mask, etc. */
- set_policy_usage = 38,
- /* Strings to be substituted from template:
- $policy: The name of the policy
- $usage: The usage -- encrypt, decrypt, export, copy, etc. */
- get_policy_lifetime = 39,
- /* Strings to be substituted from template:
- $policy: The name of the policy
- $life: Lifetime -- volatile or persistent */
- get_policy_lifetime_print = 40,
- /* Strings to be substituted from template:
- $policy: The name of the policy
- $life: Lifetime -- volatile or persistent */
- get_policy_size = 41,
- /* Strings to be substituted from template:
- $policy: The name of the policy
- $size: The key size, in bits */
- get_policy_type = 42,
- /* Strings to be substituted from template:
- $policy: The name of the policy
- $type: The key type -- RSA pair, AES, etc. */
- get_policy_type_print = 43,
- /* Strings to be substituted from template:
- $policy: The name of the policy
- $type: The key type -- RSA pair, AES, etc. */
- get_policy_algorithm = 44,
- /* Strings to be substituted from template:
- $policy: The name of the policy
- $algorithm: The algorithm -- AEAD, sign, hash mask, etc. */
- get_policy_algorithm_print = 45,
- /* Strings to be substituted from template:
- $policy: The name of the policy
- $algorithm: The algorithm -- AEAD, sign, hash mask, etc. */
- get_policy_usage = 46,
- /* Strings to be substituted from template:
- $policy: The name of the policy
- $usage: The usage -- encrypt, decrypt, export, copy, etc. */
- print_policy_usage = 47,
- /* Strings to be substituted from template:
- $policy: The name of the policy
- $usage: The usage -- encrypt, decrypt, export, copy, etc. */
- get_policy = 48, // read the policy from a key;
- /* Strings to be substituted from template:
- $key: The key whose policy we want to read
- $policy: The policy variable to read into */
- get_policy_check = 49, // success check fpr previous;
- /* Strings to be substituted from template:
- $expect: Expected return status */
- // Crypto-key-related calls:
- generate_key = 50, // generate key from scratch;
- /* Strings to be substituted from template:
- $key: The key to generate
- $policy: The name of the policy */
- generate_key_check = 51, // success check for previous;
- /* Strings to be substituted from template:
- $expect: Expected return status */
- create_key = 52, // Create key from policy and key data;
- /* Strings to be substituted from template:
- $policy: The name of the policy
- $data: The key data
- $length: The key-data length -- sizeof() */
- create_key_check = 53, // success check for previous;
- /* Strings to be substituted from template:
- $expect: Expected return status */
- copy_key = 54, // Copy key data from one key to another; different policy;
- /* Strings to be substituted from template:
- $master: The source key-handle variable
- $policy: The name of the policy
- $copy: The copy key-handle variable */
- copy_key_check = 55, // success check for previous;
- /* Strings to be substituted from template:
- $expect: Expected return status */
- compare_data = 56, // compare data blocks, such as key data
- /* Strings to be substituted from template:
- $exp_data: Expected read data
- $act_data: Actual read data
- $length: Data length */
- read_key_data = 57, // read key data;
- /* Strings to be substituted from template:
- $key: The key to read
- $data: Where to put the data
- $length: Length of the data buffer
- $act_size: The actual size of the key data retrieved */
- read_key_data_check = 58, // success check for previous;
- /* Strings to be substituted from template:
- $expect: Expected return status */
- remove_key = 59, // boilerplate for creating a key;
- /* Strings to be substituted from template:
- $handle: The handle to the key */
- remove_key_check = 60, // boilerplate code to check success of previous;
- /* Strings to be substituted from template:
- $expect: Expected return status */
- // Just an anchor at the end, for sizing the string array (if needed):
- n_boilerplate_texts = 61;
-
-
-class boilerplate
-{
-public: // (More pain than it's worth to create getters and setters)
- // Data members:
- vector<string> bplate_string;
- string cpp_string; // used to stuff bplate_string
- // Methods:
- void stuff_boilerplate_strings (void);
- boilerplate (void);
-};
-
-
-#endif // #ifndef BOILERPLATE_HPP
diff --git a/tools/tf_fuzz/calls/README b/tools/tf_fuzz/calls/README
deleted file mode 100644
index c57499e43..000000000
--- a/tools/tf_fuzz/calls/README
+++ /dev/null
@@ -1,10 +0,0 @@
-These classes define objects that describe everything needed to generate a PSA
-call.
-
-For more information, please browse to:
-
- https://ci.trustedfirmware.org/job/tf-m-build-test-nightly/lastSuccessfulBuild/artifact/build-docs/tf-m_documents/install/doc/user_guide/html/docs/user_guides/tf_fuzz/calls_dir.html
-
---------------
-
-*Copyright (c) 2019-2020, Arm Limited. All rights reserved.*
diff --git a/tools/tf_fuzz/calls/crypto_call.cpp b/tools/tf_fuzz/calls/crypto_call.cpp
deleted file mode 100644
index 85d7ac055..000000000
--- a/tools/tf_fuzz/calls/crypto_call.cpp
+++ /dev/null
@@ -1,1385 +0,0 @@
-/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#include <cstdlib>
-
-#include "class_forwards.hpp"
-
-#include "boilerplate.hpp"
-#include "variables.hpp"
-#include "gibberish.hpp"
-#include "compute.hpp"
-#include "randomization.hpp"
-#include "string_ops.hpp"
-#include "data_blocks.hpp"
-#include "psa_asset.hpp"
-#include "find_or_create_asset.hpp"
-#include "template_line.hpp"
-#include "tf_fuzz.hpp"
-#include "crypto_asset.hpp"
-#include "psa_call.hpp"
-#include "crypto_call.hpp"
-#include "sst_asset.hpp"
-
-
-/**********************************************************************************
- Methods of class policy_call follow:
-**********************************************************************************/
-
-/* Most of the policy classes, in their fill_in_prep_code() method, need to ensure
- that, at a minimum, the policy variable (psa_key_attributes_t) exists, so, just
- to cut down code duplication: */
-void policy_call::policy_fill_in_prep_code (void)
-{
- vector<variable_info>::iterator policy_variable;
-
- policy_variable = test_state->find_var (asset_info.get_name());
- if (policy_variable == test_state->variable.end()) {
- // No such variable exists, so:
- test_state->make_var (asset_info.get_name());
- policy_variable = test_state->find_var (asset_info.get_name());
- prep_code.assign (test_state->bplate->bplate_string[declare_policy]);
- find_replace_1st ("$var", asset_info.get_name(), prep_code);
- }
-}
-
-
-policy_call::policy_call (tf_fuzz_info *test_state, // (constructor)
- long &call_ser_no,
- asset_search how_asset_found)
- : crypto_call(test_state, call_ser_no, how_asset_found)
-{
- // Note: Key attributes are set in the key_policy_info constructor.
-}
-policy_call::~policy_call (void)
-{
- // Nothing further to delete.
- return; // just to have something to pin a breakpoint onto
-}
-
-vector<psa_asset*>::iterator policy_call::resolve_asset (bool create_asset_bool,
- psa_asset_usage where) {
- vector<psa_asset*>::iterator found_asset;
- vector<psa_asset*> *asset_vector;
- int asset_pick;
-
- if (random_asset != psa_asset_usage::all) {
- // != psa_asset_usage::all means to choose some known asset at random:
- if (random_asset == psa_asset_usage::active) {
- asset_vector = &(test_state->active_policy_asset);
- asset_info.how_asset_found = asset_search::found_active;
- } else if (random_asset == psa_asset_usage::deleted) {
- asset_vector = &(test_state->deleted_policy_asset);
- asset_info.how_asset_found = asset_search::found_deleted;
- } else {
- // "invalid" assets are not currently used.
- cerr << "\nError: Tool-internal: Please report error 1102 to " << endl
- << "TF-Fuzz developers."
- << endl;
- exit(1102);
- }
- if (asset_vector->size() > 0) {
- /* Pick an active or deleted asset at random: */
- asset_pick = rand() % asset_vector->size();
- found_asset = asset_vector->begin() + asset_pick;
- /* Copy asset information into template tracker: */
- asset_info.id_n = (*found_asset)->asset_info.id_n;
- asset_info.asset_ser_no
- = (*found_asset)->asset_info.asset_ser_no;
- } else {
- if (random_asset == psa_asset_usage::active) {
- cerr << "\nError: A policy call asks for a "
- << "randomly chosen active asset, when none " << endl
- << "is currently defined." << endl;
- exit(1010);
- } else if (random_asset == psa_asset_usage::deleted) {
- cerr << "\nError: A policy call asks for a "
- << "randomly chosen deleted asset, when none " << endl
- << "is currently defined." << endl;
- exit(1011);
- } // "invalid" assets are not currently used.
- }
- } else {
- // Find the asset by name:
- asset_info.how_asset_found = test_state->find_or_create_policy_asset (
- psa_asset_search::name, where,
- asset_info.get_name(), 0, asset_info.asset_ser_no,
- create_asset_bool, found_asset );
- if ( asset_info.how_asset_found == asset_search::unsuccessful
- || asset_info.how_asset_found == asset_search::something_wrong ) {
- cerr << "\nError: Tool-internal: Please report error 108 to " << endl
- << "TF-Fuzz developers."
- << endl;
- exit(108);
- }
- }
- return found_asset;
-}
-
-/**********************************************************************************
- End of methods of class policy_call.
-**********************************************************************************/
-
-
-/**********************************************************************************
- Methods of class key_call follow:
-**********************************************************************************/
-
-key_call::key_call (tf_fuzz_info *test_state, // (constructor)
- long &call_ser_no,
- asset_search how_asset_found)
- : crypto_call(test_state, call_ser_no, how_asset_found)
-{
- asset_info.the_asset = nullptr;
-}
-key_call::~key_call (void)
-{
- // Nothing further to delete.
- return; // just to have something to pin a breakpoint onto
-}
-
-vector<psa_asset*>::iterator key_call::resolve_asset (bool create_asset_bool,
- psa_asset_usage where) {
- vector<psa_asset*>::iterator found_asset;
- vector<psa_asset*> *asset_vector;
- int asset_pick;
-
- if (random_asset != psa_asset_usage::all) {
- // != psa_asset_usage::all means to choose some known asset at random:
- if (random_asset == psa_asset_usage::active) {
- asset_vector = &(test_state->active_key_asset);
- asset_info.how_asset_found = asset_search::found_active;
- } else if (random_asset == psa_asset_usage::deleted) {
- asset_vector = &(test_state->deleted_key_asset);
- asset_info.how_asset_found = asset_search::found_deleted;
- } else {
- // "invalid" assets are not currently used.
- cerr << "\nError: Tool-internal: Please report error 1103 to " << endl
- << "TF-Fuzz developers."
- << endl;
- exit(1103);
- }
- if (asset_vector->size() > 0) {
- /* Pick an active or deleted asset at random: */
- asset_pick = rand() % asset_vector->size();
- found_asset = asset_vector->begin() + asset_pick;
- /* Copy asset information into template tracker: */
- asset_info.id_n = (*found_asset)->asset_info.id_n;
- asset_info.asset_ser_no
- = (*found_asset)->asset_info.asset_ser_no;
- } else {
- if (random_asset == psa_asset_usage::active) {
- cerr << "\nError: A key call asks for a "
- << "randomly chosen active asset, when none " << endl
- << "is currently defined." << endl;
- exit(1012);
- } else if (random_asset == psa_asset_usage::deleted) {
- cerr << "\nError: A key call asks for a "
- << "randomly chosen deleted asset, when none " << endl
- << "is currently defined." << endl;
- exit(1013);
- } // "invalid" assets are not currently used.
- }
- } else {
- // Find the asset by name:
- asset_info.how_asset_found = test_state->find_or_create_key_asset (
- psa_asset_search::name, where,
- asset_info.get_name(), 0, asset_info.asset_ser_no,
- create_asset_bool, found_asset );
- if ( asset_info.how_asset_found == asset_search::unsuccessful
- || asset_info.how_asset_found == asset_search::something_wrong ) {
- cerr << "\nError: Tool-internal: Please report error 108 to " << endl
- << "TF-Fuzz developers."
- << endl;
- exit(108);
- }
- }
- return found_asset;
-}
-
-/**********************************************************************************
- End of methods of class key_call.
-**********************************************************************************/
-
-
-/**********************************************************************************
- Methods of class init_policy_call follow:
-**********************************************************************************/
-
-init_policy_call::init_policy_call (tf_fuzz_info *test_state, // (constructor)
- long &call_ser_no,
- asset_search how_asset_found)
- : policy_call(test_state, call_ser_no,
- how_asset_found)
-{
- // Copy the boilerplate text into local buffers:
- prep_code.assign ("");
- call_code.assign (test_state->bplate->bplate_string[init_policy]);
- call_description = "initialize-policy call";
-}
-init_policy_call::~init_policy_call (void)
-{
- return; // just to have something to pin a breakpoint onto
-}
-
-bool init_policy_call::copy_call_to_asset (void)
-{
- return copy_call_to_asset_t<policy_asset*> (this, yes_create_asset);
-}
-
-void init_policy_call::fill_in_prep_code (void)
-{
- policy_fill_in_prep_code();
-}
-
-void init_policy_call::fill_in_command (void)
-{
- // (call_code already loaded by constructor)
- find_replace_all ("$policy", asset_info.get_name(), call_code);
- // Calculate the expected results:
- calc_result_code();
-}
-
-/**********************************************************************************
- End of methods of class init_policy_call.
-**********************************************************************************/
-
-
-/**********************************************************************************
- Methods of class reset_policy_call follow:
-**********************************************************************************/
-
-reset_policy_call::reset_policy_call (tf_fuzz_info *test_state, // (constructor)
- long &call_ser_no,
- asset_search how_asset_found)
- : policy_call(test_state, call_ser_no,
- how_asset_found)
-{
- // Copy the boilerplate text into local buffers:
- prep_code.assign ("");
- call_code.assign (test_state->bplate->bplate_string[reset_policy]);
- call_description = "policy reset call";
-}
-reset_policy_call::~reset_policy_call (void)
-{
- return; // just to have something to pin a breakpoint onto
-}
-
-bool reset_policy_call::copy_call_to_asset (void)
-{
- return copy_call_to_asset_t<policy_asset*> (this, yes_create_asset);
-}
-
-void reset_policy_call::fill_in_prep_code (void)
-{
- policy_fill_in_prep_code();
-}
-
-void reset_policy_call::fill_in_command (void)
-{
- // (call_code already loaded by constructor)
- find_replace_all ("$policy", asset_info.get_name(), call_code);
- // Calculate the expected results:
- calc_result_code();
-}
-
-/**********************************************************************************
- End of methods of class reset_policy_call.
-**********************************************************************************/
-
-
-/**********************************************************************************
- Methods of class add_policy_usage_call follow:
-**********************************************************************************/
-
-add_policy_usage_call::add_policy_usage_call (tf_fuzz_info *test_state, // (constructor)
- long &call_ser_no,
- asset_search how_asset_found)
- : policy_call(test_state, call_ser_no,
- how_asset_found)
-{
- // Copy the boilerplate text into local buffers:
- prep_code.assign ("");
- call_code.assign (test_state->bplate->bplate_string[add_policy_usage]);
- call_description = "policy add-usage call";
-}
-add_policy_usage_call::~add_policy_usage_call (void)
-{
- return; // just to have something to pin a breakpoint onto
-}
-
-bool add_policy_usage_call::copy_call_to_asset (void)
-{
- return copy_call_to_asset_t<policy_asset*> (this, yes_create_asset);
-}
-
-void add_policy_usage_call::fill_in_prep_code (void)
-{
- policy_fill_in_prep_code();
- /* TODO: The variable this creates should have been declared already. Should
- this instead produce an error if it doesn't exist? */
-}
-
-void add_policy_usage_call::fill_in_command (void)
-{
- // (call_code already loaded by constructor)
- find_replace_all ("$policy", asset_info.get_name(), call_code);
- find_replace_1st ("$flag", policy.usage_string, call_code);
- // Calculate the expected results:
- calc_result_code();
-}
-
-/**********************************************************************************
- End of methods of class add_policy_usage_call.
-**********************************************************************************/
-
-
-/**********************************************************************************
- Methods of class set_policy_lifetime_call follow:
-**********************************************************************************/
-
-set_policy_lifetime_call::set_policy_lifetime_call (tf_fuzz_info *test_state,
- long &call_ser_no, // (constructor)
- asset_search how_asset_found)
- : policy_call(test_state, call_ser_no,
- how_asset_found)
-{
- // Copy the boilerplate text into local buffers:
- prep_code.assign ("");
- call_code.assign (test_state->bplate->bplate_string[set_policy_lifetime]);
- call_description = "policy lifetime-set call";
-}
-set_policy_lifetime_call::~set_policy_lifetime_call (void)
-{
- return; // just to have something to pin a breakpoint onto
-}
-
-bool set_policy_lifetime_call::copy_call_to_asset (void)
-{
- return copy_call_to_asset_t<policy_asset*> (this, yes_create_asset);
-}
-
-void set_policy_lifetime_call::fill_in_prep_code (void)
-{
- policy_fill_in_prep_code();
-}
-
-void set_policy_lifetime_call::fill_in_command (void)
-{
- // (call_code already loaded by constructor)
- find_replace_all ("$policy", asset_info.get_name(), call_code);
- find_replace_1st ("$life",
- policy.persistent? "PSA_KEY_LIFETIME_PERSISTENT"
- : "PSA_KEY_LIFETIME_VOLATILE",
- call_code);
- // Calculate the expected results:
- calc_result_code();
-}
-
-/**********************************************************************************
- End of methods of class set_policy_lifetime_call.
-**********************************************************************************/
-
-
-/**********************************************************************************
- Methods of class set_policy_size_call follow:
-**********************************************************************************/
-
-set_policy_size_call::set_policy_size_call (tf_fuzz_info *test_state, // (constructor)
- long &call_ser_no,
- asset_search how_asset_found)
- : policy_call(test_state, call_ser_no,
- how_asset_found)
-{
- // Copy the boilerplate text into local buffers:
- prep_code.assign ("");
- call_code.assign (test_state->bplate->bplate_string[set_policy_size]);
- call_description = "policy size-set call";
-}
-set_policy_size_call::~set_policy_size_call (void)
-{
- return; // just to have something to pin a breakpoint onto
-}
-
-bool set_policy_size_call::copy_call_to_asset (void)
-{
- return copy_call_to_asset_t<policy_asset*> (this, yes_create_asset);
-}
-
-void set_policy_size_call::fill_in_prep_code (void)
-{
- policy_fill_in_prep_code();
-}
-
-void set_policy_size_call::fill_in_command (void)
-{
- // (call_code already loaded by constructor)
- find_replace_all ("$policy", asset_info.get_name(), call_code);
- find_replace_1st ("$size", to_string (policy.n_bits), call_code);
- // Calculate the expected results:
- calc_result_code();
-}
-
-/**********************************************************************************
- End of methods of class set_policy_size_call.
-**********************************************************************************/
-
-
-/**********************************************************************************
- Methods of class set_policy_type_call follow:
-**********************************************************************************/
-
-set_policy_type_call::set_policy_type_call (tf_fuzz_info *test_state, // (constructor)
- long &call_ser_no,
- asset_search how_asset_found)
- : policy_call(test_state, call_ser_no,
- how_asset_found)
-{
- // Copy the boilerplate text into local buffers:
- prep_code.assign ("");
- call_code.assign (test_state->bplate->bplate_string[set_policy_type]);
- call_description = "policy type-set call";
-}
-set_policy_type_call::~set_policy_type_call (void)
-{
- return; // just to have something to pin a breakpoint onto
-}
-
-bool set_policy_type_call::copy_call_to_asset (void)
-{
- return copy_call_to_asset_t<policy_asset*> (this, yes_create_asset);
-}
-
-void set_policy_type_call::fill_in_prep_code (void)
-{
- policy_fill_in_prep_code();
-}
-
-void set_policy_type_call::fill_in_command (void)
-{
- // (call_code already loaded by constructor)
- find_replace_all ("$policy", asset_info.get_name(), call_code);
- find_replace_1st ("$type", policy.key_type, call_code);
- // Calculate the expected results:
- calc_result_code();
-}
-
-/**********************************************************************************
- End of methods of class set_policy_type_call.
-**********************************************************************************/
-
-
-/**********************************************************************************
- Methods of class set_policy_algorithm_call follow:
-**********************************************************************************/
-
-set_policy_algorithm_call::set_policy_algorithm_call (tf_fuzz_info *test_state,
- long &call_ser_no, // (constructor)
- asset_search how_asset_found)
- : policy_call(test_state, call_ser_no,
- how_asset_found)
-{
- // Copy the boilerplate text into local buffers:
- prep_code.assign ("");
- call_code.assign (test_state->bplate->bplate_string[set_policy_algorithm]);
- call_description = "policy algorithm-set call";
-}
-set_policy_algorithm_call::~set_policy_algorithm_call (void)
-{
- return; // just to have something to pin a breakpoint onto
-}
-
-bool set_policy_algorithm_call::copy_call_to_asset (void)
-{
- return copy_call_to_asset_t<policy_asset*> (this, yes_create_asset);
-}
-
-void set_policy_algorithm_call::fill_in_prep_code (void)
-{
- policy_fill_in_prep_code();
-}
-
-void set_policy_algorithm_call::fill_in_command (void)
-{
- // (call_code already loaded by constructor)
- find_replace_all ("$policy", asset_info.get_name(), call_code);
- find_replace_1st ("$algorithm", policy.key_algorithm, call_code);
- // Calculate the expected results:
- calc_result_code();
-}
-
-/**********************************************************************************
- End of methods of class set_policy_algorithm_call.
-**********************************************************************************/
-
-
-/**********************************************************************************
- Methods of class set_policy_usage_call follow:
-**********************************************************************************/
-
-set_policy_usage_call::set_policy_usage_call (tf_fuzz_info *test_state, // (constructor)
- long &call_ser_no,
- asset_search how_asset_found)
- : policy_call(test_state, call_ser_no,
- how_asset_found)
-{
- // Copy the boilerplate text into local buffers:
- prep_code.assign ("");
- call_code.assign (test_state->bplate->bplate_string[set_policy_usage]);
- call_description = "policy usage-set call";
-}
-set_policy_usage_call::~set_policy_usage_call (void)
-{
- return; // just to have something to pin a breakpoint onto
-}
-
-bool set_policy_usage_call::copy_call_to_asset (void)
-{
- return copy_call_to_asset_t<policy_asset*> (this, yes_create_asset);
-}
-
-void set_policy_usage_call::fill_in_prep_code (void)
-{
- policy_fill_in_prep_code();
-}
-
-void set_policy_usage_call::fill_in_command (void)
-{
- find_replace_1st ("$policy", asset_info.get_name(), call_code);
- find_replace_1st ("$usage", "0", call_code);
- // Calculate the expected results:
- calc_result_code();
-}
-
-/**********************************************************************************
- End of methods of class set_policy_usage_call.
-**********************************************************************************/
-
-
-/**********************************************************************************
- Methods of class get_policy_lifetime_call follow:
-**********************************************************************************/
-
-get_policy_lifetime_call::get_policy_lifetime_call (tf_fuzz_info *test_state,
- long &call_ser_no, // (constructor)
- asset_search how_asset_found)
- : policy_call(test_state, call_ser_no,
- how_asset_found)
-{
- // Copy the boilerplate text into local buffers:
- prep_code.assign ("");
- call_code.assign (test_state->bplate->bplate_string[get_policy_lifetime]);
- call_description = "policy lifetime-get call";
-}
-get_policy_lifetime_call::~get_policy_lifetime_call (void)
-{
- return; // just to have something to pin a breakpoint onto
-}
-
-bool get_policy_lifetime_call::copy_call_to_asset (void)
-{
- return copy_call_to_asset_t<policy_asset*> (this, dont_create_asset);
-}
-
-void get_policy_lifetime_call::fill_in_prep_code (void)
-{
- string var_name = asset_info.get_name() + "_life";
- vector<variable_info>::iterator assign_variable;
-
- policy_fill_in_prep_code(); // make sure the policy variable itself is defined
- assign_variable = test_state->find_var (var_name);
- if (assign_variable == test_state->variable.end()) {
- // No such variable exists, so:
- test_state->make_var (var_name);
- prep_code.append (test_state->bplate->bplate_string[declare_policy_lifetime]);
- find_replace_all ("$var", var_name, prep_code);
- }
-}
-
-void get_policy_lifetime_call::fill_in_command (void)
-{
- // (call_code already loaded by constructor)
- find_replace_all ("$policy", asset_info.get_name(), call_code);
- find_replace_1st ("$life", asset_info.get_name() + "_life", call_code);
- // Calculate the expected results:
- calc_result_code();
-}
-
-/**********************************************************************************
- End of methods of class get_policy_lifetime_call.
-**********************************************************************************/
-
-
-/**********************************************************************************
- Methods of class get_policy_size_call follow:
-**********************************************************************************/
-
-get_policy_size_call::get_policy_size_call (tf_fuzz_info *test_state,
- long &call_ser_no, // (constructor)
- asset_search how_asset_found)
- : policy_call(test_state, call_ser_no,
- how_asset_found)
-{
- // Copy the boilerplate text into local buffers:
- prep_code.assign ("");
- call_code.assign (test_state->bplate->bplate_string[get_policy_size]);
- call_description = "policy size-get call";
-}
-get_policy_size_call::~get_policy_size_call (void)
-{
- return; // just to have something to pin a breakpoint onto
-}
-
-bool get_policy_size_call::copy_call_to_asset (void)
-{
- return copy_call_to_asset_t<policy_asset*> (this, dont_create_asset);
-}
-
-void get_policy_size_call::fill_in_prep_code (void)
-{
- string var_name = asset_info.get_name() + "_size";
- vector<variable_info>::iterator assign_variable;
-
- policy_fill_in_prep_code(); // make sure the policy variable itself is defined
- assign_variable = test_state->find_var (var_name);
- if (assign_variable == test_state->variable.end()) {
- // No such variable exists, so:
- test_state->make_var (var_name);
- prep_code.append (test_state->bplate->bplate_string[declare_size_t]);
- find_replace_all ("$var", var_name, prep_code);
- find_replace_1st ("$init", to_string(exp_data.data.length()), prep_code);
- }
-}
-
-void get_policy_size_call::fill_in_command (void)
-{
- // (call_code already loaded by constructor)
- find_replace_all ("$policy", asset_info.get_name(), call_code);
- find_replace_1st ("$size", asset_info.get_name() + "_size", call_code);
- // Calculate the expected results:
- calc_result_code();
-}
-
-/**********************************************************************************
- End of methods of class get_policy_size_call.
-**********************************************************************************/
-
-
-/**********************************************************************************
- Methods of class get_policy_type_call follow:
-**********************************************************************************/
-
-get_policy_type_call::get_policy_type_call (tf_fuzz_info *test_state,
- long &call_ser_no, // (constructor)
- asset_search how_asset_found)
- : policy_call(test_state, call_ser_no,
- how_asset_found)
-{
- // Copy the boilerplate text into local buffers:
- prep_code.assign ("");
- call_code.assign (test_state->bplate->bplate_string[get_policy_type]);
- call_description = "policy type-get call";
-}
-get_policy_type_call::~get_policy_type_call (void)
-{
- return; // just to have something to pin a breakpoint onto
-}
-
-bool get_policy_type_call::copy_call_to_asset (void)
-{
- return copy_call_to_asset_t<policy_asset*> (this, dont_create_asset);
-}
-
-void get_policy_type_call::fill_in_prep_code (void)
-{
- string var_name = asset_info.get_name() + "_type";
- vector<variable_info>::iterator assign_variable;
-
- policy_fill_in_prep_code(); // make sure the policy variable itself is defined
- assign_variable = test_state->find_var (var_name);
- if (assign_variable == test_state->variable.end()) {
- // No such variable exists, so:
- test_state->make_var (var_name);
- prep_code.append (test_state->bplate->bplate_string[declare_policy_type]);
- find_replace_all ("$var", var_name, prep_code);
- }
-}
-
-void get_policy_type_call::fill_in_command (void)
-{
- // (call_code already loaded by constructor)
- find_replace_all ("$policy", asset_info.get_name(), call_code);
- find_replace_1st ("$type", asset_info.get_name() + "_type", call_code);
- // Calculate the expected results:
- calc_result_code();
-}
-
-/**********************************************************************************
- End of methods of class get_policy_type_call.
-**********************************************************************************/
-
-
-/**********************************************************************************
- Methods of class get_policy_algorithm_call follow:
-**********************************************************************************/
-
-get_policy_algorithm_call::get_policy_algorithm_call (tf_fuzz_info *test_state,
- long &call_ser_no, // (constructor)
- asset_search how_asset_found)
- : policy_call(test_state, call_ser_no,
- how_asset_found)
-{
- // Copy the boilerplate text into local buffers:
- prep_code.assign ("");
- call_code.assign (test_state->bplate->bplate_string[get_policy_algorithm]);
- call_description = "policy algorithm-get call";
-}
-get_policy_algorithm_call::~get_policy_algorithm_call (void)
-{
- return; // just to have something to pin a breakpoint onto
-}
-
-bool get_policy_algorithm_call::copy_call_to_asset (void)
-{
- return copy_call_to_asset_t<policy_asset*> (this, dont_create_asset);
-}
-
-void get_policy_algorithm_call::fill_in_prep_code (void)
-{
- string var_name = asset_info.get_name() + "_algo";
- vector<variable_info>::iterator assign_variable;
-
- policy_fill_in_prep_code(); // make sure the policy variable itself is defined
- assign_variable = test_state->find_var (var_name);
- if (assign_variable == test_state->variable.end()) {
- // No such variable exists, so:
- test_state->make_var (var_name);
- prep_code.append (test_state->bplate->bplate_string[declare_policy_algorithm]);
- find_replace_all ("$var", var_name, prep_code);
- }
-}
-
-void get_policy_algorithm_call::fill_in_command (void)
-{
- // (call_code already loaded by constructor)
- find_replace_all ("$policy", asset_info.get_name(), call_code);
- find_replace_1st ("$algorithm", asset_info.get_name() + "_algo", call_code);
- // Calculate the expected results:
- calc_result_code();
-}
-
-/**********************************************************************************
- End of methods of class get_policy_algorithm_call.
-**********************************************************************************/
-
-
-/**********************************************************************************
- Methods of class get_policy_usage_call follow:
-**********************************************************************************/
-
-get_policy_usage_call::get_policy_usage_call (tf_fuzz_info *test_state,
- long &call_ser_no, // (constructor)
- asset_search how_asset_found)
- : policy_call(test_state, call_ser_no,
- how_asset_found)
-{
- // Copy the boilerplate text into local buffers:
- prep_code.assign ("");
- call_code.assign (test_state->bplate->bplate_string[get_policy_usage]);
- call_description = "policy usage-get call";
-}
-get_policy_usage_call::~get_policy_usage_call (void)
-{
- return; // just to have something to pin a breakpoint onto
-}
-
-bool get_policy_usage_call::copy_call_to_asset (void)
-{
- return copy_call_to_asset_t<policy_asset*> (this, dont_create_asset);
-}
-
-void get_policy_usage_call::fill_in_prep_code (void)
-{
- string var_name = asset_info.get_name() + "_usage";
- vector<variable_info>::iterator assign_variable;
-
- policy_fill_in_prep_code(); // make sure the policy variable itself is defined
- assign_variable = test_state->find_var (var_name);
- if (assign_variable == test_state->variable.end()) {
- // No such variable exists, so:
- test_state->make_var (var_name);
- prep_code.append (test_state->bplate->bplate_string[declare_policy_usage]);
- find_replace_all ("$var", var_name, prep_code);
- }
-}
-
-void get_policy_usage_call::fill_in_command (void)
-{
- // (call_code already loaded by constructor)
- find_replace_all ("$policy", asset_info.get_name(), call_code);
- find_replace_1st ("$usage", asset_info.get_name() + "_usage", call_code);
- // Calculate the expected results:
- calc_result_code();
-}
-
-/**********************************************************************************
- End of methods of class get_policy_usage_call.
-**********************************************************************************/
-
-
-/**********************************************************************************
- Methods of class print_policy_usage_call follow:
-**********************************************************************************/
-
-print_policy_usage_call::print_policy_usage_call (tf_fuzz_info *test_state,
- long &call_ser_no, // (constructor)
- asset_search how_asset_found)
- : policy_call(test_state, call_ser_no,
- how_asset_found)
-{
- // Copy the boilerplate text into local buffers:
- prep_code.assign ("");
- call_code.assign (test_state->bplate->bplate_string[print_policy_usage]);
- call_description = "policy usage-print call";
-}
-print_policy_usage_call::~print_policy_usage_call (void)
-{
- return; // just to have something to pin a breakpoint onto
-}
-
-bool print_policy_usage_call::copy_call_to_asset (void)
-{
- return copy_call_to_asset_t<policy_asset*> (this, dont_create_asset);
-}
-
-void print_policy_usage_call::fill_in_prep_code (void)
-{
- string var_name = asset_info.get_name() + "_usage";
- vector<variable_info>::iterator assign_variable;
-
- policy_fill_in_prep_code(); // make sure the policy variable itself is defined
- // Make sure policy-usage variable is defined:
- assign_variable = test_state->find_var (var_name);
- if (assign_variable == test_state->variable.end()) {
- // No such variable exists, so:
- test_state->make_var (var_name);
- prep_code.append (test_state->bplate->bplate_string[declare_policy_usage]);
- find_replace_all ("$var", var_name, prep_code);
- }
-}
-
-void print_policy_usage_call::fill_in_command (void)
-{
- string var_name = asset_info.get_name() + "_usage";
-
- // (call_code already loaded by constructor)
- find_replace_all ("$policy", asset_info.get_name(), call_code);
- find_replace_1st ("$usage_string", policy.usage_string, call_code);
- find_replace_1st ("$usage", var_name, call_code);
- find_replace_1st ("$print_usage_true_string", policy.print_usage_true_string,
- call_code);
- find_replace_1st ("$print_usage_false_string", policy.print_usage_false_string,
- call_code);
- // Calculate the expected results:
- calc_result_code();
-}
-
-/**********************************************************************************
- End of methods of class print_policy_usage_call.
-**********************************************************************************/
-
-
-/**********************************************************************************
- Methods of class get_key_policy_call follow:
-**********************************************************************************/
-
-get_key_policy_call::get_key_policy_call (tf_fuzz_info *test_state, // (constructor)
- long &call_ser_no,
- asset_search how_asset_found)
- : policy_call(test_state, call_ser_no,
- how_asset_found)
-{
- // Copy the boilerplate text into local buffers:
- prep_code.assign ("");
- call_code.assign (test_state->bplate->bplate_string[get_policy]);
- check_code.assign (test_state->bplate->bplate_string[get_policy_check]);
- call_description = "policy get call";
-}
-get_key_policy_call::~get_key_policy_call (void)
-{
- return; // just to have something to pin a breakpoint onto
-}
-
-bool get_key_policy_call::copy_call_to_asset (void)
-{
- return copy_call_to_asset_t<key_asset*> (this, dont_create_asset);
-}
-
-void get_key_policy_call::fill_in_prep_code (void)
-{
- // No prep code required.
- return; // just to have something to pin a breakpoint onto
-}
-
-void get_key_policy_call::fill_in_command (void)
-{
- // (call_code already loaded by constructor)
- find_replace_all ("key", asset_info.get_name(), call_code);
- find_replace_all ("$policy", policy.asset_2_name, call_code);
- // Calculate the expected results:
- calc_result_code();
-}
-
-/**********************************************************************************
- End of methods of class get_key_policy_call.
-**********************************************************************************/
-
-
-/**********************************************************************************
- Methods of class generate_key_call follow:
-**********************************************************************************/
-
-generate_key_call::generate_key_call (tf_fuzz_info *test_state, // (constructor)
- long &call_ser_no,
- asset_search how_asset_found)
- : key_call(test_state, call_ser_no,
- how_asset_found)
-{
- // Copy the boilerplate text into local buffers:
- prep_code.assign ("");
- call_code.assign (test_state->bplate->bplate_string[generate_key]);
- check_code.assign (test_state->bplate->bplate_string[generate_key_check]);
- call_description = "key-generate call";
-}
-generate_key_call::~generate_key_call (void)
-{
- return; // just to have something to pin a breakpoint onto
-}
-
-bool generate_key_call::copy_call_to_asset (void)
-{
- return copy_call_to_asset_t<key_asset*> (this, yes_create_asset);
-}
-
-void generate_key_call::fill_in_prep_code (void)
-{
- string var_name = asset_info.get_name();
- vector<variable_info>::iterator assign_variable;
-
- // Make sure key variable is defined:
- assign_variable = test_state->find_var (var_name);
- if (assign_variable == test_state->variable.end()) {
- // No such variable exists, so:
- test_state->make_var (var_name);
- prep_code.append (test_state->bplate->bplate_string[declare_key]);
- find_replace_all ("$var", var_name, prep_code);
- }
-}
-
-void generate_key_call::fill_in_command (void)
-{
- // (call_code already loaded by constructor)
- find_replace_all ("$policy", policy.asset_2_name, call_code);
- find_replace_all ("$key", asset_info.get_name(), call_code);
- // Calculate the expected results:
- calc_result_code();
-}
-
-/**********************************************************************************
- End of methods of class generate_key_call.
-**********************************************************************************/
-
-
-/**********************************************************************************
- Methods of class create_key_call follow:
-**********************************************************************************/
-
-create_key_call::create_key_call (tf_fuzz_info *test_state, // (constructor)
- long &call_ser_no,
- asset_search how_asset_found)
- : key_call(test_state, call_ser_no,
- how_asset_found)
-{
- // Copy the boilerplate text into local buffers:
- prep_code.assign ("");
- call_code.assign (test_state->bplate->bplate_string[create_key]);
- check_code.assign (test_state->bplate->bplate_string[create_key_check]);
- call_description = "key-create call";
-}
-create_key_call::~create_key_call (void)
-{
- return; // just to have something to pin a breakpoint onto
-}
-
-bool create_key_call::copy_call_to_asset (void)
-{
- return copy_call_to_asset_t<key_asset*> (this, yes_create_asset);
-}
-
-void create_key_call::fill_in_prep_code (void)
-{
- string var_name = asset_info.get_name();
- vector<variable_info>::iterator assign_variable;
- gibberish gib;
- char gib_buff[500];
- string t_string;
-
- // Key variable:
- assign_variable = test_state->find_var (var_name);
- if (assign_variable == test_state->variable.end()) {
- // No such variable exists, so:
- test_state->make_var (var_name);
- prep_code.append (test_state->bplate->bplate_string[declare_key]);
- find_replace_all ("$var", var_name, prep_code);
- }
- // Key-data variable:
- var_name = asset_info.get_name() + "_set_data";
- assign_variable = test_state->find_var (var_name);
- if (assign_variable == test_state->variable.end()) {
- // No such variable exists, so:
- test_state->make_var (var_name);
- prep_code.append (test_state->bplate->bplate_string[declare_big_string]);
- find_replace_all ("$var", var_name, prep_code);
- int rand_data_length = 12 + (rand() % 100);
- gib.sentence (gib_buff, gib_buff + rand_data_length - 1);
- t_string = gib_buff;
- find_replace_all ("$init", t_string, prep_code);
- }
-}
-
-void create_key_call::fill_in_command (void)
-{
- // (call_code already loaded by constructor)
- find_replace_all ("$policy", policy.asset_2_name, call_code);
- find_replace_all ("$data", asset_info.get_name() + "_set_data", call_code);
- find_replace_all ("$length", to_string (policy.n_bits), call_code);
- find_replace_all ("$key", asset_info.get_name(), call_code);
- // Calculate the expected results:
- calc_result_code();
-}
-
-/**********************************************************************************
- End of methods of class create_key_call.
-**********************************************************************************/
-
-
-/**********************************************************************************
- Methods of class copy_key_call follow:
-**********************************************************************************/
-
-copy_key_call::copy_key_call (tf_fuzz_info *test_state, // (constructor)
- long &call_ser_no,
- asset_search how_asset_found)
- : key_call(test_state, call_ser_no,
- how_asset_found)
-{
- // Copy the boilerplate text into local buffers:
- prep_code.assign ("");
- call_code.assign (test_state->bplate->bplate_string[copy_key]);
- check_code.assign (test_state->bplate->bplate_string[copy_key_check]);
- call_description = "key-copy call";
-}
-copy_key_call::~copy_key_call (void)
-{
- return; // just to have something to pin a breakpoint onto
-}
-
-bool copy_key_call::copy_call_to_asset (void)
-{
- return copy_call_to_asset_t<key_asset*> (this, yes_create_asset);
-}
-
-void copy_key_call::fill_in_prep_code (void)
-{
- string var_name = asset_info.get_name();
- vector<variable_info>::iterator assign_variable;
-
- // Make sure key variable is defined:
- assign_variable = test_state->find_var (var_name);
- if (assign_variable == test_state->variable.end()) {
- // No such variable exists, so:
- test_state->make_var (var_name);
- prep_code.append (test_state->bplate->bplate_string[declare_key]);
- find_replace_all ("$var", var_name, prep_code);
- }
-}
-
-void copy_key_call::fill_in_command (void)
-{
- vector<psa_asset*>::iterator key_asset;
- vector<psa_asset*> *asset_vector;
- int asset_pick;
-
- // Calculate the expected results:
- asset_search find_result;
- vector<psa_asset*>::iterator asset;
- long dummy = 0L;
- // See if the source key does not exist:
-
- if (random_asset != psa_asset_usage::all) {
- // != psa_asset_usage::all means to choose some known asset at random:
- if (random_asset == psa_asset_usage::active) {
- asset_vector = &(test_state->active_key_asset);
- find_result = asset_info.how_asset_found = asset_search::found_active;
- // if empty, we'll error out, below.
- } else if (random_asset == psa_asset_usage::deleted) {
- asset_vector = &(test_state->deleted_key_asset);
- find_result = asset_info.how_asset_found = asset_search::found_deleted;
- } else {
- // "invalid" assets are not currently used.
- cerr << "\nError: Tool-internal: Please report error 1103 to " << endl
- << "TF-Fuzz developers."
- << endl;
- exit(1103);
- }
- if (asset_vector->size() > 0) {
- /* Pick an active or deleted asset at random: */
- asset_pick = rand() % asset_vector->size();
- key_asset = asset_vector->begin() + asset_pick;
- /* Copy asset information into template tracker: */
- asset_info.id_n = (*key_asset)->asset_info.id_n;
- asset_info.asset_ser_no
- = (*key_asset)->asset_info.asset_ser_no;
- } else {
- if (random_asset == psa_asset_usage::active) {
- cerr << "\nError: A key call asks for a "
- << "randomly chosen active asset, when none " << endl
- << "is currently defined." << endl;
- exit(1012);
- } else if (random_asset == psa_asset_usage::deleted) {
- cerr << "\nError: A key call asks for a "
- << "randomly chosen deleted asset, when none " << endl
- << "is currently defined." << endl;
- exit(1013);
- } // "invalid" assets are not currently used.
- }
- } else {
- find_result = test_state->
- find_or_create_key_asset (psa_asset_search::name, psa_asset_usage::active,
- policy.asset_3_name, (uint64_t) 0, dummy,
- dont_create_asset, key_asset);
- }
- if (find_result != asset_search::found_active) {
- exp_data.pf_specified = true;
- exp_data.pf_result_string = "PSA_ERROR_INVALID_ARGUMENT";
- // TODO: Pull this in from boilerplate file
- } else {
- // See if the new policy does not exist:
- find_result = test_state->
- find_or_create_policy_asset (psa_asset_search::name, psa_asset_usage::active,
- policy.asset_2_name, (uint64_t) 0, dummy,
- dont_create_asset, asset);
- if (find_result != asset_search::found_active) {
- exp_data.pf_specified = true;
- exp_data.pf_result_string = "PSA_ERROR_INVALID_ARGUMENT";
- // TODO: Pull this in from boilerplate file
- } else if (!(*asset)->policy.copyable) {
- // See if the source key does not support export:
- // TODO: Or wait, it's the original policy for the key, right?
- exp_data.pf_specified = true;
- exp_data.pf_result_string = "PSA_ERROR_NOT_PERMITTED";
- }
- }
-
- // (call_code already loaded by constructor)
- find_replace_all ("$master", (*key_asset)->asset_info.get_name(), call_code);
- find_replace_all ("$policy", policy.asset_2_name, call_code);
- find_replace_all ("$copy", asset_info.get_name(), call_code);
- calc_result_code();
-}
-
-/**********************************************************************************
- End of methods of class copy_key_call.
-**********************************************************************************/
-
-
-/**********************************************************************************
- Methods of class read_key_data_call follow:
-**********************************************************************************/
-
-read_key_data_call::read_key_data_call (tf_fuzz_info *test_state, // (constructor)
- long &call_ser_no,
- asset_search how_asset_found)
- : key_call(test_state, call_ser_no,
- how_asset_found)
-{
- // Copy the boilerplate text into local buffers:
- prep_code.assign ("");
- call_code.assign (test_state->bplate->bplate_string[read_key_data]);
- check_code.assign (test_state->bplate->bplate_string[read_key_data_check]);
- call_description = "key read-data call";
-}
-read_key_data_call::~read_key_data_call (void)
-{
- return; // just to have something to pin a breakpoint onto
-}
-
-bool read_key_data_call::copy_call_to_asset (void)
-{
- return copy_call_to_asset_t<key_asset*> (this, dont_create_asset);
-}
-
-void read_key_data_call::fill_in_prep_code (void)
-{
- string var_name, length_var_name, actual_length_var_name, var_name_suffix,
- length_var_name_suffix, temp_string;
- vector<variable_info>::iterator expect_variable;
- vector<variable_info>::iterator assign_variable;
-
- if (exp_data.data_var_specified) {
- var_name.assign (exp_data.data_var + "_data");
- length_var_name.assign (exp_data.data_var + "_length");
- /* If actual-data variable doesn't already exist, create variable tracker,
- and write declaration for it: */
- expect_variable = test_state->find_var (exp_data.data_var);
- if (expect_variable == test_state->variable.end()) {
- // No such variable exists, so:
- test_state->make_var (exp_data.data_var);
- expect_variable = test_state->find_var (exp_data.data_var);
- prep_code.append (test_state->bplate->bplate_string[declare_big_string]);
- find_replace_1st ("$var", var_name, prep_code);
- temp_string = (char *) expect_variable->value;
- find_replace_1st ("$init", temp_string, prep_code);
- // Input data length:
- prep_code.append (test_state->bplate->bplate_string[declare_size_t]);
- find_replace_1st ("$var", length_var_name, prep_code);
- find_replace_1st ("$init", to_string(temp_string.length()), prep_code);
- // TODO: Is these lengths in bits or bytes?
- }
- }
- // else we're not comparing to named variable, so compare to assigned data.
- // Actual (output) data length:
- if (assign_data_var_specified) {
- var_name.assign (assign_data_var + "_data");
- length_var_name.assign (assign_data_var + "_length");
- actual_length_var_name.assign (assign_data_var + "_act_length");
- /* If actual-data variable doesn't already exist, create variable tracker,
- and write declaration for it: */
- assign_variable = test_state->find_var (assign_data_var);
- if (assign_variable == test_state->variable.end()) {
- // No such variable exists, so:
- test_state->make_var (assign_data_var);
- assign_variable = test_state->find_var (assign_data_var);
- prep_code.append (test_state->bplate->bplate_string[declare_big_string]);
- find_replace_1st ("$var", var_name, prep_code);
- temp_string = (char *) assign_variable->value;
- find_replace_1st ("$init", temp_string, prep_code);
- // Input data length:
- prep_code.append (test_state->bplate->bplate_string[declare_size_t]);
- find_replace_1st ("$var", length_var_name, prep_code);
- find_replace_1st ("$init", to_string(temp_string.length()), prep_code);
- }
- } else {
- // Key data not read into a named variable, so use default C variable:
- var_name = asset_info.get_name() + "_act_data";
- prep_code.append (test_state->bplate->bplate_string[declare_string]);
- find_replace_1st ("$var", var_name, prep_code);
- find_replace_1st ("$init", set_data.get(), prep_code);
- actual_length_var_name.assign (asset_info.get_name() + "_act_length");
- prep_code.append (test_state->bplate->bplate_string[declare_size_t]);
- find_replace_1st ("$var", actual_length_var_name, prep_code);
- find_replace_1st ("$init", to_string(set_data.get().length()), prep_code);
- }
- length_var_name_suffix = "_read_length";
- var_name.assign (asset_info.get_name() + var_name_suffix);
- length_var_name.assign (asset_info.get_name() + length_var_name_suffix);
- prep_code.append (test_state->bplate->bplate_string[declare_size_t]);
- find_replace_1st ("$var", length_var_name, prep_code);
- find_replace_1st ("$init", to_string(set_data.get().length()), prep_code);
-}
-
-void read_key_data_call::fill_in_command (void)
-{
- string var_name, length_var_name, exp_var_name, exp_length_var_name,
- actual_length_var_name, var_name_suffix, length_var_name_suffix,
- temp_string;
-
- // Fill in the PSA command itself:
- actual_length_var_name.assign (asset_info.get_name() + "_read_length");
- if (assign_data_var_specified) {
- var_name.assign (assign_data_var + "_data");
- length_var_name.assign (assign_data_var + "_length");
- } else {
- var_name_suffix = "_act_data";
- var_name.assign (asset_info.get_name() + var_name_suffix);
- length_var_name_suffix = "_act_length";
- length_var_name.assign (asset_info.get_name() + length_var_name_suffix);
- }
- find_replace_1st ("$data", var_name, call_code);
- find_replace_1st ("$key", asset_info.get_name(), call_code);
- string id_string = to_string((long) asset_info.id_n++);
- find_replace_1st ("$length", length_var_name, call_code);
- find_replace_1st ("$act_size", actual_length_var_name, call_code);
-
- // Check data:
- if (exp_data.data_var_specified) {
- check_code.assign (test_state->bplate->bplate_string[compare_data]);
- exp_var_name.assign (exp_data.data_var + "_data");
- exp_length_var_name.assign (exp_data.data_var + "_length");
- find_replace_1st ("$act_data", var_name, check_code);
- find_replace_1st ("$exp_data", exp_var_name, check_code);
- find_replace_1st ("$length", exp_length_var_name, check_code);
- }
-
- // See if the source key did not exist:
- if (!policy.exportable) {
- // See if the source key does not support export:
- exp_data.pf_specified = true;
- exp_data.pf_result_string = "PSA_ERROR_NOT_PERMITTED";
- }
- calc_result_code();
-}
-
-/**********************************************************************************
- End of methods of class read_key_data_call.
-**********************************************************************************/
-
-
-/**********************************************************************************
- Methods of class remove_key_call follow:
-**********************************************************************************/
-
-remove_key_call::remove_key_call (tf_fuzz_info *test_state, // (constructor)
- long &call_ser_no,
- asset_search how_asset_found)
- : key_call(test_state, call_ser_no,
- how_asset_found)
-{
- // Copy the boilerplate text into local buffers:
- prep_code.assign ("");
- call_code.assign (test_state->bplate->bplate_string[remove_key]);
- check_code.assign (test_state->bplate->bplate_string[remove_key_check]);
- call_description = "key-remove call";
-}
-remove_key_call::~remove_key_call (void)
-{
- return; // just to have something to pin a breakpoint onto
-}
-
-bool remove_key_call::copy_call_to_asset (void)
-{
- return copy_call_to_asset_t<key_asset*> (this, dont_create_asset);
-}
-
-void remove_key_call::fill_in_prep_code (void)
-{
- // No prep code required.
- return; // just to have something to pin a breakpoint onto
-}
-
-void remove_key_call::fill_in_command (void)
-{
- // (call_code already loaded by constructor)
- find_replace_all ("$key", asset_info.get_name(), call_code);
- // Calculate the expected results:
- calc_result_code();
-}
-
-/**********************************************************************************
- End of methods of class remove_key_call.
-**********************************************************************************/
-
diff --git a/tools/tf_fuzz/calls/crypto_call.hpp b/tools/tf_fuzz/calls/crypto_call.hpp
deleted file mode 100644
index 7fd58ccef..000000000
--- a/tools/tf_fuzz/calls/crypto_call.hpp
+++ /dev/null
@@ -1,582 +0,0 @@
-/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#ifndef CRYPTO_CALL_HPP
-#define CRYPTO_CALL_HPP
-
-#include <string>
-#include <vector>
-
-/* This project's header files #including other project headers quickly becomes
- unrealistically complicated. The only solution is for each .cpp to include
- the headers it needs.
-#include "psa_call.hpp"
-#include "crypto_asset.hpp"
-*/
-
-template<class T> bool copy_call_to_asset_t (psa_call *call, bool create_asset_bool)
-{
- vector<psa_asset*>::iterator found_asset;
-
- found_asset = call->resolve_asset (create_asset_bool, psa_asset_usage::all);
- // Copy over everything relevant:
- if (call->asset_info.how_asset_found != asset_search::not_found) {
- call->asset_info.the_asset = reinterpret_cast<T>(*found_asset);
- /* Note: The vector is base-class, but the assets in this list
- themselves *really are* policy_asset-type objects. */
- int i = call->asset_info.the_asset->set_data.n_set_vars; // save this
- call->asset_info.the_asset->exp_data.data = call->exp_data.data;
- call->asset_info.the_asset->set_data = call->set_data;
- call->asset_info.the_asset->set_data.n_set_vars = call->set_data.n_set_vars = ++i;
- call->asset_info.the_asset->policy = call->policy;
- call->asset_info.the_asset->handle_str = call->asset_info.get_name();
- if (call->asset_info.how_asset_found == asset_search::created_new) {
- call->asset_info.the_asset->asset_info.name_specified
- = call->asset_info.name_specified;
- call->asset_info.the_asset->asset_info.set_name (call->asset_info.get_name());
- call->asset_info.the_asset->asset_info.asset_ser_no
- = call->asset_info.asset_ser_no;
- call->asset_info.the_asset->asset_info.id_n = call->asset_info.id_n;
- }
- }
- return true;
-}
-
-
-using namespace std;
-
-class policy_call : public crypto_call
-{
-public:
- // Data members: // (low value in hiding these behind setters and getters)
- // Methods:
- vector<psa_asset*>::iterator resolve_asset (bool create_asset_bool,
- psa_asset_usage where);
- void policy_fill_in_prep_code (void);
- policy_call (tf_fuzz_info *test_state, long &asset_ser_no,
- asset_search how_asset_found); // (constructor)
- ~policy_call (void);
-
-protected:
- // Data members:
- // Methods:
-// void calc_result_code (void); for *now* keep this in crypto_call::
-
-private:
- // Data members:
- // Methods:
-};
-
-
-class key_call : public crypto_call
-{
-public:
- // Data members: // (low value in hiding these behind setters and getters)
- // Methods:
- vector<psa_asset*>::iterator resolve_asset (bool create_asset_bool,
- psa_asset_usage where);
- key_call (tf_fuzz_info *test_state, long &asset_ser_no,
- asset_search how_asset_found); // (constructor)
- ~key_call (void);
-
-protected:
- // Data members:
- // Methods:
-// void calc_result_code (void); for *now* keep this in crypto_call::
-
-private:
- // Data members:
- // Methods:
-};
-
-
-/**********************************************************************************
- Derived classes of class policy_call follow:
-**********************************************************************************/
-
-
-class init_policy_call : public policy_call
-{
-public:
- // Data members:
- // Methods:
- bool copy_call_to_asset (void);
- void fill_in_prep_code (void);
- void fill_in_command (void);
- init_policy_call (tf_fuzz_info *test_state, long &asset_ser_no,
- asset_search how_asset_found); // (constructor)
- ~init_policy_call (void);
-
-
-protected:
- // Data members:
- // Methods:
-
-private:
- // Data members:
- // Methods:
-};
-
-
-class reset_policy_call : public policy_call
-{
-public:
- // Data members:
- // Methods:
- bool copy_call_to_asset (void);
- void fill_in_prep_code (void);
- void fill_in_command (void);
- reset_policy_call (tf_fuzz_info *test_state, long &asset_ser_no,
- asset_search how_asset_found); // (constructor)
- ~reset_policy_call (void);
-
-
-protected:
- // Data members:
- // Methods:
-
-private:
- // Data members:
- // Methods:
-};
-
-
-class set_policy_usage_call : public policy_call
-{
-public:
- // Data members:
- // Methods:
- bool copy_call_to_asset (void);
- void fill_in_prep_code (void);
- void fill_in_command (void);
- set_policy_usage_call (tf_fuzz_info *test_state, long &asset_ser_no,
- asset_search how_asset_found); // (constructor)
- ~set_policy_usage_call (void);
-
-
-protected:
- // Data members:
- // Methods:
-
-private:
- // Data members:
- // Methods:
-};
-
-
-/* set_policy_usage_call(), above, gives a policy particular attribute, and resets
- all others. add_policy_usage_call(), below, ORs in an additional usage
- attribute, to whatever is already in there. */
-
-class add_policy_usage_call : public policy_call
-{
-public:
- // Data members:
- // Methods:
- bool copy_call_to_asset (void);
- void fill_in_prep_code (void);
- void fill_in_command (void);
- add_policy_usage_call (tf_fuzz_info *test_state, long &asset_ser_no,
- asset_search how_asset_found); // (constructor)
- ~add_policy_usage_call (void);
-
-
-protected:
- // Data members:
- // Methods:
-
-private:
- // Data members:
- // Methods:
-};
-
-
-class set_policy_lifetime_call : public policy_call
-{
-public:
- // Data members:
- // Methods:
- bool copy_call_to_asset (void);
- void fill_in_prep_code (void);
- void fill_in_command (void);
- set_policy_lifetime_call (tf_fuzz_info *test_state, long &asset_ser_no,
- asset_search how_asset_found); // (constructor)
- ~set_policy_lifetime_call (void);
-
-
-protected:
- // Data members:
- // Methods:
-
-private:
- // Data members:
- // Methods:
-};
-
-
-class set_policy_algorithm_call : public policy_call
-{
-public:
- // Data members:
- // Methods:
- bool copy_call_to_asset (void);
- void fill_in_prep_code (void);
- void fill_in_command (void);
- set_policy_algorithm_call (tf_fuzz_info *test_state, long &asset_ser_no,
- asset_search how_asset_found); // (constructor)
- ~set_policy_algorithm_call (void);
-
-
-protected:
- // Data members:
- // Methods:
-
-private:
- // Data members:
- // Methods:
-};
-
-
-class set_policy_size_call : public policy_call
-{
-public:
- // Data members:
- // Methods:
- bool copy_call_to_asset (void);
- void fill_in_prep_code (void);
- void fill_in_command (void);
- set_policy_size_call (tf_fuzz_info *test_state, long &asset_ser_no,
- asset_search how_asset_found); // (constructor)
- ~set_policy_size_call (void);
-
-
-protected:
- // Data members:
- // Methods:
-
-private:
- // Data members:
- // Methods:
-};
-
-
-class set_policy_type_call : public policy_call
-{
-public:
- // Data members:
- // Methods:
- bool copy_call_to_asset (void);
- void fill_in_prep_code (void);
- void fill_in_command (void);
- set_policy_type_call (tf_fuzz_info *test_state, long &asset_ser_no,
- asset_search how_asset_found); // (constructor)
- ~set_policy_type_call (void);
-
-
-protected:
- // Data members:
- // Methods:
-
-private:
- // Data members:
- // Methods:
-};
-
-
-class get_policy_lifetime_call : public policy_call
-{
-public:
- // Data members:
- // Methods:
- bool copy_call_to_asset (void);
- void fill_in_prep_code (void);
- void fill_in_command (void);
- get_policy_lifetime_call (tf_fuzz_info *test_state, long &asset_ser_no,
- asset_search how_asset_found); // (constructor)
- ~get_policy_lifetime_call (void);
-
-
-protected:
- // Data members:
- // Methods:
-
-private:
- // Data members:
- // Methods:
-};
-
-
-class get_policy_size_call : public policy_call
-{
-public:
- // Data members:
- // Methods:
- bool copy_call_to_asset (void);
- void fill_in_prep_code (void);
- void fill_in_command (void);
- get_policy_size_call (tf_fuzz_info *test_state, long &asset_ser_no,
- asset_search how_asset_found); // (constructor)
- ~get_policy_size_call (void);
-
-
-protected:
- // Data members:
- // Methods:
-
-private:
- // Data members:
- // Methods:
-};
-
-
-class get_policy_type_call : public policy_call
-{
-public:
- // Data members:
- // Methods:
- bool copy_call_to_asset (void);
- void fill_in_prep_code (void);
- void fill_in_command (void);
- get_policy_type_call (tf_fuzz_info *test_state, long &asset_ser_no,
- asset_search how_asset_found); // (constructor)
- ~get_policy_type_call (void);
-
-
-protected:
- // Data members:
- // Methods:
-
-private:
- // Data members:
- // Methods:
-};
-
-
-class get_policy_algorithm_call : public policy_call
-{
-public:
- // Data members:
- // Methods:
- bool copy_call_to_asset (void);
- void fill_in_prep_code (void);
- void fill_in_command (void);
- get_policy_algorithm_call (tf_fuzz_info *test_state, long &asset_ser_no,
- asset_search how_asset_found); // (constructor)
- ~get_policy_algorithm_call (void);
-
-
-protected:
- // Data members:
- // Methods:
-
-private:
- // Data members:
- // Methods:
-};
-
-
-class get_policy_usage_call : public policy_call
-{
-public:
- // Data members:
- // Methods:
- bool copy_call_to_asset (void);
- void fill_in_prep_code (void);
- void fill_in_command (void);
- get_policy_usage_call (tf_fuzz_info *test_state, long &asset_ser_no,
- asset_search how_asset_found); // (constructor)
- ~get_policy_usage_call (void);
-
-
-protected:
- // Data members:
- // Methods:
-
-private:
- // Data members:
- // Methods:
-};
-
-
-/* This is not actually a PSA call; it just emits code to print out, to the log,
- information about the usage info retrieved in a get_policy_usage_call above. */
-class print_policy_usage_call : public policy_call
-{
-public:
- // Data members:
- // Methods:
- bool copy_call_to_asset (void);
- void fill_in_prep_code (void);
- void fill_in_command (void);
- print_policy_usage_call (tf_fuzz_info *test_state, long &asset_ser_no,
- asset_search how_asset_found); // (constructor)
- ~print_policy_usage_call (void);
-
-
-protected:
- // Data members:
- // Methods:
-
-private:
- // Data members:
- // Methods:
-};
-
-
-class get_key_policy_call : public policy_call
-{
-public:
- // Data members:
- // Methods:
- bool copy_call_to_asset (void);
- void fill_in_prep_code (void);
- void fill_in_command (void);
- get_key_policy_call (tf_fuzz_info *test_state, long &asset_ser_no,
- asset_search how_asset_found); // (constructor)
- ~get_key_policy_call (void);
-
-
-protected:
- // Data members:
- // Methods:
-
-private:
- // Data members:
- // Methods:
-};
-
-
-/**********************************************************************************
- End of derived classes of class policy_call.
-**********************************************************************************/
-
-
-/**********************************************************************************
- Derived classes of class key_call follow:
-**********************************************************************************/
-
-
-class generate_key_call : public key_call
-{
-public:
- // Data members:
- // Methods:
- bool copy_call_to_asset (void);
- void fill_in_prep_code (void);
- void fill_in_command (void);
- generate_key_call (tf_fuzz_info *test_state, long &asset_ser_no,
- asset_search how_asset_found); // (constructor)
- ~generate_key_call (void);
-
-
-protected:
- // Data members:
- // Methods:
-
-private:
- // Data members:
- // Methods:
-};
-
-
-class create_key_call : public key_call
-{
-public:
- // Data members:
- // Methods:
- bool copy_call_to_asset (void);
- void fill_in_prep_code (void);
- void fill_in_command (void);
- create_key_call (tf_fuzz_info *test_state, long &asset_ser_no,
- asset_search how_asset_found); // (constructor)
- ~create_key_call (void);
-
-
-protected:
- // Data members:
- // Methods:
-
-private:
- // Data members:
- // Methods:
-};
-
-
-class copy_key_call : public key_call
-{
-public:
- // Data members:
- // Methods:
- bool copy_call_to_asset (void);
- void fill_in_prep_code (void);
- void fill_in_command (void);
- copy_key_call (tf_fuzz_info *test_state, long &asset_ser_no,
- asset_search how_asset_found); // (constructor)
- ~copy_key_call (void);
-
-
-protected:
- // Data members:
- // Methods:
-
-private:
- // Data members:
- // Methods:
-};
-
-
-class read_key_data_call : public key_call
-{
-public:
- // Data members:
- // Methods:
- bool copy_call_to_asset (void);
- void fill_in_prep_code (void);
- void fill_in_command (void);
- read_key_data_call (tf_fuzz_info *test_state, long &asset_ser_no,
- asset_search how_asset_found); // (constructor)
- ~read_key_data_call (void);
-
-
-protected:
- // Data members:
- // Methods:
-
-private:
- // Data members:
- // Methods:
-};
-
-
-class remove_key_call : public key_call
-{
-public:
- // Data members:
- // Methods:
- bool copy_call_to_asset (void);
- void fill_in_prep_code (void);
- void fill_in_command (void);
- remove_key_call (tf_fuzz_info *test_state, long &asset_ser_no,
- asset_search how_asset_found); // (constructor)
- ~remove_key_call (void);
-
-
-protected:
- // Data members:
- // Methods:
-
-private:
- // Data members:
- // Methods:
-};
-
-
-/**********************************************************************************
- End of derived classes of class key_call.
-**********************************************************************************/
-
-#endif // CRYPTO_CALL_HPP
diff --git a/tools/tf_fuzz/calls/psa_call.cpp b/tools/tf_fuzz/calls/psa_call.cpp
deleted file mode 100644
index 46af40971..000000000
--- a/tools/tf_fuzz/calls/psa_call.cpp
+++ /dev/null
@@ -1,350 +0,0 @@
-/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#include "class_forwards.hpp"
-
-#include "boilerplate.hpp"
-#include "gibberish.hpp"
-#include "compute.hpp"
-#include "string_ops.hpp"
-#include "data_blocks.hpp"
-#include "psa_asset.hpp"
-#include "find_or_create_asset.hpp"
-#include "template_line.hpp"
-#include "tf_fuzz.hpp"
-#include "crypto_asset.hpp"
-#include "psa_call.hpp"
-
-
-
-/**********************************************************************************
- Methods of class psa_call follow:
-**********************************************************************************/
-
-//**************** psa_call methods ****************
-
-psa_call::psa_call (tf_fuzz_info *test_state, long &call_ser_no, // (constructor)
- asset_search how_asset_found)
-{
- this->test_state = test_state;
- this->asset_info.how_asset_found = how_asset_found;
- set_data.string_specified = false;
- set_data.set (""); // actual data
- assign_data_var.assign (""); // name of variable assigned (dumped) to
- assign_data_var_specified = false;
- set_data.file_specified = false;
- set_data.file_path.assign ("");
- this->call_ser_no = call_ser_no = unique_id_counter++;
- // These will be set in the lower-level constructors, but...
- prep_code = call_code = check_code = "";
- print_data = hash_data = false;
- barrier = target_barrier = ""; // not (yet) any barrier for re-ordering calls
- call_description = "";
-}
-
-psa_call::~psa_call (void)
-{
- return; // just to have something to pin a breakpoint onto
-}
-
-void psa_call::write_out_prep_code (ofstream &test_file)
-{
- test_file << prep_code;
-}
-
-void psa_call::write_out_command (ofstream &test_file)
-{
- test_file << call_code;
-}
-
-void psa_call::write_out_check_code (ofstream &test_file)
-{
- if (!exp_data.pf_nothing) {
- test_file << check_code;
- } else {
- test_file << " /* (No checks for this PSA call.) */" << endl;
- }
-}
-
-/**********************************************************************************
- End of methods of class psa_call.
-**********************************************************************************/
-
-
-/**********************************************************************************
- Methods of class sst_call follow:
-**********************************************************************************/
-
-/* calc_result_code() fills in the check_code string member with the correct
- result code (e.g., "PSA_SUCCESS" or whatever).
-
- This is a big part of where the target modeling -- error modeling -- occurs,
- so lots of room for further refinement here. */
-void sst_call::calc_result_code (void)
-{
- string formalized; // "proper" result string
-
- if (!exp_data.pf_nothing) {
- if (exp_data.pf_pass) {
- find_replace_all ("$expect",
- test_state->bplate->bplate_string[sst_pass_string],
- check_code);
- } else if (exp_data.pf_fail) {
- // Check for not-success:
- find_replace_1st ("!=", "==",
- check_code);
- find_replace_all ("$expect",
- test_state->bplate->bplate_string[sst_pass_string],
- check_code);
- find_replace_1st ("expected ", "expected not ",
- check_code);
- } else {
- if (exp_data.pf_specified) {
- formalized = formalize (exp_data.pf_result_string, "PSA_ERROR_");
- find_replace_all ("$expect", formalized, check_code);
- } else {
- // Figure out what the message should read:
- switch (asset_info.how_asset_found) {
- case asset_search::found_active:
- case asset_search::created_new:
- find_replace_all ("$expect",
- test_state->bplate->
- bplate_string[sst_pass_string],
- check_code);
- break;
- case asset_search::found_deleted:
- case asset_search::not_found:
- find_replace_all ("$expect",
- test_state->bplate->
- bplate_string[sst_fail_removed],
- check_code);
- break;
- default:
- find_replace_1st ("!=", "==",
- check_code); // like "fail", just make sure...
- find_replace_all ("$expect",
- test_state->bplate->
- bplate_string[sst_pass_string],
- check_code); // ... it's *not* PSA_SUCCESS
- break;
- }
- }
- }
- }
-}
-
-vector<psa_asset*>::iterator sst_call::resolve_asset (bool create_asset_bool,
- psa_asset_usage where) {
- vector<psa_asset*>::iterator found_asset;
- vector<psa_asset*> *asset_vector;
- int asset_pick;
-
- if (random_asset != psa_asset_usage::all) {
- // != psa_asset_usage::all means to choose some known asset at random:
- if (random_asset == psa_asset_usage::active) {
- asset_vector = &(test_state->active_sst_asset);
- asset_info.how_asset_found = asset_search::found_active;
- } else if (random_asset == psa_asset_usage::deleted) {
- asset_vector = &(test_state->deleted_sst_asset);
- asset_info.how_asset_found = asset_search::found_deleted;
- } else {
- // "invalid" assets are not currently used.
- cerr << "\nError: Tool-internal: Please report error 1101 to " << endl
- << "TF-Fuzz developers."
- << endl;
- exit(1101);
- }
- if (asset_vector->size() > 0) {
- /* Pick an active or deleted asset at random: */
- asset_pick = rand() % asset_vector->size();
- found_asset = asset_vector->begin() + asset_pick;
- /* Copy asset information into template tracker: */
- asset_info.id_n = (*found_asset)->asset_info.id_n;
- asset_info.asset_ser_no
- = (*found_asset)->asset_info.asset_ser_no;
- } else {
- if (random_asset == psa_asset_usage::active) {
- cerr << "\nError: An sst call asks for a "
- << "randomly chosen active asset, when none " << endl
- << "is currently defined." << endl;
- exit(1008);
- } else if (random_asset == psa_asset_usage::deleted) {
- cerr << "\nError: An sst call asks for a "
- << "randomly chosen deleted asset, when none " << endl
- << "is currently defined." << endl;
- exit(1009);
- } // "invalid" assets are not currently used.
- }
- } else {
- // Find the asset by name:
- asset_info.how_asset_found = test_state->find_or_create_sst_asset (
- psa_asset_search::name, where,
- asset_info.get_name(), 0, asset_info.asset_ser_no,
- create_asset_bool, found_asset );
- if ( asset_info.how_asset_found == asset_search::unsuccessful
- || asset_info.how_asset_found == asset_search::something_wrong ) {
- cerr << "\nError: Tool-internal: Please report error 108 to " << endl
- << "TF-Fuzz developers."
- << endl;
- exit(108);
- }
- }
- return found_asset;
-}
-
-sst_call::sst_call (tf_fuzz_info *test_state, long &call_ser_no, // (constructor)
- asset_search how_asset_found)
- : psa_call(test_state, call_ser_no, how_asset_found)
-{
- asset_info.the_asset = nullptr;
- return; // just to have something to pin a breakpoint onto
-}
-sst_call::~sst_call (void)
-{
- return; // just to have something to pin a breakpoint onto
-}
-
-/**********************************************************************************
- End of methods of class sst_call.
-**********************************************************************************/
-
-
-/**********************************************************************************
- Methods of class crypto_call follow:
-**********************************************************************************/
-
-/* calc_result_code() fills in the check_code string member with the correct
- result code (e.g., "PSA_SUCCESS" or whatever). This "modeling" needs to be
- improved and expanded upon *massively* more or less mirroring what is seen in
- .../test/suites/crypto/crypto_tests_common.c in the psa_key_interface_test()
- method, (starting around line 20ish). */
-void crypto_call::calc_result_code (void)
-{
- string formalized; // "proper" result string
-
- if (!exp_data.pf_nothing) {
- if (exp_data.pf_pass) {
- find_replace_all ("$expect",
- test_state->bplate->bplate_string[sst_pass_string],
- check_code);
- } else if (exp_data.pf_fail) {
- // Check for not-success:
- find_replace_1st ("!=", "==",
- check_code);
- find_replace_all ("$expect",
- test_state->bplate->bplate_string[sst_pass_string],
- check_code);
- find_replace_1st ("expected ", "expected not ",
- check_code);
- } else {
- if (exp_data.pf_specified) {
- formalized = formalize (exp_data.pf_result_string, "PSA_ERROR_");
- find_replace_all ("$expect", formalized, check_code);
- } else {
- // Figure out what the message should read:
- switch (asset_info.how_asset_found) {
- case asset_search::found_active:
- case asset_search::created_new:
- find_replace_all ("$expect",
- test_state->bplate->
- bplate_string[sst_pass_string],
- check_code);
- break;
- case asset_search::not_found:
- case asset_search::found_deleted:
- find_replace_all ("$expect", "PSA_ERROR_INVALID_HANDLE",
- check_code); // TODO: take from boilerplate
- break;
- default:
- find_replace_1st ("!=", "==",
- check_code); // like "fail", just make sure...
- find_replace_all ("$expect",
- test_state->bplate->
- bplate_string[sst_pass_string],
- check_code); // ... it's *not* PSA_SUCCESS
- break;
- }
- }
- }
- }
-}
-
-
-bool crypto_call::copy_asset_to_call (void)
-{
- if (asset_info.the_asset == nullptr) {
- return false;
- } else {
- // Get updated asset info from the asset:
- asset_info.asset_ser_no = asset_info.the_asset->asset_info.asset_ser_no;
- asset_info.id_n = asset_info.the_asset->asset_info.id_n;
- exp_data.n_exp_vars = asset_info.the_asset->exp_data.n_exp_vars;
- exp_data.data = asset_info.the_asset->exp_data.data;
- return true;
- }
-}
-
-
-crypto_call::crypto_call (tf_fuzz_info *test_state, long &call_ser_no, // (constructor)
- asset_search how_asset_found)
- : psa_call(test_state, call_ser_no, how_asset_found)
-{
- // Nothing further to initialize.
- return; // just to have something to pin a breakpoint onto
-}
-crypto_call::~crypto_call (void)
-{
- // Nothing further to delete.
- return; // just to have something to pin a breakpoint onto
-}
-
-/**********************************************************************************
- End of methods of class crypto_call.
-**********************************************************************************/
-
-
-/**********************************************************************************
- Methods of class security_call follow:
-**********************************************************************************/
-
-security_call::security_call (tf_fuzz_info *test_state, long &call_ser_no, // (constructor)
- asset_search how_asset_found)
- : psa_call(test_state, call_ser_no, how_asset_found)
-{
- // Nothing further to initialize.
- return; // just to have something to pin a breakpoint onto
-}
-security_call::~security_call (void)
-{
- // Nothing further to delete.
- return; // just to have something to pin a breakpoint onto
-}
-
-// resolve_asset() doesn't do anything for security_calls, since there's no asset involved.
-vector<psa_asset*>::iterator security_call::resolve_asset (bool create_asset_bool,
- psa_asset_usage where)
-{
- return test_state->active_sst_asset.end(); // (anything)
-}
-
-/* calc_result_code() fills in the check_code string member with the correct result
- code (e.g., "PSA_SUCCESS" or whatever).
-
- Since there are no actual PSA calls associated with security calls (so far at least),
- this should never be invoked. */
-void security_call::calc_result_code (void)
-{
- // Currently should not be invoked.
- cerr << "\nError: Internal: Please report error #205 to TF-Fuzz developers." << endl;
- exit (205);
-}
-
-/**********************************************************************************
- End of methods of class security_call.
-**********************************************************************************/
-
-
diff --git a/tools/tf_fuzz/calls/psa_call.hpp b/tools/tf_fuzz/calls/psa_call.hpp
deleted file mode 100644
index ed66245cd..000000000
--- a/tools/tf_fuzz/calls/psa_call.hpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#ifndef PSA_CALL_HPP
-#define PSA_CALL_HPP
-
-#include <string>
-
-/* This project's header files #including other project headers quickly becomes
- unrealistically complicated. The only solution is for each .cpp to include
- the headers it needs.
-#include "tf_fuzz.hpp"
-*/
-
-
-using namespace std;
-
-class psa_call
-{
-public:
- /* Data members -- not all PSA calls have/need these, but they need to be acces-
- sible polymorphically via a psa_call iterator: */
- string call_description; // description of the call, just for tracing
- expect_info exp_data; // everything about expected results
- set_data_info set_data; // everything about setting PSA-asset-data values
- asset_name_id_info asset_info; // everything about the asset(s) for this line
- key_policy_info policy; // (specific to crypto, but have to put this here)
- string asset_2_name; // if there's a 2nd asset, then this is its name
- string asset_3_name; // if there's a 3rd asset, then this is its name
- psa_asset_usage random_asset;
- /* if asked to use some random asset from active or deleted, this says
- which. psa_asset_usage::all if not using this feature. */
- bool assign_data_var_specified; // asset data to/from named variable
- string assign_data_var; // name of variable to dump (assign) data into
- // Expected-result info:
- bool print_data; // true to print asset data to test log
- bool hash_data; // true to hash data for later comparison
- string id_string; // not all PSA calls involve an ID, but a diverse set do
- long call_ser_no; // unique serial# for this psa_call (see note in tf_fuzz.hpp)
- tf_fuzz_info *test_state; // the big blob with pointers to everything going on
- string barrier;
- /* "barrier" is used for template-line operations that resolve a series of
- PSA calls. In particular, with respect to the fact that TF-Fuzz strives
- to randomize these multiple calls where possible, meaning interspersing
- them among other, earlier commands. However, for example, calls to set
- the aspects of a policy can't be pushed too far back, such as in among
- calls setting that same policy for a previous operation! "barrier" is
- either "", in which case this call does not care whether you place calls
- before it, or it contains the name of an asset that, calls related to
- which must be placed *after* this call. */
- string target_barrier;
- /* asset to tell the psa_call objects to set and search barrier to when
- re-ordering PSA calls. For key policies, this is not necessarily the
- nominal asset of that call. For a policy call, it is that policy asset,
- so that later re-settings of the same policy don't pollute the current
- setting of that policy. However, for key sets and reads, it is not the
- key asset, but its policy. */
- // Methods:
- virtual vector<psa_asset*>::iterator resolve_asset (bool create_asset_bool,
- psa_asset_usage where) = 0;
- virtual bool copy_call_to_asset (void) = 0;
- virtual bool copy_asset_to_call (void) = 0;
- virtual void fill_in_prep_code (void) = 0;
- virtual void fill_in_command (void) = 0;
- void write_out_prep_code (ofstream &test_file);
- void write_out_command (ofstream &test_file);
- void write_out_check_code (ofstream &test_file);
- psa_call (tf_fuzz_info *test_state, long &asset_ser_no,
- asset_search how_asset_found); // (constructor)
- ~psa_call (void);
-
-protected:
- // Data members:
- string prep_code; // declarations and such prior to all of the calls
- string call_code; // for the call itself
- string check_code; // for the code to check success of the call
- static long unique_id_counter; // counts off unique IDs for assets
- // Methods:
- virtual void calc_result_code (void) = 0;
-
-private:
- // Data members:
- // Methods:
-};
-
-
-class sst_call : public psa_call
-{
-public:
- // Data members: // (low value in hiding these behind setters and getters)
- // Methods:
- vector<psa_asset*>::iterator resolve_asset (bool create_asset_bool,
- psa_asset_usage where);
- sst_call (tf_fuzz_info *test_state, long &asset_ser_no,
- asset_search how_asset_found); // (constructor)
- ~sst_call (void);
-
-protected:
- // Data members:
- // Methods:
- void calc_result_code (void);
-
-private:
- // Data members:
- // Methods:
-};
-
-class crypto_call : public psa_call
-{
-public:
- // Data members: // (low value in hiding these behind setters and getters)
- // Methods:
- bool copy_asset_to_call (void);
- crypto_call (tf_fuzz_info *test_state, long &asset_ser_no,
- asset_search how_asset_found); // (constructor)
- ~crypto_call (void);
-
-protected:
- // Data members:
- // Methods:
- void calc_result_code (void);
- // for now, the method-overide buck stops here, but that'll probably change
-
-private:
- // Data members:
- // Methods:
-};
-
-class security_call : public psa_call
- /* Strictly speaking, these don't really correspond to PSA calls, so it's a little
- iffy to subclass them from psa_call. However, the calling patterns work out
- right. */
-{
-public:
- // Data members: // (low value in hiding these behind setters and getters)
- // Methods:
- vector<psa_asset*>::iterator resolve_asset (bool create_asset_bool,
- psa_asset_usage where);
- security_call (tf_fuzz_info *test_state, long &asset_ser_no,
- asset_search how_asset_found); // (constructor)
- ~security_call (void);
-
-protected:
- // Data members:
- // Methods:
- void calc_result_code (void);
- // Should never be invoked, since security calls generate no PSA calls.
-
-private:
- // Data members:
- // Methods:
-};
-
-#endif // PSA_CALL_HPP
diff --git a/tools/tf_fuzz/calls/security_call.cpp b/tools/tf_fuzz/calls/security_call.cpp
deleted file mode 100644
index a99496a94..000000000
--- a/tools/tf_fuzz/calls/security_call.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#include <cstdlib>
-
-#include "class_forwards.hpp"
-
-#include "boilerplate.hpp"
-#include "gibberish.hpp"
-#include "compute.hpp"
-#include "randomization.hpp"
-#include "string_ops.hpp"
-#include "data_blocks.hpp"
-#include "psa_asset.hpp"
-#include "find_or_create_asset.hpp"
-#include "template_line.hpp"
-#include "tf_fuzz.hpp"
-#include "crypto_asset.hpp"
-#include "psa_call.hpp"
-#include "security_call.hpp"
-#include "sst_asset.hpp"
-
-
-
-/**********************************************************************************
- Methods of class hash_call follow:
-**********************************************************************************/
-
-hash_call::hash_call (tf_fuzz_info *test_state, // (constructor)
- long &call_ser_no,
- asset_search how_asset_found)
- : security_call(test_state, call_ser_no, how_asset_found)
-{
- call_description = "hash call";
-}
-hash_call::~hash_call (void)
-{
- // Nothing further to delete.
- return; // just to have something to pin a breakpoint onto
-}
-
-bool hash_call::copy_call_to_asset (void)
-{
- // The assets are not directly involved in this call.
- return true;
-}
-
-bool hash_call::copy_asset_to_call (void)
-{
- // The assets are not directly involved in this call.
- return true;
-}
-
-/* Note: These functions are overridden in all subclasses, but they still need to be
- defined, or the linker gives the error "undefined reference to `vtable... */
-void hash_call::fill_in_prep_code (void)
-{
- // No prep code for hash comparisons.
-}
-
-void hash_call::fill_in_command (void)
-{
- if (asset_info.asset_name_vector.size() > 1) { // nothing to compare with less than 2
- // Fill in preceding comment:
- // Fill in the hash-comparison code itself:
- for (auto outer = asset_info.asset_name_vector.begin();
- outer < asset_info.asset_name_vector.end();
- ++outer) {
- for (auto inner = outer+1;
- inner < asset_info.asset_name_vector.end();
- ++inner) {
- call_code.append (" if ( " + *outer + "_act_hash == " + *inner
- + "_act_hash) {\n");
- call_code.append ( " TEST_FAIL(\"Probable data leak between assets "
- + *outer + " and " + *inner + ".\\n\");\n");
- call_code.append (" return;\n");
- call_code.append (" }\n");
- // TODO: Pull this from boilerplate!!
- }
- }
- } else {
- call_code.assign (" /* Cannot compare hashes; only one asset specified. */\n");
-
- }
-}
-
-/**********************************************************************************
- End of methods of class hash_call.
-**********************************************************************************/
diff --git a/tools/tf_fuzz/calls/security_call.hpp b/tools/tf_fuzz/calls/security_call.hpp
deleted file mode 100644
index e55a27830..000000000
--- a/tools/tf_fuzz/calls/security_call.hpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#ifndef SECURITY_CALL_HPP
-#define SECURITY_CALL_HPP
-
-#include <string>
-#include <vector>
-
-/* This project's header files #including other project headers quickly becomes
- unrealistically complicated. The only solution is for each .cpp to include
- the headers it needs. */
-
-
-using namespace std;
-
-class hash_call : public security_call
-{
-public:
- // Data members: // (low value in hiding these behind setters and getters)
- // Methods:
- bool copy_call_to_asset (void);
- bool copy_asset_to_call (void);
- void fill_in_prep_code (void);
- void fill_in_command (void);
- /* Hash checks are different from the rest in that there's a single "call" --
- not a PSA call though -- for all of the assets cited in the template line.
- In other cases, create a single call for each asset cited by the template
- line, but in this case it's a single call for all of them. */
- hash_call (tf_fuzz_info *test_state, long &asset_ser_no,
- asset_search how_asset_found); // (constructor)
- ~hash_call (void);
-
-protected:
- // Data members:
- // Methods:
-// void calc_result_code (void); for *now* keep this in security_call::
-
-private:
- // Data members:
- // Methods:
-};
-
-#endif // #ifndef SECURITY_CALL_HPP
diff --git a/tools/tf_fuzz/calls/sst_call.cpp b/tools/tf_fuzz/calls/sst_call.cpp
deleted file mode 100644
index 9aa776294..000000000
--- a/tools/tf_fuzz/calls/sst_call.cpp
+++ /dev/null
@@ -1,492 +0,0 @@
-/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#include "class_forwards.hpp"
-
-#include "boilerplate.hpp"
-#include "gibberish.hpp"
-#include "compute.hpp"
-#include "string_ops.hpp"
-#include "data_blocks.hpp"
-#include "psa_asset.hpp"
-#include "find_or_create_asset.hpp"
-#include "template_line.hpp"
-#include "tf_fuzz.hpp"
-#include "crypto_asset.hpp"
-#include "psa_call.hpp"
-#include "sst_call.hpp"
-#include "sst_asset.hpp"
-#include "crypto_asset.hpp"
-#include "variables.hpp"
-
-
-
-/**********************************************************************************
- Methods of class sst_set_call follow:
-**********************************************************************************/
-
-sst_set_call::sst_set_call (tf_fuzz_info *test_state, // (constructor)
- long &call_ser_no,
- asset_search how_asset_found)
- : sst_call(test_state, call_ser_no, how_asset_found)
-{
- // Copy the boilerplate text into local buffers:
- prep_code.assign (""); // will fill in, depending upon template line content
- call_code.assign (test_state->bplate->bplate_string[set_sst_call]);
- check_code.assign (test_state->bplate->bplate_string[set_sst_check]);
- call_description = "SST-set call";
-}
-sst_set_call::~sst_set_call (void)
-{
- return; // just to have something to pin a breakpoint onto
-}
-
-bool sst_set_call::copy_call_to_asset (void)
-{
- vector<psa_asset*>::iterator found_asset;
-
- found_asset = resolve_asset (yes_create_asset, psa_asset_usage::all);
- // Copy over everything relevant:
- if (asset_info.how_asset_found != asset_search::not_found) {
- asset_info.the_asset = reinterpret_cast<sst_asset*>(*found_asset);
- /* Note: The vector is base-class, but the assets in this list
- themselves *really are* sst_asset-type objects. */
- int i = asset_info.the_asset->set_data.n_set_vars; // save this
- asset_info.the_asset->set_data = set_data; // TO DO: does this make sense?!
- asset_info.the_asset->set_data.n_set_vars = set_data.n_set_vars = ++i;
- asset_info.the_asset->set_data.flags_string.assign (set_data.flags_string);
- if (asset_info.how_asset_found == asset_search::created_new) {
- asset_info.the_asset->asset_info.name_specified = asset_info.name_specified;
- asset_info.the_asset->asset_info.set_name (asset_info.get_name());
- asset_info.the_asset->asset_info.asset_ser_no = asset_info.asset_ser_no;
- asset_info.the_asset->asset_info.id_n = asset_info.id_n;
- }
- }
- return true;
-}
-
-bool sst_set_call::copy_asset_to_call (void)
-{
- // Get updated asset info from the asset:
- asset_info.asset_ser_no = asset_info.the_asset->asset_info.asset_ser_no;
- asset_info.id_n = asset_info.the_asset->asset_info.id_n;
- exp_data.n_exp_vars = asset_info.the_asset->exp_data.n_exp_vars;
- exp_data.data = asset_info.the_asset->exp_data.data;
- return true;
-}
-
-void sst_set_call::fill_in_prep_code (void)
-{
- string var_name, length_var_name, var_name_suffix, length_var_name_suffix,
- temp_string;
- vector<variable_info>::iterator assign_variable;
-
- if (assign_data_var_specified) {
- var_name.assign (assign_data_var + "_data");
- length_var_name.assign (assign_data_var + "_length");
- /* If actual-data variable doesn't already exist, create variable tracker,
- and write declaration for it: */
- assign_variable = test_state->find_var (assign_data_var);
- if (assign_variable == test_state->variable.end()) {
- // No such variable exists, so:
- test_state->make_var (assign_data_var);
- assign_variable = test_state->find_var (assign_data_var);
- prep_code.append (test_state->bplate->bplate_string[declare_big_string]);
- find_replace_1st ("$var", var_name, prep_code);
- temp_string = (char *) assign_variable->value;
- find_replace_1st ("$init", temp_string, prep_code);
- // Actual-data length:
- prep_code.append (test_state->bplate->bplate_string[declare_size_t]);
- find_replace_1st ("$var", length_var_name, prep_code);
- find_replace_1st ("$init", to_string(temp_string.length()), prep_code);
- // Offset (always 0 for now):
- find_replace_1st ("$offset", "0", prep_code);
- }
- } else {
- // Single string of two lines declaring string data and its length:
- var_name_suffix = "_set_data";
- length_var_name_suffix = "_set_length";
- if (set_data.n_set_vars > 0) {
- var_name_suffix += "_" + to_string(set_data.n_set_vars);
- length_var_name_suffix += "_" + to_string(set_data.n_set_vars);
- // We'll increment set_data.n_set_vars after we fill in the call itself.
- }
- var_name.assign (asset_info.get_name() + var_name_suffix);
- length_var_name.assign (asset_info.get_name() + length_var_name_suffix);
- prep_code = test_state->bplate->bplate_string[declare_string];
- find_replace_1st ("$var", var_name, prep_code);
- find_replace_1st ("$init", set_data.get(), prep_code);
- temp_string.assign (test_state->bplate->bplate_string[declare_int]);
- find_replace_1st ("static int", "static uint32_t", temp_string);
- prep_code.append (temp_string);
- find_replace_1st ("$var", length_var_name, prep_code);
- find_replace_1st ("$init", to_string(set_data.get().length()), prep_code);
- }
-}
-
-void sst_set_call::fill_in_command (void)
-{
- string var_name, length_var_name, var_name_suffix, length_var_name_suffix,
- temp_string;
-
- // Fill in preceding comment:
- if (asset_info.how_asset_found == asset_search::created_new) {
- find_replace_1st ("$op", "Creating", call_code);
- } else {
- find_replace_1st ("$op", "Resetting", call_code);
- }
- if (asset_info.name_specified) {
- find_replace_1st ("$description", "\"" + asset_info.get_name() + ",\"",
- call_code);
- } else {
- find_replace_1st ("$description",
- "UID = " + to_string((long) asset_info.id_n), call_code);
- }
- if (set_data.string_specified) {
- find_replace_1st ("$data_source",
- "\"" + set_data.get().substr (0, 10) + "...\"",
- call_code);
- } else if (set_data.file_specified) {
- find_replace_1st ("$data_source", "from file " + set_data.file_path,
- call_code);
- } else {
- find_replace_1st (" $data_source", "", call_code);
- }
- // Fill in the PSA command itself:
- if (assign_data_var_specified) {
- var_name.assign (assign_data_var + "_data");
- length_var_name.assign (assign_data_var + "_length");
- } else {
- var_name_suffix = "_set_data";
- if (set_data.n_set_vars > 0) {
- var_name_suffix += "_" + to_string(set_data.n_set_vars);
- }
- var_name.assign (asset_info.get_name() + var_name_suffix);
- length_var_name_suffix = "_set_length";
- if (set_data.n_set_vars > 0) {
- length_var_name_suffix += "_" + to_string(set_data.n_set_vars);
- }
- length_var_name.assign (asset_info.get_name() + length_var_name_suffix);
- }
- find_replace_1st ("$data", var_name, call_code);
- find_replace_1st ("$flags", set_data.flags_string, call_code);
- string id_string = to_string((long) asset_info.id_n);
- find_replace_1st ("$uid", id_string, call_code);
- find_replace_1st ("$length", length_var_name, call_code);
- // Figure out what expected results:
- if ( set_data.flags_string == "PSA_STORAGE_FLAG_WRITE_ONCE"
- && set_data.n_set_vars > 0) {
- exp_data.pf_specified = true;
- exp_data.pf_result_string = "PSA_ERROR_NOT_PERMITTED";
- }
- calc_result_code();
-}
-
-/**********************************************************************************
- End of methods of class sst_set_call.
-**********************************************************************************/
-
-
-/**********************************************************************************
- Methods of class sst_get_call follow:
-**********************************************************************************/
-
-sst_get_call::sst_get_call (tf_fuzz_info *test_state, // (constructor)
- long &call_ser_no,
- asset_search how_asset_found)
- : sst_call(test_state, call_ser_no, how_asset_found)
-{
- // Copy the boilerplate text into local buffers:
- prep_code.assign ("");
- call_code.assign (test_state->bplate->bplate_string[get_sst_call]);
- check_code.assign ("");
- // depends upon the particular usage; will get it in fill_in_command()
- call_description = "SST-get call";
-}
-sst_get_call::~sst_get_call (void)
-{
- return; // just to have something to pin a breakpoint onto
-}
-
-bool sst_get_call::copy_call_to_asset (void)
-{
- vector<psa_asset*>::iterator found_asset;
-
- found_asset = resolve_asset (dont_create_asset, psa_asset_usage::active);
- if (asset_info.how_asset_found != asset_search::not_found) {
- // will be found for set calls, but not necessarily others
- asset_info.the_asset = reinterpret_cast<sst_asset*>(*found_asset);
- // Note: Vector is of base-class type, but the assets *are* sst_asset.
- /* Locating the asset is all we need to do here; copy_asset_to_call() will
- do the rest. */
- }
- return true;
- // TODO: Shouldn't data be copied over?
-}
-
-bool sst_get_call::copy_asset_to_call (void)
-{
- if (asset_info.the_asset != nullptr) {
- // will be found for set calls, but not necessarily others
- set_data.string_specified = asset_info.the_asset->set_data.string_specified;
- set_data.file_specified = asset_info.the_asset->set_data.file_specified;
- set_data.set (asset_info.the_asset->set_data.get());
- set_data.flags_string = asset_info.the_asset->set_data.flags_string;
- asset_info.id_n = asset_info.the_asset->asset_info.id_n;
- asset_info.asset_ser_no = asset_info.the_asset->asset_info.asset_ser_no;
- asset_info.name_specified = asset_info.the_asset->asset_info.name_specified;
- asset_info.the_asset->exp_data.n_exp_vars++;
- exp_data.n_exp_vars = asset_info.the_asset->exp_data.n_exp_vars;
- }
- return true;
-}
-
-void sst_get_call::fill_in_prep_code (void)
-{
- string var_base, var_name, length_var_name, temp_string, var_name_suffix,
- expected;
- vector<variable_info>::iterator act_variable, exp_variable;
-
- if (!(print_data || hash_data)) {
- // Checking asset data verbatim against expected, so:
- if (exp_data.data_var_specified) {
- // Template specified a variable name to "check" against; use that:
- var_base.assign (exp_data.data_var);
- exp_variable = test_state->find_var (var_base);
- if (exp_variable == test_state->variable.end()) {
- test_state->make_var (var_base);
- exp_variable = test_state->find_var (var_base);
- var_name = var_base + "_data";
- prep_code.append (test_state->bplate->bplate_string[declare_string]);
- find_replace_1st ("$var", var_name, prep_code);
- temp_string = (char *) exp_variable->value;
- find_replace_1st ("$init", temp_string, prep_code);
- // Expected-data length:
- temp_string.assign (test_state->bplate->bplate_string[declare_int]);
- find_replace_1st ("static int", "static size_t", temp_string);
- }
- } else {
- if (exp_data.data_specified) {
- // Checking against literal expected data:
- expected.assign (exp_data.data);
- } else {
- // Check against what we believe the asset to contain:
- expected.assign (set_data.get());
- }
- var_name_suffix = "_exp_data";
- if (exp_data.n_exp_vars > 0) {
- var_name_suffix =
- var_name_suffix + "_" + to_string(exp_data.n_exp_vars);
- }
- var_name.assign (asset_info.get_name() + var_name_suffix);
- prep_code.assign(test_state->bplate->bplate_string[declare_string]);
- find_replace_1st("$var", var_name, prep_code);
- find_replace_1st("$init", expected, prep_code);
- }
- }
- // Actual data:
- if (assign_data_var_specified) {
- var_base.assign (assign_data_var);
- } else {
- var_base.assign (asset_info.get_name() + "_act");
- }
- var_name.assign (var_base + "_data");
- length_var_name.assign (var_base + "_length");
- /* If actual-data variable doesn't already exist, create variable tracker,
- and write declaration for it: */
- act_variable = test_state->find_var (var_base);
- if (act_variable == test_state->variable.end()) {
- test_state->make_var (var_base);
- act_variable = test_state->find_var (var_base);
- prep_code.append (test_state->bplate->bplate_string[declare_big_string]);
- find_replace_1st ("$var", var_name, prep_code);
- temp_string = (char *) act_variable->value;
- find_replace_1st ("$init", temp_string, prep_code);
- // Actual-data length:
- temp_string.assign (test_state->bplate->bplate_string[declare_int]);
- find_replace_1st ("static int", "static size_t", temp_string);
- prep_code.append (temp_string);
- find_replace_1st ("$var", length_var_name, prep_code);
- find_replace_1st ("$init", to_string(temp_string.length()), prep_code);
- // Offset (always 0 for now):
- find_replace_1st ("$offset", "0", prep_code);
- }
- // If hashing the (actual) data, then create a variable for that:
- if (hash_data && !act_variable->hash_declared) {
- var_name = var_base + "_hash";
- prep_code.append (test_state->bplate->bplate_string[declare_generic]);
- // where to put the hash of the data
- find_replace_1st ("$type", "uint32_t", prep_code);
- find_replace_1st ("$var", var_name, prep_code);
- find_replace_1st ("$init", "0", prep_code); // for now...
- act_variable->hash_declared = true;
- }
-}
-
-void sst_get_call::fill_in_command (void)
-{
- string exp_var_name, act_var_name, act_data_length, hash_var_name,
- id_string, var_name_suffix;
-
-/* TODO: Flesh-out/fix this (it was a good try/start, but not quite right):
- // Fill in preceding comment:
- if (asset_info.how_asset_found == asset_search::created_new) {
- find_replace_1st ("$op", "Creating", call_code);
- } else {
- find_replace_1st ("$op", "Resetting", call_code);
- }
- if (asset_info.name_specified) {
- find_replace_1st ("$description", "\"" + asset_info.get_name() + ",\"",
- call_code);
- } else {
- find_replace_1st ("$description",
- "UID = " + to_string((long) asset_info.id_n), call_code);
- }
- if (set_data.string_specified) {
- find_replace_1st ("$data_source",
- "\"" + data.substr (0, 10) + "...\"",
- call_code);
- } else if (set_data.file_specified) {
- find_replace_1st ("$data_source", "from file " + set_data.file_path,
- call_code);
- } else {
- find_replace_1st (" $data_source", "", call_code);
- }
-*/ // Fill in the call itself:
- if (print_data || hash_data) {
- // Dump to variable; no data-check code needed:
- check_code.assign (test_state->bplate->bplate_string[get_sst_check]);
- } else {
- // Check either against literal or variable, so need data-check code too:
- check_code.assign (test_state->bplate->bplate_string[get_sst_check_all]);
- }
- /* Note: Can fill in the check code identically between the dump-to-variable
- and check-data cases, because the boilerplate for the former is just an
- abbreviated version of the latter. The find_replace_1st() calls for
- the check-data stuff will just simply not have any effect. */
- if (exp_data.data_var_specified) {
- // Check against data in variable:
- exp_var_name.assign (exp_data.data_var + "_data");
- } else {
- var_name_suffix = "_exp_data";
- if (exp_data.n_exp_vars > 0) {
- var_name_suffix =
- var_name_suffix + "_" + to_string(exp_data.n_exp_vars);
- }
- exp_var_name.assign (asset_info.get_name() + var_name_suffix);
- }
- if (assign_data_var_specified) {
- act_var_name.assign (assign_data_var + "_data");
- act_data_length.assign (assign_data_var + "_length");
- } else {
- act_var_name.assign (asset_info.get_name() + "_act_data");
- act_data_length.assign (asset_info.get_name() + "_act_length");
- }
-
- id_string = to_string((long) asset_info.id_n);
- // Fill in the PSA command itself:
- find_replace_1st ("$uid", id_string, call_code);
- find_replace_all ("$length", to_string(set_data.get().length()), call_code);
- find_replace_1st ("$offset", to_string(set_data.data_offset), call_code);
- find_replace_1st ("$exp_data", exp_var_name, call_code);
- find_replace_all ("$act_data", act_var_name, call_code);
- find_replace_all ("$act_length", act_data_length, call_code);
- // Perform most of the same substitutions in the check_code:
-// TODO: Make data checks contingent upon the PSA call itself passing?
- find_replace_1st ("$offset", "0", check_code);
- find_replace_1st ("$exp_data", exp_var_name, check_code);
- find_replace_all ("$act_data", act_var_name, check_code);
- find_replace_all ("$length", act_data_length, check_code);
- if (print_data) {
- check_code.append (test_state->bplate->bplate_string[test_log]);
- find_replace_1st ("$message", act_var_name, check_code);
- }
- if (hash_data) {
- hash_var_name.assign (asset_info.get_name() + "_act_hash");
- // this is where to put the hash of the data
- check_code.append (test_state->bplate->bplate_string[get_sst_hash]);
- find_replace_all ("$act_data_var", act_var_name, check_code);
- find_replace_all ("$hash_var", hash_var_name, check_code);
- }
- // Figure out what expected results:
- calc_result_code(); // this only fills $expect check_code
- // Fill in expected data, actual data, and length:
-}
-
-/**********************************************************************************
- End of methods of class sst_get_call.
-**********************************************************************************/
-
-
-/**********************************************************************************
- Methods of class sst_remove_call follow:
-**********************************************************************************/
-
-sst_remove_call::sst_remove_call (tf_fuzz_info *test_state, // (constructor)
- long &call_ser_no,
- asset_search how_asset_found)
- : sst_call(test_state, call_ser_no, how_asset_found)
-{
- // Copy the boilerplate text into local buffers:
- prep_code.assign ("");
- call_code.assign (test_state->bplate->bplate_string[remove_sst]);
- check_code.assign (test_state->bplate->bplate_string[remove_sst_check]);
- call_description = "SST-remove call";
-}
-sst_remove_call::~sst_remove_call (void)
-{
- return; // just to have something to pin a breakpoint onto
-}
-
-bool sst_remove_call::copy_call_to_asset (void)
-{
- vector<psa_asset*>::iterator found_asset;
-
- found_asset = resolve_asset (dont_create_asset, psa_asset_usage::all);
- if (asset_info.how_asset_found != asset_search::not_found) {
- asset_info.the_asset = reinterpret_cast<sst_asset*>(*found_asset);
- // Note: Vector is of base-class type, but the assets *are* sst_asset.
- if (asset_info.how_asset_found == asset_search::found_active) {
- // Delete asset; move it from active vector to deleted vector:
- test_state->deleted_sst_asset.push_back (asset_info.the_asset);
- test_state->active_sst_asset.erase (found_asset);
- } /* if not active, we'll deem the call expected to fail. */
- }
- return true;
-}
-
-bool sst_remove_call::copy_asset_to_call (void)
-{
- if (asset_info.the_asset != nullptr) {
- set_data.string_specified = asset_info.the_asset->set_data.string_specified;
- set_data.file_specified = asset_info.the_asset->set_data.file_specified;
- set_data.flags_string = asset_info.the_asset->set_data.flags_string;
- asset_info.id_n = asset_info.the_asset->asset_info.id_n;
- asset_info.name_specified = asset_info.the_asset->asset_info.name_specified;
- }
- return true;
-}
-
-void sst_remove_call::fill_in_prep_code (void)
-{
- // No prep-code.
- return; // just to have something to pin a breakpoint onto
-}
-
-void sst_remove_call::fill_in_command (void)
-{
- // Fill in the call:
- string id_string = to_string((long) asset_info.id_n);
- find_replace_1st ("$uid", id_string, call_code);
- // Fill in expected results:
- calc_result_code(); // this only fills $expect check_code
-}
-
-/**********************************************************************************
- End of methods of class sst_remove_call.
-**********************************************************************************/
-
diff --git a/tools/tf_fuzz/calls/sst_call.hpp b/tools/tf_fuzz/calls/sst_call.hpp
deleted file mode 100644
index 537b21fc9..000000000
--- a/tools/tf_fuzz/calls/sst_call.hpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#ifndef SST_CALL_HPP
-#define SST_CALL_HPP
-
-#include <string>
-#include <vector>
-#include <cstdint>
-
-/* This project's header files #including other project headers quickly becomes
- unrealistically complicated. The only solution is for each .cpp to include
- the headers it needs.
-#include "sst_asset.hpp"
-#include "psa_call.hpp"
-*/
-
-
-using namespace std;
-
-class sst_set_call : public sst_call
-{
-public:
- // Data members:
- // Methods:
- bool copy_call_to_asset (void);
- bool copy_asset_to_call (void);
- void fill_in_prep_code (void);
- void fill_in_command (void);
- sst_set_call (tf_fuzz_info *test_state, long &asset_ser_no,
- asset_search how_asset_found); // (constructor)
- ~sst_set_call (void);
-
-protected:
- // Data members:
- // Methods:
-
-private:
- // Data members:
- // Methods:
-};
-
-
-class sst_get_call : public sst_call
-{
-public:
- // Data members:
- uint32_t offset;
- uint32_t data_length;
- string data_var_name;
- // Methods:
- bool copy_call_to_asset (void);
- bool copy_asset_to_call (void);
- void fill_in_prep_code (void);
- void fill_in_command (void);
- sst_get_call (tf_fuzz_info *test_state, long &asset_ser_no,
- asset_search how_asset_found); // (constructor)
- ~sst_get_call (void);
-
-protected:
- // Data members:
- // Methods:
-
-private:
- // Data members:
- // Methods:
-};
-
-class sst_remove_call : public sst_call
-{
-public:
- // Data members:
- // Methods:
- bool copy_call_to_asset (void);
- bool copy_asset_to_call (void);
- void fill_in_prep_code (void);
- void fill_in_command (void);
- sst_remove_call (tf_fuzz_info *test_state, long &asset_ser_no,
- asset_search how_asset_found); // (constructor)
- ~sst_remove_call (void);
-
-protected:
- // Data members:
- // Methods:
-
-private:
- // Data members:
- // Methods:
-};
-
-#endif // SST_CALL_HPP
-
diff --git a/tools/tf_fuzz/class_forwards.hpp b/tools/tf_fuzz/class_forwards.hpp
deleted file mode 100644
index 6099fbea9..000000000
--- a/tools/tf_fuzz/class_forwards.hpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-/* The .hpp files in this project being so self-referential, this file forward-
- declares all classes before any are attempted to be used. */
-
-#ifndef CLASS_FORWARDS_HPP
-#define CLASS_FORWARDS_HPP
-
-using namespace std;
-
-// find_or_create_asset.hpp:
-enum class asset_search;
-enum class psa_asset_usage;
-enum class psa_asset_search;
-enum class psa_asset_type;
-
-// data_blocks.hpp:
-class expect_info;
-class set_data_info;
-class asset_name_id_info;
-
-// variables.hpp:
-class variable_info;
-
-// template_line.hpp:
-class template_line;
-class sst_template_line;
-class key_template_line;
-class policy_template_line;
-
-// sst_template_line.hpp:
-class set_sst_template_line;
-class remove_sst_template_line;
-class read_sst_template_line;
-
-// crypto_template_line.hpp:
-class set_key_template_line;
-class remove_key_template_line;
-class read_key_template_line;
-class set_policy_template_line;
-class read_policy_template_line;
-
-// security.hpp:
-class security;
-class security_hash;
-
-// psa_call.hpp:
-class psa_call;
-class sst_call;
-class crypto_call;
-
-// sst_call.hpp:
-class sst_set_call;
-class sst_get_call;
-class sst_remove_call;
-
-// crypto_call.hpp:
-class policy_call;
-class key_call;
-class init_policy_call;
-class reset_policy_call;
-class set_policy_usage_call;
-class add_policy_usage_call;
-class set_policy_lifetime_call;
-class set_policy_algorithm_call;
-class set_policy_size_call;
-class set_policy_type_call;
-class get_policy_lifetime_call;
-class get_policy_size_call;
-class get_policy_type_call;
-class get_policy_algorithm_call;
-class get_policy_usage_call;
-class print_policy_usage_call;
-class get_key_policy_call;
-class generate_key_call;
-class create_key_call;
-class copy_key_call;
-class read_key_data_call;
-class remove_key_call;
-
-
-// ************************ INSERT THE NEW STUFF HERE!!
-
-
-class destroy_key_call;
-
-// psa_asset.hpp:
-class psa_asset;
-
-// sst_asset.hpp:
-class sst_asset;
-
-// crypto_asset.hpp:
-class crypto_asset;
-class key_asset;
-class policy_asset;
-class key_asset;
-
-// boilerplate.hpp"
-//enum class boilerplate_texts; not really a "class," and no need to forward-reference it anyway
-class boilerplate;
-
-// gibberish.hpp:
-class gibberish;
-
-// tf_fuzz.hpp:
-class tf_fuzz_info;
-
-#endif // #ifndef CLASS_FORWARDS_HPP
diff --git a/tools/tf_fuzz/demo/1 b/tools/tf_fuzz/demo/1
deleted file mode 100644
index 7b84f1103..000000000
--- a/tools/tf_fuzz/demo/1
+++ /dev/null
@@ -1,2 +0,0 @@
-purpose to create an SST asset;
-set sst uid 104 data "Very simple test" expect pass;
diff --git a/tools/tf_fuzz/demo/10 b/tools/tf_fuzz/demo/10
deleted file mode 100644
index 3e70099ac..000000000
--- a/tools/tf_fuzz/demo/10
+++ /dev/null
@@ -1,2 +0,0 @@
-purpose to show what happens when you 'read' a non-existent asset;
-read sst name napoleon check "this won't work";
diff --git a/tools/tf_fuzz/demo/11 b/tools/tf_fuzz/demo/11
deleted file mode 100644
index 5fdd0fcd4..000000000
--- a/tools/tf_fuzz/demo/11
+++ /dev/null
@@ -1,2 +0,0 @@
-purpose to illustrate that you can override TF-Fuzz's expected result;
-read sst name napoleon check "this won't work" expect pass;
diff --git a/tools/tf_fuzz/demo/12 b/tools/tf_fuzz/demo/12
deleted file mode 100644
index c7825c5c7..000000000
--- a/tools/tf_fuzz/demo/12
+++ /dev/null
@@ -1,2 +0,0 @@
-purpose to more-specifically override TF-Fuzz's expected result;
-read sst name napoleon check "this won't work" expect PSA_ERROR_GENERIC_ERROR;
diff --git a/tools/tf_fuzz/demo/12.5 b/tools/tf_fuzz/demo/12.5
deleted file mode 100644
index 2e7004bd3..000000000
--- a/tools/tf_fuzz/demo/12.5
+++ /dev/null
@@ -1,2 +0,0 @@
-purpose to more-specifically override TF-Fuzz's expected result;
-read sst name napoleon check "this won't work" expect generic_error;
diff --git a/tools/tf_fuzz/demo/13 b/tools/tf_fuzz/demo/13
deleted file mode 100644
index 7edb72e5b..000000000
--- a/tools/tf_fuzz/demo/13
+++ /dev/null
@@ -1,4 +0,0 @@
-purpose to illustrate deleting assets;
-set sst name george data *;
-remove sst name george;
-rm sst name george;
diff --git a/tools/tf_fuzz/demo/14 b/tools/tf_fuzz/demo/14
deleted file mode 100644
index 5b9485ca0..000000000
--- a/tools/tf_fuzz/demo/14
+++ /dev/null
@@ -1,3 +0,0 @@
-purpose to remove something that doesn't exist;
-set sst name george data *;
-remove sst name ringo;
diff --git a/tools/tf_fuzz/demo/15 b/tools/tf_fuzz/demo/15
deleted file mode 100644
index 613439e69..000000000
--- a/tools/tf_fuzz/demo/15
+++ /dev/null
@@ -1,3 +0,0 @@
-purpose to show a more-interesting removal case;
-set sst name president george herbert walker bush data "read my lips";
-remove sst *active; // remove *some* active asset
diff --git a/tools/tf_fuzz/demo/16 b/tools/tf_fuzz/demo/16
deleted file mode 100644
index 528a0ece4..000000000
--- a/tools/tf_fuzz/demo/16
+++ /dev/null
@@ -1,6 +0,0 @@
-purpose to show a more-interesting removal case;
-set sst name president george herbert walker bush data "no new taxes";
-remove sst *active; // remove *some* active asset
-rm sst *active; // remove *some other* active asset
-remove sst *act; // remove *yet another* active asset
-rm sst *del; // attempt to remove some asset that's already been removed
diff --git a/tools/tf_fuzz/demo/17 b/tools/tf_fuzz/demo/17
deleted file mode 100644
index bdaeecefe..000000000
--- a/tools/tf_fuzz/demo/17
+++ /dev/null
@@ -1,8 +0,0 @@
-purpose to try some more-complex randomization;
-set sst name neil buzz mike data *;
-2 to 5 of {
- set sst name neil data "that's one small step for [a] man";
- remove sst *active;
- set sst name chris kraft data "wear the helmet";
- remove sst name neil;
-}
diff --git a/tools/tf_fuzz/demo/18 b/tools/tf_fuzz/demo/18
deleted file mode 100644
index f71335eab..000000000
--- a/tools/tf_fuzz/demo/18
+++ /dev/null
@@ -1,9 +0,0 @@
-purpose to shuffle the deck;
-set sst name Shiva Brahma Vishnu Ganapati data *;
-shuffle {
- remove sst *active;
- set sst name Brahma data "I am the creator";
- set sst name Shiva data "I am the destroyer";
- set sst name Vishnu data "I am the sustainer";
- remove sst name Ganapati;
-}
diff --git a/tools/tf_fuzz/demo/19 b/tools/tf_fuzz/demo/19
deleted file mode 100644
index 173c45d0c..000000000
--- a/tools/tf_fuzz/demo/19
+++ /dev/null
@@ -1,4 +0,0 @@
-purpose to show the early beginnings of security testing;
-set sst name charles babbage ada lovelace analytic engine alan turing bomb eniac edvac data *;
-read sst name charles babbage ada lovelace analytic engine alan turing bomb eniac edvac hash;
-secure hash neq charles babbage ada lovelace analytic engine alan turing bomb eniac edvac;
diff --git a/tools/tf_fuzz/demo/2 b/tools/tf_fuzz/demo/2
deleted file mode 100644
index 9af02c66c..000000000
--- a/tools/tf_fuzz/demo/2
+++ /dev/null
@@ -1,2 +0,0 @@
-purpose to give assets a human name;
-set sst name forecast data "cloudy with a 20% chance of weather" expect nothing;
diff --git a/tools/tf_fuzz/demo/20 b/tools/tf_fuzz/demo/20
deleted file mode 100644
index 6fda99a58..000000000
--- a/tools/tf_fuzz/demo/20
+++ /dev/null
@@ -1,14 +0,0 @@
-purpose to show that pretty short templates can produce a whole lot of varying test code;
-set sst name charles babbage ada lovelace alan turing bomb eniac edvac data *;
-read sst name charles babbage ada lovelace alan turing bomb eniac edvac hash;
-secure hash neq charles babbage ada lovelace alan turing bomb eniac edvac;
-remove sst *active;
-5 to 10 of {
- set sst name * data *;
- remove sst *active;
- set sst name babbles charage data "I'm confused!";
- set sst name alace adlove data "wait, something's still not right here...";
- remove sst name turing;
- set sst name charles babbage data "that's better";
- remove sst *deleted;
-}
diff --git a/tools/tf_fuzz/demo/21 b/tools/tf_fuzz/demo/21
deleted file mode 100644
index 8a609e213..000000000
--- a/tools/tf_fuzz/demo/21
+++ /dev/null
@@ -1,2 +0,0 @@
-purpose to define a policy mostly-default (random) policy;
-set policy name nothingMuch attr export volatile;
diff --git a/tools/tf_fuzz/demo/22 b/tools/tf_fuzz/demo/22
deleted file mode 100644
index fba0d5321..000000000
--- a/tools/tf_fuzz/demo/22
+++ /dev/null
@@ -1,2 +0,0 @@
-purpose to create a policy with random name, with type and algorithm using abbreviated keywords;
-set policy name * type rsa_public_key alg rsa_pss_base;
diff --git a/tools/tf_fuzz/demo/23 b/tools/tf_fuzz/demo/23
deleted file mode 100644
index deb35b2de..000000000
--- a/tools/tf_fuzz/demo/23
+++ /dev/null
@@ -1,2 +0,0 @@
-purpose to create multiple policies with attributes including key size (523);
-set policy name aPolicy anotherPolicy yetAnother alg sha_256 attr 523 noexport;
diff --git a/tools/tf_fuzz/demo/24 b/tools/tf_fuzz/demo/24
deleted file mode 100644
index dddc8f386..000000000
--- a/tools/tf_fuzz/demo/24
+++ /dev/null
@@ -1,3 +0,0 @@
-purpose to create a default (random) policy and then print it to the log;
-set policy name randomPolicy;
-read policy name randomPolicy print;
diff --git a/tools/tf_fuzz/demo/25 b/tools/tf_fuzz/demo/25
deleted file mode 100644
index 912019ca5..000000000
--- a/tools/tf_fuzz/demo/25
+++ /dev/null
@@ -1,3 +0,0 @@
-purpose to create a default (random) policy and create a key using it (no key material specified);
-set policy name randomPolicy;
-set key name akey policy randomPolicy;
diff --git a/tools/tf_fuzz/demo/26 b/tools/tf_fuzz/demo/26
deleted file mode 100644
index 9093bd131..000000000
--- a/tools/tf_fuzz/demo/26
+++ /dev/null
@@ -1,4 +0,0 @@
-purpose to create a default (random) policy and create a key using it (random key data specified), then copy that key with another random policy;
-set policy name randomPolicy anotherPolicy;
-set key name aKey policy randomPolicy data *;
-set key name aNewKey from aKey policy anotherPolicy;
diff --git a/tools/tf_fuzz/demo/27 b/tools/tf_fuzz/demo/27
deleted file mode 100644
index 76a62c854..000000000
--- a/tools/tf_fuzz/demo/27
+++ /dev/null
@@ -1,4 +0,0 @@
-purpose to do the same sort of things as #26, but change around operands;
-set policy name randomPolicy anotherPolicy;
-set key name aKey data * policy randomPolicy;
-set key name aNewKey from *active policy anotherPolicy;
diff --git a/tools/tf_fuzz/demo/28 b/tools/tf_fuzz/demo/28
deleted file mode 100644
index e9fd0d857..000000000
--- a/tools/tf_fuzz/demo/28
+++ /dev/null
@@ -1,4 +0,0 @@
-purpose to create a key, then read the key data ("material") into a variable;
-set policy name somePolicy alg sha3_224 attr noexport volatile;
-set key name aKey data * policy somePolicy;
-read key name aKey var keyDataVar;
diff --git a/tools/tf_fuzz/demo/29 b/tools/tf_fuzz/demo/29
deleted file mode 100644
index 072b30d30..000000000
--- a/tools/tf_fuzz/demo/29
+++ /dev/null
@@ -1,4 +0,0 @@
-purpose to create a key, then read the key data ("material") into a variable;
-set policy name somePolicy attr copy decrypt persistent alg xts;
-set key name aKey data * policy somePolicy;
-read key name aKey check keyDataVar expect fail;
diff --git a/tools/tf_fuzz/demo/3 b/tools/tf_fuzz/demo/3
deleted file mode 100644
index 8f41603cb..000000000
--- a/tools/tf_fuzz/demo/3
+++ /dev/null
@@ -1,2 +0,0 @@
-purpose to show that TF-Fuzz can infer results;
-set sst name john data "Take a holiday in Spain";
diff --git a/tools/tf_fuzz/demo/30 b/tools/tf_fuzz/demo/30
deleted file mode 100644
index 47ebe4c00..000000000
--- a/tools/tf_fuzz/demo/30
+++ /dev/null
@@ -1,4 +0,0 @@
-purpose to create a key, then read the key data ("material") into a variable;
-set policy name somePolicy alg rsa_pkcs1v15_sign_base attr derive noverify;
-set key name aKey data * policy somePolicy;
-read key name aKey check "12345678" expect fail;
diff --git a/tools/tf_fuzz/demo/31 b/tools/tf_fuzz/demo/31
deleted file mode 100644
index 18039a0d9..000000000
--- a/tools/tf_fuzz/demo/31
+++ /dev/null
@@ -1,4 +0,0 @@
-purpose to create a key, then read the key data ("material") into a variable;
-set policy name somePolicy attr sign verify copy alg arc4;
-set key name aKey data * policy somePolicy;
-read key name aKey print;
diff --git a/tools/tf_fuzz/demo/32 b/tools/tf_fuzz/demo/32
deleted file mode 100644
index 533fcf53f..000000000
--- a/tools/tf_fuzz/demo/32
+++ /dev/null
@@ -1,4 +0,0 @@
-purpose to create then remove a key;
-set policy name somePolicy attr sign verify copy alg arc4;
-set key name aKey data * policy somePolicy;
-remove key name aKey;
diff --git a/tools/tf_fuzz/demo/33 b/tools/tf_fuzz/demo/33
deleted file mode 100644
index 5cfa287e3..000000000
--- a/tools/tf_fuzz/demo/33
+++ /dev/null
@@ -1,6 +0,0 @@
-purpose to set SST creation flags;
-set sst name hasCF data "this asset has write-once" flag write_once;
-set sst name hasCF2 data "this asset has also write-once" flag wo;
-set sst name alsoHasCF data "this asset has no flags" flag none expect pass;
-set sst name alsoHasCF2 data "this asset has NO_CONFIDENTIALITY" flag ncf;
-set sst name yetAnother data "this asset has NO_REPLAY_PROTECTION" flag nrp;
diff --git a/tools/tf_fuzz/demo/34 b/tools/tf_fuzz/demo/34
deleted file mode 100644
index 9fa46e9f8..000000000
--- a/tools/tf_fuzz/demo/34
+++ /dev/null
@@ -1,3 +0,0 @@
-purpose to set an offset on psa_ps_get();
-set sst name whoNose data *;
-read sst name whoNose print offset 10;
diff --git a/tools/tf_fuzz/demo/35 b/tools/tf_fuzz/demo/35
deleted file mode 100644
index 60fc978bc..000000000
--- a/tools/tf_fuzz/demo/35
+++ /dev/null
@@ -1,4 +0,0 @@
-purpose to verify we can't write multiple times to a write-once SST asset;
-set sst name writeOnce data * flag wo;
-set sst name writeOnce data *;
-set sst name writeOnce data *;
diff --git a/tools/tf_fuzz/demo/4 b/tools/tf_fuzz/demo/4
deleted file mode 100644
index 912c23abe..000000000
--- a/tools/tf_fuzz/demo/4
+++ /dev/null
@@ -1,2 +0,0 @@
-purpose to show how to randomize data;
-set sst name gibberish data *;
diff --git a/tools/tf_fuzz/demo/5 b/tools/tf_fuzz/demo/5
deleted file mode 100644
index 5290f27bb..000000000
--- a/tools/tf_fuzz/demo/5
+++ /dev/null
@@ -1,2 +0,0 @@
-purpose to show how to randomize name and data;
-set sst name * data *;
diff --git a/tools/tf_fuzz/demo/6 b/tools/tf_fuzz/demo/6
deleted file mode 100644
index 2e86d7542..000000000
--- a/tools/tf_fuzz/demo/6
+++ /dev/null
@@ -1,2 +0,0 @@
-purpose to show a nice party trick;
-set sst name john paul george and ringo data *;
diff --git a/tools/tf_fuzz/demo/7 b/tools/tf_fuzz/demo/7
deleted file mode 100644
index 903027ec2..000000000
--- a/tools/tf_fuzz/demo/7
+++ /dev/null
@@ -1,2 +0,0 @@
-purpose same with UIDs;
-set sst uid 17 19 24 31 34 41 data *;
diff --git a/tools/tf_fuzz/demo/8 b/tools/tf_fuzz/demo/8
deleted file mode 100644
index 03b22d910..000000000
--- a/tools/tf_fuzz/demo/8
+++ /dev/null
@@ -1,3 +0,0 @@
-purpose to create and show an asset;
-set sst name snortwaggle data *;
-read sst name snortwaggle check "almost certainly not *this*" expect fail;
diff --git a/tools/tf_fuzz/demo/9 b/tools/tf_fuzz/demo/9
deleted file mode 100644
index 72cc2692c..000000000
--- a/tools/tf_fuzz/demo/9
+++ /dev/null
@@ -1,4 +0,0 @@
-purpose to dump to a variable or to the log;
-set sst name greebledorf data *;
-read sst name greebledorf check a_variable;
-read sst name greebledorf print;
diff --git a/tools/tf_fuzz/demo/README b/tools/tf_fuzz/demo/README
deleted file mode 100644
index 4dc4bbe9e..000000000
--- a/tools/tf_fuzz/demo/README
+++ /dev/null
@@ -1,10 +0,0 @@
-This directory contains some example usages of TF-Fuzz, in a form that makes it
-easy to run each case and quickly see the results.
-
-For more information, please browse to:
-
- https://ci.trustedfirmware.org/job/tf-m-build-test-nightly/lastSuccessfulBuild/artifact/build-docs/tf-m_documents/install/doc/user_guide/html/docs/user_guides/tf_fuzz/demo_dir.html
-
---------------
-
-*Copyright (c) 2019-2020, Arm Limited. All rights reserved.*
diff --git a/tools/tf_fuzz/demo/chkgcc b/tools/tf_fuzz/demo/chkgcc
deleted file mode 100644
index fff9770d3..000000000
--- a/tools/tf_fuzz/demo/chkgcc
+++ /dev/null
@@ -1,14 +0,0 @@
-echo
-echo "Check-compiling..."
-echo
-gcc -I../../../../trusted-firmware-m-backup/test/suites/sst \
- -I../../../../trusted-firmware-m-backup/interface/include \
- -I../../../../trusted-firmware-m-backup \
- -I../../../../trusted-firmware-m-backup/test/suites/crypto \
- -I../../../secure_fw/spm/include \
- -I../../../../CMSIS_5/CMSIS/Core/Include \
- -Werror -Wunused-variable \
- -c tossThis.c
-echo
-echo "Check-compile complete."
-echo
diff --git a/tools/tf_fuzz/demo/r b/tools/tf_fuzz/demo/r
deleted file mode 100644
index d9b897839..000000000
--- a/tools/tf_fuzz/demo/r
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/usr/bin/bash
-# Copyright (c) 2019-2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-clear
-cat $1
-#sleep 5
-echo
-echo
-echo
-echo
-echo
-echo
-echo --------------------------------------------------
-echo
-echo $ ../tfz -v $1 tossThis.c
-../tfz -v $1 tossThis.c
diff --git a/tools/tf_fuzz/docs/asset_dir.rst b/tools/tf_fuzz/docs/asset_dir.rst
deleted file mode 100644
index 4eb358ddf..000000000
--- a/tools/tf_fuzz/docs/asset_dir.rst
+++ /dev/null
@@ -1,30 +0,0 @@
-########################
-'assets'-directory guide
-########################
-
-************
-Introduction
-************
-
-This directory contains C++ header and program files for classes of objects that
-track PSA assets, while generating a directed-random test. Notably this is
-during the Simulate phase, after Parse phase, which parses the test-template
-file, and prior to writing out the generated C code.
-
-***********************************************
-``.../tools/tf_fuzz/assets`` directory contents
-***********************************************
-.. code-block:: bash
-
- crypto_asset.cpp psa_asset.cpp sst_asset.cpp
- crypto_asset.hpp psa_asset.hpp sst_asset.hpp
-
-These hold current state of those assets as the run is simulated, after the
-exact sequence of PSA commands to be executed is generated by the Parse stage.
-Simulation only occurs to a level of detail of being able to predict pass/fail
-status, and asset data. Generally speaking, it does not simulate
-secure-partition code.
-
---------------
-
-*Copyright (c) 2020, Arm Limited. All rights reserved.*
diff --git a/tools/tf_fuzz/docs/boilerplate_dir.rst b/tools/tf_fuzz/docs/boilerplate_dir.rst
deleted file mode 100644
index d4aea0ee2..000000000
--- a/tools/tf_fuzz/docs/boilerplate_dir.rst
+++ /dev/null
@@ -1,27 +0,0 @@
-#############################
-'boilerplate'-directory guide
-#############################
-
-************
-Introduction
-************
-
-This directory contains the C++ header and code files to work with the
-customizable, "boilerplate" code snippets in the ``...tools/tf_fuzz/lib``
-directory. Mostly what this code does is read these code snippets into an
-STL ``vector`` of, essentially, named strings.
-
-****************************************************
-``.../tools/tf_fuzz/boilerplate`` directory contents
-****************************************************
-.. code-block:: bash
-
- boilerplate.cpp boilerplate.hpp
-
-This is currently implemented as a vector of strings, with a parallel vector
-of ``const int`` array-index names. (In the future, it may make sense to
-manage the boilerplate code in a C++ STL ``map``-type container.)
-
---------------
-
-*Copyright (c) 2020, Arm Limited. All rights reserved.*
diff --git a/tools/tf_fuzz/docs/calls_dir.rst b/tools/tf_fuzz/docs/calls_dir.rst
deleted file mode 100644
index 17c2491f4..000000000
--- a/tools/tf_fuzz/docs/calls_dir.rst
+++ /dev/null
@@ -1,33 +0,0 @@
-#######################
-'calls'-directory guide
-#######################
-
-************
-Introduction
-************
-
-These classes define objects that describe everything needed to generate a PSA
-call. The Parse phase, which parses the test-template file, generates an C++
-STL ``vector`` of ``psa_call``-class objects describing the series of PSA calls
-chosen for the test to run, based upon the test template and the random seed.
-
-More-specifically class psa_class is an abstract class, and this vector contains
-objects of derived classes, each derived class defining a particular call type.
-Each ``psa_call``-subclass object encapsulates the initial and expected data,
-expected pass/fail results, and other information about the call.
-
-**********************************************
-``.../tools/tf_fuzz/calls`` directory contents
-**********************************************
-.. code-block:: bash
-
- crypto_call.cpp psa_call.cpp security_call.cpp sst_call.cpp
- crypto_call.hpp psa_call.hpp security_call.hpp sst_call.hpp
-
-In the future, it's probably possible to, for target systems that can support
-sufficiently large memory footprints, instead of writing these calls out to a
-``.c`` file, to directly execute these PSA calls.
-
---------------
-
-*Copyright (c) 2020, Arm Limited. All rights reserved.*
diff --git a/tools/tf_fuzz/docs/demo_dir.rst b/tools/tf_fuzz/docs/demo_dir.rst
deleted file mode 100644
index fb49fe7a5..000000000
--- a/tools/tf_fuzz/docs/demo_dir.rst
+++ /dev/null
@@ -1,46 +0,0 @@
-######################
-'demo'-directory guide
-######################
-
-************
-Introduction
-************
-
-This directory contains some example usages of TF-Fuzz, in a form that makes it
-easy to run each case and quickly see the results.
-
-An example way to use this directory:
-
-- Add ``./`` to your ``$PATH`` variable, for convenience (see below).
-- Using any text editor that provides for tabbed editing (e.g., Nedit) pop
- up all files in this directory, each in a separate tab.
-- In a shell window, run each demo test, and view a file called
- ``tossThis2`` (that name to suggest we delete that file after we're done)
- to view the generated C code.
-
-The ``purpose`` line in each test describes what each demo illustrates.
-
-Bear in mind that these are not intended as practical use cases, but just for
-illustration. In the first few cases, the TF-Fuzz tool is not very "smart";
-that is, TF-Fuzz only provides a very-compact test-specification format. As
-the test number increases, the TF-Fuzz tool infers for you more about test.
-
-*********************************************
-``.../tools/tf_fuzz/demo`` directory contents
-*********************************************
-.. code-block:: bash
-
- 1 10 11 12 13 14 15 16 17 18 19 2 3 4 5 6 7 8 9 r
-
-The numbered files are test-template files -- input to TF-Fuzz -- for
-demonstrating what it can do.
-
-The ``r`` shell script is designed to make it quick and easy to run the demo
-tests one by one: just type ``r 5`` for example. The very short script name
-``r`` and the very-short, numbered demo-test file names were chosen to make it
-easy to quickly see example usages. To see sequentially more-involved usages
-of the tool, go through these demos in order.
-
---------------
-
-*Copyright (c) 2020, Arm Limited. All rights reserved.*
diff --git a/tools/tf_fuzz/docs/index.rst b/tools/tf_fuzz/docs/index.rst
deleted file mode 100644
index ee74714de..000000000
--- a/tools/tf_fuzz/docs/index.rst
+++ /dev/null
@@ -1,13 +0,0 @@
-TF-Fuzz
-=======
-
-.. toctree::
- :maxdepth: 1
- :caption: Contents
- :glob:
-
- *
-
---------------
-
-*Copyright (c) 2020, Arm Limited. All rights reserved.*
diff --git a/tools/tf_fuzz/docs/lib_dir.rst b/tools/tf_fuzz/docs/lib_dir.rst
deleted file mode 100644
index fbc54ddb8..000000000
--- a/tools/tf_fuzz/docs/lib_dir.rst
+++ /dev/null
@@ -1,33 +0,0 @@
-#####################
-'lib'-directory guide
-#####################
-
-************
-Introduction
-************
-
-This directory contains the customizable "boilerplate" code snippets used to
-write out C source code. The file in this directory currently, is that for
-TF-M, but other comparable frameworks could be addressed with equivalent files
-taylored for the required syntax of that other framework.
-
-Which file to use for this process is selected by setting two environment
-variables pointing to that file: One for the ``lib`` directory and one for the
-file itself within that directory. In ``bash`` syntax,
-
-.. code-block:: bash
-
- export TF_FUZZ_LIB_DIR=<path to this TF-M installation>/tools/tf_fuzz/lib
- export TF_FUZZ_BPLATE=tfm_boilerplate.txt
-
-
-********************************************
-``.../tools/tf_fuzz/lib`` directory contents
-********************************************
-.. code-block:: bash
-
- tfm_boilerplate.txt
-
---------------
-
-*Copyright (c) 2020, Arm Limited. All rights reserved.*
diff --git a/tools/tf_fuzz/docs/parser_dir.rst b/tools/tf_fuzz/docs/parser_dir.rst
deleted file mode 100644
index ddbca5a5c..000000000
--- a/tools/tf_fuzz/docs/parser_dir.rst
+++ /dev/null
@@ -1,27 +0,0 @@
-########################
-'parser'-directory guide
-########################
-
-************
-Introduction
-************
-
-Users' test-template files are parsed using a Lex/YACC grammar, to make the
-test-template language easily extensible. Much of the actual work is done in
-helper functions, but the Lex/YACC grammar manages the process.
-
-***********************************************
-``.../tools/tf_fuzz/parser`` directory contents
-***********************************************
-.. code-block:: bash
-
- tf_fuzz_grammar.l tf_fuzz_grammar.y
-
-This directory contains the Lex and YACC grammars for parsing the TF-Fuzz
-command "language," if it can be called that. The
-``tf_fuzz_grammar.tab.cpp/.hpp`` files generated also form the executive for
-the entire parsing process.
-
---------------
-
-*Copyright (c) 2020, Arm Limited. All rights reserved.*
diff --git a/tools/tf_fuzz/docs/regression_dir.rst b/tools/tf_fuzz/docs/regression_dir.rst
deleted file mode 100644
index ec4ea6d39..000000000
--- a/tools/tf_fuzz/docs/regression_dir.rst
+++ /dev/null
@@ -1,169 +0,0 @@
-############################
-'regression'-directory guide
-############################
-
-************
-Introduction
-************
-
-This is a regression suite for the TF-Fuzz tool. That is, tests to make sure
-that TF-Fuzz is still functioning properly after making changes. Note that
-this regression implementation tests the most basic aspects of TF-Fuzz's
-implementation, but is not yet complete. Most notably, it does not yet test
-``*active`` and ``*deleted``, nor ``shuffle`` and ``2 to 5 of {...}``
-constructs.
-
-***************************************************
-``.../tools/tf_fuzz/regression`` directory contents
-***************************************************
-.. code-block:: bash
-
- 000001_set_sst_uid_data_expect_pass
- 000002_set_sst_name_data_expect_nothing
- 000003_set_sst_name_data
- 000004_set_sst_name_rand_data
- 000005_set_sst_rand_name_rand_data
- 000006_set_sst_multi_name_rand_data
- 000007_set_sst_multi_uid_rand_data
- 000008_set_sst_name_rand_data_read_check_wrong
- 000009_set_sst_name_rand_data_read_check_var_read_print
- 000010_read_nonexistent_sst_check_string
- 000011_read_nonexistent_sst_check_string_expect_pass
- 000012_read_nonexistent_sst_check_string_expect_other
- 000013_set_sst_name_rand_data_remove_twice
- 000014_set_sst_name_rand_data_remove_other
- 000015_set_sst_name_only
- 000016_set_sst_single_asset_set_multiple_times
- 000017_read_sst_check_single_asset_multiple_times
- 000018_000016_and_000017
- 000019_read_asset_to_variable_set_other_asset
- add_these_tests
- function2OpenFiles
- README
- regress
- regress_lib
-
-******************************
-Files for Each Regression Test
-******************************
-
-Here's the overall regression scheme:
-
-- ``bash regress`` from this directory runs regression. It will fail with an
- error if a problem is found. If it runs to completion, then regression has
- passed.
-
-- Each test is in its own sub-directory containing these files, by name (always
- same name):
-
- - ``template``: The test-template file to be run though the TF-Fuzz under
- test, called "the DUT TF-Fuzz" here.
-
- - ``exp_stdout_stderr``: The *expected*, combined ``stdout`` and ``stderr``
- from running TF-Fuzz in verbose mode ``-v``. This file contains wildcard
- expressions to be checked (more on that below).
-
- - ``exp_test.c``: The *expected* output C code. This file also contains
- wildcard expressions to be resolved against the DUT TF-Fuzz output (again,
- more on that below).
-
- - ``stdout_stderr`` (if present): The *actual* combined ``stdout`` and
- ``stderr`` from running the DUT TF-Fuzz in verbose mode ``-v``, during
- regression testing.
-
- - ``test.c`` (if present): The output C code generated from running the DUT
- TF-Fuzz in verbose mode ``-v``, during regression testing.
-
- - ``check.py``: This Python 3 script compares expected to actual
- ``stdout``/``stderr`` and C-test code, resolving wildcard references in
- ``exp_stdout_stderr`` and ``exp_test.c``. Each test directory has its own
- script customized to the needs of that particular test, but they mostly
- just runs TF-Fuzz, opens files, then invokes functions in the
- ``regress_lib`` directory, which do the majority of the actual work.
-
-********************************
-How ``check.py`` Assesses a Test
-********************************
-
-To illustrate how ``check.py`` checks a regression test, below is a ``diff`` of
-``test.c`` and ``exp_test.c`` file files, from
-``./000005_set_sst_rand_name_rand_data/``, at the time of writing this:
-
-.. code-block:: bash
-
- 47,48c47,48
- < static uint8_t koxjis_data[] = "Gaa wuqnoe xoq uhoz qof er uaycuuf?";
- < static int koxjis_data_size = 35;
- ---
- > static uint8_t @@@003@@@_data[] = "@@002@10@@[a-z\ ]*[\.\?\!]";
- > static int @@@003@@@_data_size = \d+;
- 53,55c53,55
- < /* Creating SST asset "koxjis," with data "Gaa wuqnoe...". */
- < sst_status = psa_ps_set(2110, koxjis_data_size, koxjis_data,
- < PSA_STORAGE_FLAG_NONE);
- ---
- > /* Creating SST asset "@@@003@@@," with data "@@002@10@@...". */
- > sst_status = psa_ps_set(@@@001@@@, @@@003@@@_data_size, @@@003@@@_data,
- > PSA_STORAGE_FLAG_[A-Z_]+);
- 63c63
- < psa_ps_remove(2110);
- ---
- > psa_ps_remove(@@@001@@@);
-
-``check.py``, short summary, performs a Python ``re.match()`` line-by-line the
-generated ``test.c`` against the ``exp_test.c`` file. However, ``exp_test.c``,
-in addition to Python regular expressions, also contains "special" wildcards,
-described below.
-
-*********
-Wildcards
-*********
-
-The wildcards in the ``exp_stdout_stderr`` and ``exp_test.c`` files are of
-three basic natures, using the examples shown above (please reference them
-above to clearly understand the ideas here):
-
-.. list-table::
- :widths: 20 80
-
- * - ``[a-z\ ]*[\.\?\!]`` or ``[A-Z_]+``
- - | These are Python regex pattern matches for what characters are expected
- | at those places. The data consist of quasi-sentences, capitalized at
- | the beginning. The capitalized character is covered by the
- | ``@@002@10@@`` (see below) before it. The ``[a-z\ ]*[\.\?\!]`` is a
- | Python-regex match for all remaining characters of the sentence: A
- | sequence of zero or more lower-case letters or blanks followed by
- | sentence-ending punctuation.
-
- * - ``@@@001@@@`` (``@@@``, a pattern number, ``@@@``)
- - | This denotes a particular pattern of characters, until the expected and
- | actual character streams re-sync again. The important thing, however,
- | is that what this wildcard stands for *must be consistent* throughout
- | the comparison! In this case above, ``@@@001@@@`` in the ``exp_test.c``
- | must consistently match ``8617`` everywhere throughout the ``test.c``
- | file. Of course, the ``8617`` is different for different random-seed
- | values. The number between the two ``@@@`` occurrences in the wildcard
- | designates which pattern must consistently match.
-
- * - ``@@002@10@@`` (``@@``, a pattern number, ``@``, a pattern size, ``@@``)
- - | This is a slight variant upon the previous wildcard, in which a specific
- | match length is required. In lines 47 and 48 above, random data
- | generated consists of 10 characters (thus the ... ``@10@@`` in the
- | wildcard) ``Gaa wuqnoe`` followed by other characters we don't care
- | about; they can be anything. Thus ``@@002@10@@[a-z\ ]*[\.\?\!]`` in
- | line 47: The ``@@002@10@@`` denotes a pattern number 002 for a length
- | of 10 characters that must match ``Gaa wuqnoe`` in this case, followed
- | by some arbitrary number of characters we don't care about, thus
- | ``[a-z\ ]*[\.\?\!]`` -- a sequence of lower-case letters or spaces,
- | capped off with normal sentence-ending punctuation.
-
-After the ``check.py`` capability -- resolving these wildcards -- for this
-purpose is fleshed out, we shall have to figure out how to address
-``shuffle {}`` and ``5 to 8 of {}`` randomizations.
-
-The ``add_these_tests`` directory contains regression tests of the above nature
-that the regression framework is not currently able to address.
-
---------------
-
-*Copyright (c) 2020, Arm Limited. All rights reserved.*
diff --git a/tools/tf_fuzz/docs/template_dir.rst b/tools/tf_fuzz/docs/template_dir.rst
deleted file mode 100644
index 86dbbfa40..000000000
--- a/tools/tf_fuzz/docs/template_dir.rst
+++ /dev/null
@@ -1,23 +0,0 @@
-##########################
-'template'-directory guide
-##########################
-
-************
-Introduction
-************
-
-These classes describe "tracker" objects for parsing test templates, and for
-generating PSA calls from them.
-
-*************************************************
-``.../tools/tf_fuzz/template`` directory contents
-*************************************************
-.. code-block:: bash
-
- crypto_template_line.cpp secure_template_line.hpp template_line.cpp
- crypto_template_line.hpp sst_template_line.cpp template_line.hpp
- secure_template_line.cpp sst_template_line.hpp
-
---------------
-
-*Copyright (c) 2020, Arm Limited. All rights reserved.*
diff --git a/tools/tf_fuzz/docs/tests_dir.rst b/tools/tf_fuzz/docs/tests_dir.rst
deleted file mode 100644
index 82264516e..000000000
--- a/tools/tf_fuzz/docs/tests_dir.rst
+++ /dev/null
@@ -1,21 +0,0 @@
-#######################
-'tests'-directory guide
-#######################
-
-************
-Introduction
-************
-
-These are just more examples of test-template-file content. They're not really
-organized *tests* as such.
-
-**********************************************
-``.../tools/tf_fuzz/tests`` directory contents
-**********************************************
-.. code-block:: bash
-
- example_template sstReads sstSets
-
---------------
-
-*Copyright (c) 2020, Arm Limited. All rights reserved.*
diff --git a/tools/tf_fuzz/docs/tf_fuzz_dir.rst b/tools/tf_fuzz/docs/tf_fuzz_dir.rst
deleted file mode 100644
index 6ad0a382f..000000000
--- a/tools/tf_fuzz/docs/tf_fuzz_dir.rst
+++ /dev/null
@@ -1,124 +0,0 @@
-#######################################
-TF-Fuzz (Trusted-Firmware Fuzzer) guide
-#######################################
-
-************
-Introduction
-************
-
-TF-Fuzz is a TF-M fuzzing tool, at the PSA-call level. At the time of writing
-this at least, presentations available at:
-
-- https://www.trustedfirmware.org/docs/TF-M_Fuzzing_Tool_TFOrg.pdf
-- https://zoom.us/rec/share/1dxZcZit111IadadyFqFU7IoP5X5aaa8gXUdr_UInxmMbyLzEqEmXQdx79-IWQ9p
-
-(These presentation materials may not all be viewable by all parties.)
-
-To build TF-Fuzz, simply type ``make`` in this directory. The executable,
-called ``tfz``, is placed in this directory.
-
-To run ``tfz``, two environment variables must first be assigned. In bash
-syntax:
-
-.. code-block:: bash
-
- export TF_FUZZ_LIB_DIR=<path to this TF-M installation>/tools/tf_fuzz/lib
- export TF_FUZZ_BPLATE=tfm_boilerplate.txt
-
-Examples of usage can be found in the ``demo`` directory.
-
-**********************************
-``.../tf_fuzz`` directory contents
-**********************************
-.. code-block:: bash
-
- assets calls demo parser tests regression
- backupStuff class_forwards.hpp lib document tf_fuzz.cpp utility
- boilerplate commands Makefile template tf_fuzz.hpp visualStudio
-
-*************
-Code Overview
-*************
-To help understand the code, below is a C++-class hierarchy used in this code
-base. They are explained further in the documents in their respective
-directories, so the file names where the classes are defined is listed below (this,
-very roughly in order of functional interactions, of chronological usage during
-execution, and of most-to-least importance):
-
-.. code-block:: bash
-
- template_line ./template/template_line.hpp
- sst_template_line ./template/template_line.hpp
- read_sst_template_line ./template/sst_template_line.hpp
- remove_sst_template_line ./template/sst_template_line.hpp
- set_sst_template_line ./template/sst_template_line.hpp
- policy_template_line ./template/template_line.hpp
- read_policy_template_line ./template/crypto_template_line.hpp
- set_policy_template_line ./template/crypto_template_line.hpp
- key_template_line ./template/template_line.hpp
- read_key_template_line ./template/crypto_template_line.hpp
- remove_key_template_line ./template/crypto_template_line.hpp
- set_key_template_line ./template/crypto_template_line.hpp
- security_template_line ./template/template_line.hpp
- security_hash_template_line ./template/secure_template_line.hpp
-
- psa_call ./calls/psa_call.hpp
- crypto_call ./calls/psa_call.hpp
- policy_call ./calls/crypto_call.hpp
- init_policy_call ./calls/crypto_call.hpp
- reset_policy_call ./calls/crypto_call.hpp
- add_policy_usage_call ./calls/crypto_call.hpp
- set_policy_lifetime_call ./calls/crypto_call.hpp
- set_policy_type_call ./calls/crypto_call.hpp
- set_policy_algorithm_call ./calls/crypto_call.hpp
- set_policy_usage_call ./calls/crypto_call.hpp
- get_policy_lifetime_call ./calls/crypto_call.hpp
- get_policy_type_call ./calls/crypto_call.hpp
- get_policy_algorithm_call ./calls/crypto_call.hpp
- get_policy_usage_call ./calls/crypto_call.hpp
- get_policy_size_call ./calls/crypto_call.hpp
- get_policy_call ./calls/crypto_call.hpp
- key_call ./calls/crypto_call.hpp
- generate_key_call ./calls/crypto_call.hpp
- create_key_call ./calls/crypto_call.hpp
- copy_key_call ./calls/crypto_call.hpp
- read_key_data_call ./calls/crypto_call.hpp
- remove_key_call ./calls/crypto_call.hpp
- sst_call ./calls/psa_call.hpp
- sst_remove_call ./calls/sst_call.hpp
- sst_get_call ./calls/sst_call.hpp
- sst_set_call ./calls/sst_call.hpp
- security_call ./calls/psa_call.hpp
- hash_call ./calls/security_call.hpp
-
- boilerplate ./boilerplate/boilerplate.hpp
-
- psa_asset ./assets/psa_asset.hpp
- crypto_asset ./assets/crypto_asset.hpp
- policy_asset ./assets/crypto_asset.hpp
- key_asset ./assets/crypto_asset.hpp
- sst_asset ./assets/sst_asset.hpp
-
- tf_fuzz_info ./tf_fuzz.hpp
-
- variables ./utility/variables.hpp
- crc32 ./utility/compute.hpp
-
- gibberish ./utility/gibberish.hpp
-
- expect_info ./utility/data_blocks.hpp
- set_data_info ./utility/data_blocks.hpp
- asset_name_id_info ./utility/data_blocks.hpp
-
-TF-Fuzz now has better-organized management of variables in the generated code.
-In particular, it maintains a list of variables named in the test template, and
-implicit in the code, notably variables assets are ``read`` into. It also now has
-completely separate execution phases to parse the test template, simulate the
-sequence of PSA calls generated, and write out the expected results. That
-simulation is only in enough detail to predict expected results. Since TF-Fuzz
-currectly mostly addresses only SST calls, that simulation is very simple in
-nature -- just tracking data movement.
-
---------------
-
-*Copyright (c) 2020, Arm Limited. All rights reserved.*
diff --git a/tools/tf_fuzz/docs/utility_dir.rst b/tools/tf_fuzz/docs/utility_dir.rst
deleted file mode 100644
index 89ad0609d..000000000
--- a/tools/tf_fuzz/docs/utility_dir.rst
+++ /dev/null
@@ -1,24 +0,0 @@
-#########################
-'utility'-directory guide
-#########################
-
-************
-Introduction
-************
-
-As its name implies, this ``.../tf_fuzz/utility`` directory just contains
-various utility-compute code.
-
-************************************************
-``.../tools/tf_fuzz/utility`` directory contents
-************************************************
-.. code-block:: bash
-
- compute.cpp find_or_create_asset.hpp randomization.cpp string_ops.hpp
- compute.hpp gibberish.cpp randomization.hpp
- data_blocks.cpp gibberish.hpp Source.cpp
- data_blocks.hpp interactive.c string_ops.cpp
-
---------------
-
-*Copyright (c) 2020, Arm Limited. All rights reserved.*
diff --git a/tools/tf_fuzz/docs/visualStudio_dir.rst b/tools/tf_fuzz/docs/visualStudio_dir.rst
deleted file mode 100644
index a70bbf8e6..000000000
--- a/tools/tf_fuzz/docs/visualStudio_dir.rst
+++ /dev/null
@@ -1,26 +0,0 @@
-##############################
-'visualStudio'-directory guide
-##############################
-
-************
-Introduction
-************
-
-This is just things to support running and debug under Microsoft Visual Studio
-(Visual Studio is a trademark of Microsoft Corporation). So far, it contains
-a "stand-in" for the ``unistd.h`` library, and more specifically, the
-``isatty()`` call in that library, which is used by Lex and YACC. Other
-functions may be added later as needed. At some time in the future, an
-up-coming "interactive mode" for interactively creating test templates may
-need an actual working ``isatty()``, but that's not ready yet.
-
-*************************************************
-.../tools/tf_fuzz/visualStudio directory contents
-*************************************************
-.. code-block:: bash
-
- unistd.c unistd.h
-
---------------
-
-*Copyright (c) 2020, Arm Limited. All rights reserved.*
diff --git a/tools/tf_fuzz/generate_test_suite.sh b/tools/tf_fuzz/generate_test_suite.sh
deleted file mode 100644
index 80e0b38bc..000000000
--- a/tools/tf_fuzz/generate_test_suite.sh
+++ /dev/null
@@ -1,209 +0,0 @@
-#!/usr/bin/env bash
-#
-# Copyright (c) 2020-2021, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-set -e
-
-SUITE_DIR_NAME=tfm_fuzz
-
-show_help()
-{
- echo "Usage: $0 <template_dir> <suites_dir> "
- echo ""
- echo "Where: "
- echo " template_dir: The directory containing template files for the"
- echo " fuzzing tool"
- echo " suites_dir: The directory to generate the test suite to."
-}
-
-if [ $# != 2 ]
-then
- echo "Invalid number of parameters."
- show_help
- exit 1
-fi
-
-INPUT_DIR=$1
-SUITES_DIR=$2
-
-# Check that the input directory exists
-if [ ! -d "$INPUT_DIR" ]
-then
- echo "Template directory '$INPUT_DIR' doesn't exist"
- exit 1
-fi
-
-# Check that the input directory contains files
-if [ `ls "$INPUT_DIR"| wc -l` == 0 ]
-then
- echo "Template directory '$INPUT_DIR' doesn't contain files"
- exit 1
-fi
-
-if [ ! -d "$SUITES_DIR" ]
-then
- echo "Suites directory '$SUITES_DIR' doesn't exist"
- exit 1
-fi
-
-# Check whether a fuzz test suite was generated before
-if [ -d "$SUITES_DIR/$SUITE_DIR_NAME" ]
-then
- echo "'$SUITE_DIR_NAME' exists."
- echo "A TF fuzz test suite is already generated, please delete it before running this script"
- exit 1
-fi
-
-#get absolute path of the suit dir TF_FUZZ
-pushd $SUITES_DIR > /dev/null
-SUITE_ABSOLUTE_DIR=`pwd`/$SUITE_DIR_NAME
-popd
-
-# creating directory for the fuzz tests tool
-echo "Creating '$SUITES_DIR/$SUITE_DIR_NAME/non_secure'"
-mkdir -p $SUITES_DIR/$SUITE_DIR_NAME/non_secure
-
-# generate additional files for the suite:
-CMAKELIST=$SUITES_DIR/$SUITE_DIR_NAME/CMakeLists.txt
-TESTSUITE=$SUITES_DIR/$SUITE_DIR_NAME/non_secure/tf_fuzz_testsuite.c
-TESTSUITE_HEADER=$SUITES_DIR/$SUITE_DIR_NAME/non_secure/tf_fuzz_testsuite.h
-
-# generate data for the testcases
-# Iterate over the testcase files and
-# - Run the fuzzer on the test template
-# - Generate a test function name, and replace the generic test_thread to that
-# in the generated c file
-# - append the generated c file to the CmakeList file.
-declare -A FILENAMES
-declare -A FUNC_NAMES
-declare -A PURPOSES
-for f in `ls $INPUT_DIR`
-do
- FILE="$SUITES_DIR/$SUITE_DIR_NAME/non_secure/$f.c"
- FILENAMES[$f]=$FILE
-
- SEED=$RANDOM
- echo "Generating testcase $f with seed $SEED"
- ./tfz -z $INPUT_DIR/$f $FILE $SEED
-
- echo "in File ${FILENAMES[$f]}"
-
- PURPOSE=`grep -A 1 'Test purpose' $FILE | tail -n 1 | cut -d '*' -f 2 | sed -e 's/^[[:space:]]*//'`
- PURPOSES[$f]=$PURPOSE
-
- FUNC_NAME="$PURPOSE"
- FUNC_NAME=`echo "$FUNC_NAME" | \
- sed 's/^\s*//g; s/\s*$//g; s/\s\s*/_/g'`
- FUNC_NAME=`echo "$FUNC_NAME" | \
- sed 's/\-/_/g; s/"//g; s/\\\//g'`
- FUNC_NAME=`echo "$FUNC_NAME" | \
- sed "s/#//g; s/'//g; s/,//g; s/(//g; s/)//g"`
- FUNC_NAMES[$f]=$FUNC_NAME
-
- echo " Changing 'test_thread' to '${FUNC_NAMES[$f]}'"
-
- sed -i "s/test_thread/$FUNC_NAME/g" $FILE
-
-done
-
-# generate the non-secure testsuite file
-echo '#include <stdio.h>' >> $TESTSUITE
-echo '#include <string.h>' >> $TESTSUITE
-echo '' >> $TESTSUITE
-echo '#include "tfm_api.h"' >> $TESTSUITE
-echo '#include "psa_manifest/sid.h"' >> $TESTSUITE
-echo '#include "test_framework.h"' >> $TESTSUITE
-echo '' >> $TESTSUITE
-echo '/* Forward declaring static test functions */' >> $TESTSUITE
-for f in `ls $INPUT_DIR`
-do
- echo "static void test_${FUNC_NAMES[$f]}(struct test_result_t *ret);" >> $TESTSUITE
-done
-echo '/* Forward declaring functions */' >> $TESTSUITE
-for f in `ls $INPUT_DIR`
-do
- echo "void ${FUNC_NAMES[$f]}(struct test_result_t *ret);" >> $TESTSUITE
-done
-echo '' >> $TESTSUITE
-echo 'static struct test_t tf_fuzz_tests[] = {' >> $TESTSUITE
-for f in `ls $INPUT_DIR`
-do
- echo " {&test_${FUNC_NAMES[$f]}, \"${FUNC_NAMES[$f]}\", \"${PURPOSES[$f]}\", {0} }," >> $TESTSUITE
-done
-echo '}; ' >> $TESTSUITE
-echo '' >> $TESTSUITE
-echo 'void register_testsuite_tf_fuzz_test(struct test_suite_t *p_test_suite)' >> $TESTSUITE
-echo '{' >> $TESTSUITE
-echo ' uint32_t list_size;' >> $TESTSUITE
-echo '' >> $TESTSUITE
-echo ' list_size = (sizeof(tf_fuzz_tests) / sizeof(tf_fuzz_tests[0]));' >> $TESTSUITE
-echo '' >> $TESTSUITE
-echo ' set_testsuite("TF-M fuzz tests (TF_FUZZ_TEST)",' >> $TESTSUITE
-echo ' tf_fuzz_tests, list_size, p_test_suite);' >> $TESTSUITE
-echo '}' >> $TESTSUITE
-echo '' >> $TESTSUITE
-for f in `ls $INPUT_DIR`
-do
- echo "static void test_${FUNC_NAMES[$f]}(struct test_result_t *ret)" >> $TESTSUITE
- echo '{' >> $TESTSUITE
- echo " ${FUNC_NAMES[$f]}(ret);" >> $TESTSUITE
- echo ' if (ret->val != TEST_PASSED) {' >> $TESTSUITE
- echo ' return;' >> $TESTSUITE
- echo ' }' >> $TESTSUITE
- echo '' >> $TESTSUITE
- echo '}' >> $TESTSUITE
-done
-
-# generate the CmakeList file
-echo "cmake_policy(SET CMP0079 NEW)" >> $CMAKELIST
-echo "" >> $CMAKELIST
-echo "add_library(tfm_test_suite_tf_fuzz_ns STATIC EXCLUDE_FROM_ALL)" >> $CMAKELIST
-echo "" >> $CMAKELIST
-echo "target_sources(tfm_test_suite_tf_fuzz_ns" >> $CMAKELIST
-echo " PRIVATE" >> $CMAKELIST
-for f in `ls $INPUT_DIR`
-do
- echo " $SUITE_ABSOLUTE_DIR/non_secure/$f.c" >> $CMAKELIST
-done
-echo " $SUITE_ABSOLUTE_DIR/non_secure/tf_fuzz_testsuite.c" >> $CMAKELIST
-echo ")" >> $CMAKELIST
-echo "" >> $CMAKELIST
-echo "target_include_directories(tfm_test_suite_tf_fuzz_ns" >> $CMAKELIST
-echo " PUBLIC" >> $CMAKELIST
-echo " ./non_secure" >> $CMAKELIST
-echo " PRIVATE" >> $CMAKELIST
-echo " ." >> $CMAKELIST
-echo ")" >> $CMAKELIST
-echo "" >> $CMAKELIST
-echo "target_link_libraries(tfm_test_suite_tf_fuzz_ns" >> $CMAKELIST
-echo " PRIVATE" >> $CMAKELIST
-echo " tfm_test_framework_ns" >> $CMAKELIST
-echo " tfm_test_suite_its_ns" >> $CMAKELIST
-echo ")" >> $CMAKELIST
-echo "" >> $CMAKELIST
-echo "target_link_libraries(tfm_ns_tests" >> $CMAKELIST
-echo " INTERFACE" >> $CMAKELIST
-echo " tfm_test_suite_tf_fuzz_ns" >> $CMAKELIST
-echo ")" >> $CMAKELIST
-
-# generate the testsuite header file
-echo '#ifndef __PSA_API_FUZZ_TESTSUITE_H__' >> $TESTSUITE_HEADER
-echo '#define __PSA_API_FUZZ_TESTSUITE_H__' >> $TESTSUITE_HEADER
-echo '' >> $TESTSUITE_HEADER
-echo 'void register_testsuite_tf_fuzz_test(struct test_suite_t *p_test_suite);' >> $TESTSUITE_HEADER
-echo '' >> $TESTSUITE_HEADER
-echo '#endif /* __PSA_API_FUZZ_TESTSUITE_H__ */' >> $TESTSUITE_HEADER
-
-# print some instruction on the screen
-echo ''
-echo ''
-echo '========================================================================='
-echo '= The test suite generation is done. It can be compiled to TF-M by'
-echo '= providing the following options to the CMake generate command:'
-echo '='
-echo '= -DTFM_FUZZER_TOOL_TESTS=1'
-echo '= -DTFM_FUZZER_TOOL_TESTS_CMAKE_INC_PATH='$SUITE_ABSOLUTE_DIR
-echo '========================================================================='
diff --git a/tools/tf_fuzz/lib/README b/tools/tf_fuzz/lib/README
deleted file mode 100644
index 7c46edcb4..000000000
--- a/tools/tf_fuzz/lib/README
+++ /dev/null
@@ -1,10 +0,0 @@
-This directory contains the customizable "boilerplate" code snippets used to
-write out C source code.
-
-For more information, please browse to:
-
- https://ci.trustedfirmware.org/job/tf-m-build-test-nightly/lastSuccessfulBuild/artifact/build-docs/tf-m_documents/install/doc/user_guide/html/docs/user_guides/tf_fuzz/lib_dir.html
-
---------------
-
-*Copyright (c) 2019-2020, Arm Limited. All rights reserved.*
diff --git a/tools/tf_fuzz/lib/human_boilerplate.txt b/tools/tf_fuzz/lib/human_boilerplate.txt
deleted file mode 100644
index f475902bf..000000000
--- a/tools/tf_fuzz/lib/human_boilerplate.txt
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-This file is a library text file of boilerplate-text snippets. TF-Fuzz reads in these
-snippets and then performs targeted text substitutions upon them, to create the indi-
-vidual PSA commands, and other important code snippets. This one in particular
-library-text file is used to create a human-readable summary of the actual code. It's
-not exactly documentation as such, but more of just a human-oriented flow of the
-generated test code.
-
-Four extremely important things about this file:
-* The individual text snippets are separated by "backtick" (AKA back-apostrophe)
- characters (see below). This means that text snippets of TF code can't use backtick
- characters (reasonably safe for C code).
-* The text snippets are *positional*. The loop in boilerplate.cpp reads them in, in
- the order they appear in this file, into a vector of strings. The "const int"s in
- boilerplate.hpp assign symbolic names to the vector indices. It is therefore
- *critical* that the, for example, 11th backtick-delineated text snippet in this file,
- be read into the 11 string in this vector of strings!
-* This first text snippet that you're now reading -- a README about this file -- is
- ignored by this boilerplate.cpp loop; it is not read into this vector of snippets.
-* To make it easier to track the positional nature of the text snippets in this file,
- the first three characters, plus the leading \n, of these snippets is trimmed off
- and ignored. These first three characters in each string comprise a sequence
- number, for Check against the "const int" list in boilerplate.hpp. So, these
- tags are literally the exactly the 3 characters directly after the backtick termi-
- nating the previous string.
-`000
-This test is intended:
- $purpose.
-
- It starts with essential #include directives.
-`001
-
- The code continues with declaration and definitions of helper functions
- that perform a simple hashing of data. This hash allows many different
- blocks of data to be compared to each other in all combinations. Nominally
- this is to find data leaks between variables.
-`002
-
- Next is a declaration of the thread function that performs the generated
- test, then...
-
-`003 `004
- Declaration of int-type variable called $var, with initial value "$init"
-`005
- Declaration of uint8_t unchanging array, $var, with initial value of:
- $init
-`006
- Declaration of uint8_t array, $var, with initial value of:
- $init
- A lot of space is given to this array anticipating that it will be over-
- written with potentially large read-data.
-`007
- Declaration of size_t-type variable called $var,
- with initial value "$init".
-`008
- Declaration of psa_key_attributes_t-type variable called $var.
-`009
- Declaration of psa_algorithm_t-type variable called $var.
-`010
- Declaration of psa_key_lifetime_t-type variable called $var.
-`011
- Declaration of psa_key_type_t-type variable $var;
-`012
- Declaration of psa_key_usage_t-type variable $var;
-`013
- Declaration of psa_key_handle_t-type variable $var;
-`014
- Declaration of $type-type variable called $var, with initial value "$init".
-`015
-
- Writing to the message log:
- $message.
-`016
-
- Test-teardown delete of SST asset UID $uid.
-`017
- Verify that the previous call was successful.
-`018
-
- Test-teardown delete of key asset, handle "$handle."
-`019
- Verify that the previous call was successful.
-`020
-
-And this is the end of the test.
-`021 PSA_SUCCESS`022 PSA_ERROR_DOES_NOT_EXIST`023
-
- Set an SST asset:
- * UID = $uid, length = $length,
- * data = $data, and
- * creation flags = $flags.
-`024
- Verify that previous had a result of $expect.
-`025
-
- Read (get) SST-asset data:
- * UID = $uid, length = $length,
- * actual data in $act_data, and
- * actual length in $act_length.
-`026
- Verify that previous had a result of $expect.
-`027
- Verify that the previous SST get (read) had a result of "$expect,"
- then a comparison of the values read, $act_data against $exp_data.
-`028
- Hash the SST data in $act_data_var for later data-leak check,
- resulting has being placed in $hash_var. */
-`029
-
- Deletion of SST asset, UID = $uid.
-`030
- Verify that previous SST-asset deletion had a result of $expect.
-`031
- Initializing PSA-Crypto attributes (policy) "$policy".
-`032
- Resetting key attributes (policy) for "$policy".
-`033
- Adding a key-policy attribute of $flag to "$policy".
-`034
- Setting key-policy "$policy"'s lifetime to $life.
-`035
- Setting the key size for "$policy" to $size bits.
-`036
- Setting the key type for "$policy" to $type.
-`037
- Setting the key algorithm for "$policy" to $algorithm.
-`038
- Setting key usage flags for "$policy" to $usage.
-`039
- Reading key lifetime for "$policy" into variable $life.
-`040
- Reading key lifetime for "$policy" into variable $life,
- and displaying it to the log file.
-
-`041
- Reading key size into variable $size, for key policy "$policy".
-`042
- Reading key type into variable $type, for key policy "$policy".
-`043
- Reading key type into variable $type, for key policy "$policy",
- and displaying it to the log file.
-`044
- Reading key algorithm into variable $algorithm, for key policy "$policy".
-`045
- Reading key algorithm into variable $algorithm, for key policy "$policy",
- and displaying it to the log file.
-`046
- Reading key usage into variable $usage, for key policy "$policy".
-`047
- Displaying to the log the presence or not of key-policy usage
- $usage_string for key-policy "$policy",
- as either $print_usage_true_string or $print_usage_false_string.
-`048
- Reading attributes (policy) for key $key into variable "$policy".
-`049
- Verify that previous get (read) of key policies had result of $expect.
-`050
- Generate key (no key data specified) $key, from policy "$policy".
-`051
- Verify that previous key generation had result of $expect.
-`052
- Creating key for key $key:
- * Policy = "$policy",
- * Data variable = $data, and
- * Length = $length.
-`053
- Verify that key-creation had result of $expect.
-`054
- Copying a key:
- * Master key = $master,
- * Copy key = $copy, and
- * New-key policy = "$policy".
-`055
- Verify that key-export (read of key data) had result of $expect.
-`056
- Verify that key-data read into $act_data, matches dat in $exp_data.
-`057
- Export (read) of key data for $key:
- * Data variable = $data,
- * Data-length variable = $length, and
- * Actual data-size variable = $act_size.
-`058
- Verify that key-export (read of key data) had result of $expect.
-`059
- Delete key $key.
-`060
- Verify that key-delete had result of $expect.
-`
diff --git a/tools/tf_fuzz/lib/tfm_boilerplate.txt b/tools/tf_fuzz/lib/tfm_boilerplate.txt
deleted file mode 100644
index dcec0865b..000000000
--- a/tools/tf_fuzz/lib/tfm_boilerplate.txt
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-This file is a library text file of boilerplate-text snippets. TF-Fuzz reads in these
-snippets and then performs targeted text substitutions upon them, to create the indi-
-vidual PSA commands, and other important code snippets. This one in particular
-library-text file is what might be called the "personality module" for writing tests
-with TF-M syntax.
-
-Four extremely important things about this file:
-* The individual text snippets are separated by "backtick" (AKA back-apostrophe)
- characters (see below). This means that text snippets of TF code can't use backtick
- characters (reasonably safe for C code).
-* The text snippets are *positional*. The loop in boilerplate.cpp reads them in, in
- the order they appear in this file, into a vector of strings. The "const int"s in
- boilerplate.hpp assign symbolic names to the vector indices. It is therefore
- *critical* that the, for example, 11th backtick-delineated text snippet in this file,
- be read into the 11 string in this vector of strings!
-* This first text snippet that you're now reading -- a README about this file -- is
- ignored by this boilerplate.cpp loop; it is not read into this vector of snippets.
-* To make it easier to track the positional nature of the text snippets in this file,
- the first three characters, plus the leading \n, of these snippets is trimmed off
- and ignored. These first three characters in each string comprise a sequence
- number, for checking against the "const int" list in boilerplate.hpp. So, these
- tags are literally the exactly the 3 characters directly after the backtick termi-
- nating the previous string.
-`000
-/*
- * Test purpose:
- * $purpose
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <string.h>
-#include <stdint.h>
-
-#include "psa/protected_storage.h"
-#include "psa/crypto.h"
-#include "test_framework.h"
-`001
-
-static uint32_t shift_reg = 0x55555555;
-static int i; /* generic counter variable */
-
-static void seed_hasher (void)
-{
- shift_reg = 0x55555555;
-}
-
-static uint32_t lfsr_1b (uint32_t a_bit)
-{
- int odd;
- uint32_t polynomial = 0xb4bcd35c;
-
- odd = ((shift_reg ^ a_bit) & 1) == 1;
- shift_reg >>= 1;
- if (odd == 1) {
- shift_reg ^= polynomial;
- }
- if (shift_reg == 0) {
- /* Should never happen, but... */
- seed_hasher();
- }
- return shift_reg;
-}
-
-static uint32_t crc_byte (uint8_t a_byte)
-{
- int i;
- for (i = 0; i < 8; i++) {
- lfsr_1b ((uint32_t) a_byte);
- a_byte >>= 1;
- }
- return shift_reg;
-}
-
-`002
-
-/* This is not yet right for how to run a test; need to register tests, etc. */
-
-void test_thread (struct test_result_t *ret) {
- psa_status_t crypto_status; /* result from Crypto calls */
- psa_status_t sst_status;
-`003
- (void)sst_status;
- /* "void" to prevent unused-variable warning, since the variable may not
- * be used in this particular test case.
- */
-
- crypto_status = psa_crypto_init();
- if (crypto_status != PSA_SUCCESS) {
- TEST_FAIL("Could not initialize Crypto.");
- return;
- }
-
- TEST_LOG("Test $purpose");
-`004
- static int $var = $init;
-`005
- static uint8_t $var[] = "$init";
-`006
- static uint8_t $var[2048] = "$init";
-`007
- static size_t $var = $init;
-`008
- static psa_key_attributes_t $var;
-`009
- static psa_algorithm_t $var;
-`010
- static psa_key_lifetime_t $var;
-`011
- static psa_key_type_t $var;
-`012
- static psa_key_usage_t $var;
-`013
- static psa_key_handle_t $var;
-`014
- $type $var = $init;
-`015
- TEST_LOG("$message");
-`016
- psa_ps_remove($uid);
-`017
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
-`018
- psa_destroy_key($handle);
-`019
- if (crypto_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down a crypto asset upon test completion");
- return;
- }
-`020
-
- /* Test completed */
- ret->val = TEST_PASSED;
-}
-`021 PSA_SUCCESS`022 PSA_ERROR_DOES_NOT_EXIST`023
- /* $op SST asset $description with data $data_source. */
- sst_status = psa_ps_set($uid, $length, $data,
- $flags);
-`024
- if (sst_status != $expect) {
- TEST_FAIL("psa_ps_set() expected $expect.");
- return;
- }
-`025
- sst_status = psa_ps_get($uid, $offset, $length, $act_data,
- &$act_length);
-`026
- if (sst_status != $expect) {
- TEST_FAIL("psa_ps_get() expected $expect.");
- return;
- }
-`027
- if (sst_status != $expect) {
- TEST_FAIL("psa_ps_get() expected $expect.");
- return;
- }
- /* Check that the data is correct */
- if (memcmp($act_data, $exp_data,
- $length) != 0) {
- TEST_FAIL("Read data should be equal to result data");
- return;
- }
-`028
- /* Hash the actual data for later data-leak checking: */
- seed_hasher();
- for (i = 0; i < strlen((char *) $act_data_var); ++i) {
- crc_byte ($act_data_var[i]);
- }
- /* $hash_var = shift_reg; */
-`029
- sst_status = psa_ps_remove($uid);
-`030
- if (sst_status != $expect) {
- TEST_FAIL("psa_ps_remove() expected $expect.");
- return;
- }
-`031
- $policy = psa_key_attributes_init();
-`032
- psa_reset_key_attributes (&$policy);
-`033
- psa_set_key_usage_flags (
- &$policy,
- psa_get_key_usage_flags (&$policy)
- | $flag
- );
-`034
- psa_set_key_lifetime (&$policy, $life);
-`035
- psa_set_key_bits (&$policy, $size);
-`036
- psa_set_key_type (&$policy, $type);
-`037
- psa_set_key_algorithm (&$policy, $algorithm);
-`038
- psa_set_key_usage_flags (&$policy, $usage);
-`039
- $life = psa_get_key_lifetime (&$policy);
-`040
- $life = psa_get_key_lifetime (&$policy);
- if ($life == PSA_KEY_LIFETIME_VOLATILE) {
- TEST_LOG("$policy: Lifetime is volatile.");
- } else {
- TEST_LOG("$policy: Lifetime is persistent.");
- }
-`041
- $size = psa_get_key_bits (&$policy);
-`042
- $type = psa_get_key_type (&$policy);
-`043
- $type = psa_get_key_type (&$policy);
- TEST_LOG("$policy: Key-type code == $type.");
-`044
- $algorithm = psa_get_key_algorithm (&$policy);
-`045
- $algorithm = psa_get_key_algorithm (&$policy);
- TEST_LOG("$policy: Key-algorithm code == $algorithm.");
-`046
- $usage = psa_get_key_usage_flags (&$policy);
-`047
- if (($usage & $usage_string) != 0) {
- TEST_LOG("$policy: $print_usage_true_string.");
- } else {
- TEST_LOG("$policy: $print_usage_false_string.");
- }
-`048
- crypto_status = psa_get_key_attributes ($key, &$policy);
-`049
- if (crypto_status != $expect) {
- TEST_FAIL("psa_get_key_attributes() expected $expect.");
- return;
- }
-`050
- crypto_status = psa_generate_key (&$policy, &$key);
-`051
- if (crypto_status != $expect) {
- TEST_FAIL("psa_generate_key() expected $expect.");
- return;
- }
-`052
- crypto_status
- = psa_import_key (&$policy, $data, $length, &$key);
-`053
- if (crypto_status != $expect) {
- TEST_FAIL("psa_import_key() expected $expect.");
- return;
- }
-`054
- crypto_status = psa_copy_key ($master, &$policy, &$copy);
-`055
- if (crypto_status != $expect) {
- TEST_FAIL("psa_copy_key() expected $expect.");
- return;
- }
-`056
- /* Check that the data is correct */
- if (memcmp($act_data, $exp_data,
- $length) != 0) {
- TEST_FAIL("Read data should be equal to result data");
- return;
- }
-`057
- crypto_status
- = psa_export_key ($key, $data, $length, &$act_size);
-`058
- if (crypto_status != $expect) {
- TEST_FAIL("psa_export_key() expected $expect.");
- return;
- }
-`059
- crypto_status = psa_destroy_key($key);
-`060
- if (crypto_status != $expect) {
- TEST_FAIL("psa_destroy_key() expected $expect.");
- return;
- }
-`
diff --git a/tools/tf_fuzz/parser/README b/tools/tf_fuzz/parser/README
deleted file mode 100644
index 830148837..000000000
--- a/tools/tf_fuzz/parser/README
+++ /dev/null
@@ -1,10 +0,0 @@
-This directory contains the Lex and YACC grammars for parsing the TF-Fuzz command
-"language" (if it can be called a language as such).
-
-For more information, please browse to:
-
- https://ci.trustedfirmware.org/job/tf-m-build-test-nightly/lastSuccessfulBuild/artifact/build-docs/tf-m_documents/install/doc/user_guide/html/docs/user_guides/tf_fuzz/parser_dir.html
-
---------------
-
-*Copyright (c) 2019-2020, Arm Limited. All rights reserved.*
diff --git a/tools/tf_fuzz/parser/tf_fuzz_grammar.l b/tools/tf_fuzz/parser/tf_fuzz_grammar.l
deleted file mode 100644
index 429e60c63..000000000
--- a/tools/tf_fuzz/parser/tf_fuzz_grammar.l
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-
-%{
-#include "class_forwards.hpp"
-#include "boilerplate.hpp"
-#include "gibberish.hpp"
-#include "compute.hpp"
-#include "string_ops.hpp"
-#include "data_blocks.hpp"
-#include "psa_asset.hpp"
-#include "sst_asset.hpp"
-#include "crypto_asset.hpp"
-#include "find_or_create_asset.hpp"
-#include "template_line.hpp"
-#include "tf_fuzz.hpp"
-#include "psa_call.hpp"
-#include "tf_fuzz_grammar.tab.hpp"
-
-int yycolumn = 1;
-
-//char *yytext;
-
-#define YY_USER_ACTION yylloc.first_line = yylloc.last_line = yylineno; \
- yylloc.first_column = yycolumn; yylloc.last_column = yycolumn + yyleng - 1; \
- yycolumn += yyleng; \
- yylval.str = strdup(yytext);
-
-void yyerror (tf_fuzz_info *, const char *str)
- /* not sure why it sends the yyparse() argument to yyerror(), but OK... */
-{
- fprintf (stderr, "tf_fuzz template on line %d, at text = \"%s\": %s\n",
- yylineno, yytext, str);
- exit (1);
-}
-
-#ifndef yyterminate
-#define yyterminate() return YY_NULL
-#endif
-
-%}
-
-%x BLOCK_COMMENT
-
-%option yylineno
-%option nodefault
-%option noyywrap
-%array
-
-%%
-
-\r ; /* ignore all \r */
-\/\/.*\n ; /* ignore C++-style line comments */
-purpose[ \t]+[^;]*; return PURPOSE;
-"/*" {BEGIN(BLOCK_COMMENT);}
-<BLOCK_COMMENT>"*/" {BEGIN(INITIAL);}
-<BLOCK_COMMENT>\n ;
-<BLOCK_COMMENT>. ;
- /* Root commands: */
-set return SET;
-read return READ;
-remove return REMOVE;
-rm return REMOVE;
-secure return SECURE;
-sec return SECURE;
-done return DONE;
- /* PSA-asset types: */
-sst return SST;
-key return KEY;
-policy return POLICY;
- /* Other root-command operands: */
-expect return EXPECT;
-exp return EXPECT;
-pass return PASS;
-fail return FAIL;
-nothing return NOTHING;
-error return ERROR;
-\{ return OPEN_BRACE;
-\} return CLOSE_BRACE;
-; return SEMICOLON;
-name return NAME;
-uid return UID;
-data return DATA;
-\* return STAR;
-active return ACTIVE;
-act return ACTIVE;
-deleted return DELETED;
-del return DELETED;
-removed return DELETED;
-check return CHECK;
-chk return CHECK;
-var return VAR;
-print return PRINT;
-hash return HASH;
-neq return NEQ;
-dfname return DFNAME;
-shuffle return SHUFFLE;
-shuf return SHUFFLE;
-to return TO;
-of return OF;
- /* SST creation keywords: */
-flag return FLAG;
-none return NONE;
-write_once return WRITE_ONCE;
-wo return WRITE_ONCE;
-no_rp return NO_RP;
-nrp return NO_RP;
-no_conf return NO_CONF;
-ncf return NO_CONF;
- /* Offset into an SST asset */
-offset return OFFSET;
- /* Policy keywords: */
-attributes return ATTR;
-attr return ATTR;
-type return TYPE;
-algorithm return ALG;
-alg return ALG;
- /* Policy-usage and -lifetime keywords: */
-export return EXPORT;
-exp return EXPORT;
-noexport return NOEXPORT;
-nex return NOEXPORT;
-copy return COPY;
-nocopy return NOCOPY;
-encrypt return ENCRYPT;
-encr return ENCRYPT;
-noencrypt return NOENCRYPT;
-nenc return NOENCRYPT;
-decrypt return DECRYPT;
-decr return DECRYPT;
-nodecrypt return NODECRYPT;
-ndecr return NODECRYPT;
-sign return SIGN;
-nosign return NOSIGN;
-verify return VERIFY;
-ver return VERIFY;
-noverify return NOVERIFY;
-nver return NOVERIFY;
-derive return DERIVE;
-der return DERIVE;
-noderive return NODERIVE;
-nder return NODERIVE;
-persistent return PERSISTENT;
-pers return PERSISTENT;
-volatile return VOLATILE;
-vol return VOLATILE;
-from return FROM;
-with return WITH;
- /* Structure operands: */
-[a-zA-z][a-zA-Z_0-9]* {yylval.str = yytext; return IDENTIFIER_TOK;}
-[+-]?[0-9]* {yylval.valueN = atol(yytext); return NUMBER_TOK;}
-\'[a-zA-Z_0-9\/\.]+\' {yylval.str = yytext; return FILE_PATH_TOK;}
-\"[^\"]*\" {yylval.str = yytext; return LITERAL_TOK;}
-\[[a-fA-F 0-9]*\] {yylval.str = yytext; return HEX_LIST;}
- /* inside quotes: anything but a quote, or nothing */
-[ \t\n\r] ; /* ignore white space */
-. yyerror ((tf_fuzz_info *) NULL, "Unexpected character");
-
-%%
-
diff --git a/tools/tf_fuzz/parser/tf_fuzz_grammar.y b/tools/tf_fuzz/parser/tf_fuzz_grammar.y
deleted file mode 100644
index 17c31b4b6..000000000
--- a/tools/tf_fuzz/parser/tf_fuzz_grammar.y
+++ /dev/null
@@ -1,1423 +0,0 @@
-/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-%{
-#include <iostream>
-#include <vector>
-#include <set>
-
-#include "class_forwards.hpp"
-#include "data_blocks.hpp"
-#include "boilerplate.hpp"
-#include "gibberish.hpp"
-#include "compute.hpp"
-#include "string_ops.hpp"
-#include "psa_asset.hpp"
-#include "find_or_create_asset.hpp"
-#include "template_line.hpp"
-#include "tf_fuzz.hpp"
-#include "sst_asset.hpp"
-#include "crypto_asset.hpp"
-#include "psa_call.hpp"
-#include "crypto_call.hpp"
-#include "sst_call.hpp"
-#include "security_call.hpp"
-#include "secure_template_line.hpp"
-#include "sst_template_line.hpp"
-#include "crypto_template_line.hpp"
-
-/* These items are defined in tf_fuzz_grammar.l. Note, however that, because
- of "name mangling," defining them as extern "C" may or may not be ideal,
- depending upon which compiler -- gcc vs. g++, compiles the output from lex.
- So far, it seems best without the extern "C", including also compiling
- under Visual Studio. */
-/* extern "C"
-{ */
- extern int yylineno;
- int yywrap() {return 1;}
- extern char yytext[];
- extern int yyleng;
-/* } */
-
-int yylex (void);
-void yyerror (tf_fuzz_info *, const char *);
- /* Sends the yyparse() argument to yyerror(), probably, to print incorrect
- text it parsed. */
-
-/* A few consts just to make code more comprehensible: */
-const bool yes_fill_in_template = true;
-const bool dont_fill_in_template = false;
-const bool yes_create_call = true;
-const bool dont_create_call = false;
-
-tf_fuzz_info *rsrc;
-
-/* These are object pointers used to parse the template and create the test. Ac-
- tually, probably only templateLin is used for now, but this is a good outline of
- of the template_line class hierarchy. */
-template_line *templateLin = nullptr;
- sst_template_line *sstTemplateLin = nullptr;
- set_sst_template_line *setSstTemplateLin = nullptr;
- read_sst_template_line *reaSstTemplateLin = nullptr;
- remove_sst_template_line *remSstTemplateLin = nullptr;
- policy_template_line *polTemplateLin = nullptr;
- set_policy_template_line *setPolTemplateLin = nullptr;
- read_policy_template_line *reaPolTemplateLin = nullptr;
- key_template_line *keyTemplateLin = nullptr;
- set_key_template_line *setKeyTemplateLin = nullptr;
- read_key_template_line *reaKeyTemplateLin = nullptr;
- remove_key_template_line *remKeyTemplateLin = nullptr;
- security_template_line *secTemplateLin = nullptr;
- security_hash_template_line *secHasTemplateLin = nullptr;
-/* Call and asset objects are presumably not immediately needed, because the objects
- of these types are within the resource object, *rsrc, but even if only just to
- show that class hierarchy: */
-psa_call *psaCal = nullptr;
- sst_call *sstCal = nullptr;
- sst_set_call *sstSetCal = nullptr;
- sst_get_call *sstGetCal = nullptr;
- sst_remove_call *sstRemCal = nullptr;
- crypto_call *cryCal = nullptr;
- policy_call *polCal = nullptr;
- init_policy_call *iniPolCal = nullptr;
- reset_policy_call *resPolCal = nullptr;
- add_policy_usage_call *addPolUsaCal = nullptr;
- set_policy_lifetime_call *setPolLifCal = nullptr;
- set_policy_type_call *setPolTypCal = nullptr;
- set_policy_algorithm_call *setPolAlgCal = nullptr;
- set_policy_usage_call *setPolUsaCal = nullptr;
- get_policy_lifetime_call *getPolLifCal = nullptr;
- get_policy_type_call *getPolTypCal = nullptr;
- get_policy_algorithm_call *getPolAlgCal = nullptr;
- get_policy_usage_call *getPolUsaCal = nullptr;
- get_policy_size_call *getPolSizCal = nullptr;
- get_key_policy_call *getKeyPolCal = nullptr;
- key_call *keyCal = nullptr;
- generate_key_call *genKeyCal = nullptr;
- create_key_call *creKeyCal = nullptr;
- copy_key_call *copKeyCal = nullptr;
- read_key_data_call *reaKeyDatCal = nullptr;
- remove_key_call *remKeyCal = nullptr;
-psa_asset *psaAst = nullptr;
- sst_asset *sstAst = nullptr;
- crypto_asset *cryAst = nullptr;
- policy_asset *polAst = nullptr;
- key_asset *keyAst = nullptr;
-
-/* For generating random, but readable/memorable, data: */
-gibberish gib;
-char gib_buff[4096]; // spew gibberish into here
-int rand_data_length = 0;
-
-/* General-utility variables: */
-bool purpose_defined = false;
-psa_asset_usage random_asset = psa_asset_usage::all;
- /* to pick what type of asset at random */
-bool random_name; /* template didn't specify name, so it's generated randomly */
-string literal_data; /* literal data for an asset value */
-
-/* Holders for state in read commands: */
-expect_info expect; /* everything about expected results and data */
-set_data_info set_data; /* everything about setting the value of PSA-asset data */
-asset_name_id_info parsed_asset; /* everything about identifying assets */
-string target_barrier = ""; /* asset to set and search barrier when re-ordering PSA calls */
-key_policy_info policy_info; /* everything about key policies */
-bool assign_data_var_specified = false;
-string assign_data_var;
-bool print_data = false; /* true to just print asset data to the test log */
-bool hash_data = false; /* true to just print asset data to the test log */
-bool literal_is_string = true;
- /* if true, literal value is character-string; if false, is list of hex values */
-
-/* The following are more tied to the template syntax than to the resulting PSA calls */
-string literal; /* temporary holder for all string literals */
-string identifier; /* temporary holder for strings representing identifiers */
-string var_name; /* a variable name */
-string asset_name; /* as parsed, not yet put into parsed_asset */
-string aid; /* string-typed holder for an asset ID in a list thereof */
-int nid; /* same idea as aid, but for asset ID# lists */
-size_t strFind1, strFind2; /* for searching through strings */
-
-/* Because of the parsing order, psa_calls of the specific type have to be
- push_back()ed onto rsrc->calls before their expected results are known. Therefore,
- must inject those results after parsing the expected results. add_expect is a
- loop index to track where to add results. */
-unsigned int add_expect = 0;
-
-/* Temporaries: */
-vector<psa_asset*>::iterator t_sst_asset;
-vector<psa_asset*>::iterator t_key_asset;
-vector<psa_asset*>::iterator t_policy_asset;
-sst_call *t_sst_call = nullptr;
-key_call *t_key_call = nullptr;
-policy_call *t_policy_call = nullptr;
-long number; /* temporary holder for a number, e.g., sting form of UID */
-int i, j, k;
-
-/* Relating to template-statement blocks: */
-vector<template_line*> template_block_vector; /* (must be *pointers to* templates) */
-vector<int> block_order; /* "statisticalized" order of template lines in a block */
-int nesting_level = 0;
- /* how many levels deep in { } nesting currently. Initially only 0 or 1. */
-bool shuffle_not_pick;
- /* true to shuffle statements in a block, rather than pick so-and-so
- number of them at random. */
-int low_nmbr_lines = 1; /* if picking so-and-so number of template lines from a ... */
-int high_nmbr_lines = 1; /* ... block at random, these are fewest and most lines. */
-int exact_nmbr_lines = 1;
-
-using namespace std;
-
-
-void set_purp_str (
- char *raw_purpose, /* the purpose C string from parser */
- tf_fuzz_info *rsrc /* test resources containing the actual test-purpose string */
-) {
- size_t l; /* temporary of size_t type */
- string purp_str = raw_purpose;
- strFind1 = purp_str.find (" ");
- purp_str = purp_str.substr (strFind1, purp_str.length());
- purp_str.erase (0, 1); // (extra space)
- strFind1 = purp_str.rfind (";");
- purp_str = purp_str.substr (0, strFind1);
- l = 0;
- do { /* escape all " chars (if not already escaped) */
- l = purp_str.find ("\"", l);
- if ( l < purp_str.length()) { /* did find a quote character */
- if ( l == 0 /* it's the first character in the string*/
- || purp_str[l-1] != '\\' /* or it's not already escaped */
- ) {
- purp_str.insert (l, "\\"); /* then escape the " char */
- l++; /* point l to the " again */
- }
- l++; /* point l past the " */
- }
- } while (l < purp_str.length());
- rsrc->test_purpose = purp_str;
-}
-
-/* randomize_template_lines() chooses a template-line order in cases where they are to
- be randomized -- shuffled or random picked. */
-void randomize_template_lines (
- bool shuffle_not_pick, /* true to perform a shuffle operation rather than pick */
- int &low_nmbr_lines, /* if picking so-and-so number of template lines from a ... */
- int &high_nmbr_lines, /* ... block at random, these are fewest and most lines. */
- int &exact_nmbr_lines,
- vector<template_line*> &template_block_vector,
- vector<int> &block_order,
- tf_fuzz_info *rsrc /* test resources containing the actual test-purpose string */
-) {
- set<int> template_used; /* used for shuffle */
- low_nmbr_lines = (low_nmbr_lines < 0)? 0 : low_nmbr_lines;
- high_nmbr_lines = (high_nmbr_lines < 0)? 0 : high_nmbr_lines;
- if (low_nmbr_lines > high_nmbr_lines) {
- int swap = low_nmbr_lines;
- low_nmbr_lines = high_nmbr_lines;
- high_nmbr_lines = swap;
- }
- template_used.clear();
- if (shuffle_not_pick) {
- /* Choose a random order in which to generate all of the
- template lines in the block: */
- while (template_used.size() < template_block_vector.size()) {
- i = rand() % template_block_vector.size();
- if (template_used.find (i) == template_used.end()) {
- /* This template not already shuffled in. */
- block_order.push_back (i);
- template_used.insert (i);
- }
- }
- /* Done shuffling; empty out the set: */
- } else {
- if (high_nmbr_lines == low_nmbr_lines) {
- exact_nmbr_lines = low_nmbr_lines;
- /* just in case the template says "3 to 3 of"... */
- } else {
- exact_nmbr_lines = low_nmbr_lines
- + (rand() % ( high_nmbr_lines
- - low_nmbr_lines + 1 ) );
- }
- for (int j = 0; j < exact_nmbr_lines; ++j) {
- /* Repeatedly choose a random template line from the block: */
- i = rand() % template_block_vector.size();
- block_order.push_back (i);
- }
- }
- IVM(cout << "Order of lines in block: " << flush;
- for (auto i : block_order) {
- cout << i << " ";
- }
- cout << endl;
- )
-}
-
-/* interpret_template_line() fills in random data, locates PSA assets, (etc.) and
- conditionally creates PSA calls for a given template line. Note that there needs
- to be a single place where all of this is done, so that statement blocks can be
- randomized and then dispatched from a single point. */
-void interpret_template_line (
- template_line *templateLin, /* the template line to process */
- tf_fuzz_info *rsrc, /* program resources in general */
- set_data_info &set_data, psa_asset_usage random_asset,
- bool assign_data_var_specified, expect_info &expect, key_policy_info &policy_info,
- bool print_data, bool hash_data, string asset_name, string assign_data_var,
- asset_name_id_info &asset_info, /* everything about the asset(s) involved */
- bool create_call_bool, /* true to create the PSA call at this time */
- bool create_asset_bool, /* true to create the PSA asset at this time */
- bool fill_in_template, /* true to back-fill info into template */
- int instance
- /* if further differentiation to the names or IDs is needed, make instance >0 */
-) {
- const bool yes_fill_in_template = true; /* just to improve readability */
- vector<psa_asset*>::iterator t_psa_asset;
-
- if (fill_in_template) {
- /* Set basic parameters from the template line: */
- templateLin->set_data = set_data;
- templateLin->expect = expect;
- templateLin->policy_info = policy_info;
- templateLin->asset_info.id_n_not_name = asset_info.id_n_not_name;
- templateLin->asset_info.set_name (asset_name);
- /* Fill in state parsed from the template below: */
- templateLin->assign_data_var_specified = assign_data_var_specified;
- templateLin->assign_data_var.assign (assign_data_var);
- templateLin->print_data = print_data;
- templateLin->hash_data = hash_data;
- templateLin->random_asset = random_asset;
- if ( set_data.literal_data_not_file && !set_data.random_data
- && set_data.string_specified) {
- templateLin->set_data.set (literal_data);
- }
- /* Save names or IDs to the template-line tracker: */
- for (auto id_no : asset_info.asset_id_n_vector) {
- templateLin->asset_info.asset_id_n_vector.push_back (id_no);
- }
- asset_info.asset_id_n_vector.clear();
- for (auto as_name : asset_info.asset_name_vector) {
- templateLin->asset_info.asset_name_vector.push_back (as_name);
- }
- asset_info.asset_name_vector.clear();
- }
-
- /* Random asset choice (e.g., *active) case: */
- if (templateLin->random_asset != psa_asset_usage::all) {
- /* Just create the call tracker; random name chosen in simulation stage: */
- templateLin->setup_call (set_data, templateLin->set_data.random_data,
- yes_fill_in_template, create_call_bool,
- templateLin, rsrc );
- } else if (asset_info.id_n_not_name) {
- /* Not random asset; asset(s) by ID rather than name. Go through all
- specified asset IDs: */
- uint64_t id_no;
- for (auto id_n : templateLin->asset_info.asset_id_n_vector) {
- id_no = id_n + (uint64_t) instance * 10000UL;
- templateLin->asset_info.set_id_n(id_no); /* just a holder */
- asset_name = templateLin->asset_info.make_id_n_based_name (id_no);
- templateLin->asset_info.set_calc_name (asset_name);
- templateLin->expect.data_var = var_name;
- if (!set_data.literal_data_not_file) {
- templateLin->set_data.set_file (set_data.file_path);
- }
- templateLin->setup_call (set_data, templateLin->set_data.random_data,
- fill_in_template, create_call_bool,
- templateLin, rsrc );
- }
- } else {
- /* Not random asset, asset(s) specified by name. Go through all specified
- asset names: */
- for (auto as_name : templateLin->asset_info.asset_name_vector) {
- /* Also copy into template line object's local vector: */
- if (instance > 0) {
- templateLin->asset_info.set_name (as_name + "_" + to_string (instance));
- } else {
- templateLin->asset_info.set_name (as_name);
- }
- /* Give each occurrence a different random ID: */
- templateLin->asset_info.set_id_n (100 + (rand() % 10000));
- /* TODO: unlikely, but this *could* alias! */
- templateLin->setup_call (set_data, templateLin->set_data.random_data,
- yes_fill_in_template, create_call_bool,
- templateLin, rsrc );
- }
- }
-}
-
-%}
-
-%start lines
-
-%union {int valueN; int tokenN; char *str;}
-%token <tokenN> PURPOSE RAW_TEXT
-%token <tokenN> SET READ REMOVE SECURE DONE /* root commands */
-%token <tokenN> SST KEY POLICY NAME UID STAR ACTIVE DELETED EQUAL DATA DFNAME
-%token <tokenN> FLAG NONE WRITE_ONCE NO_RP NO_CONF /* SST creation flag keywords */
-%token <tokenN> OFFSET /* offset into an SST asset */
-%token <tokenN> CHECK VAR HASH NEQ PRINT EXPECT PASS FAIL NOTHING ERROR /* expected results */
-%token <str> IDENTIFIER_TOK LITERAL_TOK HEX_LIST FILE_PATH_TOK /* variables and content */
-%token <valueN> NUMBER_TOK /* variables and content */
-%token <tokenN> SEMICOLON SHUFFLE TO OF OPEN_BRACE CLOSE_BRACE /* block structure */
-%token <tokenN> ATTR TYPE ALG /* "set policy" line portions */
-%token <tokenN> EXPORT COPY ENCRYPT DECRYPT SIGN VERIFY DERIVE /* key-usage keywords */
-%token <tokenN> NOEXPORT NOCOPY NOENCRYPT NODECRYPT NOSIGN NOVERIFY NODERIVE
-%token <tokenN> PERSISTENT VOLATILE /* key lifetime keywords */
-%token <tokenN> FROM /* for copying a key "from" another */
-%token <tokenN> WITH /* for specifying a key without explicitly defining a policy */
-
-%define parse.error verbose
-%locations
-%parse-param {tf_fuzz_info *rsrc}
-
-%%
-
- /* Top-level syntax: */
-lines:
- %empty /* nothing */
- | line lines {
- IVM(cout << "Lines: Line number " << dec << yylineno << "." << endl;)
- /* Re-randomize objects we parse into: */
- expect = expect_info();
- set_data = set_data_info();
- parsed_asset = asset_name_id_info();
- policy_info = key_policy_info();
- }
- ;
-
-line:
- PURPOSE {
- IVM(cout << "Purpose line: " << flush;)
- set_purp_str (yytext, rsrc);
- IVM(cout << rsrc->test_purpose << endl;)
- /* TODO: Is there much/any value in turning this back on? The
- constructor clear()s them out, and run-time errors observed
- under Visual Studio...
- Just a precaution to make sure that these vectors start out empty.
- Should inherently be, but purpose is typically specified first:
- parsed_asset.asset_id_n_vector.clear();
- parsed_asset.asset_name_vector.clear(); */
- /* Re-randomize or re-initialize objects we parse into: */
- purpose_defined = true;
- expect = expect_info();
- set_data = set_data_info();
- parsed_asset = asset_name_id_info();
- policy_info = key_policy_info();
- target_barrier = "";
- }
- | block {
- /* TODO: This code may not won't work with "secure hash neq ..." */
- IVM(cout << "Block of lines." << endl;)
- /* "Statisticalize" :-) the vector of template lines, then crank
- the selected lines in order here. */
- randomize_template_lines (shuffle_not_pick,
- low_nmbr_lines, high_nmbr_lines, exact_nmbr_lines,
- template_block_vector, block_order, rsrc
- );
- /* Vector block_order contains the sequence of template lines to be
- realized, in order. Pop the indicated template line off the
- vector and generate code from it: */
- k = 0; /* ID adder to at least help ensure uniqueness */
- for (int i : block_order) {
- templateLin = template_block_vector[i];
- /* Note that temLin will have its fields filled in already. */
- interpret_template_line (
- templateLin, rsrc, set_data, random_asset,
- assign_data_var_specified, expect, policy_info,
- print_data, hash_data, asset_name, assign_data_var, parsed_asset,
- yes_create_call, /* did not create call nor asset earlier */
- yes_create_asset,
- dont_fill_in_template, /* but did fill it all in before */
- 0
- );
- k++;
- for (add_expect = 0; add_expect < rsrc->calls.size(); ++add_expect) {
- if (!(rsrc->calls[add_expect]->exp_data.expected_results_saved)) {
- templateLin->expect.copy_expect_to_call (rsrc->calls[add_expect]);
- templateLin->expect.expected_results_saved = true;
- }
- }
- }
- templateLin->asset_info.asset_id_n_vector.clear();
- templateLin->asset_info.asset_name_vector.clear();
- /* Done. Empty out the "statisticalization" vector: */
- block_order.clear();
- /* Empty out the vector of template lines; no longer needed. */
- template_block_vector.clear();
- --nesting_level;
- IVM(cout << "Finished coding block of lines." << endl;)
- }
- | command SEMICOLON {
- IVM(cout << "Command with no expect: \"" << flush;)
- if (!purpose_defined) {
- cerr << endl << endl
- << "Error: Please begin your test with the \"purpose\" "
- << "directive. \n For example, "
- << "\"purpose to exercise crypto and SST...\"" << endl;
- exit (1024);
- }
- if (nesting_level == 0) { /* if laying down the code now... */
- for (add_expect = 0; add_expect < rsrc->calls.size(); ++add_expect) {
- if (!(rsrc->calls[add_expect]->exp_data.expected_results_saved)) {
- templateLin->expect.copy_expect_to_call (rsrc->calls[add_expect]);
- templateLin->expect.expected_results_saved = true;
- }
- }
- delete templateLin; /* done with this template line */
- } else {
- /* The template line is now fully decoded, so stuff it onto
- vector of lines to be "statisticalized": */
- template_block_vector.push_back (templateLin);
- }
- IVM(cout << yytext << "\"" << endl;)
- }
- | command expect SEMICOLON {
- /* (This is the same as for command SEMICOLON, other than the IVM.) */
- IVM(cout << "Command with expect: \"" << flush;)
- if (!purpose_defined) {
- cerr << endl << endl
- << "Error: Please begin your test with the \"purpose\" "
- << "directive. \n For example, "
- << "\"purpose to exercise crypto and SST...\"" << endl;
- exit (1024);
- }
- if (nesting_level == 0) {
- for (add_expect = 0; add_expect < rsrc->calls.size(); ++add_expect) {
- if (!(rsrc->calls[add_expect]->exp_data.expected_results_saved)) {
- templateLin->expect.copy_expect_to_call (rsrc->calls[add_expect]);
- templateLin->expect.expected_results_saved = true;
- }
- }
- delete templateLin;
- } else {
- template_block_vector.push_back (templateLin);
- }
- IVM(cout << yytext << "\"" << endl;)
- }
- ;
-
-command:
- set_command {
- IVM(cout << "Set command: \"" << yytext << "\"" << endl;)
- }
- | remove_command {
- IVM(cout << "Remove command: \"" << yytext << "\"" << endl;)
- }
- | read_command {
- IVM(cout << "Read command: \"" << yytext << "\"" << endl;)
- }
- | secure_command {
- IVM(cout << "Security command: \"" << yytext << "\"" << endl;)
- }
- | done_command {
- IVM(cout << "Done command: \"" << yytext << "\"" << endl;)
- }
- ;
-
-expect:
- EXPECT PASS {
- IVM(cout << "Expect pass clause: \"" << flush;)
- templateLin->expect.set_pf_pass();
- IVM(cout << yytext << "\"" << endl;)
- }
- | EXPECT FAIL {
- IVM(cout << "Expect fail clause: \"" << flush;)
- templateLin->expect.set_pf_fail();
- IVM(cout << yytext << "\"" << endl;)
- }
- | EXPECT NOTHING {
- IVM(cout << "Expect nothing clause: \"" << flush;)
- templateLin->expect.set_pf_nothing();
- IVM(cout << yytext << "\"" << endl;)
- }
- | EXPECT IDENTIFIER {
- IVM(cout << "Expect error clause: \"" << flush;)
- templateLin->expect.set_pf_error (identifier);
- IVM(cout << yytext << "\"" << endl;)
- }
- ;
-
- /* Root commands: */
-set_command:
- SET SST sst_set_base_args sst_set_extended_args {
- IVM(cout << "Set SST command: \"" << yytext << "\"" << endl;)
- templateLin = new set_sst_template_line (rsrc);
- interpret_template_line (
- templateLin, rsrc, set_data, random_asset,
- assign_data_var_specified, expect, policy_info,
- print_data, hash_data, asset_name, assign_data_var, parsed_asset,
- nesting_level == 0 /* create call unless inside {} */,
- nesting_level == 0 /* similarly, create asset unless inside {} */,
- yes_fill_in_template, 0
- );
- }
- | SET KEY key_set_args {
- IVM(cout << "Set key command: \"" << yytext << "\"" << endl;)
- templateLin = new set_key_template_line (rsrc);
- target_barrier = policy_info.asset_2_name; /* policy */
- interpret_template_line (
- templateLin, rsrc, set_data, random_asset,
- assign_data_var_specified, expect, policy_info,
- print_data, hash_data, asset_name, assign_data_var, parsed_asset,
- nesting_level == 0 /* create call unless inside {} */,
- nesting_level == 0 /* similarly, create asset unless inside {} */,
- yes_fill_in_template, 0
- );
- }
- | SET POLICY policy_set_args {
- IVM(cout << "Set policy command: \"" << yytext << "\"" << endl;;)
- templateLin = new set_policy_template_line (rsrc);
- interpret_template_line (
- templateLin, rsrc, set_data, random_asset,
- assign_data_var_specified, expect, policy_info,
- print_data, hash_data, asset_name, assign_data_var, parsed_asset,
- nesting_level == 0 /* create call unless inside {} */,
- nesting_level == 0 /* similarly, create asset unless inside {} */,
- yes_fill_in_template, 0
- );
- }
- ;
-
-read_command:
- READ SST sst_read_args {
- IVM(cout << "Read SST command: \"" << yytext << "\"" << endl;;)
- templateLin = new read_sst_template_line (rsrc);
- interpret_template_line (
- templateLin, rsrc, set_data, random_asset,
- assign_data_var_specified, expect, policy_info,
- print_data, hash_data, asset_name, assign_data_var, parsed_asset,
- nesting_level == 0 /* create call unless inside {} */,
- dont_create_asset /* if no such asset exists, fail the call */,
- yes_fill_in_template, 0
- );
- }
- | READ KEY key_read_args {
- IVM(cout << "Read key command: \"" << yytext << "\"" << endl;;)
- templateLin = new read_key_template_line (rsrc);
- interpret_template_line (
- templateLin, rsrc, set_data, random_asset,
- assign_data_var_specified, expect, policy_info,
- print_data, hash_data, asset_name, assign_data_var, parsed_asset,
- nesting_level == 0 /* create call unless inside {} */,
- dont_create_asset /* if no such asset exists, fail the call */,
- yes_fill_in_template, 0
- );
- }
- | READ POLICY policy_read_args {
- IVM(cout << "Read policy command: \"" << yytext << "\"" << endl;;)
- templateLin = new read_policy_template_line (rsrc);
- interpret_template_line (
- templateLin, rsrc, set_data, random_asset,
- assign_data_var_specified, expect, policy_info,
- print_data, hash_data, asset_name, assign_data_var, parsed_asset,
- nesting_level == 0 /* create call unless inside {} */,
- dont_create_asset /* if no such asset exists, fail the call */,
- yes_fill_in_template, 0
- );
- }
- ;
-
-remove_command:
- REMOVE SST sst_remove_args {
- IVM(cout << "Remove SST command: \"" << yytext << "\"" << endl;;)
- templateLin = new remove_sst_template_line (rsrc);
- interpret_template_line (
- templateLin, rsrc, set_data, random_asset,
- assign_data_var_specified, expect, policy_info,
- print_data, hash_data, asset_name, assign_data_var, parsed_asset,
- nesting_level == 0 /* create call unless inside {} */,
- dont_create_asset /* don't create an asset being deleted */,
- yes_fill_in_template, 0
- );
- }
- | REMOVE KEY key_remove_args {
- IVM(cout << "Remove key command: \"" << yytext << "\"" << endl;;)
- templateLin = new remove_key_template_line (rsrc);
- templateLin->asset_info.set_name (asset_name); // set in key_asset_name, below
- interpret_template_line (
- templateLin, rsrc, set_data, random_asset,
- assign_data_var_specified, expect, policy_info,
- print_data, hash_data, asset_name, assign_data_var, parsed_asset,
- nesting_level == 0 /* create call unless inside {} */,
- dont_create_asset /* don't create an asset being deleted */,
- yes_fill_in_template, 0
- );
- }
- ;
-
-secure_command: SECURE HASH NEQ ASSET_IDENTIFIER_LIST {
- /* TODO: This needs to allow not only SST assets, but mix and match with others
- (keys especially) as well. */
- IVM(cout << "Secure hash command: \"" << yytext << "\"" << endl;)
- templateLin = new security_hash_template_line (rsrc);
- templateLin->asset_info.set_name (asset_name);
- templateLin->assign_data_var_specified = assign_data_var_specified;
- templateLin->assign_data_var.assign (assign_data_var);
- templateLin->expect = expect;
- templateLin->print_data = print_data;
- templateLin->hash_data = hash_data;
- templateLin->random_asset = random_asset;
- /* Hash checks are different from the rest in that there's a single
- "call" -- not a PSA call though -- for all of the assets cited in the
- template line. In *other* cases, create a single call for *each*
- asset cited by the template line, but not in this case. */
- for (auto as_name : parsed_asset.asset_name_vector) {
- /* Also copy into template line object's local vector: */
- templateLin->asset_info.asset_name_vector.push_back (as_name);
- }
- /* Don't need to locate the assets, so no searches required. */
- templateLin->expect.data_var = var_name;
- templateLin->setup_call (set_data, set_data.random_data, yes_fill_in_template,
- nesting_level == 0, templateLin, rsrc );
- parsed_asset.asset_name_vector.clear();
-
-
- }
- ;
-
-done_command: DONE {
- if (nesting_level != 0) {
- cerr << "\n\"done\" only available at outer-most { } nesting level."
- << endl;
- exit (702);
- } else {
- YYACCEPT;
- }
- }
- ;
-
-literal_or_random_data:
- DATA LITERAL {
- IVM(cout << "Create from literal data: \"" << flush;)
- set_data.random_data = false;
- set_data.string_specified = true;
- set_data.literal_data_not_file = true;
- literal.erase(0,1); // zap the ""s
- literal.erase(literal.length()-1,1);
- literal_data.assign (literal);
- IVM(cout << yytext << "\"" << endl;)
- }
- | DATA STAR { /* TF-Fuzz supplies random data */
- IVM(cout << "Create from random data" << endl;)
- set_data.randomize();
- literal.assign (set_data.get()); /* just in case something uses literal */
- set_data.random_data = true;
- set_data.string_specified = false;
- }
- ;
-
- /* Root-command parameters: */
-sst_set_base_args:
- sst_asset_name literal_or_random_data
- | sst_asset_name {
- IVM(cout << "SST-create from random data (no 'data *')" << endl;)
- set_data.randomize();
- literal.assign (set_data.get()); /* just in case something uses literal */
- }
- | sst_asset_name VAR IDENTIFIER { /* set from variable */
- IVM(cout << "SST-set set from variable: \"" << flush;)
- assign_data_var.assign (identifier);
- assign_data_var_specified = true;
- expect.data_specified = false;
- expect.data_var_specified = false;
- IVM(cout << yytext << "\"" << endl;)
- }
- | sst_asset_name DFNAME sst_asset_set_file_path {
- set_data.literal_data_not_file = set_data.random_data = false;
- IVM(cout << "SST-create from file: " << yytext << "\"" << endl;)
- /* TODO: Need to decide whether the concept of using files to set SST
- asset values has meaning, and if so, write code to write code to
- set data appropriately from the file. */
- }
- ;
-
-sst_set_extended_args:
- %empty /* nothing */
- | FLAG sst_flags {
- IVM(cout << "SST creation flags" << endl;)
- IVM(cout << yytext << "\"" << endl;)
- }
- ;
-
-sst_flags:
- %empty /* nothing */
- | sst_flag sst_flags {
- IVM(cout << "SST creation flag" << endl;)
- IVM(cout << yytext << "\"" << endl;)
- }
- ;
-
-sst_flag: none | write_once | no_rp | no_conf;
-
-none : NONE {
- set_data.flags_string = "PSA_STORAGE_FLAG_NONE";
- /* TODO: grab from boilerplate */
- IVM(cout << "SST no storage flag: " << yytext << "\"" << endl;)
- }
- ;
-
-write_once : WRITE_ONCE {
- set_data.flags_string = "PSA_STORAGE_FLAG_WRITE_ONCE";
- /* TODO: grab from boilerplate */
- IVM(cout << "SST write-once flag: " << yytext << "\"" << endl;)
- }
- ;
-
-no_rp : NO_RP {
- set_data.flags_string = "PSA_STORAGE_FLAG_NO_REPLAY_PROTECTION";
- /* TODO: grab from boilerplate */
- IVM(cout << "SST no-replay-protection flag: "
- << yytext << "\"" << endl;)
- }
- ;
-
-no_conf : NO_CONF {
- set_data.flags_string = "PSA_STORAGE_FLAG_NO_CONFIDENTIALITY";
- /* TODO: grab from boilerplate */
- IVM(cout << "SST no-confidentiality flag: " << yytext
- << "\"" << endl;)
- }
- ;
-
-sst_offset_spec:
- NUMBER_TOK {
- IVM(cout << "SST-data offset: \"" << flush;)
- set_data.data_offset = atol(yytext);
- IVM(cout << yytext << "\"" << endl;)
- }
- ;
-
-
-sst_read_args:
- sst_asset_name read_args sst_read_extended_args {
- IVM(cout << "SST-read arguments: " << yytext << "\"" << endl;)
- }
- ;
-
-read_args:
- VAR IDENTIFIER { /* dump to variable */
- IVM(cout << "Read dump to variable: \"" << flush;)
- assign_data_var.assign (identifier);
- assign_data_var_specified = true;
- expect.data_specified = false;
- expect.data_var_specified = false;
- IVM(cout << yytext << "\"" << endl;)
- }
- | CHECK read_args_var_name { /* check against variable */
- IVM(cout << "Read check against variable: \""
- << yytext << "\"" << endl;)
- set_data.set (literal);
- assign_data_var_specified = false;
- expect.data_specified = false;
- expect.data_var_specified = true;
- expect.data_var = identifier;
- }
- | CHECK LITERAL { /* check against literal */
- IVM(cout << "Read check against literal: " << flush;)
- expect.data.assign (literal);
- expect.data.erase(0,1); // zap the ""s
- expect.data.erase(expect.data.length()-1,1);
- assign_data_var_specified = false; /* don't read variable */
- expect.data_specified = true; /* check against literal data */
- expect.data_var_specified = false; /* don't check against variable */
- IVM(cout << yytext << endl;)
- }
- | PRINT { /* print out content in test log */
- IVM(cout << "Read log to test log: \"" << flush;)
- /* TODO: set_data content probably doesn't need to be set here;
- constructor probably sets it fine. */
- set_data.random_data = false;
- set_data.literal_data_not_file = true;
- assign_data_var_specified = false;
- expect.data_specified = false;
- expect.data_var_specified = false;
- print_data = true;
- IVM(cout << yytext << "\"" << endl;)
- }
- | HASH { /* hash the data and save for later comparison */
- IVM(cout << "Read hash for future data-leak detection: \"" << flush;)
- /* TODO: set_data content probably doesn't need to be set here;
- constructor probably sets it fine. */
- set_data.random_data = false;
- set_data.literal_data_not_file = true;
- assign_data_var_specified = false;
- expect.data_specified = false;
- expect.data_var_specified = false;
- hash_data = true;
- rsrc->include_hashing_code = true;
- IVM(cout << yytext << "\"" << endl;)
- }
- | DFNAME sst_asset_dump_file_path { /* dump to file */
- IVM(cout << "Read dump to file: \""
- << yytext << "\"" << endl;)
- set_data.literal_data_not_file = set_data.random_data = false;
- }
- ;
-
-sst_read_extended_args:
- %empty /* nothing */
- | OFFSET sst_offset_spec {
- IVM(cout << "SST data offset" << endl;)
- set_data.data_offset = atol(yytext);
- IVM(cout << yytext << "\"" << endl;)
- }
- ;
-
-sst_remove_args:
- sst_asset_name | random_picked_asset {
- IVM(cout << "SST-remove arguments: \""
- << yytext << "\"" << endl;)
- }
- ;
-
-asset_designator:
- NAME ASSET_IDENTIFIER_LIST {
- IVM(cout << "Asset identifier list: \"" << flush;)
- random_name = false;
- asset_name.assign (identifier); /* TODO: Not sure this ultimately has any effect... */
- random_asset = psa_asset_usage::all; /* don't randomly choose existing asset */
- parsed_asset.id_n_not_name = false;
- IVM(cout << yytext << "\"" << endl;)
- }
- | NAME STAR {
- IVM(cout << "Asset random identifier: \"" << flush;)
- random_name = true;
- rand_data_length = 4 + (rand() % 5);
- gib.word (false, gib_buff, gib_buff + rand_data_length - 1);
- aid.assign (gib_buff);
- parsed_asset.asset_name_vector.push_back (aid);
- random_asset = psa_asset_usage::all; /* don't randomly choose existing asset */
- parsed_asset.id_n_not_name = false;
- IVM(cout << yytext << "\"" << endl;)
- }
- ;
-single_existing_asset:
- IDENTIFIER {
- IVM(cout << "Single existing asset by name: \"" << flush;)
- random_name = false;
- policy_info.asset_3_name.assign (identifier);
- random_asset = psa_asset_usage::all; /* don't randomly choose existing asset */
- parsed_asset.id_n_not_name = false;
- IVM(cout << yytext << "\"" << endl;)
- }
- | random_picked_asset
- ;
-
-random_picked_asset:
- STAR ACTIVE {
- IVM(cout << "Asset random active: \"" << flush;)
- random_asset = psa_asset_usage::active;
- parsed_asset.id_n_not_name = false;
- IVM(cout << yytext << "\"" << endl;)
- }
- | STAR DELETED {
- IVM(cout << "Asset random deleted: \"" << flush;)
- random_asset = psa_asset_usage::deleted;
- parsed_asset.id_n_not_name = false;
- IVM(cout << yytext << "\"" << endl;)
- }
- ;
-
-sst_asset_name:
- asset_designator
- | UID ASSET_NUMBER_LIST {
- IVM(cout << "SST-asset UID list: \"" << flush;)
- random_name = false;
- random_asset = psa_asset_usage::all; /* don't randomly choose existing asset */
- parsed_asset.id_n_not_name = true;
- parsed_asset.id_n_specified = true;
- IVM(cout << yytext << "\"" << endl;)
- }
- | UID STAR {
- IVM(cout << "SST-asset random UID: \"" << flush;)
- parsed_asset.id_n_not_name = true;
- random_name = false;
- nid = 100 + (rand() % 10000);
- parsed_asset.asset_id_n_vector.push_back (nid);
- random_asset = psa_asset_usage::all; /* don't randomly choose existing asset */
- IVM(cout << yytext << "\"" << endl;)
- }
- ;
-
-sst_asset_set_file_path:
- FILE_PATH {
- IVM(cout << "SST-asset-create file path: \"" << flush;)
- IVM(cout << yytext << "\"" << endl;)
- }
- ;
-
-read_args_var_name:
- IDENTIFIER {
- IVM(cout << "Read-arguments variable name: \"" << flush;)
- var_name = yytext;
- IVM(cout << yytext << "\"" << endl;)
- }
- ;
-
-sst_asset_dump_file_path:
- FILE_PATH {
- IVM(cout << "SST-asset dump-file path: \"" << flush;)
- set_data.file_path = yytext;
- IVM(cout << yytext << "\"" << endl;)
- }
- ;
-
-key_size:
- NUMBER_TOK {
- IVM(cout << "Key size: \"" << flush;)
- policy_info.n_bits = atol(yytext);
- IVM(cout << yytext << "\"" << endl;)
- }
- ;
-
-policy_usage_list: ATTR policy_usage policy_usages; /* at least one usage */
-
-policy_usages:
- %empty /* nothing */
- | policy_usage policy_usages {
- IVM(cout << "Key-policy usages at line number " << dec << yylineno
- << "." << endl;)
- }
- ;
-
-export : EXPORT {
- policy_info.exportable = true;
- IVM(cout << "Exportable key true: " << yytext << "\"" << endl;)
- }
- ;
-
-noexport : NOEXPORT {
- policy_info.exportable = false;
- IVM(cout << "Non-exportable key: " << yytext << "\"" << endl;)
- }
- ;
-
-copy : COPY {
- policy_info.copyable = true;
- IVM(cout << "Copyable key true: " << yytext << "\"" << endl;)
- }
- ;
-
-nocopy : NOCOPY {
- policy_info.copyable = false;
- IVM(cout << "Non-copyable key: " << yytext << "\"" << endl;)
- }
- ;
-
-encrypt : ENCRYPT {
- policy_info.can_encrypt = true;
- IVM(cout << "Encryption key true: " << yytext << "\"" << endl;)
- }
- ;
-
-noencrypt : NOENCRYPT {
- policy_info.can_encrypt = false;
- IVM(cout << "Non-encryption key: " << yytext << "\"" << endl;)
- }
- ;
-
-decrypt : DECRYPT {
- policy_info.can_decrypt = true;
- IVM(cout << "Decryption key true: " << yytext << "\"" << endl;)
- }
- ;
-
-nodecrypt : NODECRYPT {
- policy_info.can_decrypt = false;
- IVM(cout << "Non-decryption key: " << yytext << "\"" << endl;)
- }
- ;
-
-sign : SIGN {
- policy_info.can_sign = true;
- IVM(cout << "Signing key true: " << yytext << "\"" << endl;)
- }
- ;
-
-nosign : NOSIGN {
- policy_info.can_sign = false;
- IVM(cout << "Non-signing key: " << yytext << "\"" << endl;)
- }
- ;
-
-verify : VERIFY {
- policy_info.can_verify = true;
- IVM(cout << "Verify key true: " << yytext << "\"" << endl;)
- }
- ;
-
-noverify : NOVERIFY {
- policy_info.can_verify = false;
- IVM(cout << "Non-verify key: " << yytext << "\"" << endl;)
- }
- ;
-
-derive : DERIVE {
- policy_info.derivable = true;
- IVM(cout << "Derivable key true: " << yytext << "\"" << endl;)
- }
- ;
-
-noderive : NODERIVE {
- policy_info.derivable = false;
- IVM(cout << "Non-derivable key: " << yytext << "\"" << endl;)
- }
- ;
-
-persistent : PERSISTENT {
- policy_info.persistent = true;
- IVM(cout << "Persistent key: " << yytext << "\"" << endl;)
- }
- ;
-
-volatle : VOLATILE {
- policy_info.persistent = false;
- IVM(cout << "Volatile key: " << yytext << "\"" << endl;)
- }
- ;
-
-policy_usage:
- export | copy | encrypt | decrypt | sign | verify | derive
- | noexport | nocopy | noencrypt | nodecrypt | nosign | noverify
- | noderive | persistent | volatle | key_size {
- IVM(cout << "Policy usage: " << yytext << "\"" << endl;)
- }
- ;
-
-policy_type:
- TYPE IDENTIFIER {
- // Change type identifier, e.g., from "raw_data" to PSA_KEY_TYPE_RAW_DATA:
- identifier = formalize (identifier, "PSA_KEY_TYPE_");
- policy_info.key_type = identifier;
- IVM(cout << "Policy type: \""
- << policy_info.key_type << "\"" << endl;)
- }
-
-policy_algorithm:
- ALG IDENTIFIER {
- // Change type identifier, e.g., from "sha_256" to PSA_ALG_SHA_256:
- identifier = formalize (identifier, "PSA_ALG_");
- policy_info.key_algorithm = identifier;
- IVM(cout << "Policy algorithm: \""
- << policy_info.key_algorithm << "\"" << endl;)
- }
-
-policy_specs:
- %empty /* nothing */
- | policy_spec policy_specs {
- IVM(cout << "Key-policy specs at line number " << dec << yylineno
- << "." << endl;)
- }
- ;
-
-policy_spec: policy_usage_list | policy_type | policy_algorithm;
-
-policy_asset_spec:
- %empty /* nothing */
- | NAME ASSET_IDENTIFIER_LIST {
- IVM(cout << "policy-asset identifier list: \"" << flush;)
- random_name = false;
- asset_name.assign (identifier); /* TODO: Not sure this ultimately has any effect... */
- random_asset = psa_asset_usage::all; /* don't randomly choose existing asset */
- parsed_asset.id_n_not_name = false;
- IVM(cout << yytext << "\"" << endl;)
- }
- | NAME STAR {
- IVM(cout << "policy-asset random identifier: \"" << flush;)
- random_name = true;
- rand_data_length = 2 + (rand() % 10);
- gib.word (false, gib_buff, gib_buff + rand_data_length - 1);
- aid.assign (gib_buff);
- parsed_asset.asset_name_vector.push_back (aid);
- random_asset = psa_asset_usage::all; /* don't randomly choose existing asset */
- parsed_asset.id_n_not_name = false;
- IVM(cout << yytext << "\"" << endl;)
- }
- ;
-
-policy_asset_name:
- NAME IDENTIFIER {
- IVM(cout << "policy-asset identifier list: \"" << flush;)
- random_name = false;
- policy_info.get_policy_from_key = false;
- asset_name.assign (identifier); /* TODO: Not sure this ultimately has any effect... */
- parsed_asset.asset_name_vector.push_back (identifier);
- random_asset = psa_asset_usage::all; /* don't randomly choose existing asset */
- parsed_asset.id_n_not_name = false;
- IVM(cout << yytext << "\"" << endl;)
- }
- | STAR ACTIVE {
- IVM(cout << "policy-asset random active: \"" << flush;)
- policy_info.get_policy_from_key = false;
- random_asset = psa_asset_usage::active;
- parsed_asset.id_n_not_name = false;
- IVM(cout << yytext << "\"" << endl;)
- }
- | STAR DELETED {
- IVM(cout << "policy-asset random deleted: \"" << flush;)
- policy_info.get_policy_from_key = false;
- random_asset = psa_asset_usage::deleted;
- parsed_asset.id_n_not_name = false;
- IVM(cout << yytext << "\"" << endl;)
- }
- | KEY IDENTIFIER {
- IVM(cout << "policy-asset specified by key: \"" << flush;)
- policy_info.get_policy_from_key = true;
- random_name = false;
- asset_name.assign (identifier); /* ask this key what it's policy is */
- random_asset = psa_asset_usage::all; /* don't randomly choose existing asset */
- parsed_asset.id_n_not_name = false;
- IVM(cout << yytext << "\"" << endl;)
- }
- ;
-
-policy_set_args:
- policy_asset_spec policy_specs {
- IVM(cout << "Policy-create arguments: \"" << yytext << "\"" << endl;)
- }
- ;
-
-policy_read_args:
- policy_asset_name read_args {
- IVM(cout << "Policy-read arguments: " << yytext << "\"" << endl;)
- }
- ;
-
-key_set_sources:
- %empty /* nothing */
- | key_set_source key_set_sources {
- IVM(cout << "Key-set sources at Line number "
- << yytext << "\"" << endl;)
- }
- ;
-
-key_set_source:
- literal_or_random_data {
- IVM(cout << "Key-set sources, literal or random data: "
- << yytext << "\"" << endl;)
- }
- | POLICY IDENTIFIER {
- IVM(cout << "Key-set sources, explicitly-specified policy name: "
- << flush;)
- policy_info.asset_2_name = identifier; /* policy */
- /* Make note that key data (key material) was not specified: */
- IVM(cout << yytext << "\"" << endl;)
- }
- ;
-
-key_data_or_not:
- %empty /* nothing */
- | literal_or_random_data {
- IVM(cout << "Key data, literal or random data: "
- << yytext << "\"" << endl;)
- }
- ;
-
-key_set_args:
- asset_designator key_set_sources {
- IVM(cout << "Key-create from data, policy, or nothing (default): \""
- << yytext << "\"" << endl;)
- policy_info.copy_key = false;
- policy_info.implicit_policy = false;
- }
- | asset_designator FROM single_existing_asset POLICY IDENTIFIER {
- IVM(cout << "Key-copy from other key: \"" << flush;)
- policy_info.asset_2_name = identifier; /* policy */
- policy_info.copy_key = true;
- policy_info.implicit_policy = false;
- IVM(cout << yytext << "\"" << endl;)
- }
- | asset_designator key_data_or_not WITH policy_specs {
- IVM(cout << "Key-create directly specifying policy attributes (implicit policy): \""
- << yytext << "\"" << endl;)
- policy_info.copy_key = false;
- policy_info.implicit_policy = true;
- cerr << "\nError: Defining keys with implicit policies is not yet implemented."
- << endl;
- exit (772);
- }
- ;
-
-key_remove_args:
- asset_designator {
- IVM(cout << "Key-remove arguments: \""
- << yytext << "\"" << endl;)
- }
- ;
-
-key_read_args:
- asset_designator read_args {
- IVM(cout << "Key dump: \"" << yytext << "\"" << endl;)
- }
- ;
-
-/* Code structuring: */
-block:
- SHUFFLE block_content {
- IVM(cout << "Shuffled block: \"" << flush;)
- if (nesting_level > 1) {
- cerr << "\nError: Sorry, currently only one level of { } "
- << "nesting is allowed." << endl;
- exit (500);
- }
- shuffle_not_pick = true;
- low_nmbr_lines = high_nmbr_lines = 0; /* not used, but... */
- IVM(cout << yytext << "\"" << endl;)
- }
- | exact_sel_count OF block_content {
- IVM(cout << "Fixed number of lines from block: \"" << flush;)
- shuffle_not_pick = false;
- /* low_nmbr_lines and high_nmbr_lines are set below. */
- IVM(cout << yytext << "\"" << endl;)
- }
- | low_sel_count TO high_sel_count OF block_content {
- IVM(cout << "Range number of lines from block: \"" << flush;)
- if (nesting_level > 1) {
- cerr << "\nError: Sorry, currently only one level of { } "
- << "nesting is allowed." << endl;
- exit (502);
- }
- shuffle_not_pick = false;
- /* low_nmbr_lines and high_nmbr_lines are set below. */
- IVM(cout << yytext << "\"" << endl;)
- }
- ;
-
-block_content:
- open_brace lines close_brace {
- IVM(cout << "Block content: \"" << yytext << "\"" << endl;)
- }
- | line {
- IVM(cout << "Single-line would-be-block content: \"" << flush;)
- IVM(cout << yytext << "\"" << endl;)
- }
- ;
-
-open_brace:
- OPEN_BRACE {
- IVM(cout << "Open brace: \"" << flush;)
- template_block_vector.clear(); // clean slate of template lines
- nesting_level = 1;
- IVM(cout << yytext << "\"" << endl;)
- }
- ;
-
-close_brace:
- CLOSE_BRACE {
- IVM(cout << "Close brace: " << flush;)
- IVM(cout << yytext << "\"" << endl;)
- }
- ;
-
- /* Low-level structures: */
-
- /* Please see comment before ASSET_IDENTIFIER_LIST, below. */
-ASSET_NUMBER_LIST:
- ASSET_NUMBER ASSET_NUMBERS; /* at least one number */
-
-ASSET_NUMBERS:
- %empty /* nothing */
- | ASSET_NUMBER ASSET_NUMBERS;
-
-ASSET_NUMBER:
- NUMBER_TOK {
- IVM(cout << "ASSET_NUMBER: \"" << flush;)
- nid = atol(yytext);
- parsed_asset.asset_id_n_vector.push_back (nid);
- IVM(cout << yytext << "\"" << endl;)
- }
- ;
-
- /* ASSET_IDENTIFIER are used specifically for lists of assets within a singletemplate
- line. That, as opposed to list of identifers in general. The difference is the
- need to queue ASSET_IDENTIFIERS up into parsed_asset.asset_name_vector, and have to
- do so here before they "vanish." */
-ASSET_IDENTIFIER_LIST:
- ASSET_IDENTIFIER ASSET_IDENTIFIERS; /* (at least one) */
-
-ASSET_IDENTIFIERS:
- %empty /* nothing */
- | ASSET_IDENTIFIER ASSET_IDENTIFIERS;
-
-ASSET_IDENTIFIER:
- IDENTIFIER_TOK {
- IVM(cout << "ASSET_IDENTIFIER: \"" << flush;)
- aid = identifier = yytext;
- parsed_asset.asset_name_vector.push_back (aid);
- IVM(cout << yytext << "\"" << endl;)
- }
- ;
-
-IDENTIFIER:
- IDENTIFIER_TOK {
- IVM(cout << "IDENTIFIER: \"" << flush;)
- identifier = yytext;
- IVM(cout << yytext << "\"" << endl;)
- }
- ;
-
-FILE_PATH:
- FILE_PATH_TOK {
- IVM(cout << "FILE_PATH: \"" << flush;)
- set_data.file_path = yytext;
- IVM(cout << yytext << "\"" << endl;)
- }
- ;
-
- /* These are related to randomized blocks of template lines: */
-
-exact_sel_count:
- NUMBER {
- IVM(cout << "Exact number of random template lines: \"" << flush;)
- low_nmbr_lines = high_nmbr_lines = exact_nmbr_lines = number;
- ++nesting_level;
- IVM(cout << number << "\"" << endl;)
- }
- ;
-
-low_sel_count:
- NUMBER {
- IVM(cout << "Least number of random template lines: \"" << flush;)
- low_nmbr_lines = number;
- IVM(cout << number << "\"" << endl;)
- }
- ;
-
-high_sel_count:
- NUMBER {
- IVM(cout << "Most number of random template lines: \"" << flush;)
- high_nmbr_lines = number;
- ++nesting_level;
- IVM(cout << number << "\"" << endl;)
- }
- ;
-
-
- /* These are general-case numbers, literals and such: */
-
-NUMBER: NUMBER_TOK {
- IVM(cout << "NUMBER: \"" << flush;)
- number = atol(yytext);
- IVM(cout << yytext << "\"" << endl;)
- }
- ;
-
-LITERAL:
- LITERAL_TOK {
- IVM(cout << "LITERAL string: " << flush;)
- literal = yytext;
- literal_is_string = true;
- IVM(cout << yytext << endl;)
- }
- | HEX_LIST {
- IVM(cout << "LITERAL hex-value list: " << flush;)
- literal = yytext;
- literal_is_string = false;
- IVM(cout << yytext << endl;)
- }
- ;
-
-
-%%
-
diff --git a/tools/tf_fuzz/regression/000001_set_sst_uid_data_expect_pass/check.py b/tools/tf_fuzz/regression/000001_set_sst_uid_data_expect_pass/check.py
deleted file mode 100644
index 1bc5cbe74..000000000
--- a/tools/tf_fuzz/regression/000001_set_sst_uid_data_expect_pass/check.py
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-'''
- Please read .../tf_fuzz/regression/README to understand this code.
-
- Please also read the comments in .../tf_fuzz/regression/regress_lib/line_by_line.py.
-'''
-
-import sys, os, re, string, pdb
-sys.path.append ("../regress_lib")
-import line_by_line
-
-
-# Describe script usage:
-def usage():
- print ('''
- Command-line parameters:
- 1. The test-template file, nominally named "template",
- 2. The expected combined stdout/stderr output, nominally named "exp_stdout_stderr",
- 3. The actual/generated combined stdout/stderr output, nominally named "stdout_stderr",
- 4. The expected .c test file, nominally named "exp_test.c", and
- 5. The actual, generated .c test file, nominally named "test.c".
-
- Optionally, *before* these five arguments, you may add switches thus:
- "--v" for verbose mode, to view line-by-line comparisons actual vs. expected,
- "--q" to only print error messages and a successful-completion message,
- "--qq" same as --q but not even printing out the completion message, and
- "--s 12345" to run TF-Fuzz with seed value 12345 (or whatever).
- ''')
-
-
-def main():
- # See if we're supposed to be quiet:
- loud = quiet = ultra_quiet = False
- seed = ""
- while sys.argv[1][0] == "-":
- if sys.argv[1] == "--v":
- loud = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--q":
- quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--qq":
- quiet = ultra_quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--s":
- sys.argv.pop(1)
- seed = sys.argv[1]
- sys.argv.pop(1)
- if not seed.isnumeric():
- print ('The --s seed argument was not a number.')
- usage()
- sys.exit(1)
-
- # Run TF-Fuzz:
- if not quiet: print ("Running TF-Fuzz... ")
- os.system ('rm -f stdout_stderr test.c')
- command = '../../tfz -v ./' + sys.argv[1] + ' ./' + sys.argv[5]
- command += ' ' + seed + ' >' + sys.argv[3] + ' 2>&1'
- if loud:
- print (command)
- if os.system (command) == 0:
- if not quiet: print ("TF-Fuzz run complete.")
- else:
- print ('Could not run TF-Fuzz; please see stdout_stderr file.')
- sys.exit(2)
-
- # Attempt to open files indicated on command line:
- if len(sys.argv) != 6:
- message = '{} requires 5 command-line arguments. Exiting.'
- print (message.format(sys.argv[0]), file=sys.stderr)
- usage()
- sys.exit(3)
- template_file_name = sys.argv[1]
- exp_stdout_file_name = sys.argv[2]
- act_stdout_file_name = sys.argv[3]
- exp_test_file_name = sys.argv[4]
- act_test_file_name = sys.argv[5]
-
- try:
- template_file = open (template_file_name, 'rt')
- exp_stdout_file = open (exp_stdout_file_name, 'rt')
- act_stdout_file = open (act_stdout_file_name, 'rt')
- exp_test_file = open (exp_test_file_name, 'rt')
- act_test_file = open (act_test_file_name, 'rt')
- except FileNotFoundError:
- print ('One or more files could not be found.')
- usage();
- sys.exit(4)
- except:
- print ('Something went wrong trying to open the input files.')
- usage();
- sys.exit(5)
- else:
- message = '\nInput files:\n {},\n {},\n {},\n'
- message += ' {}, and\n {}\nopened successfully.\n'
- if not quiet:
- print (message.format (template_file_name, exp_stdout_file_name,
- act_stdout_file_name, exp_test_file_name, act_test_file_name))
-
- # Check it all:
- if not quiet: print ("\nChecking test C file: ", end="")
- line_by_line.check_file ( exp_test_file, exp_test_file_name,
- act_test_file, act_test_file_name,
- loud, quiet, ultra_quiet )
- if not quiet: print ("Checking stdout and stderr: ", end="")
- line_by_line.check_file ( exp_stdout_file, exp_stdout_file_name,
- act_stdout_file, act_stdout_file_name,
- loud, quiet, ultra_quiet )
-
- # Ran to completion normally, so pass:
- if not ultra_quiet: print ("Regression test passed.")
- sys.exit(0)
-
-if __name__ == "__main__": main()
diff --git a/tools/tf_fuzz/regression/000001_set_sst_uid_data_expect_pass/exp_stdout_stderr b/tools/tf_fuzz/regression/000001_set_sst_uid_data_expect_pass/exp_stdout_stderr
deleted file mode 100644
index 1976f7b3f..000000000
--- a/tools/tf_fuzz/regression/000001_set_sst_uid_data_expect_pass/exp_stdout_stderr
+++ /dev/null
@@ -1,24 +0,0 @@
-Trusted Firmware Fuzzer (TF-Fuzz) starting...
-
-Info: random seed was not specified.
-
-Using seed value of \d+ \(0x[a-f\d]+\).
-Purpose line: to create an SST asset
-ASSET_NUMBER: "104"
-SST-asset UID list: "data"
-LITERAL string: "Very simple test"
-Create from literal data: ""Very simple test""
-Set SST command: "expect"
-Appended to end of call sequence: SST-set call.
-Set command: "expect"
-Expect pass clause: "pass"
-Command with expect: ";"
-Lines: Line number 3.
-Lines: Line number 3.
-Call sequence generated.
-Simulating call sequence...
-Call sequence:
- SST-set call for asset SST_ID_104
-Writing test file, ./test.c.
-
-TF-Fuzz test generation complete.
diff --git a/tools/tf_fuzz/regression/000001_set_sst_uid_data_expect_pass/exp_test.c b/tools/tf_fuzz/regression/000001_set_sst_uid_data_expect_pass/exp_test.c
deleted file mode 100644
index 04b84e96c..000000000
--- a/tools/tf_fuzz/regression/000001_set_sst_uid_data_expect_pass/exp_test.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Test purpose:
- * to create an SST asset
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <string.h>
-#include <stdint.h>
-
-#include "../sst/non_secure/ns_test_helpers.h"
-#include "psa/protected_storage.h"
-#include "test/framework/test_framework_helpers.h"
-#include "tfm_memory_utils.h"
-#include "psa/crypto.h"
-#include "psa/crypto_sizes.h"
-
-/* This is not yet right for how to run a test; need to register tests, etc. */
-
-void test_thread (struct test_result_t *ret) {
- psa_status_t crypto_status; /* result from Crypto calls */
- psa_status_t sst_status;
- /* Variables (etc.) to initialize and check PSA assets: */
- static uint8_t SST_ID_104_set_data[] = "Very simple test";
- static uint32_t SST_ID_104_set_length = 16;
- (void)sst_status;
- /* "void" to prevent unused-variable warning, since the variable may not
- * be used in this particular test case.
- */
-
- crypto_status = psa_crypto_init();
- if (crypto_status != PSA_SUCCESS) {
- TEST_FAIL("Could not initialize Crypto.");
- return;
- }
-
- TEST_LOG("Test to create an SST asset");
-
-
- /* PSA calls to test: */
- /\* Creating SST asset UID = 104 with data "Very simpl...". \*/
- sst_status = psa_ps_set(104, SST_ID_104_set_length, SST_ID_104_set_data,
- PSA_STORAGE_FLAG_[A-Z_]+\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
-
-
- /* Removing assets left over from testing: */
- psa_ps_remove(104);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
-
- /* Test completed */
- ret->val = TEST_PASSED;
-}
diff --git a/tools/tf_fuzz/regression/000001_set_sst_uid_data_expect_pass/template b/tools/tf_fuzz/regression/000001_set_sst_uid_data_expect_pass/template
deleted file mode 100644
index 7b84f1103..000000000
--- a/tools/tf_fuzz/regression/000001_set_sst_uid_data_expect_pass/template
+++ /dev/null
@@ -1,2 +0,0 @@
-purpose to create an SST asset;
-set sst uid 104 data "Very simple test" expect pass;
diff --git a/tools/tf_fuzz/regression/000002_set_sst_name_data_expect_nothing/check.py b/tools/tf_fuzz/regression/000002_set_sst_name_data_expect_nothing/check.py
deleted file mode 100644
index 1bc5cbe74..000000000
--- a/tools/tf_fuzz/regression/000002_set_sst_name_data_expect_nothing/check.py
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-'''
- Please read .../tf_fuzz/regression/README to understand this code.
-
- Please also read the comments in .../tf_fuzz/regression/regress_lib/line_by_line.py.
-'''
-
-import sys, os, re, string, pdb
-sys.path.append ("../regress_lib")
-import line_by_line
-
-
-# Describe script usage:
-def usage():
- print ('''
- Command-line parameters:
- 1. The test-template file, nominally named "template",
- 2. The expected combined stdout/stderr output, nominally named "exp_stdout_stderr",
- 3. The actual/generated combined stdout/stderr output, nominally named "stdout_stderr",
- 4. The expected .c test file, nominally named "exp_test.c", and
- 5. The actual, generated .c test file, nominally named "test.c".
-
- Optionally, *before* these five arguments, you may add switches thus:
- "--v" for verbose mode, to view line-by-line comparisons actual vs. expected,
- "--q" to only print error messages and a successful-completion message,
- "--qq" same as --q but not even printing out the completion message, and
- "--s 12345" to run TF-Fuzz with seed value 12345 (or whatever).
- ''')
-
-
-def main():
- # See if we're supposed to be quiet:
- loud = quiet = ultra_quiet = False
- seed = ""
- while sys.argv[1][0] == "-":
- if sys.argv[1] == "--v":
- loud = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--q":
- quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--qq":
- quiet = ultra_quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--s":
- sys.argv.pop(1)
- seed = sys.argv[1]
- sys.argv.pop(1)
- if not seed.isnumeric():
- print ('The --s seed argument was not a number.')
- usage()
- sys.exit(1)
-
- # Run TF-Fuzz:
- if not quiet: print ("Running TF-Fuzz... ")
- os.system ('rm -f stdout_stderr test.c')
- command = '../../tfz -v ./' + sys.argv[1] + ' ./' + sys.argv[5]
- command += ' ' + seed + ' >' + sys.argv[3] + ' 2>&1'
- if loud:
- print (command)
- if os.system (command) == 0:
- if not quiet: print ("TF-Fuzz run complete.")
- else:
- print ('Could not run TF-Fuzz; please see stdout_stderr file.')
- sys.exit(2)
-
- # Attempt to open files indicated on command line:
- if len(sys.argv) != 6:
- message = '{} requires 5 command-line arguments. Exiting.'
- print (message.format(sys.argv[0]), file=sys.stderr)
- usage()
- sys.exit(3)
- template_file_name = sys.argv[1]
- exp_stdout_file_name = sys.argv[2]
- act_stdout_file_name = sys.argv[3]
- exp_test_file_name = sys.argv[4]
- act_test_file_name = sys.argv[5]
-
- try:
- template_file = open (template_file_name, 'rt')
- exp_stdout_file = open (exp_stdout_file_name, 'rt')
- act_stdout_file = open (act_stdout_file_name, 'rt')
- exp_test_file = open (exp_test_file_name, 'rt')
- act_test_file = open (act_test_file_name, 'rt')
- except FileNotFoundError:
- print ('One or more files could not be found.')
- usage();
- sys.exit(4)
- except:
- print ('Something went wrong trying to open the input files.')
- usage();
- sys.exit(5)
- else:
- message = '\nInput files:\n {},\n {},\n {},\n'
- message += ' {}, and\n {}\nopened successfully.\n'
- if not quiet:
- print (message.format (template_file_name, exp_stdout_file_name,
- act_stdout_file_name, exp_test_file_name, act_test_file_name))
-
- # Check it all:
- if not quiet: print ("\nChecking test C file: ", end="")
- line_by_line.check_file ( exp_test_file, exp_test_file_name,
- act_test_file, act_test_file_name,
- loud, quiet, ultra_quiet )
- if not quiet: print ("Checking stdout and stderr: ", end="")
- line_by_line.check_file ( exp_stdout_file, exp_stdout_file_name,
- act_stdout_file, act_stdout_file_name,
- loud, quiet, ultra_quiet )
-
- # Ran to completion normally, so pass:
- if not ultra_quiet: print ("Regression test passed.")
- sys.exit(0)
-
-if __name__ == "__main__": main()
diff --git a/tools/tf_fuzz/regression/000002_set_sst_name_data_expect_nothing/exp_stdout_stderr b/tools/tf_fuzz/regression/000002_set_sst_name_data_expect_nothing/exp_stdout_stderr
deleted file mode 100644
index 97c20e8e8..000000000
--- a/tools/tf_fuzz/regression/000002_set_sst_name_data_expect_nothing/exp_stdout_stderr
+++ /dev/null
@@ -1,24 +0,0 @@
-Trusted Firmware Fuzzer (TF-Fuzz) starting...
-
-Info: random seed was not specified.
-
-Using seed value of \d+ \(0x[a-f\d]+\).
-Purpose line: to give assets a human name
-ASSET_IDENTIFIER: "forecast"
-Asset identifier list: "data"
-LITERAL string: "sunny with a 30% chance of weather!"
-Create from literal data: ""sunny with a 30% chance of weather!""
-Set SST command: "expect"
-Appended to end of call sequence: SST-set call.
-Set command: "expect"
-Expect nothing clause: "nothing"
-Command with expect: ";"
-Lines: Line number 3.
-Lines: Line number 3.
-Call sequence generated.
-Simulating call sequence...
-Call sequence:
- SST-set call for asset forecast
-Writing test file, ./test.c.
-
-TF-Fuzz test generation complete.
diff --git a/tools/tf_fuzz/regression/000002_set_sst_name_data_expect_nothing/exp_test.c b/tools/tf_fuzz/regression/000002_set_sst_name_data_expect_nothing/exp_test.c
deleted file mode 100644
index e792c9bac..000000000
--- a/tools/tf_fuzz/regression/000002_set_sst_name_data_expect_nothing/exp_test.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Test purpose:
- * to give assets a human name
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <string.h>
-#include <stdint.h>
-
-#include "../sst/non_secure/ns_test_helpers.h"
-#include "psa/protected_storage.h"
-#include "test/framework/test_framework_helpers.h"
-#include "tfm_memory_utils.h"
-#include "psa/crypto.h"
-#include "psa/crypto_sizes.h"
-
-/* This is not yet right for how to run a test; need to register tests, etc. */
-
-void test_thread (struct test_result_t *ret) {
- psa_status_t crypto_status; /* result from Crypto calls */
- psa_status_t sst_status;
- /* Variables (etc.) to initialize and check PSA assets: */
- static uint8_t forecast_set_data[] = "sunny with a 30% chance of weather!";
- static uint32_t forecast_set_length = 35;
- (void)sst_status;
- /* "void" to prevent unused-variable warning, since the variable may not
- * be used in this particular test case.
- */
-
- crypto_status = psa_crypto_init();
- if (crypto_status != PSA_SUCCESS) {
- TEST_FAIL("Could not initialize Crypto.");
- return;
- }
-
- TEST_LOG("Test to give assets a human name");
-
-
- /* PSA calls to test: */
- /\* Creating SST asset "forecast," with data "sunny with...". \*/
- sst_status = psa_ps_set\(@@@001@@@, forecast_set_length, forecast_set_data,
- PSA_STORAGE_FLAG_[A-Z_]+\);
- /* (No checks for this PSA call.) */
-
-
- /* Removing assets left over from testing: */
- psa_ps_remove\(@@@001@@@\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
-
- /* Test completed */
- ret->val = TEST_PASSED;
-}
diff --git a/tools/tf_fuzz/regression/000002_set_sst_name_data_expect_nothing/template b/tools/tf_fuzz/regression/000002_set_sst_name_data_expect_nothing/template
deleted file mode 100644
index 7292031e1..000000000
--- a/tools/tf_fuzz/regression/000002_set_sst_name_data_expect_nothing/template
+++ /dev/null
@@ -1,2 +0,0 @@
-purpose to give assets a human name;
-set sst name forecast data "sunny with a 30% chance of weather!" expect nothing;
diff --git a/tools/tf_fuzz/regression/000003_set_sst_name_data/check.py b/tools/tf_fuzz/regression/000003_set_sst_name_data/check.py
deleted file mode 100644
index 1bc5cbe74..000000000
--- a/tools/tf_fuzz/regression/000003_set_sst_name_data/check.py
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-'''
- Please read .../tf_fuzz/regression/README to understand this code.
-
- Please also read the comments in .../tf_fuzz/regression/regress_lib/line_by_line.py.
-'''
-
-import sys, os, re, string, pdb
-sys.path.append ("../regress_lib")
-import line_by_line
-
-
-# Describe script usage:
-def usage():
- print ('''
- Command-line parameters:
- 1. The test-template file, nominally named "template",
- 2. The expected combined stdout/stderr output, nominally named "exp_stdout_stderr",
- 3. The actual/generated combined stdout/stderr output, nominally named "stdout_stderr",
- 4. The expected .c test file, nominally named "exp_test.c", and
- 5. The actual, generated .c test file, nominally named "test.c".
-
- Optionally, *before* these five arguments, you may add switches thus:
- "--v" for verbose mode, to view line-by-line comparisons actual vs. expected,
- "--q" to only print error messages and a successful-completion message,
- "--qq" same as --q but not even printing out the completion message, and
- "--s 12345" to run TF-Fuzz with seed value 12345 (or whatever).
- ''')
-
-
-def main():
- # See if we're supposed to be quiet:
- loud = quiet = ultra_quiet = False
- seed = ""
- while sys.argv[1][0] == "-":
- if sys.argv[1] == "--v":
- loud = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--q":
- quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--qq":
- quiet = ultra_quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--s":
- sys.argv.pop(1)
- seed = sys.argv[1]
- sys.argv.pop(1)
- if not seed.isnumeric():
- print ('The --s seed argument was not a number.')
- usage()
- sys.exit(1)
-
- # Run TF-Fuzz:
- if not quiet: print ("Running TF-Fuzz... ")
- os.system ('rm -f stdout_stderr test.c')
- command = '../../tfz -v ./' + sys.argv[1] + ' ./' + sys.argv[5]
- command += ' ' + seed + ' >' + sys.argv[3] + ' 2>&1'
- if loud:
- print (command)
- if os.system (command) == 0:
- if not quiet: print ("TF-Fuzz run complete.")
- else:
- print ('Could not run TF-Fuzz; please see stdout_stderr file.')
- sys.exit(2)
-
- # Attempt to open files indicated on command line:
- if len(sys.argv) != 6:
- message = '{} requires 5 command-line arguments. Exiting.'
- print (message.format(sys.argv[0]), file=sys.stderr)
- usage()
- sys.exit(3)
- template_file_name = sys.argv[1]
- exp_stdout_file_name = sys.argv[2]
- act_stdout_file_name = sys.argv[3]
- exp_test_file_name = sys.argv[4]
- act_test_file_name = sys.argv[5]
-
- try:
- template_file = open (template_file_name, 'rt')
- exp_stdout_file = open (exp_stdout_file_name, 'rt')
- act_stdout_file = open (act_stdout_file_name, 'rt')
- exp_test_file = open (exp_test_file_name, 'rt')
- act_test_file = open (act_test_file_name, 'rt')
- except FileNotFoundError:
- print ('One or more files could not be found.')
- usage();
- sys.exit(4)
- except:
- print ('Something went wrong trying to open the input files.')
- usage();
- sys.exit(5)
- else:
- message = '\nInput files:\n {},\n {},\n {},\n'
- message += ' {}, and\n {}\nopened successfully.\n'
- if not quiet:
- print (message.format (template_file_name, exp_stdout_file_name,
- act_stdout_file_name, exp_test_file_name, act_test_file_name))
-
- # Check it all:
- if not quiet: print ("\nChecking test C file: ", end="")
- line_by_line.check_file ( exp_test_file, exp_test_file_name,
- act_test_file, act_test_file_name,
- loud, quiet, ultra_quiet )
- if not quiet: print ("Checking stdout and stderr: ", end="")
- line_by_line.check_file ( exp_stdout_file, exp_stdout_file_name,
- act_stdout_file, act_stdout_file_name,
- loud, quiet, ultra_quiet )
-
- # Ran to completion normally, so pass:
- if not ultra_quiet: print ("Regression test passed.")
- sys.exit(0)
-
-if __name__ == "__main__": main()
diff --git a/tools/tf_fuzz/regression/000003_set_sst_name_data/exp_stdout_stderr b/tools/tf_fuzz/regression/000003_set_sst_name_data/exp_stdout_stderr
deleted file mode 100644
index 19a9bdb72..000000000
--- a/tools/tf_fuzz/regression/000003_set_sst_name_data/exp_stdout_stderr
+++ /dev/null
@@ -1,23 +0,0 @@
-Trusted Firmware Fuzzer (TF-Fuzz) starting...
-
-Info: random seed was not specified.
-
-Using seed value of \d+ \(0x[a-f\d]+\).
-Purpose line: to show that TF-Fuzz can \"infer\" \"results\"
-ASSET_IDENTIFIER: "jonathan"
-Asset identifier list: "data"
-LITERAL string: "I am the man"
-Create from literal data: ""I am the man""
-Set SST command: ";"
-Appended to end of call sequence: SST-set call.
-Set command: ";"
-Command with no expect: ";"
-Lines: Line number 3.
-Lines: Line number 3.
-Call sequence generated.
-Simulating call sequence...
-Call sequence:
- SST-set call for asset jonathan
-Writing test file, ./test.c.
-
-TF-Fuzz test generation complete.
diff --git a/tools/tf_fuzz/regression/000003_set_sst_name_data/exp_test.c b/tools/tf_fuzz/regression/000003_set_sst_name_data/exp_test.c
deleted file mode 100644
index 9dc4d2425..000000000
--- a/tools/tf_fuzz/regression/000003_set_sst_name_data/exp_test.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Test purpose:
- * to show that TF-Fuzz can \"infer\" \"results\"
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <string.h>
-#include <stdint.h>
-
-#include "../sst/non_secure/ns_test_helpers.h"
-#include "psa/protected_storage.h"
-#include "test/framework/test_framework_helpers.h"
-#include "tfm_memory_utils.h"
-#include "psa/crypto.h"
-#include "psa/crypto_sizes.h"
-
-/* This is not yet right for how to run a test; need to register tests, etc. */
-
-void test_thread (struct test_result_t *ret) {
- psa_status_t crypto_status; /* result from Crypto calls */
- psa_status_t sst_status;
- /* Variables (etc.) to initialize and check PSA assets: */
- static uint8_t jonathan_set_data[] = "I am the man";
- static uint32_t jonathan_set_length = 12;
- (void)sst_status;
- /* "void" to prevent unused-variable warning, since the variable may not
- * be used in this particular test case.
- */
-
- crypto_status = psa_crypto_init();
- if (crypto_status != PSA_SUCCESS) {
- TEST_FAIL("Could not initialize Crypto.");
- return;
- }
-
- TEST_LOG("Test to show that TF-Fuzz can \"infer\" \"results\"");
-
-
- /* PSA calls to test: */
- /\* Creating SST asset "jonathan," with data "I am the m...". \*/
- sst_status = psa_ps_set\(@@@001@@@, jonathan_set_length, jonathan_set_data,
- PSA_STORAGE_FLAG_[A-Z_]+\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
-
-
- /* Removing assets left over from testing: */
- psa_ps_remove\(@@@001@@@\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
-
- /* Test completed */
- ret->val = TEST_PASSED;
-}
diff --git a/tools/tf_fuzz/regression/000003_set_sst_name_data/template b/tools/tf_fuzz/regression/000003_set_sst_name_data/template
deleted file mode 100644
index 820e3ab56..000000000
--- a/tools/tf_fuzz/regression/000003_set_sst_name_data/template
+++ /dev/null
@@ -1,2 +0,0 @@
-purpose to show that TF-Fuzz can "infer" \"results\";
-set sst name jonathan data "I am the man";
diff --git a/tools/tf_fuzz/regression/000004_set_sst_name_rand_data/check.py b/tools/tf_fuzz/regression/000004_set_sst_name_rand_data/check.py
deleted file mode 100644
index 1bc5cbe74..000000000
--- a/tools/tf_fuzz/regression/000004_set_sst_name_rand_data/check.py
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-'''
- Please read .../tf_fuzz/regression/README to understand this code.
-
- Please also read the comments in .../tf_fuzz/regression/regress_lib/line_by_line.py.
-'''
-
-import sys, os, re, string, pdb
-sys.path.append ("../regress_lib")
-import line_by_line
-
-
-# Describe script usage:
-def usage():
- print ('''
- Command-line parameters:
- 1. The test-template file, nominally named "template",
- 2. The expected combined stdout/stderr output, nominally named "exp_stdout_stderr",
- 3. The actual/generated combined stdout/stderr output, nominally named "stdout_stderr",
- 4. The expected .c test file, nominally named "exp_test.c", and
- 5. The actual, generated .c test file, nominally named "test.c".
-
- Optionally, *before* these five arguments, you may add switches thus:
- "--v" for verbose mode, to view line-by-line comparisons actual vs. expected,
- "--q" to only print error messages and a successful-completion message,
- "--qq" same as --q but not even printing out the completion message, and
- "--s 12345" to run TF-Fuzz with seed value 12345 (or whatever).
- ''')
-
-
-def main():
- # See if we're supposed to be quiet:
- loud = quiet = ultra_quiet = False
- seed = ""
- while sys.argv[1][0] == "-":
- if sys.argv[1] == "--v":
- loud = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--q":
- quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--qq":
- quiet = ultra_quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--s":
- sys.argv.pop(1)
- seed = sys.argv[1]
- sys.argv.pop(1)
- if not seed.isnumeric():
- print ('The --s seed argument was not a number.')
- usage()
- sys.exit(1)
-
- # Run TF-Fuzz:
- if not quiet: print ("Running TF-Fuzz... ")
- os.system ('rm -f stdout_stderr test.c')
- command = '../../tfz -v ./' + sys.argv[1] + ' ./' + sys.argv[5]
- command += ' ' + seed + ' >' + sys.argv[3] + ' 2>&1'
- if loud:
- print (command)
- if os.system (command) == 0:
- if not quiet: print ("TF-Fuzz run complete.")
- else:
- print ('Could not run TF-Fuzz; please see stdout_stderr file.')
- sys.exit(2)
-
- # Attempt to open files indicated on command line:
- if len(sys.argv) != 6:
- message = '{} requires 5 command-line arguments. Exiting.'
- print (message.format(sys.argv[0]), file=sys.stderr)
- usage()
- sys.exit(3)
- template_file_name = sys.argv[1]
- exp_stdout_file_name = sys.argv[2]
- act_stdout_file_name = sys.argv[3]
- exp_test_file_name = sys.argv[4]
- act_test_file_name = sys.argv[5]
-
- try:
- template_file = open (template_file_name, 'rt')
- exp_stdout_file = open (exp_stdout_file_name, 'rt')
- act_stdout_file = open (act_stdout_file_name, 'rt')
- exp_test_file = open (exp_test_file_name, 'rt')
- act_test_file = open (act_test_file_name, 'rt')
- except FileNotFoundError:
- print ('One or more files could not be found.')
- usage();
- sys.exit(4)
- except:
- print ('Something went wrong trying to open the input files.')
- usage();
- sys.exit(5)
- else:
- message = '\nInput files:\n {},\n {},\n {},\n'
- message += ' {}, and\n {}\nopened successfully.\n'
- if not quiet:
- print (message.format (template_file_name, exp_stdout_file_name,
- act_stdout_file_name, exp_test_file_name, act_test_file_name))
-
- # Check it all:
- if not quiet: print ("\nChecking test C file: ", end="")
- line_by_line.check_file ( exp_test_file, exp_test_file_name,
- act_test_file, act_test_file_name,
- loud, quiet, ultra_quiet )
- if not quiet: print ("Checking stdout and stderr: ", end="")
- line_by_line.check_file ( exp_stdout_file, exp_stdout_file_name,
- act_stdout_file, act_stdout_file_name,
- loud, quiet, ultra_quiet )
-
- # Ran to completion normally, so pass:
- if not ultra_quiet: print ("Regression test passed.")
- sys.exit(0)
-
-if __name__ == "__main__": main()
diff --git a/tools/tf_fuzz/regression/000004_set_sst_name_rand_data/exp_stdout_stderr b/tools/tf_fuzz/regression/000004_set_sst_name_rand_data/exp_stdout_stderr
deleted file mode 100644
index 916f354dd..000000000
--- a/tools/tf_fuzz/regression/000004_set_sst_name_rand_data/exp_stdout_stderr
+++ /dev/null
@@ -1,22 +0,0 @@
-Trusted Firmware Fuzzer (TF-Fuzz) starting...
-
-Info: random seed was not specified.
-
-Using seed value of \d+ \(0x[a-f\d]+\).
-Purpose line: to show how to randomize data
-ASSET_IDENTIFIER: "gibberish"
-Asset identifier list: "data"
-Create from random data
-Set SST command: "*"
-Appended to end of call sequence: SST-set call.
-Set command: "*"
-Command with no expect: ";"
-Lines: Line number 3.
-Lines: Line number 3.
-Call sequence generated.
-Simulating call sequence...
-Call sequence:
- SST-set call for asset gibberish
-Writing test file, ./test.c.
-
-TF-Fuzz test generation complete.
diff --git a/tools/tf_fuzz/regression/000004_set_sst_name_rand_data/exp_test.c b/tools/tf_fuzz/regression/000004_set_sst_name_rand_data/exp_test.c
deleted file mode 100644
index 2f56e4eb8..000000000
--- a/tools/tf_fuzz/regression/000004_set_sst_name_rand_data/exp_test.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Test purpose:
- * to show how to randomize data
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <string.h>
-#include <stdint.h>
-
-#include "../sst/non_secure/ns_test_helpers.h"
-#include "psa/protected_storage.h"
-#include "test/framework/test_framework_helpers.h"
-#include "tfm_memory_utils.h"
-#include "psa/crypto.h"
-#include "psa/crypto_sizes.h"
-
-/* This is not yet right for how to run a test; need to register tests, etc. */
-
-void test_thread (struct test_result_t *ret) {
- psa_status_t crypto_status; /* result from Crypto calls */
- psa_status_t sst_status;
- /* Variables (etc.) to initialize and check PSA assets: */
- static uint8_t gibberish_set_data\[\] = "@@002@10@@[a-z\ ]*[\.\?\!]";
- static uint32_t gibberish_set_length = \d+;
- (void)sst_status;
- /* "void" to prevent unused-variable warning, since the variable may not
- * be used in this particular test case.
- */
-
- crypto_status = psa_crypto_init();
- if (crypto_status != PSA_SUCCESS) {
- TEST_FAIL("Could not initialize Crypto.");
- return;
- }
-
- TEST_LOG("Test to show how to randomize data");
-
-
- /* PSA calls to test: */
- /\* Creating SST asset "gibberish," with data "@@002@10@@...". \*/
- sst_status = psa_ps_set\(@@@001@@@, gibberish_set_length, gibberish_set_data,
- PSA_STORAGE_FLAG_[A-Z_]+\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
-
-
- /* Removing assets left over from testing: */
- psa_ps_remove\(@@@001@@@\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
-
- /* Test completed */
- ret->val = TEST_PASSED;
-}
diff --git a/tools/tf_fuzz/regression/000004_set_sst_name_rand_data/template b/tools/tf_fuzz/regression/000004_set_sst_name_rand_data/template
deleted file mode 100644
index 912c23abe..000000000
--- a/tools/tf_fuzz/regression/000004_set_sst_name_rand_data/template
+++ /dev/null
@@ -1,2 +0,0 @@
-purpose to show how to randomize data;
-set sst name gibberish data *;
diff --git a/tools/tf_fuzz/regression/000005_set_sst_rand_name_rand_data/check.py b/tools/tf_fuzz/regression/000005_set_sst_rand_name_rand_data/check.py
deleted file mode 100644
index 1bc5cbe74..000000000
--- a/tools/tf_fuzz/regression/000005_set_sst_rand_name_rand_data/check.py
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-'''
- Please read .../tf_fuzz/regression/README to understand this code.
-
- Please also read the comments in .../tf_fuzz/regression/regress_lib/line_by_line.py.
-'''
-
-import sys, os, re, string, pdb
-sys.path.append ("../regress_lib")
-import line_by_line
-
-
-# Describe script usage:
-def usage():
- print ('''
- Command-line parameters:
- 1. The test-template file, nominally named "template",
- 2. The expected combined stdout/stderr output, nominally named "exp_stdout_stderr",
- 3. The actual/generated combined stdout/stderr output, nominally named "stdout_stderr",
- 4. The expected .c test file, nominally named "exp_test.c", and
- 5. The actual, generated .c test file, nominally named "test.c".
-
- Optionally, *before* these five arguments, you may add switches thus:
- "--v" for verbose mode, to view line-by-line comparisons actual vs. expected,
- "--q" to only print error messages and a successful-completion message,
- "--qq" same as --q but not even printing out the completion message, and
- "--s 12345" to run TF-Fuzz with seed value 12345 (or whatever).
- ''')
-
-
-def main():
- # See if we're supposed to be quiet:
- loud = quiet = ultra_quiet = False
- seed = ""
- while sys.argv[1][0] == "-":
- if sys.argv[1] == "--v":
- loud = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--q":
- quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--qq":
- quiet = ultra_quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--s":
- sys.argv.pop(1)
- seed = sys.argv[1]
- sys.argv.pop(1)
- if not seed.isnumeric():
- print ('The --s seed argument was not a number.')
- usage()
- sys.exit(1)
-
- # Run TF-Fuzz:
- if not quiet: print ("Running TF-Fuzz... ")
- os.system ('rm -f stdout_stderr test.c')
- command = '../../tfz -v ./' + sys.argv[1] + ' ./' + sys.argv[5]
- command += ' ' + seed + ' >' + sys.argv[3] + ' 2>&1'
- if loud:
- print (command)
- if os.system (command) == 0:
- if not quiet: print ("TF-Fuzz run complete.")
- else:
- print ('Could not run TF-Fuzz; please see stdout_stderr file.')
- sys.exit(2)
-
- # Attempt to open files indicated on command line:
- if len(sys.argv) != 6:
- message = '{} requires 5 command-line arguments. Exiting.'
- print (message.format(sys.argv[0]), file=sys.stderr)
- usage()
- sys.exit(3)
- template_file_name = sys.argv[1]
- exp_stdout_file_name = sys.argv[2]
- act_stdout_file_name = sys.argv[3]
- exp_test_file_name = sys.argv[4]
- act_test_file_name = sys.argv[5]
-
- try:
- template_file = open (template_file_name, 'rt')
- exp_stdout_file = open (exp_stdout_file_name, 'rt')
- act_stdout_file = open (act_stdout_file_name, 'rt')
- exp_test_file = open (exp_test_file_name, 'rt')
- act_test_file = open (act_test_file_name, 'rt')
- except FileNotFoundError:
- print ('One or more files could not be found.')
- usage();
- sys.exit(4)
- except:
- print ('Something went wrong trying to open the input files.')
- usage();
- sys.exit(5)
- else:
- message = '\nInput files:\n {},\n {},\n {},\n'
- message += ' {}, and\n {}\nopened successfully.\n'
- if not quiet:
- print (message.format (template_file_name, exp_stdout_file_name,
- act_stdout_file_name, exp_test_file_name, act_test_file_name))
-
- # Check it all:
- if not quiet: print ("\nChecking test C file: ", end="")
- line_by_line.check_file ( exp_test_file, exp_test_file_name,
- act_test_file, act_test_file_name,
- loud, quiet, ultra_quiet )
- if not quiet: print ("Checking stdout and stderr: ", end="")
- line_by_line.check_file ( exp_stdout_file, exp_stdout_file_name,
- act_stdout_file, act_stdout_file_name,
- loud, quiet, ultra_quiet )
-
- # Ran to completion normally, so pass:
- if not ultra_quiet: print ("Regression test passed.")
- sys.exit(0)
-
-if __name__ == "__main__": main()
diff --git a/tools/tf_fuzz/regression/000005_set_sst_rand_name_rand_data/exp_stdout_stderr b/tools/tf_fuzz/regression/000005_set_sst_rand_name_rand_data/exp_stdout_stderr
deleted file mode 100644
index 5ead6c6c5..000000000
--- a/tools/tf_fuzz/regression/000005_set_sst_rand_name_rand_data/exp_stdout_stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-Trusted Firmware Fuzzer (TF-Fuzz) starting...
-
-Info: random seed was not specified.
-
-Using seed value of \d+ \(0x[a-f\d]+\).
-Purpose line: to show how to randomize name and data
-Asset random identifier: "*"
-Create from random data
-Set SST command: "*"
-Appended to end of call sequence: SST-set call.
-Set command: "*"
-Command with no expect: ";"
-Lines: Line number 3.
-Lines: Line number 3.
-Call sequence generated.
-Simulating call sequence...
-Call sequence:
- SST-set call for asset [a-z]+
-Writing test file, ./test.c.
-
-TF-Fuzz test generation complete.
diff --git a/tools/tf_fuzz/regression/000005_set_sst_rand_name_rand_data/exp_test.c b/tools/tf_fuzz/regression/000005_set_sst_rand_name_rand_data/exp_test.c
deleted file mode 100644
index 288cb1995..000000000
--- a/tools/tf_fuzz/regression/000005_set_sst_rand_name_rand_data/exp_test.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Test purpose:
- * to show how to randomize name and data
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <string.h>
-#include <stdint.h>
-
-#include "../sst/non_secure/ns_test_helpers.h"
-#include "psa/protected_storage.h"
-#include "test/framework/test_framework_helpers.h"
-#include "tfm_memory_utils.h"
-#include "psa/crypto.h"
-#include "psa/crypto_sizes.h"
-
-/* This is not yet right for how to run a test; need to register tests, etc. */
-
-void test_thread (struct test_result_t *ret) {
- psa_status_t crypto_status; /* result from Crypto calls */
- psa_status_t sst_status;
- /* Variables (etc.) to initialize and check PSA assets: */
- static uint8_t @@@003@@@_set_data\[\] = "@@002@10@@[a-z\ ]*[\.\?\!]";
- static uint32_t @@@003@@@_set_length = \d+;
- (void)sst_status;
- /* "void" to prevent unused-variable warning, since the variable may not
- * be used in this particular test case.
- */
-
- crypto_status = psa_crypto_init();
- if (crypto_status != PSA_SUCCESS) {
- TEST_FAIL("Could not initialize Crypto.");
- return;
- }
-
- TEST_LOG("Test to show how to randomize name and data");
-
-
- /* PSA calls to test: */
- /\* Creating SST asset "@@@003@@@," with data "@@002@10@@...". \*/
- sst_status = psa_ps_set\(@@@001@@@, @@@003@@@_set_length, @@@003@@@_set_data,
- PSA_STORAGE_FLAG_[A-Z_]+\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
-
-
- /* Removing assets left over from testing: */
- psa_ps_remove\(@@@001@@@\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
-
- /* Test completed */
- ret->val = TEST_PASSED;
-}
diff --git a/tools/tf_fuzz/regression/000005_set_sst_rand_name_rand_data/template b/tools/tf_fuzz/regression/000005_set_sst_rand_name_rand_data/template
deleted file mode 100644
index 5290f27bb..000000000
--- a/tools/tf_fuzz/regression/000005_set_sst_rand_name_rand_data/template
+++ /dev/null
@@ -1,2 +0,0 @@
-purpose to show how to randomize name and data;
-set sst name * data *;
diff --git a/tools/tf_fuzz/regression/000006_set_sst_multi_name_rand_data/check.py b/tools/tf_fuzz/regression/000006_set_sst_multi_name_rand_data/check.py
deleted file mode 100644
index 1bc5cbe74..000000000
--- a/tools/tf_fuzz/regression/000006_set_sst_multi_name_rand_data/check.py
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-'''
- Please read .../tf_fuzz/regression/README to understand this code.
-
- Please also read the comments in .../tf_fuzz/regression/regress_lib/line_by_line.py.
-'''
-
-import sys, os, re, string, pdb
-sys.path.append ("../regress_lib")
-import line_by_line
-
-
-# Describe script usage:
-def usage():
- print ('''
- Command-line parameters:
- 1. The test-template file, nominally named "template",
- 2. The expected combined stdout/stderr output, nominally named "exp_stdout_stderr",
- 3. The actual/generated combined stdout/stderr output, nominally named "stdout_stderr",
- 4. The expected .c test file, nominally named "exp_test.c", and
- 5. The actual, generated .c test file, nominally named "test.c".
-
- Optionally, *before* these five arguments, you may add switches thus:
- "--v" for verbose mode, to view line-by-line comparisons actual vs. expected,
- "--q" to only print error messages and a successful-completion message,
- "--qq" same as --q but not even printing out the completion message, and
- "--s 12345" to run TF-Fuzz with seed value 12345 (or whatever).
- ''')
-
-
-def main():
- # See if we're supposed to be quiet:
- loud = quiet = ultra_quiet = False
- seed = ""
- while sys.argv[1][0] == "-":
- if sys.argv[1] == "--v":
- loud = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--q":
- quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--qq":
- quiet = ultra_quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--s":
- sys.argv.pop(1)
- seed = sys.argv[1]
- sys.argv.pop(1)
- if not seed.isnumeric():
- print ('The --s seed argument was not a number.')
- usage()
- sys.exit(1)
-
- # Run TF-Fuzz:
- if not quiet: print ("Running TF-Fuzz... ")
- os.system ('rm -f stdout_stderr test.c')
- command = '../../tfz -v ./' + sys.argv[1] + ' ./' + sys.argv[5]
- command += ' ' + seed + ' >' + sys.argv[3] + ' 2>&1'
- if loud:
- print (command)
- if os.system (command) == 0:
- if not quiet: print ("TF-Fuzz run complete.")
- else:
- print ('Could not run TF-Fuzz; please see stdout_stderr file.')
- sys.exit(2)
-
- # Attempt to open files indicated on command line:
- if len(sys.argv) != 6:
- message = '{} requires 5 command-line arguments. Exiting.'
- print (message.format(sys.argv[0]), file=sys.stderr)
- usage()
- sys.exit(3)
- template_file_name = sys.argv[1]
- exp_stdout_file_name = sys.argv[2]
- act_stdout_file_name = sys.argv[3]
- exp_test_file_name = sys.argv[4]
- act_test_file_name = sys.argv[5]
-
- try:
- template_file = open (template_file_name, 'rt')
- exp_stdout_file = open (exp_stdout_file_name, 'rt')
- act_stdout_file = open (act_stdout_file_name, 'rt')
- exp_test_file = open (exp_test_file_name, 'rt')
- act_test_file = open (act_test_file_name, 'rt')
- except FileNotFoundError:
- print ('One or more files could not be found.')
- usage();
- sys.exit(4)
- except:
- print ('Something went wrong trying to open the input files.')
- usage();
- sys.exit(5)
- else:
- message = '\nInput files:\n {},\n {},\n {},\n'
- message += ' {}, and\n {}\nopened successfully.\n'
- if not quiet:
- print (message.format (template_file_name, exp_stdout_file_name,
- act_stdout_file_name, exp_test_file_name, act_test_file_name))
-
- # Check it all:
- if not quiet: print ("\nChecking test C file: ", end="")
- line_by_line.check_file ( exp_test_file, exp_test_file_name,
- act_test_file, act_test_file_name,
- loud, quiet, ultra_quiet )
- if not quiet: print ("Checking stdout and stderr: ", end="")
- line_by_line.check_file ( exp_stdout_file, exp_stdout_file_name,
- act_stdout_file, act_stdout_file_name,
- loud, quiet, ultra_quiet )
-
- # Ran to completion normally, so pass:
- if not ultra_quiet: print ("Regression test passed.")
- sys.exit(0)
-
-if __name__ == "__main__": main()
diff --git a/tools/tf_fuzz/regression/000006_set_sst_multi_name_rand_data/exp_stdout_stderr b/tools/tf_fuzz/regression/000006_set_sst_multi_name_rand_data/exp_stdout_stderr
deleted file mode 100644
index 4e76308f5..000000000
--- a/tools/tf_fuzz/regression/000006_set_sst_multi_name_rand_data/exp_stdout_stderr
+++ /dev/null
@@ -1,34 +0,0 @@
-Trusted Firmware Fuzzer (TF-Fuzz) starting...
-
-Info: random seed was not specified.
-
-Using seed value of \d+ \(0x[a-f\d]+\).
-Purpose line: to show a nice party trick
-ASSET_IDENTIFIER: "john"
-ASSET_IDENTIFIER: "paul"
-ASSET_IDENTIFIER: "george"
-ASSET_IDENTIFIER: "and"
-ASSET_IDENTIFIER: "ringo"
-Asset identifier list: "data"
-Create from random data
-Set SST command: "*"
-Appended to end of call sequence: SST-set call.
-Appended to end of call sequence: SST-set call.
-Appended to end of call sequence: SST-set call.
-Appended to end of call sequence: SST-set call.
-Appended to end of call sequence: SST-set call.
-Set command: "*"
-Command with no expect: ";"
-Lines: Line number 3.
-Lines: Line number 3.
-Call sequence generated.
-Simulating call sequence...
-Call sequence:
- SST-set call for asset john
- SST-set call for asset paul
- SST-set call for asset george
- SST-set call for asset and
- SST-set call for asset ringo
-Writing test file, ./test.c.
-
-TF-Fuzz test generation complete.
diff --git a/tools/tf_fuzz/regression/000006_set_sst_multi_name_rand_data/exp_test.c b/tools/tf_fuzz/regression/000006_set_sst_multi_name_rand_data/exp_test.c
deleted file mode 100644
index 84026ac6b..000000000
--- a/tools/tf_fuzz/regression/000006_set_sst_multi_name_rand_data/exp_test.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Test purpose:
- * to show a nice party trick
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <string.h>
-#include <stdint.h>
-
-#include "../sst/non_secure/ns_test_helpers.h"
-#include "psa/protected_storage.h"
-#include "test/framework/test_framework_helpers.h"
-#include "tfm_memory_utils.h"
-#include "psa/crypto.h"
-#include "psa/crypto_sizes.h"
-
-/* This is not yet right for how to run a test; need to register tests, etc. */
-
-void test_thread (struct test_result_t *ret) {
- psa_status_t crypto_status; /* result from Crypto calls */
- psa_status_t sst_status;
- /* Variables (etc.) to initialize and check PSA assets: */
- static uint8_t john_set_data\[\] = "@@012@10@@[a-z\ ]*[\.\?\!]";
- static uint32_t john_set_length = \d+;
- static uint8_t paul_set_data\[\] = "@@013@10@@[a-z\ ]*[\.\?\!]";
- static uint32_t paul_set_length = \d+;
- static uint8_t george_set_data\[\] = "@@014@10@@[a-z\ ]*[\.\?\!]";
- static uint32_t george_set_length = \d+;
- static uint8_t and_set_data\[\] = "@@015@10@@[a-z\ ]*[\.\?\!]";
- static uint32_t and_set_length = \d+;
- static uint8_t ringo_set_data\[\] = "@@016@10@@[a-z\ ]*[\.\?\!]";
- static uint32_t ringo_set_length = \d+;
- (void)sst_status;
- /* "void" to prevent unused-variable warning, since the variable may not
- * be used in this particular test case.
- */
-
- crypto_status = psa_crypto_init();
- if (crypto_status != PSA_SUCCESS) {
- TEST_FAIL("Could not initialize Crypto.");
- return;
- }
-
- TEST_LOG("Test to show a nice party trick");
-
-
- /* PSA calls to test: */
- /\* Creating SST asset "john," with data "@@012@10@@...". \*/
- sst_status = psa_ps_set\(@@@001@@@, john_set_length, john_set_data,
- PSA_STORAGE_FLAG_[A-Z_]+\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- /\* Creating SST asset "paul," with data "@@013@10@@...". \*/
- sst_status = psa_ps_set\(@@@002@@@, paul_set_length, paul_set_data,
- PSA_STORAGE_FLAG_[A-Z_]+\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- /\* Creating SST asset "george," with data "@@014@10@@...". \*/
- sst_status = psa_ps_set\(@@@003@@@, george_set_length, george_set_data,
- PSA_STORAGE_FLAG_[A-Z_]+\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- /\* Creating SST asset "and," with data "@@015@10@@...". \*/
- sst_status = psa_ps_set\(@@@004@@@, and_set_length, and_set_data,
- PSA_STORAGE_FLAG_[A-Z_]+\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- /\* Creating SST asset "ringo," with data "@@016@10@@...". \*/
- sst_status = psa_ps_set\(@@@005@@@, ringo_set_length, ringo_set_data,
- PSA_STORAGE_FLAG_[A-Z_]+\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
-
-
- /* Removing assets left over from testing: */
- psa_ps_remove\(@@@001@@@\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
- psa_ps_remove\(@@@002@@@\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
- psa_ps_remove\(@@@003@@@\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
- psa_ps_remove\(@@@004@@@\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
- psa_ps_remove\(@@@005@@@\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
-
- /* Test completed */
- ret->val = TEST_PASSED;
-}
diff --git a/tools/tf_fuzz/regression/000006_set_sst_multi_name_rand_data/template b/tools/tf_fuzz/regression/000006_set_sst_multi_name_rand_data/template
deleted file mode 100644
index 2e86d7542..000000000
--- a/tools/tf_fuzz/regression/000006_set_sst_multi_name_rand_data/template
+++ /dev/null
@@ -1,2 +0,0 @@
-purpose to show a nice party trick;
-set sst name john paul george and ringo data *;
diff --git a/tools/tf_fuzz/regression/000007_set_sst_multi_uid_rand_data/check.py b/tools/tf_fuzz/regression/000007_set_sst_multi_uid_rand_data/check.py
deleted file mode 100644
index 1bc5cbe74..000000000
--- a/tools/tf_fuzz/regression/000007_set_sst_multi_uid_rand_data/check.py
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-'''
- Please read .../tf_fuzz/regression/README to understand this code.
-
- Please also read the comments in .../tf_fuzz/regression/regress_lib/line_by_line.py.
-'''
-
-import sys, os, re, string, pdb
-sys.path.append ("../regress_lib")
-import line_by_line
-
-
-# Describe script usage:
-def usage():
- print ('''
- Command-line parameters:
- 1. The test-template file, nominally named "template",
- 2. The expected combined stdout/stderr output, nominally named "exp_stdout_stderr",
- 3. The actual/generated combined stdout/stderr output, nominally named "stdout_stderr",
- 4. The expected .c test file, nominally named "exp_test.c", and
- 5. The actual, generated .c test file, nominally named "test.c".
-
- Optionally, *before* these five arguments, you may add switches thus:
- "--v" for verbose mode, to view line-by-line comparisons actual vs. expected,
- "--q" to only print error messages and a successful-completion message,
- "--qq" same as --q but not even printing out the completion message, and
- "--s 12345" to run TF-Fuzz with seed value 12345 (or whatever).
- ''')
-
-
-def main():
- # See if we're supposed to be quiet:
- loud = quiet = ultra_quiet = False
- seed = ""
- while sys.argv[1][0] == "-":
- if sys.argv[1] == "--v":
- loud = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--q":
- quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--qq":
- quiet = ultra_quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--s":
- sys.argv.pop(1)
- seed = sys.argv[1]
- sys.argv.pop(1)
- if not seed.isnumeric():
- print ('The --s seed argument was not a number.')
- usage()
- sys.exit(1)
-
- # Run TF-Fuzz:
- if not quiet: print ("Running TF-Fuzz... ")
- os.system ('rm -f stdout_stderr test.c')
- command = '../../tfz -v ./' + sys.argv[1] + ' ./' + sys.argv[5]
- command += ' ' + seed + ' >' + sys.argv[3] + ' 2>&1'
- if loud:
- print (command)
- if os.system (command) == 0:
- if not quiet: print ("TF-Fuzz run complete.")
- else:
- print ('Could not run TF-Fuzz; please see stdout_stderr file.')
- sys.exit(2)
-
- # Attempt to open files indicated on command line:
- if len(sys.argv) != 6:
- message = '{} requires 5 command-line arguments. Exiting.'
- print (message.format(sys.argv[0]), file=sys.stderr)
- usage()
- sys.exit(3)
- template_file_name = sys.argv[1]
- exp_stdout_file_name = sys.argv[2]
- act_stdout_file_name = sys.argv[3]
- exp_test_file_name = sys.argv[4]
- act_test_file_name = sys.argv[5]
-
- try:
- template_file = open (template_file_name, 'rt')
- exp_stdout_file = open (exp_stdout_file_name, 'rt')
- act_stdout_file = open (act_stdout_file_name, 'rt')
- exp_test_file = open (exp_test_file_name, 'rt')
- act_test_file = open (act_test_file_name, 'rt')
- except FileNotFoundError:
- print ('One or more files could not be found.')
- usage();
- sys.exit(4)
- except:
- print ('Something went wrong trying to open the input files.')
- usage();
- sys.exit(5)
- else:
- message = '\nInput files:\n {},\n {},\n {},\n'
- message += ' {}, and\n {}\nopened successfully.\n'
- if not quiet:
- print (message.format (template_file_name, exp_stdout_file_name,
- act_stdout_file_name, exp_test_file_name, act_test_file_name))
-
- # Check it all:
- if not quiet: print ("\nChecking test C file: ", end="")
- line_by_line.check_file ( exp_test_file, exp_test_file_name,
- act_test_file, act_test_file_name,
- loud, quiet, ultra_quiet )
- if not quiet: print ("Checking stdout and stderr: ", end="")
- line_by_line.check_file ( exp_stdout_file, exp_stdout_file_name,
- act_stdout_file, act_stdout_file_name,
- loud, quiet, ultra_quiet )
-
- # Ran to completion normally, so pass:
- if not ultra_quiet: print ("Regression test passed.")
- sys.exit(0)
-
-if __name__ == "__main__": main()
diff --git a/tools/tf_fuzz/regression/000007_set_sst_multi_uid_rand_data/exp_stdout_stderr b/tools/tf_fuzz/regression/000007_set_sst_multi_uid_rand_data/exp_stdout_stderr
deleted file mode 100644
index 5e9e3621e..000000000
--- a/tools/tf_fuzz/regression/000007_set_sst_multi_uid_rand_data/exp_stdout_stderr
+++ /dev/null
@@ -1,37 +0,0 @@
-Trusted Firmware Fuzzer (TF-Fuzz) starting...
-
-Info: random seed was not specified.
-
-Using seed value of \d+ \(0x[a-f\d]+\).
-Purpose line: same with UIDs
-ASSET_NUMBER: "17"
-ASSET_NUMBER: "19"
-ASSET_NUMBER: "24"
-ASSET_NUMBER: "31"
-ASSET_NUMBER: "34"
-ASSET_NUMBER: "41"
-SST-asset UID list: "data"
-Create from random data
-Set SST command: "*"
-Appended to end of call sequence: SST-set call.
-Appended to end of call sequence: SST-set call.
-Appended to end of call sequence: SST-set call.
-Appended to end of call sequence: SST-set call.
-Appended to end of call sequence: SST-set call.
-Appended to end of call sequence: SST-set call.
-Set command: "*"
-Command with no expect: ";"
-Lines: Line number 3.
-Lines: Line number 3.
-Call sequence generated.
-Simulating call sequence...
-Call sequence:
- SST-set call for asset SST_ID_17
- SST-set call for asset SST_ID_19
- SST-set call for asset SST_ID_24
- SST-set call for asset SST_ID_31
- SST-set call for asset SST_ID_34
- SST-set call for asset SST_ID_41
-Writing test file, ./test.c.
-
-TF-Fuzz test generation complete.
diff --git a/tools/tf_fuzz/regression/000007_set_sst_multi_uid_rand_data/exp_test.c b/tools/tf_fuzz/regression/000007_set_sst_multi_uid_rand_data/exp_test.c
deleted file mode 100644
index 02055e80c..000000000
--- a/tools/tf_fuzz/regression/000007_set_sst_multi_uid_rand_data/exp_test.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Test purpose:
- * same with UIDs
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <string.h>
-#include <stdint.h>
-
-#include "../sst/non_secure/ns_test_helpers.h"
-#include "psa/protected_storage.h"
-#include "test/framework/test_framework_helpers.h"
-#include "tfm_memory_utils.h"
-#include "psa/crypto.h"
-#include "psa/crypto_sizes.h"
-
-/* This is not yet right for how to run a test; need to register tests, etc. */
-
-void test_thread (struct test_result_t *ret) {
- psa_status_t crypto_status; /* result from Crypto calls */
- psa_status_t sst_status;
- /* Variables (etc.) to initialize and check PSA assets: */
- static uint8_t SST_ID_17_set_data\[\] = "@@012@10@@[a-z\ ]*[\.\?\!]";
- static uint32_t SST_ID_17_set_length = \d+;
- static uint8_t SST_ID_19_set_data\[\] = "@@013@10@@[a-z\ ]*[\.\?\!]";
- static uint32_t SST_ID_19_set_length = \d+;
- static uint8_t SST_ID_24_set_data\[\] = "@@014@10@@[a-z\ ]*[\.\?\!]";
- static uint32_t SST_ID_24_set_length = \d+;
- static uint8_t SST_ID_31_set_data\[\] = "@@015@10@@[a-z\ ]*[\.\?\!]";
- static uint32_t SST_ID_31_set_length = \d+;
- static uint8_t SST_ID_34_set_data\[\] = "@@016@10@@[a-z\ ]*[\.\?\!]";
- static uint32_t SST_ID_34_set_length = \d+;
- static uint8_t SST_ID_41_set_data\[\] = "@@017@10@@[a-z\ ]*[\.\?\!]";
- static uint32_t SST_ID_41_set_length = \d+;
- (void)sst_status;
- /* "void" to prevent unused-variable warning, since the variable may not
- * be used in this particular test case.
- */
-
- crypto_status = psa_crypto_init();
- if (crypto_status != PSA_SUCCESS) {
- TEST_FAIL("Could not initialize Crypto.");
- return;
- }
-
- TEST_LOG("Test same with UIDs");
-
-
- /* PSA calls to test: */
- /\* Creating SST asset UID = 17 with data "@@012@10@@...". \*/
- sst_status = psa_ps_set(17, SST_ID_17_set_length, SST_ID_17_set_data,
- PSA_STORAGE_FLAG_[A-Z_]+\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- /\* Creating SST asset UID = 19 with data "@@013@10@@...". \*/
- sst_status = psa_ps_set(19, SST_ID_19_set_length, SST_ID_19_set_data,
- PSA_STORAGE_FLAG_[A-Z_]+\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- /\* Creating SST asset UID = 24 with data "@@014@10@@...". \*/
- sst_status = psa_ps_set(24, SST_ID_24_set_length, SST_ID_24_set_data,
- PSA_STORAGE_FLAG_[A-Z_]+\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- /\* Creating SST asset UID = 31 with data "@@015@10@@...". \*/
- sst_status = psa_ps_set(31, SST_ID_31_set_length, SST_ID_31_set_data,
- PSA_STORAGE_FLAG_[A-Z_]+\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- /\* Creating SST asset UID = 34 with data "@@016@10@@...". \*/
- sst_status = psa_ps_set(34, SST_ID_34_set_length, SST_ID_34_set_data,
- PSA_STORAGE_FLAG_[A-Z_]+\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- /\* Creating SST asset UID = 41 with data "@@017@10@@...". \*/
- sst_status = psa_ps_set(41, SST_ID_41_set_length, SST_ID_41_set_data,
- PSA_STORAGE_FLAG_[A-Z_]+\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
-
-
- /* Removing assets left over from testing: */
- psa_ps_remove(17);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
- psa_ps_remove(19);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
- psa_ps_remove(24);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
- psa_ps_remove(31);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
- psa_ps_remove(34);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
- psa_ps_remove(41);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
-
- /* Test completed */
- ret->val = TEST_PASSED;
-}
diff --git a/tools/tf_fuzz/regression/000007_set_sst_multi_uid_rand_data/template b/tools/tf_fuzz/regression/000007_set_sst_multi_uid_rand_data/template
deleted file mode 100644
index 903027ec2..000000000
--- a/tools/tf_fuzz/regression/000007_set_sst_multi_uid_rand_data/template
+++ /dev/null
@@ -1,2 +0,0 @@
-purpose same with UIDs;
-set sst uid 17 19 24 31 34 41 data *;
diff --git a/tools/tf_fuzz/regression/000008_set_sst_name_rand_data_read_check_wrong/check.py b/tools/tf_fuzz/regression/000008_set_sst_name_rand_data_read_check_wrong/check.py
deleted file mode 100644
index 1bc5cbe74..000000000
--- a/tools/tf_fuzz/regression/000008_set_sst_name_rand_data_read_check_wrong/check.py
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-'''
- Please read .../tf_fuzz/regression/README to understand this code.
-
- Please also read the comments in .../tf_fuzz/regression/regress_lib/line_by_line.py.
-'''
-
-import sys, os, re, string, pdb
-sys.path.append ("../regress_lib")
-import line_by_line
-
-
-# Describe script usage:
-def usage():
- print ('''
- Command-line parameters:
- 1. The test-template file, nominally named "template",
- 2. The expected combined stdout/stderr output, nominally named "exp_stdout_stderr",
- 3. The actual/generated combined stdout/stderr output, nominally named "stdout_stderr",
- 4. The expected .c test file, nominally named "exp_test.c", and
- 5. The actual, generated .c test file, nominally named "test.c".
-
- Optionally, *before* these five arguments, you may add switches thus:
- "--v" for verbose mode, to view line-by-line comparisons actual vs. expected,
- "--q" to only print error messages and a successful-completion message,
- "--qq" same as --q but not even printing out the completion message, and
- "--s 12345" to run TF-Fuzz with seed value 12345 (or whatever).
- ''')
-
-
-def main():
- # See if we're supposed to be quiet:
- loud = quiet = ultra_quiet = False
- seed = ""
- while sys.argv[1][0] == "-":
- if sys.argv[1] == "--v":
- loud = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--q":
- quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--qq":
- quiet = ultra_quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--s":
- sys.argv.pop(1)
- seed = sys.argv[1]
- sys.argv.pop(1)
- if not seed.isnumeric():
- print ('The --s seed argument was not a number.')
- usage()
- sys.exit(1)
-
- # Run TF-Fuzz:
- if not quiet: print ("Running TF-Fuzz... ")
- os.system ('rm -f stdout_stderr test.c')
- command = '../../tfz -v ./' + sys.argv[1] + ' ./' + sys.argv[5]
- command += ' ' + seed + ' >' + sys.argv[3] + ' 2>&1'
- if loud:
- print (command)
- if os.system (command) == 0:
- if not quiet: print ("TF-Fuzz run complete.")
- else:
- print ('Could not run TF-Fuzz; please see stdout_stderr file.')
- sys.exit(2)
-
- # Attempt to open files indicated on command line:
- if len(sys.argv) != 6:
- message = '{} requires 5 command-line arguments. Exiting.'
- print (message.format(sys.argv[0]), file=sys.stderr)
- usage()
- sys.exit(3)
- template_file_name = sys.argv[1]
- exp_stdout_file_name = sys.argv[2]
- act_stdout_file_name = sys.argv[3]
- exp_test_file_name = sys.argv[4]
- act_test_file_name = sys.argv[5]
-
- try:
- template_file = open (template_file_name, 'rt')
- exp_stdout_file = open (exp_stdout_file_name, 'rt')
- act_stdout_file = open (act_stdout_file_name, 'rt')
- exp_test_file = open (exp_test_file_name, 'rt')
- act_test_file = open (act_test_file_name, 'rt')
- except FileNotFoundError:
- print ('One or more files could not be found.')
- usage();
- sys.exit(4)
- except:
- print ('Something went wrong trying to open the input files.')
- usage();
- sys.exit(5)
- else:
- message = '\nInput files:\n {},\n {},\n {},\n'
- message += ' {}, and\n {}\nopened successfully.\n'
- if not quiet:
- print (message.format (template_file_name, exp_stdout_file_name,
- act_stdout_file_name, exp_test_file_name, act_test_file_name))
-
- # Check it all:
- if not quiet: print ("\nChecking test C file: ", end="")
- line_by_line.check_file ( exp_test_file, exp_test_file_name,
- act_test_file, act_test_file_name,
- loud, quiet, ultra_quiet )
- if not quiet: print ("Checking stdout and stderr: ", end="")
- line_by_line.check_file ( exp_stdout_file, exp_stdout_file_name,
- act_stdout_file, act_stdout_file_name,
- loud, quiet, ultra_quiet )
-
- # Ran to completion normally, so pass:
- if not ultra_quiet: print ("Regression test passed.")
- sys.exit(0)
-
-if __name__ == "__main__": main()
diff --git a/tools/tf_fuzz/regression/000008_set_sst_name_rand_data_read_check_wrong/exp_stdout_stderr b/tools/tf_fuzz/regression/000008_set_sst_name_rand_data_read_check_wrong/exp_stdout_stderr
deleted file mode 100644
index a138dc47f..000000000
--- a/tools/tf_fuzz/regression/000008_set_sst_name_rand_data_read_check_wrong/exp_stdout_stderr
+++ /dev/null
@@ -1,34 +0,0 @@
-Trusted Firmware Fuzzer (TF-Fuzz) starting...
-
-Info: random seed was not specified.
-
-Using seed value of \d+ \(0x[a-f\d]+\).
-Purpose line: to create and show an asset
-ASSET_IDENTIFIER: "snortwaggle"
-Asset identifier list: "data"
-Create from random data
-Set SST command: ";"
-Appended to end of call sequence: SST-set call.
-Set command: ";"
-Command with no expect: ";"
-ASSET_IDENTIFIER: "snortwaggle"
-Asset identifier list: "check"
-LITERAL string: "almost certainly not *this*"
-Read check against literal: "almost certainly not *this*"
-SST-read arguments: expect"
-Read SST command: "expect"
-Appended to end of call sequence: SST-get call.
-Read command: "expect"
-Expect fail clause: "fail"
-Command with expect: ";"
-Lines: Line number 4.
-Lines: Line number 4.
-Lines: Line number 4.
-Call sequence generated.
-Simulating call sequence...
-Call sequence:
- SST-set call for asset snortwaggle
- SST-get call for asset snortwaggle
-Writing test file, ./test.c.
-
-TF-Fuzz test generation complete.
diff --git a/tools/tf_fuzz/regression/000008_set_sst_name_rand_data_read_check_wrong/exp_test.c b/tools/tf_fuzz/regression/000008_set_sst_name_rand_data_read_check_wrong/exp_test.c
deleted file mode 100644
index 5f8486c82..000000000
--- a/tools/tf_fuzz/regression/000008_set_sst_name_rand_data_read_check_wrong/exp_test.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Test purpose:
- * to create and show an asset
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <string.h>
-#include <stdint.h>
-
-#include "../sst/non_secure/ns_test_helpers.h"
-#include "psa/protected_storage.h"
-#include "test/framework/test_framework_helpers.h"
-#include "tfm_memory_utils.h"
-#include "psa/crypto.h"
-#include "psa/crypto_sizes.h"
-
-/* This is not yet right for how to run a test; need to register tests, etc. */
-
-void test_thread (struct test_result_t *ret) {
- psa_status_t crypto_status; /* result from Crypto calls */
- psa_status_t sst_status;
- /* Variables (etc.) to initialize and check PSA assets: */
- static uint8_t snortwaggle_set_data\[\] = "@@002@10@@[a-z\ ]*[\.\?\!]";
- static uint32_t snortwaggle_set_length = \d+;
- static uint8_t snortwaggle_exp_data[] = "almost certainly not *this*";
- static uint8_t snortwaggle_act_data\[2048\] = "[A-Z][a-z ]*[\.\?\!]";
- static size_t snortwaggle_act_length = \d+;
- (void)sst_status;
- /* "void" to prevent unused-variable warning, since the variable may not
- * be used in this particular test case.
- */
-
- crypto_status = psa_crypto_init();
- if (crypto_status != PSA_SUCCESS) {
- TEST_FAIL("Could not initialize Crypto.");
- return;
- }
-
- TEST_LOG("Test to create and show an asset");
-
-
- /* PSA calls to test: */
- /\* Creating SST asset "snortwaggle," with data "@@002@10@@...". \*/
- sst_status = psa_ps_set\(@@@001@@@, snortwaggle_set_length, snortwaggle_set_data,
- PSA_STORAGE_FLAG_[A-Z_]+\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- sst_status = psa_ps_get\(@@@001@@@, 0, @@@003@@@, snortwaggle_act_data
- &snortwaggle_act_length);
- if (sst_status == PSA_SUCCESS) {
- TEST_FAIL("psa_ps_get() expected not PSA_SUCCESS.");
- return;
- }
- /* Check that the data is correct */
- if \(tfm_memcmp\(snortwaggle_act_data, snortwaggle_exp_data,
- snortwaggle_act_length\) != 0\) {
- TEST_FAIL("Read data should be equal to result data");
- return;
- }
-
-
- /* Removing assets left over from testing: */
- psa_ps_remove\(@@@001@@@\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
-
- /* Test completed */
- ret->val = TEST_PASSED;
-}
diff --git a/tools/tf_fuzz/regression/000008_set_sst_name_rand_data_read_check_wrong/template b/tools/tf_fuzz/regression/000008_set_sst_name_rand_data_read_check_wrong/template
deleted file mode 100644
index 03b22d910..000000000
--- a/tools/tf_fuzz/regression/000008_set_sst_name_rand_data_read_check_wrong/template
+++ /dev/null
@@ -1,3 +0,0 @@
-purpose to create and show an asset;
-set sst name snortwaggle data *;
-read sst name snortwaggle check "almost certainly not *this*" expect fail;
diff --git a/tools/tf_fuzz/regression/000009_set_sst_name_rand_data_read_check_var_read_print/check.py b/tools/tf_fuzz/regression/000009_set_sst_name_rand_data_read_check_var_read_print/check.py
deleted file mode 100644
index 1bc5cbe74..000000000
--- a/tools/tf_fuzz/regression/000009_set_sst_name_rand_data_read_check_var_read_print/check.py
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-'''
- Please read .../tf_fuzz/regression/README to understand this code.
-
- Please also read the comments in .../tf_fuzz/regression/regress_lib/line_by_line.py.
-'''
-
-import sys, os, re, string, pdb
-sys.path.append ("../regress_lib")
-import line_by_line
-
-
-# Describe script usage:
-def usage():
- print ('''
- Command-line parameters:
- 1. The test-template file, nominally named "template",
- 2. The expected combined stdout/stderr output, nominally named "exp_stdout_stderr",
- 3. The actual/generated combined stdout/stderr output, nominally named "stdout_stderr",
- 4. The expected .c test file, nominally named "exp_test.c", and
- 5. The actual, generated .c test file, nominally named "test.c".
-
- Optionally, *before* these five arguments, you may add switches thus:
- "--v" for verbose mode, to view line-by-line comparisons actual vs. expected,
- "--q" to only print error messages and a successful-completion message,
- "--qq" same as --q but not even printing out the completion message, and
- "--s 12345" to run TF-Fuzz with seed value 12345 (or whatever).
- ''')
-
-
-def main():
- # See if we're supposed to be quiet:
- loud = quiet = ultra_quiet = False
- seed = ""
- while sys.argv[1][0] == "-":
- if sys.argv[1] == "--v":
- loud = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--q":
- quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--qq":
- quiet = ultra_quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--s":
- sys.argv.pop(1)
- seed = sys.argv[1]
- sys.argv.pop(1)
- if not seed.isnumeric():
- print ('The --s seed argument was not a number.')
- usage()
- sys.exit(1)
-
- # Run TF-Fuzz:
- if not quiet: print ("Running TF-Fuzz... ")
- os.system ('rm -f stdout_stderr test.c')
- command = '../../tfz -v ./' + sys.argv[1] + ' ./' + sys.argv[5]
- command += ' ' + seed + ' >' + sys.argv[3] + ' 2>&1'
- if loud:
- print (command)
- if os.system (command) == 0:
- if not quiet: print ("TF-Fuzz run complete.")
- else:
- print ('Could not run TF-Fuzz; please see stdout_stderr file.')
- sys.exit(2)
-
- # Attempt to open files indicated on command line:
- if len(sys.argv) != 6:
- message = '{} requires 5 command-line arguments. Exiting.'
- print (message.format(sys.argv[0]), file=sys.stderr)
- usage()
- sys.exit(3)
- template_file_name = sys.argv[1]
- exp_stdout_file_name = sys.argv[2]
- act_stdout_file_name = sys.argv[3]
- exp_test_file_name = sys.argv[4]
- act_test_file_name = sys.argv[5]
-
- try:
- template_file = open (template_file_name, 'rt')
- exp_stdout_file = open (exp_stdout_file_name, 'rt')
- act_stdout_file = open (act_stdout_file_name, 'rt')
- exp_test_file = open (exp_test_file_name, 'rt')
- act_test_file = open (act_test_file_name, 'rt')
- except FileNotFoundError:
- print ('One or more files could not be found.')
- usage();
- sys.exit(4)
- except:
- print ('Something went wrong trying to open the input files.')
- usage();
- sys.exit(5)
- else:
- message = '\nInput files:\n {},\n {},\n {},\n'
- message += ' {}, and\n {}\nopened successfully.\n'
- if not quiet:
- print (message.format (template_file_name, exp_stdout_file_name,
- act_stdout_file_name, exp_test_file_name, act_test_file_name))
-
- # Check it all:
- if not quiet: print ("\nChecking test C file: ", end="")
- line_by_line.check_file ( exp_test_file, exp_test_file_name,
- act_test_file, act_test_file_name,
- loud, quiet, ultra_quiet )
- if not quiet: print ("Checking stdout and stderr: ", end="")
- line_by_line.check_file ( exp_stdout_file, exp_stdout_file_name,
- act_stdout_file, act_stdout_file_name,
- loud, quiet, ultra_quiet )
-
- # Ran to completion normally, so pass:
- if not ultra_quiet: print ("Regression test passed.")
- sys.exit(0)
-
-if __name__ == "__main__": main()
diff --git a/tools/tf_fuzz/regression/000009_set_sst_name_rand_data_read_check_var_read_print/exp_stdout_stderr b/tools/tf_fuzz/regression/000009_set_sst_name_rand_data_read_check_var_read_print/exp_stdout_stderr
deleted file mode 100644
index 844cb1730..000000000
--- a/tools/tf_fuzz/regression/000009_set_sst_name_rand_data_read_check_var_read_print/exp_stdout_stderr
+++ /dev/null
@@ -1,44 +0,0 @@
-Trusted Firmware Fuzzer (TF-Fuzz) starting...
-
-Info: random seed was not specified.
-
-Using seed value of \d+ \(0x[a-f\d]+\).
-Purpose line: to check against a variable or dump into the log
-ASSET_IDENTIFIER: "greebledorf"
-Asset identifier list: "data"
-Create from random data
-Set SST command: ";"
-Appended to end of call sequence: SST-set call.
-Set command: ";"
-Command with no expect: ";"
-ASSET_IDENTIFIER: "greebledorf"
-Asset identifier list: "chk"
-IDENTIFIER: "a_variable"
-Read-arguments variable name: "a_variable"
-Read check against variable: "a_variable"
-SST-read arguments: ;"
-Read SST command: ";"
-Appended to end of call sequence: SST-get call.
-Read command: ";"
-Command with no expect: ";"
-ASSET_IDENTIFIER: "greebledorf"
-Asset identifier list: "print"
-Read log to test log: "print"
-SST-read arguments: ;"
-Read SST command: ";"
-Appended to end of call sequence: SST-get call.
-Read command: ";"
-Command with no expect: ";"
-Lines: Line number 5.
-Lines: Line number 5.
-Lines: Line number 5.
-Lines: Line number 5.
-Call sequence generated.
-Simulating call sequence...
-Call sequence:
- SST-set call for asset greebledorf
- SST-get call for asset greebledorf
- SST-get call for asset greebledorf
-Writing test file, ./test.c.
-
-TF-Fuzz test generation complete.
diff --git a/tools/tf_fuzz/regression/000009_set_sst_name_rand_data_read_check_var_read_print/exp_test.c b/tools/tf_fuzz/regression/000009_set_sst_name_rand_data_read_check_var_read_print/exp_test.c
deleted file mode 100644
index f745c1f04..000000000
--- a/tools/tf_fuzz/regression/000009_set_sst_name_rand_data_read_check_var_read_print/exp_test.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Test purpose:
- * to check against a variable or dump into the log
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <string.h>
-#include <stdint.h>
-
-#include "../sst/non_secure/ns_test_helpers.h"
-#include "psa/protected_storage.h"
-#include "test/framework/test_framework_helpers.h"
-#include "tfm_memory_utils.h"
-#include "psa/crypto.h"
-#include "psa/crypto_sizes.h"
-
-/* This is not yet right for how to run a test; need to register tests, etc. */
-
-void test_thread (struct test_result_t *ret) {
- psa_status_t crypto_status; /* result from Crypto calls */
- psa_status_t sst_status;
- /* Variables (etc.) to initialize and check PSA assets: */
- static uint8_t greebledorf_set_data\[\] = "@@002@10@@[a-z\ ]*[\.\?\!]";
- static uint32_t greebledorf_set_length = \d+;
- static uint8_t a_variable_data\[\] = "[A-Z][a-z ]*[\.\?\!]";
- static uint8_t greebledorf_act_data\[2048\] = "[A-Z][a-z ]*[\.\?\!]";
- static size_t greebledorf_act_length = \d+;
- (void)sst_status;
- /* "void" to prevent unused-variable warning, since the variable may not
- * be used in this particular test case.
- */
-
- crypto_status = psa_crypto_init();
- if (crypto_status != PSA_SUCCESS) {
- TEST_FAIL("Could not initialize Crypto.");
- return;
- }
-
- TEST_LOG("Test to check against a variable or dump into the log");
-
-
- /* PSA calls to test: */
- /\* Creating SST asset "greebledorf," with data "@@002@10@@...". \*/
- sst_status = psa_ps_set\(@@@001@@@, greebledorf_set_length, greebledorf_set_data,
- PSA_STORAGE_FLAG_[A-Z_]+\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- sst_status = psa_ps_get\(@@@001@@@, 0, \d+, greebledorf_act_data,
- &greebledorf_act_length);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_get() expected PSA_SUCCESS.");
- return;
- }
- /* Check that the data is correct */
- if (tfm_memcmp(greebledorf_act_data, a_variable_data,
- greebledorf_act_length) != 0) {
- TEST_FAIL("Read data should be equal to result data");
- return;
- }
- sst_status = psa_ps_get\(@@@001@@@, 0, \d+, greebledorf_act_data,
- &greebledorf_act_length);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_get() expected PSA_SUCCESS.");
- return;
- }
- TEST_LOG\(\"greebledorf_act_data\"\);
-
-
- /* Removing assets left over from testing: */
- psa_ps_remove\(@@@001@@@\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
-
- /* Test completed */
- ret->val = TEST_PASSED;
-}
diff --git a/tools/tf_fuzz/regression/000009_set_sst_name_rand_data_read_check_var_read_print/template b/tools/tf_fuzz/regression/000009_set_sst_name_rand_data_read_check_var_read_print/template
deleted file mode 100644
index a1a4d6131..000000000
--- a/tools/tf_fuzz/regression/000009_set_sst_name_rand_data_read_check_var_read_print/template
+++ /dev/null
@@ -1,4 +0,0 @@
-purpose to check against a variable or dump into the log;
-set sst name greebledorf data *;
-read sst name greebledorf chk a_variable;
-read sst name greebledorf print;
diff --git a/tools/tf_fuzz/regression/000010_read_nonexistent_sst_check_string/check.py b/tools/tf_fuzz/regression/000010_read_nonexistent_sst_check_string/check.py
deleted file mode 100644
index 1bc5cbe74..000000000
--- a/tools/tf_fuzz/regression/000010_read_nonexistent_sst_check_string/check.py
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-'''
- Please read .../tf_fuzz/regression/README to understand this code.
-
- Please also read the comments in .../tf_fuzz/regression/regress_lib/line_by_line.py.
-'''
-
-import sys, os, re, string, pdb
-sys.path.append ("../regress_lib")
-import line_by_line
-
-
-# Describe script usage:
-def usage():
- print ('''
- Command-line parameters:
- 1. The test-template file, nominally named "template",
- 2. The expected combined stdout/stderr output, nominally named "exp_stdout_stderr",
- 3. The actual/generated combined stdout/stderr output, nominally named "stdout_stderr",
- 4. The expected .c test file, nominally named "exp_test.c", and
- 5. The actual, generated .c test file, nominally named "test.c".
-
- Optionally, *before* these five arguments, you may add switches thus:
- "--v" for verbose mode, to view line-by-line comparisons actual vs. expected,
- "--q" to only print error messages and a successful-completion message,
- "--qq" same as --q but not even printing out the completion message, and
- "--s 12345" to run TF-Fuzz with seed value 12345 (or whatever).
- ''')
-
-
-def main():
- # See if we're supposed to be quiet:
- loud = quiet = ultra_quiet = False
- seed = ""
- while sys.argv[1][0] == "-":
- if sys.argv[1] == "--v":
- loud = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--q":
- quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--qq":
- quiet = ultra_quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--s":
- sys.argv.pop(1)
- seed = sys.argv[1]
- sys.argv.pop(1)
- if not seed.isnumeric():
- print ('The --s seed argument was not a number.')
- usage()
- sys.exit(1)
-
- # Run TF-Fuzz:
- if not quiet: print ("Running TF-Fuzz... ")
- os.system ('rm -f stdout_stderr test.c')
- command = '../../tfz -v ./' + sys.argv[1] + ' ./' + sys.argv[5]
- command += ' ' + seed + ' >' + sys.argv[3] + ' 2>&1'
- if loud:
- print (command)
- if os.system (command) == 0:
- if not quiet: print ("TF-Fuzz run complete.")
- else:
- print ('Could not run TF-Fuzz; please see stdout_stderr file.')
- sys.exit(2)
-
- # Attempt to open files indicated on command line:
- if len(sys.argv) != 6:
- message = '{} requires 5 command-line arguments. Exiting.'
- print (message.format(sys.argv[0]), file=sys.stderr)
- usage()
- sys.exit(3)
- template_file_name = sys.argv[1]
- exp_stdout_file_name = sys.argv[2]
- act_stdout_file_name = sys.argv[3]
- exp_test_file_name = sys.argv[4]
- act_test_file_name = sys.argv[5]
-
- try:
- template_file = open (template_file_name, 'rt')
- exp_stdout_file = open (exp_stdout_file_name, 'rt')
- act_stdout_file = open (act_stdout_file_name, 'rt')
- exp_test_file = open (exp_test_file_name, 'rt')
- act_test_file = open (act_test_file_name, 'rt')
- except FileNotFoundError:
- print ('One or more files could not be found.')
- usage();
- sys.exit(4)
- except:
- print ('Something went wrong trying to open the input files.')
- usage();
- sys.exit(5)
- else:
- message = '\nInput files:\n {},\n {},\n {},\n'
- message += ' {}, and\n {}\nopened successfully.\n'
- if not quiet:
- print (message.format (template_file_name, exp_stdout_file_name,
- act_stdout_file_name, exp_test_file_name, act_test_file_name))
-
- # Check it all:
- if not quiet: print ("\nChecking test C file: ", end="")
- line_by_line.check_file ( exp_test_file, exp_test_file_name,
- act_test_file, act_test_file_name,
- loud, quiet, ultra_quiet )
- if not quiet: print ("Checking stdout and stderr: ", end="")
- line_by_line.check_file ( exp_stdout_file, exp_stdout_file_name,
- act_stdout_file, act_stdout_file_name,
- loud, quiet, ultra_quiet )
-
- # Ran to completion normally, so pass:
- if not ultra_quiet: print ("Regression test passed.")
- sys.exit(0)
-
-if __name__ == "__main__": main()
diff --git a/tools/tf_fuzz/regression/000010_read_nonexistent_sst_check_string/exp_stdout_stderr b/tools/tf_fuzz/regression/000010_read_nonexistent_sst_check_string/exp_stdout_stderr
deleted file mode 100644
index b8316fc24..000000000
--- a/tools/tf_fuzz/regression/000010_read_nonexistent_sst_check_string/exp_stdout_stderr
+++ /dev/null
@@ -1,24 +0,0 @@
-Trusted Firmware Fuzzer (TF-Fuzz) starting...
-
-Info: random seed was not specified.
-
-Using seed value of \d+ \(0x[a-f\d]+\).
-Purpose line: to show what happens when you 'read' a non-existent asset
-ASSET_IDENTIFIER: "napoleon"
-Asset identifier list: "check"
-LITERAL string: "this won't work"
-Read check against literal: "this won't work"
-SST-read arguments: ;"
-Read SST command: ";"
-Appended to end of call sequence: SST-get call.
-Read command: ";"
-Command with no expect: ";"
-Lines: Line number 3.
-Lines: Line number 3.
-Call sequence generated.
-Simulating call sequence...
-Call sequence:
- SST-get call for asset napoleon
-Writing test file, ./test.c.
-
-TF-Fuzz test generation complete.
diff --git a/tools/tf_fuzz/regression/000010_read_nonexistent_sst_check_string/exp_test.c b/tools/tf_fuzz/regression/000010_read_nonexistent_sst_check_string/exp_test.c
deleted file mode 100644
index 2048a69a3..000000000
--- a/tools/tf_fuzz/regression/000010_read_nonexistent_sst_check_string/exp_test.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Test purpose:
- * to show what happens when you 'read' a non-existent asset
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <string.h>
-#include <stdint.h>
-
-#include "../sst/non_secure/ns_test_helpers.h"
-#include "psa/protected_storage.h"
-#include "test/framework/test_framework_helpers.h"
-#include "tfm_memory_utils.h"
-#include "psa/crypto.h"
-#include "psa/crypto_sizes.h"
-
-/* This is not yet right for how to run a test; need to register tests, etc. */
-
-void test_thread (struct test_result_t *ret) {
- psa_status_t crypto_status; /* result from Crypto calls */
- psa_status_t sst_status;
- /* Variables (etc.) to initialize and check PSA assets: */
- static uint8_t napoleon_exp_data[] = "this won't work";
- static uint8_t napoleon_act_data\[2048\] = "[A-Z][a-z ]*[\.\?\!]";
- static size_t napoleon_act_length = \d+;
- (void)sst_status;
- /* "void" to prevent unused-variable warning, since the variable may not
- * be used in this particular test case.
- */
-
- crypto_status = psa_crypto_init();
- if (crypto_status != PSA_SUCCESS) {
- TEST_FAIL("Could not initialize Crypto.");
- return;
- }
-
- TEST_LOG("Test to show what happens when you 'read' a non-existent asset");
-
-
- /* PSA calls to test: */
- sst_status = psa_ps_get\(\d+, 0, \d+, napoleon_act_data
- &napoleon_act_length);
- if (sst_status != PSA_ERROR_DOES_NOT_EXIST) {
- TEST_FAIL("psa_ps_get() expected PSA_ERROR_DOES_NOT_EXIST.");
- return;
- }
- /* Check that the data is correct */
- if \(tfm_memcmp\(napoleon_act_data, napoleon_exp_data,
- napoleon_act_length\) != 0\) {
- TEST_FAIL("Read data should be equal to result data");
- return;
- }
-
-
- /* Removing assets left over from testing: */
-
- /* Test completed */
- ret->val = TEST_PASSED;
-}
diff --git a/tools/tf_fuzz/regression/000010_read_nonexistent_sst_check_string/template b/tools/tf_fuzz/regression/000010_read_nonexistent_sst_check_string/template
deleted file mode 100644
index 3e70099ac..000000000
--- a/tools/tf_fuzz/regression/000010_read_nonexistent_sst_check_string/template
+++ /dev/null
@@ -1,2 +0,0 @@
-purpose to show what happens when you 'read' a non-existent asset;
-read sst name napoleon check "this won't work";
diff --git a/tools/tf_fuzz/regression/000011_read_nonexistent_sst_check_string_expect_pass/check.py b/tools/tf_fuzz/regression/000011_read_nonexistent_sst_check_string_expect_pass/check.py
deleted file mode 100644
index 1bc5cbe74..000000000
--- a/tools/tf_fuzz/regression/000011_read_nonexistent_sst_check_string_expect_pass/check.py
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-'''
- Please read .../tf_fuzz/regression/README to understand this code.
-
- Please also read the comments in .../tf_fuzz/regression/regress_lib/line_by_line.py.
-'''
-
-import sys, os, re, string, pdb
-sys.path.append ("../regress_lib")
-import line_by_line
-
-
-# Describe script usage:
-def usage():
- print ('''
- Command-line parameters:
- 1. The test-template file, nominally named "template",
- 2. The expected combined stdout/stderr output, nominally named "exp_stdout_stderr",
- 3. The actual/generated combined stdout/stderr output, nominally named "stdout_stderr",
- 4. The expected .c test file, nominally named "exp_test.c", and
- 5. The actual, generated .c test file, nominally named "test.c".
-
- Optionally, *before* these five arguments, you may add switches thus:
- "--v" for verbose mode, to view line-by-line comparisons actual vs. expected,
- "--q" to only print error messages and a successful-completion message,
- "--qq" same as --q but not even printing out the completion message, and
- "--s 12345" to run TF-Fuzz with seed value 12345 (or whatever).
- ''')
-
-
-def main():
- # See if we're supposed to be quiet:
- loud = quiet = ultra_quiet = False
- seed = ""
- while sys.argv[1][0] == "-":
- if sys.argv[1] == "--v":
- loud = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--q":
- quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--qq":
- quiet = ultra_quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--s":
- sys.argv.pop(1)
- seed = sys.argv[1]
- sys.argv.pop(1)
- if not seed.isnumeric():
- print ('The --s seed argument was not a number.')
- usage()
- sys.exit(1)
-
- # Run TF-Fuzz:
- if not quiet: print ("Running TF-Fuzz... ")
- os.system ('rm -f stdout_stderr test.c')
- command = '../../tfz -v ./' + sys.argv[1] + ' ./' + sys.argv[5]
- command += ' ' + seed + ' >' + sys.argv[3] + ' 2>&1'
- if loud:
- print (command)
- if os.system (command) == 0:
- if not quiet: print ("TF-Fuzz run complete.")
- else:
- print ('Could not run TF-Fuzz; please see stdout_stderr file.')
- sys.exit(2)
-
- # Attempt to open files indicated on command line:
- if len(sys.argv) != 6:
- message = '{} requires 5 command-line arguments. Exiting.'
- print (message.format(sys.argv[0]), file=sys.stderr)
- usage()
- sys.exit(3)
- template_file_name = sys.argv[1]
- exp_stdout_file_name = sys.argv[2]
- act_stdout_file_name = sys.argv[3]
- exp_test_file_name = sys.argv[4]
- act_test_file_name = sys.argv[5]
-
- try:
- template_file = open (template_file_name, 'rt')
- exp_stdout_file = open (exp_stdout_file_name, 'rt')
- act_stdout_file = open (act_stdout_file_name, 'rt')
- exp_test_file = open (exp_test_file_name, 'rt')
- act_test_file = open (act_test_file_name, 'rt')
- except FileNotFoundError:
- print ('One or more files could not be found.')
- usage();
- sys.exit(4)
- except:
- print ('Something went wrong trying to open the input files.')
- usage();
- sys.exit(5)
- else:
- message = '\nInput files:\n {},\n {},\n {},\n'
- message += ' {}, and\n {}\nopened successfully.\n'
- if not quiet:
- print (message.format (template_file_name, exp_stdout_file_name,
- act_stdout_file_name, exp_test_file_name, act_test_file_name))
-
- # Check it all:
- if not quiet: print ("\nChecking test C file: ", end="")
- line_by_line.check_file ( exp_test_file, exp_test_file_name,
- act_test_file, act_test_file_name,
- loud, quiet, ultra_quiet )
- if not quiet: print ("Checking stdout and stderr: ", end="")
- line_by_line.check_file ( exp_stdout_file, exp_stdout_file_name,
- act_stdout_file, act_stdout_file_name,
- loud, quiet, ultra_quiet )
-
- # Ran to completion normally, so pass:
- if not ultra_quiet: print ("Regression test passed.")
- sys.exit(0)
-
-if __name__ == "__main__": main()
diff --git a/tools/tf_fuzz/regression/000011_read_nonexistent_sst_check_string_expect_pass/exp_stdout_stderr b/tools/tf_fuzz/regression/000011_read_nonexistent_sst_check_string_expect_pass/exp_stdout_stderr
deleted file mode 100644
index 2a7d593a5..000000000
--- a/tools/tf_fuzz/regression/000011_read_nonexistent_sst_check_string_expect_pass/exp_stdout_stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-Trusted Firmware Fuzzer (TF-Fuzz) starting...
-
-Info: random seed was not specified.
-
-Using seed value of \d+ \(0x[a-f\d]+\).
-Purpose line: to illustrate that you can override TF-Fuzz's expected result
-ASSET_IDENTIFIER: "napoleon"
-Asset identifier list: "chk"
-LITERAL string: "this won't work"
-Read check against literal: "this won't work"
-SST-read arguments: expect"
-Read SST command: "expect"
-Appended to end of call sequence: SST-get call.
-Read command: "expect"
-Expect pass clause: "pass"
-Command with expect: ";"
-Lines: Line number 3.
-Lines: Line number 3.
-Call sequence generated.
-Simulating call sequence...
-Call sequence:
- SST-get call for asset napoleon
-Writing test file, ./test.c.
-
-TF-Fuzz test generation complete.
diff --git a/tools/tf_fuzz/regression/000011_read_nonexistent_sst_check_string_expect_pass/exp_test.c b/tools/tf_fuzz/regression/000011_read_nonexistent_sst_check_string_expect_pass/exp_test.c
deleted file mode 100644
index d5d3e4013..000000000
--- a/tools/tf_fuzz/regression/000011_read_nonexistent_sst_check_string_expect_pass/exp_test.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Test purpose:
- * to illustrate that you can override TF-Fuzz's expected result
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <string.h>
-#include <stdint.h>
-
-#include "../sst/non_secure/ns_test_helpers.h"
-#include "psa/protected_storage.h"
-#include "test/framework/test_framework_helpers.h"
-#include "tfm_memory_utils.h"
-#include "psa/crypto.h"
-#include "psa/crypto_sizes.h"
-
-/* This is not yet right for how to run a test; need to register tests, etc. */
-
-void test_thread (struct test_result_t *ret) {
- psa_status_t crypto_status; /* result from Crypto calls */
- psa_status_t sst_status;
- /* Variables (etc.) to initialize and check PSA assets: */
- static uint8_t napoleon_exp_data[] = "this won't work";
- static uint8_t napoleon_act_data\[2048\] = "[A-Z][a-z ]*[\.\?\!]";
- static size_t napoleon_act_length = \d+;
- (void)sst_status;
- /* "void" to prevent unused-variable warning, since the variable may not
- * be used in this particular test case.
- */
-
- crypto_status = psa_crypto_init();
- if (crypto_status != PSA_SUCCESS) {
- TEST_FAIL("Could not initialize Crypto.");
- return;
- }
-
- TEST_LOG("Test to illustrate that you can override TF-Fuzz's expected result");
-
-
- /* PSA calls to test: */
- sst_status = psa_ps_get\(\d+, 0, @@@001@@@, napoleon_act_data,
- &napoleon_act_length);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_get() expected PSA_SUCCESS.");
- return;
- }
- /* Check that the data is correct */
- if \(tfm_memcmp\(napoleon_act_data, napoleon_exp_data,
- napoleon_act_length\) != 0\) \{
- TEST_FAIL("Read data should be equal to result data");
- return;
- }
-
-
- /* Removing assets left over from testing: */
-
- /* Test completed */
- ret->val = TEST_PASSED;
-}
diff --git a/tools/tf_fuzz/regression/000011_read_nonexistent_sst_check_string_expect_pass/template b/tools/tf_fuzz/regression/000011_read_nonexistent_sst_check_string_expect_pass/template
deleted file mode 100644
index 6372bad68..000000000
--- a/tools/tf_fuzz/regression/000011_read_nonexistent_sst_check_string_expect_pass/template
+++ /dev/null
@@ -1,2 +0,0 @@
-purpose to illustrate that you can override TF-Fuzz's expected result;
-read sst name napoleon chk "this won't work" expect pass;
diff --git a/tools/tf_fuzz/regression/000012_read_nonexistent_sst_check_string_expect_other/check.py b/tools/tf_fuzz/regression/000012_read_nonexistent_sst_check_string_expect_other/check.py
deleted file mode 100644
index 1bc5cbe74..000000000
--- a/tools/tf_fuzz/regression/000012_read_nonexistent_sst_check_string_expect_other/check.py
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-'''
- Please read .../tf_fuzz/regression/README to understand this code.
-
- Please also read the comments in .../tf_fuzz/regression/regress_lib/line_by_line.py.
-'''
-
-import sys, os, re, string, pdb
-sys.path.append ("../regress_lib")
-import line_by_line
-
-
-# Describe script usage:
-def usage():
- print ('''
- Command-line parameters:
- 1. The test-template file, nominally named "template",
- 2. The expected combined stdout/stderr output, nominally named "exp_stdout_stderr",
- 3. The actual/generated combined stdout/stderr output, nominally named "stdout_stderr",
- 4. The expected .c test file, nominally named "exp_test.c", and
- 5. The actual, generated .c test file, nominally named "test.c".
-
- Optionally, *before* these five arguments, you may add switches thus:
- "--v" for verbose mode, to view line-by-line comparisons actual vs. expected,
- "--q" to only print error messages and a successful-completion message,
- "--qq" same as --q but not even printing out the completion message, and
- "--s 12345" to run TF-Fuzz with seed value 12345 (or whatever).
- ''')
-
-
-def main():
- # See if we're supposed to be quiet:
- loud = quiet = ultra_quiet = False
- seed = ""
- while sys.argv[1][0] == "-":
- if sys.argv[1] == "--v":
- loud = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--q":
- quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--qq":
- quiet = ultra_quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--s":
- sys.argv.pop(1)
- seed = sys.argv[1]
- sys.argv.pop(1)
- if not seed.isnumeric():
- print ('The --s seed argument was not a number.')
- usage()
- sys.exit(1)
-
- # Run TF-Fuzz:
- if not quiet: print ("Running TF-Fuzz... ")
- os.system ('rm -f stdout_stderr test.c')
- command = '../../tfz -v ./' + sys.argv[1] + ' ./' + sys.argv[5]
- command += ' ' + seed + ' >' + sys.argv[3] + ' 2>&1'
- if loud:
- print (command)
- if os.system (command) == 0:
- if not quiet: print ("TF-Fuzz run complete.")
- else:
- print ('Could not run TF-Fuzz; please see stdout_stderr file.')
- sys.exit(2)
-
- # Attempt to open files indicated on command line:
- if len(sys.argv) != 6:
- message = '{} requires 5 command-line arguments. Exiting.'
- print (message.format(sys.argv[0]), file=sys.stderr)
- usage()
- sys.exit(3)
- template_file_name = sys.argv[1]
- exp_stdout_file_name = sys.argv[2]
- act_stdout_file_name = sys.argv[3]
- exp_test_file_name = sys.argv[4]
- act_test_file_name = sys.argv[5]
-
- try:
- template_file = open (template_file_name, 'rt')
- exp_stdout_file = open (exp_stdout_file_name, 'rt')
- act_stdout_file = open (act_stdout_file_name, 'rt')
- exp_test_file = open (exp_test_file_name, 'rt')
- act_test_file = open (act_test_file_name, 'rt')
- except FileNotFoundError:
- print ('One or more files could not be found.')
- usage();
- sys.exit(4)
- except:
- print ('Something went wrong trying to open the input files.')
- usage();
- sys.exit(5)
- else:
- message = '\nInput files:\n {},\n {},\n {},\n'
- message += ' {}, and\n {}\nopened successfully.\n'
- if not quiet:
- print (message.format (template_file_name, exp_stdout_file_name,
- act_stdout_file_name, exp_test_file_name, act_test_file_name))
-
- # Check it all:
- if not quiet: print ("\nChecking test C file: ", end="")
- line_by_line.check_file ( exp_test_file, exp_test_file_name,
- act_test_file, act_test_file_name,
- loud, quiet, ultra_quiet )
- if not quiet: print ("Checking stdout and stderr: ", end="")
- line_by_line.check_file ( exp_stdout_file, exp_stdout_file_name,
- act_stdout_file, act_stdout_file_name,
- loud, quiet, ultra_quiet )
-
- # Ran to completion normally, so pass:
- if not ultra_quiet: print ("Regression test passed.")
- sys.exit(0)
-
-if __name__ == "__main__": main()
diff --git a/tools/tf_fuzz/regression/000012_read_nonexistent_sst_check_string_expect_other/exp_stdout_stderr b/tools/tf_fuzz/regression/000012_read_nonexistent_sst_check_string_expect_other/exp_stdout_stderr
deleted file mode 100644
index 44bc211a2..000000000
--- a/tools/tf_fuzz/regression/000012_read_nonexistent_sst_check_string_expect_other/exp_stdout_stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-Trusted Firmware Fuzzer (TF-Fuzz) starting...
-
-Info: random seed was not specified.
-
-Using seed value of \d+ \(0x[a-f\d]+\).
-Purpose line: to more-specifically override TF-Fuzz's expected result
-ASSET_IDENTIFIER: "napoleon"
-Asset identifier list: "check"
-LITERAL string: "this won't work"
-Read check against literal: "this won't work"
-SST-read arguments: expect"
-Read SST command: "expect"
-Appended to end of call sequence: SST-get call.
-Read command: "expect"
-IDENTIFIER: "PSA_ERROR_GENERIC_ERROR"
-Expect error clause: "PSA_ERROR_GENERIC_ERROR"
-Command with expect: ";"
-Lines: Line number 3.
-Lines: Line number 3.
-Call sequence generated.
-Simulating call sequence...
-Call sequence:
- SST-get call for asset napoleon
-Writing test file, ./test.c.
-
-TF-Fuzz test generation complete.
diff --git a/tools/tf_fuzz/regression/000012_read_nonexistent_sst_check_string_expect_other/exp_test.c b/tools/tf_fuzz/regression/000012_read_nonexistent_sst_check_string_expect_other/exp_test.c
deleted file mode 100644
index 359dd8aa7..000000000
--- a/tools/tf_fuzz/regression/000012_read_nonexistent_sst_check_string_expect_other/exp_test.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Test purpose:
- * to more-specifically override TF-Fuzz's expected result
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <string.h>
-#include <stdint.h>
-
-#include "../sst/non_secure/ns_test_helpers.h"
-#include "psa/protected_storage.h"
-#include "test/framework/test_framework_helpers.h"
-#include "tfm_memory_utils.h"
-#include "psa/crypto.h"
-#include "psa/crypto_sizes.h"
-
-/* This is not yet right for how to run a test; need to register tests, etc. */
-
-void test_thread (struct test_result_t *ret) {
- psa_status_t crypto_status; /* result from Crypto calls */
- psa_status_t sst_status;
- /* Variables (etc.) to initialize and check PSA assets: */
- static uint8_t napoleon_exp_data[] = "this won't work";
- static uint8_t napoleon_act_data\[2048\] = "[A-Z][a-z ]*[\.\?\!]";
- static size_t napoleon_act_length = \d+;
- (void)sst_status;
- /* "void" to prevent unused-variable warning, since the variable may not
- * be used in this particular test case.
- */
-
- crypto_status = psa_crypto_init();
- if (crypto_status != PSA_SUCCESS) {
- TEST_FAIL("Could not initialize Crypto.");
- return;
- }
-
- TEST_LOG("Test to more-specifically override TF-Fuzz's expected result");
-
-
- /* PSA calls to test: */
- sst_status = psa_ps_get\(\d+, 0, @@@001@@@, napoleon_act_data,
- &napoleon_act_length);
- if (sst_status != PSA_ERROR_GENERIC_ERROR) {
- TEST_FAIL("psa_ps_get() expected PSA_ERROR_GENERIC_ERROR.");
- return;
- }
- /* Check that the data is correct */
- if \(tfm_memcmp\(napoleon_act_data, napoleon_exp_data,
- napoleon_act_length\) != 0\) \{
- TEST_FAIL("Read data should be equal to result data");
- return;
- }
-
-
- /* Removing assets left over from testing: */
-
- /* Test completed */
- ret->val = TEST_PASSED;
-}
diff --git a/tools/tf_fuzz/regression/000012_read_nonexistent_sst_check_string_expect_other/template b/tools/tf_fuzz/regression/000012_read_nonexistent_sst_check_string_expect_other/template
deleted file mode 100644
index c7825c5c7..000000000
--- a/tools/tf_fuzz/regression/000012_read_nonexistent_sst_check_string_expect_other/template
+++ /dev/null
@@ -1,2 +0,0 @@
-purpose to more-specifically override TF-Fuzz's expected result;
-read sst name napoleon check "this won't work" expect PSA_ERROR_GENERIC_ERROR;
diff --git a/tools/tf_fuzz/regression/000013_set_sst_name_rand_data_remove_twice/check.py b/tools/tf_fuzz/regression/000013_set_sst_name_rand_data_remove_twice/check.py
deleted file mode 100644
index 1bc5cbe74..000000000
--- a/tools/tf_fuzz/regression/000013_set_sst_name_rand_data_remove_twice/check.py
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-'''
- Please read .../tf_fuzz/regression/README to understand this code.
-
- Please also read the comments in .../tf_fuzz/regression/regress_lib/line_by_line.py.
-'''
-
-import sys, os, re, string, pdb
-sys.path.append ("../regress_lib")
-import line_by_line
-
-
-# Describe script usage:
-def usage():
- print ('''
- Command-line parameters:
- 1. The test-template file, nominally named "template",
- 2. The expected combined stdout/stderr output, nominally named "exp_stdout_stderr",
- 3. The actual/generated combined stdout/stderr output, nominally named "stdout_stderr",
- 4. The expected .c test file, nominally named "exp_test.c", and
- 5. The actual, generated .c test file, nominally named "test.c".
-
- Optionally, *before* these five arguments, you may add switches thus:
- "--v" for verbose mode, to view line-by-line comparisons actual vs. expected,
- "--q" to only print error messages and a successful-completion message,
- "--qq" same as --q but not even printing out the completion message, and
- "--s 12345" to run TF-Fuzz with seed value 12345 (or whatever).
- ''')
-
-
-def main():
- # See if we're supposed to be quiet:
- loud = quiet = ultra_quiet = False
- seed = ""
- while sys.argv[1][0] == "-":
- if sys.argv[1] == "--v":
- loud = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--q":
- quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--qq":
- quiet = ultra_quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--s":
- sys.argv.pop(1)
- seed = sys.argv[1]
- sys.argv.pop(1)
- if not seed.isnumeric():
- print ('The --s seed argument was not a number.')
- usage()
- sys.exit(1)
-
- # Run TF-Fuzz:
- if not quiet: print ("Running TF-Fuzz... ")
- os.system ('rm -f stdout_stderr test.c')
- command = '../../tfz -v ./' + sys.argv[1] + ' ./' + sys.argv[5]
- command += ' ' + seed + ' >' + sys.argv[3] + ' 2>&1'
- if loud:
- print (command)
- if os.system (command) == 0:
- if not quiet: print ("TF-Fuzz run complete.")
- else:
- print ('Could not run TF-Fuzz; please see stdout_stderr file.')
- sys.exit(2)
-
- # Attempt to open files indicated on command line:
- if len(sys.argv) != 6:
- message = '{} requires 5 command-line arguments. Exiting.'
- print (message.format(sys.argv[0]), file=sys.stderr)
- usage()
- sys.exit(3)
- template_file_name = sys.argv[1]
- exp_stdout_file_name = sys.argv[2]
- act_stdout_file_name = sys.argv[3]
- exp_test_file_name = sys.argv[4]
- act_test_file_name = sys.argv[5]
-
- try:
- template_file = open (template_file_name, 'rt')
- exp_stdout_file = open (exp_stdout_file_name, 'rt')
- act_stdout_file = open (act_stdout_file_name, 'rt')
- exp_test_file = open (exp_test_file_name, 'rt')
- act_test_file = open (act_test_file_name, 'rt')
- except FileNotFoundError:
- print ('One or more files could not be found.')
- usage();
- sys.exit(4)
- except:
- print ('Something went wrong trying to open the input files.')
- usage();
- sys.exit(5)
- else:
- message = '\nInput files:\n {},\n {},\n {},\n'
- message += ' {}, and\n {}\nopened successfully.\n'
- if not quiet:
- print (message.format (template_file_name, exp_stdout_file_name,
- act_stdout_file_name, exp_test_file_name, act_test_file_name))
-
- # Check it all:
- if not quiet: print ("\nChecking test C file: ", end="")
- line_by_line.check_file ( exp_test_file, exp_test_file_name,
- act_test_file, act_test_file_name,
- loud, quiet, ultra_quiet )
- if not quiet: print ("Checking stdout and stderr: ", end="")
- line_by_line.check_file ( exp_stdout_file, exp_stdout_file_name,
- act_stdout_file, act_stdout_file_name,
- loud, quiet, ultra_quiet )
-
- # Ran to completion normally, so pass:
- if not ultra_quiet: print ("Regression test passed.")
- sys.exit(0)
-
-if __name__ == "__main__": main()
diff --git a/tools/tf_fuzz/regression/000013_set_sst_name_rand_data_remove_twice/exp_stdout_stderr b/tools/tf_fuzz/regression/000013_set_sst_name_rand_data_remove_twice/exp_stdout_stderr
deleted file mode 100644
index f10b04dcb..000000000
--- a/tools/tf_fuzz/regression/000013_set_sst_name_rand_data_remove_twice/exp_stdout_stderr
+++ /dev/null
@@ -1,38 +0,0 @@
-Trusted Firmware Fuzzer (TF-Fuzz) starting...
-
-Info: random seed was not specified.
-
-Using seed value of \d+ \(0x[a-f\d]+\).
-Purpose line: to illustrate deleting assets
-ASSET_IDENTIFIER: "george"
-Asset identifier list: "data"
-Create from random data
-Set SST command: ";"
-Appended to end of call sequence: SST-set call.
-Set command: ";"
-Command with no expect: ";"
-ASSET_IDENTIFIER: "george"
-Asset identifier list: ";"
-Remove SST command: ";"
-Appended to end of call sequence: SST-remove call.
-Remove command: ";"
-Command with no expect: ";"
-ASSET_IDENTIFIER: "george"
-Asset identifier list: ";"
-Remove SST command: ";"
-Appended to end of call sequence: SST-remove call.
-Remove command: ";"
-Command with no expect: ";"
-Lines: Line number 5.
-Lines: Line number 5.
-Lines: Line number 5.
-Lines: Line number 5.
-Call sequence generated.
-Simulating call sequence...
-Call sequence:
- SST-set call for asset george
- SST-remove call for asset george
- SST-remove call for asset george
-Writing test file, ./test.c.
-
-TF-Fuzz test generation complete.
diff --git a/tools/tf_fuzz/regression/000013_set_sst_name_rand_data_remove_twice/exp_test.c b/tools/tf_fuzz/regression/000013_set_sst_name_rand_data_remove_twice/exp_test.c
deleted file mode 100644
index efc6bf11c..000000000
--- a/tools/tf_fuzz/regression/000013_set_sst_name_rand_data_remove_twice/exp_test.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Test purpose:
- * to illustrate deleting assets
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <string.h>
-#include <stdint.h>
-
-#include "../sst/non_secure/ns_test_helpers.h"
-#include "psa/protected_storage.h"
-#include "test/framework/test_framework_helpers.h"
-#include "tfm_memory_utils.h"
-#include "psa/crypto.h"
-#include "psa/crypto_sizes.h"
-
-/* This is not yet right for how to run a test; need to register tests, etc. */
-
-void test_thread (struct test_result_t *ret) {
- psa_status_t crypto_status; /* result from Crypto calls */
- psa_status_t sst_status;
- /* Variables (etc.) to initialize and check PSA assets: */
- static uint8_t george_set_data\[\] = "@@002@10@@[a-z\ ]*[\.\?\!]";
- static uint32_t george_set_length = \d+;
- (void)sst_status;
- /* "void" to prevent unused-variable warning, since the variable may not
- * be used in this particular test case.
- */
-
- crypto_status = psa_crypto_init();
- if (crypto_status != PSA_SUCCESS) {
- TEST_FAIL("Could not initialize Crypto.");
- return;
- }
-
- TEST_LOG("Test to illustrate deleting assets");
-
-
- /* PSA calls to test: */
- /\* Creating SST asset "george," with data "@@002@10@@...". \*/
- sst_status = psa_ps_set\(@@@001@@@, george_set_length, george_set_data,
- PSA_STORAGE_FLAG_[A-Z_]+\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- sst_status = psa_ps_remove\(@@@001@@@\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_remove() expected PSA_SUCCESS.");
- return;
- }
- sst_status = psa_ps_remove\(@@@001@@@\);
- if (sst_status != PSA_ERROR_DOES_NOT_EXIST) {
- TEST_FAIL("psa_ps_remove() expected PSA_ERROR_DOES_NOT_EXIST.");
- return;
- }
-
-
- /* Removing assets left over from testing: */
-
- /* Test completed */
- ret->val = TEST_PASSED;
-}
diff --git a/tools/tf_fuzz/regression/000013_set_sst_name_rand_data_remove_twice/template b/tools/tf_fuzz/regression/000013_set_sst_name_rand_data_remove_twice/template
deleted file mode 100644
index 7edb72e5b..000000000
--- a/tools/tf_fuzz/regression/000013_set_sst_name_rand_data_remove_twice/template
+++ /dev/null
@@ -1,4 +0,0 @@
-purpose to illustrate deleting assets;
-set sst name george data *;
-remove sst name george;
-rm sst name george;
diff --git a/tools/tf_fuzz/regression/000014_set_sst_name_rand_data_remove_other/check.py b/tools/tf_fuzz/regression/000014_set_sst_name_rand_data_remove_other/check.py
deleted file mode 100644
index 1bc5cbe74..000000000
--- a/tools/tf_fuzz/regression/000014_set_sst_name_rand_data_remove_other/check.py
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-'''
- Please read .../tf_fuzz/regression/README to understand this code.
-
- Please also read the comments in .../tf_fuzz/regression/regress_lib/line_by_line.py.
-'''
-
-import sys, os, re, string, pdb
-sys.path.append ("../regress_lib")
-import line_by_line
-
-
-# Describe script usage:
-def usage():
- print ('''
- Command-line parameters:
- 1. The test-template file, nominally named "template",
- 2. The expected combined stdout/stderr output, nominally named "exp_stdout_stderr",
- 3. The actual/generated combined stdout/stderr output, nominally named "stdout_stderr",
- 4. The expected .c test file, nominally named "exp_test.c", and
- 5. The actual, generated .c test file, nominally named "test.c".
-
- Optionally, *before* these five arguments, you may add switches thus:
- "--v" for verbose mode, to view line-by-line comparisons actual vs. expected,
- "--q" to only print error messages and a successful-completion message,
- "--qq" same as --q but not even printing out the completion message, and
- "--s 12345" to run TF-Fuzz with seed value 12345 (or whatever).
- ''')
-
-
-def main():
- # See if we're supposed to be quiet:
- loud = quiet = ultra_quiet = False
- seed = ""
- while sys.argv[1][0] == "-":
- if sys.argv[1] == "--v":
- loud = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--q":
- quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--qq":
- quiet = ultra_quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--s":
- sys.argv.pop(1)
- seed = sys.argv[1]
- sys.argv.pop(1)
- if not seed.isnumeric():
- print ('The --s seed argument was not a number.')
- usage()
- sys.exit(1)
-
- # Run TF-Fuzz:
- if not quiet: print ("Running TF-Fuzz... ")
- os.system ('rm -f stdout_stderr test.c')
- command = '../../tfz -v ./' + sys.argv[1] + ' ./' + sys.argv[5]
- command += ' ' + seed + ' >' + sys.argv[3] + ' 2>&1'
- if loud:
- print (command)
- if os.system (command) == 0:
- if not quiet: print ("TF-Fuzz run complete.")
- else:
- print ('Could not run TF-Fuzz; please see stdout_stderr file.')
- sys.exit(2)
-
- # Attempt to open files indicated on command line:
- if len(sys.argv) != 6:
- message = '{} requires 5 command-line arguments. Exiting.'
- print (message.format(sys.argv[0]), file=sys.stderr)
- usage()
- sys.exit(3)
- template_file_name = sys.argv[1]
- exp_stdout_file_name = sys.argv[2]
- act_stdout_file_name = sys.argv[3]
- exp_test_file_name = sys.argv[4]
- act_test_file_name = sys.argv[5]
-
- try:
- template_file = open (template_file_name, 'rt')
- exp_stdout_file = open (exp_stdout_file_name, 'rt')
- act_stdout_file = open (act_stdout_file_name, 'rt')
- exp_test_file = open (exp_test_file_name, 'rt')
- act_test_file = open (act_test_file_name, 'rt')
- except FileNotFoundError:
- print ('One or more files could not be found.')
- usage();
- sys.exit(4)
- except:
- print ('Something went wrong trying to open the input files.')
- usage();
- sys.exit(5)
- else:
- message = '\nInput files:\n {},\n {},\n {},\n'
- message += ' {}, and\n {}\nopened successfully.\n'
- if not quiet:
- print (message.format (template_file_name, exp_stdout_file_name,
- act_stdout_file_name, exp_test_file_name, act_test_file_name))
-
- # Check it all:
- if not quiet: print ("\nChecking test C file: ", end="")
- line_by_line.check_file ( exp_test_file, exp_test_file_name,
- act_test_file, act_test_file_name,
- loud, quiet, ultra_quiet )
- if not quiet: print ("Checking stdout and stderr: ", end="")
- line_by_line.check_file ( exp_stdout_file, exp_stdout_file_name,
- act_stdout_file, act_stdout_file_name,
- loud, quiet, ultra_quiet )
-
- # Ran to completion normally, so pass:
- if not ultra_quiet: print ("Regression test passed.")
- sys.exit(0)
-
-if __name__ == "__main__": main()
diff --git a/tools/tf_fuzz/regression/000014_set_sst_name_rand_data_remove_other/exp_stdout_stderr b/tools/tf_fuzz/regression/000014_set_sst_name_rand_data_remove_other/exp_stdout_stderr
deleted file mode 100644
index 1c447b715..000000000
--- a/tools/tf_fuzz/regression/000014_set_sst_name_rand_data_remove_other/exp_stdout_stderr
+++ /dev/null
@@ -1,30 +0,0 @@
-Trusted Firmware Fuzzer (TF-Fuzz) starting...
-
-Info: random seed was not specified.
-
-Using seed value of \d+ \(0x[a-f\d]+\).
-Purpose line: to remove something that doesn't exist
-ASSET_IDENTIFIER: "george"
-Asset identifier list: "data"
-Create from random data
-Set SST command: ";"
-Appended to end of call sequence: SST-set call.
-Set command: ";"
-Command with no expect: ";"
-ASSET_IDENTIFIER: "ringo"
-Asset identifier list: ";"
-Remove SST command: ";"
-Appended to end of call sequence: SST-remove call.
-Remove command: ";"
-Command with no expect: ";"
-Lines: Line number 4.
-Lines: Line number 4.
-Lines: Line number 4.
-Call sequence generated.
-Simulating call sequence...
-Call sequence:
- SST-set call for asset george
- SST-remove call for asset ringo
-Writing test file, ./test.c.
-
-TF-Fuzz test generation complete.
diff --git a/tools/tf_fuzz/regression/000014_set_sst_name_rand_data_remove_other/exp_test.c b/tools/tf_fuzz/regression/000014_set_sst_name_rand_data_remove_other/exp_test.c
deleted file mode 100644
index 85d51bba5..000000000
--- a/tools/tf_fuzz/regression/000014_set_sst_name_rand_data_remove_other/exp_test.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Test purpose:
- * to remove something that doesn't exist
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <string.h>
-#include <stdint.h>
-
-#include "../sst/non_secure/ns_test_helpers.h"
-#include "psa/protected_storage.h"
-#include "test/framework/test_framework_helpers.h"
-#include "tfm_memory_utils.h"
-#include "psa/crypto.h"
-#include "psa/crypto_sizes.h"
-
-/* This is not yet right for how to run a test; need to register tests, etc. */
-
-void test_thread (struct test_result_t *ret) {
- psa_status_t crypto_status; /* result from Crypto calls */
- psa_status_t sst_status;
- /* Variables (etc.) to initialize and check PSA assets: */
- static uint8_t george_set_data\[\] = "@@002@10@@[a-z\ ]*[\.\?\!]";
- static uint32_t george_set_length = \d+;
- (void)sst_status;
- /* "void" to prevent unused-variable warning, since the variable may not
- * be used in this particular test case.
- */
-
- crypto_status = psa_crypto_init();
- if (crypto_status != PSA_SUCCESS) {
- TEST_FAIL("Could not initialize Crypto.");
- return;
- }
-
- TEST_LOG("Test to remove something that doesn't exist");
-
-
- /* PSA calls to test: */
- /\* Creating SST asset "george," with data "@@002@10@@...". \*/
- sst_status = psa_ps_set\(@@@001@@@, george_set_length, george_set_data,
- PSA_STORAGE_FLAG_[A-Z_]+\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- sst_status = psa_ps_remove\(\d+\);
- if (sst_status != PSA_ERROR_DOES_NOT_EXIST) {
- TEST_FAIL("psa_ps_remove() expected PSA_ERROR_DOES_NOT_EXIST.");
- return;
- }
-
-
- /* Removing assets left over from testing: */
- psa_ps_remove\(@@@001@@@\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
-
- /* Test completed */
- ret->val = TEST_PASSED;
-}
diff --git a/tools/tf_fuzz/regression/000014_set_sst_name_rand_data_remove_other/template b/tools/tf_fuzz/regression/000014_set_sst_name_rand_data_remove_other/template
deleted file mode 100644
index 5b9485ca0..000000000
--- a/tools/tf_fuzz/regression/000014_set_sst_name_rand_data_remove_other/template
+++ /dev/null
@@ -1,3 +0,0 @@
-purpose to remove something that doesn't exist;
-set sst name george data *;
-remove sst name ringo;
diff --git a/tools/tf_fuzz/regression/000015_set_sst_name_only/check.py b/tools/tf_fuzz/regression/000015_set_sst_name_only/check.py
deleted file mode 100644
index 1bc5cbe74..000000000
--- a/tools/tf_fuzz/regression/000015_set_sst_name_only/check.py
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-'''
- Please read .../tf_fuzz/regression/README to understand this code.
-
- Please also read the comments in .../tf_fuzz/regression/regress_lib/line_by_line.py.
-'''
-
-import sys, os, re, string, pdb
-sys.path.append ("../regress_lib")
-import line_by_line
-
-
-# Describe script usage:
-def usage():
- print ('''
- Command-line parameters:
- 1. The test-template file, nominally named "template",
- 2. The expected combined stdout/stderr output, nominally named "exp_stdout_stderr",
- 3. The actual/generated combined stdout/stderr output, nominally named "stdout_stderr",
- 4. The expected .c test file, nominally named "exp_test.c", and
- 5. The actual, generated .c test file, nominally named "test.c".
-
- Optionally, *before* these five arguments, you may add switches thus:
- "--v" for verbose mode, to view line-by-line comparisons actual vs. expected,
- "--q" to only print error messages and a successful-completion message,
- "--qq" same as --q but not even printing out the completion message, and
- "--s 12345" to run TF-Fuzz with seed value 12345 (or whatever).
- ''')
-
-
-def main():
- # See if we're supposed to be quiet:
- loud = quiet = ultra_quiet = False
- seed = ""
- while sys.argv[1][0] == "-":
- if sys.argv[1] == "--v":
- loud = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--q":
- quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--qq":
- quiet = ultra_quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--s":
- sys.argv.pop(1)
- seed = sys.argv[1]
- sys.argv.pop(1)
- if not seed.isnumeric():
- print ('The --s seed argument was not a number.')
- usage()
- sys.exit(1)
-
- # Run TF-Fuzz:
- if not quiet: print ("Running TF-Fuzz... ")
- os.system ('rm -f stdout_stderr test.c')
- command = '../../tfz -v ./' + sys.argv[1] + ' ./' + sys.argv[5]
- command += ' ' + seed + ' >' + sys.argv[3] + ' 2>&1'
- if loud:
- print (command)
- if os.system (command) == 0:
- if not quiet: print ("TF-Fuzz run complete.")
- else:
- print ('Could not run TF-Fuzz; please see stdout_stderr file.')
- sys.exit(2)
-
- # Attempt to open files indicated on command line:
- if len(sys.argv) != 6:
- message = '{} requires 5 command-line arguments. Exiting.'
- print (message.format(sys.argv[0]), file=sys.stderr)
- usage()
- sys.exit(3)
- template_file_name = sys.argv[1]
- exp_stdout_file_name = sys.argv[2]
- act_stdout_file_name = sys.argv[3]
- exp_test_file_name = sys.argv[4]
- act_test_file_name = sys.argv[5]
-
- try:
- template_file = open (template_file_name, 'rt')
- exp_stdout_file = open (exp_stdout_file_name, 'rt')
- act_stdout_file = open (act_stdout_file_name, 'rt')
- exp_test_file = open (exp_test_file_name, 'rt')
- act_test_file = open (act_test_file_name, 'rt')
- except FileNotFoundError:
- print ('One or more files could not be found.')
- usage();
- sys.exit(4)
- except:
- print ('Something went wrong trying to open the input files.')
- usage();
- sys.exit(5)
- else:
- message = '\nInput files:\n {},\n {},\n {},\n'
- message += ' {}, and\n {}\nopened successfully.\n'
- if not quiet:
- print (message.format (template_file_name, exp_stdout_file_name,
- act_stdout_file_name, exp_test_file_name, act_test_file_name))
-
- # Check it all:
- if not quiet: print ("\nChecking test C file: ", end="")
- line_by_line.check_file ( exp_test_file, exp_test_file_name,
- act_test_file, act_test_file_name,
- loud, quiet, ultra_quiet )
- if not quiet: print ("Checking stdout and stderr: ", end="")
- line_by_line.check_file ( exp_stdout_file, exp_stdout_file_name,
- act_stdout_file, act_stdout_file_name,
- loud, quiet, ultra_quiet )
-
- # Ran to completion normally, so pass:
- if not ultra_quiet: print ("Regression test passed.")
- sys.exit(0)
-
-if __name__ == "__main__": main()
diff --git a/tools/tf_fuzz/regression/000015_set_sst_name_only/exp_stdout_stderr b/tools/tf_fuzz/regression/000015_set_sst_name_only/exp_stdout_stderr
deleted file mode 100644
index 318a12590..000000000
--- a/tools/tf_fuzz/regression/000015_set_sst_name_only/exp_stdout_stderr
+++ /dev/null
@@ -1,30 +0,0 @@
-Trusted Firmware Fuzzer (TF-Fuzz) starting...
-
-Info: random seed was not specified.
-
-Using seed value of \d+ \(0x[a-f\d]+\).
-Purpose line: to show that if you don't have say anything about data to randomize it
-ASSET_IDENTIFIER: "random"
-Asset identifier list: ";"
-SST-create from random data (no 'data *')
-Set SST command: ";"
-Appended to end of call sequence: SST-set call.
-Set command: ";"
-Command with no expect: ";"
-Asset random identifier: "*"
-SST-create from random data (no 'data *')
-Set SST command: ";"
-Appended to end of call sequence: SST-set call.
-Set command: ";"
-Command with no expect: ";"
-Lines: Line number 4.
-Lines: Line number 4.
-Lines: Line number 4.
-Call sequence generated.
-Simulating call sequence...
-Call sequence:
- SST-set call for asset random
- SST-set call for asset [a-z]+
-Writing test file, ./test.c.
-
-TF-Fuzz test generation complete.
diff --git a/tools/tf_fuzz/regression/000015_set_sst_name_only/exp_test.c b/tools/tf_fuzz/regression/000015_set_sst_name_only/exp_test.c
deleted file mode 100644
index 900d9e286..000000000
--- a/tools/tf_fuzz/regression/000015_set_sst_name_only/exp_test.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Test purpose:
- * to show that if you don't have say anything about data to randomize it
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <string.h>
-#include <stdint.h>
-
-#include "../sst/non_secure/ns_test_helpers.h"
-#include "psa/protected_storage.h"
-#include "test/framework/test_framework_helpers.h"
-#include "tfm_memory_utils.h"
-#include "psa/crypto.h"
-#include "psa/crypto_sizes.h"
-
-/* This is not yet right for how to run a test; need to register tests, etc. */
-
-void test_thread (struct test_result_t *ret) {
- psa_status_t crypto_status; /* result from Crypto calls */
- psa_status_t sst_status;
- /* Variables (etc.) to initialize and check PSA assets: */
- static uint8_t random_set_data\[\] = "@@002@10@@[a-z\ ]*[\.\?\!]";
- static uint32_t random_set_length = \d+;
- static uint8_t @@@003@@@_set_data\[\] = "@@004@10@@[a-z\ ]*[\.\?\!]";
- static uint32_t @@@003@@@_set_length = \d+;
- (void)sst_status;
- /* "void" to prevent unused-variable warning, since the variable may not
- * be used in this particular test case.
- */
-
- crypto_status = psa_crypto_init();
- if (crypto_status != PSA_SUCCESS) {
- TEST_FAIL("Could not initialize Crypto.");
- return;
- }
-
- TEST_LOG("Test to show that if you don't have say anything about data to randomize it");
-
-
- /* PSA calls to test: */
- /\* Creating SST asset "random," with data "@@002@10@@...". \*/
- sst_status = psa_ps_set\(@@@001@@@, random_set_length, random_set_data,
- PSA_STORAGE_FLAG_[A-Z_]+\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- /\* Creating SST asset "@@@003@@@," with data "@@004@10@@...". \*/
- sst_status = psa_ps_set\(@@@004@@@, @@@003@@@_set_length, @@@003@@@_set_data,
- PSA_STORAGE_FLAG_[A-Z_]+\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
-
-
- /* Removing assets left over from testing: */
- psa_ps_remove\(@@@001@@@\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
- psa_ps_remove\(@@@004@@@\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
-
- /* Test completed */
- ret->val = TEST_PASSED;
-}
diff --git a/tools/tf_fuzz/regression/000015_set_sst_name_only/template b/tools/tf_fuzz/regression/000015_set_sst_name_only/template
deleted file mode 100644
index 63220dbd5..000000000
--- a/tools/tf_fuzz/regression/000015_set_sst_name_only/template
+++ /dev/null
@@ -1,3 +0,0 @@
-purpose to show that if you don't have say anything about data to randomize it;
-set sst name random;
-set sst name *;
diff --git a/tools/tf_fuzz/regression/000016_set_sst_single_asset_set_multiple_times/check.py b/tools/tf_fuzz/regression/000016_set_sst_single_asset_set_multiple_times/check.py
deleted file mode 100644
index 1bc5cbe74..000000000
--- a/tools/tf_fuzz/regression/000016_set_sst_single_asset_set_multiple_times/check.py
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-'''
- Please read .../tf_fuzz/regression/README to understand this code.
-
- Please also read the comments in .../tf_fuzz/regression/regress_lib/line_by_line.py.
-'''
-
-import sys, os, re, string, pdb
-sys.path.append ("../regress_lib")
-import line_by_line
-
-
-# Describe script usage:
-def usage():
- print ('''
- Command-line parameters:
- 1. The test-template file, nominally named "template",
- 2. The expected combined stdout/stderr output, nominally named "exp_stdout_stderr",
- 3. The actual/generated combined stdout/stderr output, nominally named "stdout_stderr",
- 4. The expected .c test file, nominally named "exp_test.c", and
- 5. The actual, generated .c test file, nominally named "test.c".
-
- Optionally, *before* these five arguments, you may add switches thus:
- "--v" for verbose mode, to view line-by-line comparisons actual vs. expected,
- "--q" to only print error messages and a successful-completion message,
- "--qq" same as --q but not even printing out the completion message, and
- "--s 12345" to run TF-Fuzz with seed value 12345 (or whatever).
- ''')
-
-
-def main():
- # See if we're supposed to be quiet:
- loud = quiet = ultra_quiet = False
- seed = ""
- while sys.argv[1][0] == "-":
- if sys.argv[1] == "--v":
- loud = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--q":
- quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--qq":
- quiet = ultra_quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--s":
- sys.argv.pop(1)
- seed = sys.argv[1]
- sys.argv.pop(1)
- if not seed.isnumeric():
- print ('The --s seed argument was not a number.')
- usage()
- sys.exit(1)
-
- # Run TF-Fuzz:
- if not quiet: print ("Running TF-Fuzz... ")
- os.system ('rm -f stdout_stderr test.c')
- command = '../../tfz -v ./' + sys.argv[1] + ' ./' + sys.argv[5]
- command += ' ' + seed + ' >' + sys.argv[3] + ' 2>&1'
- if loud:
- print (command)
- if os.system (command) == 0:
- if not quiet: print ("TF-Fuzz run complete.")
- else:
- print ('Could not run TF-Fuzz; please see stdout_stderr file.')
- sys.exit(2)
-
- # Attempt to open files indicated on command line:
- if len(sys.argv) != 6:
- message = '{} requires 5 command-line arguments. Exiting.'
- print (message.format(sys.argv[0]), file=sys.stderr)
- usage()
- sys.exit(3)
- template_file_name = sys.argv[1]
- exp_stdout_file_name = sys.argv[2]
- act_stdout_file_name = sys.argv[3]
- exp_test_file_name = sys.argv[4]
- act_test_file_name = sys.argv[5]
-
- try:
- template_file = open (template_file_name, 'rt')
- exp_stdout_file = open (exp_stdout_file_name, 'rt')
- act_stdout_file = open (act_stdout_file_name, 'rt')
- exp_test_file = open (exp_test_file_name, 'rt')
- act_test_file = open (act_test_file_name, 'rt')
- except FileNotFoundError:
- print ('One or more files could not be found.')
- usage();
- sys.exit(4)
- except:
- print ('Something went wrong trying to open the input files.')
- usage();
- sys.exit(5)
- else:
- message = '\nInput files:\n {},\n {},\n {},\n'
- message += ' {}, and\n {}\nopened successfully.\n'
- if not quiet:
- print (message.format (template_file_name, exp_stdout_file_name,
- act_stdout_file_name, exp_test_file_name, act_test_file_name))
-
- # Check it all:
- if not quiet: print ("\nChecking test C file: ", end="")
- line_by_line.check_file ( exp_test_file, exp_test_file_name,
- act_test_file, act_test_file_name,
- loud, quiet, ultra_quiet )
- if not quiet: print ("Checking stdout and stderr: ", end="")
- line_by_line.check_file ( exp_stdout_file, exp_stdout_file_name,
- act_stdout_file, act_stdout_file_name,
- loud, quiet, ultra_quiet )
-
- # Ran to completion normally, so pass:
- if not ultra_quiet: print ("Regression test passed.")
- sys.exit(0)
-
-if __name__ == "__main__": main()
diff --git a/tools/tf_fuzz/regression/000016_set_sst_single_asset_set_multiple_times/exp_stdout_stderr b/tools/tf_fuzz/regression/000016_set_sst_single_asset_set_multiple_times/exp_stdout_stderr
deleted file mode 100644
index a85de7dfe..000000000
--- a/tools/tf_fuzz/regression/000016_set_sst_single_asset_set_multiple_times/exp_stdout_stderr
+++ /dev/null
@@ -1,66 +0,0 @@
-Trusted Firmware Fuzzer (TF-Fuzz) starting...
-
-Info: random seed was not specified.
-
-Using seed value of \d+ \(0x[a-f\d]+\).
-Purpose line: to assign a sequence of values to a single asset
-ASSET_IDENTIFIER: "indecisive"
-Asset identifier list: "data"
-LITERAL string: "First value"
-Create from literal data: ""First value""
-SST no storage flag: none"
-SST creation flag
-;"
-SST creation flags
-;"
-Set SST command: ";"
-Appended to end of call sequence: SST-set call.
-Set command: ";"
-Command with no expect: ";"
-ASSET_IDENTIFIER: "indecisive"
-Asset identifier list: "data"
-LITERAL string: "Second value"
-Create from literal data: ""Second value""
-Set SST command: ";"
-Appended to end of call sequence: SST-set call.
-Set command: ";"
-Command with no expect: ";"
-ASSET_IDENTIFIER: "indecisive"
-Asset identifier list: "data"
-Create from random data
-Set SST command: ";"
-Appended to end of call sequence: SST-set call.
-Set command: ";"
-Command with no expect: ";"
-ASSET_IDENTIFIER: "indecisive"
-Asset identifier list: "data"
-LITERAL string: "Fourth value"
-Create from literal data: ""Fourth value""
-Set SST command: ";"
-Appended to end of call sequence: SST-set call.
-Set command: ";"
-Command with no expect: ";"
-ASSET_IDENTIFIER: "indecisive"
-Asset identifier list: "data"
-Create from random data
-Set SST command: ";"
-Appended to end of call sequence: SST-set call.
-Set command: ";"
-Command with no expect: ";"
-Lines: Line number 7.
-Lines: Line number 7.
-Lines: Line number 7.
-Lines: Line number 7.
-Lines: Line number 7.
-Lines: Line number 7.
-Call sequence generated.
-Simulating call sequence...
-Call sequence:
- SST-set call for asset indecisive
- SST-set call for asset indecisive
- SST-set call for asset indecisive
- SST-set call for asset indecisive
- SST-set call for asset indecisive
-Writing test file, ./test.c.
-
-TF-Fuzz test generation complete.
diff --git a/tools/tf_fuzz/regression/000016_set_sst_single_asset_set_multiple_times/exp_test.c b/tools/tf_fuzz/regression/000016_set_sst_single_asset_set_multiple_times/exp_test.c
deleted file mode 100644
index 224c85c25..000000000
--- a/tools/tf_fuzz/regression/000016_set_sst_single_asset_set_multiple_times/exp_test.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Test purpose:
- * to assign a sequence of values to a single asset
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <string.h>
-#include <stdint.h>
-
-#include "../sst/non_secure/ns_test_helpers.h"
-#include "psa/protected_storage.h"
-#include "test/framework/test_framework_helpers.h"
-#include "tfm_memory_utils.h"
-#include "psa/crypto.h"
-#include "psa/crypto_sizes.h"
-
-/* This is not yet right for how to run a test; need to register tests, etc. */
-
-void test_thread (struct test_result_t *ret) {
- psa_status_t crypto_status; /* result from Crypto calls */
- psa_status_t sst_status;
- /* Variables (etc.) to initialize and check PSA assets: */
- static uint8_t indecisive_set_data[] = "First value";
- static uint32_t indecisive_set_length = 11;
- static uint8_t indecisive_set_data_1[] = "Second value";
- static uint32_t indecisive_set_length_1 = 12;
- static uint8_t indecisive_set_data_2\[\] = "@@001@10@@[a-z\ ]*[\.\?\!]";
- static uint32_t indecisive_set_length_2 = \d+;
- static uint8_t indecisive_set_data_3[] = "Fourth value";
- static uint32_t indecisive_set_length_3 = 12;
- static uint8_t indecisive_set_data_4\[\] = "@@002@10@@[a-z\ ]*[\.\?\!]";
- static uint32_t indecisive_set_length_4 = \d+;
- (void)sst_status;
- /* "void" to prevent unused-variable warning, since the variable may not
- * be used in this particular test case.
- */
-
- crypto_status = psa_crypto_init();
- if (crypto_status != PSA_SUCCESS) {
- TEST_FAIL("Could not initialize Crypto.");
- return;
- }
-
- TEST_LOG("Test to assign a sequence of values to a single asset");
-
-
- /* PSA calls to test: */
- /* Creating SST asset "indecisive," with data "First valu...". */
- sst_status = psa_ps_set\(@@@001@@@, indecisive_set_length, indecisive_set_data,
- PSA_STORAGE_FLAG_[A-Z_]+\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- /* Resetting SST asset "indecisive," with data "Second val...". */
- sst_status = psa_ps_set\(@@@001@@@, indecisive_set_length_1, indecisive_set_data_1,
- PSA_STORAGE_FLAG_[A-Z_]+\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- /\* Resetting SST asset "indecisive," with data "@@001@10@@...". \*/
- sst_status = psa_ps_set\(@@@001@@@, indecisive_set_length_2, indecisive_set_data_2,
- PSA_STORAGE_FLAG_[A-Z_]+\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- /* Resetting SST asset "indecisive," with data "Fourth val...". */
- sst_status = psa_ps_set\(@@@001@@@, indecisive_set_length_3, indecisive_set_data_3,
- PSA_STORAGE_FLAG_[A-Z_]+\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- /\* Resetting SST asset "indecisive," with data "@@002@10@@...". \*/
- sst_status = psa_ps_set\(@@@001@@@, indecisive_set_length_4, indecisive_set_data_4,
- PSA_STORAGE_FLAG_[A-Z_]+\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
-
-
- /* Removing assets left over from testing: */
- psa_ps_remove\(@@@001@@@\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
-
- /* Test completed */
- ret->val = TEST_PASSED;
-}
diff --git a/tools/tf_fuzz/regression/000016_set_sst_single_asset_set_multiple_times/template b/tools/tf_fuzz/regression/000016_set_sst_single_asset_set_multiple_times/template
deleted file mode 100644
index 0127a2983..000000000
--- a/tools/tf_fuzz/regression/000016_set_sst_single_asset_set_multiple_times/template
+++ /dev/null
@@ -1,6 +0,0 @@
-purpose to assign a sequence of values to a single asset;
-set sst name indecisive data "First value" flag none;
-set sst name indecisive data "Second value";
-set sst name indecisive data *;
-set sst name indecisive data "Fourth value";
-set sst name indecisive data *;
diff --git a/tools/tf_fuzz/regression/000017_read_sst_check_single_asset_multiple_times/check.py b/tools/tf_fuzz/regression/000017_read_sst_check_single_asset_multiple_times/check.py
deleted file mode 100644
index 1bc5cbe74..000000000
--- a/tools/tf_fuzz/regression/000017_read_sst_check_single_asset_multiple_times/check.py
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-'''
- Please read .../tf_fuzz/regression/README to understand this code.
-
- Please also read the comments in .../tf_fuzz/regression/regress_lib/line_by_line.py.
-'''
-
-import sys, os, re, string, pdb
-sys.path.append ("../regress_lib")
-import line_by_line
-
-
-# Describe script usage:
-def usage():
- print ('''
- Command-line parameters:
- 1. The test-template file, nominally named "template",
- 2. The expected combined stdout/stderr output, nominally named "exp_stdout_stderr",
- 3. The actual/generated combined stdout/stderr output, nominally named "stdout_stderr",
- 4. The expected .c test file, nominally named "exp_test.c", and
- 5. The actual, generated .c test file, nominally named "test.c".
-
- Optionally, *before* these five arguments, you may add switches thus:
- "--v" for verbose mode, to view line-by-line comparisons actual vs. expected,
- "--q" to only print error messages and a successful-completion message,
- "--qq" same as --q but not even printing out the completion message, and
- "--s 12345" to run TF-Fuzz with seed value 12345 (or whatever).
- ''')
-
-
-def main():
- # See if we're supposed to be quiet:
- loud = quiet = ultra_quiet = False
- seed = ""
- while sys.argv[1][0] == "-":
- if sys.argv[1] == "--v":
- loud = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--q":
- quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--qq":
- quiet = ultra_quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--s":
- sys.argv.pop(1)
- seed = sys.argv[1]
- sys.argv.pop(1)
- if not seed.isnumeric():
- print ('The --s seed argument was not a number.')
- usage()
- sys.exit(1)
-
- # Run TF-Fuzz:
- if not quiet: print ("Running TF-Fuzz... ")
- os.system ('rm -f stdout_stderr test.c')
- command = '../../tfz -v ./' + sys.argv[1] + ' ./' + sys.argv[5]
- command += ' ' + seed + ' >' + sys.argv[3] + ' 2>&1'
- if loud:
- print (command)
- if os.system (command) == 0:
- if not quiet: print ("TF-Fuzz run complete.")
- else:
- print ('Could not run TF-Fuzz; please see stdout_stderr file.')
- sys.exit(2)
-
- # Attempt to open files indicated on command line:
- if len(sys.argv) != 6:
- message = '{} requires 5 command-line arguments. Exiting.'
- print (message.format(sys.argv[0]), file=sys.stderr)
- usage()
- sys.exit(3)
- template_file_name = sys.argv[1]
- exp_stdout_file_name = sys.argv[2]
- act_stdout_file_name = sys.argv[3]
- exp_test_file_name = sys.argv[4]
- act_test_file_name = sys.argv[5]
-
- try:
- template_file = open (template_file_name, 'rt')
- exp_stdout_file = open (exp_stdout_file_name, 'rt')
- act_stdout_file = open (act_stdout_file_name, 'rt')
- exp_test_file = open (exp_test_file_name, 'rt')
- act_test_file = open (act_test_file_name, 'rt')
- except FileNotFoundError:
- print ('One or more files could not be found.')
- usage();
- sys.exit(4)
- except:
- print ('Something went wrong trying to open the input files.')
- usage();
- sys.exit(5)
- else:
- message = '\nInput files:\n {},\n {},\n {},\n'
- message += ' {}, and\n {}\nopened successfully.\n'
- if not quiet:
- print (message.format (template_file_name, exp_stdout_file_name,
- act_stdout_file_name, exp_test_file_name, act_test_file_name))
-
- # Check it all:
- if not quiet: print ("\nChecking test C file: ", end="")
- line_by_line.check_file ( exp_test_file, exp_test_file_name,
- act_test_file, act_test_file_name,
- loud, quiet, ultra_quiet )
- if not quiet: print ("Checking stdout and stderr: ", end="")
- line_by_line.check_file ( exp_stdout_file, exp_stdout_file_name,
- act_stdout_file, act_stdout_file_name,
- loud, quiet, ultra_quiet )
-
- # Ran to completion normally, so pass:
- if not ultra_quiet: print ("Regression test passed.")
- sys.exit(0)
-
-if __name__ == "__main__": main()
diff --git a/tools/tf_fuzz/regression/000017_read_sst_check_single_asset_multiple_times/exp_stdout_stderr b/tools/tf_fuzz/regression/000017_read_sst_check_single_asset_multiple_times/exp_stdout_stderr
deleted file mode 100644
index 990480dff..000000000
--- a/tools/tf_fuzz/regression/000017_read_sst_check_single_asset_multiple_times/exp_stdout_stderr
+++ /dev/null
@@ -1,68 +0,0 @@
-Trusted Firmware Fuzzer (TF-Fuzz) starting...
-
-Info: random seed was not specified.
-
-Using seed value of \d+ \(0x[a-f\d]+\).
-Purpose line: to read the value of a single asset multiple times
-ASSET_IDENTIFIER: "just_checking"
-Asset identifier list: "data"
-Create from random data
-Set SST command: ";"
-Appended to end of call sequence: SST-set call.
-Set command: ";"
-Command with no expect: ";"
-ASSET_IDENTIFIER: "just_checking"
-Asset identifier list: "check"
-LITERAL string: "Not this"
-Read check against literal: "Not this"
-SST-read arguments: expect"
-Read SST command: "expect"
-Appended to end of call sequence: SST-get call.
-Read command: "expect"
-Expect fail clause: "fail"
-Command with expect: ";"
-ASSET_IDENTIFIER: "just_checking"
-Asset identifier list: "check"
-LITERAL string: "Not this either"
-Read check against literal: "Not this either"
-SST-read arguments: expect"
-Read SST command: "expect"
-Appended to end of call sequence: SST-get call.
-Read command: "expect"
-Expect fail clause: "fail"
-Command with expect: ";"
-ASSET_IDENTIFIER: "just_checking"
-Asset identifier list: "check"
-LITERAL string: "No dice on this either"
-Read check against literal: "No dice on this either"
-SST-read arguments: expect"
-Read SST command: "expect"
-Appended to end of call sequence: SST-get call.
-Read command: "expect"
-Expect fail clause: "fail"
-Command with expect: ";"
-ASSET_IDENTIFIER: "just_checking"
-Asset identifier list: "print"
-Read log to test log: "print"
-SST-read arguments: ;"
-Read SST command: ";"
-Appended to end of call sequence: SST-get call.
-Read command: ";"
-Command with no expect: ";"
-Lines: Line number 8.
-Lines: Line number 8.
-Lines: Line number 8.
-Lines: Line number 8.
-Lines: Line number 8.
-Lines: Line number 8.
-Call sequence generated.
-Simulating call sequence...
-Call sequence:
- SST-set call for asset just_checking
- SST-get call for asset just_checking
- SST-get call for asset just_checking
- SST-get call for asset just_checking
- SST-get call for asset just_checking
-Writing test file, ./test.c.
-
-TF-Fuzz test generation complete.
diff --git a/tools/tf_fuzz/regression/000017_read_sst_check_single_asset_multiple_times/exp_test.c b/tools/tf_fuzz/regression/000017_read_sst_check_single_asset_multiple_times/exp_test.c
deleted file mode 100644
index aa333ab7c..000000000
--- a/tools/tf_fuzz/regression/000017_read_sst_check_single_asset_multiple_times/exp_test.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Test purpose:
- * to read the value of a single asset multiple times
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <string.h>
-#include <stdint.h>
-
-#include "../sst/non_secure/ns_test_helpers.h"
-#include "psa/protected_storage.h"
-#include "test/framework/test_framework_helpers.h"
-#include "tfm_memory_utils.h"
-#include "psa/crypto.h"
-#include "psa/crypto_sizes.h"
-
-/* This is not yet right for how to run a test; need to register tests, etc. */
-
-void test_thread (struct test_result_t *ret) {
- psa_status_t crypto_status; /* result from Crypto calls */
- psa_status_t sst_status;
- /* Variables (etc.) to initialize and check PSA assets: */
- static uint8_t just_checking_set_data\[\] = "@@001@10@@[a-z\ ]*[\.\?\!]";
- static uint32_t just_checking_set_length = \d+;
- static uint8_t just_checking_exp_data[] = "Not this";
- static uint8_t just_checking_act_data\[2048\] = "[A-Z][a-z ]*[\.\?\!]";
- static size_t just_checking_act_length = \d+;
- static uint8_t just_checking_exp_data_1[] = "Not this either";
- static uint8_t just_checking_exp_data_2[] = "No dice on this either";
- (void)sst_status;
- /* "void" to prevent unused-variable warning, since the variable may not
- * be used in this particular test case.
- */
-
- crypto_status = psa_crypto_init();
- if (crypto_status != PSA_SUCCESS) {
- TEST_FAIL("Could not initialize Crypto.");
- return;
- }
-
- TEST_LOG("Test to read the value of a single asset multiple times");
-
-
- /* PSA calls to test: */
- /\* Creating SST asset "just_checking," with data "@@001@10@@...". \*/
- sst_status = psa_ps_set\(@@@001@@@, just_checking_set_length, just_checking_set_data,
- PSA_STORAGE_FLAG_[A-Z_]+\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- sst_status = psa_ps_get\(@@@001@@@, 0, \d+, just_checking_act_data,
- &just_checking_act_length);
- if (sst_status == PSA_SUCCESS) {
- TEST_FAIL("psa_ps_get() expected not PSA_SUCCESS.");
- return;
- }
- /* Check that the data is correct */
- if \(tfm_memcmp\(just_checking_act_data, just_checking_exp_data,
- just_checking_act_length\) != 0\) {
- TEST_FAIL("Read data should be equal to result data");
- return;
- }
- sst_status = psa_ps_get\(@@@001@@@, 0, \d+, just_checking_act_data,
- &just_checking_act_length);
- if (sst_status == PSA_SUCCESS) {
- TEST_FAIL("psa_ps_get() expected not PSA_SUCCESS.");
- return;
- }
- /* Check that the data is correct */
- if \(tfm_memcmp\(just_checking_act_data, just_checking_exp_data_1,
- just_checking_act_length\) != 0\) {
- TEST_FAIL("Read data should be equal to result data");
- return;
- }
- sst_status = psa_ps_get\(@@@001@@@, 0, \d+, just_checking_act_data,
- &just_checking_act_length);
- if (sst_status == PSA_SUCCESS) {
- TEST_FAIL("psa_ps_get() expected not PSA_SUCCESS.");
- return;
- }
- /* Check that the data is correct */
- if \(tfm_memcmp\(just_checking_act_data, just_checking_exp_data_2,
- just_checking_act_length\) != 0\) {
- TEST_FAIL("Read data should be equal to result data");
- return;
- }
- sst_status = psa_ps_get\(@@@001@@@, 0, \d+, just_checking_act_data,
- &just_checking_act_length);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_get() expected PSA_SUCCESS.");
- return;
- }
- TEST_LOG\(\"just_checking_act_data\"\);
-
-
- /* Removing assets left over from testing: */
- psa_ps_remove\(@@@001@@@\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
-
- /* Test completed */
- ret->val = TEST_PASSED;
-}
diff --git a/tools/tf_fuzz/regression/000017_read_sst_check_single_asset_multiple_times/template b/tools/tf_fuzz/regression/000017_read_sst_check_single_asset_multiple_times/template
deleted file mode 100644
index 9f101226e..000000000
--- a/tools/tf_fuzz/regression/000017_read_sst_check_single_asset_multiple_times/template
+++ /dev/null
@@ -1,7 +0,0 @@
-purpose to read the value of a single asset multiple times;
-set sst name just_checking data *;
-// TF-Fuzz needs enhancements to correctly predict the "expect" values below:
-read sst name just_checking check "Not this" expect fail;
-read sst name just_checking check "Not this either" expect fail;
-read sst name just_checking check "No dice on this either" expect fail;
-read sst name just_checking print;
diff --git a/tools/tf_fuzz/regression/000018_000016_and_000017/check.py b/tools/tf_fuzz/regression/000018_000016_and_000017/check.py
deleted file mode 100644
index 1bc5cbe74..000000000
--- a/tools/tf_fuzz/regression/000018_000016_and_000017/check.py
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-'''
- Please read .../tf_fuzz/regression/README to understand this code.
-
- Please also read the comments in .../tf_fuzz/regression/regress_lib/line_by_line.py.
-'''
-
-import sys, os, re, string, pdb
-sys.path.append ("../regress_lib")
-import line_by_line
-
-
-# Describe script usage:
-def usage():
- print ('''
- Command-line parameters:
- 1. The test-template file, nominally named "template",
- 2. The expected combined stdout/stderr output, nominally named "exp_stdout_stderr",
- 3. The actual/generated combined stdout/stderr output, nominally named "stdout_stderr",
- 4. The expected .c test file, nominally named "exp_test.c", and
- 5. The actual, generated .c test file, nominally named "test.c".
-
- Optionally, *before* these five arguments, you may add switches thus:
- "--v" for verbose mode, to view line-by-line comparisons actual vs. expected,
- "--q" to only print error messages and a successful-completion message,
- "--qq" same as --q but not even printing out the completion message, and
- "--s 12345" to run TF-Fuzz with seed value 12345 (or whatever).
- ''')
-
-
-def main():
- # See if we're supposed to be quiet:
- loud = quiet = ultra_quiet = False
- seed = ""
- while sys.argv[1][0] == "-":
- if sys.argv[1] == "--v":
- loud = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--q":
- quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--qq":
- quiet = ultra_quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--s":
- sys.argv.pop(1)
- seed = sys.argv[1]
- sys.argv.pop(1)
- if not seed.isnumeric():
- print ('The --s seed argument was not a number.')
- usage()
- sys.exit(1)
-
- # Run TF-Fuzz:
- if not quiet: print ("Running TF-Fuzz... ")
- os.system ('rm -f stdout_stderr test.c')
- command = '../../tfz -v ./' + sys.argv[1] + ' ./' + sys.argv[5]
- command += ' ' + seed + ' >' + sys.argv[3] + ' 2>&1'
- if loud:
- print (command)
- if os.system (command) == 0:
- if not quiet: print ("TF-Fuzz run complete.")
- else:
- print ('Could not run TF-Fuzz; please see stdout_stderr file.')
- sys.exit(2)
-
- # Attempt to open files indicated on command line:
- if len(sys.argv) != 6:
- message = '{} requires 5 command-line arguments. Exiting.'
- print (message.format(sys.argv[0]), file=sys.stderr)
- usage()
- sys.exit(3)
- template_file_name = sys.argv[1]
- exp_stdout_file_name = sys.argv[2]
- act_stdout_file_name = sys.argv[3]
- exp_test_file_name = sys.argv[4]
- act_test_file_name = sys.argv[5]
-
- try:
- template_file = open (template_file_name, 'rt')
- exp_stdout_file = open (exp_stdout_file_name, 'rt')
- act_stdout_file = open (act_stdout_file_name, 'rt')
- exp_test_file = open (exp_test_file_name, 'rt')
- act_test_file = open (act_test_file_name, 'rt')
- except FileNotFoundError:
- print ('One or more files could not be found.')
- usage();
- sys.exit(4)
- except:
- print ('Something went wrong trying to open the input files.')
- usage();
- sys.exit(5)
- else:
- message = '\nInput files:\n {},\n {},\n {},\n'
- message += ' {}, and\n {}\nopened successfully.\n'
- if not quiet:
- print (message.format (template_file_name, exp_stdout_file_name,
- act_stdout_file_name, exp_test_file_name, act_test_file_name))
-
- # Check it all:
- if not quiet: print ("\nChecking test C file: ", end="")
- line_by_line.check_file ( exp_test_file, exp_test_file_name,
- act_test_file, act_test_file_name,
- loud, quiet, ultra_quiet )
- if not quiet: print ("Checking stdout and stderr: ", end="")
- line_by_line.check_file ( exp_stdout_file, exp_stdout_file_name,
- act_stdout_file, act_stdout_file_name,
- loud, quiet, ultra_quiet )
-
- # Ran to completion normally, so pass:
- if not ultra_quiet: print ("Regression test passed.")
- sys.exit(0)
-
-if __name__ == "__main__": main()
diff --git a/tools/tf_fuzz/regression/000018_000016_and_000017/exp_stdout_stderr b/tools/tf_fuzz/regression/000018_000016_and_000017/exp_stdout_stderr
deleted file mode 100644
index e9fad8a98..000000000
--- a/tools/tf_fuzz/regression/000018_000016_and_000017/exp_stdout_stderr
+++ /dev/null
@@ -1,121 +0,0 @@
-Trusted Firmware Fuzzer (TF-Fuzz) starting...
-
-Info: random seed was not specified.
-
-Using seed value of \d+ \(0x[a-f\d]+\).
-Purpose line: to both read the value of a single asset multiple times and assign a sequence of values to a single asset
-ASSET_IDENTIFIER: "indecisive"
-Asset identifier list: "data"
-LITERAL string: "First value"
-Create from literal data: ""First value""
-SST no storage flag: none"
-SST creation flag
-;"
-SST creation flags
-;"
-Set SST command: ";"
-Appended to end of call sequence: SST-set call.
-Set command: ";"
-Command with no expect: ";"
-ASSET_IDENTIFIER: "indecisive"
-Asset identifier list: "check"
-LITERAL string: "Not this"
-Read check against literal: "Not this"
-SST-read arguments: expect"
-Read SST command: "expect"
-Appended to end of call sequence: SST-get call.
-Read command: "expect"
-Expect fail clause: "fail"
-Command with expect: ";"
-ASSET_IDENTIFIER: "indecisive"
-Asset identifier list: "data"
-LITERAL string: "Second value"
-Create from literal data: ""Second value""
-Set SST command: ";"
-Appended to end of call sequence: SST-set call.
-Set command: ";"
-Command with no expect: ";"
-ASSET_IDENTIFIER: "indecisive"
-Asset identifier list: "check"
-LITERAL string: "Not this either"
-Read check against literal: "Not this either"
-SST-read arguments: expect"
-Read SST command: "expect"
-Appended to end of call sequence: SST-get call.
-Read command: "expect"
-Expect fail clause: "fail"
-Command with expect: ";"
-ASSET_IDENTIFIER: "indecisive"
-Asset identifier list: "data"
-Create from random data
-Set SST command: ";"
-Appended to end of call sequence: SST-set call.
-Set command: ";"
-Command with no expect: ";"
-ASSET_IDENTIFIER: "indecisive"
-Asset identifier list: "data"
-LITERAL string: "Fourth value"
-Create from literal data: ""Fourth value""
-Set SST command: ";"
-Appended to end of call sequence: SST-set call.
-Set command: ";"
-Command with no expect: ";"
-ASSET_IDENTIFIER: "indecisive"
-Asset identifier list: "check"
-LITERAL string: "No dice on this either"
-Read check against literal: "No dice on this either"
-SST-read arguments: expect"
-Read SST command: "expect"
-Appended to end of call sequence: SST-get call.
-Read command: "expect"
-Expect fail clause: "fail"
-Command with expect: ";"
-ASSET_IDENTIFIER: "indecisive"
-Asset identifier list: "data"
-Create from random data
-Set SST command: ";"
-Appended to end of call sequence: SST-set call.
-Set command: ";"
-Command with no expect: ";"
-ASSET_IDENTIFIER: "indecisive"
-Asset identifier list: "data"
-Create from random data
-Set SST command: ";"
-Appended to end of call sequence: SST-set call.
-Set command: ";"
-Command with no expect: ";"
-ASSET_IDENTIFIER: "indecisive"
-Asset identifier list: "print"
-Read log to test log: "print"
-SST-read arguments: ;"
-Read SST command: ";"
-Appended to end of call sequence: SST-get call.
-Read command: ";"
-Command with no expect: ";"
-Lines: Line number 12.
-Lines: Line number 12.
-Lines: Line number 12.
-Lines: Line number 12.
-Lines: Line number 12.
-Lines: Line number 12.
-Lines: Line number 12.
-Lines: Line number 12.
-Lines: Line number 12.
-Lines: Line number 12.
-Lines: Line number 12.
-Call sequence generated.
-Simulating call sequence...
-Call sequence:
- SST-set call for asset indecisive
- SST-get call for asset indecisive
- SST-set call for asset indecisive
- SST-get call for asset indecisive
- SST-set call for asset indecisive
- SST-set call for asset indecisive
- SST-get call for asset indecisive
- SST-set call for asset indecisive
- SST-set call for asset indecisive
- SST-get call for asset indecisive
-Writing test file, ./test.c.
-
-TF-Fuzz test generation complete.
diff --git a/tools/tf_fuzz/regression/000018_000016_and_000017/exp_test.c b/tools/tf_fuzz/regression/000018_000016_and_000017/exp_test.c
deleted file mode 100644
index ca1ba067d..000000000
--- a/tools/tf_fuzz/regression/000018_000016_and_000017/exp_test.c
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Test purpose:
- * to both read the value of a single asset multiple times and assign a sequence of values to a single asset
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <string.h>
-#include <stdint.h>
-
-#include "../sst/non_secure/ns_test_helpers.h"
-#include "psa/protected_storage.h"
-#include "test/framework/test_framework_helpers.h"
-#include "tfm_memory_utils.h"
-#include "psa/crypto.h"
-#include "psa/crypto_sizes.h"
-
-/* This is not yet right for how to run a test; need to register tests, etc. */
-
-void test_thread (struct test_result_t *ret) {
- psa_status_t crypto_status; /* result from Crypto calls */
- psa_status_t sst_status;
- /* Variables (etc.) to initialize and check PSA assets: */
- static uint8_t indecisive_set_data[] = "First value";
- static uint32_t indecisive_set_length = 11;
- static uint8_t indecisive_exp_data[] = "Not this";
- static uint8_t indecisive_act_data\[2048\] = "[A-Z][a-z ]*[\.\?\!]";
- static size_t indecisive_act_length = \d+;
- static uint8_t indecisive_set_data_1[] = "Second value";
- static uint32_t indecisive_set_length_1 = 12;
- static uint8_t indecisive_exp_data_1[] = "Not this either";
- static uint8_t indecisive_set_data_2\[\] = "@@001@10@@[a-z\ ]*[\.\?\!]";
- static uint32_t indecisive_set_length_2 = \d+;
- static uint8_t indecisive_set_data_3[] = "Fourth value";
- static uint32_t indecisive_set_length_3 = 12;
- static uint8_t indecisive_exp_data_2[] = "No dice on this either";
- static uint8_t indecisive_set_data_4\[\] = "@@002@10@@[a-z\ ]*[\.\?\!]";
- static uint32_t indecisive_set_length_4 = \d+;
- static uint8_t indecisive_set_data_5\[\] = "@@003@10@@[a-z\ ]*[\.\?\!]";
- static uint32_t indecisive_set_length_5 = \d+;
- (void)sst_status;
- /* "void" to prevent unused-variable warning, since the variable may not
- * be used in this particular test case.
- */
-
- crypto_status = psa_crypto_init();
- if (crypto_status != PSA_SUCCESS) {
- TEST_FAIL("Could not initialize Crypto.");
- return;
- }
-
- TEST_LOG("Test to both read the value of a single asset multiple times and assign a sequence of values to a single asset");
-
-
- /* PSA calls to test: */
- /* Creating SST asset "indecisive," with data "First valu...". */
- sst_status = psa_ps_set\(@@@001@@@, indecisive_set_length, indecisive_set_data,
- PSA_STORAGE_FLAG_NONE);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- sst_status = psa_ps_get\(@@@001@@@, 0, 11, indecisive_act_data,
- &indecisive_act_length);
- if (sst_status == PSA_SUCCESS) {
- TEST_FAIL("psa_ps_get() expected not PSA_SUCCESS.");
- return;
- }
- /* Check that the data is correct */
- if (tfm_memcmp(indecisive_act_data, indecisive_exp_data,
- indecisive_act_length\) != 0\) {
- TEST_FAIL("Read data should be equal to result data");
- return;
- }
- /* Resetting SST asset "indecisive," with data "Second val...". */
- sst_status = psa_ps_set\(@@@001@@@, indecisive_set_length_1, indecisive_set_data_1,
- PSA_STORAGE_FLAG_NONE);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- sst_status = psa_ps_get\(@@@001@@@, 0, 12, indecisive_act_data,
- &indecisive_act_length);
- if (sst_status == PSA_SUCCESS) {
- TEST_FAIL("psa_ps_get() expected not PSA_SUCCESS.");
- return;
- }
- /* Check that the data is correct */
- if (tfm_memcmp(indecisive_act_data, indecisive_exp_data_1,
- indecisive_act_length) != 0) {
- TEST_FAIL("Read data should be equal to result data");
- return;
- }
- /\* Resetting SST asset "indecisive," with data "@@001@10@@...". \*/
- sst_status = psa_ps_set\(@@@001@@@, indecisive_set_length_2, indecisive_set_data_2,
- PSA_STORAGE_FLAG_NONE);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- /* Resetting SST asset "indecisive," with data "Fourth val...". */
- sst_status = psa_ps_set\(@@@001@@@, indecisive_set_length_3, indecisive_set_data_3,
- PSA_STORAGE_FLAG_NONE);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- sst_status = psa_ps_get\(@@@001@@@, 0, 12, indecisive_act_data,
- &indecisive_act_length);
- if (sst_status == PSA_SUCCESS) {
- TEST_FAIL("psa_ps_get() expected not PSA_SUCCESS.");
- return;
- }
- /* Check that the data is correct */
- if (tfm_memcmp(indecisive_act_data, indecisive_exp_data_2,
- indecisive_act_length) != 0) {
- TEST_FAIL("Read data should be equal to result data");
- return;
- }
- /\* Resetting SST asset "indecisive," with data "@@002@10@@...". \*/
- sst_status = psa_ps_set\(@@@001@@@, indecisive_set_length_4, indecisive_set_data_4,
- PSA_STORAGE_FLAG_NONE);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- /\* Resetting SST asset "indecisive," with data "@@003@10@@...". \*/
- sst_status = psa_ps_set\(@@@001@@@, indecisive_set_length_5, indecisive_set_data_5,
- PSA_STORAGE_FLAG_NONE);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- sst_status = psa_ps_get\(@@@001@@@, 0, \d+, indecisive_act_data,
- &indecisive_act_length);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_get() expected PSA_SUCCESS.");
- return;
- }
- TEST_LOG\(\"indecisive_act_data\"\);
-
-
- /* Removing assets left over from testing: */
- psa_ps_remove\(@@@001@@@\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
-
- /* Test completed */
- ret->val = TEST_PASSED;
-}
diff --git a/tools/tf_fuzz/regression/000018_000016_and_000017/template b/tools/tf_fuzz/regression/000018_000016_and_000017/template
deleted file mode 100644
index 662a252ed..000000000
--- a/tools/tf_fuzz/regression/000018_000016_and_000017/template
+++ /dev/null
@@ -1,11 +0,0 @@
-purpose to both read the value of a single asset multiple times and assign a sequence of values to a single asset;
-set sst name indecisive data "First value" flag none;
-read sst name indecisive check "Not this" expect fail;
-set sst name indecisive data "Second value";
-read sst name indecisive check "Not this either" expect fail;
-set sst name indecisive data *;
-set sst name indecisive data "Fourth value";
-read sst name indecisive check "No dice on this either" expect fail;
-set sst name indecisive data *;
-set sst name indecisive data *;
-read sst name indecisive print;
diff --git a/tools/tf_fuzz/regression/000019_read_asset_to_variable_set_other_asset/check.py b/tools/tf_fuzz/regression/000019_read_asset_to_variable_set_other_asset/check.py
deleted file mode 100644
index 1bc5cbe74..000000000
--- a/tools/tf_fuzz/regression/000019_read_asset_to_variable_set_other_asset/check.py
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-'''
- Please read .../tf_fuzz/regression/README to understand this code.
-
- Please also read the comments in .../tf_fuzz/regression/regress_lib/line_by_line.py.
-'''
-
-import sys, os, re, string, pdb
-sys.path.append ("../regress_lib")
-import line_by_line
-
-
-# Describe script usage:
-def usage():
- print ('''
- Command-line parameters:
- 1. The test-template file, nominally named "template",
- 2. The expected combined stdout/stderr output, nominally named "exp_stdout_stderr",
- 3. The actual/generated combined stdout/stderr output, nominally named "stdout_stderr",
- 4. The expected .c test file, nominally named "exp_test.c", and
- 5. The actual, generated .c test file, nominally named "test.c".
-
- Optionally, *before* these five arguments, you may add switches thus:
- "--v" for verbose mode, to view line-by-line comparisons actual vs. expected,
- "--q" to only print error messages and a successful-completion message,
- "--qq" same as --q but not even printing out the completion message, and
- "--s 12345" to run TF-Fuzz with seed value 12345 (or whatever).
- ''')
-
-
-def main():
- # See if we're supposed to be quiet:
- loud = quiet = ultra_quiet = False
- seed = ""
- while sys.argv[1][0] == "-":
- if sys.argv[1] == "--v":
- loud = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--q":
- quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--qq":
- quiet = ultra_quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--s":
- sys.argv.pop(1)
- seed = sys.argv[1]
- sys.argv.pop(1)
- if not seed.isnumeric():
- print ('The --s seed argument was not a number.')
- usage()
- sys.exit(1)
-
- # Run TF-Fuzz:
- if not quiet: print ("Running TF-Fuzz... ")
- os.system ('rm -f stdout_stderr test.c')
- command = '../../tfz -v ./' + sys.argv[1] + ' ./' + sys.argv[5]
- command += ' ' + seed + ' >' + sys.argv[3] + ' 2>&1'
- if loud:
- print (command)
- if os.system (command) == 0:
- if not quiet: print ("TF-Fuzz run complete.")
- else:
- print ('Could not run TF-Fuzz; please see stdout_stderr file.')
- sys.exit(2)
-
- # Attempt to open files indicated on command line:
- if len(sys.argv) != 6:
- message = '{} requires 5 command-line arguments. Exiting.'
- print (message.format(sys.argv[0]), file=sys.stderr)
- usage()
- sys.exit(3)
- template_file_name = sys.argv[1]
- exp_stdout_file_name = sys.argv[2]
- act_stdout_file_name = sys.argv[3]
- exp_test_file_name = sys.argv[4]
- act_test_file_name = sys.argv[5]
-
- try:
- template_file = open (template_file_name, 'rt')
- exp_stdout_file = open (exp_stdout_file_name, 'rt')
- act_stdout_file = open (act_stdout_file_name, 'rt')
- exp_test_file = open (exp_test_file_name, 'rt')
- act_test_file = open (act_test_file_name, 'rt')
- except FileNotFoundError:
- print ('One or more files could not be found.')
- usage();
- sys.exit(4)
- except:
- print ('Something went wrong trying to open the input files.')
- usage();
- sys.exit(5)
- else:
- message = '\nInput files:\n {},\n {},\n {},\n'
- message += ' {}, and\n {}\nopened successfully.\n'
- if not quiet:
- print (message.format (template_file_name, exp_stdout_file_name,
- act_stdout_file_name, exp_test_file_name, act_test_file_name))
-
- # Check it all:
- if not quiet: print ("\nChecking test C file: ", end="")
- line_by_line.check_file ( exp_test_file, exp_test_file_name,
- act_test_file, act_test_file_name,
- loud, quiet, ultra_quiet )
- if not quiet: print ("Checking stdout and stderr: ", end="")
- line_by_line.check_file ( exp_stdout_file, exp_stdout_file_name,
- act_stdout_file, act_stdout_file_name,
- loud, quiet, ultra_quiet )
-
- # Ran to completion normally, so pass:
- if not ultra_quiet: print ("Regression test passed.")
- sys.exit(0)
-
-if __name__ == "__main__": main()
diff --git a/tools/tf_fuzz/regression/000019_read_asset_to_variable_set_other_asset/exp_stdout_stderr b/tools/tf_fuzz/regression/000019_read_asset_to_variable_set_other_asset/exp_stdout_stderr
deleted file mode 100644
index ca4b2ede5..000000000
--- a/tools/tf_fuzz/regression/000019_read_asset_to_variable_set_other_asset/exp_stdout_stderr
+++ /dev/null
@@ -1,76 +0,0 @@
-Trusted Firmware Fuzzer (TF-Fuzz) starting...
-
-Info: random seed was not specified.
-
-Using seed value of \d+ \(0x[a-f\d]+\).
-Purpose line: to read an asset into a named variable the set another asset from that variable
-ASSET_IDENTIFIER: "source"
-Asset identifier list: ";"
-SST-create from random data (no 'data *')
-Set SST command: ";"
-Appended to end of call sequence: SST-set call.
-Set command: ";"
-Command with no expect: ";"
-ASSET_IDENTIFIER: "source"
-Asset identifier list: "var"
-IDENTIFIER: "transfer"
-Read dump to variable: "transfer"
-SST-read arguments: ;"
-Read SST command: ";"
-Appended to end of call sequence: SST-get call.
-Read command: ";"
-Command with no expect: ";"
-ASSET_IDENTIFIER: "intermediate"
-Asset identifier list: "var"
-IDENTIFIER: "transfer"
-SST-set set from variable: "transfer"
-Set SST command: ";"
-Appended to end of call sequence: SST-set call.
-Set command: ";"
-Command with no expect: ";"
-ASSET_IDENTIFIER: "intermediate"
-Asset identifier list: "var"
-IDENTIFIER: "transfer"
-Read dump to variable: "transfer"
-SST-read arguments: ;"
-Read SST command: ";"
-Appended to end of call sequence: SST-get call.
-Read command: ";"
-Command with no expect: ";"
-ASSET_IDENTIFIER: "destination"
-Asset identifier list: "var"
-IDENTIFIER: "transfer"
-SST-set set from variable: "transfer"
-Set SST command: ";"
-Appended to end of call sequence: SST-set call.
-Set command: ";"
-Command with no expect: ";"
-ASSET_IDENTIFIER: "destination"
-Asset identifier list: "check"
-IDENTIFIER: "transfer"
-Read-arguments variable name: "transfer"
-Read check against variable: "transfer"
-SST-read arguments: ;"
-Read SST command: ";"
-Appended to end of call sequence: SST-get call.
-Read command: ";"
-Command with no expect: ";"
-Lines: Line number 8.
-Lines: Line number 8.
-Lines: Line number 8.
-Lines: Line number 8.
-Lines: Line number 8.
-Lines: Line number 8.
-Lines: Line number 8.
-Call sequence generated.
-Simulating call sequence...
-Call sequence:
- SST-set call for asset source
- SST-get call for asset source
- SST-set call for asset intermediate
- SST-get call for asset intermediate
- SST-set call for asset destination
- SST-get call for asset destination
-Writing test file, ./test.c.
-
-TF-Fuzz test generation complete.
diff --git a/tools/tf_fuzz/regression/000019_read_asset_to_variable_set_other_asset/exp_test.c b/tools/tf_fuzz/regression/000019_read_asset_to_variable_set_other_asset/exp_test.c
deleted file mode 100644
index 6131299b6..000000000
--- a/tools/tf_fuzz/regression/000019_read_asset_to_variable_set_other_asset/exp_test.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Test purpose:
- * to read an asset into a named variable the set another asset from that variable
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <string.h>
-#include <stdint.h>
-
-#include "../sst/non_secure/ns_test_helpers.h"
-#include "psa/protected_storage.h"
-#include "test/framework/test_framework_helpers.h"
-#include "tfm_memory_utils.h"
-#include "psa/crypto.h"
-#include "psa/crypto_sizes.h"
-
-/* This is not yet right for how to run a test; need to register tests, etc. */
-
-void test_thread (struct test_result_t *ret) {
- psa_status_t crypto_status; /* result from Crypto calls */
- psa_status_t sst_status;
- /* Variables (etc.) to initialize and check PSA assets: */
- static uint8_t source_set_data\[\] = "@@001@10@@[a-z\ ]*[\.\?\!]";
- static uint32_t source_set_length = @@@004@@@;
- static uint8_t source_exp_data\[\] = "@@001@10@@[a-z\ ]*[\.\?\!]";
- static uint8_t transfer_data\[2048\] = "[A-Z][a-z ]*[\.\?\!]";
- static size_t transfer_length = \d+;
- static uint8_t intermediate_exp_data\[\] = "@@002@10@@[a-z\ ]*[\.\?\!]";
- static uint8_t destination_act_data\[2048\] = "[A-Z][a-z ]*[\.\?\!]";
- static size_t destination_act_length = \d+;
- (void)sst_status;
- /* "void" to prevent unused-variable warning, since the variable may not
- * be used in this particular test case.
- */
-
- crypto_status = psa_crypto_init();
- if (crypto_status != PSA_SUCCESS) {
- TEST_FAIL("Could not initialize Crypto.");
- return;
- }
-
- TEST_LOG("Test to read an asset into a named variable the set another asset from that variable");
-
-
- /* PSA calls to test: */
- /\* Creating SST asset "source," with data "@@001@10@@...". \*/
- sst_status = psa_ps_set\(@@@001@@@, source_set_length, source_set_data,
- PSA_STORAGE_FLAG_[A-Z_]+\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- sst_status = psa_ps_get\(@@@001@@@, 0, @@@004@@@, transfer_data,
- &transfer_length);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_get() expected PSA_SUCCESS.");
- return;
- }
- /* Check that the data is correct */
- if (tfm_memcmp(transfer_data, source_exp_data,
- transfer_length) != 0) {
- TEST_FAIL("Read data should be equal to result data");
- return;
- }
- /\* Creating SST asset "intermediate," with data "@@002@10@@...". \*/
- sst_status = psa_ps_set\(@@@002@@@, transfer_length, transfer_data,
- PSA_STORAGE_FLAG_[A-Z_]+\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- sst_status = psa_ps_get\(@@@002@@@, 0, \d+, transfer_data,
- &transfer_length);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_get() expected PSA_SUCCESS.");
- return;
- }
- /* Check that the data is correct */
- if (tfm_memcmp(transfer_data, intermediate_exp_data,
- transfer_length) != 0) {
- TEST_FAIL("Read data should be equal to result data");
- return;
- }
- /\* Creating SST asset "destination," with data "[A-Z][a-z ]*...". \*/
- sst_status = psa_ps_set\(@@@003@@@, transfer_length, transfer_data,
- PSA_STORAGE_FLAG_[A-Z_]+\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- sst_status = psa_ps_get\(@@@003@@@, 0, \d+, destination_act_data,
- &destination_act_length);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_get() expected PSA_SUCCESS.");
- return;
- }
- /* Check that the data is correct */
- if (tfm_memcmp(destination_act_data, transfer_data,
- destination_act_length) != 0) {
- TEST_FAIL("Read data should be equal to result data");
- return;
- }
-
-
- /* Removing assets left over from testing: */
- psa_ps_remove\(@@@001@@@\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
- psa_ps_remove\(@@@002@@@\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
- psa_ps_remove\(@@@003@@@\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
-
- /* Test completed */
- ret->val = TEST_PASSED;
-}
diff --git a/tools/tf_fuzz/regression/000019_read_asset_to_variable_set_other_asset/template b/tools/tf_fuzz/regression/000019_read_asset_to_variable_set_other_asset/template
deleted file mode 100644
index 0111ba243..000000000
--- a/tools/tf_fuzz/regression/000019_read_asset_to_variable_set_other_asset/template
+++ /dev/null
@@ -1,7 +0,0 @@
-purpose to read an asset into a named variable the set another asset from that variable;
-set sst name source; // shorthand for random data
-read sst name source var transfer;
-set sst name intermediate var transfer;
-read sst name intermediate var transfer;
-set sst name destination var transfer;
-read sst name destination check transfer;
diff --git a/tools/tf_fuzz/regression/000020_no_purpose/check.py b/tools/tf_fuzz/regression/000020_no_purpose/check.py
deleted file mode 100644
index 2027be87e..000000000
--- a/tools/tf_fuzz/regression/000020_no_purpose/check.py
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2019-2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-'''
- Please read .../tf_fuzz/regression/README to understand this code.
-
- Please also read the comments in .../tf_fuzz/regression/regress_lib/line_by_line.py.
-'''
-
-import sys, os, re, string, pdb
-sys.path.append ("../regress_lib")
-import line_by_line
-
-
-# Describe script usage:
-def usage():
- print ('''
- Command-line parameters:
- 1. The test-template file, nominally named "template",
- 2. The expected combined stdout/stderr output, nominally named "exp_stdout_stderr",
- 3. The actual/generated combined stdout/stderr output, nominally named "stdout_stderr",
- 4. The expected .c test file, nominally named "exp_test.c", and
- 5. The actual, generated .c test file, nominally named "test.c".
-
- Optionally, *before* these five arguments, you may add switches thus:
- "--v" for verbose mode, to view line-by-line comparisons actual vs. expected,
- "--q" to only print error messages and a successful-completion message,
- "--qq" same as --q but not even printing out the completion message, and
- "--s 12345" to run TF-Fuzz with seed value 12345 (or whatever).
- ''')
-
-
-def main():
- # See if we're supposed to be quiet:
- loud = quiet = ultra_quiet = False
- seed = ""
- while sys.argv[1][0] == "-":
- if sys.argv[1] == "--v":
- loud = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--q":
- quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--qq":
- quiet = ultra_quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--s":
- sys.argv.pop(1)
- seed = sys.argv[1]
- sys.argv.pop(1)
- if not seed.isnumeric():
- print ('The --s seed argument was not a number.')
- usage()
- sys.exit(1)
-
- # Run TF-Fuzz:
- if not quiet: print ("Running TF-Fuzz... ")
- os.system ('rm -f stdout_stderr test.c')
- command = '../../tfz -v ./' + sys.argv[1] + ' ./' + sys.argv[5]
- command += ' ' + seed + ' >' + sys.argv[3] + ' 2>&1'
- if loud:
- print (command)
- if os.system (command) == 0:
- if not quiet: print ("TF-Fuzz run complete.")
- else:
- print ('Could not run TF-Fuzz; please see stdout_stderr file.')
- sys.exit(2)
-
- # Attempt to open files indicated on command line:
- if len(sys.argv) != 6:
- message = '{} requires 5 command-line arguments. Exiting.'
- print (message.format(sys.argv[0]), file=sys.stderr)
- usage()
- sys.exit(3)
- template_file_name = sys.argv[1]
- exp_stdout_file_name = sys.argv[2]
- act_stdout_file_name = sys.argv[3]
- exp_test_file_name = sys.argv[4]
- act_test_file_name = sys.argv[5]
-
- try:
- template_file = open (template_file_name, 'rt')
- exp_stdout_file = open (exp_stdout_file_name, 'rt')
- act_stdout_file = open (act_stdout_file_name, 'rt')
- exp_test_file = open (exp_test_file_name, 'rt')
- act_test_file = open (act_test_file_name, 'rt')
- except FileNotFoundError:
- print ('One or more files could not be found.')
- usage();
- sys.exit(4)
- except:
- print ('Something went wrong trying to open the input files.')
- usage();
- sys.exit(5)
- else:
- message = '\nInput files:\n {},\n {},\n {},\n'
- message += ' {}, and\n {}\nopened successfully.\n'
- if not quiet:
- print (message.format (template_file_name, exp_stdout_file_name,
- act_stdout_file_name, exp_test_file_name, act_test_file_name))
-
- # Check it all:
- if not quiet: print ("\nChecking test C file: ", end="")
- line_by_line.check_file ( exp_test_file, exp_test_file_name,
- act_test_file, act_test_file_name,
- loud, quiet, ultra_quiet )
- if not quiet: print ("Checking stdout and stderr: ", end="")
- line_by_line.check_file ( exp_stdout_file, exp_stdout_file_name,
- act_stdout_file, act_stdout_file_name,
- loud, quiet, ultra_quiet )
-
- # Ran to completion normally, so pass:
- if not ultra_quiet: print ("Regression test passed.")
- sys.exit(0)
-
-if __name__ == "__main__": main()
diff --git a/tools/tf_fuzz/regression/000020_no_purpose/exp_stdout_stderr b/tools/tf_fuzz/regression/000020_no_purpose/exp_stdout_stderr
deleted file mode 100644
index 3a87ce676..000000000
--- a/tools/tf_fuzz/regression/000020_no_purpose/exp_stdout_stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-Trusted Firmware Fuzzer (TF-Fuzz) starting...
-
-Info: random seed was not specified.
-
-Using seed value of \d+ \(0x[a-f\d]+\).
-ASSET_NUMBER: "104"
-SST-asset UID list: "data"
-LITERAL string: "Very simple test"
-Create from literal data: ""Very simple test""
-Set SST command: "expect"
-Appended to end of call sequence: SST-set call.
-Set command: "expect"
-Expect pass clause: "pass"
-Command with expect: "
-
-Error: Please begin your test with the "purpose" directive.
- For example, "purpose to exercise crypto and SST..."
diff --git a/tools/tf_fuzz/regression/000020_no_purpose/exp_test.c b/tools/tf_fuzz/regression/000020_no_purpose/exp_test.c
deleted file mode 100644
index e69de29bb..000000000
--- a/tools/tf_fuzz/regression/000020_no_purpose/exp_test.c
+++ /dev/null
diff --git a/tools/tf_fuzz/regression/000020_no_purpose/template b/tools/tf_fuzz/regression/000020_no_purpose/template
deleted file mode 100644
index 7b7fd92a7..000000000
--- a/tools/tf_fuzz/regression/000020_no_purpose/template
+++ /dev/null
@@ -1,2 +0,0 @@
-// purpose to make sure it complains if you don't provide a purpose
-set sst uid 104 data "Very simple test" expect pass;
diff --git a/tools/tf_fuzz/regression/000021_abbreviated_result_codes/check.py b/tools/tf_fuzz/regression/000021_abbreviated_result_codes/check.py
deleted file mode 100644
index 2027be87e..000000000
--- a/tools/tf_fuzz/regression/000021_abbreviated_result_codes/check.py
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2019-2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-'''
- Please read .../tf_fuzz/regression/README to understand this code.
-
- Please also read the comments in .../tf_fuzz/regression/regress_lib/line_by_line.py.
-'''
-
-import sys, os, re, string, pdb
-sys.path.append ("../regress_lib")
-import line_by_line
-
-
-# Describe script usage:
-def usage():
- print ('''
- Command-line parameters:
- 1. The test-template file, nominally named "template",
- 2. The expected combined stdout/stderr output, nominally named "exp_stdout_stderr",
- 3. The actual/generated combined stdout/stderr output, nominally named "stdout_stderr",
- 4. The expected .c test file, nominally named "exp_test.c", and
- 5. The actual, generated .c test file, nominally named "test.c".
-
- Optionally, *before* these five arguments, you may add switches thus:
- "--v" for verbose mode, to view line-by-line comparisons actual vs. expected,
- "--q" to only print error messages and a successful-completion message,
- "--qq" same as --q but not even printing out the completion message, and
- "--s 12345" to run TF-Fuzz with seed value 12345 (or whatever).
- ''')
-
-
-def main():
- # See if we're supposed to be quiet:
- loud = quiet = ultra_quiet = False
- seed = ""
- while sys.argv[1][0] == "-":
- if sys.argv[1] == "--v":
- loud = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--q":
- quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--qq":
- quiet = ultra_quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--s":
- sys.argv.pop(1)
- seed = sys.argv[1]
- sys.argv.pop(1)
- if not seed.isnumeric():
- print ('The --s seed argument was not a number.')
- usage()
- sys.exit(1)
-
- # Run TF-Fuzz:
- if not quiet: print ("Running TF-Fuzz... ")
- os.system ('rm -f stdout_stderr test.c')
- command = '../../tfz -v ./' + sys.argv[1] + ' ./' + sys.argv[5]
- command += ' ' + seed + ' >' + sys.argv[3] + ' 2>&1'
- if loud:
- print (command)
- if os.system (command) == 0:
- if not quiet: print ("TF-Fuzz run complete.")
- else:
- print ('Could not run TF-Fuzz; please see stdout_stderr file.')
- sys.exit(2)
-
- # Attempt to open files indicated on command line:
- if len(sys.argv) != 6:
- message = '{} requires 5 command-line arguments. Exiting.'
- print (message.format(sys.argv[0]), file=sys.stderr)
- usage()
- sys.exit(3)
- template_file_name = sys.argv[1]
- exp_stdout_file_name = sys.argv[2]
- act_stdout_file_name = sys.argv[3]
- exp_test_file_name = sys.argv[4]
- act_test_file_name = sys.argv[5]
-
- try:
- template_file = open (template_file_name, 'rt')
- exp_stdout_file = open (exp_stdout_file_name, 'rt')
- act_stdout_file = open (act_stdout_file_name, 'rt')
- exp_test_file = open (exp_test_file_name, 'rt')
- act_test_file = open (act_test_file_name, 'rt')
- except FileNotFoundError:
- print ('One or more files could not be found.')
- usage();
- sys.exit(4)
- except:
- print ('Something went wrong trying to open the input files.')
- usage();
- sys.exit(5)
- else:
- message = '\nInput files:\n {},\n {},\n {},\n'
- message += ' {}, and\n {}\nopened successfully.\n'
- if not quiet:
- print (message.format (template_file_name, exp_stdout_file_name,
- act_stdout_file_name, exp_test_file_name, act_test_file_name))
-
- # Check it all:
- if not quiet: print ("\nChecking test C file: ", end="")
- line_by_line.check_file ( exp_test_file, exp_test_file_name,
- act_test_file, act_test_file_name,
- loud, quiet, ultra_quiet )
- if not quiet: print ("Checking stdout and stderr: ", end="")
- line_by_line.check_file ( exp_stdout_file, exp_stdout_file_name,
- act_stdout_file, act_stdout_file_name,
- loud, quiet, ultra_quiet )
-
- # Ran to completion normally, so pass:
- if not ultra_quiet: print ("Regression test passed.")
- sys.exit(0)
-
-if __name__ == "__main__": main()
diff --git a/tools/tf_fuzz/regression/000021_abbreviated_result_codes/exp_stdout_stderr b/tools/tf_fuzz/regression/000021_abbreviated_result_codes/exp_stdout_stderr
deleted file mode 100644
index c4af68251..000000000
--- a/tools/tf_fuzz/regression/000021_abbreviated_result_codes/exp_stdout_stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-Trusted Firmware Fuzzer (TF-Fuzz) starting...
-
-Info: random seed was not specified.
-
-Using seed value of \d+ \(0x[a-f\d]+\).
-Purpose line: to more-specifically override TF-Fuzz's expected result
-ASSET_IDENTIFIER: "napoleon"
-Asset identifier list: "chk"
-LITERAL string: "this won't work"
-Read check against literal: "this won't work"
-SST-read arguments: exp"
-Read SST command: "exp"
-Appended to end of call sequence: SST-get call.
-Read command: "exp"
-IDENTIFIER: "generic_error"
-Expect error clause: "generic_error"
-Command with expect: ";"
-Lines: Line number 3.
-Lines: Line number 3.
-Call sequence generated.
-Simulating call sequence...
-Call sequence:
- SST-get call for asset napoleon
-Writing test file, ./test.c.
-
-TF-Fuzz test generation complete.
diff --git a/tools/tf_fuzz/regression/000021_abbreviated_result_codes/exp_test.c b/tools/tf_fuzz/regression/000021_abbreviated_result_codes/exp_test.c
deleted file mode 100644
index 359dd8aa7..000000000
--- a/tools/tf_fuzz/regression/000021_abbreviated_result_codes/exp_test.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Test purpose:
- * to more-specifically override TF-Fuzz's expected result
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <string.h>
-#include <stdint.h>
-
-#include "../sst/non_secure/ns_test_helpers.h"
-#include "psa/protected_storage.h"
-#include "test/framework/test_framework_helpers.h"
-#include "tfm_memory_utils.h"
-#include "psa/crypto.h"
-#include "psa/crypto_sizes.h"
-
-/* This is not yet right for how to run a test; need to register tests, etc. */
-
-void test_thread (struct test_result_t *ret) {
- psa_status_t crypto_status; /* result from Crypto calls */
- psa_status_t sst_status;
- /* Variables (etc.) to initialize and check PSA assets: */
- static uint8_t napoleon_exp_data[] = "this won't work";
- static uint8_t napoleon_act_data\[2048\] = "[A-Z][a-z ]*[\.\?\!]";
- static size_t napoleon_act_length = \d+;
- (void)sst_status;
- /* "void" to prevent unused-variable warning, since the variable may not
- * be used in this particular test case.
- */
-
- crypto_status = psa_crypto_init();
- if (crypto_status != PSA_SUCCESS) {
- TEST_FAIL("Could not initialize Crypto.");
- return;
- }
-
- TEST_LOG("Test to more-specifically override TF-Fuzz's expected result");
-
-
- /* PSA calls to test: */
- sst_status = psa_ps_get\(\d+, 0, @@@001@@@, napoleon_act_data,
- &napoleon_act_length);
- if (sst_status != PSA_ERROR_GENERIC_ERROR) {
- TEST_FAIL("psa_ps_get() expected PSA_ERROR_GENERIC_ERROR.");
- return;
- }
- /* Check that the data is correct */
- if \(tfm_memcmp\(napoleon_act_data, napoleon_exp_data,
- napoleon_act_length\) != 0\) \{
- TEST_FAIL("Read data should be equal to result data");
- return;
- }
-
-
- /* Removing assets left over from testing: */
-
- /* Test completed */
- ret->val = TEST_PASSED;
-}
diff --git a/tools/tf_fuzz/regression/000021_abbreviated_result_codes/template b/tools/tf_fuzz/regression/000021_abbreviated_result_codes/template
deleted file mode 100644
index 67b05b3f4..000000000
--- a/tools/tf_fuzz/regression/000021_abbreviated_result_codes/template
+++ /dev/null
@@ -1,2 +0,0 @@
-purpose to more-specifically override TF-Fuzz's expected result;
-read sst name napoleon chk "this won't work" exp generic_error;
diff --git a/tools/tf_fuzz/regression/000022_SST_offset/check.py b/tools/tf_fuzz/regression/000022_SST_offset/check.py
deleted file mode 100644
index 2027be87e..000000000
--- a/tools/tf_fuzz/regression/000022_SST_offset/check.py
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2019-2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-'''
- Please read .../tf_fuzz/regression/README to understand this code.
-
- Please also read the comments in .../tf_fuzz/regression/regress_lib/line_by_line.py.
-'''
-
-import sys, os, re, string, pdb
-sys.path.append ("../regress_lib")
-import line_by_line
-
-
-# Describe script usage:
-def usage():
- print ('''
- Command-line parameters:
- 1. The test-template file, nominally named "template",
- 2. The expected combined stdout/stderr output, nominally named "exp_stdout_stderr",
- 3. The actual/generated combined stdout/stderr output, nominally named "stdout_stderr",
- 4. The expected .c test file, nominally named "exp_test.c", and
- 5. The actual, generated .c test file, nominally named "test.c".
-
- Optionally, *before* these five arguments, you may add switches thus:
- "--v" for verbose mode, to view line-by-line comparisons actual vs. expected,
- "--q" to only print error messages and a successful-completion message,
- "--qq" same as --q but not even printing out the completion message, and
- "--s 12345" to run TF-Fuzz with seed value 12345 (or whatever).
- ''')
-
-
-def main():
- # See if we're supposed to be quiet:
- loud = quiet = ultra_quiet = False
- seed = ""
- while sys.argv[1][0] == "-":
- if sys.argv[1] == "--v":
- loud = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--q":
- quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--qq":
- quiet = ultra_quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--s":
- sys.argv.pop(1)
- seed = sys.argv[1]
- sys.argv.pop(1)
- if not seed.isnumeric():
- print ('The --s seed argument was not a number.')
- usage()
- sys.exit(1)
-
- # Run TF-Fuzz:
- if not quiet: print ("Running TF-Fuzz... ")
- os.system ('rm -f stdout_stderr test.c')
- command = '../../tfz -v ./' + sys.argv[1] + ' ./' + sys.argv[5]
- command += ' ' + seed + ' >' + sys.argv[3] + ' 2>&1'
- if loud:
- print (command)
- if os.system (command) == 0:
- if not quiet: print ("TF-Fuzz run complete.")
- else:
- print ('Could not run TF-Fuzz; please see stdout_stderr file.')
- sys.exit(2)
-
- # Attempt to open files indicated on command line:
- if len(sys.argv) != 6:
- message = '{} requires 5 command-line arguments. Exiting.'
- print (message.format(sys.argv[0]), file=sys.stderr)
- usage()
- sys.exit(3)
- template_file_name = sys.argv[1]
- exp_stdout_file_name = sys.argv[2]
- act_stdout_file_name = sys.argv[3]
- exp_test_file_name = sys.argv[4]
- act_test_file_name = sys.argv[5]
-
- try:
- template_file = open (template_file_name, 'rt')
- exp_stdout_file = open (exp_stdout_file_name, 'rt')
- act_stdout_file = open (act_stdout_file_name, 'rt')
- exp_test_file = open (exp_test_file_name, 'rt')
- act_test_file = open (act_test_file_name, 'rt')
- except FileNotFoundError:
- print ('One or more files could not be found.')
- usage();
- sys.exit(4)
- except:
- print ('Something went wrong trying to open the input files.')
- usage();
- sys.exit(5)
- else:
- message = '\nInput files:\n {},\n {},\n {},\n'
- message += ' {}, and\n {}\nopened successfully.\n'
- if not quiet:
- print (message.format (template_file_name, exp_stdout_file_name,
- act_stdout_file_name, exp_test_file_name, act_test_file_name))
-
- # Check it all:
- if not quiet: print ("\nChecking test C file: ", end="")
- line_by_line.check_file ( exp_test_file, exp_test_file_name,
- act_test_file, act_test_file_name,
- loud, quiet, ultra_quiet )
- if not quiet: print ("Checking stdout and stderr: ", end="")
- line_by_line.check_file ( exp_stdout_file, exp_stdout_file_name,
- act_stdout_file, act_stdout_file_name,
- loud, quiet, ultra_quiet )
-
- # Ran to completion normally, so pass:
- if not ultra_quiet: print ("Regression test passed.")
- sys.exit(0)
-
-if __name__ == "__main__": main()
diff --git a/tools/tf_fuzz/regression/000022_SST_offset/exp_stdout_stderr b/tools/tf_fuzz/regression/000022_SST_offset/exp_stdout_stderr
deleted file mode 100644
index c9d1a0f9a..000000000
--- a/tools/tf_fuzz/regression/000022_SST_offset/exp_stdout_stderr
+++ /dev/null
@@ -1,35 +0,0 @@
-Trusted Firmware Fuzzer (TF-Fuzz) starting...
-
-Info: random seed was not specified.
-
-Using seed value of \d+ \(0x[a-f\d]+\).
-Purpose line: to set an offset on psa_ps_get()
-ASSET_IDENTIFIER: "whoNose"
-Asset identifier list: "data"
-Create from random data
-Set SST command: ";"
-Appended to end of call sequence: SST-set call.
-Set command: ";"
-Command with no expect: ";"
-ASSET_IDENTIFIER: "whoNose"
-Asset identifier list: "print"
-Read log to test log: "print"
-SST-data offset: "10"
-SST data offset
-10"
-SST-read arguments: 10"
-Read SST command: "10"
-Appended to end of call sequence: SST-get call.
-Read command: "10"
-Command with no expect: ";"
-Lines: Line number 4.
-Lines: Line number 4.
-Lines: Line number 4.
-Call sequence generated.
-Simulating call sequence...
-Call sequence:
- SST-set call for asset whoNose
- SST-get call for asset whoNose
-Writing test file, ./test.c.
-
-TF-Fuzz test generation complete.
diff --git a/tools/tf_fuzz/regression/000022_SST_offset/exp_test.c b/tools/tf_fuzz/regression/000022_SST_offset/exp_test.c
deleted file mode 100644
index 03523dc01..000000000
--- a/tools/tf_fuzz/regression/000022_SST_offset/exp_test.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Test purpose:
- * to set an offset on psa_ps_get()
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <string.h>
-#include <stdint.h>
-
-#include "../sst/non_secure/ns_test_helpers.h"
-#include "psa/protected_storage.h"
-#include "test/framework/test_framework_helpers.h"
-#include "tfm_memory_utils.h"
-#include "psa/crypto.h"
-#include "psa/crypto_sizes.h"
-
-/* This is not yet right for how to run a test; need to register tests, etc. */
-
-void test_thread (struct test_result_t *ret) {
- psa_status_t crypto_status; /* result from Crypto calls */
- psa_status_t sst_status;
- /* Variables (etc.) to initialize and check PSA assets: */
- static uint8_t whoNose_set_data\[\] = "@@012@10@@[a-z\ ]*[\.\?\!]";
- static uint32_t whoNose_set_length = \d+;
- static uint8_t whoNose_act_data\[2048\] = "[A-Z][a-z\ ]*[\.\?\!]";
- static size_t whoNose_act_length = \d+;
- (void)sst_status;
- /* "void" to prevent unused-variable warning, since the variable may not
- * be used in this particular test case.
- */
-
- crypto_status = psa_crypto_init();
- if (crypto_status != PSA_SUCCESS) {
- TEST_FAIL("Could not initialize Crypto.");
- return;
- }
-
- TEST_LOG("Test to set an offset on psa_ps_get()");
-
-
- /* PSA calls to test: */
- /\* Creating SST asset "whoNose," with data "@@012@10@@...". \*/
- sst_status = psa_ps_set\(@@@001@@@, whoNose_set_length, whoNose_set_data,
- PSA_STORAGE_FLAG_[A-Z_]+\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- sst_status = psa_ps_get\(@@@001@@@, 10, \d+, whoNose_act_data,
- &whoNose_act_length);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_get() expected PSA_SUCCESS.");
- return;
- }
- TEST_LOG\(\"whoNose_act_data\"\);
-
-
- /* Removing assets left over from testing: */
- psa_ps_remove\(@@@001@@@\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
-
- /* Test completed */
- ret->val = TEST_PASSED;
-}
diff --git a/tools/tf_fuzz/regression/000022_SST_offset/template b/tools/tf_fuzz/regression/000022_SST_offset/template
deleted file mode 100644
index 9fa46e9f8..000000000
--- a/tools/tf_fuzz/regression/000022_SST_offset/template
+++ /dev/null
@@ -1,3 +0,0 @@
-purpose to set an offset on psa_ps_get();
-set sst name whoNose data *;
-read sst name whoNose print offset 10;
diff --git a/tools/tf_fuzz/regression/000023_SST_creation_flags/check.py b/tools/tf_fuzz/regression/000023_SST_creation_flags/check.py
deleted file mode 100644
index 2027be87e..000000000
--- a/tools/tf_fuzz/regression/000023_SST_creation_flags/check.py
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2019-2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-'''
- Please read .../tf_fuzz/regression/README to understand this code.
-
- Please also read the comments in .../tf_fuzz/regression/regress_lib/line_by_line.py.
-'''
-
-import sys, os, re, string, pdb
-sys.path.append ("../regress_lib")
-import line_by_line
-
-
-# Describe script usage:
-def usage():
- print ('''
- Command-line parameters:
- 1. The test-template file, nominally named "template",
- 2. The expected combined stdout/stderr output, nominally named "exp_stdout_stderr",
- 3. The actual/generated combined stdout/stderr output, nominally named "stdout_stderr",
- 4. The expected .c test file, nominally named "exp_test.c", and
- 5. The actual, generated .c test file, nominally named "test.c".
-
- Optionally, *before* these five arguments, you may add switches thus:
- "--v" for verbose mode, to view line-by-line comparisons actual vs. expected,
- "--q" to only print error messages and a successful-completion message,
- "--qq" same as --q but not even printing out the completion message, and
- "--s 12345" to run TF-Fuzz with seed value 12345 (or whatever).
- ''')
-
-
-def main():
- # See if we're supposed to be quiet:
- loud = quiet = ultra_quiet = False
- seed = ""
- while sys.argv[1][0] == "-":
- if sys.argv[1] == "--v":
- loud = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--q":
- quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--qq":
- quiet = ultra_quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--s":
- sys.argv.pop(1)
- seed = sys.argv[1]
- sys.argv.pop(1)
- if not seed.isnumeric():
- print ('The --s seed argument was not a number.')
- usage()
- sys.exit(1)
-
- # Run TF-Fuzz:
- if not quiet: print ("Running TF-Fuzz... ")
- os.system ('rm -f stdout_stderr test.c')
- command = '../../tfz -v ./' + sys.argv[1] + ' ./' + sys.argv[5]
- command += ' ' + seed + ' >' + sys.argv[3] + ' 2>&1'
- if loud:
- print (command)
- if os.system (command) == 0:
- if not quiet: print ("TF-Fuzz run complete.")
- else:
- print ('Could not run TF-Fuzz; please see stdout_stderr file.')
- sys.exit(2)
-
- # Attempt to open files indicated on command line:
- if len(sys.argv) != 6:
- message = '{} requires 5 command-line arguments. Exiting.'
- print (message.format(sys.argv[0]), file=sys.stderr)
- usage()
- sys.exit(3)
- template_file_name = sys.argv[1]
- exp_stdout_file_name = sys.argv[2]
- act_stdout_file_name = sys.argv[3]
- exp_test_file_name = sys.argv[4]
- act_test_file_name = sys.argv[5]
-
- try:
- template_file = open (template_file_name, 'rt')
- exp_stdout_file = open (exp_stdout_file_name, 'rt')
- act_stdout_file = open (act_stdout_file_name, 'rt')
- exp_test_file = open (exp_test_file_name, 'rt')
- act_test_file = open (act_test_file_name, 'rt')
- except FileNotFoundError:
- print ('One or more files could not be found.')
- usage();
- sys.exit(4)
- except:
- print ('Something went wrong trying to open the input files.')
- usage();
- sys.exit(5)
- else:
- message = '\nInput files:\n {},\n {},\n {},\n'
- message += ' {}, and\n {}\nopened successfully.\n'
- if not quiet:
- print (message.format (template_file_name, exp_stdout_file_name,
- act_stdout_file_name, exp_test_file_name, act_test_file_name))
-
- # Check it all:
- if not quiet: print ("\nChecking test C file: ", end="")
- line_by_line.check_file ( exp_test_file, exp_test_file_name,
- act_test_file, act_test_file_name,
- loud, quiet, ultra_quiet )
- if not quiet: print ("Checking stdout and stderr: ", end="")
- line_by_line.check_file ( exp_stdout_file, exp_stdout_file_name,
- act_stdout_file, act_stdout_file_name,
- loud, quiet, ultra_quiet )
-
- # Ran to completion normally, so pass:
- if not ultra_quiet: print ("Regression test passed.")
- sys.exit(0)
-
-if __name__ == "__main__": main()
diff --git a/tools/tf_fuzz/regression/000023_SST_creation_flags/exp_stdout_stderr b/tools/tf_fuzz/regression/000023_SST_creation_flags/exp_stdout_stderr
deleted file mode 100644
index 2b6ab80c1..000000000
--- a/tools/tf_fuzz/regression/000023_SST_creation_flags/exp_stdout_stderr
+++ /dev/null
@@ -1,89 +0,0 @@
-Trusted Firmware Fuzzer (TF-Fuzz) starting...
-
-Info: random seed was not specified.
-
-Using seed value of \d+ \(0x[a-f\d]+\).
-Purpose line: to set SST creation flags
-ASSET_IDENTIFIER: "hasCF"
-Asset identifier list: "data"
-LITERAL string: "this asset has write-once"
-Create from literal data: ""this asset has write-once""
-SST write-once flag: write_once"
-SST creation flag
-;"
-SST creation flags
-;"
-Set SST command: ";"
-Appended to end of call sequence: SST-set call.
-Set command: ";"
-Command with no expect: ";"
-ASSET_IDENTIFIER: "hasCF2"
-Asset identifier list: "data"
-LITERAL string: "this asset has also write-once"
-Create from literal data: ""this asset has also write-once""
-SST write-once flag: wo"
-SST creation flag
-;"
-SST creation flags
-;"
-Set SST command: ";"
-Appended to end of call sequence: SST-set call.
-Set command: ";"
-Command with no expect: ";"
-ASSET_IDENTIFIER: "alsoHasCF"
-Asset identifier list: "data"
-LITERAL string: "this asset has no flags"
-Create from literal data: ""this asset has no flags""
-SST no storage flag: none"
-SST creation flag
-expect"
-SST creation flags
-expect"
-Set SST command: "expect"
-Appended to end of call sequence: SST-set call.
-Set command: "expect"
-Expect pass clause: "pass"
-Command with expect: ";"
-ASSET_IDENTIFIER: "alsoHasCF2"
-Asset identifier list: "data"
-LITERAL string: "this asset has NO_CONFIDENTIALITY"
-Create from literal data: ""this asset has NO_CONFIDENTIALITY""
-SST no-confidentiality flag: ncf"
-SST creation flag
-;"
-SST creation flags
-;"
-Set SST command: ";"
-Appended to end of call sequence: SST-set call.
-Set command: ";"
-Command with no expect: ";"
-ASSET_IDENTIFIER: "yetAnother"
-Asset identifier list: "data"
-LITERAL string: "this asset has NO_REPLAY_PROTECTION"
-Create from literal data: ""this asset has NO_REPLAY_PROTECTION""
-SST no-replay-protection flag: nrp"
-SST creation flag
-;"
-SST creation flags
-;"
-Set SST command: ";"
-Appended to end of call sequence: SST-set call.
-Set command: ";"
-Command with no expect: ";"
-Lines: Line number 7.
-Lines: Line number 7.
-Lines: Line number 7.
-Lines: Line number 7.
-Lines: Line number 7.
-Lines: Line number 7.
-Call sequence generated.
-Simulating call sequence...
-Call sequence:
- SST-set call for asset hasCF
- SST-set call for asset hasCF2
- SST-set call for asset alsoHasCF
- SST-set call for asset alsoHasCF2
- SST-set call for asset yetAnother
-Writing test file, ./test.c.
-
-TF-Fuzz test generation complete.
diff --git a/tools/tf_fuzz/regression/000023_SST_creation_flags/exp_test.c b/tools/tf_fuzz/regression/000023_SST_creation_flags/exp_test.c
deleted file mode 100644
index 9dbe4cf35..000000000
--- a/tools/tf_fuzz/regression/000023_SST_creation_flags/exp_test.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Test purpose:
- * to set SST creation flags
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <string.h>
-#include <stdint.h>
-
-#include "../sst/non_secure/ns_test_helpers.h"
-#include "psa/protected_storage.h"
-#include "test/framework/test_framework_helpers.h"
-#include "tfm_memory_utils.h"
-#include "psa/crypto.h"
-#include "psa/crypto_sizes.h"
-
-/* This is not yet right for how to run a test; need to register tests, etc. */
-
-void test_thread (struct test_result_t *ret) {
- psa_status_t crypto_status; /* result from Crypto calls */
- psa_status_t sst_status;
- /* Variables (etc.) to initialize and check PSA assets: */
- static uint8_t hasCF_set_data[] = "this asset has write-once";
- static uint32_t hasCF_set_length = 25;
- static uint8_t hasCF2_set_data[] = "this asset has also write-once";
- static uint32_t hasCF2_set_length = 30;
- static uint8_t alsoHasCF_set_data[] = "this asset has no flags";
- static uint32_t alsoHasCF_set_length = 23;
- static uint8_t alsoHasCF2_set_data[] = "this asset has NO_CONFIDENTIALITY";
- static uint32_t alsoHasCF2_set_length = 33;
- static uint8_t yetAnother_set_data[] = "this asset has NO_REPLAY_PROTECTION";
- static uint32_t yetAnother_set_length = 35;
- (void)sst_status;
- /* "void" to prevent unused-variable warning, since the variable may not
- * be used in this particular test case.
- */
-
- crypto_status = psa_crypto_init();
- if (crypto_status != PSA_SUCCESS) {
- TEST_FAIL("Could not initialize Crypto.");
- return;
- }
-
- TEST_LOG("Test to set SST creation flags");
-
-
- /* PSA calls to test: */
- /* Creating SST asset "hasCF," with data "this asset...". */
- sst_status = psa_ps_set\(@@@001@@@, hasCF_set_length, hasCF_set_data,
- PSA_STORAGE_FLAG_WRITE_ONCE);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- /* Creating SST asset "hasCF2," with data "this asset...". */
- sst_status = psa_ps_set\(@@@002@@@, hasCF2_set_length, hasCF2_set_data,
- PSA_STORAGE_FLAG_WRITE_ONCE);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- /* Creating SST asset "alsoHasCF," with data "this asset...". */
- sst_status = psa_ps_set\(@@@003@@@, alsoHasCF_set_length, alsoHasCF_set_data,
- PSA_STORAGE_FLAG_NONE);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- /* Creating SST asset "alsoHasCF2," with data "this asset...". */
- sst_status = psa_ps_set\(@@@004@@@, alsoHasCF2_set_length, alsoHasCF2_set_data,
- PSA_STORAGE_FLAG_NO_CONFIDENTIALITY);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- /* Creating SST asset "yetAnother," with data "this asset...". */
- sst_status = psa_ps_set\(@@@005@@@, yetAnother_set_length, yetAnother_set_data,
- PSA_STORAGE_FLAG_NO_REPLAY_PROTECTION);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
-
-
- /* Removing assets left over from testing: */
- psa_ps_remove\(@@@001@@@\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
- psa_ps_remove\(@@@002@@@\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
- psa_ps_remove\(@@@003@@@\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
- psa_ps_remove\(@@@004@@@\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
- psa_ps_remove\(@@@005@@@\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
-
- /* Test completed */
- ret->val = TEST_PASSED;
-}
diff --git a/tools/tf_fuzz/regression/000023_SST_creation_flags/template b/tools/tf_fuzz/regression/000023_SST_creation_flags/template
deleted file mode 100644
index 5cfa287e3..000000000
--- a/tools/tf_fuzz/regression/000023_SST_creation_flags/template
+++ /dev/null
@@ -1,6 +0,0 @@
-purpose to set SST creation flags;
-set sst name hasCF data "this asset has write-once" flag write_once;
-set sst name hasCF2 data "this asset has also write-once" flag wo;
-set sst name alsoHasCF data "this asset has no flags" flag none expect pass;
-set sst name alsoHasCF2 data "this asset has NO_CONFIDENTIALITY" flag ncf;
-set sst name yetAnother data "this asset has NO_REPLAY_PROTECTION" flag nrp;
diff --git a/tools/tf_fuzz/regression/000024_SST_write_once/check.py b/tools/tf_fuzz/regression/000024_SST_write_once/check.py
deleted file mode 100644
index 2027be87e..000000000
--- a/tools/tf_fuzz/regression/000024_SST_write_once/check.py
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2019-2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-'''
- Please read .../tf_fuzz/regression/README to understand this code.
-
- Please also read the comments in .../tf_fuzz/regression/regress_lib/line_by_line.py.
-'''
-
-import sys, os, re, string, pdb
-sys.path.append ("../regress_lib")
-import line_by_line
-
-
-# Describe script usage:
-def usage():
- print ('''
- Command-line parameters:
- 1. The test-template file, nominally named "template",
- 2. The expected combined stdout/stderr output, nominally named "exp_stdout_stderr",
- 3. The actual/generated combined stdout/stderr output, nominally named "stdout_stderr",
- 4. The expected .c test file, nominally named "exp_test.c", and
- 5. The actual, generated .c test file, nominally named "test.c".
-
- Optionally, *before* these five arguments, you may add switches thus:
- "--v" for verbose mode, to view line-by-line comparisons actual vs. expected,
- "--q" to only print error messages and a successful-completion message,
- "--qq" same as --q but not even printing out the completion message, and
- "--s 12345" to run TF-Fuzz with seed value 12345 (or whatever).
- ''')
-
-
-def main():
- # See if we're supposed to be quiet:
- loud = quiet = ultra_quiet = False
- seed = ""
- while sys.argv[1][0] == "-":
- if sys.argv[1] == "--v":
- loud = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--q":
- quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--qq":
- quiet = ultra_quiet = True
- sys.argv.pop(1)
- elif sys.argv[1] == "--s":
- sys.argv.pop(1)
- seed = sys.argv[1]
- sys.argv.pop(1)
- if not seed.isnumeric():
- print ('The --s seed argument was not a number.')
- usage()
- sys.exit(1)
-
- # Run TF-Fuzz:
- if not quiet: print ("Running TF-Fuzz... ")
- os.system ('rm -f stdout_stderr test.c')
- command = '../../tfz -v ./' + sys.argv[1] + ' ./' + sys.argv[5]
- command += ' ' + seed + ' >' + sys.argv[3] + ' 2>&1'
- if loud:
- print (command)
- if os.system (command) == 0:
- if not quiet: print ("TF-Fuzz run complete.")
- else:
- print ('Could not run TF-Fuzz; please see stdout_stderr file.')
- sys.exit(2)
-
- # Attempt to open files indicated on command line:
- if len(sys.argv) != 6:
- message = '{} requires 5 command-line arguments. Exiting.'
- print (message.format(sys.argv[0]), file=sys.stderr)
- usage()
- sys.exit(3)
- template_file_name = sys.argv[1]
- exp_stdout_file_name = sys.argv[2]
- act_stdout_file_name = sys.argv[3]
- exp_test_file_name = sys.argv[4]
- act_test_file_name = sys.argv[5]
-
- try:
- template_file = open (template_file_name, 'rt')
- exp_stdout_file = open (exp_stdout_file_name, 'rt')
- act_stdout_file = open (act_stdout_file_name, 'rt')
- exp_test_file = open (exp_test_file_name, 'rt')
- act_test_file = open (act_test_file_name, 'rt')
- except FileNotFoundError:
- print ('One or more files could not be found.')
- usage();
- sys.exit(4)
- except:
- print ('Something went wrong trying to open the input files.')
- usage();
- sys.exit(5)
- else:
- message = '\nInput files:\n {},\n {},\n {},\n'
- message += ' {}, and\n {}\nopened successfully.\n'
- if not quiet:
- print (message.format (template_file_name, exp_stdout_file_name,
- act_stdout_file_name, exp_test_file_name, act_test_file_name))
-
- # Check it all:
- if not quiet: print ("\nChecking test C file: ", end="")
- line_by_line.check_file ( exp_test_file, exp_test_file_name,
- act_test_file, act_test_file_name,
- loud, quiet, ultra_quiet )
- if not quiet: print ("Checking stdout and stderr: ", end="")
- line_by_line.check_file ( exp_stdout_file, exp_stdout_file_name,
- act_stdout_file, act_stdout_file_name,
- loud, quiet, ultra_quiet )
-
- # Ran to completion normally, so pass:
- if not ultra_quiet: print ("Regression test passed.")
- sys.exit(0)
-
-if __name__ == "__main__": main()
diff --git a/tools/tf_fuzz/regression/000024_SST_write_once/exp_stdout_stderr b/tools/tf_fuzz/regression/000024_SST_write_once/exp_stdout_stderr
deleted file mode 100644
index 2273c23f0..000000000
--- a/tools/tf_fuzz/regression/000024_SST_write_once/exp_stdout_stderr
+++ /dev/null
@@ -1,45 +0,0 @@
-Trusted Firmware Fuzzer (TF-Fuzz) starting...
-
-Info: random seed was not specified.
-
-Using seed value of \d+ \(0x[a-f\d]+\).
-Purpose line: to verify we can't write multiple times to a write-once SST asset
-ASSET_IDENTIFIER: "writeOnce"
-Asset identifier list: "data"
-Create from random data
-SST write-once flag: wo"
-SST creation flag
-;"
-SST creation flags
-;"
-Set SST command: ";"
-Appended to end of call sequence: SST-set call.
-Set command: ";"
-Command with no expect: ";"
-ASSET_IDENTIFIER: "writeOnce"
-Asset identifier list: "data"
-Create from random data
-Set SST command: ";"
-Appended to end of call sequence: SST-set call.
-Set command: ";"
-Command with no expect: ";"
-ASSET_IDENTIFIER: "writeOnce"
-Asset identifier list: "data"
-Create from random data
-Set SST command: ";"
-Appended to end of call sequence: SST-set call.
-Set command: ";"
-Command with no expect: ";"
-Lines: Line number 5.
-Lines: Line number 5.
-Lines: Line number 5.
-Lines: Line number 5.
-Call sequence generated.
-Simulating call sequence...
-Call sequence:
- SST-set call for asset writeOnce
- SST-set call for asset writeOnce
- SST-set call for asset writeOnce
-Writing test file, ./test.c.
-
-TF-Fuzz test generation complete.
diff --git a/tools/tf_fuzz/regression/000024_SST_write_once/exp_test.c b/tools/tf_fuzz/regression/000024_SST_write_once/exp_test.c
deleted file mode 100644
index 02d053055..000000000
--- a/tools/tf_fuzz/regression/000024_SST_write_once/exp_test.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Test purpose:
- * to verify we can't write multiple times to a write-once SST asset
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <string.h>
-#include <stdint.h>
-
-#include "../sst/non_secure/ns_test_helpers.h"
-#include "psa/protected_storage.h"
-#include "test/framework/test_framework_helpers.h"
-#include "tfm_memory_utils.h"
-#include "psa/crypto.h"
-#include "psa/crypto_sizes.h"
-
-/* This is not yet right for how to run a test; need to register tests, etc. */
-
-void test_thread (struct test_result_t *ret) {
- psa_status_t crypto_status; /* result from Crypto calls */
- psa_status_t sst_status;
- /* Variables (etc.) to initialize and check PSA assets: */
- static uint8_t writeOnce_set_data\[\] = "@@012@10@@[a-z\ ]*[\.\?\!]";
- static uint32_t writeOnce_set_length = \d+;
- static uint8_t writeOnce_set_data_1\[\] = "@@013@10@@[a-z\ ]*[\.\?\!]";
- static uint32_t writeOnce_set_length_1 = \d+;
- static uint8_t writeOnce_set_data_2\[\] = "@@014@10@@[a-z\ ]*[\.\?\!]";
- static uint32_t writeOnce_set_length_2 = \d+;
- (void)sst_status;
- /* "void" to prevent unused-variable warning, since the variable may not
- * be used in this particular test case.
- */
-
- crypto_status = psa_crypto_init();
- if (crypto_status != PSA_SUCCESS) {
- TEST_FAIL("Could not initialize Crypto.");
- return;
- }
-
- TEST_LOG("Test to verify we can't write multiple times to a write-once SST asset");
-
-
- /* PSA calls to test: */
- /\* Creating SST asset "writeOnce," with data "@@012@10@@...". \*/
- sst_status = psa_ps_set\(@@@001@@@, writeOnce_set_length, writeOnce_set_data,
- PSA_STORAGE_FLAG_WRITE_ONCE);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_SUCCESS.");
- return;
- }
- /\* Resetting SST asset "writeOnce," with data "@@013@10@@...". \*/
- sst_status = psa_ps_set\(@@@001@@@, writeOnce_set_length_1, writeOnce_set_data_1,
- PSA_STORAGE_FLAG_WRITE_ONCE);
- if (sst_status != PSA_ERROR_NOT_PERMITTED) {
- TEST_FAIL("psa_ps_set() expected PSA_ERROR_NOT_PERMITTED.");
- return;
- }
- /\* Resetting SST asset "writeOnce," with data "@@014@10@@...". \*/
- sst_status = psa_ps_set\(@@@001@@@, writeOnce_set_length_2, writeOnce_set_data_2,
- PSA_STORAGE_FLAG_WRITE_ONCE);
- if (sst_status != PSA_ERROR_NOT_PERMITTED) {
- TEST_FAIL("psa_ps_set() expected PSA_ERROR_NOT_PERMITTED.");
- return;
- }
-
-
- /* Removing assets left over from testing: */
- psa_ps_remove\(@@@001@@@\);
- if (sst_status != PSA_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion.");
- return;
- }
-
- /* Test completed */
- ret->val = TEST_PASSED;
-}
diff --git a/tools/tf_fuzz/regression/000024_SST_write_once/template b/tools/tf_fuzz/regression/000024_SST_write_once/template
deleted file mode 100644
index 60fc978bc..000000000
--- a/tools/tf_fuzz/regression/000024_SST_write_once/template
+++ /dev/null
@@ -1,4 +0,0 @@
-purpose to verify we can't write multiple times to a write-once SST asset;
-set sst name writeOnce data * flag wo;
-set sst name writeOnce data *;
-set sst name writeOnce data *;
diff --git a/tools/tf_fuzz/regression/README b/tools/tf_fuzz/regression/README
deleted file mode 100644
index d4fbcb686..000000000
--- a/tools/tf_fuzz/regression/README
+++ /dev/null
@@ -1,9 +0,0 @@
-This is a regression suite for the TF-Fuzz tool.
-
-For more information, please browse to:
-
- https://ci.trustedfirmware.org/job/tf-m-build-test-nightly/lastSuccessfulBuild/artifact/build-docs/tf-m_documents/install/doc/user_guide/html/docs/user_guides/tf_fuzz/~regression_dir.html
-
---------------
-
-*Copyright (c) 2019-2020, Arm Limited. All rights reserved.*
diff --git a/tools/tf_fuzz/regression/add_these_tests/000015_set_sst_multi_name_remove_rand_active/exp_stdout_stderr b/tools/tf_fuzz/regression/add_these_tests/000015_set_sst_multi_name_remove_rand_active/exp_stdout_stderr
deleted file mode 100644
index 3c5de3587..000000000
--- a/tools/tf_fuzz/regression/add_these_tests/000015_set_sst_multi_name_remove_rand_active/exp_stdout_stderr
+++ /dev/null
@@ -1,30 +0,0 @@
-Trusted Firmware Fuzzer (TF-Fuzz) starting...
-
-Info: random seed was not specified.
-
-Using seed value of \d+ \(0x[a-f\d]+\).
-Purpose line: to show a more-interesting removal case
-ASSET_IDENTIFIER: "president"
-ASSET_IDENTIFIER: "george"
-ASSET_IDENTIFIER: "herbert"
-ASSET_IDENTIFIER: "walker"
-ASSET_IDENTIFIER: "bush"
-Asset identifier list: "data"
-LITERAL string: "read my lips"
-Create from literal data: ""read my lips""
-Set SST command: ""read my lips""
-Set command: ""read my lips""
-Command with no expect: ";"
-SST-asset random active: "active"
-SST-remove arguments: "active"
-Remove SST command: "active"
-Remove command: "active"
-Command with no expect: ";"
-Lines: Line number 4.
-Lines: Line number 4.
-Lines: Line number 4.
-Call sequence generated.
-Simulating call sequence...
-Writing test file, ./test.c.
-
-TF-Fuzz test generation complete.
diff --git a/tools/tf_fuzz/regression/add_these_tests/000015_set_sst_multi_name_remove_rand_active/exp_test.c b/tools/tf_fuzz/regression/add_these_tests/000015_set_sst_multi_name_remove_rand_active/exp_test.c
deleted file mode 100644
index c0eddcd82..000000000
--- a/tools/tf_fuzz/regression/add_these_tests/000015_set_sst_multi_name_remove_rand_active/exp_test.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Test purpose:
- * to show a more-interesting removal case
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <string.h>
-#include <stdint.h>
-
-#include "../sst/non_secure/ns_test_helpers.h"
-#include "psa/protected_storage.h"
-#include "test/framework/test_framework_helpers.h"
-#include "tfm_memory_utils.h"
-#include "psa/crypto.h"
-#include "psa/crypto_sizes.h"
-/* For now, just a single test_result_t struct is sufficient.*/
-static struct test_result_t ret;
-
-/* This is not yet right for how to run a test; need to register tests, etc. */
-
-void test_thread (struct test_result_t *ret) {
- psa_status_t crypto_status; /* result from Crypto calls */
- psa_ps_status_t sst_status;
- /* Variables (etc.) to initialize and check PSA assets: */
- static uint8_t president_set_data[] = "read my lips";
- int president_set_length = 12;
- static uint8_t george_set_data[] = "read my lips";
- int george_set_length = 12;
- static uint8_t herbert_set_data[] = "read my lips";
- int herbert_set_length = 12;
- static uint8_t walker_set_data[] = "read my lips";
- int walker_set_length = 12;
- static uint8_t bush_set_data[] = "read my lips";
- int bush_set_length = 12;
-
- crypto_status = psa_crypto_init();
- if (crypto_status != PSA_SUCCESS) {
- TEST_FAIL("Could not initialize Crypto.");
- return;
- }
-
- TEST_LOG("Test to show a more-interesting removal case");
-
-
-
-
- /* PSA calls to test: */
-
- /* Creating SST asset "president," with data "read my li...". */
- sst_status = psa_ps_set(@@@001@@@, president_set_length, president_data, PSA_PS_FLAG_WRITE_ONCE);
- if (sst_status != PSA_PS_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_PS_SUCCESS, got #%d, (int) sst_status);
- return;
- }
-
- /* Creating SST asset "george," with data "read my li...". */
- sst_status = psa_ps_set(5517, george_set_length, george_data, PSA_PS_FLAG_WRITE_ONCE);
- if (sst_status != PSA_PS_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_PS_SUCCESS, got #%d, (int) sst_status);
- return;
- }
-
- /* Creating SST asset "herbert," with data "read my li...". */
- sst_status = psa_ps_set(4661, herbert_set_length, herbert_data, PSA_PS_FLAG_WRITE_ONCE);
- if (sst_status != PSA_PS_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_PS_SUCCESS, got #%d, (int) sst_status);
- return;
- }
-
- /* Creating SST asset "walker," with data "read my li...". */
- sst_status = psa_ps_set(3441, walker_set_length, walker_data, PSA_PS_FLAG_WRITE_ONCE);
- if (sst_status != PSA_PS_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_PS_SUCCESS, got #%d, (int) sst_status);
- return;
- }
-
- /* Creating SST asset "bush," with data "read my li...". */
- sst_status = psa_ps_set(5446, bush_set_length, bush_data, PSA_PS_FLAG_WRITE_ONCE);
- if (sst_status != PSA_PS_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_PS_SUCCESS, got #%d, (int) sst_status);
- return;
- }
-
- sst_status = psa_ps_remove(5517);
- if (sst_status != PSA_PS_SUCCESS) {
- TEST_FAIL("psa_ps_remove() expected PSA_PS_SUCCESS, got #%d", (int) sst_status);
- }
-
-
- /* Removing assets left over from testing: */
- psa_ps_remove(@@@001@@@);
- if (sst_status != PSA_PS_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion!");
- return;
- }
- psa_ps_remove(4661);
- if (sst_status != PSA_PS_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion!");
- return;
- }
- psa_ps_remove(3441);
- if (sst_status != PSA_PS_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion!");
- return;
- }
- psa_ps_remove(5446);
- if (sst_status != PSA_PS_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion!");
- return;
- }
-
- /* Test completed */
- ret->val = TEST_PASSED;
-}
diff --git a/tools/tf_fuzz/regression/add_these_tests/000015_set_sst_multi_name_remove_rand_active/template b/tools/tf_fuzz/regression/add_these_tests/000015_set_sst_multi_name_remove_rand_active/template
deleted file mode 100644
index 613439e69..000000000
--- a/tools/tf_fuzz/regression/add_these_tests/000015_set_sst_multi_name_remove_rand_active/template
+++ /dev/null
@@ -1,3 +0,0 @@
-purpose to show a more-interesting removal case;
-set sst name president george herbert walker bush data "read my lips";
-remove sst *active; // remove *some* active asset
diff --git a/tools/tf_fuzz/regression/add_these_tests/000016_set_sst_multi_name_remove_multi_rand_active_remove_rand_deleted/exp_stdout_stderr b/tools/tf_fuzz/regression/add_these_tests/000016_set_sst_multi_name_remove_multi_rand_active_remove_rand_deleted/exp_stdout_stderr
deleted file mode 100644
index bdeffb79f..000000000
--- a/tools/tf_fuzz/regression/add_these_tests/000016_set_sst_multi_name_remove_multi_rand_active_remove_rand_deleted/exp_stdout_stderr
+++ /dev/null
@@ -1,48 +0,0 @@
-Trusted Firmware Fuzzer (TF-Fuzz) starting...
-
-Info: random seed was not specified.
-
-Using seed value of \d+ \(0x[a-f\d]+\).
-Purpose line: to show a more-interesting removal case
-ASSET_IDENTIFIER: "president"
-ASSET_IDENTIFIER: "george"
-ASSET_IDENTIFIER: "herbert"
-ASSET_IDENTIFIER: "walker"
-ASSET_IDENTIFIER: "bush"
-Asset identifier list: "data"
-LITERAL string: "no new taxes"
-Create from literal data: ""no new taxes""
-Set SST command: ""no new taxes""
-Set command: ""no new taxes""
-Command with no expect: ";"
-SST-asset random active: "active"
-SST-remove arguments: "active"
-Remove SST command: "active"
-Remove command: "active"
-Command with no expect: ";"
-SST-asset random active: "active"
-SST-remove arguments: "active"
-Remove SST command: "active"
-Remove command: "active"
-Command with no expect: ";"
-SST-asset random active: "active"
-SST-remove arguments: "active"
-Remove SST command: "active"
-Remove command: "active"
-Command with no expect: ";"
-SST-asset random deleted: "deleted"
-SST-remove arguments: "deleted"
-Remove SST command: "deleted"
-Remove command: "deleted"
-Command with no expect: ";"
-Lines: Line number 7.
-Lines: Line number 7.
-Lines: Line number 7.
-Lines: Line number 7.
-Lines: Line number 7.
-Lines: Line number 7.
-Call sequence generated.
-Simulating call sequence...
-Writing test file, ./test.c.
-
-TF-Fuzz test generation complete.
diff --git a/tools/tf_fuzz/regression/add_these_tests/000016_set_sst_multi_name_remove_multi_rand_active_remove_rand_deleted/exp_test.c b/tools/tf_fuzz/regression/add_these_tests/000016_set_sst_multi_name_remove_multi_rand_active_remove_rand_deleted/exp_test.c
deleted file mode 100644
index c2752fb87..000000000
--- a/tools/tf_fuzz/regression/add_these_tests/000016_set_sst_multi_name_remove_multi_rand_active_remove_rand_deleted/exp_test.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Test purpose:
- * to show a more-interesting removal case
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <string.h>
-#include <stdint.h>
-
-#include "../sst/non_secure/ns_test_helpers.h"
-#include "psa/protected_storage.h"
-#include "test/framework/test_framework_helpers.h"
-#include "tfm_memory_utils.h"
-#include "psa/crypto.h"
-#include "psa/crypto_sizes.h"
-/* For now, just a single test_result_t struct is sufficient.*/
-static struct test_result_t ret;
-
-/* This is not yet right for how to run a test; need to register tests, etc. */
-
-void test_thread (struct test_result_t *ret) {
- psa_status_t crypto_status; /* result from Crypto calls */
- psa_ps_status_t sst_status;
- /* Variables (etc.) to initialize and check PSA assets: */
- static uint8_t president_set_data[] = "no new taxes";
- int president_set_length = 12;
- static uint8_t george_set_data[] = "no new taxes";
- int george_set_length = 12;
- static uint8_t herbert_set_data[] = "no new taxes";
- int herbert_set_length = 12;
- static uint8_t walker_set_data[] = "no new taxes";
- int walker_set_length = 12;
- static uint8_t bush_set_data[] = "no new taxes";
- int bush_set_length = 12;
-
- crypto_status = psa_crypto_init();
- if (crypto_status != PSA_SUCCESS) {
- TEST_FAIL("Could not initialize Crypto.");
- return;
- }
-
- TEST_LOG("Test to show a more-interesting removal case");
-
-
-
-
- /* PSA calls to test: */
-
- /* Creating SST asset "president," with data "no new tax...". */
- sst_status = psa_ps_set(4713, president_set_length, president_set_data,
- PSA_PS_FLAG_WRITE_ONCE);
- if (sst_status != PSA_PS_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_PS_SUCCESS, got #%d, (int) sst_status);
- return;
- }
-
- /* Creating SST asset "george," with data "no new tax...". */
- sst_status = psa_ps_set(5517, george_set_length, george_data, PSA_PS_FLAG_WRITE_ONCE);
- if (sst_status != PSA_PS_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_PS_SUCCESS, got #%d, (int) sst_status);
- return;
- }
-
- /* Creating SST asset "herbert," with data "no new tax...". */
- sst_status = psa_ps_set(4661, herbert_set_length, herbert_data, PSA_PS_FLAG_WRITE_ONCE);
- if (sst_status != PSA_PS_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_PS_SUCCESS, got #%d, (int) sst_status);
- return;
- }
-
- /* Creating SST asset "walker," with data "no new tax...". */
- sst_status = psa_ps_set(3441, walker_set_length, walker_data, PSA_PS_FLAG_WRITE_ONCE);
- if (sst_status != PSA_PS_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_PS_SUCCESS, got #%d, (int) sst_status);
- return;
- }
-
- /* Creating SST asset "bush," with data "no new tax...". */
- sst_status = psa_ps_set(5446, bush_set_length, bush_data, PSA_PS_FLAG_WRITE_ONCE);
- if (sst_status != PSA_PS_SUCCESS) {
- TEST_FAIL("psa_ps_set() expected PSA_PS_SUCCESS, got #%d, (int) sst_status);
- return;
- }
-
- sst_status = psa_ps_remove(5517);
- if (sst_status != PSA_PS_SUCCESS) {
- TEST_FAIL("psa_ps_remove() expected PSA_PS_SUCCESS, got #%d", (int) sst_status);
- }
-
- sst_status = psa_ps_remove(4713);
- if (sst_status != PSA_PS_SUCCESS) {
- TEST_FAIL("psa_ps_remove() expected PSA_PS_SUCCESS, got #%d", (int) sst_status);
- }
-
- sst_status = psa_ps_remove(3441);
- if (sst_status != PSA_PS_SUCCESS) {
- TEST_FAIL("psa_ps_remove() expected PSA_PS_SUCCESS, got #%d", (int) sst_status);
- }
-
- sst_status = psa_ps_remove(3441);
- if (sst_status != PSA_PS_ERROR_UID_NOT_FOUND) {
- TEST_FAIL("psa_ps_remove() expected PSA_PS_ERROR_UID_NOT_FOUND, got #%d", (int) sst_status);
- }
-
-
- /* Removing assets left over from testing: */
- psa_ps_remove(4661);
- if (sst_status != PSA_PS_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion!");
- return;
- }
- psa_ps_remove(5446);
- if (sst_status != PSA_PS_SUCCESS) {
- TEST_FAIL("Failed to tear down an SST asset upon test completion!");
- return;
- }
-
- /* Test completed */
- ret->val = TEST_PASSED;
-}
diff --git a/tools/tf_fuzz/regression/add_these_tests/000016_set_sst_multi_name_remove_multi_rand_active_remove_rand_deleted/template b/tools/tf_fuzz/regression/add_these_tests/000016_set_sst_multi_name_remove_multi_rand_active_remove_rand_deleted/template
deleted file mode 100644
index 2bf82b09c..000000000
--- a/tools/tf_fuzz/regression/add_these_tests/000016_set_sst_multi_name_remove_multi_rand_active_remove_rand_deleted/template
+++ /dev/null
@@ -1,6 +0,0 @@
-purpose to show a more-interesting removal case;
-set sst name president george herbert walker bush data "no new taxes";
-remove sst *active; // remove *some* active asset
-rm sst *active; // remove *some other* active asset
-rm sst *act; // remove *yet another* active asset
-remove sst *del; // attempt to remove some asset that's already been removed
diff --git a/tools/tf_fuzz/regression/regress b/tools/tf_fuzz/regression/regress
deleted file mode 100644
index 1a2b59567..000000000
--- a/tools/tf_fuzz/regression/regress
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright (c) 2019-2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-echo
-echo TF-Fuzz Regression Testing
-echo
-for reg_test in `ls -F | grep \/$ | grep -v add_these_tests | grep -v regress_lib`; do
- echo
- echo Running "$reg_test"...
- cd $reg_test
- rm -f test.c stdout_stderr
- python3 check.py --q template exp_stdout_stderr stdout_stderr exp_test.c test.c
- if test $? -ne 0
- then
- exit
- fi
- cd ..
-done
-echo
-echo
-echo All TF-Fuzz regression tests passed.
diff --git a/tools/tf_fuzz/regression/regress_lib/line_by_line.py b/tools/tf_fuzz/regression/regress_lib/line_by_line.py
deleted file mode 100644
index f09a0383f..000000000
--- a/tools/tf_fuzz/regression/regress_lib/line_by_line.py
+++ /dev/null
@@ -1,172 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2019-2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-'''
-The functions here perform straight-forward line-by-line comparisons of regression
-TF-Fuzz regression tests. These are not sufficient to address cases where the PSA
-calls are randomized.
-
-Each given line of the expected files (exp_stdout_stderr and exp_test.c) functions
-as Python regex for the corresonding line in the actual/generated corresponding
-file. Actually, the expected-file lines may need a little bit of tweaking first.
-There are three scenarios:
-* The line in exp_* file contains no regex content at all. In this case, the two
- lines must be exactly identical, character for character. The actual/generated
- output files do not contain regexes, but can contain parentheses or other
- characters that "look like" regex content, and thus confuse re.match(). So,
- it's first checked for an exact string == match.
-* The line in the exp_* file contains one or more standard-Python regex patterns
- to match. In this case, a Python re.match() will still report a match.
-* The line in the exp_* file contains one or more non-standard regex pattern, in
- which case that non-standard regex pattern needs to be replaced with the actual,
- expected character string.
-
-As described in the above-cited README, these non-standard regex wildcards in the
-exp_* files take either of two formats:
-* "@@@" a 3-digit pattern number "@@@" (e.g., "@@@005@@@"): This denotes a
- pattern of no particular length that must match the same text every occurrence
- in the actual/generated file.
-* "@@" a 3-digit pattern number "@" a 2-digit length in chars "@@": Same idea as
- the previous pattern, except that it also has a specific length.
-
-To address these special regex wildcards, check_gen_test() below has to:
-1. Isolate the wildcard from the rest of the string,
-2. Check that wildcard against a Python dictionary relating the wildcard name to
- its expected-text substitution value,
-3. If not present in the dictionary, create a new dictionary entry relating the
- wildcard text to the text found in that spot in the actual/generated file,
-4. Replace that wildcard text with the expected value from the hash, then
-5. As with all lines, perform the re.match() between the two lines.
-'''
-
-import sys, os, re, string, pdb
-
-
-'''
-mask_other_wildcards(), used by resolve_wildcards() below, is used in harvesting
-the value of a certain wildcard of the sort described above. After the caller
-replaces the wildcard of interest with a regex to retrieve that data from actual-
-output file, it passes the string into here, to replace all other wildcards with
-"anything goes" regexes.
-'''
-def mask_other_wildcards (a_string):
- # Unsized wildcards:
- while True:
- matchInfo = re.match ('.*(@@@\d\d\d@@@)', a_string)
- if not matchInfo:
- break
- wildcard = matchInfo.group(1)
- a_string = a_string.replace (wildcard, '.*')
- # Sized wildcards:
- while True:
- matchInfo = re.match ('.*(@@\d\d\d@\d\d@@)', a_string)
- if not matchInfo:
- break
- wildcard = matchInfo.group(1)
- a_string = a_string.replace (wildcard, '.*')
- return a_string
-
-
-'''
-resolve_wildcards() resolves wildcards of the sort described above, in an expected
-file line (exp) from a wildcard dictionary (wildcard_dict). In particular, it
-replaces them with what the wildcards are found to stand for in the actual test
-output (act). If it encounters a wildcard it has not seen before, it adds it to
-the dictionary, based upon what's in the test.c output. Further occurrences of that
-wildcard, it pulls from the wildcard dictionary, meaning that the subsequent
-occurrences must resolve to the same text string.
-'''
-def resolve_wildcards (exp, act, wildcard_dict):
- # Loop through each wildcard on the line, filling them in with values from the
- # wildcard dictionary, or filling them into the wildcard dictionary.
-
- #pdb.set_trace()
-
- while True:
- wildcard_sized = False
- matchInfo = re.match ('.*(@@@\d\d\d@@@)', exp)
- if not matchInfo:
- wildcard_sized = True
- # 0 = sized, and we'll fill in that size below, if we don't already know
- matchInfo = re.match ('.*(@@\d\d\d@\d\d@@)', exp)
- if not matchInfo:
- break
- wildcard = matchInfo.group(1)
- if wildcard in wildcard_dict:
- # Previously-encountered wildcard:
- wildcard_value = wildcard_dict[wildcard]
- else:
- # New wildcard:
- if wildcard_sized: # find the size
- size_str = re.match ("@@\d\d\d@(\d\d)@@",wildcard).group(1)
- find_sub = exp.replace (wildcard, '(.{' + size_str + '})', 1)
- else:
- find_sub = exp.replace (wildcard, '(.*)', 1)
- find_sub = mask_other_wildcards (find_sub)
- matchInfo = re.match (find_sub, act)
- wildcard_value = matchInfo.group(1)
- wildcard_dict[wildcard] = wildcard_value
- exp = exp.replace (wildcard, wildcard_value)
- return exp
-
-'''
-check_file() checks that an actual-output test file (act_test_file) matches an
-expected-output file (exp_test_file), line by line, including resolving the
-wildcards of the nature described above.
-'''
-def check_file ( exp_test_file, exp_test_file_name,
- act_test_file, act_test_file_name,
- loud, quiet, ultra_quiet ):
- # This is the dictionary of wildcards, of the nature described above.
- wildcard_dict = dict()
-
- line_no = 0
- while True:
- exp_line = exp_test_file.readline()
- act_line = act_test_file.readline()
- # Ignore the special case where a seed was specified in generating actual,
- # but wasn't in expected file:
- if exp_line == 'Info: random seed was not specified.\n' and act_line == '\n':
- print ("(Note: Ignoring no-seed-specified message in expected.)")
- exp_line = exp_test_file.readline()
- line_no += 1
- if not quiet and not loud: print (".", end="")
- if not exp_line and act_line:
- message = "\nError: More lines in file {} than in {}."
- if not ultra_quiet:
- print (message.format(act_test_file_name, exp_test_file_name))
- sys.exit(8)
- elif not act_line and exp_line:
- message = "\nError: More lines in file {} than in {}."
- if not ultra_quiet:
- print (message.format(exp_test_file_name, act_test_file_name))
- sys.exit(9)
- # No line-count mismatch (so far); either both reads succeeded or both failed:
- if not exp_line:
- break # all lines read; kick out of the loop.
- exp_line = exp_line.rstrip(); act_line = act_line.rstrip()
- if loud and not quiet:
- print ("\n" + str(line_no) + "\nExpect: '" + exp_line + "'")
- print ("Actual: '" + act_line + "'")
- # If the two lines match as raw strings then we're good:
- if exp_line == act_line:
- pass # this line passes
- else:
- # Before doing a re.match() on this line pair, replace any nontraditional
- # wildcards with what they're expected to contain:
- if re.match (".*@@\d\d\d@", exp_line): # just to save time if no wildcards
- exp_line = resolve_wildcards (exp_line, act_line, wildcard_dict)
- if (exp_line == "" and act_line != "") or not re.match (exp_line, act_line):
- message = "\nError: At line {} mismatch between {} and {}:"
- message1 = " Expected: {}"
- message2 = " Got: {}\n"
- if not ultra_quiet:
- print (message.format(line_no, exp_test_file_name, act_test_file_name))
- print (message1.format(exp_line))
- print (message2.format(act_line))
- sys.exit(10)
- if not quiet: print ("\nGenerated file complies with expected file.")
-
-
diff --git a/tools/tf_fuzz/template/README b/tools/tf_fuzz/template/README
deleted file mode 100644
index 3cfc30974..000000000
--- a/tools/tf_fuzz/template/README
+++ /dev/null
@@ -1,10 +0,0 @@
-These classes describe "tracker" objects for parsing test templates, and for
-generating PSA calls from them.
-
-For more information, please browse to:
-
- https://ci.trustedfirmware.org/job/tf-m-build-test-nightly/lastSuccessfulBuild/artifact/build-docs/tf-m_documents/install/doc/user_guide/html/docs/user_guides/tf_fuzz/template_dir.html
-
---------------
-
-*Copyright (c) 2019-2020, Arm Limited. All rights reserved.*
diff --git a/tools/tf_fuzz/template/crypto_template_line.cpp b/tools/tf_fuzz/template/crypto_template_line.cpp
deleted file mode 100644
index 3cf8a352e..000000000
--- a/tools/tf_fuzz/template/crypto_template_line.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#include "class_forwards.hpp"
-
-#include "boilerplate.hpp"
-#include "gibberish.hpp"
-#include "compute.hpp"
-#include "data_blocks.hpp"
-#include "psa_asset.hpp"
-#include "find_or_create_asset.hpp"
-#include "template_line.hpp"
-#include "tf_fuzz.hpp"
-#include "crypto_asset.hpp"
-#include "psa_call.hpp"
-#include "crypto_call.hpp"
-#include "sst_asset.hpp"
-#include "crypto_asset.hpp"
-#include "crypto_template_line.hpp"
-
-
-
-/**********************************************************************************
- Methods of class set_policy_template_line follow:
-**********************************************************************************/
-
-set_policy_template_line::set_policy_template_line (tf_fuzz_info *resources)
- : policy_template_line (resources)
-{
- // No further setup to be performed.
- return; // just to have something to pin a breakpoint onto
-}
-
-// Default destructor:
-set_policy_template_line::~set_policy_template_line (void)
-{
- // TODO: Add an error for this being invoked.
- return; // just to have something to pin a breakpoint onto
-}
-
-// (Default constructor not used)
-
-
-/**********************************************************************************
- End of methods of class set_policy_template_line.
-**********************************************************************************/
-
-
-/**********************************************************************************
- Methods of cl