[sw/sca] Optimize/Clean up code of batch modes in sca serial files
- Dominant language
- SystemVerilog
- Stars
- 3.6k
- Forks
- 1.1k
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 141
Description
### Description
This issue is related to https://github.com/lowRISC/opentitan/pull/17416
@jadephilipoom made some good points on the batch mode implementation in the ecc256_keygen_serial.c file, which are also valid to each batch mode implementation in the other serial files. Hence, these suggested modifications should be applied to every serial file.
The points are:
- To fully comply with the style guide.
- To remove the global key/message/seed/etc. arrays, which store all values from each batch, and instead allocate enough stack memory locally for a single key/message/seed/etc. value. If we then directly process each single value this would allow us to remove the maximum number of traces per batch and also the second for-loop.
- To use `memcpy(num_traces, data, data_len)` instead of `num_traces = read_32(data)` . This is safer.
Contributor guide
Research direction
Start with ecc256_keygen_serial.c and compare its batch-mode implementation with the corresponding implementations in the other serial files. Review the style-guide concerns, global batch arrays, second loop, and num_traces handling described in the issue. Done means the same cleanup is applied consistently across all affected serial files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- cryptography, security
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100