Hashing#

Provides cryptographic hash functions (SHA-1, SHA-224, SHA-256, SHA-384, SHA-512).

Provides API for one-way hashing functions.

Modules#

sl_se_sha1_multipart_context_t

sl_se_sha224_multipart_context_t

sl_se_sha256_multipart_context_t

sl_se_sha384_multipart_context_t

sl_se_sha512_multipart_context_t

Enumerations#

enum
SL_SE_HASH_NONE
SL_SE_HASH_SHA1
SL_SE_HASH_SHA224
SL_SE_HASH_SHA256
SL_SE_HASH_SHA384
SL_SE_HASH_SHA512
}

Hash algorithms.

Functions#

sl_status_t
sl_se_hash(sl_se_command_context_t *cmd_ctx, sl_se_hash_type_t hash_type, const uint8_t *message, unsigned int message_size, uint8_t *digest, size_t digest_len)

Produce a message digest (a hash block) using the input data.

sl_status_t
sl_se_hash_sha1_multipart_starts(sl_se_sha1_multipart_context_t *sha1_ctx, sl_se_command_context_t *cmd_ctx)

Prepare a SHA1 hash streaming command context object.

sl_status_t
sl_se_hash_sha224_multipart_starts(sl_se_sha224_multipart_context_t *sha224_ctx, sl_se_command_context_t *cmd_ctx)

Prepare a SHA224 hash streaming command context object.

sl_status_t
sl_se_hash_sha256_multipart_starts(sl_se_sha256_multipart_context_t *sha256_ctx, sl_se_command_context_t *cmd_ctx)

Prepare a SHA256 hash streaming command context object.

sl_status_t
sl_se_hash_sha384_multipart_starts(sl_se_sha384_multipart_context_t *sha384_ctx, sl_se_command_context_t *cmd_ctx)

Prepare a SHA384 streaming command context object.

sl_status_t
sl_se_hash_sha512_multipart_starts(sl_se_sha512_multipart_context_t *sha512_ctx, sl_se_command_context_t *cmd_ctx)

Prepare a SHA512 streaming command context object.

sl_status_t
sl_se_hash_multipart_starts(void *hash_type_ctx, sl_se_command_context_t *cmd_ctx, sl_se_hash_type_t hash_type)

Prepare a hash streaming command context object.

sl_status_t
sl_se_hash_multipart_update(void *hash_type_ctx, sl_se_command_context_t *cmd_ctx, const uint8_t *input, size_t input_len)

Feeds an input buffer into an ongoing hash computation.

sl_status_t
sl_se_hash_multipart_finish(void *hash_type_ctx, sl_se_command_context_t *cmd_ctx, uint8_t *digest_out, size_t digest_len)

Finish a hash streaming operation and return the resulting hash digest.

Macros#

#define

Default streaming hash context.

#define
SL_SE_SHA1_STREAMING_INIT_DEFAULT { { 0 }, { 0 }, { 0 } }

SHA1 streaming hash context.

#define
SL_SE_SHA224_STREAMING_INIT_DEFAULT { { 0 }, { 0 }, { 0 } }

SHA224 streaming hash context.

#define
SL_SE_SHA256_STREAMING_INIT_DEFAULT { { 0 }, { 0 }, { 0 } }

SHA256 streaming hash context.

#define
SL_SE_SHA384_STREAMING_INIT_DEFAULT { { 0 }, { 0 }, { 0 } }

SHA384 streaming hash context.

#define
SL_SE_SHA512_STREAMING_INIT_DEFAULT { { 0 }, { 0 }, { 0 } }

SHA512 streaming hash context.

Enumeration Documentation#

sl_se_hash_type_t#

sl_se_hash_type_t

Hash algorithms.

Enumerator
SL_SE_HASH_NONE

No hash.

SL_SE_HASH_SHA1

SHA-1.

SL_SE_HASH_SHA224

SHA-224.

SL_SE_HASH_SHA256

SHA-256.

SL_SE_HASH_SHA384

SHA-384.

SL_SE_HASH_SHA512

SHA-512.


Definition at line 384 of file platform/security/sl_component/se_manager/inc/sl_se_manager_types.h

Function Documentation#

sl_se_hash#

sl_status_t sl_se_hash (sl_se_command_context_t * cmd_ctx, sl_se_hash_type_t hash_type, const uint8_t * message, unsigned int message_size, uint8_t * digest, size_t digest_len)

Produce a message digest (a hash block) using the input data.

Parameters
[in]cmd_ctx

Pointer to an SE command context object.

[in]hash_type

Which hashing algorithm to use.

[in]message

Pointer to the message buffer to compute the hash/digest from.

[in]message_size

Number of bytes in message.

[out]digest

Pointer to block of memory to store the final digest.

[in]digest_len

The length of the message digest (hash), must be at least the size of the corresponding hash type.

This function generates a message digest adhering to the given inputs. For instance, if the algorithm is chosen to be SHA-256, it will generate a 32 bytes message digest computed based on the input message. This function supports SHA-1, SHA-256 and SHA-512 algorithms.

Returns

  • Status code, sl_status.h.


Definition at line 99 of file platform/security/sl_component/se_manager/inc/sl_se_manager_hash.h

sl_se_hash_sha1_multipart_starts#

sl_status_t sl_se_hash_sha1_multipart_starts (sl_se_sha1_multipart_context_t * sha1_ctx, sl_se_command_context_t * cmd_ctx)

Prepare a SHA1 hash streaming command context object.

Parameters
[in]sha1_ctx

Pointer to a SHA1 streaming context object.

[in]cmd_ctx

Pointer to an SE command context object.

Prepare a SHA1 hash streaming command context object to be used in subsequent calls to hash streaming functions sl_se_hash_multipart_update() and sl_se_hash_multipart_finish().

Returns

  • Status code, sl_status.h.


Definition at line 124 of file platform/security/sl_component/se_manager/inc/sl_se_manager_hash.h

sl_se_hash_sha224_multipart_starts#

sl_status_t sl_se_hash_sha224_multipart_starts (sl_se_sha224_multipart_context_t * sha224_ctx, sl_se_command_context_t * cmd_ctx)

Prepare a SHA224 hash streaming command context object.

Parameters
[in]sha224_ctx

Pointer to a SHA224 streaming context object.

[in]cmd_ctx

Pointer to an SE command context object.

Prepare a SHA224 hash streaming command context object to be used in subsequent calls to hash streaming functions sl_se_hash_multipart_update() and sl_se_hash_multipart_finish().

Returns

  • Status code, sl_status.h.


Definition at line 145 of file platform/security/sl_component/se_manager/inc/sl_se_manager_hash.h

sl_se_hash_sha256_multipart_starts#

sl_status_t sl_se_hash_sha256_multipart_starts (sl_se_sha256_multipart_context_t * sha256_ctx, sl_se_command_context_t * cmd_ctx)

Prepare a SHA256 hash streaming command context object.

Parameters
[in]sha256_ctx

Pointer to a SHA256 streaming context object.

[in]cmd_ctx

Pointer to an SE command context object.

Prepare a SHA256 hash streaming command context object to be used in subsequent calls to hash streaming functions sl_se_hash_multipart_update() and sl_se_hash_multipart_finish().

Returns

  • Status code, sl_status.h.


Definition at line 166 of file platform/security/sl_component/se_manager/inc/sl_se_manager_hash.h

sl_se_hash_sha384_multipart_starts#

sl_status_t sl_se_hash_sha384_multipart_starts (sl_se_sha384_multipart_context_t * sha384_ctx, sl_se_command_context_t * cmd_ctx)

Prepare a SHA384 streaming command context object.

Parameters
[in]sha384_ctx

Pointer to a SHA384 streaming context object.

[in]cmd_ctx

Pointer to an SE command context object.

Prepare a SHA384 hash streaming command context object to be used in subsequent calls to hash streaming functions sl_se_hash_multipart_update() and sl_se_hash_multipart_finish().

Returns

  • Status code, sl_status.h.


Definition at line 188 of file platform/security/sl_component/se_manager/inc/sl_se_manager_hash.h

sl_se_hash_sha512_multipart_starts#

sl_status_t sl_se_hash_sha512_multipart_starts (sl_se_sha512_multipart_context_t * sha512_ctx, sl_se_command_context_t * cmd_ctx)

Prepare a SHA512 streaming command context object.

Parameters
[in]sha512_ctx

Pointer to a SHA512 streaming context object.

[in]cmd_ctx

Pointer to an SE command context object.

Prepare a SHA512 hash streaming command context object to be used in subsequent calls to hash streaming functions sl_se_hash_multipart_update() and sl_se_hash_multipart_finish().

Returns

  • Status code, sl_status.h.


Definition at line 209 of file platform/security/sl_component/se_manager/inc/sl_se_manager_hash.h

sl_se_hash_multipart_starts#

sl_status_t sl_se_hash_multipart_starts (void * hash_type_ctx, sl_se_command_context_t * cmd_ctx, sl_se_hash_type_t hash_type)

Prepare a hash streaming command context object.

Parameters
[in]hash_type_ctx

Pointer to a hash streaming context object specific to the hash type specified by hash_type.

[in]cmd_ctx

Pointer to an SE command context object.

[in]hash_type

Type of hash algoritm

Prepare a hash (message digest) streaming command context object to be used in subsequent calls to hash streaming functions sl_se_hash_multipart_update() and sl_se_hash_multipart_finish().

Returns

  • Status code, sl_status.h.


Definition at line 237 of file platform/security/sl_component/se_manager/inc/sl_se_manager_hash.h

sl_se_hash_multipart_update#

sl_status_t sl_se_hash_multipart_update (void * hash_type_ctx, sl_se_command_context_t * cmd_ctx, const uint8_t * input, size_t input_len)

Feeds an input buffer into an ongoing hash computation.

Parameters
[in]hash_type_ctx

Pointer to a hash streaming context object specific to the hash type specified by hash_type.

[in]cmd_ctx

Pointer to an SE command context object.

[in]input

Buffer holding the input data, must be at least ilen bytes wide.

[in]input_len

The length of the input data in bytes.

This function is called between sl_se_hash_multipart_starts() and sl_se_hash_multipart_finish(). This function can be called repeatedly.

Returns

  • Status code, sl_status.h.


Definition at line 265 of file platform/security/sl_component/se_manager/inc/sl_se_manager_hash.h

sl_se_hash_multipart_finish#

sl_status_t sl_se_hash_multipart_finish (void * hash_type_ctx, sl_se_command_context_t * cmd_ctx, uint8_t * digest_out, size_t digest_len)

Finish a hash streaming operation and return the resulting hash digest.

Parameters
[in]hash_type_ctx

Pointer to a hash streaming context object specific to the hash type specified by hash_type.

[in]cmd_ctx

Pointer to an SE command context object.

[out]digest_out

Buffer for holding the message digest (hash), must be at least the size of the corresponding message digest type.

[in]digest_len

The length of the message digest (hash), must be at least the size of the corresponding hash type.

This function is called after sl_se_hash_multipart_update().

Returns

  • Status code, sl_status.h.


Definition at line 294 of file platform/security/sl_component/se_manager/inc/sl_se_manager_hash.h

Macro Definition Documentation#

SL_SE_HASH_STREAMING_INIT_DEFAULT#

#define SL_SE_HASH_STREAMING_INIT_DEFAULT
Value:
{ NULL, 0, 0, NULL }

Default streaming hash context.


Definition at line 480 of file platform/security/sl_component/se_manager/inc/sl_se_manager_defines.h

SL_SE_SHA1_STREAMING_INIT_DEFAULT#

#define SL_SE_SHA1_STREAMING_INIT_DEFAULT
Value:
{ { 0 }, { 0 }, { 0 } }

SHA1 streaming hash context.


Definition at line 481 of file platform/security/sl_component/se_manager/inc/sl_se_manager_defines.h

SL_SE_SHA224_STREAMING_INIT_DEFAULT#

#define SL_SE_SHA224_STREAMING_INIT_DEFAULT
Value:
{ { 0 }, { 0 }, { 0 } }

SHA224 streaming hash context.


Definition at line 482 of file platform/security/sl_component/se_manager/inc/sl_se_manager_defines.h

SL_SE_SHA256_STREAMING_INIT_DEFAULT#

#define SL_SE_SHA256_STREAMING_INIT_DEFAULT
Value:
{ { 0 }, { 0 }, { 0 } }

SHA256 streaming hash context.


Definition at line 483 of file platform/security/sl_component/se_manager/inc/sl_se_manager_defines.h

SL_SE_SHA384_STREAMING_INIT_DEFAULT#

#define SL_SE_SHA384_STREAMING_INIT_DEFAULT
Value:
{ { 0 }, { 0 }, { 0 } }

SHA384 streaming hash context.


Definition at line 484 of file platform/security/sl_component/se_manager/inc/sl_se_manager_defines.h

SL_SE_SHA512_STREAMING_INIT_DEFAULT#

#define SL_SE_SHA512_STREAMING_INIT_DEFAULT
Value:
{ { 0 }, { 0 }, { 0 } }

SHA512 streaming hash context.


Definition at line 485 of file platform/security/sl_component/se_manager/inc/sl_se_manager_defines.h