Karl Zhang | 3de5ab1 | 2021-05-31 11:45:48 +0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2019-2020, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #include "class_forwards.hpp" |
| 9 | |
| 10 | #include "boilerplate.hpp" |
| 11 | #include "gibberish.hpp" |
| 12 | #include "compute.hpp" |
| 13 | #include "data_blocks.hpp" |
| 14 | #include "psa_asset.hpp" |
| 15 | #include "find_or_create_asset.hpp" |
| 16 | #include "template_line.hpp" |
| 17 | #include "tf_fuzz.hpp" |
| 18 | #include "crypto_asset.hpp" |
| 19 | #include "psa_call.hpp" |
| 20 | #include "crypto_call.hpp" |
| 21 | #include "sst_asset.hpp" |
| 22 | #include "crypto_asset.hpp" |
| 23 | #include "crypto_template_line.hpp" |
| 24 | |
| 25 | |
| 26 | |
| 27 | /********************************************************************************** |
| 28 | Methods of class set_policy_template_line follow: |
| 29 | **********************************************************************************/ |
| 30 | |
| 31 | set_policy_template_line::set_policy_template_line (tf_fuzz_info *resources) |
| 32 | : policy_template_line (resources) |
| 33 | { |
| 34 | // No further setup to be performed. |
| 35 | return; // just to have something to pin a breakpoint onto |
| 36 | } |
| 37 | |
| 38 | // Default destructor: |
| 39 | set_policy_template_line::~set_policy_template_line (void) |
| 40 | { |
| 41 | // TODO: Add an error for this being invoked. |
| 42 | return; // just to have something to pin a breakpoint onto |
| 43 | } |
| 44 | |
| 45 | // (Default constructor not used) |
| 46 | |
| 47 | |
| 48 | /********************************************************************************** |
| 49 | End of methods of class set_policy_template_line. |
| 50 | **********************************************************************************/ |
| 51 | |
| 52 | |
| 53 | /********************************************************************************** |
| 54 | Methods of class read_policy_template_line follow: |
| 55 | **********************************************************************************/ |
| 56 | |
| 57 | read_policy_template_line::read_policy_template_line (tf_fuzz_info *resources) |
| 58 | : policy_template_line (resources) |
| 59 | { |
| 60 | return; // just to have something to pin a breakpoint onto |
| 61 | } |
| 62 | |
| 63 | // Default destructor: |
| 64 | read_policy_template_line::~read_policy_template_line (void) |
| 65 | { |
| 66 | return; // just to have something to pin a breakpoint onto |
| 67 | } |
| 68 | |
| 69 | // (Default constructor not used) |
| 70 | |
| 71 | |
| 72 | /********************************************************************************** |
| 73 | End of methods of class read_policy_template_line. |
| 74 | **********************************************************************************/ |
| 75 | |
| 76 | |
| 77 | /********************************************************************************** |
| 78 | Methods of class set_key_template_line follow: |
| 79 | **********************************************************************************/ |
| 80 | |
| 81 | set_key_template_line::set_key_template_line (tf_fuzz_info *resources) |
| 82 | : key_template_line (resources) |
| 83 | { |
| 84 | // Nothing further to initialize. |
| 85 | } |
| 86 | |
| 87 | // Default destructor: |
| 88 | set_key_template_line::~set_key_template_line (void) |
| 89 | { |
| 90 | return; // just to have something to pin a breakpoint onto |
| 91 | } |
| 92 | |
| 93 | // (Default constructor not used) |
| 94 | |
| 95 | |
| 96 | /********************************************************************************** |
| 97 | End of methods of class set_key_template_line. |
| 98 | **********************************************************************************/ |
| 99 | |
| 100 | |
| 101 | /********************************************************************************** |
| 102 | Methods of class remove_key_template_line follow: |
| 103 | **********************************************************************************/ |
| 104 | |
| 105 | remove_key_template_line::remove_key_template_line (tf_fuzz_info *resources) |
| 106 | : key_template_line (resources) |
| 107 | { |
| 108 | is_remove = true; // template_line's constructor defaults this to false |
| 109 | } |
| 110 | |
| 111 | // Default destructor: |
| 112 | remove_key_template_line::~remove_key_template_line (void) |
| 113 | { |
| 114 | return; // just to have something to pin a breakpoint onto |
| 115 | } |
| 116 | |
| 117 | // (Default constructor not used) |
| 118 | |
| 119 | |
| 120 | /********************************************************************************** |
| 121 | End of methods of class remove_key_template_line. |
| 122 | **********************************************************************************/ |
| 123 | |
| 124 | |
| 125 | /********************************************************************************** |
| 126 | Methods of class read_key_template_line follow: |
| 127 | **********************************************************************************/ |
| 128 | |
| 129 | read_key_template_line::read_key_template_line (tf_fuzz_info *resources) |
| 130 | : key_template_line (resources) |
| 131 | { |
| 132 | char gibberish_buffer[4096]; string databuff; |
| 133 | int data_length; |
| 134 | set_data.string_specified = (rand()%2) == 1? true : false; |
| 135 | |
| 136 | // Go ahead and create a literal-data string even if not ultimately used: |
| 137 | data_length = test_state->gibbergen.pick_sentence_len(); |
| 138 | test_state->gibbergen.sentence (gibberish_buffer, gibberish_buffer + data_length); |
| 139 | databuff = gibberish_buffer; set_data.set (databuff); |
| 140 | |
| 141 | set_data.file_specified = (!set_data.string_specified && (rand()%2) == 1)? true : false; |
| 142 | set_data.file_path = ""; // can't really devise a random path |
| 143 | } |
| 144 | |
| 145 | // Default destructor: |
| 146 | read_key_template_line::~read_key_template_line (void) |
| 147 | { |
| 148 | return; // just to have something to pin a breakpoint onto |
| 149 | } |
| 150 | |
| 151 | // (Default constructor not used) |
| 152 | |
| 153 | |
| 154 | /********************************************************************************** |
| 155 | End of methods of class read_key_template_line. |
| 156 | **********************************************************************************/ |