@@ -15,38 +15,24 @@ extern "C" {
15
15
#[ link_name = "llvm.aarch64.crypto.sha1h" ]
16
16
fn vsha1h_u32_ ( hash_e : u32 ) -> u32 ;
17
17
#[ link_name = "llvm.aarch64.crypto.sha1su0" ]
18
- fn vsha1su0q_u32_ (
19
- w0_3 : uint32x4_t , w4_7 : uint32x4_t , w8_11 : uint32x4_t ,
20
- ) -> uint32x4_t ;
18
+ fn vsha1su0q_u32_ ( w0_3 : uint32x4_t , w4_7 : uint32x4_t , w8_11 : uint32x4_t ) -> uint32x4_t ;
21
19
#[ link_name = "llvm.aarch64.crypto.sha1su1" ]
22
20
fn vsha1su1q_u32_ ( tw0_3 : uint32x4_t , w12_15 : uint32x4_t ) -> uint32x4_t ;
23
21
#[ link_name = "llvm.aarch64.crypto.sha1c" ]
24
- fn vsha1cq_u32_ (
25
- hash_abcd : uint32x4_t , hash_e : u32 , wk : uint32x4_t ,
26
- ) -> uint32x4_t ;
22
+ fn vsha1cq_u32_ ( hash_abcd : uint32x4_t , hash_e : u32 , wk : uint32x4_t ) -> uint32x4_t ;
27
23
#[ link_name = "llvm.aarch64.crypto.sha1p" ]
28
- fn vsha1pq_u32_ (
29
- hash_abcd : uint32x4_t , hash_e : u32 , wk : uint32x4_t ,
30
- ) -> uint32x4_t ;
24
+ fn vsha1pq_u32_ ( hash_abcd : uint32x4_t , hash_e : u32 , wk : uint32x4_t ) -> uint32x4_t ;
31
25
#[ link_name = "llvm.aarch64.crypto.sha1m" ]
32
- fn vsha1mq_u32_ (
33
- hash_abcd : uint32x4_t , hash_e : u32 , wk : uint32x4_t ,
34
- ) -> uint32x4_t ;
26
+ fn vsha1mq_u32_ ( hash_abcd : uint32x4_t , hash_e : u32 , wk : uint32x4_t ) -> uint32x4_t ;
35
27
36
28
#[ link_name = "llvm.aarch64.crypto.sha256h" ]
37
- fn vsha256hq_u32_ (
38
- hash_abcd : uint32x4_t , hash_efgh : uint32x4_t , wk : uint32x4_t ,
39
- ) -> uint32x4_t ;
29
+ fn vsha256hq_u32_ ( hash_abcd : uint32x4_t , hash_efgh : uint32x4_t , wk : uint32x4_t ) -> uint32x4_t ;
40
30
#[ link_name = "llvm.aarch64.crypto.sha256h2" ]
41
- fn vsha256h2q_u32_ (
42
- hash_efgh : uint32x4_t , hash_abcd : uint32x4_t , wk : uint32x4_t ,
43
- ) -> uint32x4_t ;
31
+ fn vsha256h2q_u32_ ( hash_efgh : uint32x4_t , hash_abcd : uint32x4_t , wk : uint32x4_t ) -> uint32x4_t ;
44
32
#[ link_name = "llvm.aarch64.crypto.sha256su0" ]
45
33
fn vsha256su0q_u32_ ( w0_3 : uint32x4_t , w4_7 : uint32x4_t ) -> uint32x4_t ;
46
34
#[ link_name = "llvm.aarch64.crypto.sha256su1" ]
47
- fn vsha256su1q_u32_ (
48
- tw0_3 : uint32x4_t , w8_11 : uint32x4_t , w12_15 : uint32x4_t ,
49
- ) -> uint32x4_t ;
35
+ fn vsha256su1q_u32_ ( tw0_3 : uint32x4_t , w8_11 : uint32x4_t , w12_15 : uint32x4_t ) -> uint32x4_t ;
50
36
}
51
37
52
38
#[ cfg( test) ]
@@ -96,49 +82,39 @@ pub unsafe fn vsha1h_u32(hash_e: u32) -> u32 {
96
82
#[ inline]
97
83
#[ target_feature( enable = "crypto" ) ]
98
84
#[ cfg_attr( test, assert_instr( sha1c) ) ]
99
- pub unsafe fn vsha1cq_u32 (
100
- hash_abcd : uint32x4_t , hash_e : u32 , wk : uint32x4_t ,
101
- ) -> uint32x4_t {
85
+ pub unsafe fn vsha1cq_u32 ( hash_abcd : uint32x4_t , hash_e : u32 , wk : uint32x4_t ) -> uint32x4_t {
102
86
vsha1cq_u32_ ( hash_abcd, hash_e, wk)
103
87
}
104
88
105
89
/// SHA1 hash update accelerator, majority.
106
90
#[ inline]
107
91
#[ target_feature( enable = "crypto" ) ]
108
92
#[ cfg_attr( test, assert_instr( sha1m) ) ]
109
- pub unsafe fn vsha1mq_u32 (
110
- hash_abcd : uint32x4_t , hash_e : u32 , wk : uint32x4_t ,
111
- ) -> uint32x4_t {
93
+ pub unsafe fn vsha1mq_u32 ( hash_abcd : uint32x4_t , hash_e : u32 , wk : uint32x4_t ) -> uint32x4_t {
112
94
vsha1mq_u32_ ( hash_abcd, hash_e, wk)
113
95
}
114
96
115
97
/// SHA1 hash update accelerator, parity.
116
98
#[ inline]
117
99
#[ target_feature( enable = "crypto" ) ]
118
100
#[ cfg_attr( test, assert_instr( sha1p) ) ]
119
- pub unsafe fn vsha1pq_u32 (
120
- hash_abcd : uint32x4_t , hash_e : u32 , wk : uint32x4_t ,
121
- ) -> uint32x4_t {
101
+ pub unsafe fn vsha1pq_u32 ( hash_abcd : uint32x4_t , hash_e : u32 , wk : uint32x4_t ) -> uint32x4_t {
122
102
vsha1pq_u32_ ( hash_abcd, hash_e, wk)
123
103
}
124
104
125
105
/// SHA1 schedule update accelerator, first part.
126
106
#[ inline]
127
107
#[ target_feature( enable = "crypto" ) ]
128
108
#[ cfg_attr( test, assert_instr( sha1su0) ) ]
129
- pub unsafe fn vsha1su0q_u32 (
130
- w0_3 : uint32x4_t , w4_7 : uint32x4_t , w8_11 : uint32x4_t ,
131
- ) -> uint32x4_t {
109
+ pub unsafe fn vsha1su0q_u32 ( w0_3 : uint32x4_t , w4_7 : uint32x4_t , w8_11 : uint32x4_t ) -> uint32x4_t {
132
110
vsha1su0q_u32_ ( w0_3, w4_7, w8_11)
133
111
}
134
112
135
113
/// SHA1 schedule update accelerator, second part.
136
114
#[ inline]
137
115
#[ target_feature( enable = "crypto" ) ]
138
116
#[ cfg_attr( test, assert_instr( sha1su1) ) ]
139
- pub unsafe fn vsha1su1q_u32 (
140
- tw0_3 : uint32x4_t , w12_15 : uint32x4_t ,
141
- ) -> uint32x4_t {
117
+ pub unsafe fn vsha1su1q_u32 ( tw0_3 : uint32x4_t , w12_15 : uint32x4_t ) -> uint32x4_t {
142
118
vsha1su1q_u32_ ( tw0_3, w12_15)
143
119
}
144
120
@@ -147,7 +123,9 @@ pub unsafe fn vsha1su1q_u32(
147
123
#[ target_feature( enable = "crypto" ) ]
148
124
#[ cfg_attr( test, assert_instr( sha256h) ) ]
149
125
pub unsafe fn vsha256hq_u32 (
150
- hash_abcd : uint32x4_t , hash_efgh : uint32x4_t , wk : uint32x4_t ,
126
+ hash_abcd : uint32x4_t ,
127
+ hash_efgh : uint32x4_t ,
128
+ wk : uint32x4_t ,
151
129
) -> uint32x4_t {
152
130
vsha256hq_u32_ ( hash_abcd, hash_efgh, wk)
153
131
}
@@ -157,7 +135,9 @@ pub unsafe fn vsha256hq_u32(
157
135
#[ target_feature( enable = "crypto" ) ]
158
136
#[ cfg_attr( test, assert_instr( sha256h2) ) ]
159
137
pub unsafe fn vsha256h2q_u32 (
160
- hash_efgh : uint32x4_t , hash_abcd : uint32x4_t , wk : uint32x4_t ,
138
+ hash_efgh : uint32x4_t ,
139
+ hash_abcd : uint32x4_t ,
140
+ wk : uint32x4_t ,
161
141
) -> uint32x4_t {
162
142
vsha256h2q_u32_ ( hash_efgh, hash_abcd, wk)
163
143
}
@@ -166,9 +146,7 @@ pub unsafe fn vsha256h2q_u32(
166
146
#[ inline]
167
147
#[ target_feature( enable = "crypto" ) ]
168
148
#[ cfg_attr( test, assert_instr( sha256su0) ) ]
169
- pub unsafe fn vsha256su0q_u32 (
170
- w0_3 : uint32x4_t , w4_7 : uint32x4_t ,
171
- ) -> uint32x4_t {
149
+ pub unsafe fn vsha256su0q_u32 ( w0_3 : uint32x4_t , w4_7 : uint32x4_t ) -> uint32x4_t {
172
150
vsha256su0q_u32_ ( w0_3, w4_7)
173
151
}
174
152
@@ -177,7 +155,9 @@ pub unsafe fn vsha256su0q_u32(
177
155
#[ target_feature( enable = "crypto" ) ]
178
156
#[ cfg_attr( test, assert_instr( sha256su1) ) ]
179
157
pub unsafe fn vsha256su1q_u32 (
180
- tw0_3 : uint32x4_t , w8_11 : uint32x4_t , w12_15 : uint32x4_t ,
158
+ tw0_3 : uint32x4_t ,
159
+ w8_11 : uint32x4_t ,
160
+ w12_15 : uint32x4_t ,
181
161
) -> uint32x4_t {
182
162
vsha256su1q_u32_ ( tw0_3, w8_11, w12_15)
183
163
}
@@ -191,44 +171,31 @@ mod tests {
191
171
192
172
#[ simd_test( enable = "crypto" ) ]
193
173
unsafe fn test_vaeseq_u8 ( ) {
194
- let data = :: mem:: transmute ( u8x16:: new (
195
- 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ,
196
- ) ) ;
197
- let key = :: mem:: transmute ( u8x16:: new (
198
- 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 ,
199
- ) ) ;
174
+ let data = :: mem:: transmute ( u8x16:: new ( 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ) ) ;
175
+ let key = :: mem:: transmute ( u8x16:: new ( 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 ) ) ;
200
176
let r: u8x16 = :: mem:: transmute ( vaeseq_u8 ( data, key) ) ;
201
177
assert_eq ! (
202
178
r,
203
179
u8x16:: new(
204
- 124 , 123 , 124 , 118 , 124 , 123 , 124 , 197 , 124 , 123 , 124 , 118 ,
205
- 124 , 123 , 124 , 197
180
+ 124 , 123 , 124 , 118 , 124 , 123 , 124 , 197 , 124 , 123 , 124 , 118 , 124 , 123 , 124 , 197
206
181
)
207
182
) ;
208
183
}
209
184
210
185
#[ simd_test( enable = "crypto" ) ]
211
186
unsafe fn test_vaesdq_u8 ( ) {
212
- let data = :: mem:: transmute ( u8x16:: new (
213
- 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ,
214
- ) ) ;
215
- let key = :: mem:: transmute ( u8x16:: new (
216
- 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 ,
217
- ) ) ;
187
+ let data = :: mem:: transmute ( u8x16:: new ( 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ) ) ;
188
+ let key = :: mem:: transmute ( u8x16:: new ( 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 ) ) ;
218
189
let r: u8x16 = :: mem:: transmute ( vaesdq_u8 ( data, key) ) ;
219
190
assert_eq ! (
220
191
r,
221
- u8x16:: new(
222
- 9 , 213 , 9 , 251 , 9 , 213 , 9 , 56 , 9 , 213 , 9 , 251 , 9 , 213 , 9 , 56
223
- )
192
+ u8x16:: new( 9 , 213 , 9 , 251 , 9 , 213 , 9 , 56 , 9 , 213 , 9 , 251 , 9 , 213 , 9 , 56 )
224
193
) ;
225
194
}
226
195
227
196
#[ simd_test( enable = "crypto" ) ]
228
197
unsafe fn test_vaesmcq_u8 ( ) {
229
- let data = :: mem:: transmute ( u8x16:: new (
230
- 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ,
231
- ) ) ;
198
+ let data = :: mem:: transmute ( u8x16:: new ( 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ) ) ;
232
199
let r: u8x16 = :: mem:: transmute ( vaesmcq_u8 ( data) ) ;
233
200
assert_eq ! (
234
201
r,
@@ -238,16 +205,11 @@ mod tests {
238
205
239
206
#[ simd_test( enable = "crypto" ) ]
240
207
unsafe fn test_vaesimcq_u8 ( ) {
241
- let data = :: mem:: transmute ( u8x16:: new (
242
- 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ,
243
- ) ) ;
208
+ let data = :: mem:: transmute ( u8x16:: new ( 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ) ) ;
244
209
let r: u8x16 = :: mem:: transmute ( vaesimcq_u8 ( data) ) ;
245
210
assert_eq ! (
246
211
r,
247
- u8x16:: new(
248
- 43 , 60 , 33 , 50 , 103 , 80 , 125 , 70 , 43 , 60 , 33 , 50 , 103 , 80 ,
249
- 125 , 70
250
- )
212
+ u8x16:: new( 43 , 60 , 33 , 50 , 103 , 80 , 125 , 70 , 43 , 60 , 33 , 50 , 103 , 80 , 125 , 70 )
251
213
) ;
252
214
}
253
215
@@ -260,15 +222,9 @@ mod tests {
260
222
#[ simd_test( enable = "crypto" ) ]
261
223
unsafe fn test_vsha1su0q_u32 ( ) {
262
224
let r: u32x4 = :: mem:: transmute ( vsha1su0q_u32 (
263
- :: mem:: transmute ( u32x4:: new (
264
- 0x1234_u32 , 0x5678_u32 , 0x9abc_u32 , 0xdef0_u32 ,
265
- ) ) ,
266
- :: mem:: transmute ( u32x4:: new (
267
- 0x1234_u32 , 0x5678_u32 , 0x9abc_u32 , 0xdef0_u32 ,
268
- ) ) ,
269
- :: mem:: transmute ( u32x4:: new (
270
- 0x1234_u32 , 0x5678_u32 , 0x9abc_u32 , 0xdef0_u32 ,
271
- ) ) ,
225
+ :: mem:: transmute ( u32x4:: new ( 0x1234_u32 , 0x5678_u32 , 0x9abc_u32 , 0xdef0_u32 ) ) ,
226
+ :: mem:: transmute ( u32x4:: new ( 0x1234_u32 , 0x5678_u32 , 0x9abc_u32 , 0xdef0_u32 ) ) ,
227
+ :: mem:: transmute ( u32x4:: new ( 0x1234_u32 , 0x5678_u32 , 0x9abc_u32 , 0xdef0_u32 ) ) ,
272
228
) ) ;
273
229
assert_eq ! ( r, u32x4:: new( 0x9abc , 0xdef0 , 0x1234 , 0x5678 ) ) ;
274
230
}
0 commit comments