Add tf_fuzz tool
This is fully derived from tf-m repo.
Signed-off-by: Karl Zhang <karl.zhang@arm.com>
Change-Id: I8d35e70eda9081af66d8fa3f3cb4beb1d953060e
diff --git a/tf_fuzz/parser/README b/tf_fuzz/parser/README
new file mode 100644
index 0000000..8301488
--- /dev/null
+++ b/tf_fuzz/parser/README
@@ -0,0 +1,10 @@
+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/tf_fuzz/parser/tf_fuzz_grammar.l b/tf_fuzz/parser/tf_fuzz_grammar.l
new file mode 100644
index 0000000..429e60c
--- /dev/null
+++ b/tf_fuzz/parser/tf_fuzz_grammar.l
@@ -0,0 +1,165 @@
+/*
+ * 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/tf_fuzz/parser/tf_fuzz_grammar.lex.c b/tf_fuzz/parser/tf_fuzz_grammar.lex.c
new file mode 100644
index 0000000..48c715b
--- /dev/null
+++ b/tf_fuzz/parser/tf_fuzz_grammar.lex.c
@@ -0,0 +1,2548 @@
+#line 2 "parser/tf_fuzz_grammar.lex.c"
+
+#line 4 "parser/tf_fuzz_grammar.lex.c"
+
+#define YY_INT_ALIGNED short int
+
+/* A lexical scanner generated by flex */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 6
+#define YY_FLEX_SUBMINOR_VERSION 0
+#if YY_FLEX_SUBMINOR_VERSION > 0
+#define FLEX_BETA
+#endif
+
+/* First, we deal with platform-specific or compiler-specific issues. */
+
+/* begin standard C headers. */
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+
+/* end standard C headers. */
+
+/* flex integer type definitions */
+
+#ifndef FLEXINT_H
+#define FLEXINT_H
+
+/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
+
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+
+/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
+ * if you want the limit (max/min) macros for int types.
+ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS 1
+#endif
+
+#include <inttypes.h>
+typedef int8_t flex_int8_t;
+typedef uint8_t flex_uint8_t;
+typedef int16_t flex_int16_t;
+typedef uint16_t flex_uint16_t;
+typedef int32_t flex_int32_t;
+typedef uint32_t flex_uint32_t;
+#else
+typedef signed char flex_int8_t;
+typedef short int flex_int16_t;
+typedef int flex_int32_t;
+typedef unsigned char flex_uint8_t;
+typedef unsigned short int flex_uint16_t;
+typedef unsigned int flex_uint32_t;
+
+/* Limits of integral types. */
+#ifndef INT8_MIN
+#define INT8_MIN (-128)
+#endif
+#ifndef INT16_MIN
+#define INT16_MIN (-32767-1)
+#endif
+#ifndef INT32_MIN
+#define INT32_MIN (-2147483647-1)
+#endif
+#ifndef INT8_MAX
+#define INT8_MAX (127)
+#endif
+#ifndef INT16_MAX
+#define INT16_MAX (32767)
+#endif
+#ifndef INT32_MAX
+#define INT32_MAX (2147483647)
+#endif
+#ifndef UINT8_MAX
+#define UINT8_MAX (255U)
+#endif
+#ifndef UINT16_MAX
+#define UINT16_MAX (65535U)
+#endif
+#ifndef UINT32_MAX
+#define UINT32_MAX (4294967295U)
+#endif
+
+#endif /* ! C99 */
+
+#endif /* ! FLEXINT_H */
+
+#ifdef __cplusplus
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else /* ! __cplusplus */
+
+/* C99 requires __STDC__ to be defined as 1. */
+#if defined (__STDC__)
+
+#define YY_USE_CONST
+
+#endif /* defined (__STDC__) */
+#endif /* ! __cplusplus */
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index. If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+
+/* Enter a start condition. This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN (yy_start) = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state. The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START (((yy_start) - 1) / 2)
+#define YYSTATE YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE yyrestart(yyin )
+
+#define YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#ifndef YY_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k.
+ * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
+ * Ditto for the __ia64__ case accordingly.
+ */
+#define YY_BUF_SIZE 32768
+#else
+#define YY_BUF_SIZE 16384
+#endif /* __ia64__ */
+#endif
+
+/* The state buf must be large enough to hold one state per character in the main buffer.
+ */
+#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
+
+#ifndef YY_TYPEDEF_YY_BUFFER_STATE
+#define YY_TYPEDEF_YY_BUFFER_STATE
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+#endif
+
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
+extern yy_size_t yyleng;
+
+extern FILE *yyin, *yyout;
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+ /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
+ * access to the local variable yy_act. Since yyless() is a macro, it would break
+ * existing scanners that call yyless() from OUTSIDE yylex.
+ * One obvious solution it to make yy_act a global. I tried that, and saw
+ * a 5% performance hit in a non-yylineno scanner, because yy_act is
+ * normally declared as a register variable-- so it is not worth it.
+ */
+ #define YY_LESS_LINENO(n) \
+ do { \
+ int yyl;\
+ for ( yyl = n; yyl < yyleng; ++yyl )\
+ if ( yytext[yyl] == '\n' )\
+ --yylineno;\
+ }while(0)
+ #define YY_LINENO_REWIND_TO(dst) \
+ do {\
+ const char *p;\
+ for ( p = yy_cp-1; p >= (dst); --p)\
+ if ( *p == '\n' )\
+ --yylineno;\
+ }while(0)
+
+/* Return all but the first "n" matched characters back to the input stream. */
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ int yyless_macro_arg = (n); \
+ YY_LESS_LINENO(yyless_macro_arg);\
+ *yy_cp = (yy_hold_char); \
+ YY_RESTORE_YY_MORE_OFFSET \
+ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
+ YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+ } \
+ while ( 0 )
+
+#define unput(c) yyunput( c, (yytext_ptr) )
+
+#ifndef YY_STRUCT_YY_BUFFER_STATE
+#define YY_STRUCT_YY_BUFFER_STATE
+struct yy_buffer_state
+ {
+ FILE *yy_input_file;
+
+ char *yy_ch_buf; /* input buffer */
+ char *yy_buf_pos; /* current position in input buffer */
+
+ /* Size of input buffer in bytes, not including room for EOB
+ * characters.
+ */
+ yy_size_t yy_buf_size;
+
+ /* Number of characters read into yy_ch_buf, not including EOB
+ * characters.
+ */
+ int yy_n_chars;
+
+ /* Whether we "own" the buffer - i.e., we know we created it,
+ * and can realloc() it to grow it, and should free() it to
+ * delete it.
+ */
+ int yy_is_our_buffer;
+
+ /* Whether this is an "interactive" input source; if so, and
+ * if we're using stdio for input, then we want to use getc()
+ * instead of fread(), to make sure we stop fetching input after
+ * each newline.
+ */
+ int yy_is_interactive;
+
+ /* Whether we're considered to be at the beginning of a line.
+ * If so, '^' rules will be active on the next match, otherwise
+ * not.
+ */
+ int yy_at_bol;
+
+ int yy_bs_lineno; /**< The line count. */
+ int yy_bs_column; /**< The column count. */
+
+ /* Whether to try to fill the input buffer when we reach the
+ * end of it.
+ */
+ int yy_fill_buffer;
+
+ int yy_buffer_status;
+
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+ /* When an EOF's been seen but there's still some text to process
+ * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+ * shouldn't try reading from the input source any more. We might
+ * still have a bunch of tokens to match, though, because of
+ * possible backing-up.
+ *
+ * When we actually see the EOF, we change the status to "new"
+ * (via yyrestart()), so that the user can continue scanning by
+ * just pointing yyin at a new input file.
+ */
+#define YY_BUFFER_EOF_PENDING 2
+
+ };
+#endif /* !YY_STRUCT_YY_BUFFER_STATE */
+
+/* Stack of input buffers. */
+static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
+static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
+static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ *
+ * Returns the top of the stack, or NULL.
+ */
+#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
+ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
+ : NULL)
+
+/* Same as previous macro, but useful when we know that the buffer stack is not
+ * NULL or when we need an lvalue. For internal use only.
+ */
+#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
+
+/* yy_hold_char holds the character lost when yytext is formed. */
+static char yy_hold_char;
+static int yy_n_chars; /* number of characters read into yy_ch_buf */
+yy_size_t yyleng;
+
+/* Points to current character in buffer. */
+static char *yy_c_buf_p = (char *) 0;
+static int yy_init = 0; /* whether we need to initialize */
+static int yy_start = 0; /* start state number */
+
+/* Flag which is used to allow yywrap()'s to do buffer switches
+ * instead of setting up a fresh yyin. A bit of a hack ...
+ */
+static int yy_did_buffer_switch_on_eof;
+
+void yyrestart (FILE *input_file );
+void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
+YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
+void yy_delete_buffer (YY_BUFFER_STATE b );
+void yy_flush_buffer (YY_BUFFER_STATE b );
+void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
+void yypop_buffer_state (void );
+
+static void yyensure_buffer_stack (void );
+static void yy_load_buffer_state (void );
+static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
+
+#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
+
+YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
+YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
+YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len );
+
+void *yyalloc (yy_size_t );
+void *yyrealloc (void *,yy_size_t );
+void yyfree (void * );
+
+#define yy_new_buffer yy_create_buffer
+
+#define yy_set_interactive(is_interactive) \
+ { \
+ if ( ! YY_CURRENT_BUFFER ){ \
+ yyensure_buffer_stack (); \
+ YY_CURRENT_BUFFER_LVALUE = \
+ yy_create_buffer(yyin,YY_BUF_SIZE ); \
+ } \
+ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
+ }
+
+#define yy_set_bol(at_bol) \
+ { \
+ if ( ! YY_CURRENT_BUFFER ){\
+ yyensure_buffer_stack (); \
+ YY_CURRENT_BUFFER_LVALUE = \
+ yy_create_buffer(yyin,YY_BUF_SIZE ); \
+ } \
+ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
+ }
+
+#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
+
+/* Begin user sect3 */
+
+#define yywrap() (/*CONSTCOND*/1)
+#define YY_SKIP_YYWRAP
+
+typedef unsigned char YY_CHAR;
+
+FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
+
+typedef int yy_state_type;
+
+extern int yylineno;
+
+int yylineno = 1;
+
+extern char yytext[];
+
+static yy_state_type yy_get_previous_state (void );
+static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
+static int yy_get_next_buffer (void );
+#if defined(__GNUC__) && __GNUC__ >= 3
+__attribute__((__noreturn__))
+#endif
+static void yy_fatal_error (yyconst char msg[] );
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+ (yytext_ptr) = yy_bp; \
+ yyleng = (size_t) (yy_cp - yy_bp); \
+ (yy_hold_char) = *yy_cp; \
+ *yy_cp = '\0'; \
+ if ( yyleng >= YYLMAX ) \
+ YY_FATAL_ERROR( "token too large, exceeds YYLMAX" ); \
+ yy_flex_strncpy( yytext, (yytext_ptr), yyleng + 1 ); \
+ (yy_c_buf_p) = yy_cp;
+
+#define YY_NUM_RULES 98
+#define YY_END_OF_BUFFER 99
+/* This struct is not used in this scanner,
+ but its presence is necessary. */
+struct yy_trans_info
+ {
+ flex_int32_t yy_verify;
+ flex_int32_t yy_nxt;
+ };
+static yyconst flex_int16_t yy_accept[310] =
+ { 0,
+ 92, 92, 0, 0, 99, 97, 96, 96, 1, 97,
+ 97, 30, 92, 97, 92, 26, 91, 91, 91, 91,
+ 91, 91, 91, 91, 91, 91, 91, 91, 91, 91,
+ 91, 91, 91, 91, 24, 25, 7, 6, 7, 0,
+ 94, 0, 92, 4, 0, 91, 0, 91, 95, 91,
+ 91, 91, 91, 91, 91, 91, 91, 91, 91, 91,
+ 91, 91, 91, 91, 91, 91, 91, 91, 91, 91,
+ 91, 91, 91, 46, 91, 91, 91, 91, 91, 91,
+ 11, 91, 91, 91, 91, 45, 91, 91, 91, 91,
+ 91, 91, 50, 91, 5, 93, 0, 2, 32, 60,
+
+ 91, 91, 37, 91, 91, 91, 34, 82, 91, 91,
+ 91, 91, 19, 91, 91, 91, 91, 16, 91, 54,
+ 91, 91, 41, 64, 91, 91, 91, 91, 91, 91,
+ 91, 91, 52, 91, 91, 91, 91, 91, 91, 91,
+ 91, 91, 13, 8, 91, 91, 15, 91, 28, 38,
+ 78, 88, 91, 91, 91, 91, 57, 91, 65, 29,
+ 72, 91, 91, 91, 14, 68, 91, 91, 91, 21,
+ 47, 89, 40, 27, 91, 84, 70, 91, 91, 91,
+ 91, 91, 91, 48, 91, 91, 91, 80, 91, 20,
+ 86, 91, 91, 91, 9, 91, 91, 44, 75, 58,
+
+ 91, 91, 90, 91, 91, 91, 91, 36, 91, 91,
+ 91, 91, 91, 23, 91, 91, 74, 91, 51, 91,
+ 91, 91, 91, 91, 91, 91, 91, 91, 91, 91,
+ 39, 91, 91, 91, 91, 91, 91, 91, 31, 91,
+ 91, 91, 91, 81, 42, 91, 18, 61, 91, 66,
+ 91, 91, 91, 91, 76, 91, 91, 55, 91, 17,
+ 91, 10, 12, 91, 77, 91, 91, 91, 91, 71,
+ 33, 67, 53, 91, 91, 91, 91, 22, 91, 91,
+ 91, 35, 43, 91, 91, 91, 91, 91, 83, 91,
+ 63, 79, 91, 0, 87, 91, 59, 91, 73, 69,
+
+ 91, 0, 0, 3, 91, 56, 85, 49, 0
+ } ;
+
+static yyconst YY_CHAR yy_ec[256] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
+ 1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 5, 1, 6, 1, 1, 1, 1, 7, 1,
+ 1, 8, 9, 1, 9, 10, 11, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 1, 13, 1,
+ 1, 1, 1, 1, 14, 14, 14, 14, 14, 14,
+ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+ 16, 17, 18, 17, 19, 17, 20, 21, 22, 23,
+
+ 24, 25, 26, 27, 28, 15, 29, 30, 31, 32,
+ 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
+ 43, 15, 44, 1, 45, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1
+ } ;
+
+static yyconst YY_CHAR yy_meta[46] =
+ { 0,
+ 1, 1, 1, 1, 2, 1, 1, 1, 1, 3,
+ 3, 4, 1, 4, 5, 1, 1, 2, 5, 4,
+ 4, 4, 4, 4, 4, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 1, 1
+ } ;
+
+static yyconst flex_uint16_t yy_base[317] =
+ { 0,
+ 0, 0, 43, 44, 359, 360, 360, 360, 360, 352,
+ 0, 360, 345, 42, 344, 360, 0, 49, 26, 22,
+ 55, 26, 46, 335, 330, 69, 328, 61, 53, 59,
+ 65, 324, 79, 78, 360, 360, 360, 360, 340, 344,
+ 360, 342, 336, 360, 344, 0, 328, 0, 360, 307,
+ 318, 305, 36, 308, 303, 85, 308, 307, 316, 301,
+ 302, 307, 314, 300, 295, 288, 299, 304, 304, 78,
+ 103, 293, 302, 300, 287, 287, 292, 293, 284, 70,
+ 0, 94, 280, 292, 279, 0, 282, 292, 278, 277,
+ 282, 273, 0, 282, 360, 360, 306, 360, 280, 274,
+
+ 270, 283, 0, 261, 283, 266, 277, 272, 279, 274,
+ 261, 263, 71, 265, 268, 262, 265, 0, 267, 0,
+ 95, 268, 0, 0, 97, 256, 264, 86, 263, 258,
+ 258, 260, 0, 247, 245, 244, 243, 251, 246, 243,
+ 253, 242, 235, 0, 248, 240, 0, 247, 0, 0,
+ 242, 249, 241, 229, 226, 229, 236, 234, 0, 0,
+ 219, 223, 220, 228, 0, 215, 221, 234, 219, 0,
+ 0, 0, 0, 0, 218, 0, 0, 220, 218, 217,
+ 101, 228, 215, 0, 222, 219, 210, 0, 221, 0,
+ 216, 221, 204, 208, 0, 200, 203, 213, 0, 0,
+
+ 212, 198, 0, 211, 210, 205, 211, 0, 197, 206,
+ 205, 204, 193, 0, 188, 187, 0, 192, 0, 180,
+ 186, 193, 184, 186, 186, 185, 188, 177, 177, 170,
+ 0, 175, 187, 186, 179, 165, 179, 187, 0, 167,
+ 165, 165, 179, 0, 0, 163, 0, 0, 175, 0,
+ 156, 158, 154, 160, 0, 169, 169, 0, 155, 0,
+ 168, 168, 0, 166, 0, 159, 155, 160, 148, 0,
+ 0, 0, 0, 151, 160, 143, 116, 0, 109, 127,
+ 134, 0, 0, 126, 117, 117, 122, 100, 0, 96,
+ 0, 0, 98, 140, 0, 107, 0, 87, 0, 0,
+
+ 40, 46, 142, 360, 33, 0, 0, 0, 360, 155,
+ 160, 163, 165, 170, 174, 178
+ } ;
+
+static yyconst flex_int16_t yy_def[317] =
+ { 0,
+ 309, 1, 310, 310, 309, 309, 309, 309, 309, 311,
+ 312, 309, 309, 309, 309, 309, 313, 313, 313, 313,
+ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
+ 313, 313, 313, 313, 309, 309, 309, 309, 309, 311,
+ 309, 312, 309, 309, 314, 313, 315, 18, 309, 313,
+ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
+ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
+ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
+ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
+ 313, 313, 313, 313, 309, 309, 314, 309, 313, 313,
+
+ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
+ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
+ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
+ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
+ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
+ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
+ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
+ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
+ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
+ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
+
+ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
+ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
+ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
+ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
+ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
+ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
+ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
+ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
+ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
+ 313, 313, 313, 316, 313, 313, 313, 313, 313, 313,
+
+ 313, 316, 316, 309, 313, 313, 313, 313, 0, 309,
+ 309, 309, 309, 309, 309, 309
+ } ;
+
+static yyconst flex_uint16_t yy_nxt[406] =
+ { 0,
+ 6, 7, 8, 9, 7, 10, 11, 12, 13, 6,
+ 14, 15, 16, 17, 17, 18, 17, 17, 17, 19,
+ 17, 20, 21, 22, 23, 17, 24, 17, 25, 17,
+ 17, 26, 27, 28, 17, 29, 30, 31, 32, 33,
+ 34, 17, 17, 35, 36, 38, 38, 50, 53, 44,
+ 39, 39, 45, 47, 54, 51, 308, 59, 304, 102,
+ 48, 60, 48, 52, 103, 62, 49, 61, 48, 48,
+ 48, 48, 48, 48, 55, 63, 80, 307, 56, 57,
+ 75, 64, 82, 81, 76, 83, 84, 58, 67, 141,
+ 68, 69, 70, 77, 168, 85, 78, 86, 89, 79,
+
+ 142, 71, 90, 169, 72, 92, 106, 87, 73, 122,
+ 93, 91, 123, 94, 107, 143, 175, 182, 178, 124,
+ 108, 125, 221, 306, 126, 127, 128, 183, 305, 301,
+ 176, 144, 179, 300, 129, 294, 222, 299, 294, 130,
+ 131, 303, 132, 303, 303, 298, 303, 297, 296, 295,
+ 293, 292, 304, 291, 304, 37, 37, 37, 37, 37,
+ 40, 40, 40, 40, 40, 42, 42, 42, 46, 46,
+ 97, 97, 97, 97, 97, 47, 290, 47, 302, 302,
+ 302, 302, 302, 289, 288, 287, 286, 285, 284, 283,
+ 282, 281, 280, 279, 278, 277, 276, 275, 274, 273,
+
+ 272, 271, 270, 269, 268, 267, 266, 265, 264, 263,
+ 262, 261, 260, 259, 258, 257, 256, 255, 254, 253,
+ 252, 251, 250, 249, 248, 247, 246, 245, 244, 243,
+ 242, 241, 240, 239, 238, 237, 236, 235, 234, 233,
+ 232, 231, 230, 229, 228, 227, 226, 225, 224, 223,
+ 220, 219, 218, 217, 216, 215, 214, 213, 212, 211,
+ 210, 209, 208, 207, 206, 205, 204, 203, 202, 201,
+ 200, 199, 198, 197, 196, 195, 194, 193, 192, 191,
+ 190, 189, 188, 187, 186, 185, 184, 181, 180, 177,
+ 174, 173, 172, 171, 170, 167, 166, 165, 164, 163,
+
+ 162, 161, 160, 159, 158, 157, 156, 155, 98, 154,
+ 153, 152, 151, 150, 149, 148, 147, 146, 145, 140,
+ 139, 138, 137, 136, 135, 134, 133, 121, 120, 119,
+ 118, 117, 116, 115, 114, 113, 112, 111, 110, 109,
+ 105, 104, 101, 100, 99, 49, 98, 43, 96, 41,
+ 95, 88, 74, 66, 65, 43, 43, 41, 309, 5,
+ 309, 309, 309, 309, 309, 309, 309, 309, 309, 309,
+ 309, 309, 309, 309, 309, 309, 309, 309, 309, 309,
+ 309, 309, 309, 309, 309, 309, 309, 309, 309, 309,
+ 309, 309, 309, 309, 309, 309, 309, 309, 309, 309,
+
+ 309, 309, 309, 309, 309
+ } ;
+
+static yyconst flex_int16_t yy_chk[406] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 3, 4, 19, 20, 14,
+ 3, 4, 14, 18, 20, 19, 305, 22, 302, 53,
+ 18, 22, 18, 19, 53, 23, 18, 22, 18, 18,
+ 18, 18, 18, 18, 21, 23, 29, 301, 21, 21,
+ 28, 23, 30, 29, 28, 30, 30, 21, 26, 80,
+ 26, 26, 26, 28, 113, 30, 28, 31, 33, 28,
+
+ 80, 26, 33, 113, 26, 34, 56, 31, 26, 70,
+ 34, 33, 70, 34, 56, 82, 121, 128, 125, 70,
+ 56, 71, 181, 298, 71, 71, 71, 128, 296, 293,
+ 121, 82, 125, 290, 71, 281, 181, 288, 281, 71,
+ 71, 294, 71, 303, 294, 287, 303, 286, 285, 284,
+ 280, 279, 294, 277, 303, 310, 310, 310, 310, 310,
+ 311, 311, 311, 311, 311, 312, 312, 312, 313, 313,
+ 314, 314, 314, 314, 314, 315, 276, 315, 316, 316,
+ 316, 316, 316, 275, 274, 269, 268, 267, 266, 264,
+ 262, 261, 259, 257, 256, 254, 253, 252, 251, 249,
+
+ 246, 243, 242, 241, 240, 238, 237, 236, 235, 234,
+ 233, 232, 230, 229, 228, 227, 226, 225, 224, 223,
+ 222, 221, 220, 218, 216, 215, 213, 212, 211, 210,
+ 209, 207, 206, 205, 204, 202, 201, 198, 197, 196,
+ 194, 193, 192, 191, 189, 187, 186, 185, 183, 182,
+ 180, 179, 178, 175, 169, 168, 167, 166, 164, 163,
+ 162, 161, 158, 157, 156, 155, 154, 153, 152, 151,
+ 148, 146, 145, 143, 142, 141, 140, 139, 138, 137,
+ 136, 135, 134, 132, 131, 130, 129, 127, 126, 122,
+ 119, 117, 116, 115, 114, 112, 111, 110, 109, 108,
+
+ 107, 106, 105, 104, 102, 101, 100, 99, 97, 94,
+ 92, 91, 90, 89, 88, 87, 85, 84, 83, 79,
+ 78, 77, 76, 75, 74, 73, 72, 69, 68, 67,
+ 66, 65, 64, 63, 62, 61, 60, 59, 58, 57,
+ 55, 54, 52, 51, 50, 47, 45, 43, 42, 40,
+ 39, 32, 27, 25, 24, 15, 13, 10, 5, 309,
+ 309, 309, 309, 309, 309, 309, 309, 309, 309, 309,
+ 309, 309, 309, 309, 309, 309, 309, 309, 309, 309,
+ 309, 309, 309, 309, 309, 309, 309, 309, 309, 309,
+ 309, 309, 309, 309, 309, 309, 309, 309, 309, 309,
+
+ 309, 309, 309, 309, 309
+ } ;
+
+/* Table of booleans, true if rule could match eol. */
+static yyconst flex_int32_t yy_rule_can_match_eol[99] =
+ { 0,
+0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, };
+
+static yy_state_type yy_last_accepting_state;
+static char *yy_last_accepting_cpos;
+
+extern int yy_flex_debug;
+int yy_flex_debug = 0;
+
+/* The intent behind this definition is that it'll catch
+ * any uses of REJECT which flex missed.
+ */
+#define REJECT reject_used_but_not_detected
+#define yymore() yymore_used_but_not_detected
+#define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET
+#ifndef YYLMAX
+#define YYLMAX 8192
+#endif
+
+char yytext[YYLMAX];
+char *yytext_ptr;
+#line 1 "parser/tf_fuzz_grammar.l"
+/*
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+#line 10 "parser/tf_fuzz_grammar.l"
+#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
+
+
+#line 738 "parser/tf_fuzz_grammar.lex.c"
+
+#define INITIAL 0
+#define BLOCK_COMMENT 1
+
+#ifndef YY_NO_UNISTD_H
+/* Special case for "unistd.h", since it is non-ANSI. We include it way
+ * down here because we want the user's section 1 to have been scanned first.
+ * The user has a chance to override it with an option.
+ */
+#include <unistd.h>
+#endif
+
+#ifndef YY_EXTRA_TYPE
+#define YY_EXTRA_TYPE void *
+#endif
+
+static int yy_init_globals (void );
+
+/* Accessor methods to globals.
+ These are made visible to non-reentrant scanners for convenience. */
+
+int yylex_destroy (void );
+
+int yyget_debug (void );
+
+void yyset_debug (int debug_flag );
+
+YY_EXTRA_TYPE yyget_extra (void );
+
+void yyset_extra (YY_EXTRA_TYPE user_defined );
+
+FILE *yyget_in (void );
+
+void yyset_in (FILE * _in_str );
+
+FILE *yyget_out (void );
+
+void yyset_out (FILE * _out_str );
+
+yy_size_t yyget_leng (void );
+
+char *yyget_text (void );
+
+int yyget_lineno (void );
+
+void yyset_lineno (int _line_number );
+
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef YY_SKIP_YYWRAP
+#ifdef __cplusplus
+extern "C" int yywrap (void );
+#else
+extern int yywrap (void );
+#endif
+#endif
+
+#ifndef YY_NO_UNPUT
+
+ static void yyunput (int c,char *buf_ptr );
+
+#endif
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char *,yyconst char *,int );
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * );
+#endif
+
+#ifndef YY_NO_INPUT
+
+#ifdef __cplusplus
+static int yyinput (void );
+#else
+static int input (void );
+#endif
+
+#endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k */
+#define YY_READ_BUF_SIZE 16384
+#else
+#define YY_READ_BUF_SIZE 8192
+#endif /* __ia64__ */
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+#ifndef ECHO
+/* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
+#endif
+
+/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
+ { \
+ int c = '*'; \
+ size_t n; \
+ for ( n = 0; n < max_size && \
+ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
+ buf[n] = (char) c; \
+ if ( c == '\n' ) \
+ buf[n++] = (char) c; \
+ if ( c == EOF && ferror( yyin ) ) \
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
+ result = n; \
+ } \
+ else \
+ { \
+ errno=0; \
+ while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
+ { \
+ if( errno != EINTR) \
+ { \
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
+ break; \
+ } \
+ errno=0; \
+ clearerr(yyin); \
+ } \
+ }\
+\
+
+#endif
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
+#endif
+
+/* end tables serialization structures and prototypes */
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL_IS_OURS 1
+
+extern int yylex (void);
+
+#define YY_DECL int yylex (void)
+#endif /* !YY_DECL */
+
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK /*LINTED*/break;
+#endif
+
+#define YY_RULE_SETUP \
+ YY_USER_ACTION
+
+/** The main scanner function which does all the work.
+ */
+YY_DECL
+{
+ yy_state_type yy_current_state;
+ char *yy_cp, *yy_bp;
+ int yy_act;
+
+ if ( !(yy_init) )
+ {
+ (yy_init) = 1;
+
+#ifdef YY_USER_INIT
+ YY_USER_INIT;
+#endif
+
+ if ( ! (yy_start) )
+ (yy_start) = 1; /* first start state */
+
+ if ( ! yyin )
+ yyin = stdin;
+
+ if ( ! yyout )
+ yyout = stdout;
+
+ if ( ! YY_CURRENT_BUFFER ) {
+ yyensure_buffer_stack ();
+ YY_CURRENT_BUFFER_LVALUE =
+ yy_create_buffer(yyin,YY_BUF_SIZE );
+ }
+
+ yy_load_buffer_state( );
+ }
+
+ {
+#line 55 "parser/tf_fuzz_grammar.l"
+
+
+#line 960 "parser/tf_fuzz_grammar.lex.c"
+
+ while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
+ {
+ yy_cp = (yy_c_buf_p);
+
+ /* Support of yytext. */
+ *yy_cp = (yy_hold_char);
+
+ /* yy_bp points to the position in yy_ch_buf of the start of
+ * the current run.
+ */
+ yy_bp = yy_cp;
+
+ yy_current_state = (yy_start);
+yy_match:
+ do
+ {
+ YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
+ if ( yy_accept[yy_current_state] )
+ {
+ (yy_last_accepting_state) = yy_current_state;
+ (yy_last_accepting_cpos) = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 310 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ ++yy_cp;
+ }
+ while ( yy_base[yy_current_state] != 360 );
+
+yy_find_action:
+ yy_act = yy_accept[yy_current_state];
+ if ( yy_act == 0 )
+ { /* have to back up */
+ yy_cp = (yy_last_accepting_cpos);
+ yy_current_state = (yy_last_accepting_state);
+ yy_act = yy_accept[yy_current_state];
+ }
+
+ YY_DO_BEFORE_ACTION;
+
+ if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
+ {
+ yy_size_t yyl;
+ for ( yyl = 0; yyl < yyleng; ++yyl )
+ if ( yytext[yyl] == '\n' )
+
+ yylineno++;
+;
+ }
+
+do_action: /* This label is used only to access EOF actions. */
+
+ switch ( yy_act )
+ { /* beginning of action switch */
+ case 0: /* must back up */
+ /* undo the effects of YY_DO_BEFORE_ACTION */
+ *yy_cp = (yy_hold_char);
+ yy_cp = (yy_last_accepting_cpos);
+ yy_current_state = (yy_last_accepting_state);
+ goto yy_find_action;
+
+case 1:
+YY_RULE_SETUP
+#line 57 "parser/tf_fuzz_grammar.l"
+; /* ignore all \r */
+ YY_BREAK
+case 2:
+/* rule 2 can match eol */
+YY_RULE_SETUP
+#line 58 "parser/tf_fuzz_grammar.l"
+; /* ignore C++-style line comments */
+ YY_BREAK
+case 3:
+/* rule 3 can match eol */
+YY_RULE_SETUP
+#line 59 "parser/tf_fuzz_grammar.l"
+return PURPOSE;
+ YY_BREAK
+case 4:
+YY_RULE_SETUP
+#line 60 "parser/tf_fuzz_grammar.l"
+{BEGIN(BLOCK_COMMENT);}
+ YY_BREAK
+case 5:
+YY_RULE_SETUP
+#line 61 "parser/tf_fuzz_grammar.l"
+{BEGIN(INITIAL);}
+ YY_BREAK
+case 6:
+/* rule 6 can match eol */
+YY_RULE_SETUP
+#line 62 "parser/tf_fuzz_grammar.l"
+;
+ YY_BREAK
+case 7:
+YY_RULE_SETUP
+#line 63 "parser/tf_fuzz_grammar.l"
+;
+ YY_BREAK
+/* Root commands: */
+case 8:
+YY_RULE_SETUP
+#line 65 "parser/tf_fuzz_grammar.l"
+return SET;
+ YY_BREAK
+case 9:
+YY_RULE_SETUP
+#line 66 "parser/tf_fuzz_grammar.l"
+return READ;
+ YY_BREAK
+case 10:
+YY_RULE_SETUP
+#line 67 "parser/tf_fuzz_grammar.l"
+return REMOVE;
+ YY_BREAK
+case 11:
+YY_RULE_SETUP
+#line 68 "parser/tf_fuzz_grammar.l"
+return REMOVE;
+ YY_BREAK
+case 12:
+YY_RULE_SETUP
+#line 69 "parser/tf_fuzz_grammar.l"
+return SECURE;
+ YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 70 "parser/tf_fuzz_grammar.l"
+return SECURE;
+ YY_BREAK
+case 14:
+YY_RULE_SETUP
+#line 71 "parser/tf_fuzz_grammar.l"
+return DONE;
+ YY_BREAK
+/* PSA-asset types: */
+case 15:
+YY_RULE_SETUP
+#line 73 "parser/tf_fuzz_grammar.l"
+return SST;
+ YY_BREAK
+case 16:
+YY_RULE_SETUP
+#line 74 "parser/tf_fuzz_grammar.l"
+return KEY;
+ YY_BREAK
+case 17:
+YY_RULE_SETUP
+#line 75 "parser/tf_fuzz_grammar.l"
+return POLICY;
+ YY_BREAK
+/* Other root-command operands: */
+case 18:
+YY_RULE_SETUP
+#line 77 "parser/tf_fuzz_grammar.l"
+return EXPECT;
+ YY_BREAK
+case 19:
+YY_RULE_SETUP
+#line 78 "parser/tf_fuzz_grammar.l"
+return EXPECT;
+ YY_BREAK
+case 20:
+YY_RULE_SETUP
+#line 79 "parser/tf_fuzz_grammar.l"
+return PASS;
+ YY_BREAK
+case 21:
+YY_RULE_SETUP
+#line 80 "parser/tf_fuzz_grammar.l"
+return FAIL;
+ YY_BREAK
+case 22:
+YY_RULE_SETUP
+#line 81 "parser/tf_fuzz_grammar.l"
+return NOTHING;
+ YY_BREAK
+case 23:
+YY_RULE_SETUP
+#line 82 "parser/tf_fuzz_grammar.l"
+return ERROR;
+ YY_BREAK
+case 24:
+YY_RULE_SETUP
+#line 83 "parser/tf_fuzz_grammar.l"
+return OPEN_BRACE;
+ YY_BREAK
+case 25:
+YY_RULE_SETUP
+#line 84 "parser/tf_fuzz_grammar.l"
+return CLOSE_BRACE;
+ YY_BREAK
+case 26:
+YY_RULE_SETUP
+#line 85 "parser/tf_fuzz_grammar.l"
+return SEMICOLON;
+ YY_BREAK
+case 27:
+YY_RULE_SETUP
+#line 86 "parser/tf_fuzz_grammar.l"
+return NAME;
+ YY_BREAK
+case 28:
+YY_RULE_SETUP
+#line 87 "parser/tf_fuzz_grammar.l"
+return UID;
+ YY_BREAK
+case 29:
+YY_RULE_SETUP
+#line 88 "parser/tf_fuzz_grammar.l"
+return DATA;
+ YY_BREAK
+case 30:
+YY_RULE_SETUP
+#line 89 "parser/tf_fuzz_grammar.l"
+return STAR;
+ YY_BREAK
+case 31:
+YY_RULE_SETUP
+#line 90 "parser/tf_fuzz_grammar.l"
+return ACTIVE;
+ YY_BREAK
+case 32:
+YY_RULE_SETUP
+#line 91 "parser/tf_fuzz_grammar.l"
+return ACTIVE;
+ YY_BREAK
+case 33:
+YY_RULE_SETUP
+#line 92 "parser/tf_fuzz_grammar.l"
+return DELETED;
+ YY_BREAK
+case 34:
+YY_RULE_SETUP
+#line 93 "parser/tf_fuzz_grammar.l"
+return DELETED;
+ YY_BREAK
+case 35:
+YY_RULE_SETUP
+#line 94 "parser/tf_fuzz_grammar.l"
+return DELETED;
+ YY_BREAK
+case 36:
+YY_RULE_SETUP
+#line 95 "parser/tf_fuzz_grammar.l"
+return CHECK;
+ YY_BREAK
+case 37:
+YY_RULE_SETUP
+#line 96 "parser/tf_fuzz_grammar.l"
+return CHECK;
+ YY_BREAK
+case 38:
+YY_RULE_SETUP
+#line 97 "parser/tf_fuzz_grammar.l"
+return VAR;
+ YY_BREAK
+case 39:
+YY_RULE_SETUP
+#line 98 "parser/tf_fuzz_grammar.l"
+return PRINT;
+ YY_BREAK
+case 40:
+YY_RULE_SETUP
+#line 99 "parser/tf_fuzz_grammar.l"
+return HASH;
+ YY_BREAK
+case 41:
+YY_RULE_SETUP
+#line 100 "parser/tf_fuzz_grammar.l"
+return NEQ;
+ YY_BREAK
+case 42:
+YY_RULE_SETUP
+#line 101 "parser/tf_fuzz_grammar.l"
+return DFNAME;
+ YY_BREAK
+case 43:
+YY_RULE_SETUP
+#line 102 "parser/tf_fuzz_grammar.l"
+return SHUFFLE;
+ YY_BREAK
+case 44:
+YY_RULE_SETUP
+#line 103 "parser/tf_fuzz_grammar.l"
+return SHUFFLE;
+ YY_BREAK
+case 45:
+YY_RULE_SETUP
+#line 104 "parser/tf_fuzz_grammar.l"
+return TO;
+ YY_BREAK
+case 46:
+YY_RULE_SETUP
+#line 105 "parser/tf_fuzz_grammar.l"
+return OF;
+ YY_BREAK
+/* SST creation keywords: */
+case 47:
+YY_RULE_SETUP
+#line 107 "parser/tf_fuzz_grammar.l"
+return FLAG;
+ YY_BREAK
+case 48:
+YY_RULE_SETUP
+#line 108 "parser/tf_fuzz_grammar.l"
+return NONE;
+ YY_BREAK
+case 49:
+YY_RULE_SETUP
+#line 109 "parser/tf_fuzz_grammar.l"
+return WRITE_ONCE;
+ YY_BREAK
+case 50:
+YY_RULE_SETUP
+#line 110 "parser/tf_fuzz_grammar.l"
+return WRITE_ONCE;
+ YY_BREAK
+case 51:
+YY_RULE_SETUP
+#line 111 "parser/tf_fuzz_grammar.l"
+return NO_RP;
+ YY_BREAK
+case 52:
+YY_RULE_SETUP
+#line 112 "parser/tf_fuzz_grammar.l"
+return NO_RP;
+ YY_BREAK
+case 53:
+YY_RULE_SETUP
+#line 113 "parser/tf_fuzz_grammar.l"
+return NO_CONF;
+ YY_BREAK
+case 54:
+YY_RULE_SETUP
+#line 114 "parser/tf_fuzz_grammar.l"
+return NO_CONF;
+ YY_BREAK
+/* Offset into an SST asset */
+case 55:
+YY_RULE_SETUP
+#line 116 "parser/tf_fuzz_grammar.l"
+return OFFSET;
+ YY_BREAK
+/* Policy keywords: */
+case 56:
+YY_RULE_SETUP
+#line 118 "parser/tf_fuzz_grammar.l"
+return ATTR;
+ YY_BREAK
+case 57:
+YY_RULE_SETUP
+#line 119 "parser/tf_fuzz_grammar.l"
+return ATTR;
+ YY_BREAK
+case 58:
+YY_RULE_SETUP
+#line 120 "parser/tf_fuzz_grammar.l"
+return TYPE;
+ YY_BREAK
+case 59:
+YY_RULE_SETUP
+#line 121 "parser/tf_fuzz_grammar.l"
+return ALG;
+ YY_BREAK
+case 60:
+YY_RULE_SETUP
+#line 122 "parser/tf_fuzz_grammar.l"
+return ALG;
+ YY_BREAK
+/* Policy-usage and -lifetime keywords: */
+case 61:
+YY_RULE_SETUP
+#line 124 "parser/tf_fuzz_grammar.l"
+return EXPORT;
+ YY_BREAK
+case 62:
+YY_RULE_SETUP
+#line 125 "parser/tf_fuzz_grammar.l"
+return EXPORT;
+ YY_BREAK
+case 63:
+YY_RULE_SETUP
+#line 126 "parser/tf_fuzz_grammar.l"
+return NOEXPORT;
+ YY_BREAK
+case 64:
+YY_RULE_SETUP
+#line 127 "parser/tf_fuzz_grammar.l"
+return NOEXPORT;
+ YY_BREAK
+case 65:
+YY_RULE_SETUP
+#line 128 "parser/tf_fuzz_grammar.l"
+return COPY;
+ YY_BREAK
+case 66:
+YY_RULE_SETUP
+#line 129 "parser/tf_fuzz_grammar.l"
+return NOCOPY;
+ YY_BREAK
+case 67:
+YY_RULE_SETUP
+#line 130 "parser/tf_fuzz_grammar.l"
+return ENCRYPT;
+ YY_BREAK
+case 68:
+YY_RULE_SETUP
+#line 131 "parser/tf_fuzz_grammar.l"
+return ENCRYPT;
+ YY_BREAK
+case 69:
+YY_RULE_SETUP
+#line 132 "parser/tf_fuzz_grammar.l"
+return NOENCRYPT;
+ YY_BREAK
+case 70:
+YY_RULE_SETUP
+#line 133 "parser/tf_fuzz_grammar.l"
+return NOENCRYPT;
+ YY_BREAK
+case 71:
+YY_RULE_SETUP
+#line 134 "parser/tf_fuzz_grammar.l"
+return DECRYPT;
+ YY_BREAK
+case 72:
+YY_RULE_SETUP
+#line 135 "parser/tf_fuzz_grammar.l"
+return DECRYPT;
+ YY_BREAK
+case 73:
+YY_RULE_SETUP
+#line 136 "parser/tf_fuzz_grammar.l"
+return NODECRYPT;
+ YY_BREAK
+case 74:
+YY_RULE_SETUP
+#line 137 "parser/tf_fuzz_grammar.l"
+return NODECRYPT;
+ YY_BREAK
+case 75:
+YY_RULE_SETUP
+#line 138 "parser/tf_fuzz_grammar.l"
+return SIGN;
+ YY_BREAK
+case 76:
+YY_RULE_SETUP
+#line 139 "parser/tf_fuzz_grammar.l"
+return NOSIGN;
+ YY_BREAK
+case 77:
+YY_RULE_SETUP
+#line 140 "parser/tf_fuzz_grammar.l"
+return VERIFY;
+ YY_BREAK
+case 78:
+YY_RULE_SETUP
+#line 141 "parser/tf_fuzz_grammar.l"
+return VERIFY;
+ YY_BREAK
+case 79:
+YY_RULE_SETUP
+#line 142 "parser/tf_fuzz_grammar.l"
+return NOVERIFY;
+ YY_BREAK
+case 80:
+YY_RULE_SETUP
+#line 143 "parser/tf_fuzz_grammar.l"
+return NOVERIFY;
+ YY_BREAK
+case 81:
+YY_RULE_SETUP
+#line 144 "parser/tf_fuzz_grammar.l"
+return DERIVE;
+ YY_BREAK
+case 82:
+YY_RULE_SETUP
+#line 145 "parser/tf_fuzz_grammar.l"
+return DERIVE;
+ YY_BREAK
+case 83:
+YY_RULE_SETUP
+#line 146 "parser/tf_fuzz_grammar.l"
+return NODERIVE;
+ YY_BREAK
+case 84:
+YY_RULE_SETUP
+#line 147 "parser/tf_fuzz_grammar.l"
+return NODERIVE;
+ YY_BREAK
+case 85:
+YY_RULE_SETUP
+#line 148 "parser/tf_fuzz_grammar.l"
+return PERSISTENT;
+ YY_BREAK
+case 86:
+YY_RULE_SETUP
+#line 149 "parser/tf_fuzz_grammar.l"
+return PERSISTENT;
+ YY_BREAK
+case 87:
+YY_RULE_SETUP
+#line 150 "parser/tf_fuzz_grammar.l"
+return VOLATILE;
+ YY_BREAK
+case 88:
+YY_RULE_SETUP
+#line 151 "parser/tf_fuzz_grammar.l"
+return VOLATILE;
+ YY_BREAK
+case 89:
+YY_RULE_SETUP
+#line 152 "parser/tf_fuzz_grammar.l"
+return FROM;
+ YY_BREAK
+case 90:
+YY_RULE_SETUP
+#line 153 "parser/tf_fuzz_grammar.l"
+return WITH;
+ YY_BREAK
+/* Structure operands: */
+case 91:
+YY_RULE_SETUP
+#line 155 "parser/tf_fuzz_grammar.l"
+{yylval.str = yytext; return IDENTIFIER_TOK;}
+ YY_BREAK
+case 92:
+YY_RULE_SETUP
+#line 156 "parser/tf_fuzz_grammar.l"
+{yylval.valueN = atol(yytext); return NUMBER_TOK;}
+ YY_BREAK
+case 93:
+YY_RULE_SETUP
+#line 157 "parser/tf_fuzz_grammar.l"
+{yylval.str = yytext; return FILE_PATH_TOK;}
+ YY_BREAK
+case 94:
+/* rule 94 can match eol */
+YY_RULE_SETUP
+#line 158 "parser/tf_fuzz_grammar.l"
+{yylval.str = yytext; return LITERAL_TOK;}
+ YY_BREAK
+case 95:
+YY_RULE_SETUP
+#line 159 "parser/tf_fuzz_grammar.l"
+{yylval.str = yytext; return HEX_LIST;}
+ YY_BREAK
+/* inside quotes: anything but a quote, or nothing */
+case 96:
+/* rule 96 can match eol */
+YY_RULE_SETUP
+#line 161 "parser/tf_fuzz_grammar.l"
+; /* ignore white space */
+ YY_BREAK
+case 97:
+YY_RULE_SETUP
+#line 162 "parser/tf_fuzz_grammar.l"
+yyerror ((tf_fuzz_info *) NULL, "Unexpected character");
+ YY_BREAK
+case 98:
+YY_RULE_SETUP
+#line 164 "parser/tf_fuzz_grammar.l"
+YY_FATAL_ERROR( "flex scanner jammed" );
+ YY_BREAK
+#line 1531 "parser/tf_fuzz_grammar.lex.c"
+case YY_STATE_EOF(INITIAL):
+case YY_STATE_EOF(BLOCK_COMMENT):
+ yyterminate();
+
+ case YY_END_OF_BUFFER:
+ {
+ /* Amount of text matched not including the EOB char. */
+ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
+
+ /* Undo the effects of YY_DO_BEFORE_ACTION. */
+ *yy_cp = (yy_hold_char);
+ YY_RESTORE_YY_MORE_OFFSET
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
+ {
+ /* We're scanning a new file or input source. It's
+ * possible that this happened because the user
+ * just pointed yyin at a new source and called
+ * yylex(). If so, then we have to assure
+ * consistency between YY_CURRENT_BUFFER and our
+ * globals. Here is the right place to do so, because
+ * this is the first action (other than possibly a
+ * back-up) that will match for the new input source.
+ */
+ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+ YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
+ }
+
+ /* Note that here we test for yy_c_buf_p "<=" to the position
+ * of the first EOB in the buffer, since yy_c_buf_p will
+ * already have been incremented past the NUL character
+ * (since all states make transitions on EOB to the
+ * end-of-buffer state). Contrast this with the test
+ * in input().
+ */
+ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+ { /* This was really a NUL. */
+ yy_state_type yy_next_state;
+
+ (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state( );
+
+ /* Okay, we're now positioned to make the NUL
+ * transition. We couldn't have
+ * yy_get_previous_state() go ahead and do it
+ * for us because it doesn't know how to deal
+ * with the possibility of jamming (and we don't
+ * want to build jamming into it because then it
+ * will run more slowly).
+ */
+
+ yy_next_state = yy_try_NUL_trans( yy_current_state );
+
+ yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+
+ if ( yy_next_state )
+ {
+ /* Consume the NUL. */
+ yy_cp = ++(yy_c_buf_p);
+ yy_current_state = yy_next_state;
+ goto yy_match;
+ }
+
+ else
+ {
+ yy_cp = (yy_c_buf_p);
+ goto yy_find_action;
+ }
+ }
+
+ else switch ( yy_get_next_buffer( ) )
+ {
+ case EOB_ACT_END_OF_FILE:
+ {
+ (yy_did_buffer_switch_on_eof) = 0;
+
+ if ( yywrap( ) )
+ {
+ /* Note: because we've taken care in
+ * yy_get_next_buffer() to have set up
+ * yytext, we can now set up
+ * yy_c_buf_p so that if some total
+ * hoser (like flex itself) wants to
+ * call the scanner after we return the
+ * YY_NULL, it'll still work - another
+ * YY_NULL will get returned.
+ */
+ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
+
+ yy_act = YY_STATE_EOF(YY_START);
+ goto do_action;
+ }
+
+ else
+ {
+ if ( ! (yy_did_buffer_switch_on_eof) )
+ YY_NEW_FILE;
+ }
+ break;
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ (yy_c_buf_p) =
+ (yytext_ptr) + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state( );
+
+ yy_cp = (yy_c_buf_p);
+ yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+ goto yy_match;
+
+ case EOB_ACT_LAST_MATCH:
+ (yy_c_buf_p) =
+ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
+
+ yy_current_state = yy_get_previous_state( );
+
+ yy_cp = (yy_c_buf_p);
+ yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+ goto yy_find_action;
+ }
+ break;
+ }
+
+ default:
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--no action found" );
+ } /* end of action switch */
+ } /* end of scanning one token */
+ } /* end of user's declarations */
+} /* end of yylex */
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ * EOB_ACT_LAST_MATCH -
+ * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ * EOB_ACT_END_OF_FILE - end of file
+ */
+static int yy_get_next_buffer (void)
+{
+ char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+ char *source = (yytext_ptr);
+ yy_size_t number_to_move, i;
+ int ret_val;
+
+ if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--end of buffer missed" );
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
+ { /* Don't try to fill the buffer, so this is an EOF. */
+ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
+ {
+ /* We matched a single character, the EOB, so
+ * treat this as a final EOF.
+ */
+ return EOB_ACT_END_OF_FILE;
+ }
+
+ else
+ {
+ /* We matched some text prior to the EOB, first
+ * process it.
+ */
+ return EOB_ACT_LAST_MATCH;
+ }
+ }
+
+ /* Try to read more data. */
+
+ /* First move last chars to start of buffer. */
+ number_to_move = (yy_size_t) ((yy_c_buf_p) - (yytext_ptr)) - 1;
+
+ for ( i = 0; i < number_to_move; ++i )
+ *(dest++) = *(source++);
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+ /* don't do the read, it's not guaranteed to return an EOF,
+ * just force an EOF
+ */
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
+
+ else
+ {
+ yy_size_t num_to_read =
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+
+ while ( num_to_read <= 0 )
+ { /* Not enough room in the buffer - grow it. */
+
+ /* just a shorter name for the current buffer */
+ YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
+
+ int yy_c_buf_p_offset =
+ (int) ((yy_c_buf_p) - b->yy_ch_buf);
+
+ if ( b->yy_is_our_buffer )
+ {
+ yy_size_t new_size = b->yy_buf_size * 2;
+
+ if ( new_size <= 0 )
+ b->yy_buf_size += b->yy_buf_size / 8;
+ else
+ b->yy_buf_size *= 2;
+
+ b->yy_ch_buf = (char *)
+ /* Include room in for 2 EOB chars. */
+ yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
+ }
+ else
+ /* Can't grow it, we don't own it. */
+ b->yy_ch_buf = 0;
+
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR(
+ "fatal error - scanner input buffer overflow" );
+
+ (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+ num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
+ number_to_move - 1;
+
+ }
+
+ if ( num_to_read > YY_READ_BUF_SIZE )
+ num_to_read = YY_READ_BUF_SIZE;
+
+ /* Read in more data. */
+ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
+ (yy_n_chars), num_to_read );
+
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+ }
+
+ if ( (yy_n_chars) == 0 )
+ {
+ if ( number_to_move == YY_MORE_ADJ )
+ {
+ ret_val = EOB_ACT_END_OF_FILE;
+ yyrestart(yyin );
+ }
+
+ else
+ {
+ ret_val = EOB_ACT_LAST_MATCH;
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
+ YY_BUFFER_EOF_PENDING;
+ }
+ }
+
+ else
+ ret_val = EOB_ACT_CONTINUE_SCAN;
+
+ if ((int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+ /* Extend the array by 50%, plus the number we really need. */
+ int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
+ if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+ }
+
+ (yy_n_chars) += number_to_move;
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
+
+ (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+
+ return ret_val;
+}
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+ static yy_state_type yy_get_previous_state (void)
+{
+ yy_state_type yy_current_state;
+ char *yy_cp;
+
+ yy_current_state = (yy_start);
+
+ for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
+ {
+ YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+ if ( yy_accept[yy_current_state] )
+ {
+ (yy_last_accepting_state) = yy_current_state;
+ (yy_last_accepting_cpos) = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 310 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ }
+
+ return yy_current_state;
+}
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ * next_state = yy_try_NUL_trans( current_state );
+ */
+ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
+{
+ int yy_is_jam;
+ char *yy_cp = (yy_c_buf_p);
+
+ YY_CHAR yy_c = 1;
+ if ( yy_accept[yy_current_state] )
+ {
+ (yy_last_accepting_state) = yy_current_state;
+ (yy_last_accepting_cpos) = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 310 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ yy_is_jam = (yy_current_state == 309);
+
+ return yy_is_jam ? 0 : yy_current_state;
+}
+
+#ifndef YY_NO_UNPUT
+
+ static void yyunput (int c, char * yy_bp )
+{
+ char *yy_cp;
+
+ yy_cp = (yy_c_buf_p);
+
+ /* undo effects of setting up yytext */
+ *yy_cp = (yy_hold_char);
+
+ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+ { /* need to shift things up to make room */
+ /* +2 for EOB chars. */
+ yy_size_t number_to_move = (yy_n_chars) + 2;
+ char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
+ char *source =
+ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
+
+ while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+ *--dest = *--source;
+
+ yy_cp += (int) (dest - source);
+ yy_bp += (int) (dest - source);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
+ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
+
+ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+ YY_FATAL_ERROR( "flex scanner push-back overflow" );
+ }
+
+ *--yy_cp = (char) c;
+
+ if ( c == '\n' ){
+ --yylineno;
+ }
+
+ (yytext_ptr) = yy_bp;
+ (yy_hold_char) = *yy_cp;
+ (yy_c_buf_p) = yy_cp;
+}
+
+#endif
+
+#ifndef YY_NO_INPUT
+#ifdef __cplusplus
+ static int yyinput (void)
+#else
+ static int input (void)
+#endif
+
+{
+ int c;
+
+ *(yy_c_buf_p) = (yy_hold_char);
+
+ if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
+ {
+ /* yy_c_buf_p now points to the character we want to return.
+ * If this occurs *before* the EOB characters, then it's a
+ * valid NUL; if not, then we've hit the end of the buffer.
+ */
+ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+ /* This was really a NUL. */
+ *(yy_c_buf_p) = '\0';
+
+ else
+ { /* need more input */
+ yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
+ ++(yy_c_buf_p);
+
+ switch ( yy_get_next_buffer( ) )
+ {
+ case EOB_ACT_LAST_MATCH:
+ /* This happens because yy_g_n_b()
+ * sees that we've accumulated a
+ * token and flags that we need to
+ * try matching the token before
+ * proceeding. But for input(),
+ * there's no matching to consider.
+ * So convert the EOB_ACT_LAST_MATCH
+ * to EOB_ACT_END_OF_FILE.
+ */
+
+ /* Reset buffer status. */
+ yyrestart(yyin );
+
+ /*FALLTHROUGH*/
+
+ case EOB_ACT_END_OF_FILE:
+ {
+ if ( yywrap( ) )
+ return EOF;
+
+ if ( ! (yy_did_buffer_switch_on_eof) )
+ YY_NEW_FILE;
+#ifdef __cplusplus
+ return yyinput();
+#else
+ return input();
+#endif
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ (yy_c_buf_p) = (yytext_ptr) + offset;
+ break;
+ }
+ }
+ }
+
+ c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
+ *(yy_c_buf_p) = '\0'; /* preserve yytext */
+ (yy_hold_char) = *++(yy_c_buf_p);
+
+ if ( c == '\n' )
+
+ yylineno++;
+;
+
+ return c;
+}
+#endif /* ifndef YY_NO_INPUT */
+
+/** Immediately switch to a different input stream.
+ * @param input_file A readable stream.
+ *
+ * @note This function does not reset the start condition to @c INITIAL .
+ */
+ void yyrestart (FILE * input_file )
+{
+
+ if ( ! YY_CURRENT_BUFFER ){
+ yyensure_buffer_stack ();
+ YY_CURRENT_BUFFER_LVALUE =
+ yy_create_buffer(yyin,YY_BUF_SIZE );
+ }
+
+ yy_init_buffer(YY_CURRENT_BUFFER,input_file );
+ yy_load_buffer_state( );
+}
+
+/** Switch to a different input buffer.
+ * @param new_buffer The new input buffer.
+ *
+ */
+ void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
+{
+
+ /* TODO. We should be able to replace this entire function body
+ * with
+ * yypop_buffer_state();
+ * yypush_buffer_state(new_buffer);
+ */
+ yyensure_buffer_stack ();
+ if ( YY_CURRENT_BUFFER == new_buffer )
+ return;
+
+ if ( YY_CURRENT_BUFFER )
+ {
+ /* Flush out information for old buffer. */
+ *(yy_c_buf_p) = (yy_hold_char);
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+ }
+
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
+ yy_load_buffer_state( );
+
+ /* We don't actually know whether we did this switch during
+ * EOF (yywrap()) processing, but the only time this flag
+ * is looked at is after yywrap() is called, so it's safe
+ * to go ahead and always set it.
+ */
+ (yy_did_buffer_switch_on_eof) = 1;
+}
+
+static void yy_load_buffer_state (void)
+{
+ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+ (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
+ yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
+ (yy_hold_char) = *(yy_c_buf_p);
+}
+
+/** Allocate and initialize an input buffer state.
+ * @param file A readable stream.
+ * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
+ *
+ * @return the allocated buffer state.
+ */
+ YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
+{
+ YY_BUFFER_STATE b;
+
+ b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_buf_size = (yy_size_t)size;
+
+ /* yy_ch_buf has to be 2 characters longer than the size given because
+ * we need to put in 2 end-of-buffer characters.
+ */
+ b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_is_our_buffer = 1;
+
+ yy_init_buffer(b,file );
+
+ return b;
+}
+
+/** Destroy the buffer.
+ * @param b a buffer created with yy_create_buffer()
+ *
+ */
+ void yy_delete_buffer (YY_BUFFER_STATE b )
+{
+
+ if ( ! b )
+ return;
+
+ if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
+ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
+
+ if ( b->yy_is_our_buffer )
+ yyfree((void *) b->yy_ch_buf );
+
+ yyfree((void *) b );
+}
+
+/* Initializes or reinitializes a buffer.
+ * This function is sometimes called more than once on the same buffer,
+ * such as during a yyrestart() or at EOF.
+ */
+ static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
+
+{
+ int oerrno = errno;
+
+ yy_flush_buffer(b );
+
+ b->yy_input_file = file;
+ b->yy_fill_buffer = 1;
+
+ /* If b is the current buffer, then yy_init_buffer was _probably_
+ * called from yyrestart() or through yy_get_next_buffer.
+ * In that case, we don't want to reset the lineno or column.
+ */
+ if (b != YY_CURRENT_BUFFER){
+ b->yy_bs_lineno = 1;
+ b->yy_bs_column = 0;
+ }
+
+ b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+
+ errno = oerrno;
+}
+
+/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
+ * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
+ *
+ */
+ void yy_flush_buffer (YY_BUFFER_STATE b )
+{
+ if ( ! b )
+ return;
+
+ b->yy_n_chars = 0;
+
+ /* We always need two end-of-buffer characters. The first causes
+ * a transition to the end-of-buffer state. The second causes
+ * a jam in that state.
+ */
+ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+ b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+ b->yy_buf_pos = &b->yy_ch_buf[0];
+
+ b->yy_at_bol = 1;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ if ( b == YY_CURRENT_BUFFER )
+ yy_load_buffer_state( );
+}
+
+/** Pushes the new state onto the stack. The new state becomes
+ * the current state. This function will allocate the stack
+ * if necessary.
+ * @param new_buffer The new state.
+ *
+ */
+void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
+{
+ if (new_buffer == NULL)
+ return;
+
+ yyensure_buffer_stack();
+
+ /* This block is copied from yy_switch_to_buffer. */
+ if ( YY_CURRENT_BUFFER )
+ {
+ /* Flush out information for old buffer. */
+ *(yy_c_buf_p) = (yy_hold_char);
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+ }
+
+ /* Only push if top exists. Otherwise, replace top. */
+ if (YY_CURRENT_BUFFER)
+ (yy_buffer_stack_top)++;
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
+
+ /* copied from yy_switch_to_buffer. */
+ yy_load_buffer_state( );
+ (yy_did_buffer_switch_on_eof) = 1;
+}
+
+/** Removes and deletes the top of the stack, if present.
+ * The next element becomes the new top.
+ *
+ */
+void yypop_buffer_state (void)
+{
+ if (!YY_CURRENT_BUFFER)
+ return;
+
+ yy_delete_buffer(YY_CURRENT_BUFFER );
+ YY_CURRENT_BUFFER_LVALUE = NULL;
+ if ((yy_buffer_stack_top) > 0)
+ --(yy_buffer_stack_top);
+
+ if (YY_CURRENT_BUFFER) {
+ yy_load_buffer_state( );
+ (yy_did_buffer_switch_on_eof) = 1;
+ }
+}
+
+/* Allocates the stack if it does not exist.
+ * Guarantees space for at least one push.
+ */
+static void yyensure_buffer_stack (void)
+{
+ yy_size_t num_to_alloc;
+
+ if (!(yy_buffer_stack)) {
+
+ /* First allocation is just for 2 elements, since we don't know if this
+ * scanner will even need a stack. We use 2 instead of 1 to avoid an
+ * immediate realloc on the next call.
+ */
+ num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
+ (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
+ (num_to_alloc * sizeof(struct yy_buffer_state*)
+ );
+ if ( ! (yy_buffer_stack) )
+ YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+
+ memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
+
+ (yy_buffer_stack_max) = num_to_alloc;
+ (yy_buffer_stack_top) = 0;
+ return;
+ }
+
+ if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
+
+ /* Increase the buffer to prepare for a possible push. */
+ yy_size_t grow_size = 8 /* arbitrary grow size */;
+
+ num_to_alloc = (yy_buffer_stack_max) + grow_size;
+ (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
+ ((yy_buffer_stack),
+ num_to_alloc * sizeof(struct yy_buffer_state*)
+ );
+ if ( ! (yy_buffer_stack) )
+ YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+
+ /* zero only the new slots.*/
+ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
+ (yy_buffer_stack_max) = num_to_alloc;
+ }
+}
+
+/** Setup the input buffer state to scan directly from a user-specified character buffer.
+ * @param base the character buffer
+ * @param size the size in bytes of the character buffer
+ *
+ * @return the newly allocated buffer state object.
+ */
+YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
+{
+ YY_BUFFER_STATE b;
+
+ if ( size < 2 ||
+ base[size-2] != YY_END_OF_BUFFER_CHAR ||
+ base[size-1] != YY_END_OF_BUFFER_CHAR )
+ /* They forgot to leave room for the EOB's. */
+ return 0;
+
+ b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
+
+ b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
+ b->yy_buf_pos = b->yy_ch_buf = base;
+ b->yy_is_our_buffer = 0;
+ b->yy_input_file = 0;
+ b->yy_n_chars = b->yy_buf_size;
+ b->yy_is_interactive = 0;
+ b->yy_at_bol = 1;
+ b->yy_fill_buffer = 0;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ yy_switch_to_buffer(b );
+
+ return b;
+}
+
+/** Setup the input buffer state to scan a string. The next call to yylex() will
+ * scan from a @e copy of @a str.
+ * @param yystr a NUL-terminated string to scan
+ *
+ * @return the newly allocated buffer state object.
+ * @note If you want to scan bytes that may contain NUL values, then use
+ * yy_scan_bytes() instead.
+ */
+YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
+{
+
+ return yy_scan_bytes(yystr,strlen(yystr) );
+}
+
+/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
+ * scan from a @e copy of @a bytes.
+ * @param yybytes the byte buffer to scan
+ * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
+ *
+ * @return the newly allocated buffer state object.
+ */
+YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len )
+{
+ YY_BUFFER_STATE b;
+ char *buf;
+ yy_size_t n;
+ yy_size_t i;
+
+ /* Get memory for full buffer, including space for trailing EOB's. */
+ n = _yybytes_len + 2;
+ buf = (char *) yyalloc(n );
+ if ( ! buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
+
+ for ( i = 0; i < _yybytes_len; ++i )
+ buf[i] = yybytes[i];
+
+ buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
+
+ b = yy_scan_buffer(buf,n );
+ if ( ! b )
+ YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
+
+ /* It's okay to grow etc. this buffer, and we should throw it
+ * away when we're done.
+ */
+ b->yy_is_our_buffer = 1;
+
+ return b;
+}
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+static void yy_fatal_error (yyconst char* msg )
+{
+ (void) fprintf( stderr, "%s\n", msg );
+ exit( YY_EXIT_FAILURE );
+}
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ int yyless_macro_arg = (n); \
+ YY_LESS_LINENO(yyless_macro_arg);\
+ yytext[yyleng] = (yy_hold_char); \
+ (yy_c_buf_p) = yytext + yyless_macro_arg; \
+ (yy_hold_char) = *(yy_c_buf_p); \
+ *(yy_c_buf_p) = '\0'; \
+ yyleng = yyless_macro_arg; \
+ } \
+ while ( 0 )
+
+/* Accessor methods (get/set functions) to struct members. */
+
+/** Get the current line number.
+ *
+ */
+int yyget_lineno (void)
+{
+
+ return yylineno;
+}
+
+/** Get the input stream.
+ *
+ */
+FILE *yyget_in (void)
+{
+ return yyin;
+}
+
+/** Get the output stream.
+ *
+ */
+FILE *yyget_out (void)
+{
+ return yyout;
+}
+
+/** Get the length of the current token.
+ *
+ */
+yy_size_t yyget_leng (void)
+{
+ return yyleng;
+}
+
+/** Get the current token.
+ *
+ */
+
+char *yyget_text (void)
+{
+ return yytext;
+}
+
+/** Set the current line number.
+ * @param _line_number line number
+ *
+ */
+void yyset_lineno (int _line_number )
+{
+
+ yylineno = _line_number;
+}
+
+/** Set the input stream. This does not discard the current
+ * input buffer.
+ * @param _in_str A readable stream.
+ *
+ * @see yy_switch_to_buffer
+ */
+void yyset_in (FILE * _in_str )
+{
+ yyin = _in_str ;
+}
+
+void yyset_out (FILE * _out_str )
+{
+ yyout = _out_str ;
+}
+
+int yyget_debug (void)
+{
+ return yy_flex_debug;
+}
+
+void yyset_debug (int _bdebug )
+{
+ yy_flex_debug = _bdebug ;
+}
+
+static int yy_init_globals (void)
+{
+ /* Initialization is the same as for the non-reentrant scanner.
+ * This function is called from yylex_destroy(), so don't allocate here.
+ */
+
+ /* We do not touch yylineno unless the option is enabled. */
+ yylineno = 1;
+
+ (yy_buffer_stack) = 0;
+ (yy_buffer_stack_top) = 0;
+ (yy_buffer_stack_max) = 0;
+ (yy_c_buf_p) = (char *) 0;
+ (yy_init) = 0;
+ (yy_start) = 0;
+
+/* Defined in main.c */
+#ifdef YY_STDINIT
+ yyin = stdin;
+ yyout = stdout;
+#else
+ yyin = (FILE *) 0;
+ yyout = (FILE *) 0;
+#endif
+
+ /* For future reference: Set errno on error, since we are called by
+ * yylex_init()
+ */
+ return 0;
+}
+
+/* yylex_destroy is for both reentrant and non-reentrant scanners. */
+int yylex_destroy (void)
+{
+
+ /* Pop the buffer stack, destroying each element. */
+ while(YY_CURRENT_BUFFER){
+ yy_delete_buffer(YY_CURRENT_BUFFER );
+ YY_CURRENT_BUFFER_LVALUE = NULL;
+ yypop_buffer_state();
+ }
+
+ /* Destroy the stack itself. */
+ yyfree((yy_buffer_stack) );
+ (yy_buffer_stack) = NULL;
+
+ /* Reset the globals. This is important in a non-reentrant scanner so the next time
+ * yylex() is called, initialization will occur. */
+ yy_init_globals( );
+
+ return 0;
+}
+
+/*
+ * Internal utility routines.
+ */
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
+{
+
+ int i;
+ for ( i = 0; i < n; ++i )
+ s1[i] = s2[i];
+}
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * s )
+{
+ int n;
+ for ( n = 0; s[n]; ++n )
+ ;
+
+ return n;
+}
+#endif
+
+void *yyalloc (yy_size_t size )
+{
+ return (void *) malloc( size );
+}
+
+void *yyrealloc (void * ptr, yy_size_t size )
+{
+
+ /* The cast to (char *) in the following accommodates both
+ * implementations that use char* generic pointers, and those
+ * that use void* generic pointers. It works with the latter
+ * because both ANSI C and C++ allow castless assignment from
+ * any pointer type to void*, and deal with argument conversions
+ * as though doing an assignment.
+ */
+ return (void *) realloc( (char *) ptr, size );
+}
+
+void yyfree (void * ptr )
+{
+ free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
+}
+
+#define YYTABLES_NAME "yytables"
+
+#line 164 "parser/tf_fuzz_grammar.l"
+
+
+
+
diff --git a/tf_fuzz/parser/tf_fuzz_grammar.lex.o b/tf_fuzz/parser/tf_fuzz_grammar.lex.o
new file mode 100644
index 0000000..bba09f8
--- /dev/null
+++ b/tf_fuzz/parser/tf_fuzz_grammar.lex.o
Binary files differ
diff --git a/tf_fuzz/parser/tf_fuzz_grammar.output b/tf_fuzz/parser/tf_fuzz_grammar.output
new file mode 100644
index 0000000..aaadb77
--- /dev/null
+++ b/tf_fuzz/parser/tf_fuzz_grammar.output
@@ -0,0 +1,2471 @@
+Terminals unused in grammar
+
+ RAW_TEXT
+ EQUAL
+ ERROR
+
+
+Grammar
+
+ 0 $accept: lines $end
+
+ 1 lines: %empty
+ 2 | line lines
+
+ 3 line: PURPOSE
+ 4 | block
+ 5 | command SEMICOLON
+ 6 | command expect SEMICOLON
+
+ 7 command: set_command
+ 8 | remove_command
+ 9 | read_command
+ 10 | secure_command
+ 11 | done_command
+
+ 12 expect: EXPECT PASS
+ 13 | EXPECT FAIL
+ 14 | EXPECT NOTHING
+ 15 | EXPECT IDENTIFIER
+
+ 16 set_command: SET SST sst_set_base_args sst_set_extended_args
+ 17 | SET KEY key_set_args
+ 18 | SET POLICY policy_set_args
+
+ 19 read_command: READ SST sst_read_args
+ 20 | READ KEY key_read_args
+ 21 | READ POLICY policy_read_args
+
+ 22 remove_command: REMOVE SST sst_remove_args
+ 23 | REMOVE KEY key_remove_args
+
+ 24 secure_command: SECURE HASH NEQ ASSET_IDENTIFIER_LIST
+
+ 25 done_command: DONE
+
+ 26 literal_or_random_data: DATA LITERAL
+ 27 | DATA STAR
+
+ 28 sst_set_base_args: sst_asset_name literal_or_random_data
+ 29 | sst_asset_name
+ 30 | sst_asset_name VAR IDENTIFIER
+ 31 | sst_asset_name DFNAME sst_asset_set_file_path
+
+ 32 sst_set_extended_args: %empty
+ 33 | FLAG sst_flags
+
+ 34 sst_flags: %empty
+ 35 | sst_flag sst_flags
+
+ 36 sst_flag: none
+ 37 | write_once
+ 38 | no_rp
+ 39 | no_conf
+
+ 40 none: NONE
+
+ 41 write_once: WRITE_ONCE
+
+ 42 no_rp: NO_RP
+
+ 43 no_conf: NO_CONF
+
+ 44 sst_offset_spec: NUMBER_TOK
+
+ 45 sst_read_args: sst_asset_name read_args sst_read_extended_args
+
+ 46 read_args: VAR IDENTIFIER
+ 47 | CHECK read_args_var_name
+ 48 | CHECK LITERAL
+ 49 | PRINT
+ 50 | HASH
+ 51 | DFNAME sst_asset_dump_file_path
+
+ 52 sst_read_extended_args: %empty
+ 53 | OFFSET sst_offset_spec
+
+ 54 sst_remove_args: sst_asset_name
+ 55 | random_picked_asset
+
+ 56 asset_designator: NAME ASSET_IDENTIFIER_LIST
+ 57 | NAME STAR
+
+ 58 single_existing_asset: IDENTIFIER
+ 59 | random_picked_asset
+
+ 60 random_picked_asset: STAR ACTIVE
+ 61 | STAR DELETED
+
+ 62 sst_asset_name: asset_designator
+ 63 | UID ASSET_NUMBER_LIST
+ 64 | UID STAR
+
+ 65 sst_asset_set_file_path: FILE_PATH
+
+ 66 read_args_var_name: IDENTIFIER
+
+ 67 sst_asset_dump_file_path: FILE_PATH
+
+ 68 key_size: NUMBER_TOK
+
+ 69 policy_usage_list: ATTR policy_usage policy_usages
+
+ 70 policy_usages: %empty
+ 71 | policy_usage policy_usages
+
+ 72 export: EXPORT
+
+ 73 noexport: NOEXPORT
+
+ 74 copy: COPY
+
+ 75 nocopy: NOCOPY
+
+ 76 encrypt: ENCRYPT
+
+ 77 noencrypt: NOENCRYPT
+
+ 78 decrypt: DECRYPT
+
+ 79 nodecrypt: NODECRYPT
+
+ 80 sign: SIGN
+
+ 81 nosign: NOSIGN
+
+ 82 verify: VERIFY
+
+ 83 noverify: NOVERIFY
+
+ 84 derive: DERIVE
+
+ 85 noderive: NODERIVE
+
+ 86 persistent: PERSISTENT
+
+ 87 volatle: VOLATILE
+
+ 88 policy_usage: export
+ 89 | copy
+ 90 | encrypt
+ 91 | decrypt
+ 92 | sign
+ 93 | verify
+ 94 | derive
+ 95 | noexport
+ 96 | nocopy
+ 97 | noencrypt
+ 98 | nodecrypt
+ 99 | nosign
+ 100 | noverify
+ 101 | noderive
+ 102 | persistent
+ 103 | volatle
+ 104 | key_size
+
+ 105 policy_type: TYPE IDENTIFIER
+
+ 106 policy_algorithm: ALG IDENTIFIER
+
+ 107 policy_specs: %empty
+ 108 | policy_spec policy_specs
+
+ 109 policy_spec: policy_usage_list
+ 110 | policy_type
+ 111 | policy_algorithm
+
+ 112 policy_asset_spec: %empty
+ 113 | NAME ASSET_IDENTIFIER_LIST
+ 114 | NAME STAR
+
+ 115 policy_asset_name: NAME IDENTIFIER
+ 116 | STAR ACTIVE
+ 117 | STAR DELETED
+ 118 | KEY IDENTIFIER
+
+ 119 policy_set_args: policy_asset_spec policy_specs
+
+ 120 policy_read_args: policy_asset_name read_args
+
+ 121 key_set_sources: %empty
+ 122 | key_set_source key_set_sources
+
+ 123 key_set_source: literal_or_random_data
+ 124 | POLICY IDENTIFIER
+
+ 125 key_data_or_not: %empty
+ 126 | literal_or_random_data
+
+ 127 key_set_args: asset_designator key_set_sources
+ 128 | asset_designator FROM single_existing_asset POLICY IDENTIFIER
+ 129 | asset_designator key_data_or_not WITH policy_specs
+
+ 130 key_remove_args: asset_designator
+
+ 131 key_read_args: asset_designator read_args
+
+ 132 block: SHUFFLE block_content
+ 133 | exact_sel_count OF block_content
+ 134 | low_sel_count TO high_sel_count OF block_content
+
+ 135 block_content: open_brace lines close_brace
+ 136 | line
+
+ 137 open_brace: OPEN_BRACE
+
+ 138 close_brace: CLOSE_BRACE
+
+ 139 ASSET_NUMBER_LIST: ASSET_NUMBER ASSET_NUMBERS
+
+ 140 ASSET_NUMBERS: %empty
+ 141 | ASSET_NUMBER ASSET_NUMBERS
+
+ 142 ASSET_NUMBER: NUMBER_TOK
+
+ 143 ASSET_IDENTIFIER_LIST: ASSET_IDENTIFIER ASSET_IDENTIFIERS
+
+ 144 ASSET_IDENTIFIERS: %empty
+ 145 | ASSET_IDENTIFIER ASSET_IDENTIFIERS
+
+ 146 ASSET_IDENTIFIER: IDENTIFIER_TOK
+
+ 147 IDENTIFIER: IDENTIFIER_TOK
+
+ 148 FILE_PATH: FILE_PATH_TOK
+
+ 149 exact_sel_count: NUMBER
+
+ 150 low_sel_count: NUMBER
+
+ 151 high_sel_count: NUMBER
+
+ 152 NUMBER: NUMBER_TOK
+
+ 153 LITERAL: LITERAL_TOK
+ 154 | HEX_LIST
+
+
+Terminals, with rules where they appear
+
+$end (0) 0
+error (256)
+PURPOSE (258) 3
+RAW_TEXT (259)
+SET (260) 16 17 18
+READ (261) 19 20 21
+REMOVE (262) 22 23
+SECURE (263) 24
+DONE (264) 25
+SST (265) 16 19 22
+KEY (266) 17 20 23 118
+POLICY (267) 18 21 124 128
+NAME (268) 56 57 113 114 115
+UID (269) 63 64
+STAR (270) 27 57 60 61 64 114 116 117
+ACTIVE (271) 60 116
+DELETED (272) 61 117
+EQUAL (273)
+DATA (274) 26 27
+DFNAME (275) 31 51
+FLAG (276) 33
+NONE (277) 40
+WRITE_ONCE (278) 41
+NO_RP (279) 42
+NO_CONF (280) 43
+OFFSET (281) 53
+CHECK (282) 47 48
+VAR (283) 30 46
+HASH (284) 24 50
+NEQ (285) 24
+PRINT (286) 49
+EXPECT (287) 12 13 14 15
+PASS (288) 12
+FAIL (289) 13
+NOTHING (290) 14
+ERROR (291)
+IDENTIFIER_TOK (292) 146 147
+LITERAL_TOK (293) 153
+HEX_LIST (294) 154
+FILE_PATH_TOK (295) 148
+NUMBER_TOK (296) 44 68 142 152
+SEMICOLON (297) 5 6
+SHUFFLE (298) 132
+TO (299) 134
+OF (300) 133 134
+OPEN_BRACE (301) 137
+CLOSE_BRACE (302) 138
+ATTR (303) 69
+TYPE (304) 105
+ALG (305) 106
+EXPORT (306) 72
+COPY (307) 74
+ENCRYPT (308) 76
+DECRYPT (309) 78
+SIGN (310) 80
+VERIFY (311) 82
+DERIVE (312) 84
+NOEXPORT (313) 73
+NOCOPY (314) 75
+NOENCRYPT (315) 77
+NODECRYPT (316) 79
+NOSIGN (317) 81
+NOVERIFY (318) 83
+NODERIVE (319) 85
+PERSISTENT (320) 86
+VOLATILE (321) 87
+FROM (322) 128
+WITH (323) 129
+
+
+Nonterminals, with rules where they appear
+
+$accept (69)
+ on left: 0
+lines (70)
+ on left: 1 2, on right: 0 2 135
+line (71)
+ on left: 3 4 5 6, on right: 2 136
+command (72)
+ on left: 7 8 9 10 11, on right: 5 6
+expect (73)
+ on left: 12 13 14 15, on right: 6
+set_command (74)
+ on left: 16 17 18, on right: 7
+read_command (75)
+ on left: 19 20 21, on right: 9
+remove_command (76)
+ on left: 22 23, on right: 8
+secure_command (77)
+ on left: 24, on right: 10
+done_command (78)
+ on left: 25, on right: 11
+literal_or_random_data (79)
+ on left: 26 27, on right: 28 123 126
+sst_set_base_args (80)
+ on left: 28 29 30 31, on right: 16
+sst_set_extended_args (81)
+ on left: 32 33, on right: 16
+sst_flags (82)
+ on left: 34 35, on right: 33 35
+sst_flag (83)
+ on left: 36 37 38 39, on right: 35
+none (84)
+ on left: 40, on right: 36
+write_once (85)
+ on left: 41, on right: 37
+no_rp (86)
+ on left: 42, on right: 38
+no_conf (87)
+ on left: 43, on right: 39
+sst_offset_spec (88)
+ on left: 44, on right: 53
+sst_read_args (89)
+ on left: 45, on right: 19
+read_args (90)
+ on left: 46 47 48 49 50 51, on right: 45 120 131
+sst_read_extended_args (91)
+ on left: 52 53, on right: 45
+sst_remove_args (92)
+ on left: 54 55, on right: 22
+asset_designator (93)
+ on left: 56 57, on right: 62 127 128 129 130 131
+single_existing_asset (94)
+ on left: 58 59, on right: 128
+random_picked_asset (95)
+ on left: 60 61, on right: 55 59
+sst_asset_name (96)
+ on left: 62 63 64, on right: 28 29 30 31 45 54
+sst_asset_set_file_path (97)
+ on left: 65, on right: 31
+read_args_var_name (98)
+ on left: 66, on right: 47
+sst_asset_dump_file_path (99)
+ on left: 67, on right: 51
+key_size (100)
+ on left: 68, on right: 104
+policy_usage_list (101)
+ on left: 69, on right: 109
+policy_usages (102)
+ on left: 70 71, on right: 69 71
+export (103)
+ on left: 72, on right: 88
+noexport (104)
+ on left: 73, on right: 95
+copy (105)
+ on left: 74, on right: 89
+nocopy (106)
+ on left: 75, on right: 96
+encrypt (107)
+ on left: 76, on right: 90
+noencrypt (108)
+ on left: 77, on right: 97
+decrypt (109)
+ on left: 78, on right: 91
+nodecrypt (110)
+ on left: 79, on right: 98
+sign (111)
+ on left: 80, on right: 92
+nosign (112)
+ on left: 81, on right: 99
+verify (113)
+ on left: 82, on right: 93
+noverify (114)
+ on left: 83, on right: 100
+derive (115)
+ on left: 84, on right: 94
+noderive (116)
+ on left: 85, on right: 101
+persistent (117)
+ on left: 86, on right: 102
+volatle (118)
+ on left: 87, on right: 103
+policy_usage (119)
+ on left: 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104,
+ on right: 69 71
+policy_type (120)
+ on left: 105, on right: 110
+policy_algorithm (121)
+ on left: 106, on right: 111
+policy_specs (122)
+ on left: 107 108, on right: 108 119 129
+policy_spec (123)
+ on left: 109 110 111, on right: 108
+policy_asset_spec (124)
+ on left: 112 113 114, on right: 119
+policy_asset_name (125)
+ on left: 115 116 117 118, on right: 120
+policy_set_args (126)
+ on left: 119, on right: 18
+policy_read_args (127)
+ on left: 120, on right: 21
+key_set_sources (128)
+ on left: 121 122, on right: 122 127
+key_set_source (129)
+ on left: 123 124, on right: 122
+key_data_or_not (130)
+ on left: 125 126, on right: 129
+key_set_args (131)
+ on left: 127 128 129, on right: 17
+key_remove_args (132)
+ on left: 130, on right: 23
+key_read_args (133)
+ on left: 131, on right: 20
+block (134)
+ on left: 132 133 134, on right: 4
+block_content (135)
+ on left: 135 136, on right: 132 133 134
+open_brace (136)
+ on left: 137, on right: 135
+close_brace (137)
+ on left: 138, on right: 135
+ASSET_NUMBER_LIST (138)
+ on left: 139, on right: 63
+ASSET_NUMBERS (139)
+ on left: 140 141, on right: 139 141
+ASSET_NUMBER (140)
+ on left: 142, on right: 139 141
+ASSET_IDENTIFIER_LIST (141)
+ on left: 143, on right: 24 56 113
+ASSET_IDENTIFIERS (142)
+ on left: 144 145, on right: 143 145
+ASSET_IDENTIFIER (143)
+ on left: 146, on right: 143 145
+IDENTIFIER (144)
+ on left: 147, on right: 15 30 46 58 66 105 106 115 118 124 128
+FILE_PATH (145)
+ on left: 148, on right: 65 67
+exact_sel_count (146)
+ on left: 149, on right: 133
+low_sel_count (147)
+ on left: 150, on right: 134
+high_sel_count (148)
+ on left: 151, on right: 134
+NUMBER (149)
+ on left: 152, on right: 149 150 151
+LITERAL (150)
+ on left: 153 154, on right: 26 48
+
+
+State 0
+
+ 0 $accept: . lines $end
+
+ PURPOSE shift, and go to state 1
+ SET shift, and go to state 2
+ READ shift, and go to state 3
+ REMOVE shift, and go to state 4
+ SECURE shift, and go to state 5
+ DONE shift, and go to state 6
+ NUMBER_TOK shift, and go to state 7
+ SHUFFLE shift, and go to state 8
+
+ $default reduce using rule 1 (lines)
+
+ lines go to state 9
+ line go to state 10
+ command go to state 11
+ set_command go to state 12
+ read_command go to state 13
+ remove_command go to state 14
+ secure_command go to state 15
+ done_command go to state 16
+ block go to state 17
+ exact_sel_count go to state 18
+ low_sel_count go to state 19
+ NUMBER go to state 20
+
+
+State 1
+
+ 3 line: PURPOSE .
+
+ $default reduce using rule 3 (line)
+
+
+State 2
+
+ 16 set_command: SET . SST sst_set_base_args sst_set_extended_args
+ 17 | SET . KEY key_set_args
+ 18 | SET . POLICY policy_set_args
+
+ SST shift, and go to state 21
+ KEY shift, and go to state 22
+ POLICY shift, and go to state 23
+
+
+State 3
+
+ 19 read_command: READ . SST sst_read_args
+ 20 | READ . KEY key_read_args
+ 21 | READ . POLICY policy_read_args
+
+ SST shift, and go to state 24
+ KEY shift, and go to state 25
+ POLICY shift, and go to state 26
+
+
+State 4
+
+ 22 remove_command: REMOVE . SST sst_remove_args
+ 23 | REMOVE . KEY key_remove_args
+
+ SST shift, and go to state 27
+ KEY shift, and go to state 28
+
+
+State 5
+
+ 24 secure_command: SECURE . HASH NEQ ASSET_IDENTIFIER_LIST
+
+ HASH shift, and go to state 29
+
+
+State 6
+
+ 25 done_command: DONE .
+
+ $default reduce using rule 25 (done_command)
+
+
+State 7
+
+ 152 NUMBER: NUMBER_TOK .
+
+ $default reduce using rule 152 (NUMBER)
+
+
+State 8
+
+ 132 block: SHUFFLE . block_content
+
+ PURPOSE shift, and go to state 1
+ SET shift, and go to state 2
+ READ shift, and go to state 3
+ REMOVE shift, and go to state 4
+ SECURE shift, and go to state 5
+ DONE shift, and go to state 6
+ NUMBER_TOK shift, and go to state 7
+ SHUFFLE shift, and go to state 8
+ OPEN_BRACE shift, and go to state 30
+
+ line go to state 31
+ command go to state 11
+ set_command go to state 12
+ read_command go to state 13
+ remove_command go to state 14
+ secure_command go to state 15
+ done_command go to state 16
+ block go to state 17
+ block_content go to state 32
+ open_brace go to state 33
+ exact_sel_count go to state 18
+ low_sel_count go to state 19
+ NUMBER go to state 20
+
+
+State 9
+
+ 0 $accept: lines . $end
+
+ $end shift, and go to state 34
+
+
+State 10
+
+ 2 lines: line . lines
+
+ PURPOSE shift, and go to state 1
+ SET shift, and go to state 2
+ READ shift, and go to state 3
+ REMOVE shift, and go to state 4
+ SECURE shift, and go to state 5
+ DONE shift, and go to state 6
+ NUMBER_TOK shift, and go to state 7
+ SHUFFLE shift, and go to state 8
+
+ $default reduce using rule 1 (lines)
+
+ lines go to state 35
+ line go to state 10
+ command go to state 11
+ set_command go to state 12
+ read_command go to state 13
+ remove_command go to state 14
+ secure_command go to state 15
+ done_command go to state 16
+ block go to state 17
+ exact_sel_count go to state 18
+ low_sel_count go to state 19
+ NUMBER go to state 20
+
+
+State 11
+
+ 5 line: command . SEMICOLON
+ 6 | command . expect SEMICOLON
+
+ EXPECT shift, and go to state 36
+ SEMICOLON shift, and go to state 37
+
+ expect go to state 38
+
+
+State 12
+
+ 7 command: set_command .
+
+ $default reduce using rule 7 (command)
+
+
+State 13
+
+ 9 command: read_command .
+
+ $default reduce using rule 9 (command)
+
+
+State 14
+
+ 8 command: remove_command .
+
+ $default reduce using rule 8 (command)
+
+
+State 15
+
+ 10 command: secure_command .
+
+ $default reduce using rule 10 (command)
+
+
+State 16
+
+ 11 command: done_command .
+
+ $default reduce using rule 11 (command)
+
+
+State 17
+
+ 4 line: block .
+
+ $default reduce using rule 4 (line)
+
+
+State 18
+
+ 133 block: exact_sel_count . OF block_content
+
+ OF shift, and go to state 39
+
+
+State 19
+
+ 134 block: low_sel_count . TO high_sel_count OF block_content
+
+ TO shift, and go to state 40
+
+
+State 20
+
+ 149 exact_sel_count: NUMBER .
+ 150 low_sel_count: NUMBER .
+
+ TO reduce using rule 150 (low_sel_count)
+ $default reduce using rule 149 (exact_sel_count)
+
+
+State 21
+
+ 16 set_command: SET SST . sst_set_base_args sst_set_extended_args
+
+ NAME shift, and go to state 41
+ UID shift, and go to state 42
+
+ sst_set_base_args go to state 43
+ asset_designator go to state 44
+ sst_asset_name go to state 45
+
+
+State 22
+
+ 17 set_command: SET KEY . key_set_args
+
+ NAME shift, and go to state 41
+
+ asset_designator go to state 46
+ key_set_args go to state 47
+
+
+State 23
+
+ 18 set_command: SET POLICY . policy_set_args
+
+ NAME shift, and go to state 48
+
+ $default reduce using rule 112 (policy_asset_spec)
+
+ policy_asset_spec go to state 49
+ policy_set_args go to state 50
+
+
+State 24
+
+ 19 read_command: READ SST . sst_read_args
+
+ NAME shift, and go to state 41
+ UID shift, and go to state 42
+
+ sst_read_args go to state 51
+ asset_designator go to state 44
+ sst_asset_name go to state 52
+
+
+State 25
+
+ 20 read_command: READ KEY . key_read_args
+
+ NAME shift, and go to state 41
+
+ asset_designator go to state 53
+ key_read_args go to state 54
+
+
+State 26
+
+ 21 read_command: READ POLICY . policy_read_args
+
+ KEY shift, and go to state 55
+ NAME shift, and go to state 56
+ STAR shift, and go to state 57
+
+ policy_asset_name go to state 58
+ policy_read_args go to state 59
+
+
+State 27
+
+ 22 remove_command: REMOVE SST . sst_remove_args
+
+ NAME shift, and go to state 41
+ UID shift, and go to state 42
+ STAR shift, and go to state 60
+
+ sst_remove_args go to state 61
+ asset_designator go to state 44
+ random_picked_asset go to state 62
+ sst_asset_name go to state 63
+
+
+State 28
+
+ 23 remove_command: REMOVE KEY . key_remove_args
+
+ NAME shift, and go to state 41
+
+ asset_designator go to state 64
+ key_remove_args go to state 65
+
+
+State 29
+
+ 24 secure_command: SECURE HASH . NEQ ASSET_IDENTIFIER_LIST
+
+ NEQ shift, and go to state 66
+
+
+State 30
+
+ 137 open_brace: OPEN_BRACE .
+
+ $default reduce using rule 137 (open_brace)
+
+
+State 31
+
+ 136 block_content: line .
+
+ $default reduce using rule 136 (block_content)
+
+
+State 32
+
+ 132 block: SHUFFLE block_content .
+
+ $default reduce using rule 132 (block)
+
+
+State 33
+
+ 135 block_content: open_brace . lines close_brace
+
+ PURPOSE shift, and go to state 1
+ SET shift, and go to state 2
+ READ shift, and go to state 3
+ REMOVE shift, and go to state 4
+ SECURE shift, and go to state 5
+ DONE shift, and go to state 6
+ NUMBER_TOK shift, and go to state 7
+ SHUFFLE shift, and go to state 8
+
+ $default reduce using rule 1 (lines)
+
+ lines go to state 67
+ line go to state 10
+ command go to state 11
+ set_command go to state 12
+ read_command go to state 13
+ remove_command go to state 14
+ secure_command go to state 15
+ done_command go to state 16
+ block go to state 17
+ exact_sel_count go to state 18
+ low_sel_count go to state 19
+ NUMBER go to state 20
+
+
+State 34
+
+ 0 $accept: lines $end .
+
+ $default accept
+
+
+State 35
+
+ 2 lines: line lines .
+
+ $default reduce using rule 2 (lines)
+
+
+State 36
+
+ 12 expect: EXPECT . PASS
+ 13 | EXPECT . FAIL
+ 14 | EXPECT . NOTHING
+ 15 | EXPECT . IDENTIFIER
+
+ PASS shift, and go to state 68
+ FAIL shift, and go to state 69
+ NOTHING shift, and go to state 70
+ IDENTIFIER_TOK shift, and go to state 71
+
+ IDENTIFIER go to state 72
+
+
+State 37
+
+ 5 line: command SEMICOLON .
+
+ $default reduce using rule 5 (line)
+
+
+State 38
+
+ 6 line: command expect . SEMICOLON
+
+ SEMICOLON shift, and go to state 73
+
+
+State 39
+
+ 133 block: exact_sel_count OF . block_content
+
+ PURPOSE shift, and go to state 1
+ SET shift, and go to state 2
+ READ shift, and go to state 3
+ REMOVE shift, and go to state 4
+ SECURE shift, and go to state 5
+ DONE shift, and go to state 6
+ NUMBER_TOK shift, and go to state 7
+ SHUFFLE shift, and go to state 8
+ OPEN_BRACE shift, and go to state 30
+
+ line go to state 31
+ command go to state 11
+ set_command go to state 12
+ read_command go to state 13
+ remove_command go to state 14
+ secure_command go to state 15
+ done_command go to state 16
+ block go to state 17
+ block_content go to state 74
+ open_brace go to state 33
+ exact_sel_count go to state 18
+ low_sel_count go to state 19
+ NUMBER go to state 20
+
+
+State 40
+
+ 134 block: low_sel_count TO . high_sel_count OF block_content
+
+ NUMBER_TOK shift, and go to state 7
+
+ high_sel_count go to state 75
+ NUMBER go to state 76
+
+
+State 41
+
+ 56 asset_designator: NAME . ASSET_IDENTIFIER_LIST
+ 57 | NAME . STAR
+
+ STAR shift, and go to state 77
+ IDENTIFIER_TOK shift, and go to state 78
+
+ ASSET_IDENTIFIER_LIST go to state 79
+ ASSET_IDENTIFIER go to state 80
+
+
+State 42
+
+ 63 sst_asset_name: UID . ASSET_NUMBER_LIST
+ 64 | UID . STAR
+
+ STAR shift, and go to state 81
+ NUMBER_TOK shift, and go to state 82
+
+ ASSET_NUMBER_LIST go to state 83
+ ASSET_NUMBER go to state 84
+
+
+State 43
+
+ 16 set_command: SET SST sst_set_base_args . sst_set_extended_args
+
+ FLAG shift, and go to state 85
+
+ $default reduce using rule 32 (sst_set_extended_args)
+
+ sst_set_extended_args go to state 86
+
+
+State 44
+
+ 62 sst_asset_name: asset_designator .
+
+ $default reduce using rule 62 (sst_asset_name)
+
+
+State 45
+
+ 28 sst_set_base_args: sst_asset_name . literal_or_random_data
+ 29 | sst_asset_name .
+ 30 | sst_asset_name . VAR IDENTIFIER
+ 31 | sst_asset_name . DFNAME sst_asset_set_file_path
+
+ DATA shift, and go to state 87
+ DFNAME shift, and go to state 88
+ VAR shift, and go to state 89
+
+ $default reduce using rule 29 (sst_set_base_args)
+
+ literal_or_random_data go to state 90
+
+
+State 46
+
+ 127 key_set_args: asset_designator . key_set_sources
+ 128 | asset_designator . FROM single_existing_asset POLICY IDENTIFIER
+ 129 | asset_designator . key_data_or_not WITH policy_specs
+
+ POLICY shift, and go to state 91
+ DATA shift, and go to state 87
+ FROM shift, and go to state 92
+
+ WITH reduce using rule 125 (key_data_or_not)
+ $default reduce using rule 121 (key_set_sources)
+
+ literal_or_random_data go to state 93
+ key_set_sources go to state 94
+ key_set_source go to state 95
+ key_data_or_not go to state 96
+
+
+State 47
+
+ 17 set_command: SET KEY key_set_args .
+
+ $default reduce using rule 17 (set_command)
+
+
+State 48
+
+ 113 policy_asset_spec: NAME . ASSET_IDENTIFIER_LIST
+ 114 | NAME . STAR
+
+ STAR shift, and go to state 97
+ IDENTIFIER_TOK shift, and go to state 78
+
+ ASSET_IDENTIFIER_LIST go to state 98
+ ASSET_IDENTIFIER go to state 80
+
+
+State 49
+
+ 119 policy_set_args: policy_asset_spec . policy_specs
+
+ ATTR shift, and go to state 99
+ TYPE shift, and go to state 100
+ ALG shift, and go to state 101
+
+ $default reduce using rule 107 (policy_specs)
+
+ policy_usage_list go to state 102
+ policy_type go to state 103
+ policy_algorithm go to state 104
+ policy_specs go to state 105
+ policy_spec go to state 106
+
+
+State 50
+
+ 18 set_command: SET POLICY policy_set_args .
+
+ $default reduce using rule 18 (set_command)
+
+
+State 51
+
+ 19 read_command: READ SST sst_read_args .
+
+ $default reduce using rule 19 (read_command)
+
+
+State 52
+
+ 45 sst_read_args: sst_asset_name . read_args sst_read_extended_args
+
+ DFNAME shift, and go to state 107
+ CHECK shift, and go to state 108
+ VAR shift, and go to state 109
+ HASH shift, and go to state 110
+ PRINT shift, and go to state 111
+
+ read_args go to state 112
+
+
+State 53
+
+ 131 key_read_args: asset_designator . read_args
+
+ DFNAME shift, and go to state 107
+ CHECK shift, and go to state 108
+ VAR shift, and go to state 109
+ HASH shift, and go to state 110
+ PRINT shift, and go to state 111
+
+ read_args go to state 113
+
+
+State 54
+
+ 20 read_command: READ KEY key_read_args .
+
+ $default reduce using rule 20 (read_command)
+
+
+State 55
+
+ 118 policy_asset_name: KEY . IDENTIFIER
+
+ IDENTIFIER_TOK shift, and go to state 71
+
+ IDENTIFIER go to state 114
+
+
+State 56
+
+ 115 policy_asset_name: NAME . IDENTIFIER
+
+ IDENTIFIER_TOK shift, and go to state 71
+
+ IDENTIFIER go to state 115
+
+
+State 57
+
+ 116 policy_asset_name: STAR . ACTIVE
+ 117 | STAR . DELETED
+
+ ACTIVE shift, and go to state 116
+ DELETED shift, and go to state 117
+
+
+State 58
+
+ 120 policy_read_args: policy_asset_name . read_args
+
+ DFNAME shift, and go to state 107
+ CHECK shift, and go to state 108
+ VAR shift, and go to state 109
+ HASH shift, and go to state 110
+ PRINT shift, and go to state 111
+
+ read_args go to state 118
+
+
+State 59
+
+ 21 read_command: READ POLICY policy_read_args .
+
+ $default reduce using rule 21 (read_command)
+
+
+State 60
+
+ 60 random_picked_asset: STAR . ACTIVE
+ 61 | STAR . DELETED
+
+ ACTIVE shift, and go to state 119
+ DELETED shift, and go to state 120
+
+
+State 61
+
+ 22 remove_command: REMOVE SST sst_remove_args .
+
+ $default reduce using rule 22 (remove_command)
+
+
+State 62
+
+ 55 sst_remove_args: random_picked_asset .
+
+ $default reduce using rule 55 (sst_remove_args)
+
+
+State 63
+
+ 54 sst_remove_args: sst_asset_name .
+
+ $default reduce using rule 54 (sst_remove_args)
+
+
+State 64
+
+ 130 key_remove_args: asset_designator .
+
+ $default reduce using rule 130 (key_remove_args)
+
+
+State 65
+
+ 23 remove_command: REMOVE KEY key_remove_args .
+
+ $default reduce using rule 23 (remove_command)
+
+
+State 66
+
+ 24 secure_command: SECURE HASH NEQ . ASSET_IDENTIFIER_LIST
+
+ IDENTIFIER_TOK shift, and go to state 78
+
+ ASSET_IDENTIFIER_LIST go to state 121
+ ASSET_IDENTIFIER go to state 80
+
+
+State 67
+
+ 135 block_content: open_brace lines . close_brace
+
+ CLOSE_BRACE shift, and go to state 122
+
+ close_brace go to state 123
+
+
+State 68
+
+ 12 expect: EXPECT PASS .
+
+ $default reduce using rule 12 (expect)
+
+
+State 69
+
+ 13 expect: EXPECT FAIL .
+
+ $default reduce using rule 13 (expect)
+
+
+State 70
+
+ 14 expect: EXPECT NOTHING .
+
+ $default reduce using rule 14 (expect)
+
+
+State 71
+
+ 147 IDENTIFIER: IDENTIFIER_TOK .
+
+ $default reduce using rule 147 (IDENTIFIER)
+
+
+State 72
+
+ 15 expect: EXPECT IDENTIFIER .
+
+ $default reduce using rule 15 (expect)
+
+
+State 73
+
+ 6 line: command expect SEMICOLON .
+
+ $default reduce using rule 6 (line)
+
+
+State 74
+
+ 133 block: exact_sel_count OF block_content .
+
+ $default reduce using rule 133 (block)
+
+
+State 75
+
+ 134 block: low_sel_count TO high_sel_count . OF block_content
+
+ OF shift, and go to state 124
+
+
+State 76
+
+ 151 high_sel_count: NUMBER .
+
+ $default reduce using rule 151 (high_sel_count)
+
+
+State 77
+
+ 57 asset_designator: NAME STAR .
+
+ $default reduce using rule 57 (asset_designator)
+
+
+State 78
+
+ 146 ASSET_IDENTIFIER: IDENTIFIER_TOK .
+
+ $default reduce using rule 146 (ASSET_IDENTIFIER)
+
+
+State 79
+
+ 56 asset_designator: NAME ASSET_IDENTIFIER_LIST .
+
+ $default reduce using rule 56 (asset_designator)
+
+
+State 80
+
+ 143 ASSET_IDENTIFIER_LIST: ASSET_IDENTIFIER . ASSET_IDENTIFIERS
+
+ IDENTIFIER_TOK shift, and go to state 78
+
+ $default reduce using rule 144 (ASSET_IDENTIFIERS)
+
+ ASSET_IDENTIFIERS go to state 125
+ ASSET_IDENTIFIER go to state 126
+
+
+State 81
+
+ 64 sst_asset_name: UID STAR .
+
+ $default reduce using rule 64 (sst_asset_name)
+
+
+State 82
+
+ 142 ASSET_NUMBER: NUMBER_TOK .
+
+ $default reduce using rule 142 (ASSET_NUMBER)
+
+
+State 83
+
+ 63 sst_asset_name: UID ASSET_NUMBER_LIST .
+
+ $default reduce using rule 63 (sst_asset_name)
+
+
+State 84
+
+ 139 ASSET_NUMBER_LIST: ASSET_NUMBER . ASSET_NUMBERS
+
+ NUMBER_TOK shift, and go to state 82
+
+ $default reduce using rule 140 (ASSET_NUMBERS)
+
+ ASSET_NUMBERS go to state 127
+ ASSET_NUMBER go to state 128
+
+
+State 85
+
+ 33 sst_set_extended_args: FLAG . sst_flags
+
+ NONE shift, and go to state 129
+ WRITE_ONCE shift, and go to state 130
+ NO_RP shift, and go to state 131
+ NO_CONF shift, and go to state 132
+
+ $default reduce using rule 34 (sst_flags)
+
+ sst_flags go to state 133
+ sst_flag go to state 134
+ none go to state 135
+ write_once go to state 136
+ no_rp go to state 137
+ no_conf go to state 138
+
+
+State 86
+
+ 16 set_command: SET SST sst_set_base_args sst_set_extended_args .
+
+ $default reduce using rule 16 (set_command)
+
+
+State 87
+
+ 26 literal_or_random_data: DATA . LITERAL
+ 27 | DATA . STAR
+
+ STAR shift, and go to state 139
+ LITERAL_TOK shift, and go to state 140
+ HEX_LIST shift, and go to state 141
+
+ LITERAL go to state 142
+
+
+State 88
+
+ 31 sst_set_base_args: sst_asset_name DFNAME . sst_asset_set_file_path
+
+ FILE_PATH_TOK shift, and go to state 143
+
+ sst_asset_set_file_path go to state 144
+ FILE_PATH go to state 145
+
+
+State 89
+
+ 30 sst_set_base_args: sst_asset_name VAR . IDENTIFIER
+
+ IDENTIFIER_TOK shift, and go to state 71
+
+ IDENTIFIER go to state 146
+
+
+State 90
+
+ 28 sst_set_base_args: sst_asset_name literal_or_random_data .
+
+ $default reduce using rule 28 (sst_set_base_args)
+
+
+State 91
+
+ 124 key_set_source: POLICY . IDENTIFIER
+
+ IDENTIFIER_TOK shift, and go to state 71
+
+ IDENTIFIER go to state 147
+
+
+State 92
+
+ 128 key_set_args: asset_designator FROM . single_existing_asset POLICY IDENTIFIER
+
+ STAR shift, and go to state 60
+ IDENTIFIER_TOK shift, and go to state 71
+
+ single_existing_asset go to state 148
+ random_picked_asset go to state 149
+ IDENTIFIER go to state 150
+
+
+State 93
+
+ 123 key_set_source: literal_or_random_data .
+ 126 key_data_or_not: literal_or_random_data .
+
+ WITH reduce using rule 126 (key_data_or_not)
+ $default reduce using rule 123 (key_set_source)
+
+
+State 94
+
+ 127 key_set_args: asset_designator key_set_sources .
+
+ $default reduce using rule 127 (key_set_args)
+
+
+State 95
+
+ 122 key_set_sources: key_set_source . key_set_sources
+
+ POLICY shift, and go to state 91
+ DATA shift, and go to state 87
+
+ $default reduce using rule 121 (key_set_sources)
+
+ literal_or_random_data go to state 151
+ key_set_sources go to state 152
+ key_set_source go to state 95
+
+
+State 96
+
+ 129 key_set_args: asset_designator key_data_or_not . WITH policy_specs
+
+ WITH shift, and go to state 153
+
+
+State 97
+
+ 114 policy_asset_spec: NAME STAR .
+
+ $default reduce using rule 114 (policy_asset_spec)
+
+
+State 98
+
+ 113 policy_asset_spec: NAME ASSET_IDENTIFIER_LIST .
+
+ $default reduce using rule 113 (policy_asset_spec)
+
+
+State 99
+
+ 69 policy_usage_list: ATTR . policy_usage policy_usages
+
+ NUMBER_TOK shift, and go to state 154
+ EXPORT shift, and go to state 155
+ COPY shift, and go to state 156
+ ENCRYPT shift, and go to state 157
+ DECRYPT shift, and go to state 158
+ SIGN shift, and go to state 159
+ VERIFY shift, and go to state 160
+ DERIVE shift, and go to state 161
+ NOEXPORT shift, and go to state 162
+ NOCOPY shift, and go to state 163
+ NOENCRYPT shift, and go to state 164
+ NODECRYPT shift, and go to state 165
+ NOSIGN shift, and go to state 166
+ NOVERIFY shift, and go to state 167
+ NODERIVE shift, and go to state 168
+ PERSISTENT shift, and go to state 169
+ VOLATILE shift, and go to state 170
+
+ key_size go to state 171
+ export go to state 172
+ noexport go to state 173
+ copy go to state 174
+ nocopy go to state 175
+ encrypt go to state 176
+ noencrypt go to state 177
+ decrypt go to state 178
+ nodecrypt go to state 179
+ sign go to state 180
+ nosign go to state 181
+ verify go to state 182
+ noverify go to state 183
+ derive go to state 184
+ noderive go to state 185
+ persistent go to state 186
+ volatle go to state 187
+ policy_usage go to state 188
+
+
+State 100
+
+ 105 policy_type: TYPE . IDENTIFIER
+
+ IDENTIFIER_TOK shift, and go to state 71
+
+ IDENTIFIER go to state 189
+
+
+State 101
+
+ 106 policy_algorithm: ALG . IDENTIFIER
+
+ IDENTIFIER_TOK shift, and go to state 71
+
+ IDENTIFIER go to state 190
+
+
+State 102
+
+ 109 policy_spec: policy_usage_list .
+
+ $default reduce using rule 109 (policy_spec)
+
+
+State 103
+
+ 110 policy_spec: policy_type .
+
+ $default reduce using rule 110 (policy_spec)
+
+
+State 104
+
+ 111 policy_spec: policy_algorithm .
+
+ $default reduce using rule 111 (policy_spec)
+
+
+State 105
+
+ 119 policy_set_args: policy_asset_spec policy_specs .
+
+ $default reduce using rule 119 (policy_set_args)
+
+
+State 106
+
+ 108 policy_specs: policy_spec . policy_specs
+
+ ATTR shift, and go to state 99
+ TYPE shift, and go to state 100
+ ALG shift, and go to state 101
+
+ $default reduce using rule 107 (policy_specs)
+
+ policy_usage_list go to state 102
+ policy_type go to state 103
+ policy_algorithm go to state 104
+ policy_specs go to state 191
+ policy_spec go to state 106
+
+
+State 107
+
+ 51 read_args: DFNAME . sst_asset_dump_file_path
+
+ FILE_PATH_TOK shift, and go to state 143
+
+ sst_asset_dump_file_path go to state 192
+ FILE_PATH go to state 193
+
+
+State 108
+
+ 47 read_args: CHECK . read_args_var_name
+ 48 | CHECK . LITERAL
+
+ IDENTIFIER_TOK shift, and go to state 71
+ LITERAL_TOK shift, and go to state 140
+ HEX_LIST shift, and go to state 141
+
+ read_args_var_name go to state 194
+ IDENTIFIER go to state 195
+ LITERAL go to state 196
+
+
+State 109
+
+ 46 read_args: VAR . IDENTIFIER
+
+ IDENTIFIER_TOK shift, and go to state 71
+
+ IDENTIFIER go to state 197
+
+
+State 110
+
+ 50 read_args: HASH .
+
+ $default reduce using rule 50 (read_args)
+
+
+State 111
+
+ 49 read_args: PRINT .
+
+ $default reduce using rule 49 (read_args)
+
+
+State 112
+
+ 45 sst_read_args: sst_asset_name read_args . sst_read_extended_args
+
+ OFFSET shift, and go to state 198
+
+ $default reduce using rule 52 (sst_read_extended_args)
+
+ sst_read_extended_args go to state 199
+
+
+State 113
+
+ 131 key_read_args: asset_designator read_args .
+
+ $default reduce using rule 131 (key_read_args)
+
+
+State 114
+
+ 118 policy_asset_name: KEY IDENTIFIER .
+
+ $default reduce using rule 118 (policy_asset_name)
+
+
+State 115
+
+ 115 policy_asset_name: NAME IDENTIFIER .
+
+ $default reduce using rule 115 (policy_asset_name)
+
+
+State 116
+
+ 116 policy_asset_name: STAR ACTIVE .
+
+ $default reduce using rule 116 (policy_asset_name)
+
+
+State 117
+
+ 117 policy_asset_name: STAR DELETED .
+
+ $default reduce using rule 117 (policy_asset_name)
+
+
+State 118
+
+ 120 policy_read_args: policy_asset_name read_args .
+
+ $default reduce using rule 120 (policy_read_args)
+
+
+State 119
+
+ 60 random_picked_asset: STAR ACTIVE .
+
+ $default reduce using rule 60 (random_picked_asset)
+
+
+State 120
+
+ 61 random_picked_asset: STAR DELETED .
+
+ $default reduce using rule 61 (random_picked_asset)
+
+
+State 121
+
+ 24 secure_command: SECURE HASH NEQ ASSET_IDENTIFIER_LIST .
+
+ $default reduce using rule 24 (secure_command)
+
+
+State 122
+
+ 138 close_brace: CLOSE_BRACE .
+
+ $default reduce using rule 138 (close_brace)
+
+
+State 123
+
+ 135 block_content: open_brace lines close_brace .
+
+ $default reduce using rule 135 (block_content)
+
+
+State 124
+
+ 134 block: low_sel_count TO high_sel_count OF . block_content
+
+ PURPOSE shift, and go to state 1
+ SET shift, and go to state 2
+ READ shift, and go to state 3
+ REMOVE shift, and go to state 4
+ SECURE shift, and go to state 5
+ DONE shift, and go to state 6
+ NUMBER_TOK shift, and go to state 7
+ SHUFFLE shift, and go to state 8
+ OPEN_BRACE shift, and go to state 30
+
+ line go to state 31
+ command go to state 11
+ set_command go to state 12
+ read_command go to state 13
+ remove_command go to state 14
+ secure_command go to state 15
+ done_command go to state 16
+ block go to state 17
+ block_content go to state 200
+ open_brace go to state 33
+ exact_sel_count go to state 18
+ low_sel_count go to state 19
+ NUMBER go to state 20
+
+
+State 125
+
+ 143 ASSET_IDENTIFIER_LIST: ASSET_IDENTIFIER ASSET_IDENTIFIERS .
+
+ $default reduce using rule 143 (ASSET_IDENTIFIER_LIST)
+
+
+State 126
+
+ 145 ASSET_IDENTIFIERS: ASSET_IDENTIFIER . ASSET_IDENTIFIERS
+
+ IDENTIFIER_TOK shift, and go to state 78
+
+ $default reduce using rule 144 (ASSET_IDENTIFIERS)
+
+ ASSET_IDENTIFIERS go to state 201
+ ASSET_IDENTIFIER go to state 126
+
+
+State 127
+
+ 139 ASSET_NUMBER_LIST: ASSET_NUMBER ASSET_NUMBERS .
+
+ $default reduce using rule 139 (ASSET_NUMBER_LIST)
+
+
+State 128
+
+ 141 ASSET_NUMBERS: ASSET_NUMBER . ASSET_NUMBERS
+
+ NUMBER_TOK shift, and go to state 82
+
+ $default reduce using rule 140 (ASSET_NUMBERS)
+
+ ASSET_NUMBERS go to state 202
+ ASSET_NUMBER go to state 128
+
+
+State 129
+
+ 40 none: NONE .
+
+ $default reduce using rule 40 (none)
+
+
+State 130
+
+ 41 write_once: WRITE_ONCE .
+
+ $default reduce using rule 41 (write_once)
+
+
+State 131
+
+ 42 no_rp: NO_RP .
+
+ $default reduce using rule 42 (no_rp)
+
+
+State 132
+
+ 43 no_conf: NO_CONF .
+
+ $default reduce using rule 43 (no_conf)
+
+
+State 133
+
+ 33 sst_set_extended_args: FLAG sst_flags .
+
+ $default reduce using rule 33 (sst_set_extended_args)
+
+
+State 134
+
+ 35 sst_flags: sst_flag . sst_flags
+
+ NONE shift, and go to state 129
+ WRITE_ONCE shift, and go to state 130
+ NO_RP shift, and go to state 131
+ NO_CONF shift, and go to state 132
+
+ $default reduce using rule 34 (sst_flags)
+
+ sst_flags go to state 203
+ sst_flag go to state 134
+ none go to state 135
+ write_once go to state 136
+ no_rp go to state 137
+ no_conf go to state 138
+
+
+State 135
+
+ 36 sst_flag: none .
+
+ $default reduce using rule 36 (sst_flag)
+
+
+State 136
+
+ 37 sst_flag: write_once .
+
+ $default reduce using rule 37 (sst_flag)
+
+
+State 137
+
+ 38 sst_flag: no_rp .
+
+ $default reduce using rule 38 (sst_flag)
+
+
+State 138
+
+ 39 sst_flag: no_conf .
+
+ $default reduce using rule 39 (sst_flag)
+
+
+State 139
+
+ 27 literal_or_random_data: DATA STAR .
+
+ $default reduce using rule 27 (literal_or_random_data)
+
+
+State 140
+
+ 153 LITERAL: LITERAL_TOK .
+
+ $default reduce using rule 153 (LITERAL)
+
+
+State 141
+
+ 154 LITERAL: HEX_LIST .
+
+ $default reduce using rule 154 (LITERAL)
+
+
+State 142
+
+ 26 literal_or_random_data: DATA LITERAL .
+
+ $default reduce using rule 26 (literal_or_random_data)
+
+
+State 143
+
+ 148 FILE_PATH: FILE_PATH_TOK .
+
+ $default reduce using rule 148 (FILE_PATH)
+
+
+State 144
+
+ 31 sst_set_base_args: sst_asset_name DFNAME sst_asset_set_file_path .
+
+ $default reduce using rule 31 (sst_set_base_args)
+
+
+State 145
+
+ 65 sst_asset_set_file_path: FILE_PATH .
+
+ $default reduce using rule 65 (sst_asset_set_file_path)
+
+
+State 146
+
+ 30 sst_set_base_args: sst_asset_name VAR IDENTIFIER .
+
+ $default reduce using rule 30 (sst_set_base_args)
+
+
+State 147
+
+ 124 key_set_source: POLICY IDENTIFIER .
+
+ $default reduce using rule 124 (key_set_source)
+
+
+State 148
+
+ 128 key_set_args: asset_designator FROM single_existing_asset . POLICY IDENTIFIER
+
+ POLICY shift, and go to state 204
+
+
+State 149
+
+ 59 single_existing_asset: random_picked_asset .
+
+ $default reduce using rule 59 (single_existing_asset)
+
+
+State 150
+
+ 58 single_existing_asset: IDENTIFIER .
+
+ $default reduce using rule 58 (single_existing_asset)
+
+
+State 151
+
+ 123 key_set_source: literal_or_random_data .
+
+ $default reduce using rule 123 (key_set_source)
+
+
+State 152
+
+ 122 key_set_sources: key_set_source key_set_sources .
+
+ $default reduce using rule 122 (key_set_sources)
+
+
+State 153
+
+ 129 key_set_args: asset_designator key_data_or_not WITH . policy_specs
+
+ ATTR shift, and go to state 99
+ TYPE shift, and go to state 100
+ ALG shift, and go to state 101
+
+ $default reduce using rule 107 (policy_specs)
+
+ policy_usage_list go to state 102
+ policy_type go to state 103
+ policy_algorithm go to state 104
+ policy_specs go to state 205
+ policy_spec go to state 106
+
+
+State 154
+
+ 68 key_size: NUMBER_TOK .
+
+ $default reduce using rule 68 (key_size)
+
+
+State 155
+
+ 72 export: EXPORT .
+
+ $default reduce using rule 72 (export)
+
+
+State 156
+
+ 74 copy: COPY .
+
+ $default reduce using rule 74 (copy)
+
+
+State 157
+
+ 76 encrypt: ENCRYPT .
+
+ $default reduce using rule 76 (encrypt)
+
+
+State 158
+
+ 78 decrypt: DECRYPT .
+
+ $default reduce using rule 78 (decrypt)
+
+
+State 159
+
+ 80 sign: SIGN .
+
+ $default reduce using rule 80 (sign)
+
+
+State 160
+
+ 82 verify: VERIFY .
+
+ $default reduce using rule 82 (verify)
+
+
+State 161
+
+ 84 derive: DERIVE .
+
+ $default reduce using rule 84 (derive)
+
+
+State 162
+
+ 73 noexport: NOEXPORT .
+
+ $default reduce using rule 73 (noexport)
+
+
+State 163
+
+ 75 nocopy: NOCOPY .
+
+ $default reduce using rule 75 (nocopy)
+
+
+State 164
+
+ 77 noencrypt: NOENCRYPT .
+
+ $default reduce using rule 77 (noencrypt)
+
+
+State 165
+
+ 79 nodecrypt: NODECRYPT .
+
+ $default reduce using rule 79 (nodecrypt)
+
+
+State 166
+
+ 81 nosign: NOSIGN .
+
+ $default reduce using rule 81 (nosign)
+
+
+State 167
+
+ 83 noverify: NOVERIFY .
+
+ $default reduce using rule 83 (noverify)
+
+
+State 168
+
+ 85 noderive: NODERIVE .
+
+ $default reduce using rule 85 (noderive)
+
+
+State 169
+
+ 86 persistent: PERSISTENT .
+
+ $default reduce using rule 86 (persistent)
+
+
+State 170
+
+ 87 volatle: VOLATILE .
+
+ $default reduce using rule 87 (volatle)
+
+
+State 171
+
+ 104 policy_usage: key_size .
+
+ $default reduce using rule 104 (policy_usage)
+
+
+State 172
+
+ 88 policy_usage: export .
+
+ $default reduce using rule 88 (policy_usage)
+
+
+State 173
+
+ 95 policy_usage: noexport .
+
+ $default reduce using rule 95 (policy_usage)
+
+
+State 174
+
+ 89 policy_usage: copy .
+
+ $default reduce using rule 89 (policy_usage)
+
+
+State 175
+
+ 96 policy_usage: nocopy .
+
+ $default reduce using rule 96 (policy_usage)
+
+
+State 176
+
+ 90 policy_usage: encrypt .
+
+ $default reduce using rule 90 (policy_usage)
+
+
+State 177
+
+ 97 policy_usage: noencrypt .
+
+ $default reduce using rule 97 (policy_usage)
+
+
+State 178
+
+ 91 policy_usage: decrypt .
+
+ $default reduce using rule 91 (policy_usage)
+
+
+State 179
+
+ 98 policy_usage: nodecrypt .
+
+ $default reduce using rule 98 (policy_usage)
+
+
+State 180
+
+ 92 policy_usage: sign .
+
+ $default reduce using rule 92 (policy_usage)
+
+
+State 181
+
+ 99 policy_usage: nosign .
+
+ $default reduce using rule 99 (policy_usage)
+
+
+State 182
+
+ 93 policy_usage: verify .
+
+ $default reduce using rule 93 (policy_usage)
+
+
+State 183
+
+ 100 policy_usage: noverify .
+
+ $default reduce using rule 100 (policy_usage)
+
+
+State 184
+
+ 94 policy_usage: derive .
+
+ $default reduce using rule 94 (policy_usage)
+
+
+State 185
+
+ 101 policy_usage: noderive .
+
+ $default reduce using rule 101 (policy_usage)
+
+
+State 186
+
+ 102 policy_usage: persistent .
+
+ $default reduce using rule 102 (policy_usage)
+
+
+State 187
+
+ 103 policy_usage: volatle .
+
+ $default reduce using rule 103 (policy_usage)
+
+
+State 188
+
+ 69 policy_usage_list: ATTR policy_usage . policy_usages
+
+ NUMBER_TOK shift, and go to state 154
+ EXPORT shift, and go to state 155
+ COPY shift, and go to state 156
+ ENCRYPT shift, and go to state 157
+ DECRYPT shift, and go to state 158
+ SIGN shift, and go to state 159
+ VERIFY shift, and go to state 160
+ DERIVE shift, and go to state 161
+ NOEXPORT shift, and go to state 162
+ NOCOPY shift, and go to state 163
+ NOENCRYPT shift, and go to state 164
+ NODECRYPT shift, and go to state 165
+ NOSIGN shift, and go to state 166
+ NOVERIFY shift, and go to state 167
+ NODERIVE shift, and go to state 168
+ PERSISTENT shift, and go to state 169
+ VOLATILE shift, and go to state 170
+
+ $default reduce using rule 70 (policy_usages)
+
+ key_size go to state 171
+ policy_usages go to state 206
+ export go to state 172
+ noexport go to state 173
+ copy go to state 174
+ nocopy go to state 175
+ encrypt go to state 176
+ noencrypt go to state 177
+ decrypt go to state 178
+ nodecrypt go to state 179
+ sign go to state 180
+ nosign go to state 181
+ verify go to state 182
+ noverify go to state 183
+ derive go to state 184
+ noderive go to state 185
+ persistent go to state 186
+ volatle go to state 187
+ policy_usage go to state 207
+
+
+State 189
+
+ 105 policy_type: TYPE IDENTIFIER .
+
+ $default reduce using rule 105 (policy_type)
+
+
+State 190
+
+ 106 policy_algorithm: ALG IDENTIFIER .
+
+ $default reduce using rule 106 (policy_algorithm)
+
+
+State 191
+
+ 108 policy_specs: policy_spec policy_specs .
+
+ $default reduce using rule 108 (policy_specs)
+
+
+State 192
+
+ 51 read_args: DFNAME sst_asset_dump_file_path .
+
+ $default reduce using rule 51 (read_args)
+
+
+State 193
+
+ 67 sst_asset_dump_file_path: FILE_PATH .
+
+ $default reduce using rule 67 (sst_asset_dump_file_path)
+
+
+State 194
+
+ 47 read_args: CHECK read_args_var_name .
+
+ $default reduce using rule 47 (read_args)
+
+
+State 195
+
+ 66 read_args_var_name: IDENTIFIER .
+
+ $default reduce using rule 66 (read_args_var_name)
+
+
+State 196
+
+ 48 read_args: CHECK LITERAL .
+
+ $default reduce using rule 48 (read_args)
+
+
+State 197
+
+ 46 read_args: VAR IDENTIFIER .
+
+ $default reduce using rule 46 (read_args)
+
+
+State 198
+
+ 53 sst_read_extended_args: OFFSET . sst_offset_spec
+
+ NUMBER_TOK shift, and go to state 208
+
+ sst_offset_spec go to state 209
+
+
+State 199
+
+ 45 sst_read_args: sst_asset_name read_args sst_read_extended_args .
+
+ $default reduce using rule 45 (sst_read_args)
+
+
+State 200
+
+ 134 block: low_sel_count TO high_sel_count OF block_content .
+
+ $default reduce using rule 134 (block)
+
+
+State 201
+
+ 145 ASSET_IDENTIFIERS: ASSET_IDENTIFIER ASSET_IDENTIFIERS .
+
+ $default reduce using rule 145 (ASSET_IDENTIFIERS)
+
+
+State 202
+
+ 141 ASSET_NUMBERS: ASSET_NUMBER ASSET_NUMBERS .
+
+ $default reduce using rule 141 (ASSET_NUMBERS)
+
+
+State 203
+
+ 35 sst_flags: sst_flag sst_flags .
+
+ $default reduce using rule 35 (sst_flags)
+
+
+State 204
+
+ 128 key_set_args: asset_designator FROM single_existing_asset POLICY . IDENTIFIER
+
+ IDENTIFIER_TOK shift, and go to state 71
+
+ IDENTIFIER go to state 210
+
+
+State 205
+
+ 129 key_set_args: asset_designator key_data_or_not WITH policy_specs .
+
+ $default reduce using rule 129 (key_set_args)
+
+
+State 206
+
+ 69 policy_usage_list: ATTR policy_usage policy_usages .
+
+ $default reduce using rule 69 (policy_usage_list)
+
+
+State 207
+
+ 71 policy_usages: policy_usage . policy_usages
+
+ NUMBER_TOK shift, and go to state 154
+ EXPORT shift, and go to state 155
+ COPY shift, and go to state 156
+ ENCRYPT shift, and go to state 157
+ DECRYPT shift, and go to state 158
+ SIGN shift, and go to state 159
+ VERIFY shift, and go to state 160
+ DERIVE shift, and go to state 161
+ NOEXPORT shift, and go to state 162
+ NOCOPY shift, and go to state 163
+ NOENCRYPT shift, and go to state 164
+ NODECRYPT shift, and go to state 165
+ NOSIGN shift, and go to state 166
+ NOVERIFY shift, and go to state 167
+ NODERIVE shift, and go to state 168
+ PERSISTENT shift, and go to state 169
+ VOLATILE shift, and go to state 170
+
+ $default reduce using rule 70 (policy_usages)
+
+ key_size go to state 171
+ policy_usages go to state 211
+ export go to state 172
+ noexport go to state 173
+ copy go to state 174
+ nocopy go to state 175
+ encrypt go to state 176
+ noencrypt go to state 177
+ decrypt go to state 178
+ nodecrypt go to state 179
+ sign go to state 180
+ nosign go to state 181
+ verify go to state 182
+ noverify go to state 183
+ derive go to state 184
+ noderive go to state 185
+ persistent go to state 186
+ volatle go to state 187
+ policy_usage go to state 207
+
+
+State 208
+
+ 44 sst_offset_spec: NUMBER_TOK .
+
+ $default reduce using rule 44 (sst_offset_spec)
+
+
+State 209
+
+ 53 sst_read_extended_args: OFFSET sst_offset_spec .
+
+ $default reduce using rule 53 (sst_read_extended_args)
+
+
+State 210
+
+ 128 key_set_args: asset_designator FROM single_existing_asset POLICY IDENTIFIER .
+
+ $default reduce using rule 128 (key_set_args)
+
+
+State 211
+
+ 71 policy_usages: policy_usage policy_usages .
+
+ $default reduce using rule 71 (policy_usages)
diff --git a/tf_fuzz/parser/tf_fuzz_grammar.tab.cpp b/tf_fuzz/parser/tf_fuzz_grammar.tab.cpp
new file mode 100644
index 0000000..6a1e852
--- /dev/null
+++ b/tf_fuzz/parser/tf_fuzz_grammar.tab.cpp
@@ -0,0 +1,3497 @@
+/* A Bison parser, made by GNU Bison 3.0.4. */
+
+/* Bison implementation for Yacc-like parsers in C
+
+ Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* As a special exception, you may create a larger work that contains
+ part or all of the Bison parser skeleton and distribute that work
+ under terms of your choice, so long as that work isn't itself a
+ parser generator using the skeleton or a modified version thereof
+ as a parser skeleton. Alternatively, if you modify or redistribute
+ the parser skeleton itself, you may (at your option) remove this
+ special exception, which will cause the skeleton and the resulting
+ Bison output files to be licensed under the GNU General Public
+ License without this special exception.
+
+ This special exception was added by the Free Software Foundation in
+ version 2.2 of Bison. */
+
+/* C LALR(1) parser skeleton written by Richard Stallman, by
+ simplifying the original so-called "semantic" parser. */
+
+/* All symbols defined below should begin with yy or YY, to avoid
+ infringing on user name space. This should be done even for local
+ variables, as they might otherwise be expanded by user macros.
+ There are some unavoidable exceptions within include files to
+ define necessary library symbols; they are noted "INFRINGES ON
+ USER NAME SPACE" below. */
+
+/* Identify Bison output. */
+#define YYBISON 1
+
+/* Bison version. */
+#define YYBISON_VERSION "3.0.4"
+
+/* Skeleton name. */
+#define YYSKELETON_NAME "yacc.c"
+
+/* Pure parsers. */
+#define YYPURE 0
+
+/* Push parsers. */
+#define YYPUSH 0
+
+/* Pull parsers. */
+#define YYPULL 1
+
+
+
+
+/* Copy the first part of user declarations. */
+#line 8 "parser/tf_fuzz_grammar.y" /* yacc.c:339 */
+
+#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 );
+ }
+ }
+}
+
+
+#line 409 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:339 */
+
+# ifndef YY_NULLPTR
+# if defined __cplusplus && 201103L <= __cplusplus
+# define YY_NULLPTR nullptr
+# else
+# define YY_NULLPTR 0
+# endif
+# endif
+
+/* Enabling verbose error messages. */
+#ifdef YYERROR_VERBOSE
+# undef YYERROR_VERBOSE
+# define YYERROR_VERBOSE 1
+#else
+# define YYERROR_VERBOSE 1
+#endif
+
+/* In a future release of Bison, this section will be replaced
+ by #include "tf_fuzz_grammar.tab.hpp". */
+#ifndef YY_YY_PARSER_TF_FUZZ_GRAMMAR_TAB_HPP_INCLUDED
+# define YY_YY_PARSER_TF_FUZZ_GRAMMAR_TAB_HPP_INCLUDED
+/* Debug traces. */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+#if YYDEBUG
+extern int yydebug;
+#endif
+
+/* Token type. */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+ enum yytokentype
+ {
+ PURPOSE = 258,
+ RAW_TEXT = 259,
+ SET = 260,
+ READ = 261,
+ REMOVE = 262,
+ SECURE = 263,
+ DONE = 264,
+ SST = 265,
+ KEY = 266,
+ POLICY = 267,
+ NAME = 268,
+ UID = 269,
+ STAR = 270,
+ ACTIVE = 271,
+ DELETED = 272,
+ EQUAL = 273,
+ DATA = 274,
+ DFNAME = 275,
+ FLAG = 276,
+ NONE = 277,
+ WRITE_ONCE = 278,
+ NO_RP = 279,
+ NO_CONF = 280,
+ OFFSET = 281,
+ CHECK = 282,
+ VAR = 283,
+ HASH = 284,
+ NEQ = 285,
+ PRINT = 286,
+ EXPECT = 287,
+ PASS = 288,
+ FAIL = 289,
+ NOTHING = 290,
+ ERROR = 291,
+ IDENTIFIER_TOK = 292,
+ LITERAL_TOK = 293,
+ HEX_LIST = 294,
+ FILE_PATH_TOK = 295,
+ NUMBER_TOK = 296,
+ SEMICOLON = 297,
+ SHUFFLE = 298,
+ TO = 299,
+ OF = 300,
+ OPEN_BRACE = 301,
+ CLOSE_BRACE = 302,
+ ATTR = 303,
+ TYPE = 304,
+ ALG = 305,
+ EXPORT = 306,
+ COPY = 307,
+ ENCRYPT = 308,
+ DECRYPT = 309,
+ SIGN = 310,
+ VERIFY = 311,
+ DERIVE = 312,
+ NOEXPORT = 313,
+ NOCOPY = 314,
+ NOENCRYPT = 315,
+ NODECRYPT = 316,
+ NOSIGN = 317,
+ NOVERIFY = 318,
+ NODERIVE = 319,
+ PERSISTENT = 320,
+ VOLATILE = 321,
+ FROM = 322,
+ WITH = 323
+ };
+#endif
+
+/* Value type. */
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+
+union YYSTYPE
+{
+#line 353 "parser/tf_fuzz_grammar.y" /* yacc.c:355 */
+int valueN; int tokenN; char *str;
+
+#line 521 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:355 */
+};
+
+typedef union YYSTYPE YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+/* Location type. */
+#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
+typedef struct YYLTYPE YYLTYPE;
+struct YYLTYPE
+{
+ int first_line;
+ int first_column;
+ int last_line;
+ int last_column;
+};
+# define YYLTYPE_IS_DECLARED 1
+# define YYLTYPE_IS_TRIVIAL 1
+#endif
+
+
+extern YYSTYPE yylval;
+extern YYLTYPE yylloc;
+int yyparse (tf_fuzz_info *rsrc);
+
+#endif /* !YY_YY_PARSER_TF_FUZZ_GRAMMAR_TAB_HPP_INCLUDED */
+
+/* Copy the second part of user declarations. */
+
+#line 552 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:358 */
+
+#ifdef short
+# undef short
+#endif
+
+#ifdef YYTYPE_UINT8
+typedef YYTYPE_UINT8 yytype_uint8;
+#else
+typedef unsigned char yytype_uint8;
+#endif
+
+#ifdef YYTYPE_INT8
+typedef YYTYPE_INT8 yytype_int8;
+#else
+typedef signed char yytype_int8;
+#endif
+
+#ifdef YYTYPE_UINT16
+typedef YYTYPE_UINT16 yytype_uint16;
+#else
+typedef unsigned short int yytype_uint16;
+#endif
+
+#ifdef YYTYPE_INT16
+typedef YYTYPE_INT16 yytype_int16;
+#else
+typedef short int yytype_int16;
+#endif
+
+#ifndef YYSIZE_T
+# ifdef __SIZE_TYPE__
+# define YYSIZE_T __SIZE_TYPE__
+# elif defined size_t
+# define YYSIZE_T size_t
+# elif ! defined YYSIZE_T
+# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+# define YYSIZE_T size_t
+# else
+# define YYSIZE_T unsigned int
+# endif
+#endif
+
+#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
+
+#ifndef YY_
+# if defined YYENABLE_NLS && YYENABLE_NLS
+# if ENABLE_NLS
+# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
+# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
+# endif
+# endif
+# ifndef YY_
+# define YY_(Msgid) Msgid
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE
+# if (defined __GNUC__ \
+ && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
+ || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
+# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
+# else
+# define YY_ATTRIBUTE(Spec) /* empty */
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE_PURE
+# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
+#endif
+
+#ifndef YY_ATTRIBUTE_UNUSED
+# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
+#endif
+
+#if !defined _Noreturn \
+ && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
+# if defined _MSC_VER && 1200 <= _MSC_VER
+# define _Noreturn __declspec (noreturn)
+# else
+# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
+# endif
+#endif
+
+/* Suppress unused-variable warnings by "using" E. */
+#if ! defined lint || defined __GNUC__
+# define YYUSE(E) ((void) (E))
+#else
+# define YYUSE(E) /* empty */
+#endif
+
+#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+/* Suppress an incorrect diagnostic about yylval being uninitialized. */
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
+ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
+ _Pragma ("GCC diagnostic pop")
+#else
+# define YY_INITIAL_VALUE(Value) Value
+#endif
+#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+#endif
+#ifndef YY_INITIAL_VALUE
+# define YY_INITIAL_VALUE(Value) /* Nothing. */
+#endif
+
+
+#if ! defined yyoverflow || YYERROR_VERBOSE
+
+/* The parser invokes alloca or malloc; define the necessary symbols. */
+
+# ifdef YYSTACK_USE_ALLOCA
+# if YYSTACK_USE_ALLOCA
+# ifdef __GNUC__
+# define YYSTACK_ALLOC __builtin_alloca
+# elif defined __BUILTIN_VA_ARG_INCR
+# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
+# elif defined _AIX
+# define YYSTACK_ALLOC __alloca
+# elif defined _MSC_VER
+# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
+# define alloca _alloca
+# else
+# define YYSTACK_ALLOC alloca
+# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
+# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+ /* Use EXIT_SUCCESS as a witness for stdlib.h. */
+# ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
+# endif
+# endif
+# endif
+# endif
+# endif
+
+# ifdef YYSTACK_ALLOC
+ /* Pacify GCC's 'empty if-body' warning. */
+# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
+# ifndef YYSTACK_ALLOC_MAXIMUM
+ /* The OS might guarantee only one guard page at the bottom of the stack,
+ and a page size can be as small as 4096 bytes. So we cannot safely
+ invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
+ to allow for a few compiler-allocated temporary stack slots. */
+# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
+# endif
+# else
+# define YYSTACK_ALLOC YYMALLOC
+# define YYSTACK_FREE YYFREE
+# ifndef YYSTACK_ALLOC_MAXIMUM
+# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
+# endif
+# if (defined __cplusplus && ! defined EXIT_SUCCESS \
+ && ! ((defined YYMALLOC || defined malloc) \
+ && (defined YYFREE || defined free)))
+# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+# ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
+# endif
+# endif
+# ifndef YYMALLOC
+# define YYMALLOC malloc
+# if ! defined malloc && ! defined EXIT_SUCCESS
+void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
+# endif
+# endif
+# ifndef YYFREE
+# define YYFREE free
+# if ! defined free && ! defined EXIT_SUCCESS
+void free (void *); /* INFRINGES ON USER NAME SPACE */
+# endif
+# endif
+# endif
+#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
+
+
+#if (! defined yyoverflow \
+ && (! defined __cplusplus \
+ || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
+ && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+
+/* A type that is properly aligned for any stack member. */
+union yyalloc
+{
+ yytype_int16 yyss_alloc;
+ YYSTYPE yyvs_alloc;
+ YYLTYPE yyls_alloc;
+};
+
+/* The size of the maximum gap between one aligned stack and the next. */
+# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
+
+/* The size of an array large to enough to hold all stacks, each with
+ N elements. */
+# define YYSTACK_BYTES(N) \
+ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
+ + 2 * YYSTACK_GAP_MAXIMUM)
+
+# define YYCOPY_NEEDED 1
+
+/* Relocate STACK from its old location to the new one. The
+ local variables YYSIZE and YYSTACKSIZE give the old and new number of
+ elements in the stack, and YYPTR gives the new location of the
+ stack. Advance YYPTR to a properly aligned location for the next
+ stack. */
+# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
+ do \
+ { \
+ YYSIZE_T yynewbytes; \
+ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
+ Stack = &yyptr->Stack_alloc; \
+ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+ yyptr += yynewbytes / sizeof (*yyptr); \
+ } \
+ while (0)
+
+#endif
+
+#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
+/* Copy COUNT objects from SRC to DST. The source and destination do
+ not overlap. */
+# ifndef YYCOPY
+# if defined __GNUC__ && 1 < __GNUC__
+# define YYCOPY(Dst, Src, Count) \
+ __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
+# else
+# define YYCOPY(Dst, Src, Count) \
+ do \
+ { \
+ YYSIZE_T yyi; \
+ for (yyi = 0; yyi < (Count); yyi++) \
+ (Dst)[yyi] = (Src)[yyi]; \
+ } \
+ while (0)
+# endif
+# endif
+#endif /* !YYCOPY_NEEDED */
+
+/* YYFINAL -- State number of the termination state. */
+#define YYFINAL 34
+/* YYLAST -- Last index in YYTABLE. */
+#define YYLAST 159
+
+/* YYNTOKENS -- Number of terminals. */
+#define YYNTOKENS 69
+/* YYNNTS -- Number of nonterminals. */
+#define YYNNTS 82
+/* YYNRULES -- Number of rules. */
+#define YYNRULES 155
+/* YYNSTATES -- Number of states. */
+#define YYNSTATES 212
+
+/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
+ by yylex, with out-of-bounds checking. */
+#define YYUNDEFTOK 2
+#define YYMAXUTOK 323
+
+#define YYTRANSLATE(YYX) \
+ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+
+/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
+ as returned by yylex, without out-of-bounds checking. */
+static const yytype_uint8 yytranslate[] =
+{
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
+ 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
+ 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
+ 65, 66, 67, 68
+};
+
+#if YYDEBUG
+ /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
+static const yytype_uint16 yyrline[] =
+{
+ 0, 378, 378, 379, 390, 409, 451, 475, 501, 504,
+ 507, 510, 513, 519, 524, 529, 534, 543, 555, 568,
+ 583, 595, 607, 622, 634, 649, 679, 691, 701, 712,
+ 713, 718, 726, 736, 737, 744, 745, 751, 751, 751,
+ 751, 753, 760, 767, 775, 784, 793, 799, 807, 816,
+ 826, 838, 851, 859, 860, 868, 868, 875, 883, 896,
+ 904, 908, 914, 923, 924, 932, 944, 951, 959, 967,
+ 974, 977, 978, 984, 990, 996, 1002, 1008, 1014, 1020,
+ 1026, 1032, 1038, 1044, 1050, 1056, 1062, 1068, 1074, 1081,
+ 1081, 1081, 1081, 1081, 1081, 1081, 1082, 1082, 1082, 1082,
+ 1082, 1082, 1083, 1083, 1083, 1083, 1089, 1098, 1107, 1108,
+ 1114, 1114, 1114, 1117, 1118, 1126, 1140, 1150, 1157, 1164,
+ 1176, 1182, 1188, 1189, 1196, 1200, 1210, 1211, 1218, 1224,
+ 1231, 1243, 1250, 1257, 1268, 1274, 1288, 1291, 1298, 1307,
+ 1317, 1320, 1321, 1324, 1337, 1340, 1341, 1344, 1353, 1361,
+ 1371, 1380, 1388, 1399, 1407, 1413
+};
+#endif
+
+#if YYDEBUG || YYERROR_VERBOSE || 1
+/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+ First, the terminals, then, starting at YYNTOKENS, nonterminals. */
+static const char *const yytname[] =
+{
+ "$end", "error", "$undefined", "PURPOSE", "RAW_TEXT", "SET", "READ",
+ "REMOVE", "SECURE", "DONE", "SST", "KEY", "POLICY", "NAME", "UID",
+ "STAR", "ACTIVE", "DELETED", "EQUAL", "DATA", "DFNAME", "FLAG", "NONE",
+ "WRITE_ONCE", "NO_RP", "NO_CONF", "OFFSET", "CHECK", "VAR", "HASH",
+ "NEQ", "PRINT", "EXPECT", "PASS", "FAIL", "NOTHING", "ERROR",
+ "IDENTIFIER_TOK", "LITERAL_TOK", "HEX_LIST", "FILE_PATH_TOK",
+ "NUMBER_TOK", "SEMICOLON", "SHUFFLE", "TO", "OF", "OPEN_BRACE",
+ "CLOSE_BRACE", "ATTR", "TYPE", "ALG", "EXPORT", "COPY", "ENCRYPT",
+ "DECRYPT", "SIGN", "VERIFY", "DERIVE", "NOEXPORT", "NOCOPY", "NOENCRYPT",
+ "NODECRYPT", "NOSIGN", "NOVERIFY", "NODERIVE", "PERSISTENT", "VOLATILE",
+ "FROM", "WITH", "$accept", "lines", "line", "command", "expect",
+ "set_command", "read_command", "remove_command", "secure_command",
+ "done_command", "literal_or_random_data", "sst_set_base_args",
+ "sst_set_extended_args", "sst_flags", "sst_flag", "none", "write_once",
+ "no_rp", "no_conf", "sst_offset_spec", "sst_read_args", "read_args",
+ "sst_read_extended_args", "sst_remove_args", "asset_designator",
+ "single_existing_asset", "random_picked_asset", "sst_asset_name",
+ "sst_asset_set_file_path", "read_args_var_name",
+ "sst_asset_dump_file_path", "key_size", "policy_usage_list",
+ "policy_usages", "export", "noexport", "copy", "nocopy", "encrypt",
+ "noencrypt", "decrypt", "nodecrypt", "sign", "nosign", "verify",
+ "noverify", "derive", "noderive", "persistent", "volatle",
+ "policy_usage", "policy_type", "policy_algorithm", "policy_specs",
+ "policy_spec", "policy_asset_spec", "policy_asset_name",
+ "policy_set_args", "policy_read_args", "key_set_sources",
+ "key_set_source", "key_data_or_not", "key_set_args", "key_remove_args",
+ "key_read_args", "block", "block_content", "open_brace", "close_brace",
+ "ASSET_NUMBER_LIST", "ASSET_NUMBERS", "ASSET_NUMBER",
+ "ASSET_IDENTIFIER_LIST", "ASSET_IDENTIFIERS", "ASSET_IDENTIFIER",
+ "IDENTIFIER", "FILE_PATH", "exact_sel_count", "low_sel_count",
+ "high_sel_count", "NUMBER", "LITERAL", YY_NULLPTR
+};
+#endif
+
+# ifdef YYPRINT
+/* YYTOKNUM[NUM] -- (External) token number corresponding to the
+ (internal) symbol number NUM (which must be that of a token). */
+static const yytype_uint16 yytoknum[] =
+{
+ 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
+ 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
+ 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
+ 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
+ 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
+ 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
+ 315, 316, 317, 318, 319, 320, 321, 322, 323
+};
+# endif
+
+#define YYPACT_NINF -102
+
+#define yypact_value_is_default(Yystate) \
+ (!!((Yystate) == (-102)))
+
+#define YYTABLE_NINF -152
+
+#define yytable_value_is_error(Yytable_value) \
+ 0
+
+ /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+ STATE-NUM. */
+static const yytype_int16 yypact[] =
+{
+ 35, -102, 75, 104, 47, -17, -102, -102, 20, 64,
+ 35, -23, -102, -102, -102, -102, -102, -102, 30, 39,
+ 73, 37, 95, 112, 37, 95, 7, 106, 95, 103,
+ -102, -102, -102, 35, -102, -102, 72, -102, 92, 20,
+ 94, 32, -2, 116, -102, -4, -8, -102, 33, 74,
+ -102, -102, 53, 53, -102, 99, 99, 113, 53, -102,
+ 115, -102, -102, -102, -102, -102, 101, 93, -102, -102,
+ -102, -102, -102, -102, -102, 96, -102, -102, -102, -102,
+ 101, -102, -102, -102, 98, 88, -102, -7, 102, 99,
+ -102, 99, 34, 76, -102, 2, 77, -102, -102, 38,
+ 99, 99, -102, -102, -102, -102, 74, 102, 89, 99,
+ -102, -102, 117, -102, -102, -102, -102, -102, -102, -102,
+ -102, -102, -102, -102, 20, -102, 101, -102, 98, -102,
+ -102, -102, -102, -102, 88, -102, -102, -102, -102, -102,
+ -102, -102, -102, -102, -102, -102, -102, -102, 134, -102,
+ -102, -102, -102, 74, -102, -102, -102, -102, -102, -102,
+ -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,
+ -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,
+ -102, -102, -102, -102, -102, -102, -102, -102, 38, -102,
+ -102, -102, -102, -102, -102, -102, -102, -102, 107, -102,
+ -102, -102, -102, -102, 99, -102, -102, 38, -102, -102,
+ -102, -102
+};
+
+ /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+ Performed when YYTABLE does not specify something else to do. Zero
+ means the default is an error. */
+static const yytype_uint8 yydefact[] =
+{
+ 2, 4, 0, 0, 0, 0, 26, 153, 0, 0,
+ 2, 0, 8, 10, 9, 11, 12, 5, 0, 0,
+ 150, 0, 0, 113, 0, 0, 0, 0, 0, 0,
+ 138, 137, 133, 2, 1, 3, 0, 6, 0, 0,
+ 0, 0, 0, 33, 63, 30, 122, 18, 0, 108,
+ 19, 20, 0, 0, 21, 0, 0, 0, 0, 22,
+ 0, 23, 56, 55, 131, 24, 0, 0, 13, 14,
+ 15, 148, 16, 7, 134, 0, 152, 58, 147, 57,
+ 145, 65, 143, 64, 141, 35, 17, 0, 0, 0,
+ 29, 0, 0, 124, 128, 122, 0, 115, 114, 0,
+ 0, 0, 110, 111, 112, 120, 108, 0, 0, 0,
+ 51, 50, 53, 132, 119, 116, 117, 118, 121, 61,
+ 62, 25, 139, 136, 0, 144, 145, 140, 141, 41,
+ 42, 43, 44, 34, 35, 37, 38, 39, 40, 28,
+ 154, 155, 27, 149, 32, 66, 31, 125, 0, 60,
+ 59, 124, 123, 108, 69, 73, 75, 77, 79, 81,
+ 83, 85, 74, 76, 78, 80, 82, 84, 86, 87,
+ 88, 105, 89, 96, 90, 97, 91, 98, 92, 99,
+ 93, 100, 94, 101, 95, 102, 103, 104, 71, 106,
+ 107, 109, 52, 68, 48, 67, 49, 47, 0, 46,
+ 135, 146, 142, 36, 0, 130, 70, 71, 45, 54,
+ 129, 72
+};
+
+ /* YYPGOTO[NTERM-NUM]. */
+static const yytype_int8 yypgoto[] =
+{
+ -102, -3, -6, -102, -102, -102, -102, -102, -102, -102,
+ -40, -102, -102, 13, -102, -102, -102, -102, -102, -102,
+ -102, 14, -102, -102, 40, -102, 58, 50, -102, -102,
+ -102, -102, -102, -56, -102, -102, -102, -102, -102, -102,
+ -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,
+ 54, -102, -102, -101, -102, -102, -102, -102, -102, 57,
+ -102, -102, -102, -102, -102, -102, -36, -102, -102, -102,
+ 26, 114, -31, 29, -70, -55, 51, -102, -102, -102,
+ 119, 49
+};
+
+ /* YYDEFGOTO[NTERM-NUM]. */
+static const yytype_int16 yydefgoto[] =
+{
+ -1, 9, 10, 11, 38, 12, 13, 14, 15, 16,
+ 90, 43, 86, 133, 134, 135, 136, 137, 138, 209,
+ 51, 112, 199, 61, 44, 148, 62, 45, 144, 194,
+ 192, 171, 102, 206, 172, 173, 174, 175, 176, 177,
+ 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
+ 207, 103, 104, 105, 106, 49, 58, 50, 59, 94,
+ 95, 96, 47, 65, 54, 17, 32, 33, 123, 83,
+ 127, 128, 79, 125, 80, 72, 145, 18, 19, 75,
+ 20, 142
+};
+
+ /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
+ positive, shift that token. If negative, reduce the rule whose
+ number is the opposite. If YYTABLE_NINF, syntax error. */
+static const yytype_int16 yytable[] =
+{
+ 114, 115, 31, 74, 91, 191, 93, 35, 139, 36,
+ 126, 87, 29, 81, 91, 87, 88, 98, 55, 37,
+ 56, 87, 57, 1, 89, 2, 3, 4, 5, 6,
+ 67, 140, 141, 31, 146, 121, 147, 150, 1, 82,
+ 2, 3, 4, 5, 6, 189, 190, 77, 97, 60,
+ 41, 42, 205, 195, 197, 151, 126, 27, 28, 92,
+ -126, 7, 46, 8, 34, 53, 30, 113, 64, 78,
+ 78, 71, 118, 107, 52, 39, 7, 63, 8, 154,
+ 108, 109, 110, 40, 111, 21, 22, 23, 200, 155,
+ 156, 157, 158, 159, 160, 161, 162, 163, 164, 165,
+ 166, 167, 168, 169, 170, 68, 69, 70, 41, 71,
+ 129, 130, 131, 132, 24, 25, 26, -151, 31, 41,
+ 42, 60, 99, 100, 101, 48, 71, 140, 141, 116,
+ 117, 119, 120, 66, 73, 7, 71, 85, 78, 82,
+ 122, 124, 143, 198, -127, 153, 204, 203, 208, 210,
+ 149, 211, 152, 188, 202, 201, 84, 196, 193, 76
+};
+
+static const yytype_uint8 yycheck[] =
+{
+ 55, 56, 8, 39, 12, 106, 46, 10, 15, 32,
+ 80, 19, 29, 15, 12, 19, 20, 48, 11, 42,
+ 13, 19, 15, 3, 28, 5, 6, 7, 8, 9,
+ 33, 38, 39, 39, 89, 66, 91, 92, 3, 41,
+ 5, 6, 7, 8, 9, 100, 101, 15, 15, 15,
+ 13, 14, 153, 108, 109, 95, 126, 10, 11, 67,
+ 68, 41, 22, 43, 0, 25, 46, 53, 28, 37,
+ 37, 37, 58, 20, 24, 45, 41, 27, 43, 41,
+ 27, 28, 29, 44, 31, 10, 11, 12, 124, 51,
+ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
+ 62, 63, 64, 65, 66, 33, 34, 35, 13, 37,
+ 22, 23, 24, 25, 10, 11, 12, 44, 124, 13,
+ 14, 15, 48, 49, 50, 13, 37, 38, 39, 16,
+ 17, 16, 17, 30, 42, 41, 37, 21, 37, 41,
+ 47, 45, 40, 26, 68, 68, 12, 134, 41, 204,
+ 92, 207, 95, 99, 128, 126, 42, 108, 107, 40
+};
+
+ /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+ symbol of state STATE-NUM. */
+static const yytype_uint8 yystos[] =
+{
+ 0, 3, 5, 6, 7, 8, 9, 41, 43, 70,
+ 71, 72, 74, 75, 76, 77, 78, 134, 146, 147,
+ 149, 10, 11, 12, 10, 11, 12, 10, 11, 29,
+ 46, 71, 135, 136, 0, 70, 32, 42, 73, 45,
+ 44, 13, 14, 80, 93, 96, 93, 131, 13, 124,
+ 126, 89, 96, 93, 133, 11, 13, 15, 125, 127,
+ 15, 92, 95, 96, 93, 132, 30, 70, 33, 34,
+ 35, 37, 144, 42, 135, 148, 149, 15, 37, 141,
+ 143, 15, 41, 138, 140, 21, 81, 19, 20, 28,
+ 79, 12, 67, 79, 128, 129, 130, 15, 141, 48,
+ 49, 50, 101, 120, 121, 122, 123, 20, 27, 28,
+ 29, 31, 90, 90, 144, 144, 16, 17, 90, 16,
+ 17, 141, 47, 137, 45, 142, 143, 139, 140, 22,
+ 23, 24, 25, 82, 83, 84, 85, 86, 87, 15,
+ 38, 39, 150, 40, 97, 145, 144, 144, 94, 95,
+ 144, 79, 128, 68, 41, 51, 52, 53, 54, 55,
+ 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
+ 66, 100, 103, 104, 105, 106, 107, 108, 109, 110,
+ 111, 112, 113, 114, 115, 116, 117, 118, 119, 144,
+ 144, 122, 99, 145, 98, 144, 150, 144, 26, 91,
+ 135, 142, 139, 82, 12, 122, 102, 119, 41, 88,
+ 144, 102
+};
+
+ /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
+static const yytype_uint8 yyr1[] =
+{
+ 0, 69, 70, 70, 71, 71, 71, 71, 72, 72,
+ 72, 72, 72, 73, 73, 73, 73, 74, 74, 74,
+ 75, 75, 75, 76, 76, 77, 78, 79, 79, 80,
+ 80, 80, 80, 81, 81, 82, 82, 83, 83, 83,
+ 83, 84, 85, 86, 87, 88, 89, 90, 90, 90,
+ 90, 90, 90, 91, 91, 92, 92, 93, 93, 94,
+ 94, 95, 95, 96, 96, 96, 97, 98, 99, 100,
+ 101, 102, 102, 103, 104, 105, 106, 107, 108, 109,
+ 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
+ 119, 119, 119, 119, 119, 119, 119, 119, 119, 119,
+ 119, 119, 119, 119, 119, 119, 120, 121, 122, 122,
+ 123, 123, 123, 124, 124, 124, 125, 125, 125, 125,
+ 126, 127, 128, 128, 129, 129, 130, 130, 131, 131,
+ 131, 132, 133, 134, 134, 134, 135, 135, 136, 137,
+ 138, 139, 139, 140, 141, 142, 142, 143, 144, 145,
+ 146, 147, 148, 149, 150, 150
+};
+
+ /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
+static const yytype_uint8 yyr2[] =
+{
+ 0, 2, 0, 2, 1, 1, 2, 3, 1, 1,
+ 1, 1, 1, 2, 2, 2, 2, 4, 3, 3,
+ 3, 3, 3, 3, 3, 4, 1, 2, 2, 2,
+ 1, 3, 3, 0, 2, 0, 2, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 3, 2, 2, 2,
+ 1, 1, 2, 0, 2, 1, 1, 2, 2, 1,
+ 1, 2, 2, 1, 2, 2, 1, 1, 1, 1,
+ 3, 0, 2, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 2, 2, 0, 2,
+ 1, 1, 1, 0, 2, 2, 2, 2, 2, 2,
+ 2, 2, 0, 2, 1, 2, 0, 1, 2, 5,
+ 4, 1, 2, 2, 3, 5, 3, 1, 1, 1,
+ 2, 0, 2, 1, 2, 0, 2, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1
+};
+
+
+#define yyerrok (yyerrstatus = 0)
+#define yyclearin (yychar = YYEMPTY)
+#define YYEMPTY (-2)
+#define YYEOF 0
+
+#define YYACCEPT goto yyacceptlab
+#define YYABORT goto yyabortlab
+#define YYERROR goto yyerrorlab
+
+
+#define YYRECOVERING() (!!yyerrstatus)
+
+#define YYBACKUP(Token, Value) \
+do \
+ if (yychar == YYEMPTY) \
+ { \
+ yychar = (Token); \
+ yylval = (Value); \
+ YYPOPSTACK (yylen); \
+ yystate = *yyssp; \
+ goto yybackup; \
+ } \
+ else \
+ { \
+ yyerror (rsrc, YY_("syntax error: cannot back up")); \
+ YYERROR; \
+ } \
+while (0)
+
+/* Error token number */
+#define YYTERROR 1
+#define YYERRCODE 256
+
+
+/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
+ If N is 0, then set CURRENT to the empty location which ends
+ the previous symbol: RHS[0] (always defined). */
+
+#ifndef YYLLOC_DEFAULT
+# define YYLLOC_DEFAULT(Current, Rhs, N) \
+ do \
+ if (N) \
+ { \
+ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
+ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
+ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
+ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
+ } \
+ else \
+ { \
+ (Current).first_line = (Current).last_line = \
+ YYRHSLOC (Rhs, 0).last_line; \
+ (Current).first_column = (Current).last_column = \
+ YYRHSLOC (Rhs, 0).last_column; \
+ } \
+ while (0)
+#endif
+
+#define YYRHSLOC(Rhs, K) ((Rhs)[K])
+
+
+/* Enable debugging if requested. */
+#if YYDEBUG
+
+# ifndef YYFPRINTF
+# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
+# define YYFPRINTF fprintf
+# endif
+
+# define YYDPRINTF(Args) \
+do { \
+ if (yydebug) \
+ YYFPRINTF Args; \
+} while (0)
+
+
+/* YY_LOCATION_PRINT -- Print the location on the stream.
+ This macro was not mandated originally: define only if we know
+ we won't break user code: when these are the locations we know. */
+
+#ifndef YY_LOCATION_PRINT
+# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
+
+/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
+
+YY_ATTRIBUTE_UNUSED
+static unsigned
+yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
+{
+ unsigned res = 0;
+ int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
+ if (0 <= yylocp->first_line)
+ {
+ res += YYFPRINTF (yyo, "%d", yylocp->first_line);
+ if (0 <= yylocp->first_column)
+ res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
+ }
+ if (0 <= yylocp->last_line)
+ {
+ if (yylocp->first_line < yylocp->last_line)
+ {
+ res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
+ if (0 <= end_col)
+ res += YYFPRINTF (yyo, ".%d", end_col);
+ }
+ else if (0 <= end_col && yylocp->first_column < end_col)
+ res += YYFPRINTF (yyo, "-%d", end_col);
+ }
+ return res;
+ }
+
+# define YY_LOCATION_PRINT(File, Loc) \
+ yy_location_print_ (File, &(Loc))
+
+# else
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+# endif
+#endif
+
+
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
+do { \
+ if (yydebug) \
+ { \
+ YYFPRINTF (stderr, "%s ", Title); \
+ yy_symbol_print (stderr, \
+ Type, Value, Location, rsrc); \
+ YYFPRINTF (stderr, "\n"); \
+ } \
+} while (0)
+
+
+/*----------------------------------------.
+| Print this symbol's value on YYOUTPUT. |
+`----------------------------------------*/
+
+static void
+yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, tf_fuzz_info *rsrc)
+{
+ FILE *yyo = yyoutput;
+ YYUSE (yyo);
+ YYUSE (yylocationp);
+ YYUSE (rsrc);
+ if (!yyvaluep)
+ return;
+# ifdef YYPRINT
+ if (yytype < YYNTOKENS)
+ YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+# endif
+ YYUSE (yytype);
+}
+
+
+/*--------------------------------.
+| Print this symbol on YYOUTPUT. |
+`--------------------------------*/
+
+static void
+yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, tf_fuzz_info *rsrc)
+{
+ YYFPRINTF (yyoutput, "%s %s (",
+ yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
+
+ YY_LOCATION_PRINT (yyoutput, *yylocationp);
+ YYFPRINTF (yyoutput, ": ");
+ yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, rsrc);
+ YYFPRINTF (yyoutput, ")");
+}
+
+/*------------------------------------------------------------------.
+| yy_stack_print -- Print the state stack from its BOTTOM up to its |
+| TOP (included). |
+`------------------------------------------------------------------*/
+
+static void
+yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
+{
+ YYFPRINTF (stderr, "Stack now");
+ for (; yybottom <= yytop; yybottom++)
+ {
+ int yybot = *yybottom;
+ YYFPRINTF (stderr, " %d", yybot);
+ }
+ YYFPRINTF (stderr, "\n");
+}
+
+# define YY_STACK_PRINT(Bottom, Top) \
+do { \
+ if (yydebug) \
+ yy_stack_print ((Bottom), (Top)); \
+} while (0)
+
+
+/*------------------------------------------------.
+| Report that the YYRULE is going to be reduced. |
+`------------------------------------------------*/
+
+static void
+yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, tf_fuzz_info *rsrc)
+{
+ unsigned long int yylno = yyrline[yyrule];
+ int yynrhs = yyr2[yyrule];
+ int yyi;
+ YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
+ yyrule - 1, yylno);
+ /* The symbols being reduced. */
+ for (yyi = 0; yyi < yynrhs; yyi++)
+ {
+ YYFPRINTF (stderr, " $%d = ", yyi + 1);
+ yy_symbol_print (stderr,
+ yystos[yyssp[yyi + 1 - yynrhs]],
+ &(yyvsp[(yyi + 1) - (yynrhs)])
+ , &(yylsp[(yyi + 1) - (yynrhs)]) , rsrc);
+ YYFPRINTF (stderr, "\n");
+ }
+}
+
+# define YY_REDUCE_PRINT(Rule) \
+do { \
+ if (yydebug) \
+ yy_reduce_print (yyssp, yyvsp, yylsp, Rule, rsrc); \
+} while (0)
+
+/* Nonzero means print parse trace. It is left uninitialized so that
+ multiple parsers can coexist. */
+int yydebug;
+#else /* !YYDEBUG */
+# define YYDPRINTF(Args)
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
+# define YY_STACK_PRINT(Bottom, Top)
+# define YY_REDUCE_PRINT(Rule)
+#endif /* !YYDEBUG */
+
+
+/* YYINITDEPTH -- initial size of the parser's stacks. */
+#ifndef YYINITDEPTH
+# define YYINITDEPTH 200
+#endif
+
+/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
+ if the built-in stack extension method is used).
+
+ Do not make this value too large; the results are undefined if
+ YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
+ evaluated with infinite-precision integer arithmetic. */
+
+#ifndef YYMAXDEPTH
+# define YYMAXDEPTH 10000
+#endif
+
+
+#if YYERROR_VERBOSE
+
+# ifndef yystrlen
+# if defined __GLIBC__ && defined _STRING_H
+# define yystrlen strlen
+# else
+/* Return the length of YYSTR. */
+static YYSIZE_T
+yystrlen (const char *yystr)
+{
+ YYSIZE_T yylen;
+ for (yylen = 0; yystr[yylen]; yylen++)
+ continue;
+ return yylen;
+}
+# endif
+# endif
+
+# ifndef yystpcpy
+# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
+# define yystpcpy stpcpy
+# else
+/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
+ YYDEST. */
+static char *
+yystpcpy (char *yydest, const char *yysrc)
+{
+ char *yyd = yydest;
+ const char *yys = yysrc;
+
+ while ((*yyd++ = *yys++) != '\0')
+ continue;
+
+ return yyd - 1;
+}
+# endif
+# endif
+
+# ifndef yytnamerr
+/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
+ quotes and backslashes, so that it's suitable for yyerror. The
+ heuristic is that double-quoting is unnecessary unless the string
+ contains an apostrophe, a comma, or backslash (other than
+ backslash-backslash). YYSTR is taken from yytname. If YYRES is
+ null, do not copy; instead, return the length of what the result
+ would have been. */
+static YYSIZE_T
+yytnamerr (char *yyres, const char *yystr)
+{
+ if (*yystr == '"')
+ {
+ YYSIZE_T yyn = 0;
+ char const *yyp = yystr;
+
+ for (;;)
+ switch (*++yyp)
+ {
+ case '\'':
+ case ',':
+ goto do_not_strip_quotes;
+
+ case '\\':
+ if (*++yyp != '\\')
+ goto do_not_strip_quotes;
+ /* Fall through. */
+ default:
+ if (yyres)
+ yyres[yyn] = *yyp;
+ yyn++;
+ break;
+
+ case '"':
+ if (yyres)
+ yyres[yyn] = '\0';
+ return yyn;
+ }
+ do_not_strip_quotes: ;
+ }
+
+ if (! yyres)
+ return yystrlen (yystr);
+
+ return yystpcpy (yyres, yystr) - yyres;
+}
+# endif
+
+/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
+ about the unexpected token YYTOKEN for the state stack whose top is
+ YYSSP.
+
+ Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
+ not large enough to hold the message. In that case, also set
+ *YYMSG_ALLOC to the required number of bytes. Return 2 if the
+ required number of bytes is too large to store. */
+static int
+yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
+ yytype_int16 *yyssp, int yytoken)
+{
+ YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
+ YYSIZE_T yysize = yysize0;
+ enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+ /* Internationalized format string. */
+ const char *yyformat = YY_NULLPTR;
+ /* Arguments of yyformat. */
+ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+ /* Number of reported tokens (one for the "unexpected", one per
+ "expected"). */
+ int yycount = 0;
+
+ /* There are many possibilities here to consider:
+ - If this state is a consistent state with a default action, then
+ the only way this function was invoked is if the default action
+ is an error action. In that case, don't check for expected
+ tokens because there are none.
+ - The only way there can be no lookahead present (in yychar) is if
+ this state is a consistent state with a default action. Thus,
+ detecting the absence of a lookahead is sufficient to determine
+ that there is no unexpected or expected token to report. In that
+ case, just report a simple "syntax error".
+ - Don't assume there isn't a lookahead just because this state is a
+ consistent state with a default action. There might have been a
+ previous inconsistent state, consistent state with a non-default
+ action, or user semantic action that manipulated yychar.
+ - Of course, the expected token list depends on states to have
+ correct lookahead information, and it depends on the parser not
+ to perform extra reductions after fetching a lookahead from the
+ scanner and before detecting a syntax error. Thus, state merging
+ (from LALR or IELR) and default reductions corrupt the expected
+ token list. However, the list is correct for canonical LR with
+ one exception: it will still contain any token that will not be
+ accepted due to an error action in a later state.
+ */
+ if (yytoken != YYEMPTY)
+ {
+ int yyn = yypact[*yyssp];
+ yyarg[yycount++] = yytname[yytoken];
+ if (!yypact_value_is_default (yyn))
+ {
+ /* Start YYX at -YYN if negative to avoid negative indexes in
+ YYCHECK. In other words, skip the first -YYN actions for
+ this state because they are default actions. */
+ int yyxbegin = yyn < 0 ? -yyn : 0;
+ /* Stay within bounds of both yycheck and yytname. */
+ int yychecklim = YYLAST - yyn + 1;
+ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+ int yyx;
+
+ for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
+ && !yytable_value_is_error (yytable[yyx + yyn]))
+ {
+ if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+ {
+ yycount = 1;
+ yysize = yysize0;
+ break;
+ }
+ yyarg[yycount++] = yytname[yyx];
+ {
+ YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
+ if (! (yysize <= yysize1
+ && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+ }
+ }
+ }
+ }
+
+ switch (yycount)
+ {
+# define YYCASE_(N, S) \
+ case N: \
+ yyformat = S; \
+ break
+ YYCASE_(0, YY_("syntax error"));
+ YYCASE_(1, YY_("syntax error, unexpected %s"));
+ YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
+ YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
+ YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
+ YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
+# undef YYCASE_
+ }
+
+ {
+ YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
+ if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+ }
+
+ if (*yymsg_alloc < yysize)
+ {
+ *yymsg_alloc = 2 * yysize;
+ if (! (yysize <= *yymsg_alloc
+ && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
+ *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
+ return 1;
+ }
+
+ /* Avoid sprintf, as that infringes on the user's name space.
+ Don't have undefined behavior even if the translation
+ produced a string with the wrong number of "%s"s. */
+ {
+ char *yyp = *yymsg;
+ int yyi = 0;
+ while ((*yyp = *yyformat) != '\0')
+ if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
+ {
+ yyp += yytnamerr (yyp, yyarg[yyi++]);
+ yyformat += 2;
+ }
+ else
+ {
+ yyp++;
+ yyformat++;
+ }
+ }
+ return 0;
+}
+#endif /* YYERROR_VERBOSE */
+
+/*-----------------------------------------------.
+| Release the memory associated to this symbol. |
+`-----------------------------------------------*/
+
+static void
+yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, tf_fuzz_info *rsrc)
+{
+ YYUSE (yyvaluep);
+ YYUSE (yylocationp);
+ YYUSE (rsrc);
+ if (!yymsg)
+ yymsg = "Deleting";
+ YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
+
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+ YYUSE (yytype);
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
+}
+
+
+
+
+/* The lookahead symbol. */
+int yychar;
+
+/* The semantic value of the lookahead symbol. */
+YYSTYPE yylval;
+/* Location data for the lookahead symbol. */
+YYLTYPE yylloc
+# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
+ = { 1, 1, 1, 1 }
+# endif
+;
+/* Number of syntax errors so far. */
+int yynerrs;
+
+
+/*----------.
+| yyparse. |
+`----------*/
+
+int
+yyparse (tf_fuzz_info *rsrc)
+{
+ int yystate;
+ /* Number of tokens to shift before error messages enabled. */
+ int yyerrstatus;
+
+ /* The stacks and their tools:
+ 'yyss': related to states.
+ 'yyvs': related to semantic values.
+ 'yyls': related to locations.
+
+ Refer to the stacks through separate pointers, to allow yyoverflow
+ to reallocate them elsewhere. */
+
+ /* The state stack. */
+ yytype_int16 yyssa[YYINITDEPTH];
+ yytype_int16 *yyss;
+ yytype_int16 *yyssp;
+
+ /* The semantic value stack. */
+ YYSTYPE yyvsa[YYINITDEPTH];
+ YYSTYPE *yyvs;
+ YYSTYPE *yyvsp;
+
+ /* The location stack. */
+ YYLTYPE yylsa[YYINITDEPTH];
+ YYLTYPE *yyls;
+ YYLTYPE *yylsp;
+
+ /* The locations where the error started and ended. */
+ YYLTYPE yyerror_range[3];
+
+ YYSIZE_T yystacksize;
+
+ int yyn;
+ int yyresult;
+ /* Lookahead token as an internal (translated) token number. */
+ int yytoken = 0;
+ /* The variables used to return semantic value and location from the
+ action routines. */
+ YYSTYPE yyval;
+ YYLTYPE yyloc;
+
+#if YYERROR_VERBOSE
+ /* Buffer for error messages, and its allocated size. */
+ char yymsgbuf[128];
+ char *yymsg = yymsgbuf;
+ YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+#endif
+
+#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
+
+ /* The number of symbols on the RHS of the reduced rule.
+ Keep to zero when no symbol should be popped. */
+ int yylen = 0;
+
+ yyssp = yyss = yyssa;
+ yyvsp = yyvs = yyvsa;
+ yylsp = yyls = yylsa;
+ yystacksize = YYINITDEPTH;
+
+ YYDPRINTF ((stderr, "Starting parse\n"));
+
+ yystate = 0;
+ yyerrstatus = 0;
+ yynerrs = 0;
+ yychar = YYEMPTY; /* Cause a token to be read. */
+ yylsp[0] = yylloc;
+ goto yysetstate;
+
+/*------------------------------------------------------------.
+| yynewstate -- Push a new state, which is found in yystate. |
+`------------------------------------------------------------*/
+ yynewstate:
+ /* In all cases, when you get here, the value and location stacks
+ have just been pushed. So pushing a state here evens the stacks. */
+ yyssp++;
+
+ yysetstate:
+ *yyssp = yystate;
+
+ if (yyss + yystacksize - 1 <= yyssp)
+ {
+ /* Get the current used size of the three stacks, in elements. */
+ YYSIZE_T yysize = yyssp - yyss + 1;
+
+#ifdef yyoverflow
+ {
+ /* Give user a chance to reallocate the stack. Use copies of
+ these so that the &'s don't force the real ones into
+ memory. */
+ YYSTYPE *yyvs1 = yyvs;
+ yytype_int16 *yyss1 = yyss;
+ YYLTYPE *yyls1 = yyls;
+
+ /* Each stack pointer address is followed by the size of the
+ data in use in that stack, in bytes. This used to be a
+ conditional around just the two extra args, but that might
+ be undefined if yyoverflow is a macro. */
+ yyoverflow (YY_("memory exhausted"),
+ &yyss1, yysize * sizeof (*yyssp),
+ &yyvs1, yysize * sizeof (*yyvsp),
+ &yyls1, yysize * sizeof (*yylsp),
+ &yystacksize);
+
+ yyls = yyls1;
+ yyss = yyss1;
+ yyvs = yyvs1;
+ }
+#else /* no yyoverflow */
+# ifndef YYSTACK_RELOCATE
+ goto yyexhaustedlab;
+# else
+ /* Extend the stack our own way. */
+ if (YYMAXDEPTH <= yystacksize)
+ goto yyexhaustedlab;
+ yystacksize *= 2;
+ if (YYMAXDEPTH < yystacksize)
+ yystacksize = YYMAXDEPTH;
+
+ {
+ yytype_int16 *yyss1 = yyss;
+ union yyalloc *yyptr =
+ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+ if (! yyptr)
+ goto yyexhaustedlab;
+ YYSTACK_RELOCATE (yyss_alloc, yyss);
+ YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+ YYSTACK_RELOCATE (yyls_alloc, yyls);
+# undef YYSTACK_RELOCATE
+ if (yyss1 != yyssa)
+ YYSTACK_FREE (yyss1);
+ }
+# endif
+#endif /* no yyoverflow */
+
+ yyssp = yyss + yysize - 1;
+ yyvsp = yyvs + yysize - 1;
+ yylsp = yyls + yysize - 1;
+
+ YYDPRINTF ((stderr, "Stack size increased to %lu\n",
+ (unsigned long int) yystacksize));
+
+ if (yyss + yystacksize - 1 <= yyssp)
+ YYABORT;
+ }
+
+ YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+
+ if (yystate == YYFINAL)
+ YYACCEPT;
+
+ goto yybackup;
+
+/*-----------.
+| yybackup. |
+`-----------*/
+yybackup:
+
+ /* Do appropriate processing given the current state. Read a
+ lookahead token if we need one and don't already have one. */
+
+ /* First try to decide what to do without reference to lookahead token. */
+ yyn = yypact[yystate];
+ if (yypact_value_is_default (yyn))
+ goto yydefault;
+
+ /* Not known => get a lookahead token if don't already have one. */
+
+ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
+ if (yychar == YYEMPTY)
+ {
+ YYDPRINTF ((stderr, "Reading a token: "));
+ yychar = yylex ();
+ }
+
+ if (yychar <= YYEOF)
+ {
+ yychar = yytoken = YYEOF;
+ YYDPRINTF ((stderr, "Now at end of input.\n"));
+ }
+ else
+ {
+ yytoken = YYTRANSLATE (yychar);
+ YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
+ }
+
+ /* If the proper action on seeing token YYTOKEN is to reduce or to
+ detect an error, take that action. */
+ yyn += yytoken;
+ if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
+ goto yydefault;
+ yyn = yytable[yyn];
+ if (yyn <= 0)
+ {
+ if (yytable_value_is_error (yyn))
+ goto yyerrlab;
+ yyn = -yyn;
+ goto yyreduce;
+ }
+
+ /* Count tokens shifted since error; after three, turn off error
+ status. */
+ if (yyerrstatus)
+ yyerrstatus--;
+
+ /* Shift the lookahead token. */
+ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
+
+ /* Discard the shifted token. */
+ yychar = YYEMPTY;
+
+ yystate = yyn;
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+ *++yyvsp = yylval;
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
+ *++yylsp = yylloc;
+ goto yynewstate;
+
+
+/*-----------------------------------------------------------.
+| yydefault -- do the default action for the current state. |
+`-----------------------------------------------------------*/
+yydefault:
+ yyn = yydefact[yystate];
+ if (yyn == 0)
+ goto yyerrlab;
+ goto yyreduce;
+
+
+/*-----------------------------.
+| yyreduce -- Do a reduction. |
+`-----------------------------*/
+yyreduce:
+ /* yyn is the number of a rule to reduce with. */
+ yylen = yyr2[yyn];
+
+ /* If YYLEN is nonzero, implement the default value of the action:
+ '$$ = $1'.
+
+ Otherwise, the following line sets YYVAL to garbage.
+ This behavior is undocumented and Bison
+ users should not rely upon it. Assigning to YYVAL
+ unconditionally makes the parser a bit smaller, and it avoids a
+ GCC warning that YYVAL may be used uninitialized. */
+ yyval = yyvsp[1-yylen];
+
+ /* Default location. */
+ YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
+ YY_REDUCE_PRINT (yyn);
+ switch (yyn)
+ {
+ case 3:
+#line 379 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ 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 1917 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 4:
+#line 390 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ 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 = "";
+ }
+#line 1941 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 5:
+#line 409 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ /* 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;)
+ }
+#line 1988 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 6:
+#line 451 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ 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;)
+ }
+#line 2017 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 7:
+#line 475 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ /* (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;)
+ }
+#line 2045 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 8:
+#line 501 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "Set command: \"" << yytext << "\"" << endl;)
+ }
+#line 2053 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 9:
+#line 504 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "Remove command: \"" << yytext << "\"" << endl;)
+ }
+#line 2061 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 10:
+#line 507 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "Read command: \"" << yytext << "\"" << endl;)
+ }
+#line 2069 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 11:
+#line 510 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "Security command: \"" << yytext << "\"" << endl;)
+ }
+#line 2077 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 12:
+#line 513 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "Done command: \"" << yytext << "\"" << endl;)
+ }
+#line 2085 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 13:
+#line 519 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "Expect pass clause: \"" << flush;)
+ templateLin->expect.set_pf_pass();
+ IVM(cout << yytext << "\"" << endl;)
+ }
+#line 2095 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 14:
+#line 524 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "Expect fail clause: \"" << flush;)
+ templateLin->expect.set_pf_fail();
+ IVM(cout << yytext << "\"" << endl;)
+ }
+#line 2105 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 15:
+#line 529 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "Expect nothing clause: \"" << flush;)
+ templateLin->expect.set_pf_nothing();
+ IVM(cout << yytext << "\"" << endl;)
+ }
+#line 2115 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 16:
+#line 534 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "Expect error clause: \"" << flush;)
+ templateLin->expect.set_pf_error (identifier);
+ IVM(cout << yytext << "\"" << endl;)
+ }
+#line 2125 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 17:
+#line 543 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ 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
+ );
+ }
+#line 2142 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 18:
+#line 555 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ 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
+ );
+ }
+#line 2160 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 19:
+#line 568 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ 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
+ );
+ }
+#line 2177 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 20:
+#line 583 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ 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
+ );
+ }
+#line 2194 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 21:
+#line 595 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ 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
+ );
+ }
+#line 2211 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 22:
+#line 607 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ 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
+ );
+ }
+#line 2228 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 23:
+#line 622 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ 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
+ );
+ }
+#line 2245 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 24:
+#line 634 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ 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
+ );
+ }
+#line 2263 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 25:
+#line 649 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ /* 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();
+
+
+ }
+#line 2296 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 26:
+#line 679 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ if (nesting_level != 0) {
+ cerr << "\n\"done\" only available at outer-most { } nesting level."
+ << endl;
+ exit (702);
+ } else {
+ YYACCEPT;
+ }
+ }
+#line 2310 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 27:
+#line 691 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ 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;)
+ }
+#line 2325 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 28:
+#line 701 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ { /* 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;
+ }
+#line 2337 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 30:
+#line 713 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "SST-create from random data (no 'data *')" << endl;)
+ set_data.randomize();
+ literal.assign (set_data.get()); /* just in case something uses literal */
+ }
+#line 2347 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 31:
+#line 718 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ { /* 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;)
+ }
+#line 2360 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 32:
+#line 726 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ 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. */
+ }
+#line 2372 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 34:
+#line 737 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "SST creation flags" << endl;)
+ IVM(cout << yytext << "\"" << endl;)
+ }
+#line 2381 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 36:
+#line 745 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "SST creation flag" << endl;)
+ IVM(cout << yytext << "\"" << endl;)
+ }
+#line 2390 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 41:
+#line 753 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ set_data.flags_string = "PSA_STORAGE_FLAG_NONE";
+ /* TODO: grab from boilerplate */
+ IVM(cout << "SST no storage flag: " << yytext << "\"" << endl;)
+ }
+#line 2400 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 42:
+#line 760 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ set_data.flags_string = "PSA_STORAGE_FLAG_WRITE_ONCE";
+ /* TODO: grab from boilerplate */
+ IVM(cout << "SST write-once flag: " << yytext << "\"" << endl;)
+ }
+#line 2410 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 43:
+#line 767 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ set_data.flags_string = "PSA_STORAGE_FLAG_NO_REPLAY_PROTECTION";
+ /* TODO: grab from boilerplate */
+ IVM(cout << "SST no-replay-protection flag: "
+ << yytext << "\"" << endl;)
+ }
+#line 2421 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 44:
+#line 775 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ set_data.flags_string = "PSA_STORAGE_FLAG_NO_CONFIDENTIALITY";
+ /* TODO: grab from boilerplate */
+ IVM(cout << "SST no-confidentiality flag: " << yytext
+ << "\"" << endl;)
+ }
+#line 2432 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 45:
+#line 784 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "SST-data offset: \"" << flush;)
+ set_data.data_offset = atol(yytext);
+ IVM(cout << yytext << "\"" << endl;)
+ }
+#line 2442 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 46:
+#line 793 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "SST-read arguments: " << yytext << "\"" << endl;)
+ }
+#line 2450 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 47:
+#line 799 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ { /* 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;)
+ }
+#line 2463 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 48:
+#line 807 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ { /* 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;
+ }
+#line 2477 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 49:
+#line 816 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ { /* 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;)
+ }
+#line 2492 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 50:
+#line 826 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ { /* 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;)
+ }
+#line 2509 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 51:
+#line 838 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ { /* 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;)
+ }
+#line 2527 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 52:
+#line 851 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ { /* dump to file */
+ IVM(cout << "Read dump to file: \""
+ << yytext << "\"" << endl;)
+ set_data.literal_data_not_file = set_data.random_data = false;
+ }
+#line 2537 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 54:
+#line 860 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "SST data offset" << endl;)
+ set_data.data_offset = atol(yytext);
+ IVM(cout << yytext << "\"" << endl;)
+ }
+#line 2547 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 56:
+#line 868 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "SST-remove arguments: \""
+ << yytext << "\"" << endl;)
+ }
+#line 2556 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 57:
+#line 875 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ 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;)
+ }
+#line 2569 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 58:
+#line 883 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ 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;)
+ }
+#line 2585 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 59:
+#line 896 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ 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;)
+ }
+#line 2598 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 61:
+#line 908 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "Asset random active: \"" << flush;)
+ random_asset = psa_asset_usage::active;
+ parsed_asset.id_n_not_name = false;
+ IVM(cout << yytext << "\"" << endl;)
+ }
+#line 2609 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 62:
+#line 914 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "Asset random deleted: \"" << flush;)
+ random_asset = psa_asset_usage::deleted;
+ parsed_asset.id_n_not_name = false;
+ IVM(cout << yytext << "\"" << endl;)
+ }
+#line 2620 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 64:
+#line 924 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ 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;)
+ }
+#line 2633 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 65:
+#line 932 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ 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;)
+ }
+#line 2647 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 66:
+#line 944 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "SST-asset-create file path: \"" << flush;)
+ IVM(cout << yytext << "\"" << endl;)
+ }
+#line 2656 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 67:
+#line 951 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "Read-arguments variable name: \"" << flush;)
+ var_name = yytext;
+ IVM(cout << yytext << "\"" << endl;)
+ }
+#line 2666 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 68:
+#line 959 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "SST-asset dump-file path: \"" << flush;)
+ set_data.file_path = yytext;
+ IVM(cout << yytext << "\"" << endl;)
+ }
+#line 2676 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 69:
+#line 967 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "Key size: \"" << flush;)
+ policy_info.n_bits = atol(yytext);
+ IVM(cout << yytext << "\"" << endl;)
+ }
+#line 2686 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 72:
+#line 978 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "Key-policy usages at line number " << dec << yylineno
+ << "." << endl;)
+ }
+#line 2695 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 73:
+#line 984 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ policy_info.exportable = true;
+ IVM(cout << "Exportable key true: " << yytext << "\"" << endl;)
+ }
+#line 2704 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 74:
+#line 990 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ policy_info.exportable = false;
+ IVM(cout << "Non-exportable key: " << yytext << "\"" << endl;)
+ }
+#line 2713 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 75:
+#line 996 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ policy_info.copyable = true;
+ IVM(cout << "Copyable key true: " << yytext << "\"" << endl;)
+ }
+#line 2722 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 76:
+#line 1002 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ policy_info.copyable = false;
+ IVM(cout << "Non-copyable key: " << yytext << "\"" << endl;)
+ }
+#line 2731 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 77:
+#line 1008 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ policy_info.can_encrypt = true;
+ IVM(cout << "Encryption key true: " << yytext << "\"" << endl;)
+ }
+#line 2740 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 78:
+#line 1014 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ policy_info.can_encrypt = false;
+ IVM(cout << "Non-encryption key: " << yytext << "\"" << endl;)
+ }
+#line 2749 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 79:
+#line 1020 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ policy_info.can_decrypt = true;
+ IVM(cout << "Decryption key true: " << yytext << "\"" << endl;)
+ }
+#line 2758 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 80:
+#line 1026 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ policy_info.can_decrypt = false;
+ IVM(cout << "Non-decryption key: " << yytext << "\"" << endl;)
+ }
+#line 2767 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 81:
+#line 1032 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ policy_info.can_sign = true;
+ IVM(cout << "Signing key true: " << yytext << "\"" << endl;)
+ }
+#line 2776 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 82:
+#line 1038 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ policy_info.can_sign = false;
+ IVM(cout << "Non-signing key: " << yytext << "\"" << endl;)
+ }
+#line 2785 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 83:
+#line 1044 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ policy_info.can_verify = true;
+ IVM(cout << "Verify key true: " << yytext << "\"" << endl;)
+ }
+#line 2794 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 84:
+#line 1050 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ policy_info.can_verify = false;
+ IVM(cout << "Non-verify key: " << yytext << "\"" << endl;)
+ }
+#line 2803 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 85:
+#line 1056 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ policy_info.derivable = true;
+ IVM(cout << "Derivable key true: " << yytext << "\"" << endl;)
+ }
+#line 2812 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 86:
+#line 1062 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ policy_info.derivable = false;
+ IVM(cout << "Non-derivable key: " << yytext << "\"" << endl;)
+ }
+#line 2821 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 87:
+#line 1068 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ policy_info.persistent = true;
+ IVM(cout << "Persistent key: " << yytext << "\"" << endl;)
+ }
+#line 2830 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 88:
+#line 1074 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ policy_info.persistent = false;
+ IVM(cout << "Volatile key: " << yytext << "\"" << endl;)
+ }
+#line 2839 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 105:
+#line 1083 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "Policy usage: " << yytext << "\"" << endl;)
+ }
+#line 2847 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 106:
+#line 1089 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ // 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;)
+ }
+#line 2859 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 107:
+#line 1098 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ // 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;)
+ }
+#line 2871 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 109:
+#line 1108 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "Key-policy specs at line number " << dec << yylineno
+ << "." << endl;)
+ }
+#line 2880 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 114:
+#line 1118 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ 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;)
+ }
+#line 2893 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 115:
+#line 1126 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ 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;)
+ }
+#line 2909 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 116:
+#line 1140 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ 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;)
+ }
+#line 2924 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 117:
+#line 1150 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ 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;)
+ }
+#line 2936 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 118:
+#line 1157 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ 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;)
+ }
+#line 2948 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 119:
+#line 1164 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ 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;)
+ }
+#line 2962 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 120:
+#line 1176 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "Policy-create arguments: \"" << yytext << "\"" << endl;)
+ }
+#line 2970 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 121:
+#line 1182 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "Policy-read arguments: " << yytext << "\"" << endl;)
+ }
+#line 2978 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 123:
+#line 1189 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "Key-set sources at Line number "
+ << yytext << "\"" << endl;)
+ }
+#line 2987 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 124:
+#line 1196 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "Key-set sources, literal or random data: "
+ << yytext << "\"" << endl;)
+ }
+#line 2996 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 125:
+#line 1200 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ 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;)
+ }
+#line 3008 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 127:
+#line 1211 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "Key data, literal or random data: "
+ << yytext << "\"" << endl;)
+ }
+#line 3017 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 128:
+#line 1218 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "Key-create from data, policy, or nothing (default): \""
+ << yytext << "\"" << endl;)
+ policy_info.copy_key = false;
+ policy_info.implicit_policy = false;
+ }
+#line 3028 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 129:
+#line 1224 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ 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;)
+ }
+#line 3040 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 130:
+#line 1231 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ 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);
+ }
+#line 3054 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 131:
+#line 1243 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "Key-remove arguments: \""
+ << yytext << "\"" << endl;)
+ }
+#line 3063 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 132:
+#line 1250 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "Key dump: \"" << yytext << "\"" << endl;)
+ }
+#line 3071 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 133:
+#line 1257 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ 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;)
+ }
+#line 3087 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 134:
+#line 1268 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ 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;)
+ }
+#line 3098 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 135:
+#line 1274 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ 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;)
+ }
+#line 3114 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 136:
+#line 1288 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "Block content: \"" << yytext << "\"" << endl;)
+ }
+#line 3122 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 137:
+#line 1291 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "Single-line would-be-block content: \"" << flush;)
+ IVM(cout << yytext << "\"" << endl;)
+ }
+#line 3131 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 138:
+#line 1298 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "Open brace: \"" << flush;)
+ template_block_vector.clear(); // clean slate of template lines
+ nesting_level = 1;
+ IVM(cout << yytext << "\"" << endl;)
+ }
+#line 3142 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 139:
+#line 1307 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "Close brace: " << flush;)
+ IVM(cout << yytext << "\"" << endl;)
+ }
+#line 3151 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 143:
+#line 1324 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "ASSET_NUMBER: \"" << flush;)
+ nid = atol(yytext);
+ parsed_asset.asset_id_n_vector.push_back (nid);
+ IVM(cout << yytext << "\"" << endl;)
+ }
+#line 3162 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 147:
+#line 1344 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "ASSET_IDENTIFIER: \"" << flush;)
+ aid = identifier = yytext;
+ parsed_asset.asset_name_vector.push_back (aid);
+ IVM(cout << yytext << "\"" << endl;)
+ }
+#line 3173 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 148:
+#line 1353 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "IDENTIFIER: \"" << flush;)
+ identifier = yytext;
+ IVM(cout << yytext << "\"" << endl;)
+ }
+#line 3183 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 149:
+#line 1361 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "FILE_PATH: \"" << flush;)
+ set_data.file_path = yytext;
+ IVM(cout << yytext << "\"" << endl;)
+ }
+#line 3193 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 150:
+#line 1371 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ 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;)
+ }
+#line 3204 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 151:
+#line 1380 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "Least number of random template lines: \"" << flush;)
+ low_nmbr_lines = number;
+ IVM(cout << number << "\"" << endl;)
+ }
+#line 3214 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 152:
+#line 1388 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "Most number of random template lines: \"" << flush;)
+ high_nmbr_lines = number;
+ ++nesting_level;
+ IVM(cout << number << "\"" << endl;)
+ }
+#line 3225 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 153:
+#line 1399 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "NUMBER: \"" << flush;)
+ number = atol(yytext);
+ IVM(cout << yytext << "\"" << endl;)
+ }
+#line 3235 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 154:
+#line 1407 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "LITERAL string: " << flush;)
+ literal = yytext;
+ literal_is_string = true;
+ IVM(cout << yytext << endl;)
+ }
+#line 3246 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+ case 155:
+#line 1413 "parser/tf_fuzz_grammar.y" /* yacc.c:1646 */
+ {
+ IVM(cout << "LITERAL hex-value list: " << flush;)
+ literal = yytext;
+ literal_is_string = false;
+ IVM(cout << yytext << endl;)
+ }
+#line 3257 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ break;
+
+
+#line 3261 "parser/tf_fuzz_grammar.tab.cpp" /* yacc.c:1646 */
+ default: break;
+ }
+ /* User semantic actions sometimes alter yychar, and that requires
+ that yytoken be updated with the new translation. We take the
+ approach of translating immediately before every use of yytoken.
+ One alternative is translating here after every semantic action,
+ but that translation would be missed if the semantic action invokes
+ YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
+ if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
+ incorrect destructor might then be invoked immediately. In the
+ case of YYERROR or YYBACKUP, subsequent parser actions might lead
+ to an incorrect destructor call or verbose syntax error message
+ before the lookahead is translated. */
+ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
+
+ YYPOPSTACK (yylen);
+ yylen = 0;
+ YY_STACK_PRINT (yyss, yyssp);
+
+ *++yyvsp = yyval;
+ *++yylsp = yyloc;
+
+ /* Now 'shift' the result of the reduction. Determine what state
+ that goes to, based on the state we popped back to and the rule
+ number reduced by. */
+
+ yyn = yyr1[yyn];
+
+ yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
+ if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
+ yystate = yytable[yystate];
+ else
+ yystate = yydefgoto[yyn - YYNTOKENS];
+
+ goto yynewstate;
+
+
+/*--------------------------------------.
+| yyerrlab -- here on detecting error. |
+`--------------------------------------*/
+yyerrlab:
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
+
+ /* If not already recovering from an error, report this error. */
+ if (!yyerrstatus)
+ {
+ ++yynerrs;
+#if ! YYERROR_VERBOSE
+ yyerror (rsrc, YY_("syntax error"));
+#else
+# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
+ yyssp, yytoken)
+ {
+ char const *yymsgp = YY_("syntax error");
+ int yysyntax_error_status;
+ yysyntax_error_status = YYSYNTAX_ERROR;
+ if (yysyntax_error_status == 0)
+ yymsgp = yymsg;
+ else if (yysyntax_error_status == 1)
+ {
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE (yymsg);
+ yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
+ if (!yymsg)
+ {
+ yymsg = yymsgbuf;
+ yymsg_alloc = sizeof yymsgbuf;
+ yysyntax_error_status = 2;
+ }
+ else
+ {
+ yysyntax_error_status = YYSYNTAX_ERROR;
+ yymsgp = yymsg;
+ }
+ }
+ yyerror (rsrc, yymsgp);
+ if (yysyntax_error_status == 2)
+ goto yyexhaustedlab;
+ }
+# undef YYSYNTAX_ERROR
+#endif
+ }
+
+ yyerror_range[1] = yylloc;
+
+ if (yyerrstatus == 3)
+ {
+ /* If just tried and failed to reuse lookahead token after an
+ error, discard it. */
+
+ if (yychar <= YYEOF)
+ {
+ /* Return failure if at end of input. */
+ if (yychar == YYEOF)
+ YYABORT;
+ }
+ else
+ {
+ yydestruct ("Error: discarding",
+ yytoken, &yylval, &yylloc, rsrc);
+ yychar = YYEMPTY;
+ }
+ }
+
+ /* Else will try to reuse lookahead token after shifting the error
+ token. */
+ goto yyerrlab1;
+
+
+/*---------------------------------------------------.
+| yyerrorlab -- error raised explicitly by YYERROR. |
+`---------------------------------------------------*/
+yyerrorlab:
+
+ /* Pacify compilers like GCC when the user code never invokes
+ YYERROR and the label yyerrorlab therefore never appears in user
+ code. */
+ if (/*CONSTCOND*/ 0)
+ goto yyerrorlab;
+
+ yyerror_range[1] = yylsp[1-yylen];
+ /* Do not reclaim the symbols of the rule whose action triggered
+ this YYERROR. */
+ YYPOPSTACK (yylen);
+ yylen = 0;
+ YY_STACK_PRINT (yyss, yyssp);
+ yystate = *yyssp;
+ goto yyerrlab1;
+
+
+/*-------------------------------------------------------------.
+| yyerrlab1 -- common code for both syntax error and YYERROR. |
+`-------------------------------------------------------------*/
+yyerrlab1:
+ yyerrstatus = 3; /* Each real token shifted decrements this. */
+
+ for (;;)
+ {
+ yyn = yypact[yystate];
+ if (!yypact_value_is_default (yyn))
+ {
+ yyn += YYTERROR;
+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+ {
+ yyn = yytable[yyn];
+ if (0 < yyn)
+ break;
+ }
+ }
+
+ /* Pop the current state because it cannot handle the error token. */
+ if (yyssp == yyss)
+ YYABORT;
+
+ yyerror_range[1] = *yylsp;
+ yydestruct ("Error: popping",
+ yystos[yystate], yyvsp, yylsp, rsrc);
+ YYPOPSTACK (1);
+ yystate = *yyssp;
+ YY_STACK_PRINT (yyss, yyssp);
+ }
+
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+ *++yyvsp = yylval;
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
+
+ yyerror_range[2] = yylloc;
+ /* Using YYLLOC is tempting, but would change the location of
+ the lookahead. YYLOC is available though. */
+ YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
+ *++yylsp = yyloc;
+
+ /* Shift the error token. */
+ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
+
+ yystate = yyn;
+ goto yynewstate;
+
+
+/*-------------------------------------.
+| yyacceptlab -- YYACCEPT comes here. |
+`-------------------------------------*/
+yyacceptlab:
+ yyresult = 0;
+ goto yyreturn;
+
+/*-----------------------------------.
+| yyabortlab -- YYABORT comes here. |
+`-----------------------------------*/
+yyabortlab:
+ yyresult = 1;
+ goto yyreturn;
+
+#if !defined yyoverflow || YYERROR_VERBOSE
+/*-------------------------------------------------.
+| yyexhaustedlab -- memory exhaustion comes here. |
+`-------------------------------------------------*/
+yyexhaustedlab:
+ yyerror (rsrc, YY_("memory exhausted"));
+ yyresult = 2;
+ /* Fall through. */
+#endif
+
+yyreturn:
+ if (yychar != YYEMPTY)
+ {
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = YYTRANSLATE (yychar);
+ yydestruct ("Cleanup: discarding lookahead",
+ yytoken, &yylval, &yylloc, rsrc);
+ }
+ /* Do not reclaim the symbols of the rule whose action triggered
+ this YYABORT or YYACCEPT. */
+ YYPOPSTACK (yylen);
+ YY_STACK_PRINT (yyss, yyssp);
+ while (yyssp != yyss)
+ {
+ yydestruct ("Cleanup: popping",
+ yystos[*yyssp], yyvsp, yylsp, rsrc);
+ YYPOPSTACK (1);
+ }
+#ifndef yyoverflow
+ if (yyss != yyssa)
+ YYSTACK_FREE (yyss);
+#endif
+#if YYERROR_VERBOSE
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE (yymsg);
+#endif
+ return yyresult;
+}
+#line 1422 "parser/tf_fuzz_grammar.y" /* yacc.c:1906 */
+
+
diff --git a/tf_fuzz/parser/tf_fuzz_grammar.tab.hpp b/tf_fuzz/parser/tf_fuzz_grammar.tab.hpp
new file mode 100644
index 0000000..a9a9488
--- /dev/null
+++ b/tf_fuzz/parser/tf_fuzz_grammar.tab.hpp
@@ -0,0 +1,152 @@
+/* A Bison parser, made by GNU Bison 3.0.4. */
+
+/* Bison interface for Yacc-like parsers in C
+
+ Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* As a special exception, you may create a larger work that contains
+ part or all of the Bison parser skeleton and distribute that work
+ under terms of your choice, so long as that work isn't itself a
+ parser generator using the skeleton or a modified version thereof
+ as a parser skeleton. Alternatively, if you modify or redistribute
+ the parser skeleton itself, you may (at your option) remove this
+ special exception, which will cause the skeleton and the resulting
+ Bison output files to be licensed under the GNU General Public
+ License without this special exception.
+
+ This special exception was added by the Free Software Foundation in
+ version 2.2 of Bison. */
+
+#ifndef YY_YY_PARSER_TF_FUZZ_GRAMMAR_TAB_HPP_INCLUDED
+# define YY_YY_PARSER_TF_FUZZ_GRAMMAR_TAB_HPP_INCLUDED
+/* Debug traces. */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+#if YYDEBUG
+extern int yydebug;
+#endif
+
+/* Token type. */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+ enum yytokentype
+ {
+ PURPOSE = 258,
+ RAW_TEXT = 259,
+ SET = 260,
+ READ = 261,
+ REMOVE = 262,
+ SECURE = 263,
+ DONE = 264,
+ SST = 265,
+ KEY = 266,
+ POLICY = 267,
+ NAME = 268,
+ UID = 269,
+ STAR = 270,
+ ACTIVE = 271,
+ DELETED = 272,
+ EQUAL = 273,
+ DATA = 274,
+ DFNAME = 275,
+ FLAG = 276,
+ NONE = 277,
+ WRITE_ONCE = 278,
+ NO_RP = 279,
+ NO_CONF = 280,
+ OFFSET = 281,
+ CHECK = 282,
+ VAR = 283,
+ HASH = 284,
+ NEQ = 285,
+ PRINT = 286,
+ EXPECT = 287,
+ PASS = 288,
+ FAIL = 289,
+ NOTHING = 290,
+ ERROR = 291,
+ IDENTIFIER_TOK = 292,
+ LITERAL_TOK = 293,
+ HEX_LIST = 294,
+ FILE_PATH_TOK = 295,
+ NUMBER_TOK = 296,
+ SEMICOLON = 297,
+ SHUFFLE = 298,
+ TO = 299,
+ OF = 300,
+ OPEN_BRACE = 301,
+ CLOSE_BRACE = 302,
+ ATTR = 303,
+ TYPE = 304,
+ ALG = 305,
+ EXPORT = 306,
+ COPY = 307,
+ ENCRYPT = 308,
+ DECRYPT = 309,
+ SIGN = 310,
+ VERIFY = 311,
+ DERIVE = 312,
+ NOEXPORT = 313,
+ NOCOPY = 314,
+ NOENCRYPT = 315,
+ NODECRYPT = 316,
+ NOSIGN = 317,
+ NOVERIFY = 318,
+ NODERIVE = 319,
+ PERSISTENT = 320,
+ VOLATILE = 321,
+ FROM = 322,
+ WITH = 323
+ };
+#endif
+
+/* Value type. */
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+
+union YYSTYPE
+{
+#line 353 "parser/tf_fuzz_grammar.y" /* yacc.c:1909 */
+int valueN; int tokenN; char *str;
+
+#line 126 "parser/tf_fuzz_grammar.tab.hpp" /* yacc.c:1909 */
+};
+
+typedef union YYSTYPE YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+/* Location type. */
+#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
+typedef struct YYLTYPE YYLTYPE;
+struct YYLTYPE
+{
+ int first_line;
+ int first_column;
+ int last_line;
+ int last_column;
+};
+# define YYLTYPE_IS_DECLARED 1
+# define YYLTYPE_IS_TRIVIAL 1
+#endif
+
+
+extern YYSTYPE yylval;
+extern YYLTYPE yylloc;
+int yyparse (tf_fuzz_info *rsrc);
+
+#endif /* !YY_YY_PARSER_TF_FUZZ_GRAMMAR_TAB_HPP_INCLUDED */
diff --git a/tf_fuzz/parser/tf_fuzz_grammar.tab.o b/tf_fuzz/parser/tf_fuzz_grammar.tab.o
new file mode 100644
index 0000000..5954ef6
--- /dev/null
+++ b/tf_fuzz/parser/tf_fuzz_grammar.tab.o
Binary files differ
diff --git a/tf_fuzz/parser/tf_fuzz_grammar.y b/tf_fuzz/parser/tf_fuzz_grammar.y
new file mode 100644
index 0000000..17c31b4
--- /dev/null
+++ b/tf_fuzz/parser/tf_fuzz_grammar.y
@@ -0,0 +1,1423 @@
+/*
+ * 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;)
+ }
+ ;
+
+
+%%
+