Mistake on this page?
Report an issue in GitHub or email us
Public Member Functions | Static Public Member Functions
DeviceKey Class Reference

Use this singleton if you need to derive a new key from the device root of trust. More...

#include <DeviceKey.h>

Inheritance diagram for DeviceKey:
NonCopyable< DeviceKey >

Public Member Functions

int generate_derived_key (const unsigned char *isalt, size_t isalt_size, unsigned char *output, uint16_t ikey_type)
 Derive a new key based on the salt string. More...
 
int device_inject_root_of_trust (uint32_t *value, size_t isize)
 Set a device key into the KVStore. More...
 

Static Public Member Functions

static DeviceKeyget_instance ()
 As a singleton, return the single instance of the class. More...
 

Detailed Description

Use this singleton if you need to derive a new key from the device root of trust.

Note
Synchronization level: Thread safe

Definition at line 62 of file DeviceKey.h.

Member Function Documentation

int device_inject_root_of_trust ( uint32_t *  value,
size_t  isize 
)

Set a device key into the KVStore.

If entropy support is missing, call this method before calling device_key_derived_key. This method should be called only once!

Parameters
valueInput buffer contain the key.
isizeSize of the supplied key. Must be 16 bytes or 32 bytes.
Returns
0 on success, negative error code on failure
int generate_derived_key ( const unsigned char *  isalt,
size_t  isalt_size,
unsigned char *  output,
uint16_t  ikey_type 
)

Derive a new key based on the salt string.

Parameters
isaltInput buffer used to create the new key. Same input always generates the same key
isalt_sizeSize of the data in salt buffer.
outputBuffer to receive the derived key. Size must be 16 bytes or 32 bytes according to the ikey_type parameter
ikey_typeType of the required key. Must be 16 bytes or 32 bytes.
Returns
0 on success, negative error code on failure
static DeviceKey& get_instance ( )
static

As a singleton, return the single instance of the class.

Reason for this class being a singleton is the following:

  • Ease of use for users of this class not having to coordinate instantiations.
  • Lazy instantiation of internal data (which we can't achieve with simple static classes).
Returns
Singleton instance reference.

Definition at line 73 of file DeviceKey.h.

Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.