You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/vector-crypto.adoc
+78-32Lines changed: 78 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -491,7 +491,7 @@ Note: If `Zve32x` is supported then `Zvkb` or `Zvbb` provide support for EEW of
491
491
492
492
493
493
All _cryptography-specific_ instructions defined in this Vector Crypto specification (i.e., those
494
-
in <<zvkned>>, <<zvknh,Zvknh[ab]>>, <<Zvkg>>, <<Zvksed>> and <<zvksh>> but _not_ <<zvbb>>, <<zvkb>>, <<zvbc>> or <<zvbc,Zvbc32e>>) shall
494
+
in <<zvkned>>, <<zvknh,Zvknh[ab]>>, <<Zvkg>>, <<Zvkg,Zvkgs>>, <<Zvksed>> and <<zvksh>> but _not_ <<zvbb>>, <<zvkb>>, <<zvbc>> or <<zvbc,Zvbc32e>>) shall
495
495
be executed with data-independent execution latency as defined in the
It is important to note that the Vector Crypto instructions are independent of the
@@ -600,11 +600,15 @@ in the Zvbb extension: vbrev.v, vclz.v, vctz.v, vcpop.v, and vwsll.[vv,vx,vi].
600
600
<<<
601
601
602
602
[[zvkg,Zvkg]]
603
-
==== `Zvkg` - Vector GCM/GMAC
603
+
==== `Zvkg` and `Zvkgs` - Vector GCM/GMAC
604
604
605
605
Instructions to enable the efficient implementation of GHASH~H~ which is used in Galois/Counter Mode (GCM) and
606
606
Galois Message Authentication Code (GMAC).
607
607
608
+
Zvkg defines the vector-vector (.vv) versions of the instructions.
609
+
Zvkgs defines the vector-scalar (.vs) versions of the instructions.
610
+
Zvkgs depends on Zvkg.
611
+
608
612
All of these instructions work on 128-bit element groups comprised of four 32-bit elements.
609
613
610
614
GHASH~H~ is defined in the
@@ -635,8 +639,8 @@ Likewise, `vstart` must be a multiple of `EGS=4`.
635
639
|EGW
636
640
|Mnemonic
637
641
|Instruction
638
-
| 32 | 128 | vghsh.vv | <<insns-vghsh>>
639
-
| 32 | 128 | vgmul.vv | <<insns-vgmul>>
642
+
| 32 | 128 | vghsh.[vv,vs] | <<insns-vghsh>>
643
+
| 32 | 128 | vgmul.[vv,vs] | <<insns-vgmul>>
640
644
641
645
|===
642
646
@@ -880,7 +884,7 @@ This extension is shorthand for the following set of other extensions:
880
884
881
885
[NOTE]
882
886
====
883
-
While Zvkg and Zvbc are not part of this extension, it is recommended that at least one of them is implemented with this extension to enable efficient AES-GCM.
887
+
While Zvkg, Zvkgs and Zvbc are not part of this extension, it is recommended that at least one of them is implemented with this extension to enable efficient AES-GCM.
884
888
====
885
889
886
890
<<<
@@ -955,7 +959,7 @@ This extension is shorthand for the following set of other extensions:
955
959
956
960
[NOTE]
957
961
====
958
-
While Zvkg and Zvbc are not part of this extension, it is recommended that at least one of them is implemented with this extension to enable efficient SM4-GCM.
962
+
While Zvkg, Zvkgs and Zvbc are not part of this extension, it is recommended that at least one of them is implemented with this extension to enable efficient SM4-GCM.
959
963
====
960
964
961
965
<<<
@@ -2559,15 +2563,16 @@ Included in::
2559
2563
<<<
2560
2564
2561
2565
[[insns-vghsh, Vector GHASH Add-Multiply]]
2562
-
==== vghsh.vv
2566
+
==== vghsh.[vv,vs]
2563
2567
2564
2568
Synopsis::
2565
2569
Vector Add-Multiply over GHASH Galois-Field
2566
2570
2567
2571
Mnemonic::
2568
-
vghsh.vv vd, vs2, vs1
2572
+
vghsh.vv vd, vs2, vs1 +
2573
+
vghsh.vs vd, vs2, vs1
2569
2574
2570
-
Encoding::
2575
+
Encoding (Vector-Vector)::
2571
2576
[wavedrom, , svg]
2572
2577
....
2573
2578
{reg:[
@@ -2580,8 +2585,26 @@ Encoding::
2580
2585
{bits: 6, name: '101100'},
2581
2586
]}
2582
2587
....
2588
+
2589
+
Encoding (Vector-Scalar)::
2590
+
[wavedrom, , svg]
2591
+
....
2592
+
{reg:[
2593
+
{bits: 7, name: 'OP-VE'},
2594
+
{bits: 5, name: 'vd'},
2595
+
{bits: 3, name: 'OPMVV'},
2596
+
{bits: 5, name: 'vs1'},
2597
+
{bits: 5, name: 'vs2'},
2598
+
{bits: 1, name: '1'},
2599
+
{bits: 6, name: '100011'},
2600
+
]}
2601
+
....
2602
+
2603
+
2604
+
2583
2605
Reserved Encodings::
2584
2606
* `SEW` is any value other than 32
2607
+
* Only for the `.vs` form: the `vd` register group overlaps the `vs2` scalar element group
2585
2608
2586
2609
Arguments::
2587
2610
@@ -2604,6 +2627,11 @@ Arguments::
2604
2627
Description::
2605
2628
A single "iteration" of the GHASH~H~ algorithm is performed.
2606
2629
2630
+
The previous partial hashes are read as 4-element groups from `vd`,
2631
+
the cipher texts are read as 4-element groups from `vs1`
2632
+
and the hash subkey is read either as 4-element groups from `vs2` (`vghsh.vv`) or from the scalar 4-element group in `vs2` (`vghsh.vs`).
2633
+
The resulting partial hashes are written as 4-element groups into `vd`.
2634
+
2607
2635
This instruction treats all of the inputs and outputs as 128-bit polynomials and
2608
2636
performs operations over GF[2].
2609
2637
It produces the next partial hash (Y~i+1~) by adding the current partial
@@ -2634,12 +2662,6 @@ with the NIST specification. These reversals are inexpensive to implement as the
2634
2662
swap bit positions and therefore do not require any logic.
2635
2663
====
2636
2664
2637
-
[NOTE]
2638
-
====
2639
-
Since the same hash subkey `H` will typically be used repeatedly on a given message,
2640
-
a future extension might define a vector-scalar version of this instruction where
2641
-
`vs2` is the scalar element group. This would help reduce register pressure when `LMUL` > 1.
0 commit comments