riscv / riscv-crypto

RISC-V cryptography extensions standardisation work.
https://wiki.riscv.org/x/MVcF
Creative Commons Attribution 4.0 International
363 stars 85 forks source link

Integration of Scalar into the Unpriv spec has began. #384

Open wmat opened 9 months ago

wmat commented 9 months ago

Note that I have began integrating the Scalar spec into the Unprivileged spec. I'll update this issue with a Pull Request reference against riscv-isa-manual when I have one.

nibrunieAtSi5 commented 9 months ago

Thank you @wmat.

@ben-marshall / @mjosaarinen for your information.

mjosaarinen commented 8 months ago

Thanks, added a note in README.md as discussed in the TG meeting. https://github.com/riscv/riscv-crypto/commit/ef1eeb9074e57d4e08d77d3db43dc345e354bc7f

ben-marshall commented 8 months ago

Great to hear @wmat :+1:

ThinkOpenly commented 8 months ago

Process question: given there are human-readable documentation and Sail descriptions for both scalar and vector, is there a specified order as to how things get integrated into the canonical repositories? Does vector depend on scalar? Does the documentation have to be updated before the Sail descriptions are added, or are they done simultaneously?

(My real question is when to expect the Sail specifications to be updated, but want to learn the process as well. Thanks!)

wmat commented 8 months ago

Let me try to answer as I understand the current specifications. As I understand it, scalar & vector are separate specifications and do not necessarily reoly on each other. Any SAIL code in either spec would be self contained and have been manually added. At present SAIL descriptions would need to be manually updated in the applicable scalar crypto or vector crypto chapter if they change in the SAIL model.

latifbhatti commented 8 months ago

I hope this message finds you well. I wanted to provide some insight into the use of Sail pseudo code rather than actual Sail code in the RISC-V Vector Cryptography Extension specification.

As stated in the Vector Crypto spec, the original intention was to include actual Sail code in the specification. However, due to the absence of an approved RISC-V Vector Sail Model at the time of completing the Vector Cryptography extension specification, there was no basis on which to build the required Vector Sail model. (section of riscv vector crypto spec 1.0 (1.2. Sail Specifications)). its mean riscv vector extension is important to implement vector crypto spec 1.0 extension.

only zvkt extension of vector crypto extension depended on scalar crypto extension. reference: (Chapter 2. Extensions Overview (riscv vector crypto(1.0))) "It is important to note that the Vector Crypto instructions are independent of the implementation of the Zkt( (including Zvbb, Zvkb, and Zvbc) extension and do not require that Zkt is implemented" and detail discussion in 2.15. Zvkt - Vector Data-Independent Execution Latency section.

I share this information based on my understanding. If you have any concerns or questions about this information, please feel free to discuss them with me. I appreciate your attention to this matter. If you have additional information to share, I would be grateful for your input.

Thank you for the conversation.

ThinkOpenly commented 8 months ago

[...] scalar & vector are separate specifications and do not necessarily reoly on each other. Any SAIL code in either spec would be self contained and have been manually added. At present SAIL descriptions would need to be manually updated in the applicable scalar crypto or vector crypto chapter if they change in the SAIL model.

I intended to distinguish between the human-readable ISA spec, and the Sail reference itself (https://github.com/riscv/sail-riscv). It sounds like you are referring just to the ISA spec, am I correct?

When should one expect the Sail code here to be integrated into that RISC-V Sail reference repository?

wmat commented 8 months ago

Bill Traynor Documentation Build and Release Engineer RISC-V International

On Fri, Mar 8, 2024 at 3:50 PM Paul Clarke @.***> wrote:

[...] scalar & vector are separate specifications and do not necessarily reoly on each other. Any SAIL code in either spec would be self contained and have been manually added. At present SAIL descriptions would need to be manually updated in the applicable scalar crypto or vector crypto chapter if they change in the SAIL model.

I intended to distinguish between the human-readable ISA spec, and the Sail reference itself (https://github.com/riscv/sail-riscv). It sounds like you are referring just to the ISA spec, am I correct?

Yes, the ISA spec only.

When should one expect the Sail code here to be integrated into that RISC-V

Sail reference repository?

I’m hoping to have the option to pull in SAIL code late this year.

— Reply to this email directly, view it on GitHub https://github.com/riscv/riscv-crypto/issues/384#issuecomment-1986397182, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAN6ZGJU44B7NZLD6FTK4DYXIQAVAVCNFSM6AAAAABDK7JD5GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBWGM4TOMJYGI . You are receiving this because you were mentioned.Message ID: @.***>

wmat commented 8 months ago

Quick question, where Bitmanip instructions are included in the Scalar Crypto spec, should they be included when integrated as a chapter? The reason I ask is that the Bitmanip spec will be a chapter of it's own shortly and this will create duplication I think.

wmat commented 8 months ago

Quick question, where Bitmanip instructions are included in the Scalar Crypto spec, should they be included when integrated as a chapter? The reason I ask is that the Bitmanip spec will be a chapter of it's own shortly and this will create duplication I think.

NVM, there's no duplication. I see that the Bitmanip content is referenced directly from the Bitmanip repository. This will need to be updated to reference the Bitmanip chapter once it's integrated.

wmat commented 8 months ago

I'm ready to merge the scalar-crypto chapter but I'd like to get someone to briefly skim it to make sure nothing jumps out as wrong or incomplete. Note that the content hasn't changed at all, I've simply refactored the asciidoc to fit into the higher level Unprivileged manual.

You can grab the PDF here: https://github.com/riscv/riscv-isa-manual/actions/runs/8268811976/artifacts/1323222855

If that PDF has already been deleted, let me know and I'll generate another for you. I'd appreciate a LGTM response here before I merge it.

Thanks

wmat commented 8 months ago

Note that I'll be merging scalar-crypto on Wednesday, March 20th.

wmat commented 7 months ago

Scalar crypto is now integrated into the Unprivileged spec. Note that I'll begin asking for Issue closure or transfer to the riscv-isa-manual repo when an issue is still valid. Following that, this repository will be archived.

ThinkOpenly commented 7 months ago

@wmat where would one expect to find the Sail implementation for this?

wmat commented 7 months ago

@ThinkOpenly I asked Bill McSpadden and he say in the SAIL repo, the files of interest are: riscv_types_kext.sail riscv_insts_z*.sail

ThinkOpenly commented 7 months ago

@ThinkOpenly I asked Bill McSpadden and he say in the [SAIL repo]

Thank you for that information!

However, I should've been more specific. I'm looking for the Sail implementation of Zvkned, for example.

(If I am asking in the wrong context, perhaps you could redirect me.)

wmat commented 7 months ago

There would appear to be an open PR for that implementation.

Findecanor commented 2 months ago

The descriptions for the "zip" and "unzip" instructions have been swapped in the released Unpriv spec, compared to the latest released Crypto-Scalar spec.

The instruction encodings are also different.

(Credit for finding this goes to PColim on Reddit)

wmat commented 2 months ago

Yes, I saw that on reddit as well. Will fix that up shortly.

On Fri, Sep 6, 2024 at 9:55 AM Findecanor @.***> wrote:

The descriptions for the "zip" and "unzip" instructions have been swapped in the larger Unpriv spec, compared to the latest Crypto-Scalar spec.

The instruction encodings are also different.

(Credit for finding this goes to PColim https://www.reddit.com/user/PColim on Reddit)

— Reply to this email directly, view it on GitHub https://github.com/riscv/riscv-crypto/issues/384#issuecomment-2334114354, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAN6ZEHKCVJCPOC2XMD54LZVGX5RAVCNFSM6AAAAABDK7JD5GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZUGEYTIMZVGQ . You are receiving this because you were mentioned.Message ID: @.***>