-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pkg/driver_cryptocell_310: allow data to be in ROM on hash update #21214
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks! Some nits below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good then, please squash!
55a3aa4
to
0ff9fd5
Compare
Could you please rebase on current |
0ff9fd5
to
daf814e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
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_crypto
andtests/sys/psa_crypto_hashes
should now work withconst
messages, 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.