SDP driver APIs. More...
Data Structures | |
| struct | sdp_crypto_ctx_t |
| SDP AES context structure. More... | |
| struct | sdp_dma_ctx_t |
| SDP DMA context. More... | |
| struct | sdp_hash_ctx_t |
| SDP HASH context. More... | |
Macros | |
| #define | HASH_BLOCK_SIZE (64U) |
| #define | AES_BLOCK_SIZE (16U) |
| #define | AES_128_KEY_SIZE (0x10U) |
| #define | AES_256_KEY_SIZE (0x20U) |
| #define | SM4_BLOCK_SIZE (AES_BLOCK_SIZE) |
| #define | SM4_KEY_SIZE (AES_128_KEY_SIZE) |
| #define | SDP_PKT_CTRL_DERSEMA_MASK (1U << 2) |
| Bitfield definitions for the PKT_CTRL. More... | |
| #define | SDP_PKT_CTRL_CHAIN_MASK (1U << 3) |
| #define | SDP_PKT_CTRL_HASHINIT_MASK (1U << 4) |
| #define | SDP_PKT_CTRL_HASHFINISH_MASK (1U << 5) |
| #define | SDP_PKT_CTRL_CIPHIV_MASK (1U << 6) |
Typedefs | |
| typedef sdp_crypto_key_bits_t | sdp_aes_key_bits_t |
| typedef sdp_crypto_key_bits_t | sdp_sm4_key_bits_t |
| typedef sdp_crypto_op_t | sdp_aes_op_t |
| typedef struct _sdp_packet_struct | sdp_pkt_struct_t |
| SDP packet data structure. More... | |
| typedef sdp_crypto_ctx_t | sdp_aes_ctx_t |
Enumerations | |
| enum | sdp_crypto_key_bits_t { sdp_aes_keybits_128 = 0 , sdp_aes_keybits_256 = 1 } |
| SDP AES key bit options. More... | |
| enum | sdp_crypto_op_t { sdp_aes_op_encrypt , sdp_aes_op_decrypt } |
| Crypto operation option. More... | |
| enum | sdp_crypto_alg_t { sdp_crypto_alg_aes } |
| SDP Crypto algorithms. More... | |
| enum | sdp_hash_alg_t { sdp_hash_alg_sha1 = 0 , sdp_hash_alg_crc32 = 1 , sdp_hash_alg_sha256 = 2 , sdp_hash_alg_max = sdp_hash_alg_sha256 } |
| SDP HASH algorithm definitions. More... | |
| enum | { status_sdp_no_crypto_support = ((uint32_t)( status_group_sdp )*1000U + (uint32_t)( 0 )) , status_sdp_no_hash_support = ((uint32_t)( status_group_sdp )*1000U + (uint32_t)( 1 )) , status_sdp_invalid_key_src = ((uint32_t)( status_group_sdp )*1000U + (uint32_t)( 2 )) , status_sdp_error_packet = ((uint32_t)( status_group_sdp )*1000U + (uint32_t)( 3 )) , status_sdp_aes_busy = ((uint32_t)( status_group_sdp )*1000U + (uint32_t)( 4 )) , status_sdp_hash_busy = ((uint32_t)( status_group_sdp )*1000U + (uint32_t)( 5 )) , status_sdp_error_setup = ((uint32_t)( status_group_sdp )*1000U + (uint32_t)( 6 )) , status_sdp_error_src = ((uint32_t)( status_group_sdp )*1000U + (uint32_t)( 7 )) , status_sdp_error_dst = ((uint32_t)( status_group_sdp )*1000U + (uint32_t)( 8 )) , status_sdp_error_hash = ((uint32_t)( status_group_sdp )*1000U + (uint32_t)( 9 )) , status_sdp_error_chain = ((uint32_t)( status_group_sdp )*1000U + (uint32_t)( 10 )) , status_sdp_error_invalid_mac = ((uint32_t)( status_group_sdp )*1000U + (uint32_t)( 11 )) , status_sdp_invalid_alg = ((uint32_t)( status_group_sdp )*1000U + (uint32_t)( 12 )) } |
| SDP error status definitions. More... | |
Functions | |
| hpm_stat_t | sdp_init (SDP_Type *base) |
| Initialize the SDP controller. More... | |
| hpm_stat_t | sdp_deinit (SDP_Type *base) |
| De-initialize the SDP controller. More... | |
| hpm_stat_t | sdp_aes_set_key (SDP_Type *base, sdp_aes_ctx_t *aes_ctx, const uint8_t *key, sdp_aes_key_bits_t key_bits, uint32_t key_idx) |
| Set the AES key for the SDP AES operation. More... | |
| hpm_stat_t | sdp_aes_crypt_ecb (SDP_Type *base, sdp_aes_ctx_t *aes_ctx, sdp_aes_op_t op, uint32_t len, const uint8_t *in, uint8_t *out) |
| Perform the basic AES ECB operation. More... | |
| hpm_stat_t | sdp_aes_crypt_cbc (SDP_Type *base, sdp_aes_ctx_t *aes_ctx, sdp_aes_op_t op, uint32_t length, const uint8_t iv[16], const uint8_t *input, uint8_t *output) |
| Perform the AES CBC operation. More... | |
| hpm_stat_t | sdp_aes_crypt_ctr (SDP_Type *base, sdp_aes_ctx_t *aes_ctx, uint8_t *nonce_counter, uint8_t *input, uint8_t *output, uint32_t length) |
| Perform the AES-CTR operation See NIST Special Publication800-38A for more details. More... | |
| hpm_stat_t | sdp_aes_ccm_generate_encrypt (SDP_Type *base, sdp_aes_ctx_t *aes_ctx, uint32_t input_len, const uint8_t *iv, uint32_t iv_len, const uint8_t *aad, uint32_t aad_len, const uint8_t *input, uint8_t *output, uint8_t *tag, uint32_t tag_len) |
| Perform the AES-CCM generate and encrypt See NIST Special Publication 800-38C for more details. More... | |
| hpm_stat_t | sdp_aes_ccm_decrypt_verify (SDP_Type *base, sdp_aes_ctx_t *aes_ctx, uint32_t input_len, const uint8_t *iv, uint32_t iv_len, const uint8_t *aad, uint32_t aad_len, const uint8_t *input, uint8_t *output, const uint8_t *tag, uint32_t tag_len) |
| Perform the AES-CCM decrypt and verify See NIST Special Publication 800-38C for more details. More... | |
| hpm_stat_t | sdp_memcpy (SDP_Type *base, sdp_dma_ctx_t *sdp_ctx, void *dst, const void *src, uint32_t length) |
| Perform the DMA accelerated memcpy. More... | |
| hpm_stat_t | sdp_memset (SDP_Type *base, sdp_dma_ctx_t *sdp_ctx, void *dst, uint8_t pattern, uint32_t length) |
| Perform the DMA accelerated memset. More... | |
| hpm_stat_t | sdp_hash_init (SDP_Type *base, sdp_hash_ctx_t *hash_ctx, sdp_hash_alg_t alg) |
| Initialize the HASH engine. More... | |
| hpm_stat_t | sdp_hash_update (SDP_Type *base, sdp_hash_ctx_t *hash_ctx, const uint8_t *data, uint32_t length) |
| Compute the HASH digest. More... | |
| hpm_stat_t | sdp_hash_finish (SDP_Type *base, sdp_hash_ctx_t *hash_ctx, uint8_t *digest) |
| Finish the HASH calculation and output the digest. More... | |
| hpm_stat_t | sdp_wait_done (SDP_Type *base) |
| Wait until the SDP operation gets done. More... | |
SDP driver APIs.
| #define AES_128_KEY_SIZE (0x10U) |
#include <drivers/inc/hpm_sdp_drv.h>
AES 128-bit key size in bytes
| #define AES_256_KEY_SIZE (0x20U) |
#include <drivers/inc/hpm_sdp_drv.h>
AES 256-bit key size in bytes
| #define AES_BLOCK_SIZE (16U) |
#include <drivers/inc/hpm_sdp_drv.h>
AES block size in bytes
| #define HASH_BLOCK_SIZE (64U) |
#include <drivers/inc/hpm_sdp_drv.h>
Hash block size in bytes
| #define SDP_PKT_CTRL_CHAIN_MASK (1U << 3) |
#include <drivers/inc/hpm_sdp_drv.h>
| #define SDP_PKT_CTRL_CIPHIV_MASK (1U << 6) |
#include <drivers/inc/hpm_sdp_drv.h>
| #define SDP_PKT_CTRL_DERSEMA_MASK (1U << 2) |
#include <drivers/inc/hpm_sdp_drv.h>
Bitfield definitions for the PKT_CTRL.
| #define SDP_PKT_CTRL_HASHFINISH_MASK (1U << 5) |
#include <drivers/inc/hpm_sdp_drv.h>
| #define SDP_PKT_CTRL_HASHINIT_MASK (1U << 4) |
#include <drivers/inc/hpm_sdp_drv.h>
| #define SM4_BLOCK_SIZE (AES_BLOCK_SIZE) |
#include <drivers/inc/hpm_sdp_drv.h>
SM4 block size in bytes
| #define SM4_KEY_SIZE (AES_128_KEY_SIZE) |
#include <drivers/inc/hpm_sdp_drv.h>
SM4 Key size in bytes
| typedef sdp_crypto_ctx_t sdp_aes_ctx_t |
#include <drivers/inc/hpm_sdp_drv.h>
#include <drivers/inc/hpm_sdp_drv.h>
| typedef sdp_crypto_op_t sdp_aes_op_t |
#include <drivers/inc/hpm_sdp_drv.h>
| typedef struct _sdp_packet_struct sdp_pkt_struct_t |
#include <drivers/inc/hpm_sdp_drv.h>
SDP packet data structure.
#include <drivers/inc/hpm_sdp_drv.h>
| anonymous enum |
#include <drivers/inc/hpm_sdp_drv.h>
SDP error status definitions.
| enum sdp_crypto_alg_t |
#include <drivers/inc/hpm_sdp_drv.h>
SDP AES key bit options.
| Enumerator | |
|---|---|
| sdp_aes_keybits_128 | 128 bit AES key |
| sdp_aes_keybits_256 | 256 bit AES key |
| enum sdp_crypto_op_t |
#include <drivers/inc/hpm_sdp_drv.h>
Crypto operation option.
| Enumerator | |
|---|---|
| sdp_aes_op_encrypt | AES Encrypt operation |
| sdp_aes_op_decrypt | AES Decrypt operation |
| enum sdp_hash_alg_t |
#include <drivers/inc/hpm_sdp_drv.h>
SDP HASH algorithm definitions.
| Enumerator | |
|---|---|
| sdp_hash_alg_sha1 | SDP SHA1 |
| sdp_hash_alg_crc32 | SDP CRC32 |
| sdp_hash_alg_sha256 | SDP SHA256 |
| sdp_hash_alg_max | |
| hpm_stat_t sdp_aes_ccm_decrypt_verify | ( | SDP_Type * | base, |
| sdp_aes_ctx_t * | aes_ctx, | ||
| uint32_t | input_len, | ||
| const uint8_t * | iv, | ||
| uint32_t | iv_len, | ||
| const uint8_t * | aad, | ||
| uint32_t | aad_len, | ||
| const uint8_t * | input, | ||
| uint8_t * | output, | ||
| const uint8_t * | tag, | ||
| uint32_t | tag_len | ||
| ) |
#include <drivers/inc/hpm_sdp_drv.h>
Perform the AES-CCM decrypt and verify See NIST Special Publication 800-38C for more details.
| [in] | base | SDP base address |
| [in] | aes_ctx | AES operation context |
| [in] | input_len | Input data length in bytes |
| [in] | iv | Initial vector |
| [in] | iv_len | Initial vector length in bytes |
| [in] | aad | Additional Authentication data |
| [in] | aad_len | Additional authentication data size |
| [in] | input | Input data buffer |
| [out] | output | Output buffer |
| [in] | tag | MAC buffer |
| [in] | tag_len | Tag/MAC size in bytes |
| API | execution status. |
| hpm_stat_t sdp_aes_ccm_generate_encrypt | ( | SDP_Type * | base, |
| sdp_aes_ctx_t * | aes_ctx, | ||
| uint32_t | input_len, | ||
| const uint8_t * | iv, | ||
| uint32_t | iv_len, | ||
| const uint8_t * | aad, | ||
| uint32_t | aad_len, | ||
| const uint8_t * | input, | ||
| uint8_t * | output, | ||
| uint8_t * | tag, | ||
| uint32_t | tag_len | ||
| ) |
#include <drivers/inc/hpm_sdp_drv.h>
Perform the AES-CCM generate and encrypt See NIST Special Publication 800-38C for more details.
| [in] | base | SDP base address |
| [in] | aes_ctx | AES operation context |
| [in] | input_len | Input data length in bytes |
| [in] | iv | Initial vector |
| [in] | iv_len | Initial vector length in bytes |
| [in] | aad | Additional Authentication data |
| [in] | aad_len | Additional authentication data size |
| [in] | input | Input data buffer |
| [out] | output | Output buffer |
| [out] | tag | MAC buffer |
| [in] | tag_len | Tag/MAC size in bytes |
| API | execution status. |
| hpm_stat_t sdp_aes_crypt_cbc | ( | SDP_Type * | base, |
| sdp_aes_ctx_t * | aes_ctx, | ||
| sdp_aes_op_t | op, | ||
| uint32_t | length, | ||
| const uint8_t | iv[16], | ||
| const uint8_t * | input, | ||
| uint8_t * | output | ||
| ) |
#include <drivers/inc/hpm_sdp_drv.h>
Perform the AES CBC operation.
| [in] | base | SDP base address |
| [in] | aes_ctx | AES operation context |
| [in] | op | AES operation option |
| [in] | length | AES data length in bytes |
| [in] | iv | Initial vector/nonce |
| [in] | input | Input buffer |
| [out] | output | Output buffer |
| API | execution status. |
| hpm_stat_t sdp_aes_crypt_ctr | ( | SDP_Type * | base, |
| sdp_aes_ctx_t * | aes_ctx, | ||
| uint8_t * | nonce_counter, | ||
| uint8_t * | input, | ||
| uint8_t * | output, | ||
| uint32_t | length | ||
| ) |
#include <drivers/inc/hpm_sdp_drv.h>
Perform the AES-CTR operation See NIST Special Publication800-38A for more details.
| [in] | base | SDP base address |
| [in] | aes_ctx | AES operation context |
| [in] | nonce_counter | AES-CTR nounce/counter |
| [in] | input | Input buffer |
| [out] | output | Output buffer |
| [in] | length | Length of data for AES-CTR operation |
| API | execution status. |
| hpm_stat_t sdp_aes_crypt_ecb | ( | SDP_Type * | base, |
| sdp_aes_ctx_t * | aes_ctx, | ||
| sdp_aes_op_t | op, | ||
| uint32_t | len, | ||
| const uint8_t * | in, | ||
| uint8_t * | out | ||
| ) |
#include <drivers/inc/hpm_sdp_drv.h>
Perform the basic AES ECB operation.
| [in] | base | SDP base address |
| [in] | aes_ctx | AES operation context |
| [in] | op | AES operation option |
| [in] | len | AES data length in bytes |
| [in] | in | Input buffer |
| [out] | out | Output buffer |
| API | execution status. |
| hpm_stat_t sdp_aes_set_key | ( | SDP_Type * | base, |
| sdp_aes_ctx_t * | aes_ctx, | ||
| const uint8_t * | key, | ||
| sdp_aes_key_bits_t | key_bits, | ||
| uint32_t | key_idx | ||
| ) |
#include <drivers/inc/hpm_sdp_drv.h>
Set the AES key for the SDP AES operation.
| [in] | base | SDP base address |
| [in] | aes_ctx | AES operation context |
| [in] | key | AES key |
| [in] | key_bits | AES key-bit option |
| [in] | key_idx | AES key index |
| API | execution status. |
| hpm_stat_t sdp_deinit | ( | SDP_Type * | base | ) |
#include <drivers/inc/hpm_sdp_drv.h>
De-initialize the SDP controller.
| [in] | base | SDP base address |
| API | execution status. |
| hpm_stat_t sdp_hash_finish | ( | SDP_Type * | base, |
| sdp_hash_ctx_t * | hash_ctx, | ||
| uint8_t * | digest | ||
| ) |
#include <drivers/inc/hpm_sdp_drv.h>
Finish the HASH calculation and output the digest.
| [in] | base | SDP base address |
| [in] | hash_ctx | HASH operation context |
| [out] | digest | Digest buffer |
| API | execution status. |
| hpm_stat_t sdp_hash_init | ( | SDP_Type * | base, |
| sdp_hash_ctx_t * | hash_ctx, | ||
| sdp_hash_alg_t | alg | ||
| ) |
#include <drivers/inc/hpm_sdp_drv.h>
Initialize the HASH engine.
| [in] | base | SDP base address |
| [in] | hash_ctx | HASH operation context |
| [in] | alg | Hash algorithm |
| API | execution status. status_success or status_invalid_argument |
| hpm_stat_t sdp_hash_update | ( | SDP_Type * | base, |
| sdp_hash_ctx_t * | hash_ctx, | ||
| const uint8_t * | data, | ||
| uint32_t | length | ||
| ) |
#include <drivers/inc/hpm_sdp_drv.h>
Compute the HASH digest.
| [in] | base | SDP base address |
| [in] | hash_ctx | HASH operation context |
| [in] | data | Data for HASH computing |
| [in] | length | Data size for HASH computing |
| API | execution status. |
| hpm_stat_t sdp_init | ( | SDP_Type * | base | ) |
#include <drivers/inc/hpm_sdp_drv.h>
Initialize the SDP controller.
| [in] | base | SDP base address |
| API | execution status. |
| hpm_stat_t sdp_memcpy | ( | SDP_Type * | base, |
| sdp_dma_ctx_t * | sdp_ctx, | ||
| void * | dst, | ||
| const void * | src, | ||
| uint32_t | length | ||
| ) |
#include <drivers/inc/hpm_sdp_drv.h>
Perform the DMA accelerated memcpy.
| [in] | base | SDP base address |
| [in] | sdp_ctx | SDP DMA context |
| [out] | dst | Destination address for memcpy operation |
| [in] | src | Source address for memcpy operation |
| [in] | length | Length of the data to be copied |
| API | execution status. |
| hpm_stat_t sdp_memset | ( | SDP_Type * | base, |
| sdp_dma_ctx_t * | sdp_ctx, | ||
| void * | dst, | ||
| uint8_t | pattern, | ||
| uint32_t | length | ||
| ) |
#include <drivers/inc/hpm_sdp_drv.h>
Perform the DMA accelerated memset.
| [in] | base | SDP base address |
| [in] | sdp_ctx | SDP DMA context |
| [out] | dst | SDP destination address for memset operation |
| [in] | pattern | pattern for memset operation |
| [in] | length | length of the memory for memset operation |
| API | execution status. |
| hpm_stat_t sdp_wait_done | ( | SDP_Type * | base | ) |
#include <drivers/inc/hpm_sdp_drv.h>
Wait until the SDP operation gets done.
| API | execution status. |