Example of SHA2-384 hashing using sha direct mode of ELS (CLNS component mcuxClEls)
Example of SHA2-384 hashing using sha direct mode of ELS (CLNS component mcuxClEls)
#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, 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, 0x00U, 0x00U,
0x00U, 0x00U, 0x00U, 0x18U};
0x45U, 0xa3U, 0x5eU, 0x8bU,
0xb5U, 0xa0U, 0x3dU, 0x69U,
0x9aU, 0xc6U, 0x50U, 0x07U,
0x27U, 0x2cU, 0x32U, 0xabU,
0x0eU, 0xdeU, 0xd1U, 0x63U,
0x1aU, 0x8bU, 0x60U, 0x5aU,
0x43U, 0xffU, 0x5bU, 0xedU,
0x80U, 0x86U, 0x07U, 0x2bU,
0xa1U, 0xe7U, 0xccU, 0x23U,
0x58U, 0xbaU, 0xecU, 0xa1U,
0x34U, 0xc8U, 0x25U, 0xa7U};
MCUXCLEXAMPLE_FUNCTION(mcuxClEls_Hash_Sha384_Sha_Direct_One_Block_example)
{
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
hash_options,
MCUX_CSSL_ANALYSIS_START_PATTERN_NULL_POINTER_CONSTANT()
NULL,
NULL
MCUX_CSSL_ANALYSIS_STOP_PATTERN_NULL_POINTER_CONSTANT()
));
{
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_384_digest[MCUXCLELS_HASH_STATE_SIZE_SHA_384]
Destination buffer to receive the hash output of the SHA2-384 hashing.
Definition mcuxClEls_Hash_Sha384_One_Block_example.c:78
static ALIGNED uint8_t sha384_reference_digest[MCUXCLELS_HASH_OUTPUT_SIZE_SHA_384]
Expected hash value.
Definition mcuxClEls_Hash_Sha384_One_Block_example.c:64
static ALIGNED uint8_t const sha384_padded_input[MCUXCLELS_HASH_BLOCK_SIZE_SHA_384]
Data input for SHA2-384 hashing.
Definition mcuxClEls_Hash_Sha384_One_Block_example.c:30
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_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:119
#define MCUXCLELS_HASH_INIT_ENABLE
Set this option at mcuxClEls_HashOption_t.hashini to initialize the hash.
Definition mcuxClEls_Hash.h:60
#define MCUXCLELS_HASH_OUTPUT_ENABLE
Set this option at mcuxClEls_HashOption_t.hashoe to output the hash to pDigest.
Definition mcuxClEls_Hash.h:66
#define MCUXCLELS_HASH_MODE_SHA_384
Set this option at mcuxClEls_HashOption_t.hashmd to use the hash algorithm SHA-384.
Definition mcuxClEls_Hash.h:77
#define MCUXCLELS_HASH_BLOCK_SIZE_SHA_384
SHA-384 output size: 1024 bit (128 bytes)
Definition mcuxClEls_Hash.h:99
#define MCUXCLELS_HASH_STATE_SIZE_SHA_384
SHA-384 state size: 512 bit (64 bytes)
Definition mcuxClEls_Hash.h:113
#define MCUXCLELS_HASH_OUTPUT_SIZE_SHA_384
SHA-384 output size: 384 bit (48 bytes)
Definition mcuxClEls_Hash.h:127
#define MCUXCLELS_STATUS_OK
No error occurred.
Definition mcuxClEls_Types.h:171
#define MCUX_CSSL_FP_FUNCTION_CALL_BEGIN(...)
Call a flow protected function and check the protection token.
Definition mcuxCsslFlowProtection.h:581
#define MCUX_CSSL_FP_FUNCTION_CALLED(...)
Expectation of a called function.
Definition mcuxCsslFlowProtection.h:735
#define MCUX_CSSL_FP_FUNCTION_CALL_END(...)
End a function call section started by MCUX_CSSL_FP_FUNCTION_CALL_BEGIN.
Definition mcuxCsslFlowProtection.h:616
Command option bit field for mcuxClEls_Hash_Async and #mcuxClEls_Hash_ShaDirect.
Definition mcuxClEls_Hash.h:161
struct mcuxClEls_HashOption_t::@29 bits
Access mcuxClEls_HashOption_t bit-wise.
uint32_t hashoe
Defines if the hash digest shall be moved to the output buffer.
Definition mcuxClEls_Hash.h:172
uint32_t hashmd
Defines which hash algorithm shall be used.
Definition mcuxClEls_Hash.h:171
uint32_t hashini
Defines if the hash engine shall be initialized.
Definition mcuxClEls_Hash.h:169