CRM_KEYREF_LOAD_MATERIAL

C

typedef struct crmkeyref (*FUNC_CRM_KEYREF_LOAD_MATERIAL)(size_t keysz, const char *keymaterial);
#define CRM_KEYREF_LOAD_MATERIAL                        ((FUNC_CRM_KEYREF_LOAD_MATERIAL)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_KEYREF_LOAD_MATERIAL)))

Description

Returns a reference to a key whose key material is in user memory.

This function loads the user provided key data and returns an initialized crmkeyref object.

The returned object can be passed to any of the crm_aead_create_() or crm_blkcipher_create_() functions. remark - \p keymaterial buffer should not be changed until the operation is completed.

Parameters

ParamDescription
keyszsize of the key to be loaded
keymaterialKey to be loaded with size \p keysz

Returns

crmkeyref initialized object with provided inputs

CRM_KEYREF_LOAD_BY_ID

C

typedef struct crmkeyref (*FUNC_CRM_KEYREF_LOAD_BY_ID)(size_t keyindex);
#define CRM_KEYREF_LOAD_BY_ID                           ((FUNC_CRM_KEYREF_LOAD_BY_ID)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_KEYREF_LOAD_BY_ID)))

Description

Returns a reference to a key selected by an index. This function initializes a crmkeyref object to use predefined hardware keys. Currently, predefined hardware keys can be used with AES and SM4.

The returned object can be passed to any of the crm_aead_create_() or crm_blkcipher_create_() functions.

Parameters

ParamDescription
keyindexindex of the hardware key, must be 0 or 1

Returns

crmkeyref initialized object with configuration of the hardware key index provided