@@ -20,6 +20,9 @@ extern "unadjusted" {
20
20
#[ link_name = "llvm.riscv.aes64ks2" ]
21
21
fn _aes64ks2 ( rs1 : i64 , rs2 : i64 ) -> i64 ;
22
22
23
+ #[ link_name = "llvm.riscv.aes64im" ]
24
+ fn _aes64im ( rs1 : i64 ) -> i64 ;
25
+
23
26
#[ link_name = "llvm.riscv.sha512sig0" ]
24
27
fn _sha512sig0 ( rs1 : i64 ) -> i64 ;
25
28
@@ -178,6 +181,30 @@ pub unsafe fn aes64ks2(rs1: u64, rs2: u64) -> u64 {
178
181
_aes64ks2 ( rs1 as i64 , rs2 as i64 ) as u64
179
182
}
180
183
184
+ /// This instruction accelerates the inverse MixColumns step of the AES Block Cipher, and is used to aid creation of
185
+ /// the decryption KeySchedule.
186
+ ///
187
+ /// The instruction applies the inverse MixColumns transformation to two columns of the state array, packed
188
+ /// into a single 64-bit register. It is used to create the inverse cipher KeySchedule, according to the equivalent
189
+ /// inverse cipher construction in (Page 23, Section 5.3.5). This instruction must always be implemented
190
+ /// such that its execution latency does not depend on the data being operated on.
191
+ ///
192
+ /// Source: RISC-V Cryptography Extensions Volume I: Scalar & Entropy Source Instructions
193
+ ///
194
+ /// Version: v1.0.1
195
+ ///
196
+ /// Section: 3.9
197
+ ///
198
+ /// # Safety
199
+ ///
200
+ /// This function is safe to use if the `zkne` or `zknd` target feature is present.
201
+ #[ target_feature( enable = "zkne" , enable = "zknd" ) ]
202
+ #[ cfg_attr( test, assert_instr( aes64im) ) ]
203
+ #[ inline]
204
+ pub unsafe fn aes64im ( rs1 : u64 ) -> u64 {
205
+ _aes64im ( rs1 as i64 ) as u64
206
+ }
207
+
181
208
/// Implements the Sigma0 transformation function as used in the SHA2-512 hash function \[49\]
182
209
/// (Section 4.1.3).
183
210
///
0 commit comments