@@ -56,20 +56,16 @@ unsafe extern "unadjusted" {
56
56
///
57
57
/// The `BS` parameter is expected to be a constant value and only the bottom 2 bits of `bs` are
58
58
/// used.
59
- ///
60
- /// # Safety
61
- ///
62
- /// This function is safe to use if the `zkne` target feature is present.
63
59
#[ target_feature( enable = "zkne" ) ]
64
60
#[ rustc_legacy_const_generics( 2 ) ]
65
61
// See #1464
66
62
// #[cfg_attr(test, assert_instr(aes32esi, BS = 0))]
67
63
#[ inline]
68
64
#[ 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 {
70
66
static_assert ! ( BS < 4 ) ;
71
67
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 }
73
69
}
74
70
75
71
/// AES middle round encryption instruction for RV32 with.
@@ -89,20 +85,16 @@ pub unsafe fn aes32esi<const BS: u8>(rs1: u32, rs2: u32) -> u32 {
89
85
///
90
86
/// The `bs` parameter is expected to be a constant value and only the bottom 2 bits of `bs` are
91
87
/// used.
92
- ///
93
- /// # Safety
94
- ///
95
- /// This function is safe to use if the `zkne` target feature is present.
96
88
#[ target_feature( enable = "zkne" ) ]
97
89
#[ rustc_legacy_const_generics( 2 ) ]
98
90
// See #1464
99
91
// #[cfg_attr(test, assert_instr(aes32esmi, BS = 0))]
100
92
#[ inline]
101
93
#[ 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 {
103
95
static_assert ! ( BS < 4 ) ;
104
96
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 }
106
98
}
107
99
108
100
/// AES final round decryption instruction for RV32.
@@ -121,20 +113,16 @@ pub unsafe fn aes32esmi<const BS: u8>(rs1: u32, rs2: u32) -> u32 {
121
113
///
122
114
/// The `BS` parameter is expected to be a constant value and only the bottom 2 bits of `bs` are
123
115
/// used.
124
- ///
125
- /// # Safety
126
- ///
127
- /// This function is safe to use if the `zknd` target feature is present.
128
116
#[ target_feature( enable = "zknd" ) ]
129
117
#[ rustc_legacy_const_generics( 2 ) ]
130
118
// See #1464
131
119
// #[cfg_attr(test, assert_instr(aes32dsi, BS = 0))]
132
120
#[ inline]
133
121
#[ 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 {
135
123
static_assert ! ( BS < 4 ) ;
136
124
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 }
138
126
}
139
127
140
128
/// AES middle round decryption instruction for RV32.
@@ -154,20 +142,16 @@ pub unsafe fn aes32dsi<const BS: u8>(rs1: u32, rs2: u32) -> u32 {
154
142
///
155
143
/// The `BS` parameter is expected to be a constant value and only the bottom 2 bits of `bs` are
156
144
/// used.
157
- ///
158
- /// # Safety
159
- ///
160
- /// This function is safe to use if the `zknd` target feature is present.
161
145
#[ target_feature( enable = "zknd" ) ]
162
146
#[ rustc_legacy_const_generics( 2 ) ]
163
147
// See #1464
164
148
// #[cfg_attr(test, assert_instr(aes32dsmi, BS = 0))]
165
149
#[ inline]
166
150
#[ 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 {
168
152
static_assert ! ( BS < 4 ) ;
169
153
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 }
171
155
}
172
156
173
157
/// 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 {
183
167
/// Version: v1.0.1
184
168
///
185
169
/// Section: 3.49
186
- ///
187
- /// # Safety
188
- ///
189
- /// This function is safe to use if the `zbkb` target feature is present.
190
170
#[ target_feature( enable = "zbkb" ) ]
191
171
// See #1464
192
172
// #[cfg_attr(test, assert_instr(zip))]
193
173
#[ inline]
194
174
#[ 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 }
197
177
}
198
178
199
179
/// 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 {
207
187
/// Version: v1.0.1
208
188
///
209
189
/// Section: 3.45
210
- ///
211
- /// # Safety
212
- ///
213
- /// This function is safe to use if the `zbkb` target feature is present.
214
190
#[ target_feature( enable = "zbkb" ) ]
215
191
#[ cfg_attr( test, assert_instr( unzip) ) ]
216
192
#[ inline]
217
193
#[ 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 }
220
196
}
221
197
222
198
/// 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 {
233
209
/// Version: v1.0.1
234
210
///
235
211
/// Section: 3.31
236
- ///
237
- /// # Safety
238
- ///
239
- /// This function is safe to use if the `zknh` target feature is present.
240
212
#[ target_feature( enable = "zknh" ) ]
241
213
// See #1464
242
214
// #[cfg_attr(test, assert_instr(sha512sig0h))]
243
215
#[ inline]
244
216
#[ 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 }
247
219
}
248
220
249
221
/// 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 {
260
232
/// Version: v1.0.1
261
233
///
262
234
/// Section: 3.32
263
- ///
264
- /// # Safety
265
- ///
266
- /// This function is safe to use if the `zknh` target feature is present.
267
235
#[ target_feature( enable = "zknh" ) ]
268
236
// See #1464
269
237
// #[cfg_attr(test, assert_instr(sha512sig0l))]
270
238
#[ inline]
271
239
#[ 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 }
274
242
}
275
243
276
244
/// 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 {
287
255
/// Version: v1.0.1
288
256
///
289
257
/// Section: 3.33
290
- ///
291
- /// # Safety
292
- ///
293
- /// This function is safe to use if the `zknh` target feature is present.
294
258
#[ target_feature( enable = "zknh" ) ]
295
259
// See #1464
296
260
// #[cfg_attr(test, assert_instr(sha512sig1h))]
297
261
#[ inline]
298
262
#[ 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 }
301
265
}
302
266
303
267
/// 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 {
314
278
/// Version: v1.0.1
315
279
///
316
280
/// Section: 3.34
317
- ///
318
- /// # Safety
319
- ///
320
- /// This function is safe to use if the `zknh` target feature is present.
321
281
#[ target_feature( enable = "zknh" ) ]
322
282
#[ cfg_attr( test, assert_instr( sha512sig1l) ) ]
323
283
#[ inline]
324
284
#[ 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 }
327
287
}
328
288
329
289
/// 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 {
339
299
/// Version: v1.0.1
340
300
///
341
301
/// Section: 3.35
342
- ///
343
- /// # Safety
344
- ///
345
- /// This function is safe to use if the `zknh` target feature is present.
346
302
#[ target_feature( enable = "zknh" ) ]
347
303
// See #1464
348
304
// #[cfg_attr(test, assert_instr(sha512sum0r))]
349
305
#[ inline]
350
306
#[ 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 }
353
309
}
354
310
355
311
/// 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 {
365
321
/// Version: v1.0.1
366
322
///
367
323
/// Section: 3.36
368
- ///
369
- /// # Safety
370
- ///
371
- /// This function is safe to use if the `zknh` target feature is present.
372
324
#[ target_feature( enable = "zknh" ) ]
373
325
// See #1464
374
326
// #[cfg_attr(test, assert_instr(sha512sum1r))]
375
327
#[ inline]
376
328
#[ 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 }
379
331
}
0 commit comments