tf_fuzz: refactor includes to only include what is needed
* Refactor Makefile to automatically gather prerequisites.
* Change the includes (using include-what-you-need) so that files only
include the specific headers they need. Many includes are also now
inside the .hpp files instead of the .cpp files.
This improves editor support: previously, external symbols in .hpp
files would not be resolved by clangd due to .hpp files not having any
imports.
Change-Id: Iece03f81c35aa43ac026aaeb49b87d2c4acf07cd
Signed-off-by: Nik Dewally <Nik.Dewally@arm.com>
diff --git a/.gitignore b/.gitignore
index 6569474..c73ecb0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
+# Copyright (c) 2020-2024, Arm Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -24,6 +24,7 @@
build*
bin/
*.o
+*.d*
# bison and flex generated files
*.lex.*
diff --git a/tf_fuzz/tfz-cpp/Makefile b/tf_fuzz/tfz-cpp/Makefile
index 0e98dc6..488b675 100644
--- a/tf_fuzz/tfz-cpp/Makefile
+++ b/tf_fuzz/tfz-cpp/Makefile
@@ -1,60 +1,41 @@
-# Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+# Copyright (c) 2019-2024, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
-#
+
+CXX = g++
+INCLUDES = -I /usr/include -I . -I ./parser -I ./template -I ./assets -I ./calls -I ./boilerplate -I ./utility
+override CXXFLAGS += -std=gnu++11 -O0 -g $(INCLUDES)
+
+sources = $(wildcard assets/*.cpp) \
+ $(wildcard boilerplate/*.cpp) \
+ $(wildcard calls/*.cpp) \
+ $(wildcard template/*.cpp) \
+ $(wildcard utility/*.cpp) \
+ $(wildcard *.cpp)
+
+objs = $(sources:.cpp=.o)
+depends = $(sources:.cpp=.d)
+
+generated_sources = parser/tf_fuzz_grammar.tab.cpp parser/tf_fuzz_grammar.lex.c
+generated_objs = parser/tf_fuzz_grammar.tab.o parser/tf_fuzz_grammar.lex.o
+generated_includes = parser/tf_fuzz_grammar.tab.hpp
.PHONY: default
-default: tfz;
+default: $(generated_includes) 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 &
+# Automatically gather prerequisites
+# [GNU Make manual, section 4.14]
-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 &
+include $(depends)
-includes = -I . -I ./parser -I ./template -I ./assets -I ./calls -I ./boilerplate -I ./utility
+%.d: %.cpp $(generated_includes) $(generated_sources)
+ @set -e; rm -f $@; \
+ $(CXX) -M -MM $(CXXFLAGS) $< > $@.$$$$; \
+ sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
+ rm -f $@.$$$$
+
+tfz: $(generated_includes) $(generated_objs) $(objs) Makefile
+ $(CXX) $(CXXFLAGS) -o tfz $(generated_objs) $(objs)
parser/tf_fuzz_grammar.tab.hpp: parser/tf_fuzz_grammar.y class_forwards.hpp \
boilerplate/boilerplate.hpp utility/gibberish.hpp utility/string_ops.hpp \
@@ -81,150 +62,19 @@
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 \
+ $(CXX) $(CXXFLAGS) -c -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
+ $(CXX) $(CXXFLAGS) -c -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
-
+.PHONY: clean
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.* \
+ rm -f tfz *.d **/*.d *.d* **/*.d* $(objs) $(generated_objs) $(generated_includes) $(generated_sources)\
parser/tf_fuzz_grammar.output
rm -f `find regression -name "stdout_stderr"`
rm -f `find regression -name "test.c"`
diff --git a/tf_fuzz/tfz-cpp/assets/crypto_asset.cpp b/tf_fuzz/tfz-cpp/assets/crypto_asset.cpp
index 7918a79..e1efdb1 100644
--- a/tf_fuzz/tfz-cpp/assets/crypto_asset.cpp
+++ b/tf_fuzz/tfz-cpp/assets/crypto_asset.cpp
@@ -1,23 +1,15 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
-#include "class_forwards.hpp"
+#include <stdlib.h>
-#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"
diff --git a/tf_fuzz/tfz-cpp/assets/crypto_asset.hpp b/tf_fuzz/tfz-cpp/assets/crypto_asset.hpp
index bcee450..525f026 100644
--- a/tf_fuzz/tfz-cpp/assets/crypto_asset.hpp
+++ b/tf_fuzz/tfz-cpp/assets/crypto_asset.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -13,13 +13,10 @@
#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 "data_blocks.hpp"
#include "psa_asset.hpp"
-*/
+class key_asset;
using namespace std;
diff --git a/tf_fuzz/tfz-cpp/assets/psa_asset.cpp b/tf_fuzz/tfz-cpp/assets/psa_asset.cpp
index 2c230e7..3409778 100644
--- a/tf_fuzz/tfz-cpp/assets/psa_asset.cpp
+++ b/tf_fuzz/tfz-cpp/assets/psa_asset.cpp
@@ -1,21 +1,12 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2024, 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"
diff --git a/tf_fuzz/tfz-cpp/assets/psa_asset.hpp b/tf_fuzz/tfz-cpp/assets/psa_asset.hpp
index 9f6a328..6823429 100644
--- a/tf_fuzz/tfz-cpp/assets/psa_asset.hpp
+++ b/tf_fuzz/tfz-cpp/assets/psa_asset.hpp
@@ -8,14 +8,14 @@
#ifndef PSA_ASSET_HPP
#define PSA_ASSET_HPP
-#include "class_forwards.hpp"
#include <string>
#include <vector>
#include <cstdint>
+#include <iosfwd>
-/* 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 "class_forwards.hpp"
+#include "data_blocks.hpp"
+#include "psa_call.hpp"
using namespace std;
diff --git a/tf_fuzz/tfz-cpp/assets/sst_asset.cpp b/tf_fuzz/tfz-cpp/assets/sst_asset.cpp
index ac4de6f..31e5e7e 100644
--- a/tf_fuzz/tfz-cpp/assets/sst_asset.cpp
+++ b/tf_fuzz/tfz-cpp/assets/sst_asset.cpp
@@ -1,22 +1,11 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2024, 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"
diff --git a/tf_fuzz/tfz-cpp/assets/sst_asset.hpp b/tf_fuzz/tfz-cpp/assets/sst_asset.hpp
index 0fbd5b8..f7bc252 100644
--- a/tf_fuzz/tfz-cpp/assets/sst_asset.hpp
+++ b/tf_fuzz/tfz-cpp/assets/sst_asset.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -8,14 +8,11 @@
#ifndef SST_ASSET_HPP
#define SST_ASSET_HPP
+#include <stdint.h>
#include <string>
+#include <iosfwd>
-/* 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;
diff --git a/tf_fuzz/tfz-cpp/boilerplate/boilerplate.cpp b/tf_fuzz/tfz-cpp/boilerplate/boilerplate.cpp
index 60deab7..1616d6c 100644
--- a/tf_fuzz/tfz-cpp/boilerplate/boilerplate.cpp
+++ b/tf_fuzz/tfz-cpp/boilerplate/boilerplate.cpp
@@ -1,22 +1,15 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
-#include "class_forwards.hpp"
+#include <stdlib.h>
+#include <fstream>
+#include <iostream>
#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:
diff --git a/tf_fuzz/tfz-cpp/calls/crypto_call.cpp b/tf_fuzz/tfz-cpp/calls/crypto_call.cpp
index 7dc1c8e..4ff2ce3 100644
--- a/tf_fuzz/tfz-cpp/calls/crypto_call.cpp
+++ b/tf_fuzz/tfz-cpp/calls/crypto_call.cpp
@@ -1,29 +1,25 @@
/*
- * Copyright (c) 2019-2022, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
+#include <stdint.h>
#include <cstdlib>
-
-#include "class_forwards.hpp"
+#include <iostream>
#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"
/**********************************************************************************
@@ -1349,4 +1345,3 @@
/**********************************************************************************
End of methods of class remove_key_call.
**********************************************************************************/
-
diff --git a/tf_fuzz/tfz-cpp/calls/crypto_call.hpp b/tf_fuzz/tfz-cpp/calls/crypto_call.hpp
index 6937686..782bb1b 100644
--- a/tf_fuzz/tfz-cpp/calls/crypto_call.hpp
+++ b/tf_fuzz/tfz-cpp/calls/crypto_call.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2022, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -10,13 +10,14 @@
#include <string>
#include <vector>
+#include <iosfwd>
-/* 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 "data_blocks.hpp"
+#include "find_or_create_asset.hpp"
+#include "psa_asset.hpp"
#include "psa_call.hpp"
-#include "crypto_asset.hpp"
-*/
+
+class tf_fuzz_info;
template<class T> bool copy_call_to_asset_t (psa_call *call, bool create_asset_bool)
{
diff --git a/tf_fuzz/tfz-cpp/calls/psa_call.cpp b/tf_fuzz/tfz-cpp/calls/psa_call.cpp
index 98c7ba2..1bb8c46 100644
--- a/tf_fuzz/tfz-cpp/calls/psa_call.cpp
+++ b/tf_fuzz/tfz-cpp/calls/psa_call.cpp
@@ -5,18 +5,15 @@
*
*/
-#include "class_forwards.hpp"
+#include <stdlib.h>
+#include <iostream>
#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"
diff --git a/tf_fuzz/tfz-cpp/calls/psa_call.hpp b/tf_fuzz/tfz-cpp/calls/psa_call.hpp
index ed66245..4aa8bda 100644
--- a/tf_fuzz/tfz-cpp/calls/psa_call.hpp
+++ b/tf_fuzz/tfz-cpp/calls/psa_call.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -9,13 +9,14 @@
#define PSA_CALL_HPP
#include <string>
+#include <iosfwd>
+#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 "tf_fuzz.hpp"
-*/
+#include "data_blocks.hpp"
+class psa_asset;
+enum class psa_asset_usage;
+class tf_fuzz_info;
using namespace std;
diff --git a/tf_fuzz/tfz-cpp/calls/security_call.cpp b/tf_fuzz/tfz-cpp/calls/security_call.cpp
index c861d6f..806df17 100644
--- a/tf_fuzz/tfz-cpp/calls/security_call.cpp
+++ b/tf_fuzz/tfz-cpp/calls/security_call.cpp
@@ -1,28 +1,19 @@
/*
- * Copyright (c) 2019-2022, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
-#include <cstdlib>
+#include <string>
+#include <vector>
-#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"
+
+class tf_fuzz_info;
diff --git a/tf_fuzz/tfz-cpp/calls/security_call.hpp b/tf_fuzz/tfz-cpp/calls/security_call.hpp
index e55a278..fb4d8ca 100644
--- a/tf_fuzz/tfz-cpp/calls/security_call.hpp
+++ b/tf_fuzz/tfz-cpp/calls/security_call.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -10,11 +10,12 @@
#include <string>
#include <vector>
+#include <iosfwd>
-/* 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 "find_or_create_asset.hpp"
+#include "psa_call.hpp"
+class tf_fuzz_info;
using namespace std;
diff --git a/tf_fuzz/tfz-cpp/calls/sst_call.cpp b/tf_fuzz/tfz-cpp/calls/sst_call.cpp
index 5007314..2c49d95 100644
--- a/tf_fuzz/tfz-cpp/calls/sst_call.cpp
+++ b/tf_fuzz/tfz-cpp/calls/sst_call.cpp
@@ -5,22 +5,17 @@
*
*/
-#include "class_forwards.hpp"
+#include <vector>
#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"
diff --git a/tf_fuzz/tfz-cpp/calls/sst_call.hpp b/tf_fuzz/tfz-cpp/calls/sst_call.hpp
index 537b21f..39c277b 100644
--- a/tf_fuzz/tfz-cpp/calls/sst_call.hpp
+++ b/tf_fuzz/tfz-cpp/calls/sst_call.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -11,14 +11,12 @@
#include <string>
#include <vector>
#include <cstdint>
+#include <iosfwd>
-/* 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 "find_or_create_asset.hpp"
#include "psa_call.hpp"
-*/
+class tf_fuzz_info;
using namespace std;
@@ -93,4 +91,3 @@
};
#endif // SST_CALL_HPP
-
diff --git a/tf_fuzz/tfz-cpp/class_forwards.hpp b/tf_fuzz/tfz-cpp/class_forwards.hpp
index 6099fbe..893cdd9 100644
--- a/tf_fuzz/tfz-cpp/class_forwards.hpp
+++ b/tf_fuzz/tfz-cpp/class_forwards.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -23,42 +23,34 @@
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;
@@ -88,26 +80,20 @@
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;
diff --git a/tf_fuzz/tfz-cpp/template/crypto_template_line.cpp b/tf_fuzz/tfz-cpp/template/crypto_template_line.cpp
index 3cf8a35..c0801c9 100644
--- a/tf_fuzz/tfz-cpp/template/crypto_template_line.cpp
+++ b/tf_fuzz/tfz-cpp/template/crypto_template_line.cpp
@@ -1,25 +1,16 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
-#include "class_forwards.hpp"
+#include <stdlib.h>
-#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"
diff --git a/tf_fuzz/tfz-cpp/template/crypto_template_line.hpp b/tf_fuzz/tfz-cpp/template/crypto_template_line.hpp
index 75be0fe..40218e5 100644
--- a/tf_fuzz/tfz-cpp/template/crypto_template_line.hpp
+++ b/tf_fuzz/tfz-cpp/template/crypto_template_line.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -9,17 +9,16 @@
#define CRYPTO_TEMPLATE_LINE_HPP
#include <cstdint>
+#include <string>
+#include <iosfwd>
-/* 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"
-//class psa_asset; // just need a forward reference
+#include "crypto_call.hpp"
+#include "data_blocks.hpp"
+#include "find_or_create_asset.hpp"
#include "template_line.hpp"
-#include "psa_call.hpp"
-*/
-using namespace std;
+#include "tf_fuzz.hpp"
+using namespace std;
class set_policy_template_line : public policy_template_line
{
diff --git a/tf_fuzz/tfz-cpp/template/secure_template_line.cpp b/tf_fuzz/tfz-cpp/template/secure_template_line.cpp
index 73fbde3..e8a255e 100644
--- a/tf_fuzz/tfz-cpp/template/secure_template_line.cpp
+++ b/tf_fuzz/tfz-cpp/template/secure_template_line.cpp
@@ -1,28 +1,18 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
-#include "class_forwards.hpp"
+#include <string>
+#include <vector>
-#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 "security_call.hpp"
#include "secure_template_line.hpp"
-#include "sst_call.hpp"
-#include "sst_template_line.hpp"
-#include "sst_asset.hpp"
-#include "crypto_asset.hpp"
@@ -70,4 +60,3 @@
/**********************************************************************************
End of methods of class security_hash_template_line.
**********************************************************************************/
-
diff --git a/tf_fuzz/tfz-cpp/template/secure_template_line.hpp b/tf_fuzz/tfz-cpp/template/secure_template_line.hpp
index 7f53c70..25afff3 100644
--- a/tf_fuzz/tfz-cpp/template/secure_template_line.hpp
+++ b/tf_fuzz/tfz-cpp/template/secure_template_line.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -13,18 +13,12 @@
#ifndef SECURE_TEMPLATE_LINE_HPP
#define SECURE_TEMPLATE_LINE_HPP
-#include <iostream>
-#include <string>
-#include <vector>
-#include <iterator>
-#include <algorithm>
-#include <new>
+#include "data_blocks.hpp"
+#include "security_call.hpp"
+#include "template_line.hpp"
+#include "tf_fuzz.hpp"
-/* 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.
-*/
-
+class psa_call;
using namespace std;
@@ -57,4 +51,3 @@
};
#endif // #ifndef SECURE_TEMPLATE_LINE_HPP
-
diff --git a/tf_fuzz/tfz-cpp/template/sst_template_line.cpp b/tf_fuzz/tfz-cpp/template/sst_template_line.cpp
index 829071a..e50336d 100644
--- a/tf_fuzz/tfz-cpp/template/sst_template_line.cpp
+++ b/tf_fuzz/tfz-cpp/template/sst_template_line.cpp
@@ -1,25 +1,17 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
-#include "class_forwards.hpp"
+#include <cstdlib>
-#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_call.hpp"
#include "sst_template_line.hpp"
-#include "sst_asset.hpp"
/**********************************************************************************
@@ -107,4 +99,3 @@
/**********************************************************************************
End of methods of class remove_sst_template_line.
**********************************************************************************/
-
diff --git a/tf_fuzz/tfz-cpp/template/sst_template_line.hpp b/tf_fuzz/tfz-cpp/template/sst_template_line.hpp
index bec927c..19a4a96 100644
--- a/tf_fuzz/tfz-cpp/template/sst_template_line.hpp
+++ b/tf_fuzz/tfz-cpp/template/sst_template_line.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -9,15 +9,12 @@
#define SST_TEMPLATE_LINE_HPP
#include <cstdlib> // for rand()
+#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"
+#include "data_blocks.hpp"
+#include "sst_call.hpp"
#include "template_line.hpp"
-#include "psa_call.hpp"
-*/
-
+#include "tf_fuzz.hpp"
using namespace std;
diff --git a/tf_fuzz/tfz-cpp/template/template_line.cpp b/tf_fuzz/tfz-cpp/template/template_line.cpp
index a8625b1..d5f3df3 100644
--- a/tf_fuzz/tfz-cpp/template/template_line.cpp
+++ b/tf_fuzz/tfz-cpp/template/template_line.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -12,24 +12,13 @@
commands are therefore tracked in separate objects, but referenced here. */
#include <vector>
-#include <algorithm> // for STL find()
-
-#include "class_forwards.hpp"
#include "data_blocks.hpp"
-#include "boilerplate.hpp"
-#include "randomization.hpp"
-#include "gibberish.hpp"
-#include "compute.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"
+
+class tf_fuzz_info;
@@ -275,4 +264,3 @@
/**********************************************************************************
End of methods of class security_template_line.
**********************************************************************************/
-
diff --git a/tf_fuzz/tfz-cpp/template/template_line.hpp b/tf_fuzz/tfz-cpp/template/template_line.hpp
index 143232d..dfdf111 100644
--- a/tf_fuzz/tfz-cpp/template/template_line.hpp
+++ b/tf_fuzz/tfz-cpp/template/template_line.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -14,18 +14,14 @@
#ifndef TEMPLATE_LINE_HPP
#define TEMPLATE_LINE_HPP
-#include <iostream>
+#include <stdint.h>
#include <string>
-#include <vector>
-#include <iterator>
-#include <algorithm>
-#include <new>
-/* 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 "data_blocks.hpp"
+#include "find_or_create_asset.hpp"
+class psa_call;
+class tf_fuzz_info;
using namespace std;
diff --git a/tf_fuzz/tfz-cpp/tf_fuzz.cpp b/tf_fuzz/tfz-cpp/tf_fuzz.cpp
index 17c1881..1dc95ae 100644
--- a/tf_fuzz/tfz-cpp/tf_fuzz.cpp
+++ b/tf_fuzz/tfz-cpp/tf_fuzz.cpp
@@ -5,22 +5,20 @@
*
*/
+#include "tf_fuzz.hpp"
+
+#include <ext/alloc_traits.h>
#include <ctime> // to seed random, if seed not passed in
#include <string>
#include <vector>
#include <iostream>
-#include <cstdlib> // for srand() and rand()
-#include <cstdio> // for template lex&yacc input file
-#include "class_forwards.hpp"
+#include <fstream>
+
#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 "sst_asset.hpp"
#include "crypto_asset.hpp"
#include "psa_call.hpp"
diff --git a/tf_fuzz/tfz-cpp/tf_fuzz.hpp b/tf_fuzz/tfz-cpp/tf_fuzz.hpp
index ce9051f..9db970f 100644
--- a/tf_fuzz/tfz-cpp/tf_fuzz.hpp
+++ b/tf_fuzz/tfz-cpp/tf_fuzz.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -8,20 +8,28 @@
#ifndef TF_FUZZ_HPP
#define TF_FUZZ_HPP
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
+#include "class_forwards.hpp"
+#include "compute.hpp"
+#include "data_blocks.hpp"
+#include "find_or_create_asset.hpp"
+#include "gibberish.hpp"
+#include "template_line.hpp"
+#include "variables.hpp"
-/* 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 "sst_asset.hpp"
-#include "crypto_asset.hpp"
-#include "boilerplate.hpp"
-*/
+class boilerplate;
+class psa_asset;
+class psa_call;
+class variable_info;
+class tf_fuzz_info;
+
/* Shortcuts, to reduce code clutter, and reduce risk of coding errors. */
#define IVM(content) if(rsrc->verbose_mode){content} // IVM = "If Verbose Mode"
diff --git a/tf_fuzz/tfz-cpp/utility/compute.cpp b/tf_fuzz/tfz-cpp/utility/compute.cpp
index 708a1f3..f898be2 100644
--- a/tf_fuzz/tfz-cpp/utility/compute.cpp
+++ b/tf_fuzz/tfz-cpp/utility/compute.cpp
@@ -1,11 +1,10 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
-#include <cstdint> // for uint32_t
#include "compute.hpp"
diff --git a/tf_fuzz/tfz-cpp/utility/compute.hpp b/tf_fuzz/tfz-cpp/utility/compute.hpp
index c6ece6c..86cb48f 100644
--- a/tf_fuzz/tfz-cpp/utility/compute.hpp
+++ b/tf_fuzz/tfz-cpp/utility/compute.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -8,6 +8,7 @@
#ifndef COMPUTE_HPP
#define COMPUTE_HPP
+#include <stdint.h>
#include <cstdlib>
using namespace std;
diff --git a/tf_fuzz/tfz-cpp/utility/data_blocks.cpp b/tf_fuzz/tfz-cpp/utility/data_blocks.cpp
index c84d4d2..21b7f50 100644
--- a/tf_fuzz/tfz-cpp/utility/data_blocks.cpp
+++ b/tf_fuzz/tfz-cpp/utility/data_blocks.cpp
@@ -9,24 +9,16 @@
associated methods (most importantly their constructors) used in template_
line, psa_call, psa_asset (etc.). */
+#include <stdlib.h>
#include <string>
#include <vector>
-#include <cstdint>
+#include <iostream>
-#include "class_forwards.hpp"
-
-#include "boilerplate.hpp"
#include "randomization.hpp"
#include "gibberish.hpp"
-#include "compute.hpp"
-#include "string_ops.hpp"
#include "data_blocks.hpp"
-#include "psa_asset.hpp"
-#include "crypto_asset.hpp"
#include "find_or_create_asset.hpp"
#include "psa_call.hpp"
-#include "template_line.hpp"
-#include "tf_fuzz.hpp"
diff --git a/tf_fuzz/tfz-cpp/utility/data_blocks.hpp b/tf_fuzz/tfz-cpp/utility/data_blocks.hpp
index 5b26e1b..1e56836 100644
--- a/tf_fuzz/tfz-cpp/utility/data_blocks.hpp
+++ b/tf_fuzz/tfz-cpp/utility/data_blocks.hpp
@@ -5,7 +5,17 @@
*
*/
+#include <stdint.h>
#include <string>
+#include <vector>
+#include <iosfwd>
+
+class psa_asset;
+
+enum class psa_asset_type;
+class psa_call;
+
+enum class asset_search;
/* These classes "cut down the clutter" by grouping together related data and
associated methods (most importantly their constructors) used in template_
@@ -14,12 +24,6 @@
#ifndef DATA_BLOCKS_HPP
#define DATA_BLOCKS_HPP
-/* 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. However these in particular are mostly axiomatic: Not
- dependent upon other classes. */
-
-
using namespace std;
diff --git a/tf_fuzz/tfz-cpp/utility/find_or_create_asset.hpp b/tf_fuzz/tfz-cpp/utility/find_or_create_asset.hpp
index c2e7853..92b1323 100644
--- a/tf_fuzz/tfz-cpp/utility/find_or_create_asset.hpp
+++ b/tf_fuzz/tfz-cpp/utility/find_or_create_asset.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2022, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -8,6 +8,16 @@
#ifndef FIND_OR_CREATE_ASSET_HPP
#define FIND_OR_CREATE_ASSET_HPP
+#include <stdint.h>
+#include <iostream>
+#include <iterator>
+#include <new>
+#include <string>
+#include <vector>
+
+#include "psa_asset.hpp"
+#include "data_blocks.hpp"
+
using namespace std;
/* This enum defines possible results when asked to find an existing, or create a
diff --git a/tf_fuzz/tfz-cpp/utility/gibberish.cpp b/tf_fuzz/tfz-cpp/utility/gibberish.cpp
index 6de56f0..436ace4 100644
--- a/tf_fuzz/tfz-cpp/utility/gibberish.cpp
+++ b/tf_fuzz/tfz-cpp/utility/gibberish.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2022, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -14,6 +14,7 @@
*/
#include <string>
+#include <cstdlib>
#include "gibberish.hpp" // shouldn't need any other project headers
diff --git a/tf_fuzz/tfz-cpp/utility/gibberish.hpp b/tf_fuzz/tfz-cpp/utility/gibberish.hpp
index c5692e3..533f239 100644
--- a/tf_fuzz/tfz-cpp/utility/gibberish.hpp
+++ b/tf_fuzz/tfz-cpp/utility/gibberish.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -15,6 +15,7 @@
#define GIBBERISH_HPP
#include <cstdlib>
+#include <string>
using namespace std;
diff --git a/tf_fuzz/tfz-cpp/utility/randomization.cpp b/tf_fuzz/tfz-cpp/utility/randomization.cpp
index c8cdd38..ded87bb 100644
--- a/tf_fuzz/tfz-cpp/utility/randomization.cpp
+++ b/tf_fuzz/tfz-cpp/utility/randomization.cpp
@@ -15,6 +15,8 @@
#include "randomization.hpp"
+#include <stdlib.h>
+
/**
* \brief Selects and returns a random key_usage_t value.
*
diff --git a/tf_fuzz/tfz-cpp/utility/randomization.hpp b/tf_fuzz/tfz-cpp/utility/randomization.hpp
index 2eb72f6..b47742a 100644
--- a/tf_fuzz/tfz-cpp/utility/randomization.hpp
+++ b/tf_fuzz/tfz-cpp/utility/randomization.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
diff --git a/tf_fuzz/tfz-cpp/utility/string_ops.cpp b/tf_fuzz/tfz-cpp/utility/string_ops.cpp
index 9c14140..98a4a0f 100644
--- a/tf_fuzz/tfz-cpp/utility/string_ops.cpp
+++ b/tf_fuzz/tfz-cpp/utility/string_ops.cpp
@@ -1,14 +1,19 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#include "string_ops.hpp"
+
+#include <ctype.h>
+#include <stdint.h>
+#include <stdlib.h>
#include <iostream>
-#include <sstream>
#include <iomanip>
+#include <stdexcept>
+#include <sstream>
using namespace std;
diff --git a/tf_fuzz/tfz-cpp/utility/variables.cpp b/tf_fuzz/tfz-cpp/utility/variables.cpp
index ab2a823..7209074 100644
--- a/tf_fuzz/tfz-cpp/utility/variables.cpp
+++ b/tf_fuzz/tfz-cpp/utility/variables.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -8,28 +8,13 @@
/* This file defines information to track regarding variables in the generated test
code. */
+#include <stdlib.h>
#include <string>
-#include <vector>
-#include <list>
-#include <iostream>
-#include <fstream>
-#include "class_forwards.hpp"
-
-#include "data_blocks.hpp"
-#include "psa_asset.hpp"
-#include "crypto_asset.hpp"
-#include "psa_call.hpp"
#include "find_or_create_asset.hpp"
#include "variables.hpp"
#include "gibberish.hpp"
-/* 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. However these in particular are mostly axiomatic: Not
- dependent upon other classes. */
-
-
using namespace std;
diff --git a/tf_fuzz/tfz-cpp/utility/variables.hpp b/tf_fuzz/tfz-cpp/utility/variables.hpp
index 886acc3..2c679ef 100644
--- a/tf_fuzz/tfz-cpp/utility/variables.hpp
+++ b/tf_fuzz/tfz-cpp/utility/variables.hpp
@@ -1,12 +1,13 @@
/*
- * Copyright (c) 2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#include <string>
-#include <vector>
+
+#include "find_or_create_asset.hpp"
/* This file defines information to track regarding variables in the generated test
code. */
@@ -14,12 +15,6 @@
#ifndef VARIABLES_HPP
#define VARIABLES_HPP
-/* 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. However these in particular are mostly axiomatic: Not
- dependent upon other classes. */
-
-
using namespace std;
@@ -56,4 +51,3 @@
#endif // VARIABLES_HPP
-