1.text
2
3
4.align	5
5KeccakF1600_int:
6	li	0,24
7	mtctr	0
8	b	.Loop
9.align	4
10.Loop:
11	xor	0,7,12
12	std	11,96(1)
13	xor	3,8,6
14	std	16,104(1)
15	xor	4,9,14
16	std	21,112(1)
17	xor	5,10,15
18	std	26,120(1)
19	xor	11,11,16
20	xor	0,0,17
21	xor	3,3,18
22	xor	4,4,19
23	xor	5,5,20
24	xor	11,11,21
25	xor	0,0,22
26	xor	3,3,23
27	xor	4,4,24
28	xor	5,5,25
29	xor	11,11,26
30	xor	0,0,27
31	xor	4,4,29
32	xor	3,3,28
33	xor	5,5,30
34	rotldi	16,4,1
35	xor	11,11,31
36	rotldi	21,5,1
37	xor	16,16,0
38	rotldi	26,11,1
39
40	xor	8,8,16
41	xor	6,6,16
42	xor	18,18,16
43	xor	23,23,16
44	xor	28,28,16
45
46	rotldi	16,0,1
47	xor	21,21,3
48	xor	4,4,26
49	rotldi	26,3,1
50	xor	5,5,16
51	xor	11,11,26
52
53	xor	3,   9,21
54	xor	14,14,21
55	xor	19,19,21
56	xor	24,24,21
57	xor	29,29,21
58
59	xor	7,7,11
60	xor	12,12,11
61	xor	17,17,11
62	xor	22,22,11
63	xor	27,27,11
64	ld	11,96(1)
65	xor	0,   10,4
66	ld	16,104(1)
67	xor	15,15,4
68	ld	21,112(1)
69	xor	20,20,4
70	ld	26,120(1)
71	xor	25,25,4
72	xor	30,30,4
73
74	xor	4,   11,5
75	xor	16,16,5
76	xor	21,21,5
77	xor	26,26,5
78	xor	31,31,5
79
80	mr	5,8
81	rotldi	8,6,44
82
83	rotldi	9,19,43
84
85	rotldi	10,25,21
86
87	rotldi	11,31,14
88
89	rotldi	6,16,20
90	rotldi	19,20,25
91	rotldi	25,24,15
92	rotldi	31,28,2
93
94	rotldi	16,29,61
95	rotldi	20,26,8
96	rotldi	24,18,10
97	rotldi	28,15,55
98
99	rotldi	29,21,39
100	rotldi	26,30,56
101	rotldi	18,14,6
102	rotldi	15,23,45
103
104	rotldi	21,27,18
105	rotldi	30,22,41
106	rotldi	14,17,3
107	rotldi	23,12,36
108
109	rotldi	12,0,28
110	rotldi	17,5,1
111	rotldi	22,4,27
112	rotldi	27,3,62
113
114	andc	0,9,8
115	andc	3,10,9
116	andc	4,7,11
117	andc	5,8,7
118	xor	7,7,0
119	andc	0,11,10
120	xor	8,8,3
121	ld	3,80(1)
122	xor	10,10,4
123	xor	11,11,5
124	xor	9,9,0
125	ldu	5,8(3)
126
127	andc	0,14,6
128	std	3,80(1)
129	andc	3,15,14
130	andc	4,12,16
131	xor	7,7,5
132	andc	5,6,12
133	xor	12,12,0
134	andc	0,16,15
135	xor	6,6,3
136	xor	15,15,4
137	xor	16,16,5
138	xor	14,14,0
139
140	andc	0,19,18
141	andc	3,20,19
142	andc	4,17,21
143	andc	5,18,17
144	xor	17,17,0
145	andc	0,21,20
146	xor	18,18,3
147	xor	20,20,4
148	xor	21,21,5
149	xor	19,19,0
150
151	andc	0,24,23
152	andc	3,25,24
153	andc	4,22,26
154	andc	5,23,22
155	xor	22,22,0
156	andc	0,26,25
157	xor	23,23,3
158	xor	25,25,4
159	xor	26,26,5
160	xor	24,24,0
161
162	andc	0,29,28
163	andc	3,30,29
164	andc	4,27,31
165	andc	5,28,27
166	xor	27,27,0
167	andc	0,31,30
168	xor	28,28,3
169	xor	30,30,4
170	xor	31,31,5
171	xor	29,29,0
172
173	bc	16,0,.Loop
174
175	blr
176.long	0
177.byte	0,12,0x14,0,0,0,0,0
178
179
180
181.align	5
182KeccakF1600:
183	stdu	1,-272(1)
184	mflr	0
185	std	14,128(1)
186	std	15,136(1)
187	std	16,144(1)
188	std	17,152(1)
189	std	18,160(1)
190	std	19,168(1)
191	std	20,176(1)
192	std	21,184(1)
193	std	22,192(1)
194	std	23,200(1)
195	std	24,208(1)
196	std	25,216(1)
197	std	26,224(1)
198	std	27,232(1)
199	std	28,240(1)
200	std	29,248(1)
201	std	30,256(1)
202	std	31,264(1)
203	std	0,288(1)
204
205	bl	PICmeup
206	subi	12,12,8
207
208	std	3,48(1)
209
210
211
212	std	12,80(1)
213
214	ld	7,0(3)
215	ld	8,8(3)
216	ld	9,16(3)
217	ld	10,24(3)
218	ld	11,32(3)
219	ld	12,40(3)
220	ld	6,48(3)
221	ld	14,56(3)
222	ld	15,64(3)
223	ld	16,72(3)
224	ld	17,80(3)
225	ld	18,88(3)
226	ld	19,96(3)
227	ld	20,104(3)
228	ld	21,112(3)
229	ld	22,120(3)
230	ld	23,128(3)
231	ld	24,136(3)
232	ld	25,144(3)
233	ld	26,152(3)
234	ld	27,160(3)
235	ld	28,168(3)
236	ld	29,176(3)
237	ld	30,184(3)
238	ld	31,192(3)
239
240	bl	KeccakF1600_int
241
242	ld	3,48(1)
243	std	7,0(3)
244	std	8,8(3)
245	std	9,16(3)
246	std	10,24(3)
247	std	11,32(3)
248	std	12,40(3)
249	std	6,48(3)
250	std	14,56(3)
251	std	15,64(3)
252	std	16,72(3)
253	std	17,80(3)
254	std	18,88(3)
255	std	19,96(3)
256	std	20,104(3)
257	std	21,112(3)
258	std	22,120(3)
259	std	23,128(3)
260	std	24,136(3)
261	std	25,144(3)
262	std	26,152(3)
263	std	27,160(3)
264	std	28,168(3)
265	std	29,176(3)
266	std	30,184(3)
267	std	31,192(3)
268
269	ld	0,288(1)
270	ld	14,128(1)
271	ld	15,136(1)
272	ld	16,144(1)
273	ld	17,152(1)
274	ld	18,160(1)
275	ld	19,168(1)
276	ld	20,176(1)
277	ld	21,184(1)
278	ld	22,192(1)
279	ld	23,200(1)
280	ld	24,208(1)
281	ld	25,216(1)
282	ld	26,224(1)
283	ld	27,232(1)
284	ld	28,240(1)
285	ld	29,248(1)
286	ld	30,256(1)
287	ld	31,264(1)
288	mtlr	0
289	addi	1,1,272
290	blr
291.long	0
292.byte	0,12,4,1,0x80,18,1,0
293.long	0
294
295
296
297.align	5
298dword_le_load:
299	lbzu	0,1(3)
300	lbzu	4,1(3)
301	lbzu	5,1(3)
302	insrdi	0,4,8,48
303	lbzu	4,1(3)
304	insrdi	0,5,8,40
305	lbzu	5,1(3)
306	insrdi	0,4,8,32
307	lbzu	4,1(3)
308	insrdi	0,5,8,24
309	lbzu	5,1(3)
310	insrdi	0,4,8,16
311	lbzu	4,1(3)
312	insrdi	0,5,8,8
313	insrdi	0,4,8,0
314	blr
315.long	0
316.byte	0,12,0x14,0,0,0,1,0
317.long	0
318
319
320.globl	SHA3_absorb_vsx
321.type	SHA3_absorb_vsx,@function
322.section	".opd","aw"
323.align	3
324SHA3_absorb_vsx:
325.quad	.SHA3_absorb_vsx,.TOC.@tocbase,0
326.previous
327
328.align	5
329.SHA3_absorb_vsx:
330	stdu	1,-272(1)
331	mflr	0
332	std	14,128(1)
333	std	15,136(1)
334	std	16,144(1)
335	std	17,152(1)
336	std	18,160(1)
337	std	19,168(1)
338	std	20,176(1)
339	std	21,184(1)
340	std	22,192(1)
341	std	23,200(1)
342	std	24,208(1)
343	std	25,216(1)
344	std	26,224(1)
345	std	27,232(1)
346	std	28,240(1)
347	std	29,248(1)
348	std	30,256(1)
349	std	31,264(1)
350	std	0,288(1)
351
352	bl	PICmeup
353	subi	4,4,1
354	subi	12,12,8
355
356	std	3,48(1)
357	std	4,56(1)
358	std	5,64(1)
359	std	6,72(1)
360	mr	0,6
361	std	12,80(1)
362
363	ld	7,0(3)
364	ld	8,8(3)
365	ld	9,16(3)
366	ld	10,24(3)
367	ld	11,32(3)
368	ld	12,40(3)
369	ld	6,48(3)
370	ld	14,56(3)
371	ld	15,64(3)
372	ld	16,72(3)
373	ld	17,80(3)
374	ld	18,88(3)
375	ld	19,96(3)
376	ld	20,104(3)
377	ld	21,112(3)
378	ld	22,120(3)
379	ld	23,128(3)
380	ld	24,136(3)
381	ld	25,144(3)
382	ld	26,152(3)
383	ld	27,160(3)
384	ld	28,168(3)
385	ld	29,176(3)
386	ld	30,184(3)
387	ld	31,192(3)
388
389	mr	3,4
390	mr	4,5
391	mr	5,0
392
393	b	.Loop_absorb
394
395.align	4
396.Loop_absorb:
397	cmpld	4,5
398	blt	.Labsorbed
399
400	sub	4,4,5
401	srwi	5,5,3
402	std	4,64(1)
403	mtctr	5
404	bl	dword_le_load
405	xor	7,7,0
406	bdz	.Lprocess_block
407	bl	dword_le_load
408	xor	8,8,0
409	bdz	.Lprocess_block
410	bl	dword_le_load
411	xor	9,9,0
412	bdz	.Lprocess_block
413	bl	dword_le_load
414	xor	10,10,0
415	bdz	.Lprocess_block
416	bl	dword_le_load
417	xor	11,11,0
418	bdz	.Lprocess_block
419	bl	dword_le_load
420	xor	12,12,0
421	bdz	.Lprocess_block
422	bl	dword_le_load
423	xor	6,6,0
424	bdz	.Lprocess_block
425	bl	dword_le_load
426	xor	14,14,0
427	bdz	.Lprocess_block
428	bl	dword_le_load
429	xor	15,15,0
430	bdz	.Lprocess_block
431	bl	dword_le_load
432	xor	16,16,0
433	bdz	.Lprocess_block
434	bl	dword_le_load
435	xor	17,17,0
436	bdz	.Lprocess_block
437	bl	dword_le_load
438	xor	18,18,0
439	bdz	.Lprocess_block
440	bl	dword_le_load
441	xor	19,19,0
442	bdz	.Lprocess_block
443	bl	dword_le_load
444	xor	20,20,0
445	bdz	.Lprocess_block
446	bl	dword_le_load
447	xor	21,21,0
448	bdz	.Lprocess_block
449	bl	dword_le_load
450	xor	22,22,0
451	bdz	.Lprocess_block
452	bl	dword_le_load
453	xor	23,23,0
454	bdz	.Lprocess_block
455	bl	dword_le_load
456	xor	24,24,0
457	bdz	.Lprocess_block
458	bl	dword_le_load
459	xor	25,25,0
460	bdz	.Lprocess_block
461	bl	dword_le_load
462	xor	26,26,0
463	bdz	.Lprocess_block
464	bl	dword_le_load
465	xor	27,27,0
466	bdz	.Lprocess_block
467	bl	dword_le_load
468	xor	28,28,0
469	bdz	.Lprocess_block
470	bl	dword_le_load
471	xor	29,29,0
472	bdz	.Lprocess_block
473	bl	dword_le_load
474	xor	30,30,0
475	bdz	.Lprocess_block
476	bl	dword_le_load
477	xor	31,31,0
478
479.Lprocess_block:
480	std	3,56(1)
481
482	bl	KeccakF1600_int
483
484	ld	0,80(1)
485	ld	5,72(1)
486	ld	4,64(1)
487	ld	3,56(1)
488	addic	0,0,-192
489	std	0,80(1)
490
491	b	.Loop_absorb
492
493.align	4
494.Labsorbed:
495	ld	3,48(1)
496	std	7,0(3)
497	std	8,8(3)
498	std	9,16(3)
499	std	10,24(3)
500	std	11,32(3)
501	std	12,40(3)
502	std	6,48(3)
503	std	14,56(3)
504	std	15,64(3)
505	std	16,72(3)
506	std	17,80(3)
507	std	18,88(3)
508	std	19,96(3)
509	std	20,104(3)
510	std	21,112(3)
511	std	22,120(3)
512	std	23,128(3)
513	std	24,136(3)
514	std	25,144(3)
515	std	26,152(3)
516	std	27,160(3)
517	std	28,168(3)
518	std	29,176(3)
519	std	30,184(3)
520	std	31,192(3)
521
522	mr	3,4
523	ld	0,288(1)
524	ld	14,128(1)
525	ld	15,136(1)
526	ld	16,144(1)
527	ld	17,152(1)
528	ld	18,160(1)
529	ld	19,168(1)
530	ld	20,176(1)
531	ld	21,184(1)
532	ld	22,192(1)
533	ld	23,200(1)
534	ld	24,208(1)
535	ld	25,216(1)
536	ld	26,224(1)
537	ld	27,232(1)
538	ld	28,240(1)
539	ld	29,248(1)
540	ld	30,256(1)
541	ld	31,264(1)
542	mtlr	0
543	addi	1,1,272
544	blr
545.long	0
546.byte	0,12,4,1,0x80,18,4,0
547.long	0
548
549.globl	SHA3_squeeze_vsx
550.type	SHA3_squeeze_vsx,@function
551.section	".opd","aw"
552.align	3
553SHA3_squeeze_vsx:
554.quad	.SHA3_squeeze_vsx,.TOC.@tocbase,0
555.previous
556
557.align	5
558.SHA3_squeeze_vsx:
559	stdu	1,-80(1)
560	mflr	0
561	std	28,48(1)
562	std	29,56(1)
563	std	30,64(1)
564	std	31,72(1)
565	std	0,96(1)
566
567	mr	28,3
568	subi	3,3,8
569	subi	29,4,1
570	mr	30,5
571	mr	31,6
572	b	.Loop_squeeze
573
574.align	4
575.Loop_squeeze:
576	ldu	0,8(3)
577	cmpldi	30,8
578	blt	.Lsqueeze_tail
579
580	stbu	0,1(29)
581	srdi	0,0,8
582	stbu	0,1(29)
583	srdi	0,0,8
584	stbu	0,1(29)
585	srdi	0,0,8
586	stbu	0,1(29)
587	srdi	0,0,8
588	stbu	0,1(29)
589	srdi	0,0,8
590	stbu	0,1(29)
591	srdi	0,0,8
592	stbu	0,1(29)
593	srdi	0,0,8
594	stbu	0,1(29)
595
596	subic.	30,30,8
597	beq	.Lsqueeze_done
598
599	subic.	6,6,8
600	bgt	.Loop_squeeze
601
602	mr	3,28
603	bl	KeccakF1600
604	subi	3,28,8
605	mr	6,31
606	b	.Loop_squeeze
607
608.align	4
609.Lsqueeze_tail:
610	mtctr	30
611.Loop_tail:
612	stbu	0,1(29)
613	srdi	0,0,8
614	bc	16,0,.Loop_tail
615
616.Lsqueeze_done:
617	ld	0,96(1)
618	ld	28,48(1)
619	ld	29,56(1)
620	ld	30,64(1)
621	ld	31,72(1)
622	mtlr	0
623	addi	1,1,80
624	blr
625.long	0
626.byte	0,12,4,1,0x80,4,4,0
627.long	0
628
629.align	6
630PICmeup:
631	mflr	0
632	bcl	20,31,$+4
633	mflr	12
634	addi	12,12,56
635	mtlr	0
636	blr
637.long	0
638.byte	0,12,0x14,0,0,0,0,0
639.space	28
640
641iotas:
642.long	0x00000000,0x00000001
643.long	0x00000000,0x00008082
644.long	0x80000000,0x0000808a
645.long	0x80000000,0x80008000
646.long	0x00000000,0x0000808b
647.long	0x00000000,0x80000001
648.long	0x80000000,0x80008081
649.long	0x80000000,0x00008009
650.long	0x00000000,0x0000008a
651.long	0x00000000,0x00000088
652.long	0x00000000,0x80008009
653.long	0x00000000,0x8000000a
654.long	0x00000000,0x8000808b
655.long	0x80000000,0x0000008b
656.long	0x80000000,0x00008089
657.long	0x80000000,0x00008003
658.long	0x80000000,0x00008002
659.long	0x80000000,0x00000080
660.long	0x00000000,0x0000800a
661.long	0x80000000,0x8000000a
662.long	0x80000000,0x80008081
663.long	0x80000000,0x00008080
664.long	0x00000000,0x80000001
665.long	0x80000000,0x80008008
666
667.byte	75,101,99,99,97,107,45,49,54,48,48,32,97,98,115,111,114,98,32,97,110,100,32,115,113,117,101,101,122,101,32,102,111,114,32,80,80,67,54,52,44,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
668.align	2
669