Use a builder pattern for enabling hardware accelerated RSA #31
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Built on top of #30.
This PR refactors the way we pass the RSA peripheral to a Session, using the builder pattern.
This also adds documentation detailing the usage of hardware accelerated RSA.
Whereas the older implementation is on a per session basis, it comes with the issue that only a single session can use the peripheral at the same time, even if we hold RSA statically. It would also be overwritten for every session, if one session is initialized with
None
.This implementation is closer to the actual usage we do with the peripheral, where it is passed through the FFI with a static, hence it will be used for every session. The RSA is safely dropped of usage when the session using the peripheral is dropped.
It also improves simplicity, because with the change in #30, using
None
forRSA
would require specifying the type withNone::<esp_hal::peripherals::RSA>
.