SX_KEYREF_LOAD_MATERIAL

C

typedef struct sxkeyref (*FUNC_SX_KEYREF_LOAD_MATERIAL)(size_t keysz, const char *keymaterial);
#define SX_KEYREF_LOAD_MATERIAL                        ((FUNC_SX_KEYREF_LOAD_MATERIAL)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_SX_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 sxkeyref object.

The returned object can be passed to any of the sx_aead_create_() or sx_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

sxkeyref initialized object with provided inputs

SX_KEYREF_LOAD_BY_ID

C

typedef struct sxkeyref (*FUNC_SX_KEYREF_LOAD_BY_ID)(size_t keyindex);
#define SX_KEYREF_LOAD_BY_ID                           ((FUNC_SX_KEYREF_LOAD_BY_ID)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_SX_KEYREF_LOAD_BY_ID)))

Description

Returns a reference to a key selected by an index. This function initializes a sxkeyref 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 sx_aead_create_() or sx_blkcipher_create_() functions.

Parameters

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

Returns

sxkeyref initialized object with configuration of the hardware key index provided