-
Notifications
You must be signed in to change notification settings - Fork 685
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
3092: capsules: Add support for AES GCM r=bradjc a=alistair23 ### Pull Request Overview This PR adds a new aes_gcm capsule. This capsule exposes [AES-GCM](https://en.wikipedia.org/wiki/AES-GCM-SIV) support if the hardware doesn't actually have it. We implement AES GCM using other supported AES operations and with a software implementation of ghash. This is similar to the existing virtual_aes_ccm capsule, except without virtulisation. AES-GCM is commonly used in [TLS](https://blog.mozilla.org/security/2017/09/29/improving-aes-gcm-performance/). It isn't commonly used in embedded systems, but it's still a good example I think. ### Testing Strategy Running the OpenTitan tests ### TODO or Help Wanted This PR adds an external dependency! This PR adds a dependency on the [ghash crate](https://github.com/RustCrypto/universal-hashes/tree/master/ghash) as part of Rust-crypto. We are seeing more and more requirements for cryptographic operations in Tock, which means we are also seeing more and more software implementations of them. Tock already has a SHA256 and CRC32 software implementation. It's not unreasonable that RSA becomes more common with the cryptographic app IDs as well. I wanted to start the discussion about allowing Rust-crypto crates as capsules. Re-implementing a crypto library ourselves seem very risky, so if we do want software implementations Rust-crypto would be the way to go. I'm not convinced one way or the other, I just wanted to get some feedback on how people feel. The Rust-crypto crates are well respected, have been audited and match the Tock software license ### Documentation Updated - [X] Updated the relevant files in `/docs`, or no updates are required. ### Formatting - [X] Ran `make prepush`. Co-authored-by: Alistair Francis <alistair.francis@wdc.com>
- Loading branch information
Showing
10 changed files
with
739 additions
and
46 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Licensed under the Apache License, Version 2.0 or the MIT License. | ||
# SPDX-License-Identifier: Apache-2.0 OR MIT | ||
# Copyright Western Digital 2023. | ||
|
||
[package] | ||
name = "capsules-aes-gcm" | ||
version.workspace = true | ||
authors.workspace = true | ||
edition.workspace = true | ||
|
||
[dependencies] | ||
kernel = { path = "../../kernel" } | ||
enum_primitive = { path = "../../libraries/enum_primitive" } | ||
tickv = { path = "../../libraries/tickv" } | ||
ghash = "0.4.4" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
AES GCM Capsule | ||
=============== | ||
|
||
This crate contains software support for | ||
[AES-GCM](https://en.wikipedia.org/wiki/AES-GCM-SIV). | ||
This capsule doesn't perform any AES operations, instead it relies on | ||
existing implmenetations to perform the AES operations and instead manages | ||
the operations and hashing to support GCM. | ||
|
||
This capsule uses the extenal | ||
[ghash crate](https://github.com/RustCrypto/universal-hashes/tree/master/ghash) | ||
as part of Rust-crypto to implement AES GCM on top of existing AES | ||
implementions. | ||
|
||
## Cargo tree | ||
|
||
``` | ||
capsules-aes-gcm v0.1.0 (/var/mnt/scratch/alistair/software/tock/tock/capsules/aes_gcm) | ||
├── enum_primitive v0.1.0 (/var/mnt/scratch/alistair/software/tock/tock/libraries/enum_primitive) | ||
├── ghash v0.4.4 | ||
│ ├── opaque-debug v0.3.0 | ||
│ └── polyval v0.5.3 | ||
│ ├── cfg-if v1.0.0 | ||
│ ├── cpufeatures v0.2.7 | ||
│ ├── opaque-debug v0.3.0 | ||
│ └── universal-hash v0.4.1 | ||
│ ├── generic-array v0.14.7 | ||
│ │ └── typenum v1.16.0 | ||
│ │ [build-dependencies] | ||
│ │ └── version_check v0.9.4 | ||
│ └── subtle v2.4.1 | ||
├── kernel v0.1.0 (/var/mnt/scratch/alistair/software/tock/tock/kernel) | ||
│ ├── tock-cells v0.1.0 (/var/mnt/scratch/alistair/software/tock/tock/libraries/tock-cells) | ||
│ ├── tock-registers v0.8.1 (/var/mnt/scratch/alistair/software/tock/tock/libraries/tock-register-interface) | ||
│ └── tock-tbf v0.1.0 (/var/mnt/scratch/alistair/software/tock/tock/libraries/tock-tbf) | ||
└── tickv v1.0.0 (/var/mnt/scratch/alistair/software/tock/tock/libraries/tickv) | ||
``` |
Oops, something went wrong.