Updates the AES peripheral to use the clock::v2 API and make it safer. - #920
Merged
Conversation
* Now uses the `clock::v2` API. * Fixes some items that have been renamed that prevented compilation using the `enable_unsafe_aes_newblock_cipher` feature. * Updates the `aes` module documentation example to use the current API.
* The `NewBlockCipher` trait has been removed. * This allows the ciphers (`Aes128`, `Aes192`, and `Aes256`) to now have a safe interface. * They were refactored be safe by consuming the `AesRustCrypto` so that only one cipher can be used at a time. * Ciphers now have a `free` method to release the `Aes` peripheral. * Removes the `enable_unsafe_aes_newblock_cipher` since cipher use is now fully safe.
Contributor
|
Love that this both improves functionality and deletes more source code than it adds, thanks! |
kyp44
added a commit
to kyp44/atsamd-tests
that referenced
this pull request
Jul 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
As part of the
clock::v2effort tracked in Issue #912, this PR updates theaesto use theclock::v2API as well as some other refactors. Note that the AES module is only available onthumbv7targets so there was no need to maintainclock::v1compatibility forthumbv6targets.The module was out of date, so some dependencies were updated, which now allows the ciphers to be used in a safe way, so this was refactored to make things safer, removing the now-unneeded
enable_unsafe_aes_newblock_cipherfeature.See the commit messages for more details.
Checklist
#[allow]certain lints where reasonable, but ideally justify those with a short comment.