storage: flash_map: Add SHA-256 integrity method

Add SHA-256 flash integrity method.  It reads flash data from a
device giving an offset creating a SHA-256 hash to be compared
with a reference.  On sucess match, zero is returned, otherwise
a negative errno value.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
This commit is contained in:
Gerson Fernando Budke 2020-08-18 21:53:34 -03:00 committed by Carles Cufí
commit eb0f571790
7 changed files with 166 additions and 1 deletions

View file

@ -28,4 +28,12 @@ config FLASH_MAP_CUSTOM
User must provide such a description in place of default on
if had enabled this option.
config FLASH_AREA_CHECK_INTEGRITY
bool "Enable flash check functions"
select TINYCRYPT
select TINYCRYPT_SHA256
help
If enabled, there will be available the backend to check flash
integrity using SHA-256 verification algorithm.
endif