SHA_256#

SHA-256 digest functionality for the bootloader.

Modules#

Sha256Context_t

Functions#

void
btl_initSha256(void *ctx)

Initialize SHA256 context variable.

void
btl_updateSha256(void *ctx, const void *data, size_t length)

Run data through the SHA256 hashing function.

void

Finalize the SHA256 calculation.

int32_t
btl_verifySha256(void *ctx, const void *sha256)

Compare the SHA256 from the context variable to a known value.

Macros#

#define

Number of bytes in a SHA-256 digest.

Function Documentation#

btl_initSha256#

void btl_initSha256 (void *ctx)

Initialize SHA256 context variable.

Parameters
N/Actx

Pointer to the SHA256 context variable to be initialized

Wipes out the SHA256 context variable and sets it up for re-use.


Definition at line 45 of file platform/bootloader/security/btl_security_sha256.h

btl_updateSha256#

void btl_updateSha256 (void *ctx, const void *data, size_t length)

Run data through the SHA256 hashing function.

Parameters
N/Actx

Pointer to the SHA256 context variable

N/Adata

Pointer to an array of binary data to add to the SHA256 calculation in progress

N/Alength

Length of the byte array with data.


Definition at line 56 of file platform/bootloader/security/btl_security_sha256.h

btl_finalizeSha256#

void btl_finalizeSha256 (void *ctx)

Finalize the SHA256 calculation.

Parameters
N/Actx

Pointer to the SHA256 context variable to be initialized

Finalizes the running SHA256 calculation. After finalization, the SHA value in the context variable will be valid and no more data can be added.


Definition at line 66 of file platform/bootloader/security/btl_security_sha256.h

btl_verifySha256#

int32_t btl_verifySha256 (void *ctx, const void *sha256)

Compare the SHA256 from the context variable to a known value.

Parameters
N/Actx

Pointer to the SHA256 context variable to be initialized

N/Asha256

Byte array containing SHA256 value to compare to

Returns

Convenience function to compare a known SHA256 hash against the result of a calculation.


Definition at line 79 of file platform/bootloader/security/btl_security_sha256.h

Macro Definition Documentation#

BTL_SECURITY_SHA256_DIGEST_LENGTH#

#define BTL_SECURITY_SHA256_DIGEST_LENGTH
Value:
32

Number of bytes in a SHA-256 digest.


Definition at line 36 of file platform/bootloader/security/btl_security_sha256.h