Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal of the intrinsics for vector crypto #234

Merged
merged 44 commits into from
Jun 12, 2024
Merged

Conversation

eopXD
Copy link
Collaborator

@eopXD eopXD commented Jun 1, 2023

Update (2023/11/11)

The vector crypto extension is now has a released v1.0.0 [0]. This PR creates intrinsics that exposes interfaces to the vector crypto instructions.

Regarding the data type used in the intrinsics added, this proposal does not model the concept of "element grouping (EGS/EGW)" and reuses the existing data types of the RVV intrinsics (e.g. vuint32m1_t, vuint64m2_t).

The LLVM implementation of the intrinsics is the following: (to be updated to latest v20230531)

[0] https://github.com/riscv/riscv-crypto/releases/tag/v1.0.0

@eopXD eopXD force-pushed the eopc/vector-crypto branch 4 times, most recently from 2a9812c to 93dcd87 Compare June 28, 2023 10:03
}

vuint32mf2_t test_vsm4r_vs_u32mf2(vuint32mf2_t vd, vuint32mf2_t vs2, size_t vl) {
return __riscv_vsm4r_vs_u32mf2(vd, vs2, vl);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think vs2 of .vs type of this instruction should have lmul1 type.

@eopXD
Copy link
Collaborator Author

eopXD commented Jul 17, 2023

Address comments from Craig, Nick, Brandon, and Nicholas. Thank you guys for the review.

Changes:

Zvbb - Vector Bit-manipulation used in Cryptography
Return correct LMUL type for vwsll in the function name suffix
Change rs1 operand to using type size_t

Zvbc - Vector Carryless Multiplication
Let vclmul have 64 bit variant only
Add missing vs1 (rs1) operand for vclmul

Zvkned - NIST Suite: Vector AES Block Cipher
Update test cases to have immediate operands for uimm (*.vi instruction)

Zvknh[ab] - NIST Suite: Vector SHA-2 Secure Hash
Correct vsha2c into vsha2ch and vsha2cl
Fix topic name

Zvksed - ShangMi Suite: SM4 Block Cipher
Fix overloaded name for vsmr4
Fix topic name

eopXD and others added 26 commits June 11, 2024 15:37
Signed-off-by: eop Chen <eop.chen@sifive.com>
Signed-off-by: eop Chen <eop.chen@sifive.com>
'vs' instructions will take the first element group from `vs2`, while
`vd` can be other settings of register group. This commit adds extra
variants for users to choose whatever suits their need.

Signed-off-by: eop Chen <eop.chen@sifive.com>
…s regarding zvl extensions

Signed-off-by: eop Chen <eop.chen@sifive.com>
…tion

Signed-off-by: eop Chen <eop.chen@sifive.com>
- Add operand mnemonics for overloaded intrinsics of
  vaesef/vsaesem/vaesdf/vaesdm
- Add vs2 operand for vaeskf2
- Fix vs2 data type for vwsll
…esef/vsaesem/vaesdf/vaesdm

Signed-off-by: eop Chen <eop.chen@sifive.com>
…bit-manipulation_used_in_cryptography.md

Co-authored-by: Nicolas Brunie <82109999+nibrunieAtSi5@users.noreply.github.com>
Signed-off-by: Kito Cheng <kito.cheng@gmail.com>
@4vtomat
Copy link
Collaborator

4vtomat commented Jun 12, 2024

Rebase

@4vtomat 4vtomat merged commit a1769f8 into main Jun 12, 2024
2 of 7 checks passed
@4vtomat 4vtomat deleted the eopc/vector-crypto branch June 12, 2024 06:25
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.

None yet

10 participants