Skip to content
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

Use a builder pattern for enabling hardware accelerated RSA #31

Merged
merged 1 commit into from
Jul 16, 2024

Conversation

AnthonyGrondin
Copy link
Contributor

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 for RSA would require specifying the type with None::<esp_hal::peripherals::RSA>.

@AnthonyGrondin AnthonyGrondin changed the title Draft: Use a builder pattern for enabling hardware accelerated RSA Use a builder pattern for enabling hardware accelerated RSA Jul 15, 2024
@AnthonyGrondin AnthonyGrondin marked this pull request as ready for review July 15, 2024 15:34
Copy link
Collaborator

@bjoernQ bjoernQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - LGTM

@bjoernQ bjoernQ merged commit 5fb0ca7 into esp-rs:main Jul 16, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants