Part Number: AM263P4
Other Parts Discussed in Thread: SHA-256
I reviewed the SHA calculation program for the DTHE module in the AM263P4 SDK (mcu_plus_sdk_am263px_11_00_00_19). When it is not the last block of data, for SHA256, the input length of the original text must be a multiple of 64 bytes. According to the program logic, for non-SHA256 algorithms, such as SHA1, SHA224, SHA384, SHA512, and MD5, the input length of the original text must be a multiple of 128 bytes.
The first question: does this indicate that the program only considers the cases of SHA256 and SHA512 (since only DTHE_SHA256_BLOCK_SIZE and DTHE_SHA512_BLOCK_SIZE are listed, and the comment states /* Sanity Checking: Any data buffer except the last block should be aligned as per the SHA Size. For SHA256 this is 64byte while for SHA512 this should be 128byte */), without accounting for other cases, or is the program designed to simply distinguish between SHA256 and non-SHA256?
The second question: for the last block of data, regardless of the algorithm, is there no requirement on the input length?

