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 "crypto_asset.hpp" |
Karl Zhang | 3de5ab1 | 2021-05-31 11:45:48 +0800 | [diff] [blame] | 12 | |
| 13 | |
| 14 | |
| 15 | /********************************************************************************** |
| 16 | Methods of class crypto_asset follow: |
| 17 | **********************************************************************************/ |
| 18 | |
| 19 | crypto_asset::crypto_asset (void) // (default constructor) |
| 20 | { |
| 21 | return; // just to have something to pin a breakpoint onto |
| 22 | } |
| 23 | |
| 24 | |
| 25 | crypto_asset::~crypto_asset (void) // (destructor) |
| 26 | { |
| 27 | return; // just to have something to pin a breakpoint onto |
| 28 | } |
| 29 | |
| 30 | /********************************************************************************** |
| 31 | End of methods of class crypto_asset. |
| 32 | **********************************************************************************/ |
| 33 | |
| 34 | |
| 35 | /********************************************************************************** |
| 36 | Methods of class policy_asset follow: |
| 37 | **********************************************************************************/ |
| 38 | |
| 39 | policy_asset::policy_asset (void) // (default constructor) |
| 40 | { |
Nik Dewally | 3e11e9c | 2024-08-08 10:36:06 +0100 | [diff] [blame] | 41 | return; // just to have something to pin a breakpoint onto |
Karl Zhang | 3de5ab1 | 2021-05-31 11:45:48 +0800 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | |
| 45 | policy_asset::~policy_asset (void) // (destructor) |
| 46 | { |
| 47 | return; // just to have something to pin a breakpoint onto |
| 48 | } |
| 49 | |
| 50 | /********************************************************************************** |
| 51 | End of methods of class policy_asset. |
| 52 | **********************************************************************************/ |
| 53 | |
| 54 | |
| 55 | /********************************************************************************** |
| 56 | Methods of class key_asset follow: |
| 57 | **********************************************************************************/ |
| 58 | |
| 59 | bool key_asset::set_key_id (int id_n) |
| 60 | { |
| 61 | key_id = id_n; |
| 62 | return true; |
| 63 | } |
| 64 | |
| 65 | |
| 66 | key_asset::key_asset (void) |
| 67 | { |
| 68 | // Note: Similar random initialization for asset and template |
| 69 | // Randomize handle: |
| 70 | // TODO: Key handles appear to be a lot more complex a question than the below |
| 71 | gibberish *gib = new gibberish; |
| 72 | char buffer[256]; |
| 73 | char *end; |
| 74 | int buf_len = 5ULL + (uint64_t) (rand() % 10); |
| 75 | end = gib->word (false, buffer, buffer + buf_len); |
| 76 | *end = '\0'; |
| 77 | buffer[buf_len] = '\0'; |
| 78 | handle_str = buffer; |
Karl Zhang | 3de5ab1 | 2021-05-31 11:45:48 +0800 | [diff] [blame] | 79 | } |
| 80 | |
| 81 | |
| 82 | key_asset::~key_asset (void) |
| 83 | { |
| 84 | return; // just to have something to pin a breakpoint onto |
| 85 | } |
| 86 | |
| 87 | /********************************************************************************** |
| 88 | End of methods of class key_asset. |
| 89 | **********************************************************************************/ |