Initial check-in of TF-Fuzz.

Author:  Gary Morrison <gary.morrison@arm.com>
Signed-off-by:  Gary Morrison <gary.morrison@arm.com>

Change-Id: I8f739c3403bf2a2808f33c28910c7bda6aca7887
diff --git a/tools/tf_fuzz/demo/1 b/tools/tf_fuzz/demo/1
new file mode 100644
index 0000000..7b84f11
--- /dev/null
+++ b/tools/tf_fuzz/demo/1
@@ -0,0 +1,2 @@
+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
new file mode 100644
index 0000000..3e70099
--- /dev/null
+++ b/tools/tf_fuzz/demo/10
@@ -0,0 +1,2 @@
+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
new file mode 100644
index 0000000..5fdd0fc
--- /dev/null
+++ b/tools/tf_fuzz/demo/11
@@ -0,0 +1,2 @@
+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
new file mode 100644
index 0000000..c7825c5
--- /dev/null
+++ b/tools/tf_fuzz/demo/12
@@ -0,0 +1,2 @@
+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/13 b/tools/tf_fuzz/demo/13
new file mode 100644
index 0000000..467ae6d
--- /dev/null
+++ b/tools/tf_fuzz/demo/13
@@ -0,0 +1,4 @@
+purpose to illustrate deleting assets;
+set sst name george data *;
+remove sst name george;
+remove sst name george;
diff --git a/tools/tf_fuzz/demo/14 b/tools/tf_fuzz/demo/14
new file mode 100644
index 0000000..5b9485c
--- /dev/null
+++ b/tools/tf_fuzz/demo/14
@@ -0,0 +1,3 @@
+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
new file mode 100644
index 0000000..613439e
--- /dev/null
+++ b/tools/tf_fuzz/demo/15
@@ -0,0 +1,3 @@
+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
new file mode 100644
index 0000000..e7a21b3
--- /dev/null
+++ b/tools/tf_fuzz/demo/16
@@ -0,0 +1,6 @@
+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
+remove sst *active;  // remove *some other* active asset
+remove sst *active;  // remove *yet another* active asset
+remove sst *deleted;  // attempt to remove some asset that's already been removed
diff --git a/tools/tf_fuzz/demo/17 b/tools/tf_fuzz/demo/17
new file mode 100644
index 0000000..bdaeece
--- /dev/null
+++ b/tools/tf_fuzz/demo/17
@@ -0,0 +1,8 @@
+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
new file mode 100644
index 0000000..f71335e
--- /dev/null
+++ b/tools/tf_fuzz/demo/18
@@ -0,0 +1,9 @@
+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
new file mode 100644
index 0000000..173c45d
--- /dev/null
+++ b/tools/tf_fuzz/demo/19
@@ -0,0 +1,4 @@
+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
new file mode 100644
index 0000000..9af02c6
--- /dev/null
+++ b/tools/tf_fuzz/demo/2
@@ -0,0 +1,2 @@
+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
new file mode 100644
index 0000000..6fda99a
--- /dev/null
+++ b/tools/tf_fuzz/demo/20
@@ -0,0 +1,14 @@
+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/3 b/tools/tf_fuzz/demo/3
new file mode 100644
index 0000000..8f41603
--- /dev/null
+++ b/tools/tf_fuzz/demo/3
@@ -0,0 +1,2 @@
+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/4 b/tools/tf_fuzz/demo/4
new file mode 100644
index 0000000..912c23a
--- /dev/null
+++ b/tools/tf_fuzz/demo/4
@@ -0,0 +1,2 @@
+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
new file mode 100644
index 0000000..5290f27
--- /dev/null
+++ b/tools/tf_fuzz/demo/5
@@ -0,0 +1,2 @@
+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
new file mode 100644
index 0000000..2e86d75
--- /dev/null
+++ b/tools/tf_fuzz/demo/6
@@ -0,0 +1,2 @@
+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
new file mode 100644
index 0000000..903027e
--- /dev/null
+++ b/tools/tf_fuzz/demo/7
@@ -0,0 +1,2 @@
+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
new file mode 100644
index 0000000..adaacfc
--- /dev/null
+++ b/tools/tf_fuzz/demo/8
@@ -0,0 +1,3 @@
+purpose to create and show an asset;
+set sst name snortwaggle data *;
+read sst name snortwaggle check "almost certainly not *this*";
diff --git a/tools/tf_fuzz/demo/9 b/tools/tf_fuzz/demo/9
new file mode 100644
index 0000000..72cc269
--- /dev/null
+++ b/tools/tf_fuzz/demo/9
@@ -0,0 +1,4 @@
+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
new file mode 100644
index 0000000..bad7d92
--- /dev/null
+++ b/tools/tf_fuzz/demo/README
@@ -0,0 +1,18 @@
+.../tf_fuzz/demo directory contents:
+
+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 demon-
+strating 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 initial, "purpose" line in each numbered file briefly describes what that
+file demonstrates.
+
+--------------
+
+*Copyright (c) 2019-2020, Arm Limited. All rights reserved.*
diff --git a/tools/tf_fuzz/demo/r b/tools/tf_fuzz/demo/r
new file mode 100644
index 0000000..41d0f2a
--- /dev/null
+++ b/tools/tf_fuzz/demo/r
@@ -0,0 +1,18 @@
+#!/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 tossThis2
+../tfz -v $1 tossThis2