Example of SHA2-224 hashing using the ELS (CLNS component mcuxClEls).
#include <mcuxClToolchain.h>
#include <mcuxClCore_Examples.h>
#include <mcuxClExample_ELS_Helper.h>
0x00U, 0x00U, 0x00U, 0x00U,
0x00U, 0x00U, 0x00U, 0x00U,
0x00U, 0x00U, 0x00U, 0x00U,
0x00U, 0x00U, 0x00U, 0x00U,
0x00U, 0x00U, 0x00U, 0x00U,
0x00U, 0x00U, 0x00U, 0x00U,
0x00U, 0x00U, 0x00u, 0x00U,
0x00U, 0x00U, 0x00U, 0x00U,
0x00U, 0x00U, 0x00U, 0x00U,
0x00U, 0x00U, 0x00U, 0x00U,
0x00U, 0x00U, 0x00U, 0x00U,
0x00U, 0x00U, 0x00U, 0x00U,
0x00U, 0x00U, 0x00U, 0x00U,
0x00U, 0x00U, 0x00U, 0x00U,
0x00U, 0x00U, 0x00U, 0x18U};
0x34U, 0x05U, 0xd8U, 0x22U,
0x86U, 0x42U, 0xa4U, 0x77U,
0xbdU, 0xa2U, 0x55U, 0xb3U,
0x2aU, 0xadU, 0xbcU, 0xe4U,
0xbdU, 0xa0U, 0xb3U, 0xf7U,
0xe3U, 0x6cU, 0x9dU, 0xa7U};
MCUXCLEXAMPLE_FUNCTION(mcuxClEls_Hash_Sha224_One_Block_example)
{
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
hash_options,
));
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
{
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
}
if(!mcuxClExample_Els_Disable())
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
return MCUXCLEXAMPLE_STATUS_OK;
}
static ALIGNED uint8_t sha2_224_digest[MCUXCLELS_HASH_STATE_SIZE_SHA_224]
Destination buffer to receive the hash output of the SHA2-224 hashing.
Definition mcuxClEls_Hash_Sha224_One_Block_example.c:77
static ALIGNED uint8_t const sha224_padded_input[MCUXCLELS_HASH_BLOCK_SIZE_SHA_224]
Data input for SHA2-224 hashing.
Definition mcuxClEls_Hash_Sha224_One_Block_example.c:50
static ALIGNED uint8_t sha224_reference_digest[MCUXCLELS_HASH_OUTPUT_SIZE_SHA_224]
Expected hash value.
Definition mcuxClEls_Hash_Sha224_One_Block_example.c:68
static mcuxClEls_EccByte_t ecc_public_key_client[MCUXCLELS_ECC_PUBLICKEY_SIZE] ALIGNED
Destination buffer to receive the public key of the mcuxClEls_EccKeyGen_Async operation.
Definition mcuxClEls_Tls_Master_Key_Session_Keys_example.c:53
Definition of function identifiers for the flow protection mechanism.
Top-level include file for the ELS driver.
Provides the API for the CSSL flow protection mechanism.
#define MCUXCLELS_ERROR_FLAGS_CLEAR
Set this option at mcuxClEls_ErrorHandling_t to clear all ELS error flags.
Definition mcuxClEls_Common.h:130
#define MCUXCLELS_RESET_DO_NOT_CANCEL
Set this option at mcuxClEls_ResetOption_t to abort the requested command if another ELS operation is...
Definition mcuxClEls_Common.h:139
MCUXCLELS_API mcuxClEls_Status_t mcuxClEls_WaitForOperation(mcuxClEls_ErrorHandling_t errorHandling)
Wait for an ELS operation and optionally clear the error status.
#define MCUXCLELS_HASH_INIT_ENABLE
Set this option at mcuxClEls_HashOption_t.hashini to initialize the hash.
Definition mcuxClEls_Hash.h:80
#define MCUXCLELS_HASH_OUTPUT_ENABLE
Set this option at mcuxClEls_HashOption_t.hashoe to output the hash to pDigest.
Definition mcuxClEls_Hash.h:86
#define MCUXCLELS_HASH_MODE_SHA_224
Set this option at mcuxClEls_HashOption_t.hashmd to use the hash algorithm SHA-224.
Definition mcuxClEls_Hash.h:95
#define MCUXCLELS_HASH_BLOCK_SIZE_SHA_224
SHA-224 output size: 512 bit (64 bytes).
Definition mcuxClEls_Hash.h:117
#define MCUXCLELS_HASH_STATE_SIZE_SHA_224
SHA-224 state size: 256 bit (32 bytes).
Definition mcuxClEls_Hash.h:131
#define MCUXCLELS_HASH_OUTPUT_SIZE_SHA_224
SHA-224 output size: 224 bit (28 bytes).
Definition mcuxClEls_Hash.h:145
MCUXCLELS_API mcuxClEls_Status_t mcuxClEls_Hash_Async(mcuxClEls_HashOption_t options, uint8_t const *pInput, size_t inputLength, uint8_t *pDigest)
Computes the hash of a message.
#define MCUXCLELS_STATUS_OK
No error occurred.
Definition mcuxClEls_Types.h:191
#define MCUXCLELS_STATUS_OK_WAIT
An _Async function successfully started an ELS command. Call mcuxClEls_WaitForOperation to complete i...
Definition mcuxClEls_Types.h:192
#define MCUX_CSSL_FP_FUNCTION_CALL_BEGIN(...)
Call a flow protected function and check the protection token.
Definition mcuxCsslFlowProtection.h:601
#define MCUX_CSSL_FP_FUNCTION_CALLED(...)
Expectation of a called function.
Definition mcuxCsslFlowProtection.h:755
#define MCUX_CSSL_FP_FUNCTION_CALL_END(...)
End a function call section started by MCUX_CSSL_FP_FUNCTION_CALL_BEGIN.
Definition mcuxCsslFlowProtection.h:636
Command option bit field for mcuxClEls_Hash_Async and mcuxClEls_Hash_ShaDirect.
Definition mcuxClEls_Hash.h:181
uint32_t hashoe
Defines if the hash digest shall be moved to the output buffer.
Definition mcuxClEls_Hash.h:192
uint32_t hashmd
Defines which hash algorithm shall be used.
Definition mcuxClEls_Hash.h:191
struct mcuxClEls_HashOption_t::@106367111014206316214074042350035065154005170132 bits
Access mcuxClEls_HashOption_t bit-wise.
uint32_t hashini
Defines if the hash engine shall be initialized.
Definition mcuxClEls_Hash.h:189