SHA_256#
SHA-256 digest functionality for the bootloader.
Modules#
Functions#
Initialize SHA256 context variable.
Run data through the SHA256 hashing function.
Finalize the SHA256 calculation.
Compare the SHA256 from the context variable to a known value.
Macros#
Number of bytes in a SHA-256 digest.
Function Documentation#
btl_initSha256#
void btl_initSha256 (void * ctx)
Initialize SHA256 context variable.
N/A | ctx | Pointer to the SHA256 context variable to be initialized |
Wipes out the SHA256 context variable and sets it up for re-use.
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.
N/A | ctx | Pointer to the SHA256 context variable |
N/A | data | Pointer to an array of binary data to add to the SHA256 calculation in progress |
N/A | length | Length of the byte array with data. |
56
of file platform/bootloader/security/btl_security_sha256.h
btl_finalizeSha256#
void btl_finalizeSha256 (void * ctx)
Finalize the SHA256 calculation.
N/A | ctx | 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.
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.
N/A | ctx | Pointer to the SHA256 context variable to be initialized |
N/A | sha256 | Byte array containing SHA256 value to compare to |
Returns
BOOTLOADER_OK if both hash values are equal, else error code from BOOTLOADER_ERROR_SECURITY_BASE range.
Convenience function to compare a known SHA256 hash against the result of a calculation.
79
of file platform/bootloader/security/btl_security_sha256.h