blob: 7dc1c8e8a2737566a985d7653c4daa041a221763 [file] [log] [blame]
Karl Zhang3de5ab12021-05-31 11:45:48 +08001/*
Mate Toth-Palffba10e2021-09-22 21:38:03 +02002 * Copyright (c) 2019-2022, Arm Limited. All rights reserved.
Karl Zhang3de5ab12021-05-31 11:45:48 +08003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8#include <cstdlib>
9
10#include "class_forwards.hpp"
11
12#include "boilerplate.hpp"
13#include "variables.hpp"
14#include "gibberish.hpp"
15#include "compute.hpp"
16#include "randomization.hpp"
17#include "string_ops.hpp"
18#include "data_blocks.hpp"
19#include "psa_asset.hpp"
20#include "find_or_create_asset.hpp"
21#include "template_line.hpp"
22#include "tf_fuzz.hpp"
23#include "crypto_asset.hpp"
24#include "psa_call.hpp"
25#include "crypto_call.hpp"
26#include "sst_asset.hpp"
27
28
29/**********************************************************************************
30 Methods of class policy_call follow:
31**********************************************************************************/
32
33/* Most of the policy classes, in their fill_in_prep_code() method, need to ensure
34 that, at a minimum, the policy variable (psa_key_attributes_t) exists, so, just
35 to cut down code duplication: */
36void policy_call::policy_fill_in_prep_code (void)
37{
38 vector<variable_info>::iterator policy_variable;
39
40 policy_variable = test_state->find_var (asset_info.get_name());
41 if (policy_variable == test_state->variable.end()) {
42 // No such variable exists, so:
43 test_state->make_var (asset_info.get_name());
44 policy_variable = test_state->find_var (asset_info.get_name());
45 prep_code.assign (test_state->bplate->bplate_string[declare_policy]);
46 find_replace_1st ("$var", asset_info.get_name(), prep_code);
47 }
48}
49
50
51policy_call::policy_call (tf_fuzz_info *test_state, // (constructor)
52 long &call_ser_no,
53 asset_search how_asset_found)
54 : crypto_call(test_state, call_ser_no, how_asset_found)
55{
56 // Note: Key attributes are set in the key_policy_info constructor.
57}
58policy_call::~policy_call (void)
59{
60 // Nothing further to delete.
61 return; // just to have something to pin a breakpoint onto
62}
63
64vector<psa_asset*>::iterator policy_call::resolve_asset (bool create_asset_bool,
65 psa_asset_usage where) {
66 vector<psa_asset*>::iterator found_asset;
67 vector<psa_asset*> *asset_vector;
68 int asset_pick;
69
70 if (random_asset != psa_asset_usage::all) {
71 // != psa_asset_usage::all means to choose some known asset at random:
72 if (random_asset == psa_asset_usage::active) {
73 asset_vector = &(test_state->active_policy_asset);
74 asset_info.how_asset_found = asset_search::found_active;
75 } else if (random_asset == psa_asset_usage::deleted) {
76 asset_vector = &(test_state->deleted_policy_asset);
77 asset_info.how_asset_found = asset_search::found_deleted;
78 } else {
79 // "invalid" assets are not currently used.
80 cerr << "\nError: Tool-internal: Please report error 1102 to " << endl
81 << "TF-Fuzz developers."
82 << endl;
83 exit(1102);
84 }
85 if (asset_vector->size() > 0) {
86 /* Pick an active or deleted asset at random: */
87 asset_pick = rand() % asset_vector->size();
88 found_asset = asset_vector->begin() + asset_pick;
89 /* Copy asset information into template tracker: */
90 asset_info.id_n = (*found_asset)->asset_info.id_n;
91 asset_info.asset_ser_no
92 = (*found_asset)->asset_info.asset_ser_no;
93 } else {
94 if (random_asset == psa_asset_usage::active) {
95 cerr << "\nError: A policy call asks for a "
96 << "randomly chosen active asset, when none " << endl
97 << "is currently defined." << endl;
98 exit(1010);
99 } else if (random_asset == psa_asset_usage::deleted) {
100 cerr << "\nError: A policy call asks for a "
101 << "randomly chosen deleted asset, when none " << endl
102 << "is currently defined." << endl;
103 exit(1011);
104 } // "invalid" assets are not currently used.
105 }
106 } else {
107 // Find the asset by name:
108 asset_info.how_asset_found = test_state->find_or_create_policy_asset (
109 psa_asset_search::name, where,
110 asset_info.get_name(), 0, asset_info.asset_ser_no,
111 create_asset_bool, found_asset );
112 if ( asset_info.how_asset_found == asset_search::unsuccessful
113 || asset_info.how_asset_found == asset_search::something_wrong ) {
114 cerr << "\nError: Tool-internal: Please report error 108 to " << endl
115 << "TF-Fuzz developers."
116 << endl;
117 exit(108);
118 }
119 }
120 return found_asset;
121}
122
123/**********************************************************************************
124 End of methods of class policy_call.
125**********************************************************************************/
126
127
128/**********************************************************************************
129 Methods of class key_call follow:
130**********************************************************************************/
131
132key_call::key_call (tf_fuzz_info *test_state, // (constructor)
133 long &call_ser_no,
134 asset_search how_asset_found)
135 : crypto_call(test_state, call_ser_no, how_asset_found)
136{
137 asset_info.the_asset = nullptr;
138}
139key_call::~key_call (void)
140{
141 // Nothing further to delete.
142 return; // just to have something to pin a breakpoint onto
143}
144
145vector<psa_asset*>::iterator key_call::resolve_asset (bool create_asset_bool,
146 psa_asset_usage where) {
147 vector<psa_asset*>::iterator found_asset;
148 vector<psa_asset*> *asset_vector;
149 int asset_pick;
150
151 if (random_asset != psa_asset_usage::all) {
152 // != psa_asset_usage::all means to choose some known asset at random:
153 if (random_asset == psa_asset_usage::active) {
154 asset_vector = &(test_state->active_key_asset);
155 asset_info.how_asset_found = asset_search::found_active;
156 } else if (random_asset == psa_asset_usage::deleted) {
157 asset_vector = &(test_state->deleted_key_asset);
158 asset_info.how_asset_found = asset_search::found_deleted;
159 } else {
160 // "invalid" assets are not currently used.
161 cerr << "\nError: Tool-internal: Please report error 1103 to " << endl
162 << "TF-Fuzz developers."
163 << endl;
164 exit(1103);
165 }
166 if (asset_vector->size() > 0) {
167 /* Pick an active or deleted asset at random: */
168 asset_pick = rand() % asset_vector->size();
169 found_asset = asset_vector->begin() + asset_pick;
170 /* Copy asset information into template tracker: */
171 asset_info.id_n = (*found_asset)->asset_info.id_n;
172 asset_info.asset_ser_no
173 = (*found_asset)->asset_info.asset_ser_no;
174 } else {
175 if (random_asset == psa_asset_usage::active) {
176 cerr << "\nError: A key call asks for a "
177 << "randomly chosen active asset, when none " << endl
178 << "is currently defined." << endl;
179 exit(1012);
180 } else if (random_asset == psa_asset_usage::deleted) {
181 cerr << "\nError: A key call asks for a "
182 << "randomly chosen deleted asset, when none " << endl
183 << "is currently defined." << endl;
184 exit(1013);
185 } // "invalid" assets are not currently used.
186 }
187 } else {
188 // Find the asset by name:
189 asset_info.how_asset_found = test_state->find_or_create_key_asset (
190 psa_asset_search::name, where,
191 asset_info.get_name(), 0, asset_info.asset_ser_no,
192 create_asset_bool, found_asset );
193 if ( asset_info.how_asset_found == asset_search::unsuccessful
194 || asset_info.how_asset_found == asset_search::something_wrong ) {
195 cerr << "\nError: Tool-internal: Please report error 108 to " << endl
196 << "TF-Fuzz developers."
197 << endl;
198 exit(108);
199 }
200 }
201 return found_asset;
202}
203
204/**********************************************************************************
205 End of methods of class key_call.
206**********************************************************************************/
207
208
209/**********************************************************************************
210 Methods of class init_policy_call follow:
211**********************************************************************************/
212
213init_policy_call::init_policy_call (tf_fuzz_info *test_state, // (constructor)
214 long &call_ser_no,
215 asset_search how_asset_found)
216 : policy_call(test_state, call_ser_no,
217 how_asset_found)
218{
219 // Copy the boilerplate text into local buffers:
220 prep_code.assign ("");
221 call_code.assign (test_state->bplate->bplate_string[init_policy]);
222 call_description = "initialize-policy call";
223}
224init_policy_call::~init_policy_call (void)
225{
226 return; // just to have something to pin a breakpoint onto
227}
228
229bool init_policy_call::copy_call_to_asset (void)
230{
231 return copy_call_to_asset_t<policy_asset*> (this, yes_create_asset);
232}
233
234void init_policy_call::fill_in_prep_code (void)
235{
236 policy_fill_in_prep_code();
237}
238
239void init_policy_call::fill_in_command (void)
240{
241 // (call_code already loaded by constructor)
242 find_replace_all ("$policy", asset_info.get_name(), call_code);
243 // Calculate the expected results:
244 calc_result_code();
245}
246
247/**********************************************************************************
248 End of methods of class init_policy_call.
249**********************************************************************************/
250
251
252/**********************************************************************************
253 Methods of class reset_policy_call follow:
254**********************************************************************************/
255
256reset_policy_call::reset_policy_call (tf_fuzz_info *test_state, // (constructor)
257 long &call_ser_no,
258 asset_search how_asset_found)
259 : policy_call(test_state, call_ser_no,
260 how_asset_found)
261{
262 // Copy the boilerplate text into local buffers:
263 prep_code.assign ("");
264 call_code.assign (test_state->bplate->bplate_string[reset_policy]);
265 call_description = "policy reset call";
266}
267reset_policy_call::~reset_policy_call (void)
268{
269 return; // just to have something to pin a breakpoint onto
270}
271
272bool reset_policy_call::copy_call_to_asset (void)
273{
274 return copy_call_to_asset_t<policy_asset*> (this, yes_create_asset);
275}
276
277void reset_policy_call::fill_in_prep_code (void)
278{
279 policy_fill_in_prep_code();
280}
281
282void reset_policy_call::fill_in_command (void)
283{
284 // (call_code already loaded by constructor)
285 find_replace_all ("$policy", asset_info.get_name(), call_code);
286 // Calculate the expected results:
287 calc_result_code();
288}
289
290/**********************************************************************************
291 End of methods of class reset_policy_call.
292**********************************************************************************/
293
294
295/**********************************************************************************
296 Methods of class add_policy_usage_call follow:
297**********************************************************************************/
298
299add_policy_usage_call::add_policy_usage_call (tf_fuzz_info *test_state, // (constructor)
300 long &call_ser_no,
301 asset_search how_asset_found)
302 : policy_call(test_state, call_ser_no,
303 how_asset_found)
304{
305 // Copy the boilerplate text into local buffers:
306 prep_code.assign ("");
307 call_code.assign (test_state->bplate->bplate_string[add_policy_usage]);
308 call_description = "policy add-usage call";
309}
310add_policy_usage_call::~add_policy_usage_call (void)
311{
312 return; // just to have something to pin a breakpoint onto
313}
314
315bool add_policy_usage_call::copy_call_to_asset (void)
316{
317 return copy_call_to_asset_t<policy_asset*> (this, yes_create_asset);
318}
319
320void add_policy_usage_call::fill_in_prep_code (void)
321{
322 policy_fill_in_prep_code();
323 /* TODO: The variable this creates should have been declared already. Should
324 this instead produce an error if it doesn't exist? */
325}
326
327void add_policy_usage_call::fill_in_command (void)
328{
329 // (call_code already loaded by constructor)
330 find_replace_all ("$policy", asset_info.get_name(), call_code);
331 find_replace_1st ("$flag", policy.usage_string, call_code);
332 // Calculate the expected results:
333 calc_result_code();
334}
335
336/**********************************************************************************
337 End of methods of class add_policy_usage_call.
338**********************************************************************************/
339
340
341/**********************************************************************************
342 Methods of class set_policy_lifetime_call follow:
343**********************************************************************************/
344
345set_policy_lifetime_call::set_policy_lifetime_call (tf_fuzz_info *test_state,
346 long &call_ser_no, // (constructor)
347 asset_search how_asset_found)
348 : policy_call(test_state, call_ser_no,
349 how_asset_found)
350{
351 // Copy the boilerplate text into local buffers:
352 prep_code.assign ("");
353 call_code.assign (test_state->bplate->bplate_string[set_policy_lifetime]);
354 call_description = "policy lifetime-set call";
355}
356set_policy_lifetime_call::~set_policy_lifetime_call (void)
357{
358 return; // just to have something to pin a breakpoint onto
359}
360
361bool set_policy_lifetime_call::copy_call_to_asset (void)
362{
363 return copy_call_to_asset_t<policy_asset*> (this, yes_create_asset);
364}
365
366void set_policy_lifetime_call::fill_in_prep_code (void)
367{
368 policy_fill_in_prep_code();
369}
370
371void set_policy_lifetime_call::fill_in_command (void)
372{
373 // (call_code already loaded by constructor)
374 find_replace_all ("$policy", asset_info.get_name(), call_code);
375 find_replace_1st ("$life",
376 policy.persistent? "PSA_KEY_LIFETIME_PERSISTENT"
377 : "PSA_KEY_LIFETIME_VOLATILE",
378 call_code);
379 // Calculate the expected results:
380 calc_result_code();
381}
382
383/**********************************************************************************
384 End of methods of class set_policy_lifetime_call.
385**********************************************************************************/
386
387
388/**********************************************************************************
389 Methods of class set_policy_size_call follow:
390**********************************************************************************/
391
392set_policy_size_call::set_policy_size_call (tf_fuzz_info *test_state, // (constructor)
393 long &call_ser_no,
394 asset_search how_asset_found)
395 : policy_call(test_state, call_ser_no,
396 how_asset_found)
397{
398 // Copy the boilerplate text into local buffers:
399 prep_code.assign ("");
400 call_code.assign (test_state->bplate->bplate_string[set_policy_size]);
401 call_description = "policy size-set call";
402}
403set_policy_size_call::~set_policy_size_call (void)
404{
405 return; // just to have something to pin a breakpoint onto
406}
407
408bool set_policy_size_call::copy_call_to_asset (void)
409{
410 return copy_call_to_asset_t<policy_asset*> (this, yes_create_asset);
411}
412
413void set_policy_size_call::fill_in_prep_code (void)
414{
415 policy_fill_in_prep_code();
416}
417
418void set_policy_size_call::fill_in_command (void)
419{
420 // (call_code already loaded by constructor)
421 find_replace_all ("$policy", asset_info.get_name(), call_code);
422 find_replace_1st ("$size", to_string (policy.n_bits), call_code);
423 // Calculate the expected results:
424 calc_result_code();
425}
426
427/**********************************************************************************
428 End of methods of class set_policy_size_call.
429**********************************************************************************/
430
431
432/**********************************************************************************
433 Methods of class set_policy_type_call follow:
434**********************************************************************************/
435
436set_policy_type_call::set_policy_type_call (tf_fuzz_info *test_state, // (constructor)
437 long &call_ser_no,
438 asset_search how_asset_found)
439 : policy_call(test_state, call_ser_no,
440 how_asset_found)
441{
442 // Copy the boilerplate text into local buffers:
443 prep_code.assign ("");
444 call_code.assign (test_state->bplate->bplate_string[set_policy_type]);
445 call_description = "policy type-set call";
446}
447set_policy_type_call::~set_policy_type_call (void)
448{
449 return; // just to have something to pin a breakpoint onto
450}
451
452bool set_policy_type_call::copy_call_to_asset (void)
453{
454 return copy_call_to_asset_t<policy_asset*> (this, yes_create_asset);
455}
456
457void set_policy_type_call::fill_in_prep_code (void)
458{
459 policy_fill_in_prep_code();
460}
461
462void set_policy_type_call::fill_in_command (void)
463{
464 // (call_code already loaded by constructor)
465 find_replace_all ("$policy", asset_info.get_name(), call_code);
466 find_replace_1st ("$type", policy.key_type, call_code);
467 // Calculate the expected results:
468 calc_result_code();
469}
470
471/**********************************************************************************
472 End of methods of class set_policy_type_call.
473**********************************************************************************/
474
475
476/**********************************************************************************
477 Methods of class set_policy_algorithm_call follow:
478**********************************************************************************/
479
480set_policy_algorithm_call::set_policy_algorithm_call (tf_fuzz_info *test_state,
481 long &call_ser_no, // (constructor)
482 asset_search how_asset_found)
483 : policy_call(test_state, call_ser_no,
484 how_asset_found)
485{
486 // Copy the boilerplate text into local buffers:
487 prep_code.assign ("");
488 call_code.assign (test_state->bplate->bplate_string[set_policy_algorithm]);
489 call_description = "policy algorithm-set call";
490}
491set_policy_algorithm_call::~set_policy_algorithm_call (void)
492{
493 return; // just to have something to pin a breakpoint onto
494}
495
496bool set_policy_algorithm_call::copy_call_to_asset (void)
497{
498 return copy_call_to_asset_t<policy_asset*> (this, yes_create_asset);
499}
500
501void set_policy_algorithm_call::fill_in_prep_code (void)
502{
503 policy_fill_in_prep_code();
504}
505
506void set_policy_algorithm_call::fill_in_command (void)
507{
508 // (call_code already loaded by constructor)
509 find_replace_all ("$policy", asset_info.get_name(), call_code);
510 find_replace_1st ("$algorithm", policy.key_algorithm, call_code);
511 // Calculate the expected results:
512 calc_result_code();
513}
514
515/**********************************************************************************
516 End of methods of class set_policy_algorithm_call.
517**********************************************************************************/
518
519
520/**********************************************************************************
521 Methods of class set_policy_usage_call follow:
522**********************************************************************************/
523
524set_policy_usage_call::set_policy_usage_call (tf_fuzz_info *test_state, // (constructor)
525 long &call_ser_no,
526 asset_search how_asset_found)
527 : policy_call(test_state, call_ser_no,
528 how_asset_found)
529{
530 // Copy the boilerplate text into local buffers:
531 prep_code.assign ("");
532 call_code.assign (test_state->bplate->bplate_string[set_policy_usage]);
533 call_description = "policy usage-set call";
534}
535set_policy_usage_call::~set_policy_usage_call (void)
536{
537 return; // just to have something to pin a breakpoint onto
538}
539
540bool set_policy_usage_call::copy_call_to_asset (void)
541{
542 return copy_call_to_asset_t<policy_asset*> (this, yes_create_asset);
543}
544
545void set_policy_usage_call::fill_in_prep_code (void)
546{
547 policy_fill_in_prep_code();
548}
549
550void set_policy_usage_call::fill_in_command (void)
551{
552 find_replace_1st ("$policy", asset_info.get_name(), call_code);
553 find_replace_1st ("$usage", "0", call_code);
554 // Calculate the expected results:
555 calc_result_code();
556}
557
558/**********************************************************************************
559 End of methods of class set_policy_usage_call.
560**********************************************************************************/
561
562
563/**********************************************************************************
564 Methods of class get_policy_lifetime_call follow:
565**********************************************************************************/
566
567get_policy_lifetime_call::get_policy_lifetime_call (tf_fuzz_info *test_state,
568 long &call_ser_no, // (constructor)
569 asset_search how_asset_found)
570 : policy_call(test_state, call_ser_no,
571 how_asset_found)
572{
573 // Copy the boilerplate text into local buffers:
574 prep_code.assign ("");
575 call_code.assign (test_state->bplate->bplate_string[get_policy_lifetime]);
576 call_description = "policy lifetime-get call";
577}
578get_policy_lifetime_call::~get_policy_lifetime_call (void)
579{
580 return; // just to have something to pin a breakpoint onto
581}
582
583bool get_policy_lifetime_call::copy_call_to_asset (void)
584{
585 return copy_call_to_asset_t<policy_asset*> (this, dont_create_asset);
586}
587
588void get_policy_lifetime_call::fill_in_prep_code (void)
589{
590 string var_name = asset_info.get_name() + "_life";
591 vector<variable_info>::iterator assign_variable;
592
593 policy_fill_in_prep_code(); // make sure the policy variable itself is defined
594 assign_variable = test_state->find_var (var_name);
595 if (assign_variable == test_state->variable.end()) {
596 // No such variable exists, so:
597 test_state->make_var (var_name);
598 prep_code.append (test_state->bplate->bplate_string[declare_policy_lifetime]);
599 find_replace_all ("$var", var_name, prep_code);
600 }
601}
602
603void get_policy_lifetime_call::fill_in_command (void)
604{
605 // (call_code already loaded by constructor)
606 find_replace_all ("$policy", asset_info.get_name(), call_code);
607 find_replace_1st ("$life", asset_info.get_name() + "_life", call_code);
608 // Calculate the expected results:
609 calc_result_code();
610}
611
612/**********************************************************************************
613 End of methods of class get_policy_lifetime_call.
614**********************************************************************************/
615
616
617/**********************************************************************************
618 Methods of class get_policy_size_call follow:
619**********************************************************************************/
620
621get_policy_size_call::get_policy_size_call (tf_fuzz_info *test_state,
622 long &call_ser_no, // (constructor)
623 asset_search how_asset_found)
624 : policy_call(test_state, call_ser_no,
625 how_asset_found)
626{
627 // Copy the boilerplate text into local buffers:
628 prep_code.assign ("");
629 call_code.assign (test_state->bplate->bplate_string[get_policy_size]);
630 call_description = "policy size-get call";
631}
632get_policy_size_call::~get_policy_size_call (void)
633{
634 return; // just to have something to pin a breakpoint onto
635}
636
637bool get_policy_size_call::copy_call_to_asset (void)
638{
639 return copy_call_to_asset_t<policy_asset*> (this, dont_create_asset);
640}
641
642void get_policy_size_call::fill_in_prep_code (void)
643{
644 string var_name = asset_info.get_name() + "_size";
645 vector<variable_info>::iterator assign_variable;
646
647 policy_fill_in_prep_code(); // make sure the policy variable itself is defined
648 assign_variable = test_state->find_var (var_name);
649 if (assign_variable == test_state->variable.end()) {
650 // No such variable exists, so:
651 test_state->make_var (var_name);
652 prep_code.append (test_state->bplate->bplate_string[declare_size_t]);
653 find_replace_all ("$var", var_name, prep_code);
654 find_replace_1st ("$init", to_string(exp_data.data.length()), prep_code);
655 }
656}
657
658void get_policy_size_call::fill_in_command (void)
659{
660 // (call_code already loaded by constructor)
661 find_replace_all ("$policy", asset_info.get_name(), call_code);
662 find_replace_1st ("$size", asset_info.get_name() + "_size", call_code);
663 // Calculate the expected results:
664 calc_result_code();
665}
666
667/**********************************************************************************
668 End of methods of class get_policy_size_call.
669**********************************************************************************/
670
671
672/**********************************************************************************
673 Methods of class get_policy_type_call follow:
674**********************************************************************************/
675
676get_policy_type_call::get_policy_type_call (tf_fuzz_info *test_state,
677 long &call_ser_no, // (constructor)
678 asset_search how_asset_found)
679 : policy_call(test_state, call_ser_no,
680 how_asset_found)
681{
682 // Copy the boilerplate text into local buffers:
683 prep_code.assign ("");
684 call_code.assign (test_state->bplate->bplate_string[get_policy_type]);
685 call_description = "policy type-get call";
686}
687get_policy_type_call::~get_policy_type_call (void)
688{
689 return; // just to have something to pin a breakpoint onto
690}
691
692bool get_policy_type_call::copy_call_to_asset (void)
693{
694 return copy_call_to_asset_t<policy_asset*> (this, dont_create_asset);
695}
696
697void get_policy_type_call::fill_in_prep_code (void)
698{
699 string var_name = asset_info.get_name() + "_type";
700 vector<variable_info>::iterator assign_variable;
701
702 policy_fill_in_prep_code(); // make sure the policy variable itself is defined
703 assign_variable = test_state->find_var (var_name);
704 if (assign_variable == test_state->variable.end()) {
705 // No such variable exists, so:
706 test_state->make_var (var_name);
707 prep_code.append (test_state->bplate->bplate_string[declare_policy_type]);
708 find_replace_all ("$var", var_name, prep_code);
709 }
710}
711
712void get_policy_type_call::fill_in_command (void)
713{
714 // (call_code already loaded by constructor)
715 find_replace_all ("$policy", asset_info.get_name(), call_code);
716 find_replace_1st ("$type", asset_info.get_name() + "_type", call_code);
717 // Calculate the expected results:
718 calc_result_code();
719}
720
721/**********************************************************************************
722 End of methods of class get_policy_type_call.
723**********************************************************************************/
724
725
726/**********************************************************************************
727 Methods of class get_policy_algorithm_call follow:
728**********************************************************************************/
729
730get_policy_algorithm_call::get_policy_algorithm_call (tf_fuzz_info *test_state,
731 long &call_ser_no, // (constructor)
732 asset_search how_asset_found)
733 : policy_call(test_state, call_ser_no,
734 how_asset_found)
735{
736 // Copy the boilerplate text into local buffers:
737 prep_code.assign ("");
738 call_code.assign (test_state->bplate->bplate_string[get_policy_algorithm]);
739 call_description = "policy algorithm-get call";
740}
741get_policy_algorithm_call::~get_policy_algorithm_call (void)
742{
743 return; // just to have something to pin a breakpoint onto
744}
745
746bool get_policy_algorithm_call::copy_call_to_asset (void)
747{
748 return copy_call_to_asset_t<policy_asset*> (this, dont_create_asset);
749}
750
751void get_policy_algorithm_call::fill_in_prep_code (void)
752{
753 string var_name = asset_info.get_name() + "_algo";
754 vector<variable_info>::iterator assign_variable;
755
756 policy_fill_in_prep_code(); // make sure the policy variable itself is defined
757 assign_variable = test_state->find_var (var_name);
758 if (assign_variable == test_state->variable.end()) {
759 // No such variable exists, so:
760 test_state->make_var (var_name);
761 prep_code.append (test_state->bplate->bplate_string[declare_policy_algorithm]);
762 find_replace_all ("$var", var_name, prep_code);
763 }
764}
765
766void get_policy_algorithm_call::fill_in_command (void)
767{
768 // (call_code already loaded by constructor)
769 find_replace_all ("$policy", asset_info.get_name(), call_code);
770 find_replace_1st ("$algorithm", asset_info.get_name() + "_algo", call_code);
771 // Calculate the expected results:
772 calc_result_code();
773}
774
775/**********************************************************************************
776 End of methods of class get_policy_algorithm_call.
777**********************************************************************************/
778
779
780/**********************************************************************************
781 Methods of class get_policy_usage_call follow:
782**********************************************************************************/
783
784get_policy_usage_call::get_policy_usage_call (tf_fuzz_info *test_state,
785 long &call_ser_no, // (constructor)
786 asset_search how_asset_found)
787 : policy_call(test_state, call_ser_no,
788 how_asset_found)
789{
790 // Copy the boilerplate text into local buffers:
791 prep_code.assign ("");
792 call_code.assign (test_state->bplate->bplate_string[get_policy_usage]);
793 call_description = "policy usage-get call";
794}
795get_policy_usage_call::~get_policy_usage_call (void)
796{
797 return; // just to have something to pin a breakpoint onto
798}
799
800bool get_policy_usage_call::copy_call_to_asset (void)
801{
802 return copy_call_to_asset_t<policy_asset*> (this, dont_create_asset);
803}
804
805void get_policy_usage_call::fill_in_prep_code (void)
806{
807 string var_name = asset_info.get_name() + "_usage";
808 vector<variable_info>::iterator assign_variable;
809
810 policy_fill_in_prep_code(); // make sure the policy variable itself is defined
811 assign_variable = test_state->find_var (var_name);
812 if (assign_variable == test_state->variable.end()) {
813 // No such variable exists, so:
814 test_state->make_var (var_name);
815 prep_code.append (test_state->bplate->bplate_string[declare_policy_usage]);
816 find_replace_all ("$var", var_name, prep_code);
817 }
818}
819
820void get_policy_usage_call::fill_in_command (void)
821{
822 // (call_code already loaded by constructor)
823 find_replace_all ("$policy", asset_info.get_name(), call_code);
824 find_replace_1st ("$usage", asset_info.get_name() + "_usage", call_code);
825 // Calculate the expected results:
826 calc_result_code();
827}
828
829/**********************************************************************************
830 End of methods of class get_policy_usage_call.
831**********************************************************************************/
832
833
834/**********************************************************************************
835 Methods of class print_policy_usage_call follow:
836**********************************************************************************/
837
838print_policy_usage_call::print_policy_usage_call (tf_fuzz_info *test_state,
839 long &call_ser_no, // (constructor)
840 asset_search how_asset_found)
841 : policy_call(test_state, call_ser_no,
842 how_asset_found)
843{
844 // Copy the boilerplate text into local buffers:
845 prep_code.assign ("");
846 call_code.assign (test_state->bplate->bplate_string[print_policy_usage]);
847 call_description = "policy usage-print call";
848}
849print_policy_usage_call::~print_policy_usage_call (void)
850{
851 return; // just to have something to pin a breakpoint onto
852}
853
854bool print_policy_usage_call::copy_call_to_asset (void)
855{
856 return copy_call_to_asset_t<policy_asset*> (this, dont_create_asset);
857}
858
859void print_policy_usage_call::fill_in_prep_code (void)
860{
861 string var_name = asset_info.get_name() + "_usage";
862 vector<variable_info>::iterator assign_variable;
863
864 policy_fill_in_prep_code(); // make sure the policy variable itself is defined
865 // Make sure policy-usage variable is defined:
866 assign_variable = test_state->find_var (var_name);
867 if (assign_variable == test_state->variable.end()) {
868 // No such variable exists, so:
869 test_state->make_var (var_name);
870 prep_code.append (test_state->bplate->bplate_string[declare_policy_usage]);
871 find_replace_all ("$var", var_name, prep_code);
872 }
873}
874
875void print_policy_usage_call::fill_in_command (void)
876{
877 string var_name = asset_info.get_name() + "_usage";
878
879 // (call_code already loaded by constructor)
880 find_replace_all ("$policy", asset_info.get_name(), call_code);
881 find_replace_1st ("$usage_string", policy.usage_string, call_code);
882 find_replace_1st ("$usage", var_name, call_code);
883 find_replace_1st ("$print_usage_true_string", policy.print_usage_true_string,
884 call_code);
885 find_replace_1st ("$print_usage_false_string", policy.print_usage_false_string,
886 call_code);
887 // Calculate the expected results:
888 calc_result_code();
889}
890
891/**********************************************************************************
892 End of methods of class print_policy_usage_call.
893**********************************************************************************/
894
895
896/**********************************************************************************
897 Methods of class get_key_policy_call follow:
898**********************************************************************************/
899
900get_key_policy_call::get_key_policy_call (tf_fuzz_info *test_state, // (constructor)
901 long &call_ser_no,
902 asset_search how_asset_found)
903 : policy_call(test_state, call_ser_no,
904 how_asset_found)
905{
906 // Copy the boilerplate text into local buffers:
907 prep_code.assign ("");
908 call_code.assign (test_state->bplate->bplate_string[get_policy]);
909 check_code.assign (test_state->bplate->bplate_string[get_policy_check]);
910 call_description = "policy get call";
911}
912get_key_policy_call::~get_key_policy_call (void)
913{
914 return; // just to have something to pin a breakpoint onto
915}
916
917bool get_key_policy_call::copy_call_to_asset (void)
918{
919 return copy_call_to_asset_t<key_asset*> (this, dont_create_asset);
920}
921
922void get_key_policy_call::fill_in_prep_code (void)
923{
924 // No prep code required.
925 return; // just to have something to pin a breakpoint onto
926}
927
928void get_key_policy_call::fill_in_command (void)
929{
930 // (call_code already loaded by constructor)
931 find_replace_all ("key", asset_info.get_name(), call_code);
932 find_replace_all ("$policy", policy.asset_2_name, call_code);
933 // Calculate the expected results:
934 calc_result_code();
935}
936
937/**********************************************************************************
938 End of methods of class get_key_policy_call.
939**********************************************************************************/
940
941
942/**********************************************************************************
943 Methods of class generate_key_call follow:
944**********************************************************************************/
945
946generate_key_call::generate_key_call (tf_fuzz_info *test_state, // (constructor)
947 long &call_ser_no,
948 asset_search how_asset_found)
949 : key_call(test_state, call_ser_no,
950 how_asset_found)
951{
952 // Copy the boilerplate text into local buffers:
953 prep_code.assign ("");
954 call_code.assign (test_state->bplate->bplate_string[generate_key]);
955 check_code.assign (test_state->bplate->bplate_string[generate_key_check]);
956 call_description = "key-generate call";
957}
958generate_key_call::~generate_key_call (void)
959{
960 return; // just to have something to pin a breakpoint onto
961}
962
963bool generate_key_call::copy_call_to_asset (void)
964{
965 return copy_call_to_asset_t<key_asset*> (this, yes_create_asset);
966}
967
968void generate_key_call::fill_in_prep_code (void)
969{
970 string var_name = asset_info.get_name();
971 vector<variable_info>::iterator assign_variable;
972
973 // Make sure key variable is defined:
974 assign_variable = test_state->find_var (var_name);
975 if (assign_variable == test_state->variable.end()) {
976 // No such variable exists, so:
977 test_state->make_var (var_name);
978 prep_code.append (test_state->bplate->bplate_string[declare_key]);
979 find_replace_all ("$var", var_name, prep_code);
980 }
981}
982
983void generate_key_call::fill_in_command (void)
984{
985 // (call_code already loaded by constructor)
986 find_replace_all ("$policy", policy.asset_2_name, call_code);
987 find_replace_all ("$key", asset_info.get_name(), call_code);
988 // Calculate the expected results:
989 calc_result_code();
990}
991
992/**********************************************************************************
993 End of methods of class generate_key_call.
994**********************************************************************************/
995
996
997/**********************************************************************************
998 Methods of class create_key_call follow:
999**********************************************************************************/
1000
1001create_key_call::create_key_call (tf_fuzz_info *test_state, // (constructor)
1002 long &call_ser_no,
1003 asset_search how_asset_found)
1004 : key_call(test_state, call_ser_no,
1005 how_asset_found)
1006{
1007 // Copy the boilerplate text into local buffers:
1008 prep_code.assign ("");
1009 call_code.assign (test_state->bplate->bplate_string[create_key]);
1010 check_code.assign (test_state->bplate->bplate_string[create_key_check]);
1011 call_description = "key-create call";
1012}
1013create_key_call::~create_key_call (void)
1014{
1015 return; // just to have something to pin a breakpoint onto
1016}
1017
1018bool create_key_call::copy_call_to_asset (void)
1019{
1020 return copy_call_to_asset_t<key_asset*> (this, yes_create_asset);
1021}
1022
1023void create_key_call::fill_in_prep_code (void)
1024{
1025 string var_name = asset_info.get_name();
1026 vector<variable_info>::iterator assign_variable;
1027 gibberish gib;
1028 char gib_buff[500];
1029 string t_string;
1030
1031 // Key variable:
1032 assign_variable = test_state->find_var (var_name);
1033 if (assign_variable == test_state->variable.end()) {
1034 // No such variable exists, so:
1035 test_state->make_var (var_name);
1036 prep_code.append (test_state->bplate->bplate_string[declare_key]);
1037 find_replace_all ("$var", var_name, prep_code);
1038 }
1039 // Key-data variable:
1040 var_name = asset_info.get_name() + "_set_data";
1041 assign_variable = test_state->find_var (var_name);
1042 if (assign_variable == test_state->variable.end()) {
1043 // No such variable exists, so:
1044 test_state->make_var (var_name);
1045 prep_code.append (test_state->bplate->bplate_string[declare_big_string]);
1046 find_replace_all ("$var", var_name, prep_code);
1047 int rand_data_length = 12 + (rand() % 100);
1048 gib.sentence (gib_buff, gib_buff + rand_data_length - 1);
1049 t_string = gib_buff;
1050 find_replace_all ("$init", t_string, prep_code);
1051 }
1052}
1053
1054void create_key_call::fill_in_command (void)
1055{
1056 // (call_code already loaded by constructor)
1057 find_replace_all ("$policy", policy.asset_2_name, call_code);
1058 find_replace_all ("$data", asset_info.get_name() + "_set_data", call_code);
1059 find_replace_all ("$length", to_string (policy.n_bits), call_code);
1060 find_replace_all ("$key", asset_info.get_name(), call_code);
1061 // Calculate the expected results:
1062 calc_result_code();
1063}
1064
1065/**********************************************************************************
1066 End of methods of class create_key_call.
1067**********************************************************************************/
1068
1069
1070/**********************************************************************************
1071 Methods of class copy_key_call follow:
1072**********************************************************************************/
1073
1074copy_key_call::copy_key_call (tf_fuzz_info *test_state, // (constructor)
1075 long &call_ser_no,
1076 asset_search how_asset_found)
1077 : key_call(test_state, call_ser_no,
1078 how_asset_found)
1079{
1080 // Copy the boilerplate text into local buffers:
1081 prep_code.assign ("");
1082 call_code.assign (test_state->bplate->bplate_string[copy_key]);
1083 check_code.assign (test_state->bplate->bplate_string[copy_key_check]);
1084 call_description = "key-copy call";
1085}
1086copy_key_call::~copy_key_call (void)
1087{
1088 return; // just to have something to pin a breakpoint onto
1089}
1090
1091bool copy_key_call::copy_call_to_asset (void)
1092{
1093 return copy_call_to_asset_t<key_asset*> (this, yes_create_asset);
1094}
1095
1096void copy_key_call::fill_in_prep_code (void)
1097{
1098 string var_name = asset_info.get_name();
1099 vector<variable_info>::iterator assign_variable;
1100
1101 // Make sure key variable is defined:
1102 assign_variable = test_state->find_var (var_name);
1103 if (assign_variable == test_state->variable.end()) {
1104 // No such variable exists, so:
1105 test_state->make_var (var_name);
1106 prep_code.append (test_state->bplate->bplate_string[declare_key]);
1107 find_replace_all ("$var", var_name, prep_code);
1108 }
1109}
1110
1111void copy_key_call::fill_in_command (void)
1112{
Mate Toth-Palffba10e2021-09-22 21:38:03 +02001113 // (call_code already loaded by constructor)
1114 find_replace_all ("$master", policy.asset_3_name, call_code);
1115 find_replace_all ("$policy", policy.asset_2_name, call_code);
1116 find_replace_all ("$copy", asset_info.get_name(), call_code);
Karl Zhang3de5ab12021-05-31 11:45:48 +08001117
1118 // Calculate the expected results:
1119 asset_search find_result;
1120 vector<psa_asset*>::iterator asset;
1121 long dummy = 0L;
1122 // See if the source key does not exist:
Mate Toth-Palffba10e2021-09-22 21:38:03 +02001123 find_result = test_state->
1124 find_or_create_key_asset (psa_asset_search::name, psa_asset_usage::active,
1125 policy.asset_3_name, (uint64_t) 0, dummy,
1126 dont_create_asset, asset);
Karl Zhang3de5ab12021-05-31 11:45:48 +08001127 if (find_result != asset_search::found_active) {
1128 exp_data.pf_specified = true;
1129 exp_data.pf_result_string = "PSA_ERROR_INVALID_ARGUMENT";
1130 // TODO: Pull this in from boilerplate file
1131 } else {
1132 // See if the new policy does not exist:
1133 find_result = test_state->
1134 find_or_create_policy_asset (psa_asset_search::name, psa_asset_usage::active,
1135 policy.asset_2_name, (uint64_t) 0, dummy,
1136 dont_create_asset, asset);
1137 if (find_result != asset_search::found_active) {
1138 exp_data.pf_specified = true;
1139 exp_data.pf_result_string = "PSA_ERROR_INVALID_ARGUMENT";
1140 // TODO: Pull this in from boilerplate file
1141 } else if (!(*asset)->policy.copyable) {
1142 // See if the source key does not support export:
1143 // TODO: Or wait, it's the original policy for the key, right?
1144 exp_data.pf_specified = true;
1145 exp_data.pf_result_string = "PSA_ERROR_NOT_PERMITTED";
1146 }
1147 }
Karl Zhang3de5ab12021-05-31 11:45:48 +08001148 calc_result_code();
1149}
1150
1151/**********************************************************************************
1152 End of methods of class copy_key_call.
1153**********************************************************************************/
1154
1155
1156/**********************************************************************************
1157 Methods of class read_key_data_call follow:
1158**********************************************************************************/
1159
1160read_key_data_call::read_key_data_call (tf_fuzz_info *test_state, // (constructor)
1161 long &call_ser_no,
1162 asset_search how_asset_found)
1163 : key_call(test_state, call_ser_no,
1164 how_asset_found)
1165{
1166 // Copy the boilerplate text into local buffers:
1167 prep_code.assign ("");
1168 call_code.assign (test_state->bplate->bplate_string[read_key_data]);
1169 check_code.assign (test_state->bplate->bplate_string[read_key_data_check]);
1170 call_description = "key read-data call";
1171}
1172read_key_data_call::~read_key_data_call (void)
1173{
1174 return; // just to have something to pin a breakpoint onto
1175}
1176
1177bool read_key_data_call::copy_call_to_asset (void)
1178{
1179 return copy_call_to_asset_t<key_asset*> (this, dont_create_asset);
1180}
1181
1182void read_key_data_call::fill_in_prep_code (void)
1183{
1184 string var_name, length_var_name, actual_length_var_name, var_name_suffix,
1185 length_var_name_suffix, temp_string;
1186 vector<variable_info>::iterator expect_variable;
1187 vector<variable_info>::iterator assign_variable;
1188
1189 if (exp_data.data_var_specified) {
1190 var_name.assign (exp_data.data_var + "_data");
1191 length_var_name.assign (exp_data.data_var + "_length");
1192 /* If actual-data variable doesn't already exist, create variable tracker,
1193 and write declaration for it: */
1194 expect_variable = test_state->find_var (exp_data.data_var);
1195 if (expect_variable == test_state->variable.end()) {
1196 // No such variable exists, so:
1197 test_state->make_var (exp_data.data_var);
1198 expect_variable = test_state->find_var (exp_data.data_var);
1199 prep_code.append (test_state->bplate->bplate_string[declare_big_string]);
1200 find_replace_1st ("$var", var_name, prep_code);
1201 temp_string = (char *) expect_variable->value;
1202 find_replace_1st ("$init", temp_string, prep_code);
1203 // Input data length:
1204 prep_code.append (test_state->bplate->bplate_string[declare_size_t]);
1205 find_replace_1st ("$var", length_var_name, prep_code);
1206 find_replace_1st ("$init", to_string(temp_string.length()), prep_code);
1207 // TODO: Is these lengths in bits or bytes?
Mate Toth-Palffba10e2021-09-22 21:38:03 +02001208 // Actual (output) data length:
1209 actual_length_var_name.assign (exp_data.data_var + "_act_length");
1210 prep_code.append (test_state->bplate->bplate_string[declare_size_t]);
1211 find_replace_1st ("$var", actual_length_var_name, prep_code);
1212 find_replace_1st ("$init", to_string(temp_string.length()), prep_code);
Karl Zhang3de5ab12021-05-31 11:45:48 +08001213 }
1214 }
Karl Zhang3de5ab12021-05-31 11:45:48 +08001215 if (assign_data_var_specified) {
1216 var_name.assign (assign_data_var + "_data");
1217 length_var_name.assign (assign_data_var + "_length");
1218 actual_length_var_name.assign (assign_data_var + "_act_length");
1219 /* If actual-data variable doesn't already exist, create variable tracker,
1220 and write declaration for it: */
1221 assign_variable = test_state->find_var (assign_data_var);
1222 if (assign_variable == test_state->variable.end()) {
1223 // No such variable exists, so:
1224 test_state->make_var (assign_data_var);
1225 assign_variable = test_state->find_var (assign_data_var);
1226 prep_code.append (test_state->bplate->bplate_string[declare_big_string]);
1227 find_replace_1st ("$var", var_name, prep_code);
1228 temp_string = (char *) assign_variable->value;
1229 find_replace_1st ("$init", temp_string, prep_code);
1230 // Input data length:
1231 prep_code.append (test_state->bplate->bplate_string[declare_size_t]);
1232 find_replace_1st ("$var", length_var_name, prep_code);
1233 find_replace_1st ("$init", to_string(temp_string.length()), prep_code);
Mate Toth-Palffba10e2021-09-22 21:38:03 +02001234 // Actual (output) data length:
1235 prep_code.append (test_state->bplate->bplate_string[declare_size_t]);
1236 find_replace_1st ("$var", actual_length_var_name, prep_code);
1237 find_replace_1st ("$init", to_string(temp_string.length()), prep_code);
Karl Zhang3de5ab12021-05-31 11:45:48 +08001238 }
1239 } else {
Mate Toth-Palffba10e2021-09-22 21:38:03 +02001240 // Single string of two lines declaring string data and its length:
1241 var_name_suffix = "_set_data";
1242 length_var_name_suffix = "_set_length";
1243 if (set_data.n_set_vars > 0) {
1244 var_name_suffix += "_" + to_string(set_data.n_set_vars);
1245 length_var_name_suffix += "_" + to_string(set_data.n_set_vars);
1246 }
1247 var_name.assign (asset_info.get_name() + var_name_suffix);
1248 length_var_name.assign (asset_info.get_name() + length_var_name_suffix);
Karl Zhang3de5ab12021-05-31 11:45:48 +08001249 prep_code.append (test_state->bplate->bplate_string[declare_string]);
1250 find_replace_1st ("$var", var_name, prep_code);
1251 find_replace_1st ("$init", set_data.get(), prep_code);
Mate Toth-Palffba10e2021-09-22 21:38:03 +02001252 temp_string.assign (test_state->bplate->bplate_string[declare_int]);
1253 find_replace_1st ("static int", "static uint32_t", temp_string);
1254 prep_code.append (temp_string);
1255 find_replace_1st ("$var", length_var_name, prep_code);
Karl Zhang3de5ab12021-05-31 11:45:48 +08001256 find_replace_1st ("$init", to_string(set_data.get().length()), prep_code);
1257 }
Karl Zhang3de5ab12021-05-31 11:45:48 +08001258}
1259
1260void read_key_data_call::fill_in_command (void)
1261{
Mate Toth-Palffba10e2021-09-22 21:38:03 +02001262 string var_name, length_var_name, actual_length_var_name, var_name_suffix,
1263 length_var_name_suffix, temp_string;
Karl Zhang3de5ab12021-05-31 11:45:48 +08001264
1265 // Fill in the PSA command itself:
Mate Toth-Palffba10e2021-09-22 21:38:03 +02001266 if (exp_data.data_var_specified) {
1267 var_name.assign (exp_data.data_var + "_data");
1268 actual_length_var_name.assign (exp_data.data_var + "_act_length");
1269 } else {
1270 actual_length_var_name.assign (assign_data_var + "_act_length");
1271 }
Karl Zhang3de5ab12021-05-31 11:45:48 +08001272 if (assign_data_var_specified) {
1273 var_name.assign (assign_data_var + "_data");
1274 length_var_name.assign (assign_data_var + "_length");
1275 } else {
Mate Toth-Palffba10e2021-09-22 21:38:03 +02001276 var_name_suffix = "_set_data";
1277 if (set_data.n_set_vars > 0) {
1278 var_name_suffix += "_" + to_string(set_data.n_set_vars);
1279 }
Karl Zhang3de5ab12021-05-31 11:45:48 +08001280 var_name.assign (asset_info.get_name() + var_name_suffix);
Mate Toth-Palffba10e2021-09-22 21:38:03 +02001281 length_var_name_suffix = "_set_length";
1282 if (set_data.n_set_vars > 0) {
1283 length_var_name_suffix += "_" + to_string(set_data.n_set_vars);
1284 }
Karl Zhang3de5ab12021-05-31 11:45:48 +08001285 length_var_name.assign (asset_info.get_name() + length_var_name_suffix);
1286 }
1287 find_replace_1st ("$data", var_name, call_code);
1288 find_replace_1st ("$key", asset_info.get_name(), call_code);
1289 string id_string = to_string((long) asset_info.id_n++);
Karl Zhang3de5ab12021-05-31 11:45:48 +08001290 find_replace_1st ("$act_size", actual_length_var_name, call_code);
Mate Toth-Palffba10e2021-09-22 21:38:03 +02001291 find_replace_1st ("$length", length_var_name, call_code);
Karl Zhang3de5ab12021-05-31 11:45:48 +08001292
Mate Toth-Palffba10e2021-09-22 21:38:03 +02001293 // TODO: check data?
Karl Zhang3de5ab12021-05-31 11:45:48 +08001294
1295 // See if the source key did not exist:
1296 if (!policy.exportable) {
1297 // See if the source key does not support export:
1298 exp_data.pf_specified = true;
1299 exp_data.pf_result_string = "PSA_ERROR_NOT_PERMITTED";
1300 }
1301 calc_result_code();
1302}
1303
1304/**********************************************************************************
1305 End of methods of class read_key_data_call.
1306**********************************************************************************/
1307
1308
1309/**********************************************************************************
1310 Methods of class remove_key_call follow:
1311**********************************************************************************/
1312
1313remove_key_call::remove_key_call (tf_fuzz_info *test_state, // (constructor)
1314 long &call_ser_no,
1315 asset_search how_asset_found)
1316 : key_call(test_state, call_ser_no,
1317 how_asset_found)
1318{
1319 // Copy the boilerplate text into local buffers:
1320 prep_code.assign ("");
1321 call_code.assign (test_state->bplate->bplate_string[remove_key]);
1322 check_code.assign (test_state->bplate->bplate_string[remove_key_check]);
1323 call_description = "key-remove call";
1324}
1325remove_key_call::~remove_key_call (void)
1326{
1327 return; // just to have something to pin a breakpoint onto
1328}
1329
1330bool remove_key_call::copy_call_to_asset (void)
1331{
1332 return copy_call_to_asset_t<key_asset*> (this, dont_create_asset);
1333}
1334
1335void remove_key_call::fill_in_prep_code (void)
1336{
1337 // No prep code required.
1338 return; // just to have something to pin a breakpoint onto
1339}
1340
1341void remove_key_call::fill_in_command (void)
1342{
1343 // (call_code already loaded by constructor)
1344 find_replace_all ("$key", asset_info.get_name(), call_code);
1345 // Calculate the expected results:
1346 calc_result_code();
1347}
1348
1349/**********************************************************************************
1350 End of methods of class remove_key_call.
1351**********************************************************************************/
1352