Skip to content

Updates the AES peripheral to use the clock::v2 API and make it safer. - #920

Merged
ianrrees merged 2 commits into
atsamd-rs:masterfrom
kyp44:aes-clock-v2
Jul 12, 2025
Merged

Updates the AES peripheral to use the clock::v2 API and make it safer.#920
ianrrees merged 2 commits into
atsamd-rs:masterfrom
kyp44:aes-clock-v2

Conversation

@kyp44

@kyp44 kyp44 commented Jul 11, 2025

Copy link
Copy Markdown
Contributor

Summary

As part of the clock::v2 effort tracked in Issue #912, this PR updates the aes to use the clock::v2 API as well as some other refactors. Note that the AES module is only available on thumbv7 targets so there was no need to maintain clock::v1 compatibility for thumbv6 targets.

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_cipher feature.

See the commit messages for more details.

Checklist

  • All new or modified code is well documented, especially public items
  • No new warnings or clippy suggestions have been introduced - CI will deny clippy warnings by default! You may #[allow] certain lints where reasonable, but ideally justify those with a short comment.

* 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.
@ianrrees

Copy link
Copy Markdown
Contributor

Love that this both improves functionality and deletes more source code than it adds, thanks!

@ianrrees
ianrrees merged commit d38de76 into atsamd-rs:master Jul 12, 2025
109 checks passed
kyp44 added a commit to kyp44/atsamd-tests that referenced this pull request Jul 12, 2025
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