[opentitantool] Fix sha256 byte ordering
@cfrantz is already working on this.
Since Jan 14, 2025.
- Dominant language
- SystemVerilog
- Stars
- 3.6k
- Forks
- 1.1k
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 141
Description
### Description
When opentitantool computes the SHA256 digest over a firmware image, it emits the SHA256 in reversed byte order.
This is a historical error related to the endianness selection in the OT HMAC peripheral. However, it has led to additional byte-reversal machinery being needed in hsmtool and other opentitantool commands. It has possibly resulted in a bug in the PreHashedSha256 mode of sphincsplus verification in the ROM.
1. Fix the output of the SHA256 digest from opentitantool
2. Fix the digest input in other opentitantool commands.
3. Fix the digest input in hsmtool.
4. Add an "input-bytes-reversed" flag if needed to compensate for the ROM implementation.
5. Fix occurrences of passing the `--little-endian` flag to hsmtool (consider the `input-bytes-reversed` case and the preferred representation of the signature output).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.