tf_fuzz: only allow one policy to be created per set policy line.
Only allow one policy asset to be created per set policy line, instead
of a list of assets.
This patch makes the syntax `set policy name policy1 policy2 invalid`.
Now, only one policy can be created per template line, like so:
```
set policy name policy1;
set policy name policy2;
```
Before this patch, providing a list of policy names to create to this
call was allowed by TF-Fuzz. However, doing so would cause the generated
tests to not compile. The compile error occurs due to variable
declarations not being generated for all policies but the first, causing
the C compiler to complain about missing variables. However, the exact
cause of this in TF-Fuzz is unknown.
This issue also only presents itself when the policies are used --
demo/23.test, which never uses the created policies, compiles fine,
whereas demo/27.test had to be disabled due to the above compile errors.
This patch makes giving a list of policy names to create to set-policy
invalid syntax and throw a parser error. Currently, the template and
parser related code for set-policy assumes that each set-policy template
line refers to one policy (the one stored in `psa_call::policy`). This
change makes the parser grammar consistent with this assumption.
This patch also modifies affected demos (26.test,27.test) to use
the new syntax. These tests now fail for a different reason to do with
the boilerplate for psa_copy_key being incorrect), so need further work
before they can be re-enabled.
Delete 23.test, as the sole purpose of this test was to show off the
creation of multiple policies in a single line, which this patch
removes.
Change-Id: Ib5b66b6d5df89e200d73b5b797407f7246560e26
Signed-off-by: Nik Dewally <Nik.Dewally@arm.com>
diff --git a/tf_fuzz/demo/23.test b/tf_fuzz/demo/23.test
deleted file mode 100644
index deb35b2..0000000
--- a/tf_fuzz/demo/23.test
+++ /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/tf_fuzz/demo/26.test.disabled b/tf_fuzz/demo/26.test.disabled
deleted file mode 100644
index 9093bd1..0000000
--- a/tf_fuzz/demo/26.test.disabled
+++ /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/tf_fuzz/demo/27.test.disabled b/tf_fuzz/demo/27.test.disabled
deleted file mode 100644
index 76a62c8..0000000
--- a/tf_fuzz/demo/27.test.disabled
+++ /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/tf_fuzz/tfz-cpp/parser/tf_fuzz_grammar.y b/tf_fuzz/tfz-cpp/parser/tf_fuzz_grammar.y
index 41889a9..bde5598 100644
--- a/tf_fuzz/tfz-cpp/parser/tf_fuzz_grammar.y
+++ b/tf_fuzz/tfz-cpp/parser/tf_fuzz_grammar.y
@@ -1158,10 +1158,11 @@
policy_asset_spec:
%empty /* nothing */
- | NAME ASSET_IDENTIFIER_LIST {
- IVM(cout << "policy-asset identifier list: \"" << flush;)
+ | NAME IDENTIFIER {
+ IVM(cout << "policy-asset identifier : \"" << flush;)
random_name = false;
- asset_name = identifier; /* TODO: Not sure this ultimately has any effect... */
+ asset_name = identifier;
+ 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;)