@@ -56,7 +56,7 @@ class DeviceKey : private mbed::NonCopyable<DeviceKey> {
56
56
/* *
57
57
* @brief As a singleton, return the single instance of the class.
58
58
* Reason for this class being a singleton is the following:
59
- * - Ease the use for users of this class not having to coordinate instantiations.
59
+ * - Ease of use for users of this class not having to coordinate instantiations.
60
60
* - Lazy instantiation of internal data (which we can't achieve with simple static classes).
61
61
*
62
62
* @returns Singleton instance reference.
@@ -65,27 +65,27 @@ class DeviceKey : private mbed::NonCopyable<DeviceKey> {
65
65
{
66
66
// Use this implementation of singleton (Meyer's) rather than the one that allocates
67
67
// the instance on the heap, as it ensures destruction at program end (preventing warnings
68
- // from memory checking tools such as valgrind).
68
+ // from memory checking tools, such as valgrind).
69
69
static DeviceKey instance;
70
70
return instance;
71
71
}
72
72
73
73
~DeviceKey ();
74
74
75
- /* * Derive a new key based on the salt string. key type can be with values 16 bytes and 32 bytes
76
- * @param isalt input buffer used to create the new key. Same input will generate always the same key
77
- * @param isalt_size size of the data in salt buffer
78
- * @param output buffer to receive the derived key. Size must be 16 bytes or 32 bytes
75
+ /* * Derive a new key based on the salt string.
76
+ * @param isalt Input buffer used to create the new key. Same input always generates the same key
77
+ * @param isalt_size Size of the data in salt buffer.
78
+ * @param output Buffer to receive the derived key. Size must be 16 bytes or 32 bytes
79
79
* according to the ikey_type parameter
80
- * @param ikey_type type of the required key. Type must be 16 bytes or 32 bytes.
80
+ * @param ikey_type Type of the required key. Must be 16 bytes or 32 bytes.
81
81
* @return 0 on success, negative error code on failure
82
82
*/
83
83
int generate_derived_key (const unsigned char *isalt, size_t isalt_size, unsigned char *output, uint16_t ikey_type);
84
84
85
- /* * Set a device key into the NVStore. In case TRNG support is missing, Call this method
85
+ /* * Set a device key into the NVStore. If TRNG support is missing, call this method
86
86
* before calling device_key_derived_key. This method should be called only once!
87
- * @param value input buffer contain the key.
88
- * @param isize size of the supplied key. Must be 16 bytes or 32 bytes.
87
+ * @param value Input buffer contain the key.
88
+ * @param isize Size of the supplied key. Must be 16 bytes or 32 bytes.
89
89
* @return 0 on success, negative error code on failure
90
90
*/
91
91
int device_inject_root_of_trust (uint32_t *value, size_t isize);
@@ -95,40 +95,40 @@ class DeviceKey : private mbed::NonCopyable<DeviceKey> {
95
95
DeviceKey ();
96
96
97
97
/* * Read a device key from the NVStore
98
- * @param output buffer for the returned key.
99
- * @param size input: the size of the output buffer.
100
- * output: the actual size of the written data
98
+ * @param output Buffer for the returned key.
99
+ * @param size Input: The size of the output buffer.
100
+ * Output: The actual size of the written data
101
101
* @return 0 on success, negative error code on failure
102
102
*/
103
103
int read_key_from_nvstore (uint32_t *output, size_t & size);
104
104
105
105
/* * Set a device key into the NVStore
106
- * @param input input buffer contain the key.
107
- * @param isize the size of the input buffer.
106
+ * @param input Input buffer contain the key.
107
+ * @param isize The size of the input buffer.
108
108
* @return 0 on success, negative error code on failure
109
109
*/
110
110
int write_key_to_nvstore (uint32_t *input, size_t isize);
111
111
112
- /* * Get a derived key base on a salt string. The methods implements
113
- * Section 5.1 in NIST SP 800-108, Recommendation for Key Derivation Using Pseudorandom Functions
114
- * @param ikey_buff input buffer holding the ROT key
115
- * @param ikey_size size of the input key. Must be 16 bytes or 32 bytes.
116
- * @param isalt input buffer contain some string.
117
- * @param isalt_size size of the supplied input string.
118
- * @param output buffer for the derived key result.
119
- * @param ikey_type the requested key size. Must be 16 bytes or 32 bytes.
112
+ /* * Get a derived key base on a salt string. The methods implements Section 5.1
113
+ * in NIST SP 800-108, Recommendation for Key Derivation Using Pseudorandom Functions
114
+ * @param ikey_buff Input buffer holding the ROT key
115
+ * @param ikey_size Size of the input key. Must be 16 bytes or 32 bytes.
116
+ * @param isalt Input buffer contain some string.
117
+ * @param isalt_size Size of the supplied input string.
118
+ * @param output Buffer for the derived key result.
119
+ * @param ikey_type The requested key size. Must be 16 bytes or 32 bytes.
120
120
* @return 0 on success, negative error code on failure
121
121
*/
122
122
int get_derived_key (uint32_t *ikey_buff, size_t ikey_size, const unsigned char *isalt, size_t isalt_size,
123
123
unsigned char *output, uint32_t ikey_type);
124
124
125
125
/* * Generate a random ROT key by using TRNG
126
- * @param output output buffer for the generated key.
127
- * @param size input: the size of the buffer. if size is less
128
- * then 16 bytes the method will generate an
129
- * error. 16-31 bytes will create a 16 byte key.
130
- * 32 or higher will generate a 32 bytes key
131
- * output: the actual written size to the buffer
126
+ * @param output Output buffer for the generated key.
127
+ * @param size Input: The size of the buffer. If size is less
128
+ * than 16 bytes, the method generates an
129
+ * error. 16-31 bytes creates a 16- byte key.
130
+ * 32 or higher generates a 32-byte key
131
+ * Output: The actual written size to the buffer
132
132
* @return 0 on success, negative error code on failure
133
133
*/
134
134
int generate_key_by_trng (uint32_t *output, size_t size);
0 commit comments