blob: 525f026c814dd8ef5efa783d1e7cf8be0f8a830a [file] [log] [blame]
Karl Zhang3de5ab12021-05-31 11:45:48 +08001/*
Nik Dewallybacae6c2024-07-30 16:58:14 +01002 * Copyright (c) 2019-2024, Arm Limited. All rights reserved.
Karl Zhang3de5ab12021-05-31 11:45:48 +08003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8#ifndef CRYPTO_ASSET_HPP
9#define CRYPTO_ASSET_HPP
10
11#include <string>
12#include <vector>
13#include <cstddef>
14#include <cstdint>
15
Nik Dewallybacae6c2024-07-30 16:58:14 +010016#include "data_blocks.hpp"
Karl Zhang3de5ab12021-05-31 11:45:48 +080017#include "psa_asset.hpp"
Karl Zhang3de5ab12021-05-31 11:45:48 +080018
Nik Dewallybacae6c2024-07-30 16:58:14 +010019class key_asset;
Karl Zhang3de5ab12021-05-31 11:45:48 +080020
21using namespace std;
22
23class crypto_asset : public psa_asset
24{
25public:
26 // Data members:
27 key_policy_info policy;
28 // Methods:
29 crypto_asset (void); // (constructor)
30 ~crypto_asset (void);
31
32protected:
33 // Data members:
34 // Methods:
35
36private:
37 // Data members:
38 // Methods:
39};
40
41class policy_asset : public crypto_asset
42{
43public:
44 // Data members:
45 string policy_usage; // for now just strings; maybe future tap TF-M(?) value list
46 string key_type; // DES, AES, RAW, vendor, none, etc.
47 string policy_algorithm;
48 vector<key_asset*> keys; // keys that use this policy
49 // Methods:
50 policy_asset (void); // (constructor)
51 ~policy_asset (void);
52
53protected:
54 // Data members:
55 // Methods:
56
57private:
58 // Data members:
59 // Methods:
60};
61
62class key_asset : public crypto_asset
63{
64public:
65 // Data members:
66 vector<policy_asset*>::iterator the_policy_asset;
67 /* The policy for this key. Note that psa_make_key() lets us create
68 a key without associating a policy with it. In that case, this will
69 be null, and the attributes below apply. Later, psa_set_key_policy
70 lets us associate a policy with a key, at which point this becomes
71 non-null and the following attributes no longer apply. */
72 string key_type; // DES, AES, RAW, vendor, none, etc.
73 string usage; // for now just strings; maybe future tap TF-M(?) value list
74 string alg; // these only apply if the string was created without a policy
75 string lifetime_str; // similarly, the text representation of the key's lifetime
76 // Methods:
77 bool set_key_id (int id_n); // checks key-ID value, returns true==success
78 key_asset (void); // (constructor)
79 ~key_asset (void);
80
81protected:
82 // Data members:
83 uint64_t key_id;
84 // Methods:
85
86private:
87 // Data members:
88 // Methods:
89};
90
91#endif // CRYPTO_ASSET_HPP