1|
2| UFC-crypt: ultra fast crypt(3) implementation
3| Copyright (C) 1991, 1992, Free Software Foundation, Inc.
4|
5| This library is free software, you can redistribute it and/or
6| modify it under the terms of the GNU Library General Public
7| License as published by the Free Software Foundation, either
8| version 2 of the License, or (at your option) any later version.
9|
10| This library is distributed in the hope that it will be useful,
11| but WITHOUT ANY WARRANTY, without even the implied warranty of
12| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13| Library General Public License for more details.
14|
15| You should have received a copy of the GNU Library General Public
16| License along with this library, if not, write to the Free
17| Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18|
19| @(#)crypt.sun3.S	2.12 2/15/92
20|
21| Assembly code for SUN3 68000 based workstations.
22| crypt.next68.S is generated automatically on basis of this module
23|
24
25#define L1	d0
26#define L2	d1
27#define R1	d2
28#define R2	d3
29#define SCR1	d4
30#define SCR2	d5
31
32#define I       d7
33#define ITR	a6@(24)
34
35#define SB0	a0
36#define SB1	a1
37#define SB2	a2
38#define SB3	a3
39#define KPTR	a4
40
41#define F(I,O1,O2,SBX,SBY)						\
42	movl 	KPTR@+,SCR1 ;		eorl 	I,SCR1 ;		\
43	movl	SBX@(0,SCR1:w),SCR2 ; 	eorl	SCR2,O1 ;		\
44	movl	SBX@(4,SCR1:w),SCR2 ;	eorl	SCR2,O2 ;		\
45	swap	SCR1 ;							\
46	movl	SBY@(0,SCR1:w),SCR2 ;	eorl	SCR2,O1 ;		\
47	movl	SBY@(4,SCR1:w),SCR2 ;	eorl	SCR2,O2 ;
48
49#define G(I1,I2,O1,O2)			\
50	F(I1,O1,O2,SB1,SB0) F(I2,O1,O2,SB3,SB2)
51
52#define H G(R1,R2,L1,L2) ; G(L1,L2,R1,R2)
53
54	.data
55	.ascii "UFC-crypt crypt.sun3.S, @(#)crypt.sun3.S	2.12 2/15/92\0"
56	.even
57
58	.text
59	.proc
60	.globl __ufc_doit
61__ufc_doit:
62|
63| Preamble
64|
65	link a6,#-56
66	moveml #15612,sp@
67
68	movl	a6@(20),R2
69	movl	a6@(16),R1
70	movl	a6@(12),L2
71	movl	a6@(8),L1
72|
73| Setup address registers with sb pointers
74|
75	movl	#__ufc_sb0,SB0 ; movl #__ufc_sb1,SB1
76	movl    #__ufc_sb2,SB2 ; movl #__ufc_sb3,SB3
77|
78| And loop...
79|
80Lagain:
81	movl  #__ufc_keytab,KPTR
82	moveq #8,I
83Lagain1:
84	H
85	subql #1,I
86	tstl  I
87	jne   Lagain1
88| Permute
89	movl L1,SCR1 ; movl R1,L1 ; movl SCR1,R1
90	movl L2,SCR1 ; movl R2,L2 ; movl SCR1,R2
91|
92	subql	#1,ITR
93	jne	Lagain
94|
95| Output conversion
96|
97	movl R2,sp@- ; movl R1,sp@-
98	movl L2,sp@- ; movl L1,sp@-
99	jbsr __ufc_dofinalperm ; addl #16,sp
100|
101| Postamble
102|
103	moveml 	a6@(-56),#15612 ; unlk a6 ; rts
104