|
1 | 1 | //! AES block cipher implementations for RISC-V using the Cryptography
|
2 | 2 | //! Extensions
|
3 | 3 | //!
|
4 |
| -//! Supported targets: rv64 (scalar) |
| 4 | +//! Supported targets: rv64 (scalar), rvv |
5 | 5 | //!
|
6 | 6 | //! NOTE: rv32 (scalar) is not currently implemented, primarily due to the
|
7 | 7 | //! difficulty in obtaining a suitable development environment (lack of distro
|
8 | 8 | //! support and lack of precompiled toolchains), the effort required for
|
9 | 9 | //! maintaining a test environment as 32-bit becomes less supported, and the
|
10 | 10 | //! overall scarcity of relevant hardware. If someone has a specific need for
|
11 |
| -//! such an implementation, please open an issue. |
| 11 | +//! such an implementation, please open an issue. Theoretically, the rvv |
| 12 | +//! implementation should work for riscv32, for a hypothetical rv32 |
| 13 | +//! implementation satisfying the vector feature requirements. |
12 | 14 | //!
|
13 | 15 | //! NOTE: These implementations are currently not enabled through
|
14 | 16 | //! auto-detection. In order to use this implementation, you must enable the
|
15 | 17 | //! appropriate target-features.
|
16 | 18 | //!
|
| 19 | +//! Additionally, for the vector implementation, since the `zvkned` |
| 20 | +//! target-feature is not yet defined in Rust, you must pass |
| 21 | +//! `--cfg=riscv_zvkned` to the compiler (through `RUSTFLAGS` or some other |
| 22 | +//! means). However, you still must enable the `v` target-feature. |
| 23 | +//! |
17 | 24 | //! Examining the module structure for this implementation should give you an
|
18 | 25 | //! idea of how to specify these features in your own code.
|
19 | 26 | //!
|
20 |
| -//! NOTE: AES-128, AES-192, and AES-256 are supported. |
| 27 | +//! NOTE: AES-128, AES-192, and AES-256 are supported for both the scalar and |
| 28 | +//! vector implementations. |
| 29 | +//! |
| 30 | +//! However, key expansion is not vector-accelerated for the AES-192 case |
| 31 | +//! (because RISC-V does not provide vector instructions for this case). Users |
| 32 | +//! concerned with vector performance are advised to select AES-129 or AES-256 |
| 33 | +//! instead. Nevertheless, the AES-192 vector implementation will still fall |
| 34 | +//! back to the scalar AES-192 key-schedule implementation, if the appropriate |
| 35 | +//! scalar target-features are enabled. |
21 | 36 |
|
22 | 37 | #[cfg(all(target_arch = "riscv64", riscv_zkned))]
|
23 | 38 | pub(crate) mod rv64;
|
| 39 | +#[cfg(all(target_arch = "riscv64", riscv_zvkned,))] |
| 40 | +pub(crate) mod rvv; |
24 | 41 |
|
25 | 42 | use crate::Block;
|
26 | 43 |
|
|
0 commit comments