CRM_BLKCIPHER_CREATE_AESXTS_ENC
C
typedef int (*FUNC_CRM_BLKCIPHER_CREATE_AESXTS_ENC)(struct crmblkcipher *c, const struct crmkeyref *key1, const struct crmkeyref *key2, const char *iv); #define CRM_BLKCIPHER_CREATE_AESXTS_ENC ((FUNC_CRM_BLKCIPHER_CREATE_AESXTS_ENC)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_BLKCIPHER_CREATE_AESXTS_ENC)))
Description
Prepares an AES XTS block cipher encryption.
This function initializes the user allocated object \p c with a new block cipher operation context needed to run the AES XTS encryption and reserves the HW resource. After successful execution of this function, the context \p c can be passed to any of the block cipher functions. pre - key references provided by \p key1 and \p key2 must be initialized using CRM_KEYREF_LOAD_MATERIAL().
Parameters
Param | Description |
---|---|
c | block cipher operation context |
key1 | first key used for the block cipher operation, expected size 16, 24 or 32 bytes, must be equal to \p key2 size |
key2 | second key used for the block cipher operation, expected size 16, 24 or 32 bytes, must be equal to \p key1 size |
iv | initialization vector, size must be 16 bytes |
Returns
CRM_OK CRM_ERR_INVALID_KEYREF CRM_ERR_HW_KEY_NOT_SUPPORTED CRM_ERR_INVALID_KEY_SZ CRM_ERR_INCOMPATIBLE_HW CRM_ERR_RETRY
CRM_BLKCIPHER_CREATE_AESXTS_DEC
C
typedef int (*FUNC_CRM_BLKCIPHER_CREATE_AESXTS_DEC)(struct crmblkcipher *c, const struct crmkeyref *key1, const struct crmkeyref *key2, const char *iv); #define CRM_BLKCIPHER_CREATE_AESXTS_DEC ((FUNC_CRM_BLKCIPHER_CREATE_AESXTS_DEC)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_BLKCIPHER_CREATE_AESXTS_DEC)))
Description
Prepares an AES XTS block cipher decryption
This function initializes the user allocated object \p c with a new block cipher operation context needed to run the AES XTS decryption and reserves the HW resource.
After successful execution of this function, the context \p c can be passed to any of the block cipher functions. pre - key references provided by \p key1 and \p key2 must be initialized using CRM_KEYREF_LOAD_MATERIAL().
Parameters
Param | Description |
---|---|
c | block cipher operation context |
key1 | first key used for the block cipher operation, expected size 16, 24 or 32 bytes, must be equal to \p key2 size |
key2 | second key used for the block cipher operation, expected size 16, 24 or 32 bytes, must be equal to \p key1 size |
iv | initialization vector, size must be 16 bytes |
Returns
CRM_OK CRM_ERR_INVALID_KEYREF CRM_ERR_HW_KEY_NOT_SUPPORTED CRM_ERR_INVALID_KEY_SZ CRM_ERR_INCOMPATIBLE_HW CRM_ERR_RETRY
CRM_BLKCIPHER_CREATE_AESCTR_ENC
C
typedef int (*FUNC_CRM_BLKCIPHER_CREATE_AESCTR_ENC)(struct crmblkcipher *c, const struct crmkeyref *key, const char *iv); #define CRM_BLKCIPHER_CREATE_AESCTR_ENC ((FUNC_CRM_BLKCIPHER_CREATE_AESCTR_ENC)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_BLKCIPHER_CREATE_AESCTR_ENC)))
Description
Prepares an AES CTR block cipher encryption.
This function initializes the user allocated object \p c with a new block cipher operation context needed to run the AES CTR encryption and reserves the HW resource. After successful execution of this function, the context \p c can be passed to any of the block cipher functions. pre - key reference provided by \p key must be initialized using CRM_KEYREF_LOAD_MATERIAL() or CRM_KEYREF_LOAD_BY_ID()
Parameters
Param | Description |
---|---|
c | block cipher operation context |
key | key used for the block cipher operation, expected size 16, 24 or 32 bytes |
iv | initialization vector, size must be 16 bytes |
Returns
CRM_OK CRM_ERR_INVALID_KEYREF CRM_ERR_INVALID_KEY_SZ CRM_ERR_INCOMPATIBLE_HW CRM_ERR_RETRY
CRM_BLKCIPHER_CREATE_AESCTR_DEC
C
typedef int (*FUNC_CRM_BLKCIPHER_CREATE_AESCTR_DEC)(struct crmblkcipher *c, const struct crmkeyref *key, const char *iv); #define CRM_BLKCIPHER_CREATE_AESCTR_DEC ((FUNC_CRM_BLKCIPHER_CREATE_AESCTR_DEC)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_BLKCIPHER_CREATE_AESCTR_DEC)))
Description
Prepares an AES CTR block cipher decryption This function initializes the user allocated object \p c with a new block cipher operation context needed to run the AES CTR decryption and reserves the HW resource. After successful execution of this function, the context \p c can be passed to any of the block cipher functions. pre - key reference provided by \p key must be initialized using CRM_KEYREF_LOAD_MATERIAL() or CRM_KEYREF_LOAD_BY_ID()
Parameters
Param | Description |
---|---|
c | block cipher operation context |
key | key used for the block cipher operation, expected size 16, 24 or 32 bytes |
iv | initialization vector, size must be 16 bytes |
Returns
CRM_OK CRM_ERR_INVALID_KEYREF CRM_ERR_INVALID_KEY_SZ CRM_ERR_INCOMPATIBLE_HW CRM_ERR_RETRY
CRM_BLKCIPHER_CREATE_AESECB_ENC
C
typedef int (*FUNC_CRM_BLKCIPHER_CREATE_AESECB_ENC)(struct crmblkcipher *c, const struct crmkeyref *key); #define CRM_BLKCIPHER_CREATE_AESECB_ENC ((FUNC_CRM_BLKCIPHER_CREATE_AESECB_ENC)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_BLKCIPHER_CREATE_AESECB_ENC)))
Description
Prepares an AES ECB block cipher encryption. This function initializes the user allocated object \p c with a new block cipher operation context needed to run the AES ECB encryption and reserves the HW resource.
After successful execution of this function, the context \p c can be passed to any of the block cipher functions. pre - key reference provided by \p key must be initialized using CRM_KEYREF_LOAD_MATERIAL() or CRM_KEYREF_LOAD_BY_ID() remark - AES ECB does not support context saving.
Parameters
Param | Description |
---|---|
c | block cipher operation context |
key | key used for the block cipher operation, expected size 16, 24 or 32 bytes |
Returns
CRM_OK CRM_ERR_INVALID_KEYREF CRM_ERR_INVALID_KEY_SZ CRM_ERR_INCOMPATIBLE_HW CRM_ERR_RETRY
CRM_BLKCIPHER_CREATE_AESECB_DEC
C
typedef int (*FUNC_CRM_BLKCIPHER_CREATE_AESECB_DEC)(struct crmblkcipher *c, const struct crmkeyref *key); #define CRM_BLKCIPHER_CREATE_AESECB_DEC ((FUNC_CRM_BLKCIPHER_CREATE_AESECB_DEC)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_BLKCIPHER_CREATE_AESECB_DEC)))
Description
Prepares an AES ECB block cipher decryption
This function initializes the user allocated object \p c with a new block cipher operation context needed to run the AES ECB decryption and reserves the HW resource. After successful execution of this function, the context \p c can be passed to any of the block cipher functions. pre - key reference provided by \p key must be initialized using CRM_KEYREF_LOAD_MATERIAL() or CRM_KEYREF_LOAD_BY_ID() remark - AES ECB does not support context saving.
Parameters
Param | Description |
---|---|
c | block cipher operation context |
key | key used for the block cipher operation, expected size 16, 24 or 32 bytes |
Returns
CRM_OK CRM_ERR_INVALID_KEYREF CRM_ERR_INVALID_KEY_SZ CRM_ERR_INCOMPATIBLE_HW CRM_ERR_RETRY
CRM_BLKCIPHER_CREATE_AESCBC_ENC
C
typedef int (*FUNC_CRM_BLKCIPHER_CREATE_AESCBC_ENC)(struct crmblkcipher *c, const struct crmkeyref *key, const char *iv); #define CRM_BLKCIPHER_CREATE_AESCBC_ENC ((FUNC_CRM_BLKCIPHER_CREATE_AESCBC_ENC)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_BLKCIPHER_CREATE_AESCBC_ENC)))
Description
Prepares an AES CBC block cipher encryption.
This function initializes the user allocated object \p c with a new block cipher operation context needed to run the AES CBC encryption and reserves the HW resource. After successful execution of this function, the context \p c can be passed to any of the block cipher functions. pre - key reference provided by \p key must be initialized using CRM_KEYREF_LOAD_MATERIAL() or CRM_KEYREF_LOAD_BY_ID()
Parameters
Param | Description |
---|---|
c | block cipher operation context |
key | key used for the block cipher operation, expected size 16, 24 or 32 bytes |
iv | initialization vector, size must be 16 bytes |
Returns
CRM_OK CRM_ERR_INVALID_KEYREF CRM_ERR_INVALID_KEY_SZ CRM_ERR_INCOMPATIBLE_HW CRM_ERR_RETRY
CRM_BLKCIPHER_CREATE_AESCBC_DEC
C
typedef int (*FUNC_CRM_BLKCIPHER_CREATE_AESCBC_DEC)(struct crmblkcipher *c, const struct crmkeyref *key, const char *iv); #define CRM_BLKCIPHER_CREATE_AESCBC_DEC ((FUNC_CRM_BLKCIPHER_CREATE_AESCBC_DEC)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_BLKCIPHER_CREATE_AESCBC_DEC)))
Description
Prepares an AES CBC block cipher decryption
This function initializes the user allocated object \p c with a new block cipher operation context needed to run the AES CBC decryption and reserves the HW resource.
After successful execution of this function, the context \p c can be passed to any of the block cipher functions. pre - key reference provided by \p key must be initialized using CRM_KEYREF_LOAD_MATERIAL() or CRM_KEYREF_LOAD_BY_ID()
Parameters
Param | Description |
---|---|
c | block cipher operation context |
key | key used for the block cipher operation, expected size 16, 24 or 32 bytes |
iv | initialization vector, size must be 16 bytes |
Returns
CRM_OK CRM_ERR_INVALID_KEYREF CRM_ERR_INVALID_KEY_SZ CRM_ERR_INCOMPATIBLE_HW CRM_ERR_RETRY
CRM_BLKCIPHER_CREATE_AESCFB_ENC
C
typedef int (*FUNC_CRM_BLKCIPHER_CREATE_AESCFB_ENC)(struct crmblkcipher *c, const struct crmkeyref *key, const char *iv); #define CRM_BLKCIPHER_CREATE_AESCFB_ENC ((FUNC_CRM_BLKCIPHER_CREATE_AESCFB_ENC)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_BLKCIPHER_CREATE_AESCFB_ENC)))
Description
Prepares an AES CFB block cipher encryption.
This function initializes the user allocated object \p c with a new block cipher operation context needed to run the AES CFB encryption and reserves the HW resource.
After successful execution of this function, the context \p c can be passed to any of the block cipher functions. pre - key reference provided by \p key must be initialized using CRM_KEYREF_LOAD_MATERIAL() or CRM_KEYREF_LOAD_BY_ID()
Parameters
Param | Description |
---|---|
c | block cipher operation context |
key | key used for the block cipher operation, expected size 16, 24 or 32 bytes |
iv | initialization vector, size must be 16 bytes |
Returns
CRM_OK CRM_ERR_INVALID_KEYREF CRM_ERR_INVALID_KEY_SZ CRM_ERR_INCOMPATIBLE_HW CRM_ERR_RETRY
CRM_BLKCIPHER_CREATE_AESCFB_DEC
C
typedef int (*FUNC_CRM_BLKCIPHER_CREATE_AESCFB_DEC)(struct crmblkcipher *c, const struct crmkeyref *key, const char *iv); #define CRM_BLKCIPHER_CREATE_AESCFB_DEC ((FUNC_CRM_BLKCIPHER_CREATE_AESCFB_DEC)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_BLKCIPHER_CREATE_AESCFB_DEC)))
Description
Prepares an AES CFB block cipher decryption.
This function initializes the user allocated object \p c with a new block cipher operation context needed to run the AES CFB decryption and reserves the HW resource.
After successful execution of this function, the context \p c can be passed to any of the block cipher functions. pre - key reference provided by \p key must be initialized using CRM_KEYREF_LOAD_MATERIAL() or CRM_KEYREF_LOAD_BY_ID()
Parameters
Param | Description |
---|---|
c | block cipher operation context |
key | key used for the block cipher operation, expected size 16, 24 or 32 bytes |
iv | initialization vector, size must be 16 bytes |
Returns
CRM_OK CRM_ERR_INVALID_KEYREF CRM_ERR_INVALID_KEY_SZ CRM_ERR_INCOMPATIBLE_HW CRM_ERR_RETRY
CRM_BLKCIPHER_CREATE_AESOFB_ENC
C
typedef int (*FUNC_CRM_BLKCIPHER_CREATE_AESOFB_ENC)(struct crmblkcipher *c, const struct crmkeyref *key, const char *iv); #define CRM_BLKCIPHER_CREATE_AESOFB_ENC ((FUNC_CRM_BLKCIPHER_CREATE_AESOFB_ENC)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_BLKCIPHER_CREATE_AESOFB_ENC)))
Description
Prepares an AES OFB block cipher encryption.
This function initializes the user allocated object \p c with a new block cipher operation context needed to run the AES OFB encryption and reserves the HW resource.
After successful execution of this function, the context \p c can be passed to any of the block cipher functions. pre - key reference provided by \p key must be initialized using CRM_KEYREF_LOAD_MATERIAL() or CRM_KEYREF_LOAD_BY_ID()
Parameters
Param | Description |
---|---|
c | block cipher operation context |
key | key used for the block cipher operation, expected size 16, 24 or 32 bytes |
iv | initialization vector, size must be 16 bytes |
Returns
CRM_OK CRM_ERR_INVALID_KEYREF CRM_ERR_INVALID_KEY_SZ CRM_ERR_INCOMPATIBLE_HW CRM_ERR_RETRY
CRM_BLKCIPHER_CREATE_AESOFB_DEC
C
typedef int (*FUNC_CRM_BLKCIPHER_CREATE_AESOFB_DEC)(struct crmblkcipher *c, const struct crmkeyref *key, const char *iv); #define CRM_BLKCIPHER_CREATE_AESOFB_DEC ((FUNC_CRM_BLKCIPHER_CREATE_AESOFB_DEC)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_BLKCIPHER_CREATE_AESOFB_DEC)))
Description
Prepares an AES OFB block cipher decryption.
This function initializes the user allocated object \p c with a new block cipher operation context needed to run the AES OFB decryption and reserves the HW resource.
After successful execution of this function, the context \p c can be passed to any of the block cipher functions. pre - key reference provided by \p key must be initialized using CRM_KEYREF_LOAD_MATERIAL() or CRM_KEYREF_LOAD_BY_ID()
Parameters
Param | Description |
---|---|
c | block cipher operation context |
key | key used for the block cipher operation, expected size 16, 24 or 32 bytes |
iv | initialization vector, size must be 16 bytes |
Returns
CRM_OK CRM_ERR_INVALID_KEYREF CRM_ERR_INVALID_KEY_SZ CRM_ERR_INCOMPATIBLE_HW CRM_ERR_RETRY
CRM_BLKCIPHER_CRYPT
C
typedef int (*FUNC_CRM_BLKCIPHER_CRYPT)(struct crmblkcipher *c, const char *datain, size_t sz, char *dataout); #define CRM_BLKCIPHER_CRYPT ((FUNC_CRM_BLKCIPHER_CRYPT)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_BLKCIPHER_CRYPT)))
Description
Adds data to be encrypted/decrypted.
The function will return immediately.
In order to start the operation CRM_BLKCIPHER_RUN() must be called.
\p sz must ensure the following restrictions based on the mode used: Algorithm | \p sz | Remarks --------: | :----------: | :----------- ECB | N16 bytes | N > 0 CBC | N16 bytes | N > 0 CFB | N16 bytes | N > 0 OFB | N16 bytes | N > 0 XTS | >= 16 bytes | none CTR | > 0 bytes | none
The restrictions above are applicable ONLY for the last chunk of the data to be processed when doing a partial operation. \p sz must be a multiple of block size(16 bytes) when doing a partial operation(besides last chunk). pre - one of the crm_blkcipher_create_*() functions must be called first
Parameters
Param | Description |
---|---|
c | block cipher operation context |
datain | data to be encrypted or decrypted, with size \p sz |
sz | size, in bytes, of data to be decrypted |
dataout | encrypted or decrypted data, must have \p sz bytes |
Returns
CRM_OK CRM_ERR_UNITIALIZED_OBJ CRM_ERR_TOO_BIG
CRM_BLKCIPHER_RUN
C
typedef int (*FUNC_CRM_BLKCIPHER_RUN)(struct crmblkcipher *c); #define CRM_BLKCIPHER_RUN ((FUNC_CRM_BLKCIPHER_RUN)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_BLKCIPHER_RUN)))
Description
Starts a block cipher operation.
This function is used to start an encryption or a decryption based on what create function was used, crm_blkcipher_create_enc() or crm_blkcipher_create_dec(). 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_blkcipher_status() or CRM_BLKCIPHER_WAIT(). pre - CRM_BLKCIPHER_CRYPT() function must be called first
Parameters
Param | Description |
---|---|
c | block cipher operation context |
Returns
CRM_OK CRM_ERR_UNITIALIZED_OBJ CRM_ERR_TOO_SMALL CRM_ERR_WRONG_SIZE_GRANULARITY
CRM_BLKCIPHER_RESUME_STATE
C
typedef int (*FUNC_CRM_BLKCIPHER_RESUME_STATE)(struct crmblkcipher *c); #define CRM_BLKCIPHER_RESUME_STATE ((FUNC_CRM_BLKCIPHER_RESUME_STATE)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_BLKCIPHER_RESUME_STATE)))
Description
Resumes AES operation in context-saving.
This function shall be called when using context-saving to load the state that was previously saved by crm_blkcipher_save_state() in the crmblkcipher operation context \p c. It must be called with the same crmblkcipher operation context \p c that was used with crm_crmblkcipher_save_state(). It will reserve all hardware resources required to run the partial AES operation. Previously used mode and direction are already stored in crmblkcipher \p c. After successful execution of this function, the context \p c can be passed to any of the block cipher functions, except the crm_blkcipher_create_() functions. pre - crm_blkcipher_create_aes() and crm_blkcipher_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_blkchiper_crypt() or crm_blkcipher_save_state(). remark - the user must not change the key until all parts of the message to be encrypted/decrypted are processed. remark - AES ECB does not support context saving.
Parameters
Param | Description |
---|---|
c | block cipher 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_BLKCIPHER_SAVE_STATE
C
typedef int (*FUNC_CRM_BLKCIPHER_SAVE_STATE)(struct crmblkcipher *c); #define CRM_BLKCIPHER_SAVE_STATE ((FUNC_CRM_BLKCIPHER_SAVE_STATE)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_BLKCIPHER_SAVE_STATE)))
Description
Starts a partial block cipher operation.
This function is used to start a partial encryption or decryption of \p datain. The function will return immediately. The partial result will be transfered to \p dataout only after the operation is successfully completed. The user shall check operation status with crm_blkcipher_status() or CRM_BLKCIPHER_WAIT(). pre - CRM_BLKCIPHER_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 | block cipher operation context |
Returns
CRM_OK CRM_ERR_UNITIALIZED_OBJ CRM_ERR_CONTEXT_SAVING_NOT_SUPPORTED
CRM_BLKCIPHER_WAIT
C
typedef int (*FUNC_CRM_BLKCIPHER_WAIT)(struct crmblkcipher *c); #define CRM_BLKCIPHER_WAIT ((FUNC_CRM_BLKCIPHER_WAIT)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_BLKCIPHER_WAIT)))
Description
Waits until the given block cipher operation has finished
This function returns when the block cipher 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_blkcipher_create_*() is used. remark - this function is blocking until operation finishes.
Parameters
Param | Description |
---|---|
c | block cipher operation context |
See
crm_blkcipher_status()
Returns
CRM_OK CRM_ERR_UNITIALIZED_OBJ CRM_ERR_CONTEXT_SAVING_NOT_SUPPORTED
CRM_BLKCIPHER_STATUS
C
typedef int (*FUNC_CRM_BLKCIPHER_STATUS)(struct crmblkcipher *c); #define CRM_BLKCIPHER_STATUS ((FUNC_CRM_BLKCIPHER_STATUS)(*(uint32_t *)(API_TABLE_BASE_ADDRESS + ATO_CRM_BLKCIPHER_STATUS)))
Description
Returns the block cipher operation status.
If the operation is still ongoing, return ::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 block cipher operation has ended and all resources used by block cipher operation context \p c have been released. In this case, \p c cannot be used for a new operation until one of the crm_blkcipher_create_*() functions is called again. pre - CRM_BLKCIPHER_CRYPT and CRM_BLKCIPHER_RUN() functions must be called first
Parameters
Param | Description |
---|---|
c | block cipher operation context |
See
crm_blkcipher_status()
Returns
CRM_OK CRM_ERR_UNITIALIZED_OBJ CRM_ERR_HW_PROCESSING CRM_ERR_DMA_FAILED