Functions | |
| void | hw_aes_crypt (hw_aes_context_t *ctx, uint32_t length, unsigned char iv[AES_IV_LEN], const unsigned char *input, unsigned char *output) |
| void | hw_aes_crypt_cbc (hw_aes_context_t *ctx, hw_aes_mode_type_t mode, uint32_t length, unsigned char iv[AES_IV_LEN], const unsigned char *input, unsigned char *output) |
| void | hw_aes_crypt_cfb (hw_aes_context_t *ctx, hw_aes_mode_type_t mode, uint32_t length, uint32_t *iv_off, unsigned char iv[AES_IV_LEN], const unsigned char *input, unsigned char *output) |
| void | hw_aes_crypt_ctr (hw_aes_context_t *ctx, hw_aes_mode_type_t mode, uint32_t length, unsigned char iv[AES_IV_LEN], const unsigned char *input, unsigned char *output) |
| void | hw_aes_crypt_ecb (hw_aes_context_t *ctx, hw_aes_mode_type_t mode, const unsigned char input[AES_BLOCK_SZ], unsigned char output[AES_BLOCK_SZ]) |
| void | hw_aes_setkey_dec (hw_aes_context_t *ctx, unsigned char *key, uint32_t keysize_bits) |
| void | hw_aes_setkey_enc (hw_aes_context_t *ctx, unsigned char *key, uint32_t keysize_bits) |
| void | hw_des3_set2key (hw_des_context_t *ctx, unsigned char *key) |
| void | hw_des3_set3key (hw_des_context_t *ctx, unsigned char *key) |
| void | hw_des_setkey (hw_des_context_t *ctx, unsigned char *key) |
| WEAK platform_result_t | platform_hwcrypto_aescbc_decrypt_sha256_hmac (uint8_t *crypt_key, uint8_t *crypt_iv, uint32_t crypt_size, uint32_t auth_size, uint8_t *hmac_key, uint32_t hmac_key_len, uint8_t *src, uint8_t *crypt_dest, uint8_t *hash_dest) |
| platform_result_t | platform_hwcrypto_aescbc_encrypt (uint8_t *crypt_key, uint8_t *crypt_iv, uint32_t crypt_size, uint8_t *src, uint8_t *crypt_dest) |
| WEAK platform_result_t | platform_hwcrypto_execute (crypto_cmd_t cmd) |
| platform_result_t | platform_hwcrypto_md5 (const unsigned char *input, uint32_t ilen, unsigned char output[MD5_HASH_SIZE], unsigned char *payload_buffer) |
| platform_result_t | platform_hwcrypto_md5_finish (md5_context_t *ctx, const unsigned char *input, uint32_t ilen, unsigned char output[MD5_HASH_SIZE]) |
| platform_result_t | platform_hwcrypto_md5_hmac (const unsigned char *key, uint32_t keylen, const unsigned char *input, uint32_t ilen, unsigned char output[MD5_HASH_SIZE], unsigned char *payload_buffer) |
| platform_result_t | platform_hwcrypto_md5_hmac_finish (md5_context_t *ctx, uint8_t *input, int32_t ilen, unsigned char output[MD5_HASH_SIZE]) |
| platform_result_t | platform_hwcrypto_md5_hmac_incremental (const unsigned char *key, uint32_t keylen, const unsigned char *input, uint32_t ilen, unsigned char output[MD5_HASH_SIZE]) |
| platform_result_t | platform_hwcrypto_md5_hmac_starts (md5_context_t *ctx, const unsigned char *key, uint32_t keylen) |
| platform_result_t | platform_hwcrypto_md5_hmac_update (md5_context_t *ctx, const unsigned char *input, int32_t ilen) |
| platform_result_t | platform_hwcrypto_md5_incremental (const unsigned char *input, uint32_t ilen, unsigned char output[MD5_HASH_SIZE]) |
| platform_result_t | platform_hwcrypto_md5_starts (md5_context_t *ctx, const unsigned char *input, uint32_t ilen) |
| platform_result_t | platform_hwcrypto_md5_update (md5_context_t *ctx, const unsigned char *input, uint32_t ilen) |
| platform_result_t | platform_hwcrypto_sha1 (const unsigned char *input, uint32_t ilen, unsigned char output[SHA1_HASH_SIZE], unsigned char *payload_buffer) |
| platform_result_t | platform_hwcrypto_sha1_finish (sha1_context_t *ctx, const unsigned char *input, uint32_t ilen, unsigned char output[SHA1_HASH_SIZE]) |
| platform_result_t | platform_hwcrypto_sha1_hmac (const unsigned char *key, uint32_t keylen, const unsigned char *input, uint32_t ilen, unsigned char output[SHA1_HASH_SIZE], unsigned char *payload_buffer) |
| platform_result_t | platform_hwcrypto_sha1_hmac_finish (sha1_context_t *ctx, uint8_t *input, int32_t ilen, unsigned char output[SHA1_HASH_SIZE]) |
| platform_result_t | platform_hwcrypto_sha1_hmac_incremental (const unsigned char *key, uint32_t keylen, const unsigned char *input, uint32_t ilen, unsigned char output[SHA1_HASH_SIZE]) |
| platform_result_t | platform_hwcrypto_sha1_hmac_starts (sha1_context_t *ctx, const unsigned char *key, uint32_t keylen) |
| platform_result_t | platform_hwcrypto_sha1_hmac_update (sha1_context_t *ctx, const unsigned char *input, int32_t ilen) |
| platform_result_t | platform_hwcrypto_sha1_incremental (const unsigned char *input, uint32_t ilen, unsigned char output[SHA1_HASH_SIZE]) |
| platform_result_t | platform_hwcrypto_sha1_starts (sha1_context_t *ctx, const unsigned char *input, uint32_t ilen) |
| platform_result_t | platform_hwcrypto_sha1_update (sha1_context_t *ctx, const unsigned char *input, uint32_t ilen) |
| platform_result_t | platform_hwcrypto_sha2 (const unsigned char *input, uint32_t ilen, unsigned char output[SHA256_HASH_SIZE], unsigned char *payload_buffer, int32_t is224) |
| WEAK platform_result_t | platform_hwcrypto_sha256_hash (uint8_t *source, uint32_t size, uint8_t *output_payload_buffer, uint8_t *hash_output) |
| WEAK platform_result_t | platform_hwcrypto_sha256_hmac (uint8_t *hmac_key, uint32_t keysize, uint8_t *source, uint32_t size, uint8_t *payload_buffer, uint8_t *hash_output) |
| platform_result_t | platform_hwcrypto_sha256_hmac_aescbc_encrypt (uint8_t *crypt_key, uint8_t *crypt_iv, uint32_t crypt_size, uint32_t auth_size, uint8_t *hmac_key, uint32_t hmac_key_len, uint8_t *src, uint8_t *crypt_dest, uint8_t *hash_dest) |
| platform_result_t | platform_hwcrypto_sha2_finish (sha256_context_t *ctx, const unsigned char *input, uint32_t ilen, unsigned char output[SHA256_HASH_SIZE]) |
| platform_result_t | platform_hwcrypto_sha2_hmac (const unsigned char *key, uint32_t keylen, const unsigned char *input, uint32_t ilen, unsigned char output[SHA256_HASH_SIZE], unsigned char *payload_buffer, int32_t is224) |
| platform_result_t | platform_hwcrypto_sha2_hmac_finish (sha256_context_t *ctx, uint8_t *input, int32_t ilen, unsigned char output[SHA256_HASH_SIZE]) |
| platform_result_t | platform_hwcrypto_sha2_hmac_incremental (const unsigned char *key, uint32_t keylen, const unsigned char *input, uint32_t ilen, unsigned char output[SHA256_HASH_SIZE], int32_t is224) |
| platform_result_t | platform_hwcrypto_sha2_hmac_starts (sha256_context_t *ctx, const unsigned char *key, uint32_t keylen, int32_t is224) |
| platform_result_t | platform_hwcrypto_sha2_hmac_update (sha256_context_t *ctx, const unsigned char *input, int32_t ilen) |
| platform_result_t | platform_hwcrypto_sha2_incremental (const unsigned char *input, uint32_t ilen, unsigned char output[SHA256_HASH_SIZE], int32_t is224) |
| platform_result_t | platform_hwcrypto_sha2_starts (sha256_context_t *ctx, const unsigned char *input, uint32_t ilen, int32_t is224) |
| platform_result_t | platform_hwcrypto_sha2_update (sha256_context_t *ctx, const unsigned char *input, uint32_t ilen) |
Broadcom SPU-M Interface
| void hw_aes_crypt | ( | hw_aes_context_t * | ctx, |
| uint32_t | length, | ||
| unsigned char | iv[AES_IV_LEN], | ||
| const unsigned char * | input, | ||
| unsigned char * | output ) |
AES CBC Encryption/Decryption
| [in] | ctx | hw_aes_context |
| [in] | length | length of input data |
| [in] | iv | aes_iv used for AES |
| [in] | input | input data |
| [out] | output | output of the AES encryption/decryption |
| void hw_aes_crypt_cbc | ( | hw_aes_context_t * | ctx, |
| hw_aes_mode_type_t | mode, | ||
| uint32_t | length, | ||
| unsigned char | iv[AES_IV_LEN], | ||
| const unsigned char * | input, | ||
| unsigned char * | output ) |
AES CBC Encryption/Decryption
| [in] | ctx | hw_aes_context |
| [in] | mode | mode HW_AES_ENCRYPT/HW_AES_DECRYPT |
| [in] | length | length of input data |
| [in] | iv | aes_iv used for AES |
| [in] | input | input data |
| [out] | output | output of the AES encryption/decryption |
| void hw_aes_crypt_cfb | ( | hw_aes_context_t * | ctx, |
| hw_aes_mode_type_t | mode, | ||
| uint32_t | length, | ||
| uint32_t * | iv_off, | ||
| unsigned char | iv[AES_IV_LEN], | ||
| const unsigned char * | input, | ||
| unsigned char * | output ) |
AES CFB Encryption/Decryption
| [in] | ctx | hw_aes_context |
| [in] | mode | mode HW_AES_ENCRYPT/HW_AES_DECRYPT |
| [in] | length | length of input data |
| [in] | iv | aes_iv used for AES |
| [in] | input | input data |
| [out] | output | output of the AES encryption/decryption |
| void hw_aes_crypt_ctr | ( | hw_aes_context_t * | ctx, |
| hw_aes_mode_type_t | mode, | ||
| uint32_t | length, | ||
| unsigned char | iv[AES_IV_LEN], | ||
| const unsigned char * | input, | ||
| unsigned char * | output ) |
AES CTR Encryption/Decryption
| [in] | ctx | hw_aes_context |
| [in] | mode | mode HW_AES_ENCRYPT/HW_AES_DECRYPT |
| [in] | length | length of input data |
| [in] | iv | aes_iv used for AES |
| [in] | input | input data |
| [out] | output | output of the AES encryption/decryption |
| void hw_aes_crypt_ecb | ( | hw_aes_context_t * | ctx, |
| hw_aes_mode_type_t | mode, | ||
| const unsigned char | input[AES_BLOCK_SZ], | ||
| unsigned char | output[AES_BLOCK_SZ] ) |
AES ECB Encryption/Decryption
| [in] | ctx | hw_aes_context |
| [in] | mode | mode HW_AES_ENCRYPT/HW_AES_DECRYPT |
| [in] | length | length of input data |
| [in] | iv | aes_iv used for AES |
| [in] | input | input data of size AES_BLOCK_SIZE |
| [out] | output | output of the AES encryption/decryption |
| void hw_aes_setkey_dec | ( | hw_aes_context_t * | ctx, |
| unsigned char * | key, | ||
| uint32_t | keysize_bits ) |
Populate the hw_aes_context_t with key and keysize
| [in] | ctx | |
| [in] | key | |
| [in] | keysize_bits |
| void hw_aes_setkey_enc | ( | hw_aes_context_t * | ctx, |
| unsigned char * | key, | ||
| uint32_t | keysize_bits ) |
Populate the hw_aes_context_t with key and keysize
| [in] | ctx | |
| [in] | key | |
| [in] | keysize_bits |
| void hw_des3_set2key | ( | hw_des_context_t * | ctx, |
| unsigned char * | key ) |
DES3 112 bit Key encryption/decryption K3 = K1
| [in] | ctx | |
| [in] | key |
| void hw_des3_set3key | ( | hw_des_context_t * | ctx, |
| unsigned char * | key ) |
DES3 168 bit Key encryption/decryption
| [in] | ctx | |
| [in] | key |
| void hw_des_setkey | ( | hw_des_context_t * | ctx, |
| unsigned char * | key ) |
DES/DES3 56 bit Key encryption/decryption K1=K2=K3
| [in] | ctx | |
| [in] | key |
| WEAK platform_result_t platform_hwcrypto_aescbc_decrypt_sha256_hmac | ( | uint8_t * | crypt_key, |
| uint8_t * | crypt_iv, | ||
| uint32_t | crypt_size, | ||
| uint32_t | auth_size, | ||
| uint8_t * | hmac_key, | ||
| uint32_t | hmac_key_len, | ||
| uint8_t * | src, | ||
| uint8_t * | crypt_dest, | ||
| uint8_t * | hash_dest ) |
Combo AES128 CBC decryption + SHA256HMAC Authentication For data size < ( HWCRYPTO_MAX_PAYLOAD_SIZE )
| [in] | crypt_key | AES key |
| [in] | crypt_iv | AES IV |
| [in] | crypt_size | Size of data to be decrypted |
| [in] | auth_size | Size of data to be authenticated |
| [in] | hmac_key | HMAC key |
| [in] | hmac_key_len | HMAC key length |
| [in] | src | input data |
| [out] | crypt_dest | Result of decryption |
| [out] | hash_dest | Result of authentication |
| platform_result_t platform_hwcrypto_aescbc_encrypt | ( | uint8_t * | crypt_key, |
| uint8_t * | crypt_iv, | ||
| uint32_t | crypt_size, | ||
| uint8_t * | src, | ||
| uint8_t * | crypt_dest ) |
AES128 CBC encryption Deprecated, use hw_aes_crypt_cbc() instead For data size < ( HWCRYPTO_MAX_PAYLOAD_SIZE )
| [in] | crypt_key | AES key |
| [in] | crypt_iv | AES IV |
| [in] | crypt_size | Size of data to be encrypted |
| [in] | src | input data |
| [out] | crypt_dest | Result of encryption |
| WEAK platform_result_t platform_hwcrypto_execute | ( | crypto_cmd_t | cmd | ) |
Creates a SPU-M (HWCrypto) Message and Transfers it to SPU-M using M2MDma. Results of the HWCrypto Operation are stored in the buffers specified in cmd.output
| [in] | cmd | : HWCrypto command |
| platform_result_t platform_hwcrypto_md5 | ( | const unsigned char * | input, |
| uint32_t | ilen, | ||
| unsigned char | hash_output[MD5_HASH_SIZE], | ||
| unsigned char * | payload_buffer ) |
MD5
| [in] | input | input data |
| [in] | ilen | size of data to be authenticated |
| [out] | output | buffer to hold result of authentication |
| platform_result_t platform_hwcrypto_md5_finish | ( | md5_context_t * | ctx, |
| const unsigned char * | input, | ||
| uint32_t | ilen, | ||
| unsigned char | output[MD5_HASH_SIZE] ) |
MD5 FINISH
| [in] | ctx | md5_context containing the previous sha result |
| [in] | input | input data |
| [in] | ilen | size of data to be authenticated |
| [out] | output | buffer to hold result of authentication |
| platform_result_t platform_hwcrypto_md5_hmac | ( | const unsigned char * | key, |
| uint32_t | keylen, | ||
| const unsigned char * | input, | ||
| uint32_t | ilen, | ||
| unsigned char | output[MD5_HASH_SIZE], | ||
| unsigned char * | payload_buffer ) |
MD5HMAC Authentication
| [in] | key | HMAC key |
| [in] | keylen | HMAC key length |
| [in] | input | input data |
| [in] | ilen | size of data to be authenticated |
| [out] | output | buffer to hold result of authentication |
| platform_result_t platform_hwcrypto_md5_hmac_finish | ( | md5_context_t * | ctx, |
| uint8_t * | input, | ||
| int32_t | ilen, | ||
| unsigned char | output[MD5_HASH_SIZE] ) |
MD5 HMAC FINISH
| [in] | ctx | md5_context containing the previous sha result |
| [in] | input | input data |
| [in] | ilen | size of data to be authenticated |
| [out] | output | buffer to hold result of authentication |
| platform_result_t platform_hwcrypto_md5_hmac_incremental | ( | const unsigned char * | key, |
| uint32_t | keylen, | ||
| const unsigned char * | input, | ||
| uint32_t | ilen, | ||
| unsigned char | output[MD5_HASH_SIZE] ) |
MD5HMAC Authentication For lengths > HWCRYPTO_MAX_PAYLOAD_SIZE
| [in] | key | HMAC key |
| [in] | keylen | HMAC key length |
| [in] | input | input data |
| [in] | ilen | size of data to be authenticated |
| [out] | output | buffer to hold result of authentication |
SPU-M does not support MD5 HMAC of > 64K , but it supports MD5 Hash for > 64K data So HMAC is computed by using Hash as described below. HMAC = Hash(key XOR opad || HASH(key XOR ipad || data)) (|| -> append, ipad -> 64 byte array of 0x3C, opad -> 64 byte array of 0x5c ) InnexHashContext -> key XOR ipad OuterHashContext -> key XOR opad
For Details Refer to : APPENDIX B: Summary of Hash Modes and 3.4.1 : Code authentication Using Incremental Hash operation
HWcrypto Outputs the PAYLOAD + HASH RESULT ctx->payload_buffer has the output payload output has the HASH result in case of init/updt/final
| platform_result_t platform_hwcrypto_md5_hmac_starts | ( | md5_context_t * | ctx, |
| const unsigned char * | key, | ||
| uint32_t | keylen ) |
MD5 HMAC INIT Calculates HASH(key XOR ipad) HASH(key XOR ipad || data)
| [in] | ctx | md5_context containing the previous sha result HWcrypto Outputs the PAYLOAD + HASH RESULT ctx->payload_buffer should be initialized to point to a buffer big enough to contain the input payload |
| [in] | key | HMAC key |
| [in] | keylen | HMAC key length |
The result of hash is stored in ctx->state
| platform_result_t platform_hwcrypto_md5_hmac_update | ( | md5_context_t * | ctx, |
| const unsigned char * | input, | ||
| int32_t | ilen ) |
MD5 HMAC UPDATE HASH(key XOR ipad || data) @Assumption : input_len is multiple of 64
| platform_result_t platform_hwcrypto_md5_incremental | ( | const unsigned char * | input, |
| uint32_t | ilen, | ||
| unsigned char | output[MD5_HASH_SIZE] ) |
SPU-M (HWCrypto Engine) can only hash HWCRYPTO_MAX_PAYLOAD_SIZE payload at a time. for larger payloads, divide the hash into HASH_INIT, HASH_UPDT, HASH_FINISH. SPU-M User guide Rev0.31 Page 41 Section 3.4.1
| [in] | input | pointer to input data/payload |
| [in] | ilen | length of input data/payload |
| [out] | output | buffer to store output data |
| platform_result_t platform_hwcrypto_md5_starts | ( | md5_context_t * | ctx, |
| const unsigned char * | input, | ||
| uint32_t | ilen ) |
MD5 INIT @Assumption : input_len is multiple of 64
| [in] | ctx | md5_context HWcrypto Outputs the PAYLOAD + HASH RESULT ctx->payload_buffer should be initialized to point to a buffer big enough to contain the input payload |
| [in] | input | input data |
| [in] | ilen | size of data to be authenticated |
The result of hash is stored in ctx->state
| platform_result_t platform_hwcrypto_md5_update | ( | md5_context_t * | ctx, |
| const unsigned char * | input, | ||
| uint32_t | ilen ) |
MD5 UPDATE @Assumption : input_len is multiple of 64
| [in] | ctx | md5_context containing the previous sha result |
| [in] | input | input data |
| [in] | ilen | size of data to be authenticated |
The result of hash is stored in ctx->state
| platform_result_t platform_hwcrypto_sha1 | ( | const unsigned char * | input, |
| uint32_t | ilen, | ||
| unsigned char | hash_output[SHA1_HASH_SIZE], | ||
| unsigned char * | payload_buffer ) |
SHA1
| [in] | input | input data |
| [in] | ilen | size of data to be authenticated |
| [out] | output | buffer to hold result of authentication |
| platform_result_t platform_hwcrypto_sha1_finish | ( | sha1_context_t * | ctx, |
| const unsigned char * | input, | ||
| uint32_t | ilen, | ||
| unsigned char | output[SHA1_HASH_SIZE] ) |
SHA1 FINISH
| [in] | ctx | sha1_context containing the previous sha result |
| [in] | input | input data |
| [in] | ilen | size of data to be authenticated |
| [out] | output | buffer to hold result of authentication |
| platform_result_t platform_hwcrypto_sha1_hmac | ( | const unsigned char * | key, |
| uint32_t | keylen, | ||
| const unsigned char * | input, | ||
| uint32_t | ilen, | ||
| unsigned char | output[SHA1_HASH_SIZE], | ||
| unsigned char * | payload_buffer ) |
SHA1HMAC Authentication
| [in] | key | HMAC key |
| [in] | keylen | HMAC key length |
| [in] | input | input data |
| [in] | ilen | size of data to be authenticated |
| [out] | output | buffer to hold result of authentication |
| platform_result_t platform_hwcrypto_sha1_hmac_finish | ( | sha1_context_t * | ctx, |
| uint8_t * | input, | ||
| int32_t | ilen, | ||
| unsigned char | output[SHA1_HASH_SIZE] ) |
SHA1 HMAC FINISH
| [in] | ctx | sha1_context containing the previous sha result |
| [in] | input | input data |
| [in] | ilen | size of data to be authenticated |
| [out] | output | buffer to hold result of authentication |
| platform_result_t platform_hwcrypto_sha1_hmac_incremental | ( | const unsigned char * | key, |
| uint32_t | keylen, | ||
| const unsigned char * | input, | ||
| uint32_t | ilen, | ||
| unsigned char | output[SHA1_HASH_SIZE] ) |
SHA1HMAC Authentication For lengths > HWCRYPTO_MAX_PAYLOAD_SIZE
| [in] | key | HMAC key |
| [in] | keylen | HMAC key length |
| [in] | input | input data |
| [in] | ilen | size of data to be authenticated |
| [out] | output | buffer to hold result of authentication |
SPU-M does not support SHA-1 HMAC of > 64K , but it supports SHA-1 Hash for > 64K data So HMAC is computed by using Hash as described below. HMAC = Hash(key XOR opad || HASH(key XOR ipad || data)) (|| -> append, ipad -> 64 byte array of 0x3C, opad -> 64 byte array of 0x5c ) InnexHashContext -> key XOR ipad OuterHashContext -> key XOR opad
For Details Refer to : APPENDIX B: Summary of Hash Modes and 3.4.1 : Code authentication Using Incremental Hash operation
HWcrypto Outputs the PAYLOAD + HASH RESULT ctx->payload_buffer has the output payload output has the HASH result in case of init/updt/final
| platform_result_t platform_hwcrypto_sha1_hmac_starts | ( | sha1_context_t * | ctx, |
| const unsigned char * | key, | ||
| uint32_t | keylen ) |
SHA1 HMAC INIT Calculates HASH(key XOR ipad) HASH(key XOR ipad || data)
| [in] | ctx | sha1_context containing the previous sha result HWcrypto Outputs the PAYLOAD + HASH RESULT ctx->payload_buffer should be initialized to point to a buffer big enough to contain the input payload |
| [in] | key | HMAC key |
| [in] | keylen | HMAC key length |
The result of hash is stored in ctx->state
| platform_result_t platform_hwcrypto_sha1_hmac_update | ( | sha1_context_t * | ctx, |
| const unsigned char * | input, | ||
| int32_t | ilen ) |
SHA1 HMAC UPDATE HASH(key XOR ipad || data) @Assumption : input_len is multiple of 64
| platform_result_t platform_hwcrypto_sha1_incremental | ( | const unsigned char * | input, |
| uint32_t | ilen, | ||
| unsigned char | output[SHA1_HASH_SIZE] ) |
SPU-M (HWCrypto Engine) can only hash HWCRYPTO_MAX_PAYLOAD_SIZE payload at a time. for larger payloads, divide the hash into HASH_INIT, HASH_UPDT, HASH_FINISH. SPU-M User guide Rev0.31 Page 41 Section 3.4.1
| [in] | input | pointer to input data/payload |
| [in] | ilen | length of input data/payload |
| [out] | output | buffer to store output data |
| platform_result_t platform_hwcrypto_sha1_starts | ( | sha1_context_t * | ctx, |
| const unsigned char * | input, | ||
| uint32_t | ilen ) |
SHA1 INIT @Assumption : input_len is multiple of 64
| [in] | ctx | sha1_context HWcrypto Outputs the PAYLOAD + HASH RESULT ctx->payload_buffer should be initialized to point to a buffer big enough to contain the input payload |
| [in] | input | input data |
| [in] | ilen | size of data to be authenticated |
The result of hash is stored in ctx->state
| platform_result_t platform_hwcrypto_sha1_update | ( | sha1_context_t * | ctx, |
| const unsigned char * | input, | ||
| uint32_t | ilen ) |
SHA1 UPDATE @Assumption : input_len is multiple of 64
| [in] | ctx | sha1_context containing the previous sha result |
| [in] | input | input data |
| [in] | ilen | size of data to be authenticated |
The result of hash is stored in ctx->state
| platform_result_t platform_hwcrypto_sha2 | ( | const unsigned char * | input, |
| uint32_t | ilen, | ||
| unsigned char | hash_output[SHA256_HASH_SIZE], | ||
| unsigned char * | payload_buffer, | ||
| int32_t | is224 ) |
SHA256
| [in] | input | input data |
| [in] | ilen | size of data to be authenticated |
| [out] | output | buffer to hold result of authentication |
| [in] | is224 | 0 : SHA256 1: SHA224 |
| WEAK platform_result_t platform_hwcrypto_sha256_hash | ( | uint8_t * | source, |
| uint32_t | size, | ||
| uint8_t * | output_payload_buffer, | ||
| uint8_t * | hash_output ) |
SHA256 HASH on data size < HWCRYPTO_MAX_PAYLOAD_SIZE @Deprecated, use platform_hwcrypto_sha2() instead @Assumption Size is < HWCRYPTO_MAX_PAYLOAD_SIZE output is aligned to CRYPTO_OPTIMIZED_DESCRIPTOR_ALIGNMENT
| WEAK platform_result_t platform_hwcrypto_sha256_hmac | ( | uint8_t * | hmac_key, |
| uint32_t | keysize, | ||
| uint8_t * | source, | ||
| uint32_t | size, | ||
| uint8_t * | payload_buffer, | ||
| uint8_t * | hash_output ) |
SHA256 HMAC on data size < HWCRYPTO_MAX_PAYLOAD_SIZE @Deprecated, use platform_hwcrypto_sha2_hmac() instead @Assumption Size is < HWCRYPTO_MAX_PAYLOAD_SIZE output is aligned to CRYPTO_OPTIMIZED_DESCRIPTOR_ALIGNMENT
| platform_result_t platform_hwcrypto_sha256_hmac_aescbc_encrypt | ( | uint8_t * | crypt_key, |
| uint8_t * | crypt_iv, | ||
| uint32_t | crypt_size, | ||
| uint32_t | auth_size, | ||
| uint8_t * | hmac_key, | ||
| uint32_t | hmac_key_len, | ||
| uint8_t * | src, | ||
| uint8_t * | crypt_dest, | ||
| uint8_t * | hash_dest ) |
Combo SHA256HMAC Authentication + AES128 CBC encryption For data size < ( HWCRYPTO_MAX_PAYLOAD_SIZE )
| [in] | crypt_key | AES key |
| [in] | crypt_iv | AES IV |
| [in] | crypt_size | Size of data to be encrypted |
| [in] | auth_size | Size of data to be authenticated |
| [in] | hmac_key | HMAC key |
| [in] | hmac_key_len | HMAC key length |
| [in] | src | input data |
| [out] | crypt_dest | Result of encryption |
| [out] | hash_dest | Result of authentication |
| platform_result_t platform_hwcrypto_sha2_finish | ( | sha256_context_t * | ctx, |
| const unsigned char * | input, | ||
| uint32_t | ilen, | ||
| unsigned char | output[SHA256_HASH_SIZE] ) |
SHA256 FINISH
| [in] | ctx | sha256_context containing the previous sha result |
| [in] | input | input data |
| [in] | ilen | size of data to be authenticated |
| [out] | output | buffer to hold result of authentication |
| platform_result_t platform_hwcrypto_sha2_hmac | ( | const unsigned char * | key, |
| uint32_t | keylen, | ||
| const unsigned char * | input, | ||
| uint32_t | ilen, | ||
| unsigned char | output[SHA256_HASH_SIZE], | ||
| unsigned char * | payload_buffer, | ||
| int32_t | is224 ) |
SHA256HMAC Authentication
| [in] | key | HMAC key |
| [in] | keylen | HMAC key length |
| [in] | input | input data |
| [in] | ilen | size of data to be authenticated |
| [out] | output | buffer to hold result of authentication |
| [in] | is224 | 0 : SHA256 1: SHA224 |
| platform_result_t platform_hwcrypto_sha2_hmac_finish | ( | sha256_context_t * | ctx, |
| uint8_t * | input, | ||
| int32_t | ilen, | ||
| unsigned char | output[SHA256_HASH_SIZE] ) |
SHA256 HMAC FINISH
| [in] | ctx | sha256_context containing the previous sha result |
| [in] | input | input data |
| [in] | ilen | size of data to be authenticated |
| [out] | output | buffer to hold result of authentication |
| platform_result_t platform_hwcrypto_sha2_hmac_incremental | ( | const unsigned char * | key, |
| uint32_t | keylen, | ||
| const unsigned char * | input, | ||
| uint32_t | ilen, | ||
| unsigned char | output[SHA256_HASH_SIZE], | ||
| int32_t | is224 ) |
SHA256HMAC Authentication For lengths > HWCRYPTO_MAX_PAYLOAD_SIZE
| [in] | key | HMAC key |
| [in] | keylen | HMAC key length |
| [in] | input | input data |
| [in] | ilen | size of data to be authenticated |
| [out] | output | buffer to hold result of authentication |
| [in] | is224 | 0 : SHA256 1: SHA224 |
SPU-M does not support SHA-256 HMAC of > 64K , but it supports SHA-256 Hash for > 64K data So HMAC is computed by using Hash as described below. HMAC = Hash(key XOR opad || HASH(key XOR ipad || data)) (|| -> append, ipad -> 64 byte array of 0x3C, opad -> 64 byte array of 0x5c ) InnexHashContext -> key XOR ipad OuterHashContext -> key XOR opad
For Details Refer to : APPENDIX B: Summary of Hash Modes and 3.4.1 : Code authentication Using Incremental Hash operation
HWcrypto Outputs the PAYLOAD + HASH RESULT ctx->payload_buffer has the output payload output has the HASH result in case of init/updt/final
| platform_result_t platform_hwcrypto_sha2_hmac_starts | ( | sha256_context_t * | ctx, |
| const unsigned char * | key, | ||
| uint32_t | keylen, | ||
| int32_t | is224 ) |
SHA256 HMAC INIT Calculates HASH(key XOR ipad) HASH(key XOR ipad || data)
| [in] | ctx | sha256_context containing the previous sha result HWcrypto Outputs the PAYLOAD + HASH RESULT ctx->payload_buffer should be initialized to point to a buffer big enough to contain the input payload |
| [in] | key | HMAC key |
| [in] | keylen | HMAC key length |
| [in] | is224 | 1: SHA224 0: SHA256 |
The result of hash is stored in ctx->state
| platform_result_t platform_hwcrypto_sha2_hmac_update | ( | sha256_context_t * | ctx, |
| const unsigned char * | input, | ||
| int32_t | ilen ) |
SHA256 HMAC UPDATE HASH(key XOR ipad || data) @Assumption : input_len is multiple of 64
| platform_result_t platform_hwcrypto_sha2_incremental | ( | const unsigned char * | input, |
| uint32_t | ilen, | ||
| unsigned char | output[SHA256_HASH_SIZE], | ||
| int32_t | is224 ) |
SPU-M (HWCrypto Engine) can only hash HWCRYPTO_MAX_PAYLOAD_SIZE payload at a time. for larger payloads, divide the hash into HASH_INIT, HASH_UPDT, HASH_FINISH. SPU-M User guide Rev0.31 Page 41 Section 3.4.1
| [in] | input | pointer to input data/payload |
| [in] | ilen | length of input data/payload |
| [out] | output | buffer to store output data |
| [in] | is224 | 1: SHA224 0: SHA256 |
| platform_result_t platform_hwcrypto_sha2_starts | ( | sha256_context_t * | ctx, |
| const unsigned char * | input, | ||
| uint32_t | ilen, | ||
| int32_t | is224 ) |
SHA256 INIT @Assumption : input_len is multiple of 64
| [in] | ctx | sha256_context HWcrypto Outputs the PAYLOAD + HASH RESULT ctx->payload_buffer should be initialized to point to a buffer big enough to contain the input payload |
| [in] | input | input data |
| [in] | ilen | size of data to be authenticated |
| [in] | is224 | 1: SHA224 0: SHA256 |
The result of hash is stored in ctx->state
| platform_result_t platform_hwcrypto_sha2_update | ( | sha256_context_t * | ctx, |
| const unsigned char * | input, | ||
| uint32_t | ilen ) |
SHA256 UPDATE @Assumption : input_len is multiple of 64
| [in] | ctx | sha256_context containing the previous sha result |
| [in] | input | input data |
| [in] | ilen | size of data to be authenticated |
The result of hash is stored in ctx->state