xref: /linux/arch/sparc/crypto/des_asm.S (revision 498495dba268b20e8eadd7fe93c140c68b6cc9d2)
1*b2441318SGreg Kroah-Hartman/* SPDX-License-Identifier: GPL-2.0 */
2c5aac2dfSDavid S. Miller#include <linux/linkage.h>
3c5aac2dfSDavid S. Miller#include <asm/visasm.h>
4c5aac2dfSDavid S. Miller
57cff82f5SDavid S. Miller#include "opcodes.h"
6c5aac2dfSDavid S. Miller
7c5aac2dfSDavid S. Miller	.align	32
8c5aac2dfSDavid S. MillerENTRY(des_sparc64_key_expand)
9c5aac2dfSDavid S. Miller	/* %o0=input_key, %o1=output_key */
10c5aac2dfSDavid S. Miller	VISEntryHalf
11c5aac2dfSDavid S. Miller	ld	[%o0 + 0x00], %f0
12c5aac2dfSDavid S. Miller	ld	[%o0 + 0x04], %f1
13c5aac2dfSDavid S. Miller	DES_KEXPAND(0, 0, 0)
14c5aac2dfSDavid S. Miller	DES_KEXPAND(0, 1, 2)
15c5aac2dfSDavid S. Miller	DES_KEXPAND(2, 3, 6)
16c5aac2dfSDavid S. Miller	DES_KEXPAND(2, 2, 4)
17c5aac2dfSDavid S. Miller	DES_KEXPAND(6, 3, 10)
18c5aac2dfSDavid S. Miller	DES_KEXPAND(6, 2, 8)
19c5aac2dfSDavid S. Miller	DES_KEXPAND(10, 3, 14)
20c5aac2dfSDavid S. Miller	DES_KEXPAND(10, 2, 12)
21c5aac2dfSDavid S. Miller	DES_KEXPAND(14, 1, 16)
22c5aac2dfSDavid S. Miller	DES_KEXPAND(16, 3, 20)
23c5aac2dfSDavid S. Miller	DES_KEXPAND(16, 2, 18)
24c5aac2dfSDavid S. Miller	DES_KEXPAND(20, 3, 24)
25c5aac2dfSDavid S. Miller	DES_KEXPAND(20, 2, 22)
26c5aac2dfSDavid S. Miller	DES_KEXPAND(24, 3, 28)
27c5aac2dfSDavid S. Miller	DES_KEXPAND(24, 2, 26)
28c5aac2dfSDavid S. Miller	DES_KEXPAND(28, 1, 30)
29c5aac2dfSDavid S. Miller	std	%f0, [%o1 + 0x00]
30c5aac2dfSDavid S. Miller	std	%f2, [%o1 + 0x08]
31c5aac2dfSDavid S. Miller	std	%f4, [%o1 + 0x10]
32c5aac2dfSDavid S. Miller	std	%f6, [%o1 + 0x18]
33c5aac2dfSDavid S. Miller	std	%f8, [%o1 + 0x20]
34c5aac2dfSDavid S. Miller	std	%f10, [%o1 + 0x28]
35c5aac2dfSDavid S. Miller	std	%f12, [%o1 + 0x30]
36c5aac2dfSDavid S. Miller	std	%f14, [%o1 + 0x38]
37c5aac2dfSDavid S. Miller	std	%f16, [%o1 + 0x40]
38c5aac2dfSDavid S. Miller	std	%f18, [%o1 + 0x48]
39c5aac2dfSDavid S. Miller	std	%f20, [%o1 + 0x50]
40c5aac2dfSDavid S. Miller	std	%f22, [%o1 + 0x58]
41c5aac2dfSDavid S. Miller	std	%f24, [%o1 + 0x60]
42c5aac2dfSDavid S. Miller	std	%f26, [%o1 + 0x68]
43c5aac2dfSDavid S. Miller	std	%f28, [%o1 + 0x70]
44c5aac2dfSDavid S. Miller	std	%f30, [%o1 + 0x78]
45c5aac2dfSDavid S. Miller	retl
46c5aac2dfSDavid S. Miller	 VISExitHalf
47c5aac2dfSDavid S. MillerENDPROC(des_sparc64_key_expand)
48c5aac2dfSDavid S. Miller
49c5aac2dfSDavid S. Miller	.align	32
50c5aac2dfSDavid S. MillerENTRY(des_sparc64_crypt)
51c5aac2dfSDavid S. Miller	/* %o0=key, %o1=input, %o2=output */
52c5aac2dfSDavid S. Miller	VISEntry
53c5aac2dfSDavid S. Miller	ldd	[%o1 + 0x00], %f32
54c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x00], %f0
55c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x08], %f2
56c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x10], %f4
57c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x18], %f6
58c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x20], %f8
59c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x28], %f10
60c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x30], %f12
61c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x38], %f14
62c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x40], %f16
63c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x48], %f18
64c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x50], %f20
65c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x58], %f22
66c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x60], %f24
67c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x68], %f26
68c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x70], %f28
69c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x78], %f30
70c5aac2dfSDavid S. Miller	DES_IP(32, 32)
71c5aac2dfSDavid S. Miller	DES_ROUND(0, 2, 32, 32)
72c5aac2dfSDavid S. Miller	DES_ROUND(4, 6, 32, 32)
73c5aac2dfSDavid S. Miller	DES_ROUND(8, 10, 32, 32)
74c5aac2dfSDavid S. Miller	DES_ROUND(12, 14, 32, 32)
75c5aac2dfSDavid S. Miller	DES_ROUND(16, 18, 32, 32)
76c5aac2dfSDavid S. Miller	DES_ROUND(20, 22, 32, 32)
77c5aac2dfSDavid S. Miller	DES_ROUND(24, 26, 32, 32)
78c5aac2dfSDavid S. Miller	DES_ROUND(28, 30, 32, 32)
79c5aac2dfSDavid S. Miller	DES_IIP(32, 32)
80c5aac2dfSDavid S. Miller	std	%f32, [%o2 + 0x00]
81c5aac2dfSDavid S. Miller	retl
82c5aac2dfSDavid S. Miller	 VISExit
83c5aac2dfSDavid S. MillerENDPROC(des_sparc64_crypt)
84c5aac2dfSDavid S. Miller
85c5aac2dfSDavid S. Miller	.align	32
86c5aac2dfSDavid S. MillerENTRY(des_sparc64_load_keys)
87c5aac2dfSDavid S. Miller	/* %o0=key */
88c5aac2dfSDavid S. Miller	VISEntry
89c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x00], %f0
90c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x08], %f2
91c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x10], %f4
92c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x18], %f6
93c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x20], %f8
94c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x28], %f10
95c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x30], %f12
96c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x38], %f14
97c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x40], %f16
98c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x48], %f18
99c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x50], %f20
100c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x58], %f22
101c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x60], %f24
102c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x68], %f26
103c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x70], %f28
104c5aac2dfSDavid S. Miller	retl
105c5aac2dfSDavid S. Miller	 ldd	[%o0 + 0x78], %f30
106c5aac2dfSDavid S. MillerENDPROC(des_sparc64_load_keys)
107c5aac2dfSDavid S. Miller
108c5aac2dfSDavid S. Miller	.align	32
109c5aac2dfSDavid S. MillerENTRY(des_sparc64_ecb_crypt)
110c5aac2dfSDavid S. Miller	/* %o0=input, %o1=output, %o2=len */
111c5aac2dfSDavid S. Miller1:	ldd	[%o0 + 0x00], %f32
112c5aac2dfSDavid S. Miller	add	%o0, 0x08, %o0
113c5aac2dfSDavid S. Miller	DES_IP(32, 32)
114c5aac2dfSDavid S. Miller	DES_ROUND(0, 2, 32, 32)
115c5aac2dfSDavid S. Miller	DES_ROUND(4, 6, 32, 32)
116c5aac2dfSDavid S. Miller	DES_ROUND(8, 10, 32, 32)
117c5aac2dfSDavid S. Miller	DES_ROUND(12, 14, 32, 32)
118c5aac2dfSDavid S. Miller	DES_ROUND(16, 18, 32, 32)
119c5aac2dfSDavid S. Miller	DES_ROUND(20, 22, 32, 32)
120c5aac2dfSDavid S. Miller	DES_ROUND(24, 26, 32, 32)
121c5aac2dfSDavid S. Miller	DES_ROUND(28, 30, 32, 32)
122c5aac2dfSDavid S. Miller	DES_IIP(32, 32)
123c5aac2dfSDavid S. Miller	std	%f32, [%o1 + 0x00]
124c5aac2dfSDavid S. Miller	subcc	%o2, 0x08, %o2
125c5aac2dfSDavid S. Miller	bne,pt	%icc, 1b
126c5aac2dfSDavid S. Miller	 add	%o1, 0x08, %o1
127c5aac2dfSDavid S. Miller	retl
128c5aac2dfSDavid S. Miller	 nop
129c5aac2dfSDavid S. MillerENDPROC(des_sparc64_ecb_crypt)
130c5aac2dfSDavid S. Miller
131c5aac2dfSDavid S. Miller	.align	32
132c5aac2dfSDavid S. MillerENTRY(des_sparc64_cbc_encrypt)
133c5aac2dfSDavid S. Miller	/* %o0=input, %o1=output, %o2=len, %o3=IV */
134c5aac2dfSDavid S. Miller	ldd	[%o3 + 0x00], %f32
135c5aac2dfSDavid S. Miller1:	ldd	[%o0 + 0x00], %f34
136c5aac2dfSDavid S. Miller	fxor	%f32, %f34, %f32
137c5aac2dfSDavid S. Miller	DES_IP(32, 32)
138c5aac2dfSDavid S. Miller	DES_ROUND(0, 2, 32, 32)
139c5aac2dfSDavid S. Miller	DES_ROUND(4, 6, 32, 32)
140c5aac2dfSDavid S. Miller	DES_ROUND(8, 10, 32, 32)
141c5aac2dfSDavid S. Miller	DES_ROUND(12, 14, 32, 32)
142c5aac2dfSDavid S. Miller	DES_ROUND(16, 18, 32, 32)
143c5aac2dfSDavid S. Miller	DES_ROUND(20, 22, 32, 32)
144c5aac2dfSDavid S. Miller	DES_ROUND(24, 26, 32, 32)
145c5aac2dfSDavid S. Miller	DES_ROUND(28, 30, 32, 32)
146c5aac2dfSDavid S. Miller	DES_IIP(32, 32)
147c5aac2dfSDavid S. Miller	std	%f32, [%o1 + 0x00]
148c5aac2dfSDavid S. Miller	add	%o0, 0x08, %o0
149c5aac2dfSDavid S. Miller	subcc	%o2, 0x08, %o2
150c5aac2dfSDavid S. Miller	bne,pt	%icc, 1b
151c5aac2dfSDavid S. Miller	 add	%o1, 0x08, %o1
152c5aac2dfSDavid S. Miller	retl
153c5aac2dfSDavid S. Miller	 std	%f32, [%o3 + 0x00]
154c5aac2dfSDavid S. MillerENDPROC(des_sparc64_cbc_encrypt)
155c5aac2dfSDavid S. Miller
156c5aac2dfSDavid S. Miller	.align	32
157c5aac2dfSDavid S. MillerENTRY(des_sparc64_cbc_decrypt)
158c5aac2dfSDavid S. Miller	/* %o0=input, %o1=output, %o2=len, %o3=IV */
159c5aac2dfSDavid S. Miller	ldd	[%o3 + 0x00], %f34
160c5aac2dfSDavid S. Miller1:	ldd	[%o0 + 0x00], %f36
161c5aac2dfSDavid S. Miller	DES_IP(36, 32)
162c5aac2dfSDavid S. Miller	DES_ROUND(0, 2, 32, 32)
163c5aac2dfSDavid S. Miller	DES_ROUND(4, 6, 32, 32)
164c5aac2dfSDavid S. Miller	DES_ROUND(8, 10, 32, 32)
165c5aac2dfSDavid S. Miller	DES_ROUND(12, 14, 32, 32)
166c5aac2dfSDavid S. Miller	DES_ROUND(16, 18, 32, 32)
167c5aac2dfSDavid S. Miller	DES_ROUND(20, 22, 32, 32)
168c5aac2dfSDavid S. Miller	DES_ROUND(24, 26, 32, 32)
169c5aac2dfSDavid S. Miller	DES_ROUND(28, 30, 32, 32)
170c5aac2dfSDavid S. Miller	DES_IIP(32, 32)
171c5aac2dfSDavid S. Miller	fxor	%f32, %f34, %f32
17265d5fcf5SDavid S. Miller	fsrc2	%f36, %f34
173c5aac2dfSDavid S. Miller	std	%f32, [%o1 + 0x00]
174c5aac2dfSDavid S. Miller	add	%o0, 0x08, %o0
175c5aac2dfSDavid S. Miller	subcc	%o2, 0x08, %o2
176c5aac2dfSDavid S. Miller	bne,pt	%icc, 1b
177c5aac2dfSDavid S. Miller	 add	%o1, 0x08, %o1
178c5aac2dfSDavid S. Miller	retl
179c5aac2dfSDavid S. Miller	 std	%f36, [%o3 + 0x00]
180c5aac2dfSDavid S. MillerENDPROC(des_sparc64_cbc_decrypt)
181c5aac2dfSDavid S. Miller
182c5aac2dfSDavid S. Miller	.align	32
183c5aac2dfSDavid S. MillerENTRY(des3_ede_sparc64_crypt)
184c5aac2dfSDavid S. Miller	/* %o0=key, %o1=input, %o2=output */
185c5aac2dfSDavid S. Miller	VISEntry
186c5aac2dfSDavid S. Miller	ldd	[%o1 + 0x00], %f32
187c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x00], %f0
188c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x08], %f2
189c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x10], %f4
190c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x18], %f6
191c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x20], %f8
192c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x28], %f10
193c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x30], %f12
194c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x38], %f14
195c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x40], %f16
196c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x48], %f18
197c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x50], %f20
198c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x58], %f22
199c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x60], %f24
200c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x68], %f26
201c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x70], %f28
202c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x78], %f30
203c5aac2dfSDavid S. Miller	DES_IP(32, 32)
204c5aac2dfSDavid S. Miller	DES_ROUND(0, 2, 32, 32)
205c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x80], %f0
206c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x88], %f2
207c5aac2dfSDavid S. Miller	DES_ROUND(4, 6, 32, 32)
208c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x90], %f4
209c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x98], %f6
210c5aac2dfSDavid S. Miller	DES_ROUND(8, 10, 32, 32)
211c5aac2dfSDavid S. Miller	ldd	[%o0 + 0xa0], %f8
212c5aac2dfSDavid S. Miller	ldd	[%o0 + 0xa8], %f10
213c5aac2dfSDavid S. Miller	DES_ROUND(12, 14, 32, 32)
214c5aac2dfSDavid S. Miller	ldd	[%o0 + 0xb0], %f12
215c5aac2dfSDavid S. Miller	ldd	[%o0 + 0xb8], %f14
216c5aac2dfSDavid S. Miller	DES_ROUND(16, 18, 32, 32)
217c5aac2dfSDavid S. Miller	ldd	[%o0 + 0xc0], %f16
218c5aac2dfSDavid S. Miller	ldd	[%o0 + 0xc8], %f18
219c5aac2dfSDavid S. Miller	DES_ROUND(20, 22, 32, 32)
220c5aac2dfSDavid S. Miller	ldd	[%o0 + 0xd0], %f20
221c5aac2dfSDavid S. Miller	ldd	[%o0 + 0xd8], %f22
222c5aac2dfSDavid S. Miller	DES_ROUND(24, 26, 32, 32)
223c5aac2dfSDavid S. Miller	ldd	[%o0 + 0xe0], %f24
224c5aac2dfSDavid S. Miller	ldd	[%o0 + 0xe8], %f26
225c5aac2dfSDavid S. Miller	DES_ROUND(28, 30, 32, 32)
226c5aac2dfSDavid S. Miller	ldd	[%o0 + 0xf0], %f28
227c5aac2dfSDavid S. Miller	ldd	[%o0 + 0xf8], %f30
228c5aac2dfSDavid S. Miller	DES_IIP(32, 32)
229c5aac2dfSDavid S. Miller	DES_IP(32, 32)
230c5aac2dfSDavid S. Miller	DES_ROUND(0, 2, 32, 32)
231c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x100], %f0
232c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x108], %f2
233c5aac2dfSDavid S. Miller	DES_ROUND(4, 6, 32, 32)
234c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x110], %f4
235c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x118], %f6
236c5aac2dfSDavid S. Miller	DES_ROUND(8, 10, 32, 32)
237c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x120], %f8
238c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x128], %f10
239c5aac2dfSDavid S. Miller	DES_ROUND(12, 14, 32, 32)
240c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x130], %f12
241c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x138], %f14
242c5aac2dfSDavid S. Miller	DES_ROUND(16, 18, 32, 32)
243c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x140], %f16
244c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x148], %f18
245c5aac2dfSDavid S. Miller	DES_ROUND(20, 22, 32, 32)
246c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x150], %f20
247c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x158], %f22
248c5aac2dfSDavid S. Miller	DES_ROUND(24, 26, 32, 32)
249c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x160], %f24
250c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x168], %f26
251c5aac2dfSDavid S. Miller	DES_ROUND(28, 30, 32, 32)
252c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x170], %f28
253c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x178], %f30
254c5aac2dfSDavid S. Miller	DES_IIP(32, 32)
255c5aac2dfSDavid S. Miller	DES_IP(32, 32)
256c5aac2dfSDavid S. Miller	DES_ROUND(0, 2, 32, 32)
257c5aac2dfSDavid S. Miller	DES_ROUND(4, 6, 32, 32)
258c5aac2dfSDavid S. Miller	DES_ROUND(8, 10, 32, 32)
259c5aac2dfSDavid S. Miller	DES_ROUND(12, 14, 32, 32)
260c5aac2dfSDavid S. Miller	DES_ROUND(16, 18, 32, 32)
261c5aac2dfSDavid S. Miller	DES_ROUND(20, 22, 32, 32)
262c5aac2dfSDavid S. Miller	DES_ROUND(24, 26, 32, 32)
263c5aac2dfSDavid S. Miller	DES_ROUND(28, 30, 32, 32)
264c5aac2dfSDavid S. Miller	DES_IIP(32, 32)
265c5aac2dfSDavid S. Miller
266c5aac2dfSDavid S. Miller	std	%f32, [%o2 + 0x00]
267c5aac2dfSDavid S. Miller	retl
268c5aac2dfSDavid S. Miller	 VISExit
269c5aac2dfSDavid S. MillerENDPROC(des3_ede_sparc64_crypt)
270c5aac2dfSDavid S. Miller
271c5aac2dfSDavid S. Miller	.align	32
272c5aac2dfSDavid S. MillerENTRY(des3_ede_sparc64_load_keys)
273c5aac2dfSDavid S. Miller	/* %o0=key */
274c5aac2dfSDavid S. Miller	VISEntry
275c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x00], %f0
276c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x08], %f2
277c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x10], %f4
278c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x18], %f6
279c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x20], %f8
280c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x28], %f10
281c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x30], %f12
282c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x38], %f14
283c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x40], %f16
284c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x48], %f18
285c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x50], %f20
286c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x58], %f22
287c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x60], %f24
288c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x68], %f26
289c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x70], %f28
290c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x78], %f30
291c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x80], %f32
292c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x88], %f34
293c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x90], %f36
294c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x98], %f38
295c5aac2dfSDavid S. Miller	ldd	[%o0 + 0xa0], %f40
296c5aac2dfSDavid S. Miller	ldd	[%o0 + 0xa8], %f42
297c5aac2dfSDavid S. Miller	ldd	[%o0 + 0xb0], %f44
298c5aac2dfSDavid S. Miller	ldd	[%o0 + 0xb8], %f46
299c5aac2dfSDavid S. Miller	ldd	[%o0 + 0xc0], %f48
300c5aac2dfSDavid S. Miller	ldd	[%o0 + 0xc8], %f50
301c5aac2dfSDavid S. Miller	ldd	[%o0 + 0xd0], %f52
302c5aac2dfSDavid S. Miller	ldd	[%o0 + 0xd8], %f54
303c5aac2dfSDavid S. Miller	ldd	[%o0 + 0xe0], %f56
304c5aac2dfSDavid S. Miller	retl
305c5aac2dfSDavid S. Miller	 ldd	[%o0 + 0xe8], %f58
306c5aac2dfSDavid S. MillerENDPROC(des3_ede_sparc64_load_keys)
307c5aac2dfSDavid S. Miller
308c5aac2dfSDavid S. Miller#define DES3_LOOP_BODY(X) \
309c5aac2dfSDavid S. Miller	DES_IP(X, X) \
310c5aac2dfSDavid S. Miller	DES_ROUND(0, 2, X, X) \
311c5aac2dfSDavid S. Miller	DES_ROUND(4, 6, X, X) \
312c5aac2dfSDavid S. Miller	DES_ROUND(8, 10, X, X) \
313c5aac2dfSDavid S. Miller	DES_ROUND(12, 14, X, X) \
314c5aac2dfSDavid S. Miller	DES_ROUND(16, 18, X, X) \
315c5aac2dfSDavid S. Miller	ldd	[%o0 + 0xf0], %f16; \
316c5aac2dfSDavid S. Miller	ldd	[%o0 + 0xf8], %f18; \
317c5aac2dfSDavid S. Miller	DES_ROUND(20, 22, X, X) \
318c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x100], %f20; \
319c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x108], %f22; \
320c5aac2dfSDavid S. Miller	DES_ROUND(24, 26, X, X) \
321c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x110], %f24; \
322c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x118], %f26; \
323c5aac2dfSDavid S. Miller	DES_ROUND(28, 30, X, X) \
324c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x120], %f28; \
325c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x128], %f30; \
326c5aac2dfSDavid S. Miller	DES_IIP(X, X) \
327c5aac2dfSDavid S. Miller	DES_IP(X, X) \
328c5aac2dfSDavid S. Miller	DES_ROUND(32, 34, X, X) \
329c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x130], %f0; \
330c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x138], %f2; \
331c5aac2dfSDavid S. Miller	DES_ROUND(36, 38, X, X) \
332c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x140], %f4; \
333c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x148], %f6; \
334c5aac2dfSDavid S. Miller	DES_ROUND(40, 42, X, X) \
335c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x150], %f8; \
336c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x158], %f10; \
337c5aac2dfSDavid S. Miller	DES_ROUND(44, 46, X, X) \
338c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x160], %f12; \
339c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x168], %f14; \
340c5aac2dfSDavid S. Miller	DES_ROUND(48, 50, X, X) \
341c5aac2dfSDavid S. Miller	DES_ROUND(52, 54, X, X) \
342c5aac2dfSDavid S. Miller	DES_ROUND(56, 58, X, X) \
343c5aac2dfSDavid S. Miller	DES_ROUND(16, 18, X, X) \
344c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x170], %f16; \
345c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x178], %f18; \
346c5aac2dfSDavid S. Miller	DES_IIP(X, X) \
347c5aac2dfSDavid S. Miller	DES_IP(X, X) \
348c5aac2dfSDavid S. Miller	DES_ROUND(20, 22, X, X) \
349c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x50], %f20; \
350c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x58], %f22; \
351c5aac2dfSDavid S. Miller	DES_ROUND(24, 26, X, X) \
352c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x60], %f24; \
353c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x68], %f26; \
354c5aac2dfSDavid S. Miller	DES_ROUND(28, 30, X, X) \
355c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x70], %f28; \
356c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x78], %f30; \
357c5aac2dfSDavid S. Miller	DES_ROUND(0, 2, X, X) \
358c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x00], %f0; \
359c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x08], %f2; \
360c5aac2dfSDavid S. Miller	DES_ROUND(4, 6, X, X) \
361c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x10], %f4; \
362c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x18], %f6; \
363c5aac2dfSDavid S. Miller	DES_ROUND(8, 10, X, X) \
364c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x20], %f8; \
365c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x28], %f10; \
366c5aac2dfSDavid S. Miller	DES_ROUND(12, 14, X, X) \
367c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x30], %f12; \
368c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x38], %f14; \
369c5aac2dfSDavid S. Miller	DES_ROUND(16, 18, X, X) \
370c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x40], %f16; \
371c5aac2dfSDavid S. Miller	ldd	[%o0 + 0x48], %f18; \
372c5aac2dfSDavid S. Miller	DES_IIP(X, X)
373c5aac2dfSDavid S. Miller
374c5aac2dfSDavid S. Miller	.align	32
375c5aac2dfSDavid S. MillerENTRY(des3_ede_sparc64_ecb_crypt)
376c5aac2dfSDavid S. Miller	/* %o0=key, %o1=input, %o2=output, %o3=len */
377c5aac2dfSDavid S. Miller1:	ldd	[%o1 + 0x00], %f60
378c5aac2dfSDavid S. Miller	DES3_LOOP_BODY(60)
379c5aac2dfSDavid S. Miller	std	%f60, [%o2 + 0x00]
380ce688951SDavid S. Miller	add	%o1, 0x08, %o1
381c5aac2dfSDavid S. Miller	subcc	%o3, 0x08, %o3
382c5aac2dfSDavid S. Miller	bne,pt	%icc, 1b
383c5aac2dfSDavid S. Miller	 add	%o2, 0x08, %o2
384c5aac2dfSDavid S. Miller	retl
385c5aac2dfSDavid S. Miller	 nop
386c5aac2dfSDavid S. MillerENDPROC(des3_ede_sparc64_ecb_crypt)
387c5aac2dfSDavid S. Miller
388c5aac2dfSDavid S. Miller	.align	32
389c5aac2dfSDavid S. MillerENTRY(des3_ede_sparc64_cbc_encrypt)
390c5aac2dfSDavid S. Miller	/* %o0=key, %o1=input, %o2=output, %o3=len, %o4=IV */
391c5aac2dfSDavid S. Miller	ldd	[%o4 + 0x00], %f60
392c5aac2dfSDavid S. Miller1:	ldd	[%o1 + 0x00], %f62
393c5aac2dfSDavid S. Miller	fxor	%f60, %f62, %f60
394c5aac2dfSDavid S. Miller	DES3_LOOP_BODY(60)
395c5aac2dfSDavid S. Miller	std	%f60, [%o2 + 0x00]
396c5aac2dfSDavid S. Miller	add	%o1, 0x08, %o1
397c5aac2dfSDavid S. Miller	subcc	%o3, 0x08, %o3
398c5aac2dfSDavid S. Miller	bne,pt	%icc, 1b
399c5aac2dfSDavid S. Miller	 add	%o2, 0x08, %o2
400c5aac2dfSDavid S. Miller	retl
401c5aac2dfSDavid S. Miller	 std	%f60, [%o4 + 0x00]
402c5aac2dfSDavid S. MillerENDPROC(des3_ede_sparc64_cbc_encrypt)
403c5aac2dfSDavid S. Miller
404c5aac2dfSDavid S. Miller	.align	32
405c5aac2dfSDavid S. MillerENTRY(des3_ede_sparc64_cbc_decrypt)
406c5aac2dfSDavid S. Miller	/* %o0=key, %o1=input, %o2=output, %o3=len, %o4=IV */
407c5aac2dfSDavid S. Miller	ldd	[%o4 + 0x00], %f62
408c5aac2dfSDavid S. Miller1:	ldx	[%o1 + 0x00], %g1
409c5aac2dfSDavid S. Miller	MOVXTOD_G1_F60
410c5aac2dfSDavid S. Miller	DES3_LOOP_BODY(60)
411c5aac2dfSDavid S. Miller	fxor	%f62, %f60, %f60
412c5aac2dfSDavid S. Miller	MOVXTOD_G1_F62
413c5aac2dfSDavid S. Miller	std	%f60, [%o2 + 0x00]
414c5aac2dfSDavid S. Miller	add	%o1, 0x08, %o1
415c5aac2dfSDavid S. Miller	subcc	%o3, 0x08, %o3
416c5aac2dfSDavid S. Miller	bne,pt	%icc, 1b
417c5aac2dfSDavid S. Miller	 add	%o2, 0x08, %o2
418c5aac2dfSDavid S. Miller	retl
419c5aac2dfSDavid S. Miller	 stx	%g1, [%o4 + 0x00]
420c5aac2dfSDavid S. MillerENDPROC(des3_ede_sparc64_cbc_decrypt)
421