RFR: 8334999: RISC-V: implement AES single block encryption/decryption intrinsics [v10]

Fei Yang fyang at openjdk.org
Mon Oct 28 07:28:04 UTC 2024


On Thu, 24 Oct 2024 21:55:18 GMT, Arseny Bochkarev <duke at openjdk.org> wrote:

>> Hello everyone! Please review this port of vector AES single block encryption/decryption intrinsics. On my QEMU with `Zvkned` extension enabled the `test/hotspot/jtreg/compiler/codegen/aes/TestAESMain.java` test is OK. I know that currently hardware implementing this extension is not available on the market but I suppose this PR can be a good starting point on supporting AES intrinsics for RISC-V in OpenJDK.
>
> Arseny Bochkarev has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 17 commits:
> 
>  - Replace RISCV64 -> riscv64 in comment
>  - Minor renaming of labels and reg_number
>  - Use RISCV64 instead of RISCV
>  - Fixed comment line
>  - Rename reg_number -> rounds in aes_loadkeys
>  - Fix typo
>  - Use same keys for encryption and decryption
>  - Multiversion decrypt intrinsic
>  - Use one L_end for all AES key sizes
>  - Multiversion encryption depending on keylen
>  - ... and 7 more: https://git.openjdk.org/jdk/compare/d1540e2a...e90b0d05

Thanks for the update. Two comments remain. seems fine otherwise.

src/hotspot/cpu/riscv/stubGenerator_riscv.cpp line 2283:

> 2281:     for (int i = 0; i < rounds; i++) {
> 2282:       __ vle32_v(working_vregs[i], key);
> 2283:       __ vrev8_v(working_vregs[i], working_vregs[i]);

What's is this `vrev8_v` for? I wonder how this maps to the code-samples at [1]. Might deserve a code comment here. 

[1] https://github.com/riscv/riscv-crypto/blob/main/doc/vector/code-samples/zvkned.s

src/hotspot/cpu/riscv/vm_version_riscv.cpp line 423:

> 421: 
> 422:   // AES
> 423:   if (UseZvkn) {

Was checking and enablement for `UseAES` VM option missed here?

Reference: https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp#L289

-------------

PR Review: https://git.openjdk.org/jdk/pull/19960#pullrequestreview-2397866709
PR Review Comment: https://git.openjdk.org/jdk/pull/19960#discussion_r1818490883
PR Review Comment: https://git.openjdk.org/jdk/pull/19960#discussion_r1818333010


More information about the hotspot-dev mailing list