Below is a calculation example for the SHA2-256 integrity check, if the user sets the start address as 0x0001.0000 and length as 8 bytes. Figure 3-4 shows the example application data.
Follow the steps below to calculate the example SHA2-256 value:
- Select the application digest check policy as SHA2-256 (BOOTCFG6.APPDIGESTMODE = CCDDh)
- Set 32-bit starting address of the application digest check (APPDIGESTSTART.ADDRESS = 0001.0000h)
- Set the length of the application (specified in bytes) for which the SHA2-256 digest check applies (APPDIGESTLENGTH.LENGTH = 8h)
- Calculate the SHA2-256 output with the given input
- Reverse the input 32-bit data endianness as SHA2-256 is calculated in byte: 67, 45, 23, 01, EF, CD, AB, 89
- Combine the input 8-bit data as one string: 67452301EFCDAB89
- Calculate the SHA2-256 value (select HEX as the input encoding): FDD232547CEEE35ADD35783CA7D518D2A49ABCCD0B60B028C8A9C629EBA6201F (SHA2-256 online tool)
- Break up the SHA2-256 value into 8 32-bit words: 0xFDD23254, 0x7CEEE35A, 0xDD35783C, 0xA7D518D2, 0xA49ABCCD, 0x0B60B028, 0xC8A9C629, 0xEBA6201F
- Reverse the 32-bit output words endianness: 0x5432D2FD, 0x5AE3EE7C, 0x3C7835DD, 0xD218D5A7, 0xCDBC9AA4, 0x28B0600B, 0x29C6A9C8, 0x1F20A6EB
- Store the 8 32-bit SHA2-256 checksums in the APPDIGEST.DIGEST field in order