10Sstevel@tonic-gate/*
20Sstevel@tonic-gate * CDDL HEADER START
30Sstevel@tonic-gate *
40Sstevel@tonic-gate * The contents of this file are subject to the terms of the
53708Skrishna * Common Development and Distribution License (the "License").
63708Skrishna * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate *
80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate * See the License for the specific language governing permissions
110Sstevel@tonic-gate * and limitations under the License.
120Sstevel@tonic-gate *
130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate *
190Sstevel@tonic-gate * CDDL HEADER END
200Sstevel@tonic-gate */
210Sstevel@tonic-gate/*
22*9110Sopensolaris@drydog.com * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate * Use is subject to license terms.
240Sstevel@tonic-gate */
250Sstevel@tonic-gate
26*9110Sopensolaris@drydog.com#if defined(lint) || defined(__lint)
27*9110Sopensolaris@drydog.com
28*9110Sopensolaris@drydog.com#include "arcfour.h"
290Sstevel@tonic-gate
30*9110Sopensolaris@drydog.com/* ARGSUSED */
31*9110Sopensolaris@drydog.comvoid
32*9110Sopensolaris@drydog.comarcfour_crypt_aligned(ARCFour_key *key, size_t len, uchar_t *in, uchar_t *out)
33*9110Sopensolaris@drydog.com{}
34*9110Sopensolaris@drydog.com
35*9110Sopensolaris@drydog.com#else	/* lint || __lint */
360Sstevel@tonic-gate
370Sstevel@tonic-gate	.register	%g2,#scratch
380Sstevel@tonic-gate	.register	%g3,#scratch
390Sstevel@tonic-gate
400Sstevel@tonic-gate	.section	".text",#alloc,#execinstr
410Sstevel@tonic-gate	.file	"arcfour_crypt_asm.s"
420Sstevel@tonic-gate
430Sstevel@tonic-gate	.section	".text",#alloc
440Sstevel@tonic-gate	.align	32
450Sstevel@tonic-gate
460Sstevel@tonic-gate	.section	".text",#alloc,#execinstr
470Sstevel@tonic-gate	.align	32
480Sstevel@tonic-gate	.skip	32
490Sstevel@tonic-gate
500Sstevel@tonic-gate/*
510Sstevel@tonic-gate * SUBROUTINE arcfour_crypt_aligned
520Sstevel@tonic-gate *
53*9110Sopensolaris@drydog.com * void arcfour_crypt_aligned(ARCFour_key *key, size_t len,
54*9110Sopensolaris@drydog.com *			uchar_t *in, uchar_t *out);
550Sstevel@tonic-gate *
560Sstevel@tonic-gate * in and out should be aligned on an 8-byte boundary, but len can be anything
570Sstevel@tonic-gate */
580Sstevel@tonic-gate	.global arcfour_crypt_aligned
59*9110Sopensolaris@drydog.com
60*9110Sopensolaris@drydog.com
610Sstevel@tonic-gatearcfour_crypt_aligned:
620Sstevel@tonic-gate
630Sstevel@tonic-gate/* EXPORT DELETE START */
640Sstevel@tonic-gate	save	%sp,-144,%sp
650Sstevel@tonic-gate
660Sstevel@tonic-gate	srl	%i1, 3, %l7
673708Skrishna	ldub	[%i0+256], %g1
680Sstevel@tonic-gate
690Sstevel@tonic-gate	orcc	%l7, %g0, %g0
703708Skrishna	ldub	[%i0+257], %g2
710Sstevel@tonic-gate
720Sstevel@tonic-gate	add	%g1, 1, %o1
730Sstevel@tonic-gate	bz	%icc, .Loop2
743708Skrishna	add	%i0, 0, %i5
750Sstevel@tonic-gate
760Sstevel@tonic-gate	add	%o1, 1, %g1
770Sstevel@tonic-gate	and	%o1, 255, %o1
780Sstevel@tonic-gate
790Sstevel@tonic-gate	and	%g1, 255, %g1
800Sstevel@tonic-gate	ldub	[%i5 + %o1], %o3
810Sstevel@tonic-gate
820Sstevel@tonic-gate	ldub	[%i5 + %g1], %g3
830Sstevel@tonic-gate
840Sstevel@tonic-gate	add	%g2, %o3, %o2
850Sstevel@tonic-gate
860Sstevel@tonic-gate	add	%o2, %g3, %g2
870Sstevel@tonic-gate	and	%o2, 255, %o2
880Sstevel@tonic-gate
890Sstevel@tonic-gate	and	%g2, 255, %g2
900Sstevel@tonic-gate	ldub	[%i5 + %o2], %o4
910Sstevel@tonic-gate
920Sstevel@tonic-gate	stb	%o3, [%i5+%o2]
930Sstevel@tonic-gate	subcc	%o2, %g1, %g0
940Sstevel@tonic-gate
950Sstevel@tonic-gate	stb	%o4, [%i5 + %o1]
960Sstevel@tonic-gate	bz	%icc, .L1A
970Sstevel@tonic-gate	add	%o3,%o4,%o5
980Sstevel@tonic-gate.L1B:
990Sstevel@tonic-gate	and	%o5, 255, %o5
1000Sstevel@tonic-gate	ldub	[%i5 + %g2], %g4
1010Sstevel@tonic-gate
1020Sstevel@tonic-gate	ldub	[%i5 + %o5], %o5
1030Sstevel@tonic-gate	add	%g1, 1, %o1
1040Sstevel@tonic-gate
1050Sstevel@tonic-gate	and	%o1, 255, %o1
1060Sstevel@tonic-gate	stb	%g3, [%i5 + %g2]
1070Sstevel@tonic-gate	add	%g3, %g4, %g5
1080Sstevel@tonic-gate
1090Sstevel@tonic-gate	and	%g5, 255, %g5
1100Sstevel@tonic-gate	stb	%g4, [%i5 + %g1]
1110Sstevel@tonic-gate	add	%o1, 1, %g1
1120Sstevel@tonic-gate
1130Sstevel@tonic-gate
1140Sstevel@tonic-gate	sllx	%o5, 56, %o0
1150Sstevel@tonic-gate	ldub	[%i5 + %o1], %o3
1160Sstevel@tonic-gate	and	%g1, 255, %g1
1170Sstevel@tonic-gate
1180Sstevel@tonic-gate	ldub	[%i5 + %g1], %g3
1190Sstevel@tonic-gate
1200Sstevel@tonic-gate	add	%g2, %o3, %o2
1210Sstevel@tonic-gate	ldub	[%i5 + %g5], %g5
1220Sstevel@tonic-gate
1230Sstevel@tonic-gate	add	%o2, %g3, %g2
1240Sstevel@tonic-gate	and	%o2, 255, %o2
1250Sstevel@tonic-gate
1260Sstevel@tonic-gate	sllx	%g5, 48, %g5
1270Sstevel@tonic-gate	ldub	[%i5 + %o2], %o4
1280Sstevel@tonic-gate	and	%g2, 255, %g2
1290Sstevel@tonic-gate
1300Sstevel@tonic-gate	or	%o0, %g5, %o0
1310Sstevel@tonic-gate	stb	%o3, [%i5+%o2]
1320Sstevel@tonic-gate	subcc	%o2, %g1, %g0
1330Sstevel@tonic-gate
1340Sstevel@tonic-gate	stb	%o4, [%i5 + %o1]
1350Sstevel@tonic-gate	bz	%icc, .L2A
1360Sstevel@tonic-gate	add	%o3,%o4,%o5
1370Sstevel@tonic-gate.L2B:
1380Sstevel@tonic-gate	and	%o5, 255, %o5
1390Sstevel@tonic-gate	ldub	[%i5 + %g2], %g4
1400Sstevel@tonic-gate
1410Sstevel@tonic-gate	ldub	[%i5 + %o5], %o5
1420Sstevel@tonic-gate	add	%g1, 1, %o1
1430Sstevel@tonic-gate
1440Sstevel@tonic-gate	and	%o1, 255, %o1
1450Sstevel@tonic-gate	stb	%g3, [%i5 + %g2]
1460Sstevel@tonic-gate	add	%g3, %g4, %g5
1470Sstevel@tonic-gate
1480Sstevel@tonic-gate	and	%g5, 255, %g5
1490Sstevel@tonic-gate	stb	%g4, [%i5 + %g1]
1500Sstevel@tonic-gate	add	%o1, 1, %g1
1510Sstevel@tonic-gate
1520Sstevel@tonic-gate
1530Sstevel@tonic-gate	sllx	%o5, 40, %o5
1540Sstevel@tonic-gate	ldub	[%i5 + %o1], %o3
1550Sstevel@tonic-gate	and	%g1, 255, %g1
1560Sstevel@tonic-gate
1570Sstevel@tonic-gate	ldub	[%i5 + %g1], %g3
1580Sstevel@tonic-gate	or	%o0, %o5, %o0
1590Sstevel@tonic-gate
1600Sstevel@tonic-gate	add	%g2, %o3, %o2
1610Sstevel@tonic-gate	ldub	[%i5 + %g5], %g5
1620Sstevel@tonic-gate
1630Sstevel@tonic-gate	add	%o2, %g3, %g2
1640Sstevel@tonic-gate	and	%o2, 255, %o2
1650Sstevel@tonic-gate
1660Sstevel@tonic-gate	sllx	%g5, 32, %g5
1670Sstevel@tonic-gate	ldub	[%i5 + %o2], %o4
1680Sstevel@tonic-gate	and	%g2, 255, %g2
1690Sstevel@tonic-gate
1700Sstevel@tonic-gate	or	%o0, %g5, %o0
1710Sstevel@tonic-gate	stb	%o3, [%i5+%o2]
1720Sstevel@tonic-gate	subcc	%o2, %g1, %g0
1730Sstevel@tonic-gate
1740Sstevel@tonic-gate	stb	%o4, [%i5 + %o1]
1750Sstevel@tonic-gate	bz	%icc, .L3A
1760Sstevel@tonic-gate	add	%o3,%o4,%o5
1770Sstevel@tonic-gate.L3B:
1780Sstevel@tonic-gate	and	%o5, 255, %o5
1790Sstevel@tonic-gate	ldub	[%i5 + %g2], %g4
1800Sstevel@tonic-gate
1810Sstevel@tonic-gate	ldub	[%i5 + %o5], %o5
1820Sstevel@tonic-gate	add	%g1, 1, %o1
1830Sstevel@tonic-gate
1840Sstevel@tonic-gate	and	%o1, 255, %o1
1850Sstevel@tonic-gate	stb	%g3, [%i5 + %g2]
1860Sstevel@tonic-gate	add	%g3, %g4, %g5
1870Sstevel@tonic-gate
1880Sstevel@tonic-gate	and	%g5, 255, %g5
1890Sstevel@tonic-gate	stb	%g4, [%i5 + %g1]
1900Sstevel@tonic-gate	add	%o1, 1, %g1
1910Sstevel@tonic-gate
1920Sstevel@tonic-gate
1930Sstevel@tonic-gate	sll	%o5, 24, %o5
1940Sstevel@tonic-gate	ldub	[%i5 + %o1], %o3
1950Sstevel@tonic-gate	and	%g1, 255, %g1
1960Sstevel@tonic-gate
1970Sstevel@tonic-gate	sub	%i1, 8, %i1
1980Sstevel@tonic-gate	ldub	[%i5 + %g1], %g3
1990Sstevel@tonic-gate	or	%o0, %o5, %o0
2000Sstevel@tonic-gate
2010Sstevel@tonic-gate	srl	%i1, 3, %l7
2020Sstevel@tonic-gate	ldub	[%i5 + %g5], %g5
2030Sstevel@tonic-gate	add	%g2, %o3, %o2
2040Sstevel@tonic-gate
2050Sstevel@tonic-gate	add	%o2, %g3, %g2
2060Sstevel@tonic-gate	and	%o2, 255, %o2
2070Sstevel@tonic-gate
2080Sstevel@tonic-gate	sll	%g5, 16, %g5
2090Sstevel@tonic-gate	ldub	[%i5 + %o2], %o4
2100Sstevel@tonic-gate	and	%g2, 255, %g2
2110Sstevel@tonic-gate
2120Sstevel@tonic-gate	or	%o0, %g5, %o0
2130Sstevel@tonic-gate	stb	%o3, [%i5+%o2]
2140Sstevel@tonic-gate	subcc	%o2, %g1, %g0
2150Sstevel@tonic-gate
2160Sstevel@tonic-gate	stb	%o4, [%i5 + %o1]
2170Sstevel@tonic-gate	bz	%icc, .L4A
2180Sstevel@tonic-gate	add	%o3,%o4,%o5
2190Sstevel@tonic-gate.L4B:
2200Sstevel@tonic-gate	and	%o5, 255, %o5
2210Sstevel@tonic-gate	ldub	[%i5 + %g2], %g4
2220Sstevel@tonic-gate	add	%g1, 1, %o1
2230Sstevel@tonic-gate
2240Sstevel@tonic-gate	orcc	%l7, %g0, %g0
2250Sstevel@tonic-gate	ldub	[%i5 + %o5], %o5
2260Sstevel@tonic-gate	and	%o1, 255, %o1
2270Sstevel@tonic-gate
2280Sstevel@tonic-gate	add	%g3, %g4, %g5
2290Sstevel@tonic-gate	stb	%g4, [%i5 + %g1]
2300Sstevel@tonic-gate	add	%o1, 1, %g1
2310Sstevel@tonic-gate
2320Sstevel@tonic-gate	stb	%g3, [%i5 + %g2]
2330Sstevel@tonic-gate	bz	%icc, .EndLoop1
2340Sstevel@tonic-gate	and	%g5, 255, %g5
2350Sstevel@tonic-gate
2360Sstevel@tonic-gate
237*9110Sopensolaris@drydog.com.Loop1:
2380Sstevel@tonic-gate	sll	%o5, 8, %o5
2390Sstevel@tonic-gate	ldub	[%i5 + %o1], %o3
2400Sstevel@tonic-gate	and	%g1, 255, %g1
2410Sstevel@tonic-gate
2420Sstevel@tonic-gate	ldub	[%i5 + %g1], %g3
2430Sstevel@tonic-gate	or	%o0, %o5, %o0
2440Sstevel@tonic-gate
2450Sstevel@tonic-gate	ldub	[%i5 + %g5], %g5
2460Sstevel@tonic-gate	add	%g2, %o3, %o2
2470Sstevel@tonic-gate
2480Sstevel@tonic-gate	add	%o2, %g3, %g2
2490Sstevel@tonic-gate	ldx	[%i2], %o7
2500Sstevel@tonic-gate	and	%o2, 255, %o2
2510Sstevel@tonic-gate
2520Sstevel@tonic-gate	and	%g2, 255, %g2
2530Sstevel@tonic-gate	ldub	[%i5 + %o2], %o4
2540Sstevel@tonic-gate
2550Sstevel@tonic-gate	or	%o0, %g5, %o0
2560Sstevel@tonic-gate	stb	%o3, [%i5+%o2]
2570Sstevel@tonic-gate	subcc	%o2, %g1, %g0
2580Sstevel@tonic-gate
2590Sstevel@tonic-gate	stb	%o4, [%i5 + %o1]
2600Sstevel@tonic-gate	bz	%icc, .L5A
2610Sstevel@tonic-gate	add	%o3,%o4,%o5
2620Sstevel@tonic-gate.L5B:
2630Sstevel@tonic-gate	and	%o5, 255, %o5
2640Sstevel@tonic-gate	ldub	[%i5 + %g2], %g4
2650Sstevel@tonic-gate
2660Sstevel@tonic-gate	ldub	[%i5 + %o5], %o5
2670Sstevel@tonic-gate	add	%g1, 1, %o1
2680Sstevel@tonic-gate
2690Sstevel@tonic-gate	and	%o1, 255, %o1
2700Sstevel@tonic-gate	stb	%g3, [%i5 + %g2]
2710Sstevel@tonic-gate	add	%g3, %g4, %g5
2720Sstevel@tonic-gate
2730Sstevel@tonic-gate	and	%g5, 255, %g5
2740Sstevel@tonic-gate	stb	%g4, [%i5 + %g1]
2750Sstevel@tonic-gate	add	%o1, 1, %g1
2760Sstevel@tonic-gate
2770Sstevel@tonic-gate
2780Sstevel@tonic-gate	xor	%o0, %o7, %o7
2790Sstevel@tonic-gate	ldub	[%i5 + %o1], %o3
2800Sstevel@tonic-gate	and	%g1, 255, %g1
2810Sstevel@tonic-gate
2820Sstevel@tonic-gate	sllx	%o5, 56, %o0
2830Sstevel@tonic-gate	ldub	[%i5 + %g1], %g3
2840Sstevel@tonic-gate
2850Sstevel@tonic-gate	add	%g2, %o3, %o2
2860Sstevel@tonic-gate	ldub	[%i5 + %g5], %g5
2870Sstevel@tonic-gate
2880Sstevel@tonic-gate	add	%o2, %g3, %g2
2890Sstevel@tonic-gate	stx	%o7, [%i3]
2900Sstevel@tonic-gate	and	%o2, 255, %o2
2910Sstevel@tonic-gate
2920Sstevel@tonic-gate	sllx	%g5, 48, %g5
2930Sstevel@tonic-gate	ldub	[%i5 + %o2], %o4
2940Sstevel@tonic-gate	and	%g2, 255, %g2
2950Sstevel@tonic-gate
2960Sstevel@tonic-gate	or	%o0, %g5, %o0
2970Sstevel@tonic-gate	stb	%o3, [%i5+%o2]
2980Sstevel@tonic-gate	subcc	%o2, %g1, %g0
2990Sstevel@tonic-gate
3000Sstevel@tonic-gate	stb	%o4, [%i5 + %o1]
3010Sstevel@tonic-gate	bz	%icc, .L6A
3020Sstevel@tonic-gate	add	%o3,%o4,%o5
3030Sstevel@tonic-gate.L6B:
3040Sstevel@tonic-gate	and	%o5, 255, %o5
3050Sstevel@tonic-gate	ldub	[%i5 + %g2], %g4
3060Sstevel@tonic-gate	add	%i3, 8, %i3
3070Sstevel@tonic-gate
3080Sstevel@tonic-gate	add	%i2, 8, %i2
3090Sstevel@tonic-gate	ldub	[%i5 + %o5], %o5
3100Sstevel@tonic-gate	add	%g1, 1, %o1
3110Sstevel@tonic-gate
3120Sstevel@tonic-gate	and	%o1, 255, %o1
3130Sstevel@tonic-gate	stb	%g3, [%i5 + %g2]
3140Sstevel@tonic-gate	add	%g3, %g4, %g5
3150Sstevel@tonic-gate
3160Sstevel@tonic-gate	and	%g5, 255, %g5
3170Sstevel@tonic-gate	stb	%g4, [%i5 + %g1]
3180Sstevel@tonic-gate	add	%o1, 1, %g1
3190Sstevel@tonic-gate
3200Sstevel@tonic-gate
3210Sstevel@tonic-gate	sllx	%o5, 40, %o5
3220Sstevel@tonic-gate	ldub	[%i5 + %o1], %o3
3230Sstevel@tonic-gate	and	%g1, 255, %g1
3240Sstevel@tonic-gate
3250Sstevel@tonic-gate	ldub	[%i5 + %g1], %g3
3260Sstevel@tonic-gate	or	%o0, %o5, %o0
3270Sstevel@tonic-gate
3280Sstevel@tonic-gate	add	%g2, %o3, %o2
3290Sstevel@tonic-gate	ldub	[%i5 + %g5], %g5
3300Sstevel@tonic-gate
3310Sstevel@tonic-gate	add	%o2, %g3, %g2
3320Sstevel@tonic-gate	and	%o2, 255, %o2
3330Sstevel@tonic-gate
3340Sstevel@tonic-gate	sllx	%g5, 32, %g5
3350Sstevel@tonic-gate	ldub	[%i5 + %o2], %o4
3360Sstevel@tonic-gate	and	%g2, 255, %g2
3370Sstevel@tonic-gate
3380Sstevel@tonic-gate	or	%o0, %g5, %o0
3390Sstevel@tonic-gate	stb	%o3, [%i5 + %o2]
3400Sstevel@tonic-gate	subcc	%o2, %g1, %g0
3410Sstevel@tonic-gate
3420Sstevel@tonic-gate	stb	%o4, [%i5 + %o1]
3430Sstevel@tonic-gate	bz	%icc, .L7A
3440Sstevel@tonic-gate	add	%o3,%o4,%o5
3450Sstevel@tonic-gate.L7B:
3460Sstevel@tonic-gate	and	%o5, 255, %o5
3470Sstevel@tonic-gate	ldub	[%i5 + %g2], %g4
3480Sstevel@tonic-gate
3490Sstevel@tonic-gate	ldub	[%i5 + %o5], %o5
3500Sstevel@tonic-gate	add	%g1, 1, %o1
3510Sstevel@tonic-gate
3520Sstevel@tonic-gate	and	%o1, 255, %o1
3530Sstevel@tonic-gate	stb	%g3, [%i5 + %g2]
3540Sstevel@tonic-gate	add	%g3, %g4, %g5
3550Sstevel@tonic-gate
3560Sstevel@tonic-gate	and	%g5, 255, %g5
3570Sstevel@tonic-gate	stb	%g4, [%i5 + %g1]
3580Sstevel@tonic-gate	add	%o1, 1, %g1
3590Sstevel@tonic-gate
3600Sstevel@tonic-gate
3610Sstevel@tonic-gate	sll	%o5, 24, %o5
3620Sstevel@tonic-gate	ldub	[%i5 + %o1], %o3
3630Sstevel@tonic-gate	and	%g1, 255, %g1
3640Sstevel@tonic-gate
3650Sstevel@tonic-gate	sub	%i1, 8, %i1
3660Sstevel@tonic-gate	ldub	[%i5 + %g1], %g3
3670Sstevel@tonic-gate	or	%o0, %o5, %o0
3680Sstevel@tonic-gate
3690Sstevel@tonic-gate	srl	%i1, 3, %l7
3700Sstevel@tonic-gate	ldub	[%i5 + %g5], %g5
3710Sstevel@tonic-gate	add	%g2, %o3, %o2
3720Sstevel@tonic-gate
3730Sstevel@tonic-gate	add	%o2, %g3, %g2
3740Sstevel@tonic-gate	and	%o2, 255, %o2
3750Sstevel@tonic-gate
3760Sstevel@tonic-gate	sll	%g5, 16, %g5
3770Sstevel@tonic-gate	ldub	[%i5 + %o2], %o4
3780Sstevel@tonic-gate	and	%g2, 255, %g2
3790Sstevel@tonic-gate
3800Sstevel@tonic-gate	or	%o0, %g5, %o0
3810Sstevel@tonic-gate	stb	%o3, [%i5 + %o2]
3820Sstevel@tonic-gate	subcc	%o2, %g1, %g0
3830Sstevel@tonic-gate
3840Sstevel@tonic-gate	stb	%o4, [%i5 + %o1]
3850Sstevel@tonic-gate	bz	%icc, .L8A
3860Sstevel@tonic-gate	add	%o3,%o4,%o5
3870Sstevel@tonic-gate.L8B:
3880Sstevel@tonic-gate	and	%o5, 255, %o5
3890Sstevel@tonic-gate	ldub	[%i5 + %g2], %g4
3900Sstevel@tonic-gate	add	%g1, 1, %o1
3910Sstevel@tonic-gate
3920Sstevel@tonic-gate	orcc	%l7, %g0, %g0
3930Sstevel@tonic-gate	ldub	[%i5 + %o5], %o5
3940Sstevel@tonic-gate	and	%o1, 255, %o1
3950Sstevel@tonic-gate
3960Sstevel@tonic-gate	add	%g3, %g4, %g5
3970Sstevel@tonic-gate	stb	%g4, [%i5 + %g1]
3980Sstevel@tonic-gate	add	%o1, 1, %g1
3990Sstevel@tonic-gate
4000Sstevel@tonic-gate	stb	%g3, [%i5 + %g2]
4010Sstevel@tonic-gate	bnz	%icc, .Loop1
4020Sstevel@tonic-gate	and	%g5, 255, %g5
4030Sstevel@tonic-gate
4040Sstevel@tonic-gate
4050Sstevel@tonic-gate.EndLoop1:
4060Sstevel@tonic-gate	sll	%o5, 8, %o5
4070Sstevel@tonic-gate	ldub	[%i5 + %g5], %g5
4080Sstevel@tonic-gate	orcc	%i1, %g0, %g0
4090Sstevel@tonic-gate
4100Sstevel@tonic-gate	or	%o0, %o5, %o0
4110Sstevel@tonic-gate	ldx	[%i2], %o7
4120Sstevel@tonic-gate	sub	%g1, 2, %g1
4130Sstevel@tonic-gate
4140Sstevel@tonic-gate	and	%g1, 255, %g1
4153708Skrishna	stb	%g1, [%i0 + 256]
4160Sstevel@tonic-gate	or	%o0, %g5, %o0
4170Sstevel@tonic-gate
4180Sstevel@tonic-gate	xor	%o0, %o7, %o7
4190Sstevel@tonic-gate	stx	%o7, [%i3]
4200Sstevel@tonic-gate	add	%i2, 8, %i2
4210Sstevel@tonic-gate
4220Sstevel@tonic-gate	add	%i3, 8, %i3
4230Sstevel@tonic-gate	bnz	%icc, .Loop2_1
4243708Skrishna	stb	%g2, [%i0 + 257]
425*9110Sopensolaris@drydog.com
426*9110Sopensolaris@drydog.com	ret
4270Sstevel@tonic-gate	restore	%g0,%g0,%g0
4280Sstevel@tonic-gate
4290Sstevel@tonic-gate
4300Sstevel@tonic-gate.Loop2:
4310Sstevel@tonic-gate	orcc	%i1, %g0, %g0
4320Sstevel@tonic-gate	bnz	.Loop2_1
4330Sstevel@tonic-gate	nop
4340Sstevel@tonic-gate	ret
4350Sstevel@tonic-gate	restore	%g0,%g0,%g0
4360Sstevel@tonic-gate
4370Sstevel@tonic-gate.Loop2_1:
4380Sstevel@tonic-gate	and	%o1, 255, %g1
4390Sstevel@tonic-gate	ldub	[%i5 + %g1], %g3
4400Sstevel@tonic-gate
4410Sstevel@tonic-gate	add	%g2, %g3, %g2
4420Sstevel@tonic-gate
4430Sstevel@tonic-gate	and	%g2, 255, %g2
4440Sstevel@tonic-gate
4450Sstevel@tonic-gate	ldub	[%i5 + %g2], %g4
4460Sstevel@tonic-gate
4470Sstevel@tonic-gate	stb	%g3, [%i5 + %g2]
4480Sstevel@tonic-gate
4490Sstevel@tonic-gate	add	%g3, %g4, %g5
4500Sstevel@tonic-gate	stb	%g4, [%i5 + %g1]
4510Sstevel@tonic-gate
4520Sstevel@tonic-gate	and	%g5, 255, %g5
4530Sstevel@tonic-gate	ldub	[%i2], %o0
4540Sstevel@tonic-gate
4550Sstevel@tonic-gate	add	%g1, 1, %o1
4560Sstevel@tonic-gate	ldub	[%i5 + %g5], %g5
4570Sstevel@tonic-gate	subcc	%i1, 1, %i1
4580Sstevel@tonic-gate
4590Sstevel@tonic-gate	add	%i2, 1, %i2
4600Sstevel@tonic-gate	add	%i3, 1, %i3
4610Sstevel@tonic-gate
4620Sstevel@tonic-gate	xor	%o0, %g5, %o0
4630Sstevel@tonic-gate	bnz	%icc, .Loop2_1
4640Sstevel@tonic-gate	stb	%o0, [%i3 - 1]
4650Sstevel@tonic-gate
4663708Skrishna	stb	%g1, [%i0 + 256]
4670Sstevel@tonic-gate
4683708Skrishna	stb	%g2, [%i0 + 257]
469*9110Sopensolaris@drydog.com
4700Sstevel@tonic-gate	ret
4710Sstevel@tonic-gate	restore	%g0,%g0,%g0
4720Sstevel@tonic-gate
4730Sstevel@tonic-gate.L1A:
4740Sstevel@tonic-gate	add	%o2, %o3, %g2
4750Sstevel@tonic-gate	or	%o3, %g0, %g3
4760Sstevel@tonic-gate	ba	.L1B
4770Sstevel@tonic-gate	and	%g2, 255, %g2
478*9110Sopensolaris@drydog.com
4790Sstevel@tonic-gate.L2A:
4800Sstevel@tonic-gate	add	%o2, %o3, %g2
4810Sstevel@tonic-gate	or	%o3, %g0, %g3
4820Sstevel@tonic-gate	ba	.L2B
4830Sstevel@tonic-gate	and	%g2, 255, %g2
484*9110Sopensolaris@drydog.com
4850Sstevel@tonic-gate.L3A:
4860Sstevel@tonic-gate	add	%o2, %o3, %g2
4870Sstevel@tonic-gate	or	%o3, %g0, %g3
4880Sstevel@tonic-gate	ba	.L3B
4890Sstevel@tonic-gate	and	%g2, 255, %g2
490*9110Sopensolaris@drydog.com
4910Sstevel@tonic-gate.L4A:
4920Sstevel@tonic-gate	add	%o2, %o3, %g2
4930Sstevel@tonic-gate	or	%o3, %g0, %g3
4940Sstevel@tonic-gate	ba	.L4B
4950Sstevel@tonic-gate	and	%g2, 255, %g2
496*9110Sopensolaris@drydog.com
4970Sstevel@tonic-gate.L5A:
4980Sstevel@tonic-gate	add	%o2, %o3, %g2
4990Sstevel@tonic-gate	or	%o3, %g0, %g3
5000Sstevel@tonic-gate	ba	.L5B
5010Sstevel@tonic-gate	and	%g2, 255, %g2
502*9110Sopensolaris@drydog.com
5030Sstevel@tonic-gate.L6A:
5040Sstevel@tonic-gate	add	%o2, %o3, %g2
5050Sstevel@tonic-gate	or	%o3, %g0, %g3
5060Sstevel@tonic-gate	ba	.L6B
5070Sstevel@tonic-gate	and	%g2, 255, %g2
508*9110Sopensolaris@drydog.com
5090Sstevel@tonic-gate.L7A:
5100Sstevel@tonic-gate	add	%o2, %o3, %g2
5110Sstevel@tonic-gate	or	%o3, %g0, %g3
5120Sstevel@tonic-gate	ba	.L7B
5130Sstevel@tonic-gate	and	%g2, 255, %g2
514*9110Sopensolaris@drydog.com
5150Sstevel@tonic-gate.L8A:
5160Sstevel@tonic-gate	add	%o2, %o3, %g2
5170Sstevel@tonic-gate	or	%o3, %g0, %g3
5180Sstevel@tonic-gate	ba	.L8B
5190Sstevel@tonic-gate	and	%g2, 255, %g2
520*9110Sopensolaris@drydog.com
5210Sstevel@tonic-gate/* EXPORT DELETE END */
5220Sstevel@tonic-gate	.type	arcfour_crypt_aligned,2
5230Sstevel@tonic-gate	.size	arcfour_crypt_aligned,(. - arcfour_crypt_aligned)
5240Sstevel@tonic-gate
5250Sstevel@tonic-gate#endif	/* lint || __lint */
526