File: crypt.sun3.S

package info (click to toggle)
xisp 2.6p1-2
  • links: PTS
  • area: contrib
  • in suites: potato
  • size: 1,412 kB
  • ctags: 2,059
  • sloc: ansic: 18,700; sh: 272; makefile: 218; asm: 214; perl: 56
file content (103 lines) | stat: -rw-r--r-- 2,367 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
| UFC-crypt: ultra fast crypt(3) implementation
| Copyright (C) 1991, 1992, Free Software Foundation, Inc.
|
| This library is free software, you can redistribute it and/or
| modify it under the terms of the GNU Library General Public
| License as published by the Free Software Foundation, either
| version 2 of the License, or (at your option) any later version.
|
| This library is distributed in the hope that it will be useful,
| but WITHOUT ANY WARRANTY, without even the implied warranty of
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
| Library General Public License for more details.
|
| You should have received a copy of the GNU Library General Public
| License along with this library, if not, write to the Free
| Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
| @(#)crypt.sun3.S	2.12 2/15/92
|
| Assembly code for SUN3 68000 based workstations.
| crypt.next68.S is generated automatically on basis of this module
|

#define L1	d0
#define L2	d1
#define R1	d2
#define R2	d3
#define SCR1	d4
#define SCR2	d5

#define I       d7
#define ITR	a6@(24)

#define SB0	a0
#define SB1	a1
#define SB2	a2
#define SB3	a3
#define KPTR	a4
	
#define F(I,O1,O2,SBX,SBY)						\
	movl 	KPTR@+,SCR1 ;		eorl 	I,SCR1 ;		\
	movl	SBX@(0,SCR1:w),SCR2 ; 	eorl	SCR2,O1 ;		\
	movl	SBX@(4,SCR1:w),SCR2 ;	eorl	SCR2,O2 ;		\
	swap	SCR1 ;							\
	movl	SBY@(0,SCR1:w),SCR2 ;	eorl	SCR2,O1 ;		\
	movl	SBY@(4,SCR1:w),SCR2 ;	eorl	SCR2,O2 ;

#define G(I1,I2,O1,O2)			\
	F(I1,O1,O2,SB1,SB0) F(I2,O1,O2,SB3,SB2)

#define H G(R1,R2,L1,L2) ; G(L1,L2,R1,R2)

	.data
	.ascii "UFC-crypt crypt.sun3.S, @(#)crypt.sun3.S	2.12 2/15/92\0"
	.even

	.text
	.proc
	.globl __ufc_doit
__ufc_doit:
|
| Preamble
|
	link a6,#-56
	moveml #15612,sp@

	movl	a6@(20),R2
	movl	a6@(16),R1
	movl	a6@(12),L2
	movl	a6@(8),L1
|
| Setup address registers with sb pointers
|
	movl	#__ufc_sb0,SB0 ; movl #__ufc_sb1,SB1 
	movl    #__ufc_sb2,SB2 ; movl #__ufc_sb3,SB3
| 
| And loop...
|
Lagain:	
	movl  #__ufc_keytab,KPTR
	moveq #8,I
Lagain1:
	H
	subql #1,I
	tstl  I
	jne   Lagain1	
| Permute
	movl L1,SCR1 ; movl R1,L1 ; movl SCR1,R1
	movl L2,SCR1 ; movl R2,L2 ; movl SCR1,R2
|
	subql	#1,ITR
	jne	Lagain
|
| Output conversion
|
	movl R2,sp@- ; movl R1,sp@-
	movl L2,sp@- ; movl L1,sp@-
	jbsr __ufc_dofinalperm ; addl #16,sp
|
| Postamble
|
	moveml 	a6@(-56),#15612 ; unlk a6 ; rts