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