pkg/driver_cryptocell_310: allow data to be in ROM on hash update#21214
Conversation
2d8942c to
20c441b
Compare
There was a problem hiding this comment.
Why exactly is this being removed again? We only recently introduced this, because hash operations with inputs longer than 64 bytes failed, because read operations from ROM took too long for the accelerator.
Also, as Mikolai wrote in his PR, CryptoCell officially only supports DMA from RAM.
|
Thanks for pinging @Einhornhool. #21138 is one slightly hacky solution to the problem, by simply disallowing data to be ROM. This PR uses a different approach, which is possible for all cryptographic operations that allow multi-part operation: It copies the content of the ROM buffer chunk-wise into a buffer on the stack (in RAM) and passes these chunks individually to the hardware. I think that's an elegant solution (as long as the buffer is not too large for the stack). |
|
Ah, I see. Then it looks good to me :) |
mguetschow
left a comment
There was a problem hiding this comment.
Looks good, thanks! Some nits below.
mguetschow
left a comment
There was a problem hiding this comment.
Looks good then, please squash!
55a3aa4 to
0ff9fd5
Compare
|
Could you please rebase on current |
0ff9fd5 to
daf814e
Compare
Contribution description
Removal of PSA_ERROR_DATA_INVALID when passing data from ROM into cryptocell_310_common_hash_update.
This is achieved by sequentially copying data from ROM into a buffer and calling a new "continue" function.
Testing procedure
examples/advanced_examples/psa_cryptoandtests/sys/psa_crypto_hashesshould now work withconstmessages, as provided in the commit. Tested it with feather-nrf52840-sense and nrf52840dk successfully.Issues/PRs references
The PSA_ERROR_DATA_INVALID was introduced in #21138.