CRM_MAC_FEED
C
typedef int (*FUNC_CRM_MAC_FEED)(struct crmmac *c, const char *datain, size_t sz); #define CRM_MAC_FEED ((FUNC_CRM_MAC_FEED)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_MAC_FEED)))
Description
Feeds data to be used for MAC generation. The function will return immediately. In order to start the operation CRM_MAC_GENERATE() must be called.
pre - crm_mac_create_*() function must be called first remark - this function can be called even if data size, \p sz, is 0. remark - this function can be called multiple times to feed multiple chunks scattered in memory.
Parameters
Param | Description |
---|---|
c | MAC Operation context |
datain | data to be processed, with size \p sz |
sz | Size in bytes of data to be processed |
Returns
CRM_OK CRM_ERR_UNITIALIZED_OBJ CRM_ERR_TOO_BIG CRM_ERR_FEED_COUNT_EXCEEDED
CRM_MAC_GENERATE
C
typedef int (*FUNC_CRM_MAC_GENERATE)(struct crmmac *c, char *mac); #define CRM_MAC_GENERATE ((FUNC_CRM_MAC_GENERATE)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_MAC_GENERATE)))
Description
Starts MAC generation operation.
This function is used to start MAC generation. The function will return immediately.
The result will be transfered only after the operation is successfully completed. The user shall check operation status with CRM_MAC_STATUS() or CRM_MAC_WAIT(). pre - CRM_MAC_FEED() function must be called first remark - if used with context saving(last chunk), the fed data size for the last chunk can not be 0
Parameters
Param | Description |
---|---|
c | MAC Operation context |
mac | generated MAC |
Returns
CRM_OK CRM_ERR_UNITIALIZED_OBJ CRM_ERR_TOO_SMALL
CRM_MAC_RESUME_STATE
C
typedef int (*FUNC_CRM_MAC_RESUME_STATE)(struct crmmac *c); #define CRM_MAC_RESUME_STATE ((FUNC_CRM_MAC_RESUME_STATE)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_MAC_RESUME_STATE)))
Description
Resumes MAC operation in context-saving.
This function shall be called when using context-saving to load the state that was previously saved by CRM_MAC_SAVE_STATE() in the crmmac operation context \p c. It must be called with the same crmmac operation context \p c that was used with CRM_MAC_SAVE_STATE(). It will reserve all hardware resources required to run the partial MAC operation. After successful execution of this function, the context \p c can be passed to any of the block cipher functions, except the crm_mac_create_() functions. pre - crm_mac_create_*() and CRM_MAC_SAVE_STATE() functions must be called before, for first part of the message. pre - must be called for each part of the message(besides first), before crm_mac_crypt() or CRM_MAC_SAVE_STATE(). remark - the user must not change the key until all parts of the message to be encrypted/decrypted are processed.
Parameters
Param | Description |
---|---|
c | MAC Operation context |
Returns
CRM_OK CRM_ERR_UNITIALIZED_OBJ CRM_ERR_CONTEXT_SAVING_NOT_SUPPORTED CRM_ERR_INVALID_KEYREF CRM_ERR_INVALID_KEY_SZ CRM_ERR_INCOMPATIBLE_HW CRM_ERR_RETRY
CRM_MAC_SAVE_STATE
C
typedef int (*FUNC_CRM_MAC_SAVE_STATE)(struct crmmac *c); #define CRM_MAC_SAVE_STATE ((FUNC_CRM_MAC_SAVE_STATE)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_MAC_SAVE_STATE)))
Description
Starts a partial MAC operation.
This function is used to start a partial MAC operation on data fed using CRM_MAC_FEED(). The function will return immediately. The partial result will be transfered only after the operation is successfully completed. The user shall check operation status with CRM_MAC_STATUS() or CRM_MAC_WAIT(). pre - crm_mac_crypt() should be called first. remark - the user must not change the key until all parts of the message to be encrypted/decrypted are processed.
Parameters
Param | Description |
---|---|
c | MAC Operation context |
Returns
CRM_OK CRM_ERR_UNITIALIZED_OBJ CRM_ERR_CONTEXT_SAVING_NOT_SUPPORTED CRM_ERR_TOO_SMALL CRM_ERR_WRONG_SIZE_GRANULARITY
CRM_MAC_WAIT
C
typedef int (*FUNC_CRM_MAC_WAIT)(struct crmmac *c); #define CRM_MAC_WAIT ((FUNC_CRM_MAC_WAIT)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_MAC_WAIT)))
Description
Waits until the given MAC generation operation has finished This function returns when the MAC generation operation was successfully completed, or when an error has occurred that caused the operation to terminate. The return value of this function is the operation status. After this call, all resources have been released and \p c cannot be used again unless crm_mac_create_*() is used. remark - this function is blocking until operation finishes.
Parameters
Param | Description |
---|---|
c | MAC Operation context |
See
CRM_MAC_STATUS().
Returns
CRM_OK CRM_ERR_UNITIALIZED_OBJ CRM_ERR_DMA_FAILED CRM_ERR_INVALID_TAG
CRM_MAC_STATUS
C
typedef int (*FUNC_CRM_MAC_STATUS)(struct crmmac *c); #define CRM_MAC_STATUS ((FUNC_CRM_MAC_STATUS)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_MAC_STATUS)))
Description
Returns the MAC generation operation status.
If the operation is still ongoing, CRM_ERR_HW_PROCESSING. In that case, the user can retry later.
When this function returns with a code different than ::CRM_ERR_HW_PROCESSING, the MAC generation operation has ended and all resources used by MAC generation operation context \p c have been released. In this case, \p c cannot be used for a new operation until one of the crm_mac_create_*() functions is called again. pre - CRM_MAC_FEED() and CRM_MAC_GENERATE() functions must be called first
Parameters
Param | Description |
---|---|
c | MAC Operation context |
See
CRM_MAC_STATUS().
Returns
CRM_OK CRM_ERR_UNITIALIZED_OBJ CRM_ERR_HW_PROCESSING CRM_ERR_DMA_FAILED CRM_ERR_INVALID_TAG