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