@@ -56,20 +56,16 @@ unsafe extern "unadjusted" {
5656///
5757/// The `BS` parameter is expected to be a constant value and only the bottom 2 bits of `bs` are
5858/// used.
59- ///
60- /// # Safety
61- ///
62- /// This function is safe to use if the `zkne` target feature is present.
6359#[ target_feature( enable = "zkne" ) ]
6460#[ rustc_legacy_const_generics( 2 ) ]
6561// See #1464
6662// #[cfg_attr(test, assert_instr(aes32esi, BS = 0))]
6763#[ inline]
6864#[ unstable( feature = "riscv_ext_intrinsics" , issue = "114544" ) ]
69- pub unsafe fn aes32esi < const BS : u8 > ( rs1 : u32 , rs2 : u32 ) -> u32 {
65+ pub fn aes32esi < const BS : u8 > ( rs1 : u32 , rs2 : u32 ) -> u32 {
7066 static_assert ! ( BS < 4 ) ;
7167
72- _aes32esi ( rs1 as i32 , rs2 as i32 , BS as i32 ) as u32
68+ unsafe { _aes32esi ( rs1 as i32 , rs2 as i32 , BS as i32 ) as u32 }
7369}
7470
7571/// AES middle round encryption instruction for RV32 with.
@@ -89,20 +85,16 @@ pub unsafe fn aes32esi<const BS: u8>(rs1: u32, rs2: u32) -> u32 {
8985///
9086/// The `bs` parameter is expected to be a constant value and only the bottom 2 bits of `bs` are
9187/// used.
92- ///
93- /// # Safety
94- ///
95- /// This function is safe to use if the `zkne` target feature is present.
9688#[ target_feature( enable = "zkne" ) ]
9789#[ rustc_legacy_const_generics( 2 ) ]
9890// See #1464
9991// #[cfg_attr(test, assert_instr(aes32esmi, BS = 0))]
10092#[ inline]
10193#[ unstable( feature = "riscv_ext_intrinsics" , issue = "114544" ) ]
102- pub unsafe fn aes32esmi < const BS : u8 > ( rs1 : u32 , rs2 : u32 ) -> u32 {
94+ pub fn aes32esmi < const BS : u8 > ( rs1 : u32 , rs2 : u32 ) -> u32 {
10395 static_assert ! ( BS < 4 ) ;
10496
105- _aes32esmi ( rs1 as i32 , rs2 as i32 , BS as i32 ) as u32
97+ unsafe { _aes32esmi ( rs1 as i32 , rs2 as i32 , BS as i32 ) as u32 }
10698}
10799
108100/// AES final round decryption instruction for RV32.
@@ -121,20 +113,16 @@ pub unsafe fn aes32esmi<const BS: u8>(rs1: u32, rs2: u32) -> u32 {
121113///
122114/// The `BS` parameter is expected to be a constant value and only the bottom 2 bits of `bs` are
123115/// used.
124- ///
125- /// # Safety
126- ///
127- /// This function is safe to use if the `zknd` target feature is present.
128116#[ target_feature( enable = "zknd" ) ]
129117#[ rustc_legacy_const_generics( 2 ) ]
130118// See #1464
131119// #[cfg_attr(test, assert_instr(aes32dsi, BS = 0))]
132120#[ inline]
133121#[ unstable( feature = "riscv_ext_intrinsics" , issue = "114544" ) ]
134- pub unsafe fn aes32dsi < const BS : u8 > ( rs1 : u32 , rs2 : u32 ) -> u32 {
122+ pub fn aes32dsi < const BS : u8 > ( rs1 : u32 , rs2 : u32 ) -> u32 {
135123 static_assert ! ( BS < 4 ) ;
136124
137- _aes32dsi ( rs1 as i32 , rs2 as i32 , BS as i32 ) as u32
125+ unsafe { _aes32dsi ( rs1 as i32 , rs2 as i32 , BS as i32 ) as u32 }
138126}
139127
140128/// AES middle round decryption instruction for RV32.
@@ -154,20 +142,16 @@ pub unsafe fn aes32dsi<const BS: u8>(rs1: u32, rs2: u32) -> u32 {
154142///
155143/// The `BS` parameter is expected to be a constant value and only the bottom 2 bits of `bs` are
156144/// used.
157- ///
158- /// # Safety
159- ///
160- /// This function is safe to use if the `zknd` target feature is present.
161145#[ target_feature( enable = "zknd" ) ]
162146#[ rustc_legacy_const_generics( 2 ) ]
163147// See #1464
164148// #[cfg_attr(test, assert_instr(aes32dsmi, BS = 0))]
165149#[ inline]
166150#[ unstable( feature = "riscv_ext_intrinsics" , issue = "114544" ) ]
167- pub unsafe fn aes32dsmi < const BS : u8 > ( rs1 : u32 , rs2 : u32 ) -> u32 {
151+ pub fn aes32dsmi < const BS : u8 > ( rs1 : u32 , rs2 : u32 ) -> u32 {
168152 static_assert ! ( BS < 4 ) ;
169153
170- _aes32dsmi ( rs1 as i32 , rs2 as i32 , BS as i32 ) as u32
154+ unsafe { _aes32dsmi ( rs1 as i32 , rs2 as i32 , BS as i32 ) as u32 }
171155}
172156
173157/// Place upper/lower halves of the source register into odd/even bits of the destination
@@ -183,17 +167,13 @@ pub unsafe fn aes32dsmi<const BS: u8>(rs1: u32, rs2: u32) -> u32 {
183167/// Version: v1.0.1
184168///
185169/// Section: 3.49
186- ///
187- /// # Safety
188- ///
189- /// This function is safe to use if the `zbkb` target feature is present.
190170#[ target_feature( enable = "zbkb" ) ]
191171// See #1464
192172// #[cfg_attr(test, assert_instr(zip))]
193173#[ inline]
194174#[ unstable( feature = "riscv_ext_intrinsics" , issue = "114544" ) ]
195- pub unsafe fn zip ( rs : u32 ) -> u32 {
196- _zip ( rs as i32 ) as u32
175+ pub fn zip ( rs : u32 ) -> u32 {
176+ unsafe { _zip ( rs as i32 ) as u32 }
197177}
198178
199179/// Place odd and even bits of the source word into upper/lower halves of the destination.
@@ -207,16 +187,12 @@ pub unsafe fn zip(rs: u32) -> u32 {
207187/// Version: v1.0.1
208188///
209189/// Section: 3.45
210- ///
211- /// # Safety
212- ///
213- /// This function is safe to use if the `zbkb` target feature is present.
214190#[ target_feature( enable = "zbkb" ) ]
215191#[ cfg_attr( test, assert_instr( unzip) ) ]
216192#[ inline]
217193#[ unstable( feature = "riscv_ext_intrinsics" , issue = "114544" ) ]
218- pub unsafe fn unzip ( rs : u32 ) -> u32 {
219- _unzip ( rs as i32 ) as u32
194+ pub fn unzip ( rs : u32 ) -> u32 {
195+ unsafe { _unzip ( rs as i32 ) as u32 }
220196}
221197
222198/// Implements the high half of the Sigma0 transformation, as used in the SHA2-512 hash
@@ -233,17 +209,13 @@ pub unsafe fn unzip(rs: u32) -> u32 {
233209/// Version: v1.0.1
234210///
235211/// Section: 3.31
236- ///
237- /// # Safety
238- ///
239- /// This function is safe to use if the `zknh` target feature is present.
240212#[ target_feature( enable = "zknh" ) ]
241213// See #1464
242214// #[cfg_attr(test, assert_instr(sha512sig0h))]
243215#[ inline]
244216#[ unstable( feature = "riscv_ext_intrinsics" , issue = "114544" ) ]
245- pub unsafe fn sha512sig0h ( rs1 : u32 , rs2 : u32 ) -> u32 {
246- _sha512sig0h ( rs1 as i32 , rs2 as i32 ) as u32
217+ pub fn sha512sig0h ( rs1 : u32 , rs2 : u32 ) -> u32 {
218+ unsafe { _sha512sig0h ( rs1 as i32 , rs2 as i32 ) as u32 }
247219}
248220
249221/// Implements the low half of the Sigma0 transformation, as used in the SHA2-512 hash function
@@ -260,17 +232,13 @@ pub unsafe fn sha512sig0h(rs1: u32, rs2: u32) -> u32 {
260232/// Version: v1.0.1
261233///
262234/// Section: 3.32
263- ///
264- /// # Safety
265- ///
266- /// This function is safe to use if the `zknh` target feature is present.
267235#[ target_feature( enable = "zknh" ) ]
268236// See #1464
269237// #[cfg_attr(test, assert_instr(sha512sig0l))]
270238#[ inline]
271239#[ unstable( feature = "riscv_ext_intrinsics" , issue = "114544" ) ]
272- pub unsafe fn sha512sig0l ( rs1 : u32 , rs2 : u32 ) -> u32 {
273- _sha512sig0l ( rs1 as i32 , rs2 as i32 ) as u32
240+ pub fn sha512sig0l ( rs1 : u32 , rs2 : u32 ) -> u32 {
241+ unsafe { _sha512sig0l ( rs1 as i32 , rs2 as i32 ) as u32 }
274242}
275243
276244/// Implements the high half of the Sigma1 transformation, as used in the SHA2-512 hash
@@ -287,17 +255,13 @@ pub unsafe fn sha512sig0l(rs1: u32, rs2: u32) -> u32 {
287255/// Version: v1.0.1
288256///
289257/// Section: 3.33
290- ///
291- /// # Safety
292- ///
293- /// This function is safe to use if the `zknh` target feature is present.
294258#[ target_feature( enable = "zknh" ) ]
295259// See #1464
296260// #[cfg_attr(test, assert_instr(sha512sig1h))]
297261#[ inline]
298262#[ unstable( feature = "riscv_ext_intrinsics" , issue = "114544" ) ]
299- pub unsafe fn sha512sig1h ( rs1 : u32 , rs2 : u32 ) -> u32 {
300- _sha512sig1h ( rs1 as i32 , rs2 as i32 ) as u32
263+ pub fn sha512sig1h ( rs1 : u32 , rs2 : u32 ) -> u32 {
264+ unsafe { _sha512sig1h ( rs1 as i32 , rs2 as i32 ) as u32 }
301265}
302266
303267/// Implements the low half of the Sigma1 transformation, as used in the SHA2-512 hash function
@@ -314,16 +278,12 @@ pub unsafe fn sha512sig1h(rs1: u32, rs2: u32) -> u32 {
314278/// Version: v1.0.1
315279///
316280/// Section: 3.34
317- ///
318- /// # Safety
319- ///
320- /// This function is safe to use if the `zknh` target feature is present.
321281#[ target_feature( enable = "zknh" ) ]
322282#[ cfg_attr( test, assert_instr( sha512sig1l) ) ]
323283#[ inline]
324284#[ unstable( feature = "riscv_ext_intrinsics" , issue = "114544" ) ]
325- pub unsafe fn sha512sig1l ( rs1 : u32 , rs2 : u32 ) -> u32 {
326- _sha512sig1l ( rs1 as i32 , rs2 as i32 ) as u32
285+ pub fn sha512sig1l ( rs1 : u32 , rs2 : u32 ) -> u32 {
286+ unsafe { _sha512sig1l ( rs1 as i32 , rs2 as i32 ) as u32 }
327287}
328288
329289/// Implements the Sum0 transformation, as used in the SHA2-512 hash function \[49\] (Section
@@ -339,17 +299,13 @@ pub unsafe fn sha512sig1l(rs1: u32, rs2: u32) -> u32 {
339299/// Version: v1.0.1
340300///
341301/// Section: 3.35
342- ///
343- /// # Safety
344- ///
345- /// This function is safe to use if the `zknh` target feature is present.
346302#[ target_feature( enable = "zknh" ) ]
347303// See #1464
348304// #[cfg_attr(test, assert_instr(sha512sum0r))]
349305#[ inline]
350306#[ unstable( feature = "riscv_ext_intrinsics" , issue = "114544" ) ]
351- pub unsafe fn sha512sum0r ( rs1 : u32 , rs2 : u32 ) -> u32 {
352- _sha512sum0r ( rs1 as i32 , rs2 as i32 ) as u32
307+ pub fn sha512sum0r ( rs1 : u32 , rs2 : u32 ) -> u32 {
308+ unsafe { _sha512sum0r ( rs1 as i32 , rs2 as i32 ) as u32 }
353309}
354310
355311/// Implements the Sum1 transformation, as used in the SHA2-512 hash function \[49\] (Section
@@ -365,15 +321,11 @@ pub unsafe fn sha512sum0r(rs1: u32, rs2: u32) -> u32 {
365321/// Version: v1.0.1
366322///
367323/// Section: 3.36
368- ///
369- /// # Safety
370- ///
371- /// This function is safe to use if the `zknh` target feature is present.
372324#[ target_feature( enable = "zknh" ) ]
373325// See #1464
374326// #[cfg_attr(test, assert_instr(sha512sum1r))]
375327#[ inline]
376328#[ unstable( feature = "riscv_ext_intrinsics" , issue = "114544" ) ]
377- pub unsafe fn sha512sum1r ( rs1 : u32 , rs2 : u32 ) -> u32 {
378- _sha512sum1r ( rs1 as i32 , rs2 as i32 ) as u32
329+ pub fn sha512sum1r ( rs1 : u32 , rs2 : u32 ) -> u32 {
330+ unsafe { _sha512sum1r ( rs1 as i32 , rs2 as i32 ) as u32 }
379331}
0 commit comments