cryptoauthlib
cryptoauthlib copied to clipboard
Why does the sha2_routines.c: sw_sha256_process function use ATCA_UINT32_HOST_TO_LE by default?
Describe the bug A clear and concise description of what the bug is.
When I ported CryptoLib to the STM32 platform, I encountered an issue where using the atcab_ecdh_ioenc function resulted in an incorrect premaster key every time. Upon investigation, I discovered that the sw_sha256_process function in sha2_routines.c was using ATCA_UINT32_HOST_TO_LE by default for byte order conversion. Changing this to ATCA_UINT32_HOST_TO_BE resolved the problem and produced the correct result. According to the SHA-256 standard specified in RFC 4634, data should be interpreted using big-endian byte order by default.
To Reproduce Steps to reproduce the behavior:
- Go to '...'
- Click on '....'
- Scroll down to '....'
- See error
Expected behavior A clear and concise description of what you expected to happen.
Additional context Add any other context about the problem here.