Home | History | Annotate | Line # | Download | only in sparc
      1 ! Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
      2 !
      3 ! Licensed under the OpenSSL license (the "License").  You may not use
      4 ! this file except in compliance with the License.  You can obtain a copy
      5 ! in the file LICENSE in the source distribution or at
      6 ! https://www.openssl.org/source/license.html
      7 !
      8 !  To expand the m4 macros: m4 -B 8192 des_enc.m4 > des_enc.S
      9 !
     10 !  Global registers 1 to 5 are used. This is the same as done by the
     11 !  cc compiler. The UltraSPARC load/store little endian feature is used.
     12 !
     13 !  Instruction grouping often refers to one CPU cycle.
     14 !
     15 !  Assemble through gcc: gcc -c -mcpu=ultrasparc -o des_enc.o des_enc.S
     16 !
     17 !  Assemble through cc:  cc -c -xarch=v8plusa -o des_enc.o des_enc.S
     18 !
     19 !  Performance improvement according to './apps/openssl speed des'
     20 !
     21 !	32-bit build:
     22 !		23%  faster than cc-5.2 -xarch=v8plus -xO5
     23 !		115% faster than gcc-3.2.1 -m32 -mcpu=ultrasparc -O5
     24 !	64-bit build:
     25 !		50%  faster than cc-5.2 -xarch=v9 -xO5
     26 !		100% faster than gcc-3.2.1 -m64 -mcpu=ultrasparc -O5
     27 !
     28 
     29 .ident "des_enc.m4 2.1"
     30 .file  "des_enc-sparc.S"
     31 
     32 #include <openssl/opensslconf.h>
     33 
     34 #if defined(__SUNPRO_C) && defined(__sparcv9)
     35 # define ABI64  /* They've said -xarch=v9 at command line */
     36 #elif defined(__GNUC__) && defined(__arch64__)
     37 # define ABI64  /* They've said -m64 at command line */
     38 #endif
     39 
     40 #ifdef ABI64
     41   .register	%g2,#scratch
     42   .register	%g3,#scratch
     43 # define	FRAME	-192
     44 # define	BIAS	2047
     45 # define	LDPTR	ldx
     46 # define	STPTR	stx
     47 # define	ARG0	128
     48 # define	ARGSZ	8
     49 #else
     50 # define	FRAME	-96
     51 # define	BIAS	0
     52 # define	LDPTR	ld
     53 # define	STPTR	st
     54 # define	ARG0	68
     55 # define	ARGSZ	4
     56 #endif
     57 
     58 #define LOOPS 7
     59 
     60 #define global0 %g0
     61 #define global1 %g1
     62 #define global2 %g2
     63 #define global3 %g3
     64 #define global4 %g4
     65 #define global5 %g5
     66 
     67 #define local0 %l0
     68 #define local1 %l1
     69 #define local2 %l2
     70 #define local3 %l3
     71 #define local4 %l4
     72 #define local5 %l5
     73 #define local7 %l6
     74 #define local6 %l7
     75 
     76 #define in0 %i0
     77 #define in1 %i1
     78 #define in2 %i2
     79 #define in3 %i3
     80 #define in4 %i4
     81 #define in5 %i5
     82 #define in6 %i6
     83 #define in7 %i7
     84 
     85 #define out0 %o0
     86 #define out1 %o1
     87 #define out2 %o2
     88 #define out3 %o3
     89 #define out4 %o4
     90 #define out5 %o5
     91 #define out6 %o6
     92 #define out7 %o7
     93 
     94 #define stub stb
     95 
     96 
     97 
     98 
     99 ! Macro definitions:
    100 
    101 
    102 ! ip_macro
    103 !
    104 ! The logic used in initial and final permutations is the same as in
    105 ! the C code. The permutations are done with a clever , xor, and
    106 ! technique.
    107 !
    108 ! The macro also loads address sbox 1 to 5 to global 1 to 5, address
    109 ! sbox 6 to local6, and address sbox 8 to out3.
    110 !
    111 ! Rotates the halves 3 left to bring the sbox bits in convenient positions.
    112 !
    113 ! Loads key first round from address in parameter 5 to out0, out1.
    114 !
    115 ! After the original LibDES initial permutation, the resulting left
    116 ! is in the variable initially used for right and vice versa. The macro
    117 ! implements the possibility to keep the halves in the original registers.
    118 !
    119 ! parameter 1  left
    120 ! parameter 2  right
    121 ! parameter 3  result left (modify in first round)
    122 ! parameter 4  result right (use in first round)
    123 ! parameter 5  key address
    124 ! parameter 6  1/2 for include encryption/decryption
    125 ! parameter 7  1 for move in1 to in3
    126 ! parameter 8  1 for move in3 to in4, 2 for move in4 to in3
    127 ! parameter 9  1 for load ks3 and ks2 to in4 and in3
    128 
    129 
    130 
    131 
    132 ! rounds_macro
    133 !
    134 ! The logic used in the DES rounds is the same as in the C code,
    135 ! except that calculations for sbox 1 and sbox 5 begin before
    136 ! the previous round is finished.
    137 !
    138 ! In each round one half (work) is modified based on key and the
    139 ! other half (use).
    140 !
    141 ! In this version we do two rounds in a loop repeated 7 times
    142 ! and two rounds separately.
    143 !
    144 ! One half has the bits for the sboxes in the following positions:
    145 !
    146 !	777777xx555555xx333333xx111111xx
    147 !
    148 !	88xx666666xx444444xx222222xx8888
    149 !
    150 ! The bits for each sbox are xor-ed with the key bits for that box.
    151 ! The above xx bits are cleared, and the result used for lookup in
    152 ! the sbox table. Each sbox entry contains the 4 output bits permuted
    153 ! into 32 bits according to the P permutation.
    154 !
    155 ! In the description of DES, left and right are switched after
    156 ! each round, except after last round. In this code the original
    157 ! left and right are kept in the same register in all rounds, meaning
    158 ! that after the 16 rounds the result for right is in the register
    159 ! originally used for left.
    160 !
    161 ! parameter 1  first work (left in first round)
    162 ! parameter 2  first use (right in first round)
    163 ! parameter 3  enc/dec  1/-1
    164 ! parameter 4  loop label
    165 ! parameter 5  key address register
    166 ! parameter 6  optional address for key next encryption/decryption
    167 ! parameter 7  not empty for include retl
    168 !
    169 ! also compares in2 to 8
    170 
    171 
    172 
    173 
    174 ! fp_macro
    175 !
    176 !  parameter 1   right (original left)
    177 !  parameter 2   left (original right)
    178 !  parameter 3   1 for optional store to [in0]
    179 !  parameter 4   1 for load input/output address to local5/7
    180 !
    181 !  The final permutation logic switches the halves, meaning that
    182 !  left and right ends up the registers originally used.
    183 
    184 
    185 
    186 
    187 ! fp_ip_macro
    188 !
    189 ! Does initial permutation for next block mixed with
    190 ! final permutation for current block.
    191 !
    192 ! parameter 1   original left
    193 ! parameter 2   original right
    194 ! parameter 3   left ip
    195 ! parameter 4   right ip
    196 ! parameter 5   1: load ks1/ks2 to in3/in4, add 120 to in4
    197 !                2: mov in4 to in3
    198 !
    199 ! also adds -8 to length in2 and loads loop counter to out4
    200 
    201 
    202 
    203 
    204 
    205 ! load_little_endian
    206 !
    207 ! parameter 1  address
    208 ! parameter 2  destination left
    209 ! parameter 3  destination right
    210 ! parameter 4  temporary
    211 ! parameter 5  label
    212 
    213 
    214 
    215 
    216 ! load_little_endian_inc
    217 !
    218 ! parameter 1  address
    219 ! parameter 2  destination left
    220 ! parameter 3  destination right
    221 ! parameter 4  temporary
    222 ! parameter 4  label
    223 !
    224 ! adds 8 to address
    225 
    226 
    227 
    228 
    229 ! load_n_bytes
    230 !
    231 ! Loads 1 to 7 bytes little endian
    232 ! Remaining bytes are zeroed.
    233 !
    234 ! parameter 1  address
    235 ! parameter 2  length
    236 ! parameter 3  destination register left
    237 ! parameter 4  destination register right
    238 ! parameter 5  temp
    239 ! parameter 6  temp2
    240 ! parameter 7  label
    241 ! parameter 8  return label
    242 
    243 
    244 
    245 
    246 ! store_little_endian
    247 !
    248 ! parameter 1  address
    249 ! parameter 2  source left
    250 ! parameter 3  source right
    251 ! parameter 4  temporary
    252 
    253 
    254 
    255 
    256 ! store_n_bytes
    257 !
    258 ! Stores 1 to 7 bytes little endian
    259 !
    260 ! parameter 1  address
    261 ! parameter 2  length
    262 ! parameter 3  source register left
    263 ! parameter 4  source register right
    264 ! parameter 5  temp
    265 ! parameter 6  temp2
    266 ! parameter 7  label
    267 ! parameter 8  return label
    268 
    269 
    270 
    271 
    272 
    273 
    274 
    275 
    276 .section	".text"
    277 
    278 	.align 32
    279 
    280 .des_enc:
    281 
    282 	! key address in3
    283 	! loads key next encryption/decryption first round from [in4]
    284 
    285 
    286 
    287 ! rounds_macro
    288 ! in5 out5 1 .des_enc.1 in3 in4 retl
    289 
    290 	xor	out5, out0, local1
    291 
    292 	ld	[out2+284], local5        ! 0x0000FC00
    293 	ba	.des_enc.1
    294 	and	local1, 252, local1
    295 
    296 	.align 32
    297 
    298 .des_enc.1:
    299 	! local6 is address sbox 6
    300 	! out3   is address sbox 8
    301 	! out4   is loop counter
    302 
    303 	ld	[global1+local1], local1
    304 	xor	out5, out1, out1            ! 8642
    305 	xor	out5, out0, out0            ! 7531
    306 	! fmovs	%f0, %f0                  ! fxor used for alignment
    307 
    308 	srl	out1, 4, local0           ! rotate 4 right
    309 	and	out0, local5, local3      ! 3
    310 	! fmovs	%f0, %f0
    311 
    312 	ld	[in3+1*8], local7         ! key 7531 next round
    313 	srl	local3, 8, local3         ! 3
    314 	and	local0, 252, local2       ! 2
    315 	! fmovs	%f0, %f0
    316 
    317 	ld	[global3+local3],local3   ! 3
    318 	sll	out1, 28, out1            ! rotate
    319 	xor	in5, local1, in5            ! 1 finished, local1 now sbox 7
    320 
    321 	ld	[global2+local2], local2  ! 2
    322 	srl	out0, 24, local1          ! 7
    323 	or	out1, local0, out1        ! rotate
    324 
    325 	ldub	[out2+local1], local1     ! 7 (and 0xFC)
    326 	srl	out1, 24, local0          ! 8
    327 	and	out1, local5, local4      ! 4
    328 
    329 	ldub	[out2+local0], local0     ! 8 (and 0xFC)
    330 	srl	local4, 8, local4         ! 4
    331 	xor	in5, local2, in5            ! 2 finished local2 now sbox 6
    332 
    333 	ld	[global4+local4],local4   ! 4
    334 	srl	out1, 16, local2          ! 6
    335 	xor	in5, local3, in5            ! 3 finished local3 now sbox 5
    336 
    337 	ld	[out3+local0],local0      ! 8
    338 	and	local2, 252, local2       ! 6
    339 	add	global1, 1536, local5     ! address sbox 7
    340 
    341 	ld	[local6+local2], local2   ! 6
    342 	srl	out0, 16, local3          ! 5
    343 	xor	in5, local4, in5            ! 4 finished
    344 
    345 	ld	[local5+local1],local1    ! 7
    346 	and	local3, 252, local3       ! 5
    347 	xor	in5, local0, in5            ! 8 finished
    348 
    349 	ld	[global5+local3],local3   ! 5
    350 	xor	in5, local2, in5            ! 6 finished
    351 	subcc	out4, 1, out4
    352 
    353 	ld	[in3+1*8+4], out0         ! key 8642 next round
    354 	xor	in5, local7, local2        ! sbox 5 next round
    355 	xor	in5, local1, in5            ! 7 finished
    356 
    357 	srl	local2, 16, local2        ! sbox 5 next round
    358 	xor	in5, local3, in5            ! 5 finished
    359 
    360 	ld	[in3+1*16+4], out1        ! key 8642 next round again
    361 	and	local2, 252, local2       ! sbox5 next round
    362 ! next round
    363 	xor	in5, local7, local7        ! 7531
    364 
    365 	ld	[global5+local2], local2  ! 5
    366 	srl	local7, 24, local3        ! 7
    367 	xor	in5, out0, out0            ! 8642
    368 
    369 	ldub	[out2+local3], local3     ! 7 (and 0xFC)
    370 	srl	out0, 4, local0           ! rotate 4 right
    371 	and	local7, 252, local1       ! 1
    372 
    373 	sll	out0, 28, out0            ! rotate
    374 	xor	out5, local2, out5            ! 5 finished local2 used
    375 
    376 	srl	local0, 8, local4         ! 4
    377 	and	local0, 252, local2       ! 2
    378 	ld	[local5+local3], local3   ! 7
    379 
    380 	srl	local0, 16, local5        ! 6
    381 	or	out0, local0, out0        ! rotate
    382 	ld	[global2+local2], local2  ! 2
    383 
    384 	srl	out0, 24, local0
    385 	ld	[in3+1*16], out0          ! key 7531 next round
    386 	and	local4, 252, local4	  ! 4
    387 
    388 	and	local5, 252, local5       ! 6
    389 	ld	[global4+local4], local4  ! 4
    390 	xor	out5, local3, out5            ! 7 finished local3 used
    391 
    392 	and	local0, 252, local0       ! 8
    393 	ld	[local6+local5], local5   ! 6
    394 	xor	out5, local2, out5            ! 2 finished local2 now sbox 3
    395 
    396 	srl	local7, 8, local2         ! 3 start
    397 	ld	[out3+local0], local0     ! 8
    398 	xor	out5, local4, out5            ! 4 finished
    399 
    400 	and	local2, 252, local2       ! 3
    401 	ld	[global1+local1], local1  ! 1
    402 	xor	out5, local5, out5            ! 6 finished local5 used
    403 
    404 	ld	[global3+local2], local2  ! 3
    405 	xor	out5, local0, out5            ! 8 finished
    406 	add	in3, 1*16, in3             ! enc add 8, dec add -8 to key pointer
    407 
    408 	ld	[out2+284], local5        ! 0x0000FC00
    409 	xor	out5, out0, local4          ! sbox 1 next round
    410 	xor	out5, local1, out5            ! 1 finished
    411 
    412 	xor	out5, local2, out5            ! 3 finished
    413 	bne	.des_enc.1
    414 	and	local4, 252, local1       ! sbox 1 next round
    415 
    416 ! two rounds more:
    417 
    418 	ld	[global1+local1], local1
    419 	xor	out5, out1, out1
    420 	xor	out5, out0, out0
    421 
    422 	srl	out1, 4, local0           ! rotate
    423 	and	out0, local5, local3
    424 
    425 	ld	[in3+1*8], local7         ! key 7531
    426 	srl	local3, 8, local3
    427 	and	local0, 252, local2
    428 
    429 	ld	[global3+local3],local3
    430 	sll	out1, 28, out1            ! rotate
    431 	xor	in5, local1, in5            ! 1 finished, local1 now sbox 7
    432 
    433 	ld	[global2+local2], local2
    434 	srl	out0, 24, local1
    435 	or	out1, local0, out1        ! rotate
    436 
    437 	ldub	[out2+local1], local1
    438 	srl	out1, 24, local0
    439 	and	out1, local5, local4
    440 
    441 	ldub	[out2+local0], local0
    442 	srl	local4, 8, local4
    443 	xor	in5, local2, in5            ! 2 finished local2 now sbox 6
    444 
    445 	ld	[global4+local4],local4
    446 	srl	out1, 16, local2
    447 	xor	in5, local3, in5            ! 3 finished local3 now sbox 5
    448 
    449 	ld	[out3+local0],local0
    450 	and	local2, 252, local2
    451 	add	global1, 1536, local5     ! address sbox 7
    452 
    453 	ld	[local6+local2], local2
    454 	srl	out0, 16, local3
    455 	xor	in5, local4, in5            ! 4 finished
    456 
    457 	ld	[local5+local1],local1
    458 	and	local3, 252, local3
    459 	xor	in5, local0, in5
    460 
    461 	ld	[global5+local3],local3
    462 	xor	in5, local2, in5            ! 6 finished
    463 	cmp	in2, 8
    464 
    465 	ld	[out2+280], out4  ! loop counter
    466 	xor	in5, local7, local2        ! sbox 5 next round
    467 	xor	in5, local1, in5            ! 7 finished
    468 
    469 	ld	[in3+1*8+4], out0
    470 	srl	local2, 16, local2        ! sbox 5 next round
    471 	xor	in5, local3, in5            ! 5 finished
    472 
    473 	and	local2, 252, local2
    474 ! next round (two rounds more)
    475 	xor	in5, local7, local7        ! 7531
    476 
    477 	ld	[global5+local2], local2
    478 	srl	local7, 24, local3
    479 	xor	in5, out0, out0            ! 8642
    480 
    481 	ldub	[out2+local3], local3
    482 	srl	out0, 4, local0           ! rotate
    483 	and	local7, 252, local1
    484 
    485 	sll	out0, 28, out0            ! rotate
    486 	xor	out5, local2, out5            ! 5 finished local2 used
    487 
    488 	srl	local0, 8, local4
    489 	and	local0, 252, local2
    490 	ld	[local5+local3], local3
    491 
    492 	srl	local0, 16, local5
    493 	or	out0, local0, out0        ! rotate
    494 	ld	[global2+local2], local2
    495 
    496 	srl	out0, 24, local0
    497 	ld	[in4], out0   ! key next encryption/decryption
    498 	and	local4, 252, local4
    499 
    500 	and	local5, 252, local5
    501 	ld	[global4+local4], local4
    502 	xor	out5, local3, out5            ! 7 finished local3 used
    503 
    504 	and	local0, 252, local0
    505 	ld	[local6+local5], local5
    506 	xor	out5, local2, out5            ! 2 finished local2 now sbox 3
    507 
    508 	srl	local7, 8, local2         ! 3 start
    509 	ld	[out3+local0], local0
    510 	xor	out5, local4, out5
    511 
    512 	and	local2, 252, local2
    513 	ld	[global1+local1], local1
    514 	xor	out5, local5, out5            ! 6 finished local5 used
    515 
    516 	ld	[global3+local2], local2
    517 	srl	in5, 3, local3
    518 	xor	out5, local0, out5
    519 
    520 	ld	[in4+4], out1 ! key next encryption/decryption
    521 	sll	in5, 29, local4
    522 	xor	out5, local1, out5
    523 
    524 	retl
    525 	xor	out5, local2, out5
    526 
    527 
    528 
    529 	.align 32
    530 
    531 .des_dec:
    532 
    533 	! implemented with out5 as first parameter to avoid
    534 	! register exchange in ede modes
    535 
    536 	! key address in4
    537 	! loads key next encryption/decryption first round from [in3]
    538 
    539 
    540 
    541 ! rounds_macro
    542 ! out5 in5 -1 .des_dec.1 in4 in3 retl
    543 
    544 	xor	in5, out0, local1
    545 
    546 	ld	[out2+284], local5        ! 0x0000FC00
    547 	ba	.des_dec.1
    548 	and	local1, 252, local1
    549 
    550 	.align 32
    551 
    552 .des_dec.1:
    553 	! local6 is address sbox 6
    554 	! out3   is address sbox 8
    555 	! out4   is loop counter
    556 
    557 	ld	[global1+local1], local1
    558 	xor	in5, out1, out1            ! 8642
    559 	xor	in5, out0, out0            ! 7531
    560 	! fmovs	%f0, %f0                  ! fxor used for alignment
    561 
    562 	srl	out1, 4, local0           ! rotate 4 right
    563 	and	out0, local5, local3      ! 3
    564 	! fmovs	%f0, %f0
    565 
    566 	ld	[in4+-1*8], local7         ! key 7531 next round
    567 	srl	local3, 8, local3         ! 3
    568 	and	local0, 252, local2       ! 2
    569 	! fmovs	%f0, %f0
    570 
    571 	ld	[global3+local3],local3   ! 3
    572 	sll	out1, 28, out1            ! rotate
    573 	xor	out5, local1, out5            ! 1 finished, local1 now sbox 7
    574 
    575 	ld	[global2+local2], local2  ! 2
    576 	srl	out0, 24, local1          ! 7
    577 	or	out1, local0, out1        ! rotate
    578 
    579 	ldub	[out2+local1], local1     ! 7 (and 0xFC)
    580 	srl	out1, 24, local0          ! 8
    581 	and	out1, local5, local4      ! 4
    582 
    583 	ldub	[out2+local0], local0     ! 8 (and 0xFC)
    584 	srl	local4, 8, local4         ! 4
    585 	xor	out5, local2, out5            ! 2 finished local2 now sbox 6
    586 
    587 	ld	[global4+local4],local4   ! 4
    588 	srl	out1, 16, local2          ! 6
    589 	xor	out5, local3, out5            ! 3 finished local3 now sbox 5
    590 
    591 	ld	[out3+local0],local0      ! 8
    592 	and	local2, 252, local2       ! 6
    593 	add	global1, 1536, local5     ! address sbox 7
    594 
    595 	ld	[local6+local2], local2   ! 6
    596 	srl	out0, 16, local3          ! 5
    597 	xor	out5, local4, out5            ! 4 finished
    598 
    599 	ld	[local5+local1],local1    ! 7
    600 	and	local3, 252, local3       ! 5
    601 	xor	out5, local0, out5            ! 8 finished
    602 
    603 	ld	[global5+local3],local3   ! 5
    604 	xor	out5, local2, out5            ! 6 finished
    605 	subcc	out4, 1, out4
    606 
    607 	ld	[in4+-1*8+4], out0         ! key 8642 next round
    608 	xor	out5, local7, local2        ! sbox 5 next round
    609 	xor	out5, local1, out5            ! 7 finished
    610 
    611 	srl	local2, 16, local2        ! sbox 5 next round
    612 	xor	out5, local3, out5            ! 5 finished
    613 
    614 	ld	[in4+-1*16+4], out1        ! key 8642 next round again
    615 	and	local2, 252, local2       ! sbox5 next round
    616 ! next round
    617 	xor	out5, local7, local7        ! 7531
    618 
    619 	ld	[global5+local2], local2  ! 5
    620 	srl	local7, 24, local3        ! 7
    621 	xor	out5, out0, out0            ! 8642
    622 
    623 	ldub	[out2+local3], local3     ! 7 (and 0xFC)
    624 	srl	out0, 4, local0           ! rotate 4 right
    625 	and	local7, 252, local1       ! 1
    626 
    627 	sll	out0, 28, out0            ! rotate
    628 	xor	in5, local2, in5            ! 5 finished local2 used
    629 
    630 	srl	local0, 8, local4         ! 4
    631 	and	local0, 252, local2       ! 2
    632 	ld	[local5+local3], local3   ! 7
    633 
    634 	srl	local0, 16, local5        ! 6
    635 	or	out0, local0, out0        ! rotate
    636 	ld	[global2+local2], local2  ! 2
    637 
    638 	srl	out0, 24, local0
    639 	ld	[in4+-1*16], out0          ! key 7531 next round
    640 	and	local4, 252, local4	  ! 4
    641 
    642 	and	local5, 252, local5       ! 6
    643 	ld	[global4+local4], local4  ! 4
    644 	xor	in5, local3, in5            ! 7 finished local3 used
    645 
    646 	and	local0, 252, local0       ! 8
    647 	ld	[local6+local5], local5   ! 6
    648 	xor	in5, local2, in5            ! 2 finished local2 now sbox 3
    649 
    650 	srl	local7, 8, local2         ! 3 start
    651 	ld	[out3+local0], local0     ! 8
    652 	xor	in5, local4, in5            ! 4 finished
    653 
    654 	and	local2, 252, local2       ! 3
    655 	ld	[global1+local1], local1  ! 1
    656 	xor	in5, local5, in5            ! 6 finished local5 used
    657 
    658 	ld	[global3+local2], local2  ! 3
    659 	xor	in5, local0, in5            ! 8 finished
    660 	add	in4, -1*16, in4             ! enc add 8, dec add -8 to key pointer
    661 
    662 	ld	[out2+284], local5        ! 0x0000FC00
    663 	xor	in5, out0, local4          ! sbox 1 next round
    664 	xor	in5, local1, in5            ! 1 finished
    665 
    666 	xor	in5, local2, in5            ! 3 finished
    667 	bne	.des_dec.1
    668 	and	local4, 252, local1       ! sbox 1 next round
    669 
    670 ! two rounds more:
    671 
    672 	ld	[global1+local1], local1
    673 	xor	in5, out1, out1
    674 	xor	in5, out0, out0
    675 
    676 	srl	out1, 4, local0           ! rotate
    677 	and	out0, local5, local3
    678 
    679 	ld	[in4+-1*8], local7         ! key 7531
    680 	srl	local3, 8, local3
    681 	and	local0, 252, local2
    682 
    683 	ld	[global3+local3],local3
    684 	sll	out1, 28, out1            ! rotate
    685 	xor	out5, local1, out5            ! 1 finished, local1 now sbox 7
    686 
    687 	ld	[global2+local2], local2
    688 	srl	out0, 24, local1
    689 	or	out1, local0, out1        ! rotate
    690 
    691 	ldub	[out2+local1], local1
    692 	srl	out1, 24, local0
    693 	and	out1, local5, local4
    694 
    695 	ldub	[out2+local0], local0
    696 	srl	local4, 8, local4
    697 	xor	out5, local2, out5            ! 2 finished local2 now sbox 6
    698 
    699 	ld	[global4+local4],local4
    700 	srl	out1, 16, local2
    701 	xor	out5, local3, out5            ! 3 finished local3 now sbox 5
    702 
    703 	ld	[out3+local0],local0
    704 	and	local2, 252, local2
    705 	add	global1, 1536, local5     ! address sbox 7
    706 
    707 	ld	[local6+local2], local2
    708 	srl	out0, 16, local3
    709 	xor	out5, local4, out5            ! 4 finished
    710 
    711 	ld	[local5+local1],local1
    712 	and	local3, 252, local3
    713 	xor	out5, local0, out5
    714 
    715 	ld	[global5+local3],local3
    716 	xor	out5, local2, out5            ! 6 finished
    717 	cmp	in2, 8
    718 
    719 	ld	[out2+280], out4  ! loop counter
    720 	xor	out5, local7, local2        ! sbox 5 next round
    721 	xor	out5, local1, out5            ! 7 finished
    722 
    723 	ld	[in4+-1*8+4], out0
    724 	srl	local2, 16, local2        ! sbox 5 next round
    725 	xor	out5, local3, out5            ! 5 finished
    726 
    727 	and	local2, 252, local2
    728 ! next round (two rounds more)
    729 	xor	out5, local7, local7        ! 7531
    730 
    731 	ld	[global5+local2], local2
    732 	srl	local7, 24, local3
    733 	xor	out5, out0, out0            ! 8642
    734 
    735 	ldub	[out2+local3], local3
    736 	srl	out0, 4, local0           ! rotate
    737 	and	local7, 252, local1
    738 
    739 	sll	out0, 28, out0            ! rotate
    740 	xor	in5, local2, in5            ! 5 finished local2 used
    741 
    742 	srl	local0, 8, local4
    743 	and	local0, 252, local2
    744 	ld	[local5+local3], local3
    745 
    746 	srl	local0, 16, local5
    747 	or	out0, local0, out0        ! rotate
    748 	ld	[global2+local2], local2
    749 
    750 	srl	out0, 24, local0
    751 	ld	[in3], out0   ! key next encryption/decryption
    752 	and	local4, 252, local4
    753 
    754 	and	local5, 252, local5
    755 	ld	[global4+local4], local4
    756 	xor	in5, local3, in5            ! 7 finished local3 used
    757 
    758 	and	local0, 252, local0
    759 	ld	[local6+local5], local5
    760 	xor	in5, local2, in5            ! 2 finished local2 now sbox 3
    761 
    762 	srl	local7, 8, local2         ! 3 start
    763 	ld	[out3+local0], local0
    764 	xor	in5, local4, in5
    765 
    766 	and	local2, 252, local2
    767 	ld	[global1+local1], local1
    768 	xor	in5, local5, in5            ! 6 finished local5 used
    769 
    770 	ld	[global3+local2], local2
    771 	srl	out5, 3, local3
    772 	xor	in5, local0, in5
    773 
    774 	ld	[in3+4], out1 ! key next encryption/decryption
    775 	sll	out5, 29, local4
    776 	xor	in5, local1, in5
    777 
    778 	retl
    779 	xor	in5, local2, in5
    780 
    781 
    782 
    783 
    784 ! void DES_encrypt1(data, ks, enc)
    785 ! *******************************
    786 
    787 	.align 32
    788 	.global DES_encrypt1
    789 	.type	 DES_encrypt1,#function
    790 
    791 DES_encrypt1:
    792 
    793 	save	%sp, FRAME, %sp
    794 
    795 	sethi	%hi(_PIC_DES_SPtrans-1f),global1
    796 	or	global1,%lo(_PIC_DES_SPtrans-1f),global1
    797 1:	call	.+8
    798 	add	%o7,global1,global1
    799 	sub	global1,_PIC_DES_SPtrans-.des_and,out2
    800 
    801 	ld	[in0], in5                ! left
    802 	cmp	in2, 0                    ! enc
    803 
    804 	be	.encrypt.dec
    805 	ld	[in0+4], out5             ! right
    806 
    807 	! parameter 6  1/2 for include encryption/decryption
    808 	! parameter 7  1 for move in1 to in3
    809 	! parameter 8  1 for move in3 to in4, 2 for move in4 to in3
    810 
    811 
    812 
    813 ! ip_macro
    814 ! in5 out5 out5 in5 in3 0 1 1
    815 
    816 	ld	[out2+256], local1
    817 	srl	out5, 4, local4
    818 
    819 	xor	local4, in5, local4
    820 	mov in1, in3
    821 
    822 	ld	[out2+260], local2
    823 	and	local4, local1, local4
    824 	mov in3, in4
    825 
    826 
    827 	ld	[out2+280], out4          ! loop counter
    828 	sll	local4, 4, local1
    829 	xor	in5, local4, in5
    830 
    831 	ld	[out2+264], local3
    832 	srl	in5, 16, local4
    833 	xor	out5, local1, out5
    834 
    835 
    836 	xor	local4, out5, local4
    837 	nop	!sethi	%hi(DES_SPtrans), global1 ! sbox addr
    838 
    839 
    840 	and	local4, local2, local4
    841 	nop	!or	global1, %lo(DES_SPtrans), global1   ! sbox addr
    842 
    843 	sll	local4, 16, local1
    844 	xor	out5, local4, out5
    845 
    846 	srl	out5, 2, local4
    847 	xor	in5, local1, in5
    848 
    849 	sethi	%hi(16711680), local5
    850 	xor	local4, in5, local4
    851 
    852 	and	local4, local3, local4
    853 	or	local5, 255, local5
    854 
    855 	sll	local4, 2, local2
    856 	xor	in5, local4, in5
    857 
    858 	srl	in5, 8, local4
    859 	xor	out5, local2, out5
    860 
    861 	xor	local4, out5, local4
    862 	add	global1, 768, global4
    863 
    864 	and	local4, local5, local4
    865 	add	global1, 1024, global5
    866 
    867 	ld	[out2+272], local7
    868 	sll	local4, 8, local1
    869 	xor	out5, local4, out5
    870 
    871 	srl	out5, 1, local4
    872 	xor	in5, local1, in5
    873 
    874 	ld	[in3], out0                ! key 7531
    875 	xor	local4, in5, local4
    876 	add	global1, 256, global2
    877 
    878 	ld	[in3+4], out1              ! key 8642
    879 	and	local4, local7, local4
    880 	add	global1, 512, global3
    881 
    882 	sll	local4, 1, local1
    883 	xor	in5, local4, in5
    884 
    885 	sll	in5, 3, local3
    886 	xor	out5, local1, out5
    887 
    888 	sll	out5, 3, local2
    889 	add	global1, 1280, local6     ! address sbox 8
    890 
    891 	srl	in5, 29, local4
    892 	add	global1, 1792, out3       ! address sbox 8
    893 
    894 	srl	out5, 29, local1
    895 	or	local4, local3, out5
    896 
    897 	or	local2, local1, in5
    898 
    899 
    900 
    901 
    902 
    903 
    904 
    905 
    906 ! rounds_macro
    907 ! in5 out5 1 .des_encrypt1.1 in3 in4
    908 
    909 	xor	out5, out0, local1
    910 
    911 	ld	[out2+284], local5        ! 0x0000FC00
    912 	ba	.des_encrypt1.1
    913 	and	local1, 252, local1
    914 
    915 	.align 32
    916 
    917 .des_encrypt1.1:
    918 	! local6 is address sbox 6
    919 	! out3   is address sbox 8
    920 	! out4   is loop counter
    921 
    922 	ld	[global1+local1], local1
    923 	xor	out5, out1, out1            ! 8642
    924 	xor	out5, out0, out0            ! 7531
    925 	! fmovs	%f0, %f0                  ! fxor used for alignment
    926 
    927 	srl	out1, 4, local0           ! rotate 4 right
    928 	and	out0, local5, local3      ! 3
    929 	! fmovs	%f0, %f0
    930 
    931 	ld	[in3+1*8], local7         ! key 7531 next round
    932 	srl	local3, 8, local3         ! 3
    933 	and	local0, 252, local2       ! 2
    934 	! fmovs	%f0, %f0
    935 
    936 	ld	[global3+local3],local3   ! 3
    937 	sll	out1, 28, out1            ! rotate
    938 	xor	in5, local1, in5            ! 1 finished, local1 now sbox 7
    939 
    940 	ld	[global2+local2], local2  ! 2
    941 	srl	out0, 24, local1          ! 7
    942 	or	out1, local0, out1        ! rotate
    943 
    944 	ldub	[out2+local1], local1     ! 7 (and 0xFC)
    945 	srl	out1, 24, local0          ! 8
    946 	and	out1, local5, local4      ! 4
    947 
    948 	ldub	[out2+local0], local0     ! 8 (and 0xFC)
    949 	srl	local4, 8, local4         ! 4
    950 	xor	in5, local2, in5            ! 2 finished local2 now sbox 6
    951 
    952 	ld	[global4+local4],local4   ! 4
    953 	srl	out1, 16, local2          ! 6
    954 	xor	in5, local3, in5            ! 3 finished local3 now sbox 5
    955 
    956 	ld	[out3+local0],local0      ! 8
    957 	and	local2, 252, local2       ! 6
    958 	add	global1, 1536, local5     ! address sbox 7
    959 
    960 	ld	[local6+local2], local2   ! 6
    961 	srl	out0, 16, local3          ! 5
    962 	xor	in5, local4, in5            ! 4 finished
    963 
    964 	ld	[local5+local1],local1    ! 7
    965 	and	local3, 252, local3       ! 5
    966 	xor	in5, local0, in5            ! 8 finished
    967 
    968 	ld	[global5+local3],local3   ! 5
    969 	xor	in5, local2, in5            ! 6 finished
    970 	subcc	out4, 1, out4
    971 
    972 	ld	[in3+1*8+4], out0         ! key 8642 next round
    973 	xor	in5, local7, local2        ! sbox 5 next round
    974 	xor	in5, local1, in5            ! 7 finished
    975 
    976 	srl	local2, 16, local2        ! sbox 5 next round
    977 	xor	in5, local3, in5            ! 5 finished
    978 
    979 	ld	[in3+1*16+4], out1        ! key 8642 next round again
    980 	and	local2, 252, local2       ! sbox5 next round
    981 ! next round
    982 	xor	in5, local7, local7        ! 7531
    983 
    984 	ld	[global5+local2], local2  ! 5
    985 	srl	local7, 24, local3        ! 7
    986 	xor	in5, out0, out0            ! 8642
    987 
    988 	ldub	[out2+local3], local3     ! 7 (and 0xFC)
    989 	srl	out0, 4, local0           ! rotate 4 right
    990 	and	local7, 252, local1       ! 1
    991 
    992 	sll	out0, 28, out0            ! rotate
    993 	xor	out5, local2, out5            ! 5 finished local2 used
    994 
    995 	srl	local0, 8, local4         ! 4
    996 	and	local0, 252, local2       ! 2
    997 	ld	[local5+local3], local3   ! 7
    998 
    999 	srl	local0, 16, local5        ! 6
   1000 	or	out0, local0, out0        ! rotate
   1001 	ld	[global2+local2], local2  ! 2
   1002 
   1003 	srl	out0, 24, local0
   1004 	ld	[in3+1*16], out0          ! key 7531 next round
   1005 	and	local4, 252, local4	  ! 4
   1006 
   1007 	and	local5, 252, local5       ! 6
   1008 	ld	[global4+local4], local4  ! 4
   1009 	xor	out5, local3, out5            ! 7 finished local3 used
   1010 
   1011 	and	local0, 252, local0       ! 8
   1012 	ld	[local6+local5], local5   ! 6
   1013 	xor	out5, local2, out5            ! 2 finished local2 now sbox 3
   1014 
   1015 	srl	local7, 8, local2         ! 3 start
   1016 	ld	[out3+local0], local0     ! 8
   1017 	xor	out5, local4, out5            ! 4 finished
   1018 
   1019 	and	local2, 252, local2       ! 3
   1020 	ld	[global1+local1], local1  ! 1
   1021 	xor	out5, local5, out5            ! 6 finished local5 used
   1022 
   1023 	ld	[global3+local2], local2  ! 3
   1024 	xor	out5, local0, out5            ! 8 finished
   1025 	add	in3, 1*16, in3             ! enc add 8, dec add -8 to key pointer
   1026 
   1027 	ld	[out2+284], local5        ! 0x0000FC00
   1028 	xor	out5, out0, local4          ! sbox 1 next round
   1029 	xor	out5, local1, out5            ! 1 finished
   1030 
   1031 	xor	out5, local2, out5            ! 3 finished
   1032 	bne	.des_encrypt1.1
   1033 	and	local4, 252, local1       ! sbox 1 next round
   1034 
   1035 ! two rounds more:
   1036 
   1037 	ld	[global1+local1], local1
   1038 	xor	out5, out1, out1
   1039 	xor	out5, out0, out0
   1040 
   1041 	srl	out1, 4, local0           ! rotate
   1042 	and	out0, local5, local3
   1043 
   1044 	ld	[in3+1*8], local7         ! key 7531
   1045 	srl	local3, 8, local3
   1046 	and	local0, 252, local2
   1047 
   1048 	ld	[global3+local3],local3
   1049 	sll	out1, 28, out1            ! rotate
   1050 	xor	in5, local1, in5            ! 1 finished, local1 now sbox 7
   1051 
   1052 	ld	[global2+local2], local2
   1053 	srl	out0, 24, local1
   1054 	or	out1, local0, out1        ! rotate
   1055 
   1056 	ldub	[out2+local1], local1
   1057 	srl	out1, 24, local0
   1058 	and	out1, local5, local4
   1059 
   1060 	ldub	[out2+local0], local0
   1061 	srl	local4, 8, local4
   1062 	xor	in5, local2, in5            ! 2 finished local2 now sbox 6
   1063 
   1064 	ld	[global4+local4],local4
   1065 	srl	out1, 16, local2
   1066 	xor	in5, local3, in5            ! 3 finished local3 now sbox 5
   1067 
   1068 	ld	[out3+local0],local0
   1069 	and	local2, 252, local2
   1070 	add	global1, 1536, local5     ! address sbox 7
   1071 
   1072 	ld	[local6+local2], local2
   1073 	srl	out0, 16, local3
   1074 	xor	in5, local4, in5            ! 4 finished
   1075 
   1076 	ld	[local5+local1],local1
   1077 	and	local3, 252, local3
   1078 	xor	in5, local0, in5
   1079 
   1080 	ld	[global5+local3],local3
   1081 	xor	in5, local2, in5            ! 6 finished
   1082 	cmp	in2, 8
   1083 
   1084 	ld	[out2+280], out4  ! loop counter
   1085 	xor	in5, local7, local2        ! sbox 5 next round
   1086 	xor	in5, local1, in5            ! 7 finished
   1087 
   1088 	ld	[in3+1*8+4], out0
   1089 	srl	local2, 16, local2        ! sbox 5 next round
   1090 	xor	in5, local3, in5            ! 5 finished
   1091 
   1092 	and	local2, 252, local2
   1093 ! next round (two rounds more)
   1094 	xor	in5, local7, local7        ! 7531
   1095 
   1096 	ld	[global5+local2], local2
   1097 	srl	local7, 24, local3
   1098 	xor	in5, out0, out0            ! 8642
   1099 
   1100 	ldub	[out2+local3], local3
   1101 	srl	out0, 4, local0           ! rotate
   1102 	and	local7, 252, local1
   1103 
   1104 	sll	out0, 28, out0            ! rotate
   1105 	xor	out5, local2, out5            ! 5 finished local2 used
   1106 
   1107 	srl	local0, 8, local4
   1108 	and	local0, 252, local2
   1109 	ld	[local5+local3], local3
   1110 
   1111 	srl	local0, 16, local5
   1112 	or	out0, local0, out0        ! rotate
   1113 	ld	[global2+local2], local2
   1114 
   1115 	srl	out0, 24, local0
   1116 	ld	[in4], out0   ! key next encryption/decryption
   1117 	and	local4, 252, local4
   1118 
   1119 	and	local5, 252, local5
   1120 	ld	[global4+local4], local4
   1121 	xor	out5, local3, out5            ! 7 finished local3 used
   1122 
   1123 	and	local0, 252, local0
   1124 	ld	[local6+local5], local5
   1125 	xor	out5, local2, out5            ! 2 finished local2 now sbox 3
   1126 
   1127 	srl	local7, 8, local2         ! 3 start
   1128 	ld	[out3+local0], local0
   1129 	xor	out5, local4, out5
   1130 
   1131 	and	local2, 252, local2
   1132 	ld	[global1+local1], local1
   1133 	xor	out5, local5, out5            ! 6 finished local5 used
   1134 
   1135 	ld	[global3+local2], local2
   1136 	srl	in5, 3, local3
   1137 	xor	out5, local0, out5
   1138 
   1139 	ld	[in4+4], out1 ! key next encryption/decryption
   1140 	sll	in5, 29, local4
   1141 	xor	out5, local1, out5
   1142 
   1143 
   1144 	xor	out5, local2, out5
   1145  ! in4 not used
   1146 
   1147 
   1148 
   1149 ! fp_macro
   1150 ! in5 out5 1
   1151 
   1152 	! initially undo the rotate 3 left done after initial permutation
   1153 	! original left is received shifted 3 right and 29 left in local3/4
   1154 
   1155 	sll	out5, 29, local1
   1156 	or	local3, local4, in5
   1157 
   1158 	srl	out5, 3, out5
   1159 	sethi	%hi(0x55555555), local2
   1160 
   1161 	or	out5, local1, out5
   1162 	or	local2, %lo(0x55555555), local2
   1163 
   1164 	srl	out5, 1, local3
   1165 	sethi	%hi(0x00ff00ff), local1
   1166 	xor	local3, in5, local3
   1167 	or	local1, %lo(0x00ff00ff), local1
   1168 	and	local3, local2, local3
   1169 	sethi	%hi(0x33333333), local4
   1170 	sll	local3, 1, local2
   1171 
   1172 	xor	in5, local3, in5
   1173 
   1174 	srl	in5, 8, local3
   1175 	xor	out5, local2, out5
   1176 	xor	local3, out5, local3
   1177 	or	local4, %lo(0x33333333), local4
   1178 	and	local3, local1, local3
   1179 	sethi	%hi(0x0000ffff), local1
   1180 	sll	local3, 8, local2
   1181 
   1182 	xor	out5, local3, out5
   1183 
   1184 	srl	out5, 2, local3
   1185 	xor	in5, local2, in5
   1186 	xor	local3, in5, local3
   1187 	or	local1, %lo(0x0000ffff), local1
   1188 	and	local3, local4, local3
   1189 	sethi	%hi(0x0f0f0f0f), local4
   1190 	sll	local3, 2, local2
   1191 
   1192 
   1193 	xor	in5, local3, in5
   1194 
   1195 
   1196 	srl	in5, 16, local3
   1197 	xor	out5, local2, out5
   1198 	xor	local3, out5, local3
   1199 	or	local4, %lo(0x0f0f0f0f), local4
   1200 	and	local3, local1, local3
   1201 	sll	local3, 16, local2
   1202 
   1203 	xor	out5, local3, local1
   1204 
   1205 	srl	local1, 4, local3
   1206 	xor	in5, local2, in5
   1207 	xor	local3, in5, local3
   1208 	and	local3, local4, local3
   1209 	sll	local3, 4, local2
   1210 
   1211 	xor	in5, local3, in5
   1212 
   1213 	! optional store:
   1214 
   1215 	st in5, [in0]
   1216 
   1217 	xor	local1, local2, out5
   1218 
   1219 	st out5, [in0+4]
   1220 
   1221             ! 1 for store to [in0]
   1222 
   1223 	ret
   1224 	restore
   1225 
   1226 .encrypt.dec:
   1227 
   1228 	add	in1, 120, in3             ! use last subkey for first round
   1229 
   1230 	! parameter 6  1/2 for include encryption/decryption
   1231 	! parameter 7  1 for move in1 to in3
   1232 	! parameter 8  1 for move in3 to in4, 2 for move in4 to in3
   1233 
   1234 
   1235 
   1236 ! ip_macro
   1237 ! in5 out5 in5 out5 in4 2 0 1
   1238 
   1239 	ld	[out2+256], local1
   1240 	srl	out5, 4, local4
   1241 
   1242 	xor	local4, in5, local4
   1243 	nop
   1244 
   1245 	ld	[out2+260], local2
   1246 	and	local4, local1, local4
   1247 	mov in3, in4
   1248 
   1249 
   1250 	ld	[out2+280], out4          ! loop counter
   1251 	sll	local4, 4, local1
   1252 	xor	in5, local4, in5
   1253 
   1254 	ld	[out2+264], local3
   1255 	srl	in5, 16, local4
   1256 	xor	out5, local1, out5
   1257 
   1258 
   1259 	xor	local4, out5, local4
   1260 	nop	!sethi	%hi(DES_SPtrans), global1 ! sbox addr
   1261 
   1262 
   1263 	and	local4, local2, local4
   1264 	nop	!or	global1, %lo(DES_SPtrans), global1   ! sbox addr
   1265 
   1266 	sll	local4, 16, local1
   1267 	xor	out5, local4, out5
   1268 
   1269 	srl	out5, 2, local4
   1270 	xor	in5, local1, in5
   1271 
   1272 	sethi	%hi(16711680), local5
   1273 	xor	local4, in5, local4
   1274 
   1275 	and	local4, local3, local4
   1276 	or	local5, 255, local5
   1277 
   1278 	sll	local4, 2, local2
   1279 	xor	in5, local4, in5
   1280 
   1281 	srl	in5, 8, local4
   1282 	xor	out5, local2, out5
   1283 
   1284 	xor	local4, out5, local4
   1285 	add	global1, 768, global4
   1286 
   1287 	and	local4, local5, local4
   1288 	add	global1, 1024, global5
   1289 
   1290 	ld	[out2+272], local7
   1291 	sll	local4, 8, local1
   1292 	xor	out5, local4, out5
   1293 
   1294 	srl	out5, 1, local4
   1295 	xor	in5, local1, in5
   1296 
   1297 	ld	[in4], out0                ! key 7531
   1298 	xor	local4, in5, local4
   1299 	add	global1, 256, global2
   1300 
   1301 	ld	[in4+4], out1              ! key 8642
   1302 	and	local4, local7, local4
   1303 	add	global1, 512, global3
   1304 
   1305 	sll	local4, 1, local1
   1306 	xor	in5, local4, in5
   1307 
   1308 	sll	in5, 3, local3
   1309 	xor	out5, local1, out5
   1310 
   1311 	sll	out5, 3, local2
   1312 	add	global1, 1280, local6     ! address sbox 8
   1313 
   1314 	srl	in5, 29, local4
   1315 	add	global1, 1792, out3       ! address sbox 8
   1316 
   1317 	srl	out5, 29, local1
   1318 	or	local4, local3, in5
   1319 
   1320 	or	local2, local1, out5
   1321 
   1322 
   1323 
   1324 
   1325 
   1326 		ld	[out2+284], local5     ! 0x0000FC00 used in the rounds
   1327 		or	local2, local1, out5
   1328 		xor	in5, out0, local1
   1329 
   1330 		call .des_dec.1
   1331 		and	local1, 252, local1
   1332 
   1333 
   1334  ! include dec,  ks in4
   1335 
   1336 
   1337 
   1338 ! fp_macro
   1339 ! out5 in5 1
   1340 
   1341 	! initially undo the rotate 3 left done after initial permutation
   1342 	! original left is received shifted 3 right and 29 left in local3/4
   1343 
   1344 	sll	in5, 29, local1
   1345 	or	local3, local4, out5
   1346 
   1347 	srl	in5, 3, in5
   1348 	sethi	%hi(0x55555555), local2
   1349 
   1350 	or	in5, local1, in5
   1351 	or	local2, %lo(0x55555555), local2
   1352 
   1353 	srl	in5, 1, local3
   1354 	sethi	%hi(0x00ff00ff), local1
   1355 	xor	local3, out5, local3
   1356 	or	local1, %lo(0x00ff00ff), local1
   1357 	and	local3, local2, local3
   1358 	sethi	%hi(0x33333333), local4
   1359 	sll	local3, 1, local2
   1360 
   1361 	xor	out5, local3, out5
   1362 
   1363 	srl	out5, 8, local3
   1364 	xor	in5, local2, in5
   1365 	xor	local3, in5, local3
   1366 	or	local4, %lo(0x33333333), local4
   1367 	and	local3, local1, local3
   1368 	sethi	%hi(0x0000ffff), local1
   1369 	sll	local3, 8, local2
   1370 
   1371 	xor	in5, local3, in5
   1372 
   1373 	srl	in5, 2, local3
   1374 	xor	out5, local2, out5
   1375 	xor	local3, out5, local3
   1376 	or	local1, %lo(0x0000ffff), local1
   1377 	and	local3, local4, local3
   1378 	sethi	%hi(0x0f0f0f0f), local4
   1379 	sll	local3, 2, local2
   1380 
   1381 
   1382 	xor	out5, local3, out5
   1383 
   1384 
   1385 	srl	out5, 16, local3
   1386 	xor	in5, local2, in5
   1387 	xor	local3, in5, local3
   1388 	or	local4, %lo(0x0f0f0f0f), local4
   1389 	and	local3, local1, local3
   1390 	sll	local3, 16, local2
   1391 
   1392 	xor	in5, local3, local1
   1393 
   1394 	srl	local1, 4, local3
   1395 	xor	out5, local2, out5
   1396 	xor	local3, out5, local3
   1397 	and	local3, local4, local3
   1398 	sll	local3, 4, local2
   1399 
   1400 	xor	out5, local3, out5
   1401 
   1402 	! optional store:
   1403 
   1404 	st out5, [in0]
   1405 
   1406 	xor	local1, local2, in5
   1407 
   1408 	st in5, [in0+4]
   1409 
   1410             ! 1 for store to [in0]
   1411 
   1412 	ret
   1413 	restore
   1414 
   1415 .DES_encrypt1.end:
   1416 	.size	 DES_encrypt1,.DES_encrypt1.end-DES_encrypt1
   1417 
   1418 
   1419 ! void DES_encrypt2(data, ks, enc)
   1420 !*********************************
   1421 
   1422 	! encrypts/decrypts without initial/final permutation
   1423 
   1424 	.align 32
   1425 	.global DES_encrypt2
   1426 	.type	 DES_encrypt2,#function
   1427 
   1428 DES_encrypt2:
   1429 
   1430 	save	%sp, FRAME, %sp
   1431 
   1432 	sethi	%hi(_PIC_DES_SPtrans-1f),global1
   1433 	or	global1,%lo(_PIC_DES_SPtrans-1f),global1
   1434 1:	call	.+8
   1435 	add	%o7,global1,global1
   1436 	sub	global1,_PIC_DES_SPtrans-.des_and,out2
   1437 
   1438 	! Set sbox address 1 to 6 and rotate halves 3 left
   1439 	! Errors caught by destest? Yes. Still? *NO*
   1440 
   1441 	!sethi	%hi(DES_SPtrans), global1 ! address sbox 1
   1442 
   1443 	!or	global1, %lo(DES_SPtrans), global1  ! sbox 1
   1444 
   1445 	add	global1, 256, global2     ! sbox 2
   1446 	add	global1, 512, global3     ! sbox 3
   1447 
   1448 	ld	[in0], out5               ! right
   1449 	add	global1, 768, global4     ! sbox 4
   1450 	add	global1, 1024, global5    ! sbox 5
   1451 
   1452 	ld	[in0+4], in5              ! left
   1453 	add	global1, 1280, local6     ! sbox 6
   1454 	add	global1, 1792, out3       ! sbox 8
   1455 
   1456 	! rotate
   1457 
   1458 	sll	in5, 3, local5
   1459 	mov	in1, in3                  ! key address to in3
   1460 
   1461 	sll	out5, 3, local7
   1462 	srl	in5, 29, in5
   1463 
   1464 	srl	out5, 29, out5
   1465 	add	in5, local5, in5
   1466 
   1467 	add	out5, local7, out5
   1468 	cmp	in2, 0
   1469 
   1470 	! we use our own stackframe
   1471 
   1472 	be	.encrypt2.dec
   1473 	STPTR	in0, [%sp+BIAS+ARG0+0*ARGSZ]
   1474 
   1475 	ld	[in3], out0               ! key 7531 first round
   1476 	mov	LOOPS, out4               ! loop counter
   1477 
   1478 	ld	[in3+4], out1             ! key 8642 first round
   1479 	sethi	%hi(0x0000FC00), local5
   1480 
   1481 	call .des_enc
   1482 	mov	in3, in4
   1483 
   1484 	! rotate
   1485 	sll	in5, 29, in0
   1486 	srl	in5, 3, in5
   1487 	sll	out5, 29, in1
   1488 	add	in5, in0, in5
   1489 	srl	out5, 3, out5
   1490 	LDPTR	[%sp+BIAS+ARG0+0*ARGSZ], in0
   1491 	add	out5, in1, out5
   1492 	st	in5, [in0]
   1493 	st	out5, [in0+4]
   1494 
   1495 	ret
   1496 	restore
   1497 
   1498 
   1499 .encrypt2.dec:
   1500 
   1501 	add in3, 120, in4
   1502 
   1503 	ld	[in4], out0               ! key 7531 first round
   1504 	mov	LOOPS, out4               ! loop counter
   1505 
   1506 	ld	[in4+4], out1             ! key 8642 first round
   1507 	sethi	%hi(0x0000FC00), local5
   1508 
   1509 	mov	in5, local1               ! left expected in out5
   1510 	mov	out5, in5
   1511 
   1512 	call .des_dec
   1513 	mov	local1, out5
   1514 
   1515 .encrypt2.finish:
   1516 
   1517 	! rotate
   1518 	sll	in5, 29, in0
   1519 	srl	in5, 3, in5
   1520 	sll	out5, 29, in1
   1521 	add	in5, in0, in5
   1522 	srl	out5, 3, out5
   1523 	LDPTR	[%sp+BIAS+ARG0+0*ARGSZ], in0
   1524 	add	out5, in1, out5
   1525 	st	out5, [in0]
   1526 	st	in5, [in0+4]
   1527 
   1528 	ret
   1529 	restore
   1530 
   1531 .DES_encrypt2.end:
   1532 	.size	 DES_encrypt2, .DES_encrypt2.end-DES_encrypt2
   1533 
   1534 
   1535 ! void DES_encrypt3(data, ks1, ks2, ks3)
   1536 ! **************************************
   1537 
   1538 	.align 32
   1539 	.global DES_encrypt3
   1540 	.type	 DES_encrypt3,#function
   1541 
   1542 DES_encrypt3:
   1543 
   1544 	save	%sp, FRAME, %sp
   1545 
   1546 	sethi	%hi(_PIC_DES_SPtrans-1f),global1
   1547 	or	global1,%lo(_PIC_DES_SPtrans-1f),global1
   1548 1:	call	.+8
   1549 	add	%o7,global1,global1
   1550 	sub	global1,_PIC_DES_SPtrans-.des_and,out2
   1551 
   1552 	ld	[in0], in5                ! left
   1553 	add	in2, 120, in4             ! ks2
   1554 
   1555 	ld	[in0+4], out5             ! right
   1556 	mov	in3, in2                  ! save ks3
   1557 
   1558 	! parameter 6  1/2 for include encryption/decryption
   1559 	! parameter 7  1 for mov in1 to in3
   1560 	! parameter 8  1 for mov in3 to in4
   1561 	! parameter 9  1 for load ks3 and ks2 to in4 and in3
   1562 
   1563 
   1564 
   1565 ! ip_macro
   1566 ! in5 out5 out5 in5 in3 1 1 0 0
   1567 
   1568 	ld	[out2+256], local1
   1569 	srl	out5, 4, local4
   1570 
   1571 	xor	local4, in5, local4
   1572 	mov in1, in3
   1573 
   1574 	ld	[out2+260], local2
   1575 	and	local4, local1, local4
   1576 
   1577 
   1578 
   1579 	ld	[out2+280], out4          ! loop counter
   1580 	sll	local4, 4, local1
   1581 	xor	in5, local4, in5
   1582 
   1583 	ld	[out2+264], local3
   1584 	srl	in5, 16, local4
   1585 	xor	out5, local1, out5
   1586 
   1587 
   1588 	xor	local4, out5, local4
   1589 	nop	!sethi	%hi(DES_SPtrans), global1 ! sbox addr
   1590 
   1591 
   1592 	and	local4, local2, local4
   1593 	nop	!or	global1, %lo(DES_SPtrans), global1   ! sbox addr
   1594 
   1595 	sll	local4, 16, local1
   1596 	xor	out5, local4, out5
   1597 
   1598 	srl	out5, 2, local4
   1599 	xor	in5, local1, in5
   1600 
   1601 	sethi	%hi(16711680), local5
   1602 	xor	local4, in5, local4
   1603 
   1604 	and	local4, local3, local4
   1605 	or	local5, 255, local5
   1606 
   1607 	sll	local4, 2, local2
   1608 	xor	in5, local4, in5
   1609 
   1610 	srl	in5, 8, local4
   1611 	xor	out5, local2, out5
   1612 
   1613 	xor	local4, out5, local4
   1614 	add	global1, 768, global4
   1615 
   1616 	and	local4, local5, local4
   1617 	add	global1, 1024, global5
   1618 
   1619 	ld	[out2+272], local7
   1620 	sll	local4, 8, local1
   1621 	xor	out5, local4, out5
   1622 
   1623 	srl	out5, 1, local4
   1624 	xor	in5, local1, in5
   1625 
   1626 	ld	[in3], out0                ! key 7531
   1627 	xor	local4, in5, local4
   1628 	add	global1, 256, global2
   1629 
   1630 	ld	[in3+4], out1              ! key 8642
   1631 	and	local4, local7, local4
   1632 	add	global1, 512, global3
   1633 
   1634 	sll	local4, 1, local1
   1635 	xor	in5, local4, in5
   1636 
   1637 	sll	in5, 3, local3
   1638 	xor	out5, local1, out5
   1639 
   1640 	sll	out5, 3, local2
   1641 	add	global1, 1280, local6     ! address sbox 8
   1642 
   1643 	srl	in5, 29, local4
   1644 	add	global1, 1792, out3       ! address sbox 8
   1645 
   1646 	srl	out5, 29, local1
   1647 	or	local4, local3, out5
   1648 
   1649 	or	local2, local1, in5
   1650 
   1651 
   1652 
   1653 		ld	[out2+284], local5     ! 0x0000FC00 used in the rounds
   1654 		or	local2, local1, in5
   1655 		xor	out5, out0, local1
   1656 
   1657 		call .des_enc.1
   1658 		and	local1, 252, local1
   1659 
   1660 
   1661 
   1662 
   1663 
   1664 
   1665 	call	.des_dec
   1666 	mov	in2, in3                  ! preload ks3
   1667 
   1668 	call	.des_enc
   1669 	nop
   1670 
   1671 
   1672 
   1673 ! fp_macro
   1674 ! in5 out5 1
   1675 
   1676 	! initially undo the rotate 3 left done after initial permutation
   1677 	! original left is received shifted 3 right and 29 left in local3/4
   1678 
   1679 	sll	out5, 29, local1
   1680 	or	local3, local4, in5
   1681 
   1682 	srl	out5, 3, out5
   1683 	sethi	%hi(0x55555555), local2
   1684 
   1685 	or	out5, local1, out5
   1686 	or	local2, %lo(0x55555555), local2
   1687 
   1688 	srl	out5, 1, local3
   1689 	sethi	%hi(0x00ff00ff), local1
   1690 	xor	local3, in5, local3
   1691 	or	local1, %lo(0x00ff00ff), local1
   1692 	and	local3, local2, local3
   1693 	sethi	%hi(0x33333333), local4
   1694 	sll	local3, 1, local2
   1695 
   1696 	xor	in5, local3, in5
   1697 
   1698 	srl	in5, 8, local3
   1699 	xor	out5, local2, out5
   1700 	xor	local3, out5, local3
   1701 	or	local4, %lo(0x33333333), local4
   1702 	and	local3, local1, local3
   1703 	sethi	%hi(0x0000ffff), local1
   1704 	sll	local3, 8, local2
   1705 
   1706 	xor	out5, local3, out5
   1707 
   1708 	srl	out5, 2, local3
   1709 	xor	in5, local2, in5
   1710 	xor	local3, in5, local3
   1711 	or	local1, %lo(0x0000ffff), local1
   1712 	and	local3, local4, local3
   1713 	sethi	%hi(0x0f0f0f0f), local4
   1714 	sll	local3, 2, local2
   1715 
   1716 
   1717 	xor	in5, local3, in5
   1718 
   1719 
   1720 	srl	in5, 16, local3
   1721 	xor	out5, local2, out5
   1722 	xor	local3, out5, local3
   1723 	or	local4, %lo(0x0f0f0f0f), local4
   1724 	and	local3, local1, local3
   1725 	sll	local3, 16, local2
   1726 
   1727 	xor	out5, local3, local1
   1728 
   1729 	srl	local1, 4, local3
   1730 	xor	in5, local2, in5
   1731 	xor	local3, in5, local3
   1732 	and	local3, local4, local3
   1733 	sll	local3, 4, local2
   1734 
   1735 	xor	in5, local3, in5
   1736 
   1737 	! optional store:
   1738 
   1739 	st in5, [in0]
   1740 
   1741 	xor	local1, local2, out5
   1742 
   1743 	st out5, [in0+4]
   1744 
   1745 
   1746 
   1747 	ret
   1748 	restore
   1749 
   1750 .DES_encrypt3.end:
   1751 	.size	 DES_encrypt3,.DES_encrypt3.end-DES_encrypt3
   1752 
   1753 
   1754 ! void DES_decrypt3(data, ks1, ks2, ks3)
   1755 ! **************************************
   1756 
   1757 	.align 32
   1758 	.global DES_decrypt3
   1759 	.type	 DES_decrypt3,#function
   1760 
   1761 DES_decrypt3:
   1762 
   1763 	save	%sp, FRAME, %sp
   1764 
   1765 	sethi	%hi(_PIC_DES_SPtrans-1f),global1
   1766 	or	global1,%lo(_PIC_DES_SPtrans-1f),global1
   1767 1:	call	.+8
   1768 	add	%o7,global1,global1
   1769 	sub	global1,_PIC_DES_SPtrans-.des_and,out2
   1770 
   1771 	ld	[in0], in5                ! left
   1772 	add	in3, 120, in4             ! ks3
   1773 
   1774 	ld	[in0+4], out5             ! right
   1775 	mov	in2, in3                  ! ks2
   1776 
   1777 	! parameter 6  1/2 for include encryption/decryption
   1778 	! parameter 7  1 for mov in1 to in3
   1779 	! parameter 8  1 for mov in3 to in4
   1780 	! parameter 9  1 for load ks3 and ks2 to in4 and in3
   1781 
   1782 
   1783 
   1784 ! ip_macro
   1785 ! in5 out5 in5 out5 in4 2 0 0 0
   1786 
   1787 	ld	[out2+256], local1
   1788 	srl	out5, 4, local4
   1789 
   1790 	xor	local4, in5, local4
   1791 	nop
   1792 
   1793 	ld	[out2+260], local2
   1794 	and	local4, local1, local4
   1795 
   1796 
   1797 
   1798 	ld	[out2+280], out4          ! loop counter
   1799 	sll	local4, 4, local1
   1800 	xor	in5, local4, in5
   1801 
   1802 	ld	[out2+264], local3
   1803 	srl	in5, 16, local4
   1804 	xor	out5, local1, out5
   1805 
   1806 
   1807 	xor	local4, out5, local4
   1808 	nop	!sethi	%hi(DES_SPtrans), global1 ! sbox addr
   1809 
   1810 
   1811 	and	local4, local2, local4
   1812 	nop	!or	global1, %lo(DES_SPtrans), global1   ! sbox addr
   1813 
   1814 	sll	local4, 16, local1
   1815 	xor	out5, local4, out5
   1816 
   1817 	srl	out5, 2, local4
   1818 	xor	in5, local1, in5
   1819 
   1820 	sethi	%hi(16711680), local5
   1821 	xor	local4, in5, local4
   1822 
   1823 	and	local4, local3, local4
   1824 	or	local5, 255, local5
   1825 
   1826 	sll	local4, 2, local2
   1827 	xor	in5, local4, in5
   1828 
   1829 	srl	in5, 8, local4
   1830 	xor	out5, local2, out5
   1831 
   1832 	xor	local4, out5, local4
   1833 	add	global1, 768, global4
   1834 
   1835 	and	local4, local5, local4
   1836 	add	global1, 1024, global5
   1837 
   1838 	ld	[out2+272], local7
   1839 	sll	local4, 8, local1
   1840 	xor	out5, local4, out5
   1841 
   1842 	srl	out5, 1, local4
   1843 	xor	in5, local1, in5
   1844 
   1845 	ld	[in4], out0                ! key 7531
   1846 	xor	local4, in5, local4
   1847 	add	global1, 256, global2
   1848 
   1849 	ld	[in4+4], out1              ! key 8642
   1850 	and	local4, local7, local4
   1851 	add	global1, 512, global3
   1852 
   1853 	sll	local4, 1, local1
   1854 	xor	in5, local4, in5
   1855 
   1856 	sll	in5, 3, local3
   1857 	xor	out5, local1, out5
   1858 
   1859 	sll	out5, 3, local2
   1860 	add	global1, 1280, local6     ! address sbox 8
   1861 
   1862 	srl	in5, 29, local4
   1863 	add	global1, 1792, out3       ! address sbox 8
   1864 
   1865 	srl	out5, 29, local1
   1866 	or	local4, local3, in5
   1867 
   1868 	or	local2, local1, out5
   1869 
   1870 
   1871 
   1872 
   1873 
   1874 		ld	[out2+284], local5     ! 0x0000FC00 used in the rounds
   1875 		or	local2, local1, out5
   1876 		xor	in5, out0, local1
   1877 
   1878 		call .des_dec.1
   1879 		and	local1, 252, local1
   1880 
   1881 
   1882 
   1883 
   1884 	call	.des_enc
   1885 	add	in1, 120, in4             ! preload ks1
   1886 
   1887 	call	.des_dec
   1888 	nop
   1889 
   1890 
   1891 
   1892 ! fp_macro
   1893 ! out5 in5 1
   1894 
   1895 	! initially undo the rotate 3 left done after initial permutation
   1896 	! original left is received shifted 3 right and 29 left in local3/4
   1897 
   1898 	sll	in5, 29, local1
   1899 	or	local3, local4, out5
   1900 
   1901 	srl	in5, 3, in5
   1902 	sethi	%hi(0x55555555), local2
   1903 
   1904 	or	in5, local1, in5
   1905 	or	local2, %lo(0x55555555), local2
   1906 
   1907 	srl	in5, 1, local3
   1908 	sethi	%hi(0x00ff00ff), local1
   1909 	xor	local3, out5, local3
   1910 	or	local1, %lo(0x00ff00ff), local1
   1911 	and	local3, local2, local3
   1912 	sethi	%hi(0x33333333), local4
   1913 	sll	local3, 1, local2
   1914 
   1915 	xor	out5, local3, out5
   1916 
   1917 	srl	out5, 8, local3
   1918 	xor	in5, local2, in5
   1919 	xor	local3, in5, local3
   1920 	or	local4, %lo(0x33333333), local4
   1921 	and	local3, local1, local3
   1922 	sethi	%hi(0x0000ffff), local1
   1923 	sll	local3, 8, local2
   1924 
   1925 	xor	in5, local3, in5
   1926 
   1927 	srl	in5, 2, local3
   1928 	xor	out5, local2, out5
   1929 	xor	local3, out5, local3
   1930 	or	local1, %lo(0x0000ffff), local1
   1931 	and	local3, local4, local3
   1932 	sethi	%hi(0x0f0f0f0f), local4
   1933 	sll	local3, 2, local2
   1934 
   1935 
   1936 	xor	out5, local3, out5
   1937 
   1938 
   1939 	srl	out5, 16, local3
   1940 	xor	in5, local2, in5
   1941 	xor	local3, in5, local3
   1942 	or	local4, %lo(0x0f0f0f0f), local4
   1943 	and	local3, local1, local3
   1944 	sll	local3, 16, local2
   1945 
   1946 	xor	in5, local3, local1
   1947 
   1948 	srl	local1, 4, local3
   1949 	xor	out5, local2, out5
   1950 	xor	local3, out5, local3
   1951 	and	local3, local4, local3
   1952 	sll	local3, 4, local2
   1953 
   1954 	xor	out5, local3, out5
   1955 
   1956 	! optional store:
   1957 
   1958 	st out5, [in0]
   1959 
   1960 	xor	local1, local2, in5
   1961 
   1962 	st in5, [in0+4]
   1963 
   1964 
   1965 
   1966 	ret
   1967 	restore
   1968 
   1969 .DES_decrypt3.end:
   1970 	.size	 DES_decrypt3,.DES_decrypt3.end-DES_decrypt3
   1971 
   1972 ! void DES_ncbc_encrypt(input, output, length, schedule, ivec, enc)
   1973 ! *****************************************************************
   1974 
   1975 
   1976 	.align 32
   1977 	.global DES_ncbc_encrypt
   1978 	.type	 DES_ncbc_encrypt,#function
   1979 
   1980 DES_ncbc_encrypt:
   1981 
   1982 	save	%sp, FRAME, %sp
   1983 
   1984 
   1985 
   1986 
   1987 
   1988 	sethi	%hi(_PIC_DES_SPtrans-1f),global1
   1989 	or	global1,%lo(_PIC_DES_SPtrans-1f),global1
   1990 1:	call	.+8
   1991 	add	%o7,global1,global1
   1992 	sub	global1,_PIC_DES_SPtrans-.des_and,out2
   1993 
   1994 	cmp	in5, 0                    ! enc
   1995 
   1996 	be	.ncbc.dec
   1997 	STPTR	in4,  [%sp+BIAS+ARG0+4*ARGSZ]
   1998 
   1999 	! addr  left  right  temp  label
   2000 
   2001 
   2002 ! load_little_endian
   2003 ! in4 in5 out5 local3 .LLE1
   2004 
   2005 	! first in memory to rightmost in register
   2006 
   2007 .LLE1:
   2008 	ldub	[in4+3], in5
   2009 
   2010 	ldub	[in4+2], local3
   2011 	sll	in5, 8, in5
   2012 	or	in5, local3, in5
   2013 
   2014 	ldub	[in4+1], local3
   2015 	sll	in5, 8, in5
   2016 	or	in5, local3, in5
   2017 
   2018 	ldub	[in4+0], local3
   2019 	sll	in5, 8, in5
   2020 	or	in5, local3, in5
   2021 
   2022 
   2023 	ldub	[in4+3+4], out5
   2024 
   2025 	ldub	[in4+2+4], local3
   2026 	sll	out5, 8, out5
   2027 	or	out5, local3, out5
   2028 
   2029 	ldub	[in4+1+4], local3
   2030 	sll	out5, 8, out5
   2031 	or	out5, local3, out5
   2032 
   2033 	ldub	[in4+0+4], local3
   2034 	sll	out5, 8, out5
   2035 	or	out5, local3, out5
   2036 .LLE1a:
   2037 
   2038   ! iv
   2039 
   2040 	addcc	in2, -8, in2              ! bytes missing when first block done
   2041 
   2042 	bl	.ncbc.enc.seven.or.less
   2043 	mov	in3, in4                  ! schedule
   2044 
   2045 .ncbc.enc.next.block:
   2046 
   2047 
   2048 
   2049 ! load_little_endian
   2050 ! in0 out4 global4 local3 .LLE2
   2051 
   2052 	! first in memory to rightmost in register
   2053 
   2054 .LLE2:
   2055 	ldub	[in0+3], out4
   2056 
   2057 	ldub	[in0+2], local3
   2058 	sll	out4, 8, out4
   2059 	or	out4, local3, out4
   2060 
   2061 	ldub	[in0+1], local3
   2062 	sll	out4, 8, out4
   2063 	or	out4, local3, out4
   2064 
   2065 	ldub	[in0+0], local3
   2066 	sll	out4, 8, out4
   2067 	or	out4, local3, out4
   2068 
   2069 
   2070 	ldub	[in0+3+4], global4
   2071 
   2072 	ldub	[in0+2+4], local3
   2073 	sll	global4, 8, global4
   2074 	or	global4, local3, global4
   2075 
   2076 	ldub	[in0+1+4], local3
   2077 	sll	global4, 8, global4
   2078 	or	global4, local3, global4
   2079 
   2080 	ldub	[in0+0+4], local3
   2081 	sll	global4, 8, global4
   2082 	or	global4, local3, global4
   2083 .LLE2a:
   2084 
   2085   ! block
   2086 
   2087 .ncbc.enc.next.block_1:
   2088 
   2089 	xor	in5, out4, in5            ! iv xor
   2090 	xor	out5, global4, out5       ! iv xor
   2091 
   2092 	! parameter 8  1 for move in3 to in4, 2 for move in4 to in3
   2093 
   2094 
   2095 ! ip_macro
   2096 ! in5 out5 out5 in5 in3 0 0 2
   2097 
   2098 	ld	[out2+256], local1
   2099 	srl	out5, 4, local4
   2100 
   2101 	xor	local4, in5, local4
   2102 	nop
   2103 
   2104 	ld	[out2+260], local2
   2105 	and	local4, local1, local4
   2106 
   2107 	mov in4, in3
   2108 
   2109 	ld	[out2+280], out4          ! loop counter
   2110 	sll	local4, 4, local1
   2111 	xor	in5, local4, in5
   2112 
   2113 	ld	[out2+264], local3
   2114 	srl	in5, 16, local4
   2115 	xor	out5, local1, out5
   2116 
   2117 
   2118 	xor	local4, out5, local4
   2119 	nop	!sethi	%hi(DES_SPtrans), global1 ! sbox addr
   2120 
   2121 
   2122 	and	local4, local2, local4
   2123 	nop	!or	global1, %lo(DES_SPtrans), global1   ! sbox addr
   2124 
   2125 	sll	local4, 16, local1
   2126 	xor	out5, local4, out5
   2127 
   2128 	srl	out5, 2, local4
   2129 	xor	in5, local1, in5
   2130 
   2131 	sethi	%hi(16711680), local5
   2132 	xor	local4, in5, local4
   2133 
   2134 	and	local4, local3, local4
   2135 	or	local5, 255, local5
   2136 
   2137 	sll	local4, 2, local2
   2138 	xor	in5, local4, in5
   2139 
   2140 	srl	in5, 8, local4
   2141 	xor	out5, local2, out5
   2142 
   2143 	xor	local4, out5, local4
   2144 	add	global1, 768, global4
   2145 
   2146 	and	local4, local5, local4
   2147 	add	global1, 1024, global5
   2148 
   2149 	ld	[out2+272], local7
   2150 	sll	local4, 8, local1
   2151 	xor	out5, local4, out5
   2152 
   2153 	srl	out5, 1, local4
   2154 	xor	in5, local1, in5
   2155 
   2156 	ld	[in3], out0                ! key 7531
   2157 	xor	local4, in5, local4
   2158 	add	global1, 256, global2
   2159 
   2160 	ld	[in3+4], out1              ! key 8642
   2161 	and	local4, local7, local4
   2162 	add	global1, 512, global3
   2163 
   2164 	sll	local4, 1, local1
   2165 	xor	in5, local4, in5
   2166 
   2167 	sll	in5, 3, local3
   2168 	xor	out5, local1, out5
   2169 
   2170 	sll	out5, 3, local2
   2171 	add	global1, 1280, local6     ! address sbox 8
   2172 
   2173 	srl	in5, 29, local4
   2174 	add	global1, 1792, out3       ! address sbox 8
   2175 
   2176 	srl	out5, 29, local1
   2177 	or	local4, local3, out5
   2178 
   2179 	or	local2, local1, in5
   2180 
   2181 
   2182 
   2183 
   2184 
   2185 
   2186 .ncbc.enc.next.block_2:
   2187 
   2188 !//	call .des_enc                     ! compares in2 to 8
   2189 !	rounds inlined for alignment purposes
   2190 
   2191 	add	global1, 768, global4     ! address sbox 4 since register used below
   2192 
   2193 
   2194 
   2195 ! rounds_macro
   2196 ! in5 out5 1 .ncbc.enc.1 in3 in4
   2197 
   2198 	xor	out5, out0, local1
   2199 
   2200 	ld	[out2+284], local5        ! 0x0000FC00
   2201 	ba	.ncbc.enc.1
   2202 	and	local1, 252, local1
   2203 
   2204 	.align 32
   2205 
   2206 .ncbc.enc.1:
   2207 	! local6 is address sbox 6
   2208 	! out3   is address sbox 8
   2209 	! out4   is loop counter
   2210 
   2211 	ld	[global1+local1], local1
   2212 	xor	out5, out1, out1            ! 8642
   2213 	xor	out5, out0, out0            ! 7531
   2214 	! fmovs	%f0, %f0                  ! fxor used for alignment
   2215 
   2216 	srl	out1, 4, local0           ! rotate 4 right
   2217 	and	out0, local5, local3      ! 3
   2218 	! fmovs	%f0, %f0
   2219 
   2220 	ld	[in3+1*8], local7         ! key 7531 next round
   2221 	srl	local3, 8, local3         ! 3
   2222 	and	local0, 252, local2       ! 2
   2223 	! fmovs	%f0, %f0
   2224 
   2225 	ld	[global3+local3],local3   ! 3
   2226 	sll	out1, 28, out1            ! rotate
   2227 	xor	in5, local1, in5            ! 1 finished, local1 now sbox 7
   2228 
   2229 	ld	[global2+local2], local2  ! 2
   2230 	srl	out0, 24, local1          ! 7
   2231 	or	out1, local0, out1        ! rotate
   2232 
   2233 	ldub	[out2+local1], local1     ! 7 (and 0xFC)
   2234 	srl	out1, 24, local0          ! 8
   2235 	and	out1, local5, local4      ! 4
   2236 
   2237 	ldub	[out2+local0], local0     ! 8 (and 0xFC)
   2238 	srl	local4, 8, local4         ! 4
   2239 	xor	in5, local2, in5            ! 2 finished local2 now sbox 6
   2240 
   2241 	ld	[global4+local4],local4   ! 4
   2242 	srl	out1, 16, local2          ! 6
   2243 	xor	in5, local3, in5            ! 3 finished local3 now sbox 5
   2244 
   2245 	ld	[out3+local0],local0      ! 8
   2246 	and	local2, 252, local2       ! 6
   2247 	add	global1, 1536, local5     ! address sbox 7
   2248 
   2249 	ld	[local6+local2], local2   ! 6
   2250 	srl	out0, 16, local3          ! 5
   2251 	xor	in5, local4, in5            ! 4 finished
   2252 
   2253 	ld	[local5+local1],local1    ! 7
   2254 	and	local3, 252, local3       ! 5
   2255 	xor	in5, local0, in5            ! 8 finished
   2256 
   2257 	ld	[global5+local3],local3   ! 5
   2258 	xor	in5, local2, in5            ! 6 finished
   2259 	subcc	out4, 1, out4
   2260 
   2261 	ld	[in3+1*8+4], out0         ! key 8642 next round
   2262 	xor	in5, local7, local2        ! sbox 5 next round
   2263 	xor	in5, local1, in5            ! 7 finished
   2264 
   2265 	srl	local2, 16, local2        ! sbox 5 next round
   2266 	xor	in5, local3, in5            ! 5 finished
   2267 
   2268 	ld	[in3+1*16+4], out1        ! key 8642 next round again
   2269 	and	local2, 252, local2       ! sbox5 next round
   2270 ! next round
   2271 	xor	in5, local7, local7        ! 7531
   2272 
   2273 	ld	[global5+local2], local2  ! 5
   2274 	srl	local7, 24, local3        ! 7
   2275 	xor	in5, out0, out0            ! 8642
   2276 
   2277 	ldub	[out2+local3], local3     ! 7 (and 0xFC)
   2278 	srl	out0, 4, local0           ! rotate 4 right
   2279 	and	local7, 252, local1       ! 1
   2280 
   2281 	sll	out0, 28, out0            ! rotate
   2282 	xor	out5, local2, out5            ! 5 finished local2 used
   2283 
   2284 	srl	local0, 8, local4         ! 4
   2285 	and	local0, 252, local2       ! 2
   2286 	ld	[local5+local3], local3   ! 7
   2287 
   2288 	srl	local0, 16, local5        ! 6
   2289 	or	out0, local0, out0        ! rotate
   2290 	ld	[global2+local2], local2  ! 2
   2291 
   2292 	srl	out0, 24, local0
   2293 	ld	[in3+1*16], out0          ! key 7531 next round
   2294 	and	local4, 252, local4	  ! 4
   2295 
   2296 	and	local5, 252, local5       ! 6
   2297 	ld	[global4+local4], local4  ! 4
   2298 	xor	out5, local3, out5            ! 7 finished local3 used
   2299 
   2300 	and	local0, 252, local0       ! 8
   2301 	ld	[local6+local5], local5   ! 6
   2302 	xor	out5, local2, out5            ! 2 finished local2 now sbox 3
   2303 
   2304 	srl	local7, 8, local2         ! 3 start
   2305 	ld	[out3+local0], local0     ! 8
   2306 	xor	out5, local4, out5            ! 4 finished
   2307 
   2308 	and	local2, 252, local2       ! 3
   2309 	ld	[global1+local1], local1  ! 1
   2310 	xor	out5, local5, out5            ! 6 finished local5 used
   2311 
   2312 	ld	[global3+local2], local2  ! 3
   2313 	xor	out5, local0, out5            ! 8 finished
   2314 	add	in3, 1*16, in3             ! enc add 8, dec add -8 to key pointer
   2315 
   2316 	ld	[out2+284], local5        ! 0x0000FC00
   2317 	xor	out5, out0, local4          ! sbox 1 next round
   2318 	xor	out5, local1, out5            ! 1 finished
   2319 
   2320 	xor	out5, local2, out5            ! 3 finished
   2321 	bne	.ncbc.enc.1
   2322 	and	local4, 252, local1       ! sbox 1 next round
   2323 
   2324 ! two rounds more:
   2325 
   2326 	ld	[global1+local1], local1
   2327 	xor	out5, out1, out1
   2328 	xor	out5, out0, out0
   2329 
   2330 	srl	out1, 4, local0           ! rotate
   2331 	and	out0, local5, local3
   2332 
   2333 	ld	[in3+1*8], local7         ! key 7531
   2334 	srl	local3, 8, local3
   2335 	and	local0, 252, local2
   2336 
   2337 	ld	[global3+local3],local3
   2338 	sll	out1, 28, out1            ! rotate
   2339 	xor	in5, local1, in5            ! 1 finished, local1 now sbox 7
   2340 
   2341 	ld	[global2+local2], local2
   2342 	srl	out0, 24, local1
   2343 	or	out1, local0, out1        ! rotate
   2344 
   2345 	ldub	[out2+local1], local1
   2346 	srl	out1, 24, local0
   2347 	and	out1, local5, local4
   2348 
   2349 	ldub	[out2+local0], local0
   2350 	srl	local4, 8, local4
   2351 	xor	in5, local2, in5            ! 2 finished local2 now sbox 6
   2352 
   2353 	ld	[global4+local4],local4
   2354 	srl	out1, 16, local2
   2355 	xor	in5, local3, in5            ! 3 finished local3 now sbox 5
   2356 
   2357 	ld	[out3+local0],local0
   2358 	and	local2, 252, local2
   2359 	add	global1, 1536, local5     ! address sbox 7
   2360 
   2361 	ld	[local6+local2], local2
   2362 	srl	out0, 16, local3
   2363 	xor	in5, local4, in5            ! 4 finished
   2364 
   2365 	ld	[local5+local1],local1
   2366 	and	local3, 252, local3
   2367 	xor	in5, local0, in5
   2368 
   2369 	ld	[global5+local3],local3
   2370 	xor	in5, local2, in5            ! 6 finished
   2371 	cmp	in2, 8
   2372 
   2373 	ld	[out2+280], out4  ! loop counter
   2374 	xor	in5, local7, local2        ! sbox 5 next round
   2375 	xor	in5, local1, in5            ! 7 finished
   2376 
   2377 	ld	[in3+1*8+4], out0
   2378 	srl	local2, 16, local2        ! sbox 5 next round
   2379 	xor	in5, local3, in5            ! 5 finished
   2380 
   2381 	and	local2, 252, local2
   2382 ! next round (two rounds more)
   2383 	xor	in5, local7, local7        ! 7531
   2384 
   2385 	ld	[global5+local2], local2
   2386 	srl	local7, 24, local3
   2387 	xor	in5, out0, out0            ! 8642
   2388 
   2389 	ldub	[out2+local3], local3
   2390 	srl	out0, 4, local0           ! rotate
   2391 	and	local7, 252, local1
   2392 
   2393 	sll	out0, 28, out0            ! rotate
   2394 	xor	out5, local2, out5            ! 5 finished local2 used
   2395 
   2396 	srl	local0, 8, local4
   2397 	and	local0, 252, local2
   2398 	ld	[local5+local3], local3
   2399 
   2400 	srl	local0, 16, local5
   2401 	or	out0, local0, out0        ! rotate
   2402 	ld	[global2+local2], local2
   2403 
   2404 	srl	out0, 24, local0
   2405 	ld	[in4], out0   ! key next encryption/decryption
   2406 	and	local4, 252, local4
   2407 
   2408 	and	local5, 252, local5
   2409 	ld	[global4+local4], local4
   2410 	xor	out5, local3, out5            ! 7 finished local3 used
   2411 
   2412 	and	local0, 252, local0
   2413 	ld	[local6+local5], local5
   2414 	xor	out5, local2, out5            ! 2 finished local2 now sbox 3
   2415 
   2416 	srl	local7, 8, local2         ! 3 start
   2417 	ld	[out3+local0], local0
   2418 	xor	out5, local4, out5
   2419 
   2420 	and	local2, 252, local2
   2421 	ld	[global1+local1], local1
   2422 	xor	out5, local5, out5            ! 6 finished local5 used
   2423 
   2424 	ld	[global3+local2], local2
   2425 	srl	in5, 3, local3
   2426 	xor	out5, local0, out5
   2427 
   2428 	ld	[in4+4], out1 ! key next encryption/decryption
   2429 	sll	in5, 29, local4
   2430 	xor	out5, local1, out5
   2431 
   2432 
   2433 	xor	out5, local2, out5
   2434  ! include encryption  ks in3
   2435 
   2436 	bl	.ncbc.enc.next.block_fp
   2437 	add	in0, 8, in0               ! input address
   2438 
   2439 	! If 8 or more bytes are to be encrypted after this block,
   2440 	! we combine final permutation for this block with initial
   2441 	! permutation for next block. Load next block:
   2442 
   2443 
   2444 
   2445 ! load_little_endian
   2446 ! in0 global3 global4 local5 .LLE12
   2447 
   2448 	! first in memory to rightmost in register
   2449 
   2450 .LLE12:
   2451 	ldub	[in0+3], global3
   2452 
   2453 	ldub	[in0+2], local5
   2454 	sll	global3, 8, global3
   2455 	or	global3, local5, global3
   2456 
   2457 	ldub	[in0+1], local5
   2458 	sll	global3, 8, global3
   2459 	or	global3, local5, global3
   2460 
   2461 	ldub	[in0+0], local5
   2462 	sll	global3, 8, global3
   2463 	or	global3, local5, global3
   2464 
   2465 
   2466 	ldub	[in0+3+4], global4
   2467 
   2468 	ldub	[in0+2+4], local5
   2469 	sll	global4, 8, global4
   2470 	or	global4, local5, global4
   2471 
   2472 	ldub	[in0+1+4], local5
   2473 	sll	global4, 8, global4
   2474 	or	global4, local5, global4
   2475 
   2476 	ldub	[in0+0+4], local5
   2477 	sll	global4, 8, global4
   2478 	or	global4, local5, global4
   2479 .LLE12a:
   2480 
   2481 
   2482 
   2483 	!  parameter 1   original left
   2484 	!  parameter 2   original right
   2485 	!  parameter 3   left ip
   2486 	!  parameter 4   right ip
   2487 	!  parameter 5   1: load ks1/ks2 to in3/in4, add 120 to in4
   2488 	!                2: mov in4 to in3
   2489 	!
   2490 	! also adds -8 to length in2 and loads loop counter to out4
   2491 
   2492 
   2493 
   2494 ! fp_ip_macro
   2495 ! out0 out1 global3 global4 2
   2496 
   2497 
   2498 
   2499 
   2500 
   2501 
   2502 
   2503 
   2504 
   2505 	! out0 in local3, local4
   2506 
   2507 	ld	[out2+256], local1
   2508 	sll	out5, 29, out4
   2509 	or	local3, local4, out0
   2510 
   2511 	srl	out5, 3, out1
   2512 	mov in4, in3
   2513 
   2514 	ld	[out2+272], local5
   2515 	srl	global4, 4, local0
   2516 	or	out1, out4, out1
   2517 
   2518 	srl	out1, 1, out4
   2519 	xor	out4, out0, out4
   2520 
   2521 	and	out4, local5, out4
   2522 	xor	local0, global3, local0
   2523 
   2524 	sll	out4, 1, local3
   2525 	xor	out0, out4, out0
   2526 
   2527 	and	local0, local1, local0
   2528 	add	in2, -8, in2
   2529 
   2530 	sll	local0, 4, local7
   2531 	xor	global3, local0, global3
   2532 
   2533 	ld	[out2+268], local4
   2534 	srl	out0, 8, out4
   2535 	xor	out1, local3, out1
   2536 	ld	[out2+260], local2
   2537 	srl	global3, 16, local0
   2538 	xor	global4, local7, global4
   2539 	xor	out4, out1, out4
   2540 	xor	local0, global4, local0
   2541 	and	out4, local4, out4
   2542 	and	local0, local2, local0
   2543 	sll	out4, 8, local3
   2544 	xor	out1, out4, out1
   2545 	sll	local0, 16, local7
   2546 	xor	global4, local0, global4
   2547 
   2548 	srl	out1, 2, out4
   2549 	xor	out0, local3, out0
   2550 
   2551 	ld	[out2+264], local3         ! ip3
   2552 	srl	global4, 2, local0
   2553 	xor	global3, local7, global3
   2554 	xor	out4, out0, out4
   2555 	xor	local0, global3, local0
   2556 	and	out4, local3, out4
   2557 	and	local0, local3, local0
   2558 	sll	out4, 2, local3
   2559 	xor	out0, out4, out0
   2560 	sll	local0, 2, local7
   2561 	xor	global3, local0, global3
   2562 
   2563 	srl	out0, 16, out4
   2564 	xor	out1, local3, out1
   2565 	srl	global3, 8, local0
   2566 	xor	global4, local7, global4
   2567 	xor	out4, out1, out4
   2568 	xor	local0, global4, local0
   2569 	and	out4, local2, out4
   2570 	and	local0, local4, local0
   2571 	sll	out4, 16, local3
   2572 	xor	out1, out4, local4
   2573 	sll	local0, 8, local7
   2574 	xor	global4, local0, global4
   2575 
   2576 	srl	global4, 1, local0
   2577 	xor	global3, local7, global3
   2578 
   2579 	srl	local4, 4, out4
   2580 	xor	local0, global3, local0
   2581 
   2582 	xor	out0, local3, out0
   2583 	and	local0, local5, local0
   2584 
   2585 	sll	local0, 1, local7
   2586 	xor	out4, out0, out4
   2587 
   2588 	xor	global3, local0, global3
   2589 	xor	global4, local7, global4
   2590 
   2591 	sll	global3, 3, local5
   2592 	and	out4, local1, out4
   2593 
   2594 	sll	out4, 4, local3
   2595 	xor	out0, out4, out0
   2596 
   2597 
   2598 	sll	global4, 3, local2
   2599 	xor	local4, local3, out1
   2600 
   2601 	! reload since used as temporary:
   2602 
   2603 	ld	[out2+280], out4          ! loop counter
   2604 
   2605 	srl	global3, 29, local0
   2606 
   2607 
   2608 
   2609 	srl	global4, 29, local7
   2610 
   2611 	or	local0, local5, global4
   2612 	or	local2, local7, global3
   2613 
   2614 
   2615 
   2616 
   2617 
   2618 ! store_little_endian
   2619 ! in1 out0 out1 local3 .SLE10
   2620 
   2621 	! rightmost in register to first in memory
   2622 
   2623 .SLE10:
   2624 	and	out0, 255, local3
   2625 	stub	local3, [in1+0]
   2626 
   2627 	srl	out0, 8, local3
   2628 	and	local3, 255, local3
   2629 	stub	local3, [in1+1]
   2630 
   2631 	srl	out0, 16, local3
   2632 	and	local3, 255, local3
   2633 	stub	local3, [in1+2]
   2634 
   2635 	srl	out0, 24, local3
   2636 	stub	local3, [in1+3]
   2637 
   2638 
   2639 	and	out1, 255, local3
   2640 	stub	local3, [in1+0+4]
   2641 
   2642 	srl	out1, 8, local3
   2643 	and	local3, 255, local3
   2644 	stub	local3, [in1+1+4]
   2645 
   2646 	srl	out1, 16, local3
   2647 	and	local3, 255, local3
   2648 	stub	local3, [in1+2+4]
   2649 
   2650 	srl	out1, 24, local3
   2651 	stub	local3, [in1+3+4]
   2652 
   2653 .SLE10a:
   2654 
   2655   ! block
   2656 
   2657 	ld	[in3], out0               ! key 7531 first round next block
   2658 	mov 	in5, local1
   2659 	xor	global3, out5, in5        ! iv xor next block
   2660 
   2661 	ld	[in3+4], out1             ! key 8642
   2662 	add	global1, 512, global3     ! address sbox 3 since register used
   2663 	xor	global4, local1, out5     ! iv xor next block
   2664 
   2665 	ba	.ncbc.enc.next.block_2
   2666 	add	in1, 8, in1               ! output address
   2667 
   2668 .ncbc.enc.next.block_fp:
   2669 
   2670 
   2671 
   2672 ! fp_macro
   2673 ! in5 out5
   2674 
   2675 	! initially undo the rotate 3 left done after initial permutation
   2676 	! original left is received shifted 3 right and 29 left in local3/4
   2677 
   2678 	sll	out5, 29, local1
   2679 	or	local3, local4, in5
   2680 
   2681 	srl	out5, 3, out5
   2682 	sethi	%hi(0x55555555), local2
   2683 
   2684 	or	out5, local1, out5
   2685 	or	local2, %lo(0x55555555), local2
   2686 
   2687 	srl	out5, 1, local3
   2688 	sethi	%hi(0x00ff00ff), local1
   2689 	xor	local3, in5, local3
   2690 	or	local1, %lo(0x00ff00ff), local1
   2691 	and	local3, local2, local3
   2692 	sethi	%hi(0x33333333), local4
   2693 	sll	local3, 1, local2
   2694 
   2695 	xor	in5, local3, in5
   2696 
   2697 	srl	in5, 8, local3
   2698 	xor	out5, local2, out5
   2699 	xor	local3, out5, local3
   2700 	or	local4, %lo(0x33333333), local4
   2701 	and	local3, local1, local3
   2702 	sethi	%hi(0x0000ffff), local1
   2703 	sll	local3, 8, local2
   2704 
   2705 	xor	out5, local3, out5
   2706 
   2707 	srl	out5, 2, local3
   2708 	xor	in5, local2, in5
   2709 	xor	local3, in5, local3
   2710 	or	local1, %lo(0x0000ffff), local1
   2711 	and	local3, local4, local3
   2712 	sethi	%hi(0x0f0f0f0f), local4
   2713 	sll	local3, 2, local2
   2714 
   2715 
   2716 	xor	in5, local3, in5
   2717 
   2718 
   2719 	srl	in5, 16, local3
   2720 	xor	out5, local2, out5
   2721 	xor	local3, out5, local3
   2722 	or	local4, %lo(0x0f0f0f0f), local4
   2723 	and	local3, local1, local3
   2724 	sll	local3, 16, local2
   2725 
   2726 	xor	out5, local3, local1
   2727 
   2728 	srl	local1, 4, local3
   2729 	xor	in5, local2, in5
   2730 	xor	local3, in5, local3
   2731 	and	local3, local4, local3
   2732 	sll	local3, 4, local2
   2733 
   2734 	xor	in5, local3, in5
   2735 
   2736 	! optional store:
   2737 
   2738 
   2739 
   2740 	xor	local1, local2, out5
   2741 
   2742 
   2743 
   2744 
   2745 
   2746 
   2747 
   2748 ! store_little_endian
   2749 ! in1 in5 out5 local3 .SLE1
   2750 
   2751 	! rightmost in register to first in memory
   2752 
   2753 .SLE1:
   2754 	and	in5, 255, local3
   2755 	stub	local3, [in1+0]
   2756 
   2757 	srl	in5, 8, local3
   2758 	and	local3, 255, local3
   2759 	stub	local3, [in1+1]
   2760 
   2761 	srl	in5, 16, local3
   2762 	and	local3, 255, local3
   2763 	stub	local3, [in1+2]
   2764 
   2765 	srl	in5, 24, local3
   2766 	stub	local3, [in1+3]
   2767 
   2768 
   2769 	and	out5, 255, local3
   2770 	stub	local3, [in1+0+4]
   2771 
   2772 	srl	out5, 8, local3
   2773 	and	local3, 255, local3
   2774 	stub	local3, [in1+1+4]
   2775 
   2776 	srl	out5, 16, local3
   2777 	and	local3, 255, local3
   2778 	stub	local3, [in1+2+4]
   2779 
   2780 	srl	out5, 24, local3
   2781 	stub	local3, [in1+3+4]
   2782 
   2783 .SLE1a:
   2784 
   2785   ! block
   2786 
   2787 	addcc   in2, -8, in2              ! bytes missing when next block done
   2788 
   2789 	bpos	.ncbc.enc.next.block
   2790 	add	in1, 8, in1
   2791 
   2792 .ncbc.enc.seven.or.less:
   2793 
   2794 	cmp	in2, -8
   2795 
   2796 	ble	.ncbc.enc.finish
   2797 	nop
   2798 
   2799 	add	in2, 8, local1            ! bytes to load
   2800 
   2801 	! addr, length, dest left, dest right, temp, local3, label, ret label
   2802 
   2803 
   2804 ! load_n_bytes
   2805 ! in0 local1 local2 local3 .LNB1 .ncbc.enc.next.block_1 .LNB1 .ncbc.enc.next.block_1
   2806 
   2807 .LNB1.0:	call	.+8
   2808 	sll	local1, 2, local3
   2809 
   2810 	add	%o7,.LNB1.jmp.table-.LNB1.0,local2
   2811 
   2812 	add	local2, local3, local2
   2813 	mov	0, out4
   2814 
   2815 	ld	[local2], local2
   2816 
   2817 	jmp	%o7+local2
   2818 	mov	0, global4
   2819 
   2820 .LNB1.7:
   2821 	ldub	[in0+6], local2
   2822 	sll	local2, 16, local2
   2823 	or	global4, local2, global4
   2824 .LNB1.6:
   2825 	ldub	[in0+5], local2
   2826 	sll	local2, 8, local2
   2827 	or	global4, local2, global4
   2828 .LNB1.5:
   2829 	ldub	[in0+4], local2
   2830 	or	global4, local2, global4
   2831 .LNB1.4:
   2832 	ldub	[in0+3], local2
   2833 	sll	local2, 24, local2
   2834 	or	out4, local2, out4
   2835 .LNB1.3:
   2836 	ldub	[in0+2], local2
   2837 	sll	local2, 16, local2
   2838 	or	out4, local2, out4
   2839 .LNB1.2:
   2840 	ldub	[in0+1], local2
   2841 	sll	local2, 8, local2
   2842 	or	out4, local2, out4
   2843 .LNB1.1:
   2844 	ldub	[in0+0], local2
   2845 	ba	.ncbc.enc.next.block_1
   2846 	or	out4, local2, out4
   2847 
   2848 	.align 4
   2849 
   2850 .LNB1.jmp.table:
   2851 	.word	0
   2852 	.word	.LNB1.1-.LNB1.0
   2853 	.word	.LNB1.2-.LNB1.0
   2854 	.word	.LNB1.3-.LNB1.0
   2855 	.word	.LNB1.4-.LNB1.0
   2856 	.word	.LNB1.5-.LNB1.0
   2857 	.word	.LNB1.6-.LNB1.0
   2858 	.word	.LNB1.7-.LNB1.0
   2859 
   2860 
   2861 	! Loads 1 to 7 bytes little endian to global4, out4
   2862 
   2863 
   2864 .ncbc.enc.finish:
   2865 
   2866 	LDPTR	 [%sp+BIAS+ARG0+4*ARGSZ] , local4
   2867 
   2868 
   2869 ! store_little_endian
   2870 ! local4 in5 out5 local5 .SLE2
   2871 
   2872 	! rightmost in register to first in memory
   2873 
   2874 .SLE2:
   2875 	and	in5, 255, local5
   2876 	stub	local5, [local4+0]
   2877 
   2878 	srl	in5, 8, local5
   2879 	and	local5, 255, local5
   2880 	stub	local5, [local4+1]
   2881 
   2882 	srl	in5, 16, local5
   2883 	and	local5, 255, local5
   2884 	stub	local5, [local4+2]
   2885 
   2886 	srl	in5, 24, local5
   2887 	stub	local5, [local4+3]
   2888 
   2889 
   2890 	and	out5, 255, local5
   2891 	stub	local5, [local4+0+4]
   2892 
   2893 	srl	out5, 8, local5
   2894 	and	local5, 255, local5
   2895 	stub	local5, [local4+1+4]
   2896 
   2897 	srl	out5, 16, local5
   2898 	and	local5, 255, local5
   2899 	stub	local5, [local4+2+4]
   2900 
   2901 	srl	out5, 24, local5
   2902 	stub	local5, [local4+3+4]
   2903 
   2904 .SLE2a:
   2905 
   2906   ! ivec
   2907 
   2908 	ret
   2909 	restore
   2910 
   2911 
   2912 .ncbc.dec:
   2913 
   2914 	STPTR	in0,  [%sp+BIAS+ARG0+0*ARGSZ]
   2915 	cmp	in2, 0                    ! length
   2916 	add	in3, 120, in3
   2917 
   2918 	LDPTR	 [%sp+BIAS+ARG0+4*ARGSZ] , local7              ! ivec
   2919 	ble	.ncbc.dec.finish
   2920 	mov	in3, in4                  ! schedule
   2921 
   2922 	STPTR	in1,  [%sp+BIAS+ARG0+1*ARGSZ]
   2923 	mov	in0, local5               ! input
   2924 
   2925 
   2926 
   2927 ! load_little_endian
   2928 ! local7 in0 in1 local3 .LLE3
   2929 
   2930 	! first in memory to rightmost in register
   2931 
   2932 .LLE3:
   2933 	ldub	[local7+3], in0
   2934 
   2935 	ldub	[local7+2], local3
   2936 	sll	in0, 8, in0
   2937 	or	in0, local3, in0
   2938 
   2939 	ldub	[local7+1], local3
   2940 	sll	in0, 8, in0
   2941 	or	in0, local3, in0
   2942 
   2943 	ldub	[local7+0], local3
   2944 	sll	in0, 8, in0
   2945 	or	in0, local3, in0
   2946 
   2947 
   2948 	ldub	[local7+3+4], in1
   2949 
   2950 	ldub	[local7+2+4], local3
   2951 	sll	in1, 8, in1
   2952 	or	in1, local3, in1
   2953 
   2954 	ldub	[local7+1+4], local3
   2955 	sll	in1, 8, in1
   2956 	or	in1, local3, in1
   2957 
   2958 	ldub	[local7+0+4], local3
   2959 	sll	in1, 8, in1
   2960 	or	in1, local3, in1
   2961 .LLE3a:
   2962 
   2963    ! ivec
   2964 
   2965 .ncbc.dec.next.block:
   2966 
   2967 
   2968 
   2969 ! load_little_endian
   2970 ! local5 in5 out5 local3 .LLE4
   2971 
   2972 	! first in memory to rightmost in register
   2973 
   2974 .LLE4:
   2975 	ldub	[local5+3], in5
   2976 
   2977 	ldub	[local5+2], local3
   2978 	sll	in5, 8, in5
   2979 	or	in5, local3, in5
   2980 
   2981 	ldub	[local5+1], local3
   2982 	sll	in5, 8, in5
   2983 	or	in5, local3, in5
   2984 
   2985 	ldub	[local5+0], local3
   2986 	sll	in5, 8, in5
   2987 	or	in5, local3, in5
   2988 
   2989 
   2990 	ldub	[local5+3+4], out5
   2991 
   2992 	ldub	[local5+2+4], local3
   2993 	sll	out5, 8, out5
   2994 	or	out5, local3, out5
   2995 
   2996 	ldub	[local5+1+4], local3
   2997 	sll	out5, 8, out5
   2998 	or	out5, local3, out5
   2999 
   3000 	ldub	[local5+0+4], local3
   3001 	sll	out5, 8, out5
   3002 	or	out5, local3, out5
   3003 .LLE4a:
   3004 
   3005   ! block
   3006 
   3007 	! parameter 6  1/2 for include encryption/decryption
   3008 	! parameter 7  1 for mov in1 to in3
   3009 	! parameter 8  1 for mov in3 to in4
   3010 
   3011 
   3012 
   3013 ! ip_macro
   3014 ! in5 out5 in5 out5 in4 2 0 1
   3015 
   3016 	ld	[out2+256], local1
   3017 	srl	out5, 4, local4
   3018 
   3019 	xor	local4, in5, local4
   3020 	nop
   3021 
   3022 	ld	[out2+260], local2
   3023 	and	local4, local1, local4
   3024 	mov in3, in4
   3025 
   3026 
   3027 	ld	[out2+280], out4          ! loop counter
   3028 	sll	local4, 4, local1
   3029 	xor	in5, local4, in5
   3030 
   3031 	ld	[out2+264], local3
   3032 	srl	in5, 16, local4
   3033 	xor	out5, local1, out5
   3034 
   3035 
   3036 	xor	local4, out5, local4
   3037 	nop	!sethi	%hi(DES_SPtrans), global1 ! sbox addr
   3038 
   3039 
   3040 	and	local4, local2, local4
   3041 	nop	!or	global1, %lo(DES_SPtrans), global1   ! sbox addr
   3042 
   3043 	sll	local4, 16, local1
   3044 	xor	out5, local4, out5
   3045 
   3046 	srl	out5, 2, local4
   3047 	xor	in5, local1, in5
   3048 
   3049 	sethi	%hi(16711680), local5
   3050 	xor	local4, in5, local4
   3051 
   3052 	and	local4, local3, local4
   3053 	or	local5, 255, local5
   3054 
   3055 	sll	local4, 2, local2
   3056 	xor	in5, local4, in5
   3057 
   3058 	srl	in5, 8, local4
   3059 	xor	out5, local2, out5
   3060 
   3061 	xor	local4, out5, local4
   3062 	add	global1, 768, global4
   3063 
   3064 	and	local4, local5, local4
   3065 	add	global1, 1024, global5
   3066 
   3067 	ld	[out2+272], local7
   3068 	sll	local4, 8, local1
   3069 	xor	out5, local4, out5
   3070 
   3071 	srl	out5, 1, local4
   3072 	xor	in5, local1, in5
   3073 
   3074 	ld	[in4], out0                ! key 7531
   3075 	xor	local4, in5, local4
   3076 	add	global1, 256, global2
   3077 
   3078 	ld	[in4+4], out1              ! key 8642
   3079 	and	local4, local7, local4
   3080 	add	global1, 512, global3
   3081 
   3082 	sll	local4, 1, local1
   3083 	xor	in5, local4, in5
   3084 
   3085 	sll	in5, 3, local3
   3086 	xor	out5, local1, out5
   3087 
   3088 	sll	out5, 3, local2
   3089 	add	global1, 1280, local6     ! address sbox 8
   3090 
   3091 	srl	in5, 29, local4
   3092 	add	global1, 1792, out3       ! address sbox 8
   3093 
   3094 	srl	out5, 29, local1
   3095 	or	local4, local3, in5
   3096 
   3097 	or	local2, local1, out5
   3098 
   3099 
   3100 
   3101 
   3102 
   3103 		ld	[out2+284], local5     ! 0x0000FC00 used in the rounds
   3104 		or	local2, local1, out5
   3105 		xor	in5, out0, local1
   3106 
   3107 		call .des_dec.1
   3108 		and	local1, 252, local1
   3109 
   3110 
   3111  ! include decryption  ks in4
   3112 
   3113 
   3114 
   3115 ! fp_macro
   3116 ! out5 in5 0 1
   3117 
   3118 	! initially undo the rotate 3 left done after initial permutation
   3119 	! original left is received shifted 3 right and 29 left in local3/4
   3120 
   3121 	sll	in5, 29, local1
   3122 	or	local3, local4, out5
   3123 
   3124 	srl	in5, 3, in5
   3125 	sethi	%hi(0x55555555), local2
   3126 
   3127 	or	in5, local1, in5
   3128 	or	local2, %lo(0x55555555), local2
   3129 
   3130 	srl	in5, 1, local3
   3131 	sethi	%hi(0x00ff00ff), local1
   3132 	xor	local3, out5, local3
   3133 	or	local1, %lo(0x00ff00ff), local1
   3134 	and	local3, local2, local3
   3135 	sethi	%hi(0x33333333), local4
   3136 	sll	local3, 1, local2
   3137 
   3138 	xor	out5, local3, out5
   3139 
   3140 	srl	out5, 8, local3
   3141 	xor	in5, local2, in5
   3142 	xor	local3, in5, local3
   3143 	or	local4, %lo(0x33333333), local4
   3144 	and	local3, local1, local3
   3145 	sethi	%hi(0x0000ffff), local1
   3146 	sll	local3, 8, local2
   3147 
   3148 	xor	in5, local3, in5
   3149 
   3150 	srl	in5, 2, local3
   3151 	xor	out5, local2, out5
   3152 	xor	local3, out5, local3
   3153 	or	local1, %lo(0x0000ffff), local1
   3154 	and	local3, local4, local3
   3155 	sethi	%hi(0x0f0f0f0f), local4
   3156 	sll	local3, 2, local2
   3157 
   3158 	LDPTR  [%sp+BIAS+ARG0+0*ARGSZ] , local5
   3159 	xor	out5, local3, out5
   3160 
   3161 	LDPTR  [%sp+BIAS+ARG0+1*ARGSZ] , local7
   3162 	srl	out5, 16, local3
   3163 	xor	in5, local2, in5
   3164 	xor	local3, in5, local3
   3165 	or	local4, %lo(0x0f0f0f0f), local4
   3166 	and	local3, local1, local3
   3167 	sll	local3, 16, local2
   3168 
   3169 	xor	in5, local3, local1
   3170 
   3171 	srl	local1, 4, local3
   3172 	xor	out5, local2, out5
   3173 	xor	local3, out5, local3
   3174 	and	local3, local4, local3
   3175 	sll	local3, 4, local2
   3176 
   3177 	xor	out5, local3, out5
   3178 
   3179 	! optional store:
   3180 
   3181 
   3182 
   3183 	xor	local1, local2, in5
   3184 
   3185 
   3186 
   3187  ! 1 for input and output address to local5/7
   3188 
   3189 	! in2 is bytes left to be stored
   3190 	! in2 is compared to 8 in the rounds
   3191 
   3192 	xor	out5, in0, out4           ! iv xor
   3193 	bl	.ncbc.dec.seven.or.less
   3194 	xor	in5, in1, global4         ! iv xor
   3195 
   3196 	! Load ivec next block now, since input and output address might be the same.
   3197 
   3198 
   3199 
   3200 ! load_little_endian_inc
   3201 ! local5 in0 in1 local3 .LLE5
   3202 
   3203 	! first in memory to rightmost in register
   3204 
   3205 .LLE5:
   3206 	ldub	[local5+3], in0
   3207 
   3208 	ldub	[local5+2], local3
   3209 	sll	in0, 8, in0
   3210 	or	in0, local3, in0
   3211 
   3212 	ldub	[local5+1], local3
   3213 	sll	in0, 8, in0
   3214 	or	in0, local3, in0
   3215 
   3216 	ldub	[local5+0], local3
   3217 	sll	in0, 8, in0
   3218 	or	in0, local3, in0
   3219 
   3220 	ldub	[local5+3+4], in1
   3221 	add	local5, 8, local5
   3222 
   3223 	ldub	[local5+2+4-8], local3
   3224 	sll	in1, 8, in1
   3225 	or	in1, local3, in1
   3226 
   3227 	ldub	[local5+1+4-8], local3
   3228 	sll	in1, 8, in1
   3229 	or	in1, local3, in1
   3230 
   3231 	ldub	[local5+0+4-8], local3
   3232 	sll	in1, 8, in1
   3233 	or	in1, local3, in1
   3234 .LLE5a:
   3235 
   3236   ! iv
   3237 
   3238 
   3239 
   3240 ! store_little_endian
   3241 ! local7 out4 global4 local3 .SLE3
   3242 
   3243 	! rightmost in register to first in memory
   3244 
   3245 .SLE3:
   3246 	and	out4, 255, local3
   3247 	stub	local3, [local7+0]
   3248 
   3249 	srl	out4, 8, local3
   3250 	and	local3, 255, local3
   3251 	stub	local3, [local7+1]
   3252 
   3253 	srl	out4, 16, local3
   3254 	and	local3, 255, local3
   3255 	stub	local3, [local7+2]
   3256 
   3257 	srl	out4, 24, local3
   3258 	stub	local3, [local7+3]
   3259 
   3260 
   3261 	and	global4, 255, local3
   3262 	stub	local3, [local7+0+4]
   3263 
   3264 	srl	global4, 8, local3
   3265 	and	local3, 255, local3
   3266 	stub	local3, [local7+1+4]
   3267 
   3268 	srl	global4, 16, local3
   3269 	and	local3, 255, local3
   3270 	stub	local3, [local7+2+4]
   3271 
   3272 	srl	global4, 24, local3
   3273 	stub	local3, [local7+3+4]
   3274 
   3275 .SLE3a:
   3276 
   3277 
   3278 
   3279 	STPTR	local5,  [%sp+BIAS+ARG0+0*ARGSZ]
   3280 	add	local7, 8, local7
   3281 	addcc   in2, -8, in2
   3282 
   3283 	bg	.ncbc.dec.next.block
   3284 	STPTR	local7,  [%sp+BIAS+ARG0+1*ARGSZ]
   3285 
   3286 
   3287 .ncbc.dec.store.iv:
   3288 
   3289 	LDPTR	 [%sp+BIAS+ARG0+4*ARGSZ] , local4              ! ivec
   3290 
   3291 
   3292 ! store_little_endian
   3293 ! local4 in0 in1 local5 .SLE4
   3294 
   3295 	! rightmost in register to first in memory
   3296 
   3297 .SLE4:
   3298 	and	in0, 255, local5
   3299 	stub	local5, [local4+0]
   3300 
   3301 	srl	in0, 8, local5
   3302 	and	local5, 255, local5
   3303 	stub	local5, [local4+1]
   3304 
   3305 	srl	in0, 16, local5
   3306 	and	local5, 255, local5
   3307 	stub	local5, [local4+2]
   3308 
   3309 	srl	in0, 24, local5
   3310 	stub	local5, [local4+3]
   3311 
   3312 
   3313 	and	in1, 255, local5
   3314 	stub	local5, [local4+0+4]
   3315 
   3316 	srl	in1, 8, local5
   3317 	and	local5, 255, local5
   3318 	stub	local5, [local4+1+4]
   3319 
   3320 	srl	in1, 16, local5
   3321 	and	local5, 255, local5
   3322 	stub	local5, [local4+2+4]
   3323 
   3324 	srl	in1, 24, local5
   3325 	stub	local5, [local4+3+4]
   3326 
   3327 .SLE4a:
   3328 
   3329 
   3330 
   3331 .ncbc.dec.finish:
   3332 
   3333 	ret
   3334 	restore
   3335 
   3336 .ncbc.dec.seven.or.less:
   3337 
   3338 
   3339 
   3340 ! load_little_endian_inc
   3341 ! local5 in0 in1 local3 .LLE13
   3342 
   3343 	! first in memory to rightmost in register
   3344 
   3345 .LLE13:
   3346 	ldub	[local5+3], in0
   3347 
   3348 	ldub	[local5+2], local3
   3349 	sll	in0, 8, in0
   3350 	or	in0, local3, in0
   3351 
   3352 	ldub	[local5+1], local3
   3353 	sll	in0, 8, in0
   3354 	or	in0, local3, in0
   3355 
   3356 	ldub	[local5+0], local3
   3357 	sll	in0, 8, in0
   3358 	or	in0, local3, in0
   3359 
   3360 	ldub	[local5+3+4], in1
   3361 	add	local5, 8, local5
   3362 
   3363 	ldub	[local5+2+4-8], local3
   3364 	sll	in1, 8, in1
   3365 	or	in1, local3, in1
   3366 
   3367 	ldub	[local5+1+4-8], local3
   3368 	sll	in1, 8, in1
   3369 	or	in1, local3, in1
   3370 
   3371 	ldub	[local5+0+4-8], local3
   3372 	sll	in1, 8, in1
   3373 	or	in1, local3, in1
   3374 .LLE13a:
   3375 
   3376      ! ivec
   3377 
   3378 
   3379 
   3380 ! store_n_bytes
   3381 ! local7 in2 local3 local4 .SNB1 .ncbc.dec.store.iv .SNB1 .ncbc.dec.store.iv
   3382 
   3383 .SNB1.0:	call	.+8
   3384 	sll	in2, 2, local4
   3385 
   3386 	add	%o7,.SNB1.jmp.table-.SNB1.0,local3
   3387 
   3388 	add	local3, local4, local3
   3389 
   3390 	ld	[local3], local3
   3391 
   3392 	jmp	%o7+local3
   3393 	nop
   3394 
   3395 .SNB1.7:
   3396 	srl	global4, 16, local3
   3397 	and	local3, 0xff, local3
   3398 	stub	local3, [local7+6]
   3399 .SNB1.6:
   3400 	srl	global4, 8, local3
   3401 	and	local3, 0xff, local3
   3402 	stub	local3, [local7+5]
   3403 .SNB1.5:
   3404 	and	global4, 0xff, local3
   3405 	stub	local3, [local7+4]
   3406 .SNB1.4:
   3407 	srl	out4, 24, local3
   3408 	stub	local3, [local7+3]
   3409 .SNB1.3:
   3410 	srl	out4, 16, local3
   3411 	and	local3, 0xff, local3
   3412 	stub	local3, [local7+2]
   3413 .SNB1.2:
   3414 	srl	out4, 8, local3
   3415 	and	local3, 0xff, local3
   3416 	stub	local3, [local7+1]
   3417 .SNB1.1:
   3418 	and	out4, 0xff, local3
   3419 
   3420 
   3421 	ba	.ncbc.dec.store.iv
   3422 	stub	local3, [local7]
   3423 
   3424 	.align 4
   3425 
   3426 .SNB1.jmp.table:
   3427 
   3428 	.word	0
   3429 	.word	.SNB1.1-.SNB1.0
   3430 	.word	.SNB1.2-.SNB1.0
   3431 	.word	.SNB1.3-.SNB1.0
   3432 	.word	.SNB1.4-.SNB1.0
   3433 	.word	.SNB1.5-.SNB1.0
   3434 	.word	.SNB1.6-.SNB1.0
   3435 	.word	.SNB1.7-.SNB1.0
   3436 
   3437 
   3438 
   3439 .DES_ncbc_encrypt.end:
   3440 	.size	 DES_ncbc_encrypt, .DES_ncbc_encrypt.end-DES_ncbc_encrypt
   3441 
   3442 
   3443 ! void DES_ede3_cbc_encrypt(input, output, length, ks1, ks2, ks3, ivec, enc)
   3444 ! **************************************************************************
   3445 
   3446 
   3447 	.align 32
   3448 	.global DES_ede3_cbc_encrypt
   3449 	.type	 DES_ede3_cbc_encrypt,#function
   3450 
   3451 DES_ede3_cbc_encrypt:
   3452 
   3453 	save	%sp, FRAME, %sp
   3454 
   3455 
   3456 
   3457 
   3458 
   3459 	sethi	%hi(_PIC_DES_SPtrans-1f),global1
   3460 	or	global1,%lo(_PIC_DES_SPtrans-1f),global1
   3461 1:	call	.+8
   3462 	add	%o7,global1,global1
   3463 	sub	global1,_PIC_DES_SPtrans-.des_and,out2
   3464 
   3465 	LDPTR	[%fp+BIAS+ARG0+7*ARGSZ], local3          ! enc
   3466 	LDPTR	[%fp+BIAS+ARG0+6*ARGSZ], local4          ! ivec
   3467 	cmp	local3, 0                 ! enc
   3468 
   3469 	be	.ede3.dec
   3470 	STPTR	in4,  [%sp+BIAS+ARG0+4*ARGSZ]
   3471 
   3472 	STPTR	in5,  [%sp+BIAS+ARG0+5*ARGSZ]
   3473 
   3474 
   3475 
   3476 ! load_little_endian
   3477 ! local4 in5 out5 local3 .LLE6
   3478 
   3479 	! first in memory to rightmost in register
   3480 
   3481 .LLE6:
   3482 	ldub	[local4+3], in5
   3483 
   3484 	ldub	[local4+2], local3
   3485 	sll	in5, 8, in5
   3486 	or	in5, local3, in5
   3487 
   3488 	ldub	[local4+1], local3
   3489 	sll	in5, 8, in5
   3490 	or	in5, local3, in5
   3491 
   3492 	ldub	[local4+0], local3
   3493 	sll	in5, 8, in5
   3494 	or	in5, local3, in5
   3495 
   3496 
   3497 	ldub	[local4+3+4], out5
   3498 
   3499 	ldub	[local4+2+4], local3
   3500 	sll	out5, 8, out5
   3501 	or	out5, local3, out5
   3502 
   3503 	ldub	[local4+1+4], local3
   3504 	sll	out5, 8, out5
   3505 	or	out5, local3, out5
   3506 
   3507 	ldub	[local4+0+4], local3
   3508 	sll	out5, 8, out5
   3509 	or	out5, local3, out5
   3510 .LLE6a:
   3511 
   3512   ! ivec
   3513 
   3514 	addcc	in2, -8, in2              ! bytes missing after next block
   3515 
   3516 	bl	.ede3.enc.seven.or.less
   3517 	STPTR	in3,  [%sp+BIAS+ARG0+3*ARGSZ]
   3518 
   3519 .ede3.enc.next.block:
   3520 
   3521 
   3522 
   3523 ! load_little_endian
   3524 ! in0 out4 global4 local3 .LLE7
   3525 
   3526 	! first in memory to rightmost in register
   3527 
   3528 .LLE7:
   3529 	ldub	[in0+3], out4
   3530 
   3531 	ldub	[in0+2], local3
   3532 	sll	out4, 8, out4
   3533 	or	out4, local3, out4
   3534 
   3535 	ldub	[in0+1], local3
   3536 	sll	out4, 8, out4
   3537 	or	out4, local3, out4
   3538 
   3539 	ldub	[in0+0], local3
   3540 	sll	out4, 8, out4
   3541 	or	out4, local3, out4
   3542 
   3543 
   3544 	ldub	[in0+3+4], global4
   3545 
   3546 	ldub	[in0+2+4], local3
   3547 	sll	global4, 8, global4
   3548 	or	global4, local3, global4
   3549 
   3550 	ldub	[in0+1+4], local3
   3551 	sll	global4, 8, global4
   3552 	or	global4, local3, global4
   3553 
   3554 	ldub	[in0+0+4], local3
   3555 	sll	global4, 8, global4
   3556 	or	global4, local3, global4
   3557 .LLE7a:
   3558 
   3559 
   3560 
   3561 .ede3.enc.next.block_1:
   3562 
   3563 	LDPTR	 [%sp+BIAS+ARG0+4*ARGSZ] , in4
   3564 	xor	in5, out4, in5            ! iv xor
   3565 	xor	out5, global4, out5       ! iv xor
   3566 
   3567 	LDPTR	 [%sp+BIAS+ARG0+3*ARGSZ] , in3
   3568 	add	in4, 120, in4             ! for decryption we use last subkey first
   3569 	nop
   3570 
   3571 
   3572 
   3573 ! ip_macro
   3574 ! in5 out5 out5 in5 in3
   3575 
   3576 	ld	[out2+256], local1
   3577 	srl	out5, 4, local4
   3578 
   3579 	xor	local4, in5, local4
   3580 	nop
   3581 
   3582 	ld	[out2+260], local2
   3583 	and	local4, local1, local4
   3584 
   3585 
   3586 
   3587 	ld	[out2+280], out4          ! loop counter
   3588 	sll	local4, 4, local1
   3589 	xor	in5, local4, in5
   3590 
   3591 	ld	[out2+264], local3
   3592 	srl	in5, 16, local4
   3593 	xor	out5, local1, out5
   3594 
   3595 
   3596 	xor	local4, out5, local4
   3597 	nop	!sethi	%hi(DES_SPtrans), global1 ! sbox addr
   3598 
   3599 
   3600 	and	local4, local2, local4
   3601 	nop	!or	global1, %lo(DES_SPtrans), global1   ! sbox addr
   3602 
   3603 	sll	local4, 16, local1
   3604 	xor	out5, local4, out5
   3605 
   3606 	srl	out5, 2, local4
   3607 	xor	in5, local1, in5
   3608 
   3609 	sethi	%hi(16711680), local5
   3610 	xor	local4, in5, local4
   3611 
   3612 	and	local4, local3, local4
   3613 	or	local5, 255, local5
   3614 
   3615 	sll	local4, 2, local2
   3616 	xor	in5, local4, in5
   3617 
   3618 	srl	in5, 8, local4
   3619 	xor	out5, local2, out5
   3620 
   3621 	xor	local4, out5, local4
   3622 	add	global1, 768, global4
   3623 
   3624 	and	local4, local5, local4
   3625 	add	global1, 1024, global5
   3626 
   3627 	ld	[out2+272], local7
   3628 	sll	local4, 8, local1
   3629 	xor	out5, local4, out5
   3630 
   3631 	srl	out5, 1, local4
   3632 	xor	in5, local1, in5
   3633 
   3634 	ld	[in3], out0                ! key 7531
   3635 	xor	local4, in5, local4
   3636 	add	global1, 256, global2
   3637 
   3638 	ld	[in3+4], out1              ! key 8642
   3639 	and	local4, local7, local4
   3640 	add	global1, 512, global3
   3641 
   3642 	sll	local4, 1, local1
   3643 	xor	in5, local4, in5
   3644 
   3645 	sll	in5, 3, local3
   3646 	xor	out5, local1, out5
   3647 
   3648 	sll	out5, 3, local2
   3649 	add	global1, 1280, local6     ! address sbox 8
   3650 
   3651 	srl	in5, 29, local4
   3652 	add	global1, 1792, out3       ! address sbox 8
   3653 
   3654 	srl	out5, 29, local1
   3655 	or	local4, local3, out5
   3656 
   3657 	or	local2, local1, in5
   3658 
   3659 
   3660 
   3661 
   3662 
   3663 
   3664 .ede3.enc.next.block_2:
   3665 
   3666 	call .des_enc                     ! ks1 in3
   3667 	nop
   3668 
   3669 	call .des_dec                     ! ks2 in4
   3670 	LDPTR	 [%sp+BIAS+ARG0+5*ARGSZ] , in3
   3671 
   3672 	call .des_enc                     ! ks3 in3  compares in2 to 8
   3673 	nop
   3674 
   3675 	bl	.ede3.enc.next.block_fp
   3676 	add	in0, 8, in0
   3677 
   3678 	! If 8 or more bytes are to be encrypted after this block,
   3679 	! we combine final permutation for this block with initial
   3680 	! permutation for next block. Load next block:
   3681 
   3682 
   3683 
   3684 ! load_little_endian
   3685 ! in0 global3 global4 local5 .LLE11
   3686 
   3687 	! first in memory to rightmost in register
   3688 
   3689 .LLE11:
   3690 	ldub	[in0+3], global3
   3691 
   3692 	ldub	[in0+2], local5
   3693 	sll	global3, 8, global3
   3694 	or	global3, local5, global3
   3695 
   3696 	ldub	[in0+1], local5
   3697 	sll	global3, 8, global3
   3698 	or	global3, local5, global3
   3699 
   3700 	ldub	[in0+0], local5
   3701 	sll	global3, 8, global3
   3702 	or	global3, local5, global3
   3703 
   3704 
   3705 	ldub	[in0+3+4], global4
   3706 
   3707 	ldub	[in0+2+4], local5
   3708 	sll	global4, 8, global4
   3709 	or	global4, local5, global4
   3710 
   3711 	ldub	[in0+1+4], local5
   3712 	sll	global4, 8, global4
   3713 	or	global4, local5, global4
   3714 
   3715 	ldub	[in0+0+4], local5
   3716 	sll	global4, 8, global4
   3717 	or	global4, local5, global4
   3718 .LLE11a:
   3719 
   3720 
   3721 
   3722 	!  parameter 1   original left
   3723 	!  parameter 2   original right
   3724 	!  parameter 3   left ip
   3725 	!  parameter 4   right ip
   3726 	!  parameter 5   1: load ks1/ks2 to in3/in4, add 120 to in4
   3727 	!                2: mov in4 to in3
   3728 	!
   3729 	! also adds -8 to length in2 and loads loop counter to out4
   3730 
   3731 
   3732 
   3733 ! fp_ip_macro
   3734 ! out0 out1 global3 global4 1
   3735 
   3736 
   3737 
   3738 
   3739 
   3740 
   3741 
   3742 
   3743 
   3744 	! out0 in local3, local4
   3745 
   3746 	ld	[out2+256], local1
   3747 	sll	out5, 29, out4
   3748 	or	local3, local4, out0
   3749 
   3750 	srl	out5, 3, out1
   3751 
   3752 
   3753 	ld	[out2+272], local5
   3754 	srl	global4, 4, local0
   3755 	or	out1, out4, out1
   3756 
   3757 	srl	out1, 1, out4
   3758 	xor	out4, out0, out4
   3759 
   3760 	and	out4, local5, out4
   3761 	xor	local0, global3, local0
   3762 
   3763 	sll	out4, 1, local3
   3764 	xor	out0, out4, out0
   3765 
   3766 	and	local0, local1, local0
   3767 	add	in2, -8, in2
   3768 
   3769 	sll	local0, 4, local7
   3770 	xor	global3, local0, global3
   3771 
   3772 	ld	[out2+268], local4
   3773 	srl	out0, 8, out4
   3774 	xor	out1, local3, out1
   3775 	ld	[out2+260], local2
   3776 	srl	global3, 16, local0
   3777 	xor	global4, local7, global4
   3778 	xor	out4, out1, out4
   3779 	xor	local0, global4, local0
   3780 	and	out4, local4, out4
   3781 	and	local0, local2, local0
   3782 	sll	out4, 8, local3
   3783 	xor	out1, out4, out1
   3784 	sll	local0, 16, local7
   3785 	xor	global4, local0, global4
   3786 
   3787 	srl	out1, 2, out4
   3788 	xor	out0, local3, out0
   3789 
   3790 	ld	[out2+264], local3         ! ip3
   3791 	srl	global4, 2, local0
   3792 	xor	global3, local7, global3
   3793 	xor	out4, out0, out4
   3794 	xor	local0, global3, local0
   3795 	and	out4, local3, out4
   3796 	and	local0, local3, local0
   3797 	sll	out4, 2, local3
   3798 	xor	out0, out4, out0
   3799 	sll	local0, 2, local7
   3800 	xor	global3, local0, global3
   3801 
   3802 	srl	out0, 16, out4
   3803 	xor	out1, local3, out1
   3804 	srl	global3, 8, local0
   3805 	xor	global4, local7, global4
   3806 	xor	out4, out1, out4
   3807 	xor	local0, global4, local0
   3808 	and	out4, local2, out4
   3809 	and	local0, local4, local0
   3810 	sll	out4, 16, local3
   3811 	xor	out1, out4, local4
   3812 	sll	local0, 8, local7
   3813 	xor	global4, local0, global4
   3814 
   3815 	srl	global4, 1, local0
   3816 	xor	global3, local7, global3
   3817 
   3818 	srl	local4, 4, out4
   3819 	xor	local0, global3, local0
   3820 
   3821 	xor	out0, local3, out0
   3822 	and	local0, local5, local0
   3823 
   3824 	sll	local0, 1, local7
   3825 	xor	out4, out0, out4
   3826 
   3827 	xor	global3, local0, global3
   3828 	xor	global4, local7, global4
   3829 
   3830 	sll	global3, 3, local5
   3831 	and	out4, local1, out4
   3832 
   3833 	sll	out4, 4, local3
   3834 	xor	out0, out4, out0
   3835 
   3836 	LDPTR	 [%sp+BIAS+ARG0+4*ARGSZ] , in4
   3837 	sll	global4, 3, local2
   3838 	xor	local4, local3, out1
   3839 
   3840 	! reload since used as temporary:
   3841 
   3842 	ld	[out2+280], out4          ! loop counter
   3843 
   3844 	srl	global3, 29, local0
   3845 	add in4, 120, in4
   3846 
   3847 	LDPTR	 [%sp+BIAS+ARG0+3*ARGSZ] , in3
   3848 	srl	global4, 29, local7
   3849 
   3850 	or	local0, local5, global4
   3851 	or	local2, local7, global3
   3852 
   3853 
   3854 
   3855 
   3856 
   3857 ! store_little_endian
   3858 ! in1 out0 out1 local3 .SLE9
   3859 
   3860 	! rightmost in register to first in memory
   3861 
   3862 .SLE9:
   3863 	and	out0, 255, local3
   3864 	stub	local3, [in1+0]
   3865 
   3866 	srl	out0, 8, local3
   3867 	and	local3, 255, local3
   3868 	stub	local3, [in1+1]
   3869 
   3870 	srl	out0, 16, local3
   3871 	and	local3, 255, local3
   3872 	stub	local3, [in1+2]
   3873 
   3874 	srl	out0, 24, local3
   3875 	stub	local3, [in1+3]
   3876 
   3877 
   3878 	and	out1, 255, local3
   3879 	stub	local3, [in1+0+4]
   3880 
   3881 	srl	out1, 8, local3
   3882 	and	local3, 255, local3
   3883 	stub	local3, [in1+1+4]
   3884 
   3885 	srl	out1, 16, local3
   3886 	and	local3, 255, local3
   3887 	stub	local3, [in1+2+4]
   3888 
   3889 	srl	out1, 24, local3
   3890 	stub	local3, [in1+3+4]
   3891 
   3892 .SLE9a:
   3893 
   3894   ! block
   3895 
   3896 	mov 	in5, local1
   3897 	xor	global3, out5, in5        ! iv xor next block
   3898 
   3899 	ld	[in3], out0               ! key 7531
   3900 	add	global1, 512, global3     ! address sbox 3
   3901 	xor	global4, local1, out5     ! iv xor next block
   3902 
   3903 	ld	[in3+4], out1             ! key 8642
   3904 	add	global1, 768, global4     ! address sbox 4
   3905 	ba	.ede3.enc.next.block_2
   3906 	add	in1, 8, in1
   3907 
   3908 .ede3.enc.next.block_fp:
   3909 
   3910 
   3911 
   3912 ! fp_macro
   3913 ! in5 out5
   3914 
   3915 	! initially undo the rotate 3 left done after initial permutation
   3916 	! original left is received shifted 3 right and 29 left in local3/4
   3917 
   3918 	sll	out5, 29, local1
   3919 	or	local3, local4, in5
   3920 
   3921 	srl	out5, 3, out5
   3922 	sethi	%hi(0x55555555), local2
   3923 
   3924 	or	out5, local1, out5
   3925 	or	local2, %lo(0x55555555), local2
   3926 
   3927 	srl	out5, 1, local3
   3928 	sethi	%hi(0x00ff00ff), local1
   3929 	xor	local3, in5, local3
   3930 	or	local1, %lo(0x00ff00ff), local1
   3931 	and	local3, local2, local3
   3932 	sethi	%hi(0x33333333), local4
   3933 	sll	local3, 1, local2
   3934 
   3935 	xor	in5, local3, in5
   3936 
   3937 	srl	in5, 8, local3
   3938 	xor	out5, local2, out5
   3939 	xor	local3, out5, local3
   3940 	or	local4, %lo(0x33333333), local4
   3941 	and	local3, local1, local3
   3942 	sethi	%hi(0x0000ffff), local1
   3943 	sll	local3, 8, local2
   3944 
   3945 	xor	out5, local3, out5
   3946 
   3947 	srl	out5, 2, local3
   3948 	xor	in5, local2, in5
   3949 	xor	local3, in5, local3
   3950 	or	local1, %lo(0x0000ffff), local1
   3951 	and	local3, local4, local3
   3952 	sethi	%hi(0x0f0f0f0f), local4
   3953 	sll	local3, 2, local2
   3954 
   3955 
   3956 	xor	in5, local3, in5
   3957 
   3958 
   3959 	srl	in5, 16, local3
   3960 	xor	out5, local2, out5
   3961 	xor	local3, out5, local3
   3962 	or	local4, %lo(0x0f0f0f0f), local4
   3963 	and	local3, local1, local3
   3964 	sll	local3, 16, local2
   3965 
   3966 	xor	out5, local3, local1
   3967 
   3968 	srl	local1, 4, local3
   3969 	xor	in5, local2, in5
   3970 	xor	local3, in5, local3
   3971 	and	local3, local4, local3
   3972 	sll	local3, 4, local2
   3973 
   3974 	xor	in5, local3, in5
   3975 
   3976 	! optional store:
   3977 
   3978 
   3979 
   3980 	xor	local1, local2, out5
   3981 
   3982 
   3983 
   3984 
   3985 
   3986 
   3987 
   3988 ! store_little_endian
   3989 ! in1 in5 out5 local3 .SLE5
   3990 
   3991 	! rightmost in register to first in memory
   3992 
   3993 .SLE5:
   3994 	and	in5, 255, local3
   3995 	stub	local3, [in1+0]
   3996 
   3997 	srl	in5, 8, local3
   3998 	and	local3, 255, local3
   3999 	stub	local3, [in1+1]
   4000 
   4001 	srl	in5, 16, local3
   4002 	and	local3, 255, local3
   4003 	stub	local3, [in1+2]
   4004 
   4005 	srl	in5, 24, local3
   4006 	stub	local3, [in1+3]
   4007 
   4008 
   4009 	and	out5, 255, local3
   4010 	stub	local3, [in1+0+4]
   4011 
   4012 	srl	out5, 8, local3
   4013 	and	local3, 255, local3
   4014 	stub	local3, [in1+1+4]
   4015 
   4016 	srl	out5, 16, local3
   4017 	and	local3, 255, local3
   4018 	stub	local3, [in1+2+4]
   4019 
   4020 	srl	out5, 24, local3
   4021 	stub	local3, [in1+3+4]
   4022 
   4023 .SLE5a:
   4024 
   4025   ! block
   4026 
   4027 	addcc   in2, -8, in2              ! bytes missing when next block done
   4028 
   4029 	bpos	.ede3.enc.next.block
   4030 	add	in1, 8, in1
   4031 
   4032 .ede3.enc.seven.or.less:
   4033 
   4034 	cmp	in2, -8
   4035 
   4036 	ble	.ede3.enc.finish
   4037 	nop
   4038 
   4039 	add	in2, 8, local1            ! bytes to load
   4040 
   4041 	! addr, length, dest left, dest right, temp, local3, label, ret label
   4042 
   4043 
   4044 ! load_n_bytes
   4045 ! in0 local1 local2 local3 .LNB2 .ede3.enc.next.block_1 .LNB2 .ede3.enc.next.block_1
   4046 
   4047 .LNB2.0:	call	.+8
   4048 	sll	local1, 2, local3
   4049 
   4050 	add	%o7,.LNB2.jmp.table-.LNB2.0,local2
   4051 
   4052 	add	local2, local3, local2
   4053 	mov	0, out4
   4054 
   4055 	ld	[local2], local2
   4056 
   4057 	jmp	%o7+local2
   4058 	mov	0, global4
   4059 
   4060 .LNB2.7:
   4061 	ldub	[in0+6], local2
   4062 	sll	local2, 16, local2
   4063 	or	global4, local2, global4
   4064 .LNB2.6:
   4065 	ldub	[in0+5], local2
   4066 	sll	local2, 8, local2
   4067 	or	global4, local2, global4
   4068 .LNB2.5:
   4069 	ldub	[in0+4], local2
   4070 	or	global4, local2, global4
   4071 .LNB2.4:
   4072 	ldub	[in0+3], local2
   4073 	sll	local2, 24, local2
   4074 	or	out4, local2, out4
   4075 .LNB2.3:
   4076 	ldub	[in0+2], local2
   4077 	sll	local2, 16, local2
   4078 	or	out4, local2, out4
   4079 .LNB2.2:
   4080 	ldub	[in0+1], local2
   4081 	sll	local2, 8, local2
   4082 	or	out4, local2, out4
   4083 .LNB2.1:
   4084 	ldub	[in0+0], local2
   4085 	ba	.ede3.enc.next.block_1
   4086 	or	out4, local2, out4
   4087 
   4088 	.align 4
   4089 
   4090 .LNB2.jmp.table:
   4091 	.word	0
   4092 	.word	.LNB2.1-.LNB2.0
   4093 	.word	.LNB2.2-.LNB2.0
   4094 	.word	.LNB2.3-.LNB2.0
   4095 	.word	.LNB2.4-.LNB2.0
   4096 	.word	.LNB2.5-.LNB2.0
   4097 	.word	.LNB2.6-.LNB2.0
   4098 	.word	.LNB2.7-.LNB2.0
   4099 
   4100 
   4101 .ede3.enc.finish:
   4102 
   4103 	LDPTR	[%fp+BIAS+ARG0+6*ARGSZ], local4          ! ivec
   4104 
   4105 
   4106 ! store_little_endian
   4107 ! local4 in5 out5 local5 .SLE6
   4108 
   4109 	! rightmost in register to first in memory
   4110 
   4111 .SLE6:
   4112 	and	in5, 255, local5
   4113 	stub	local5, [local4+0]
   4114 
   4115 	srl	in5, 8, local5
   4116 	and	local5, 255, local5
   4117 	stub	local5, [local4+1]
   4118 
   4119 	srl	in5, 16, local5
   4120 	and	local5, 255, local5
   4121 	stub	local5, [local4+2]
   4122 
   4123 	srl	in5, 24, local5
   4124 	stub	local5, [local4+3]
   4125 
   4126 
   4127 	and	out5, 255, local5
   4128 	stub	local5, [local4+0+4]
   4129 
   4130 	srl	out5, 8, local5
   4131 	and	local5, 255, local5
   4132 	stub	local5, [local4+1+4]
   4133 
   4134 	srl	out5, 16, local5
   4135 	and	local5, 255, local5
   4136 	stub	local5, [local4+2+4]
   4137 
   4138 	srl	out5, 24, local5
   4139 	stub	local5, [local4+3+4]
   4140 
   4141 .SLE6a:
   4142 
   4143   ! ivec
   4144 
   4145 	ret
   4146 	restore
   4147 
   4148 .ede3.dec:
   4149 
   4150 	STPTR	in0,  [%sp+BIAS+ARG0+0*ARGSZ]
   4151 	add	in5, 120, in5
   4152 
   4153 	STPTR	in1,  [%sp+BIAS+ARG0+1*ARGSZ]
   4154 	mov	in0, local5
   4155 	add	in3, 120, in3
   4156 
   4157 	STPTR	in3,  [%sp+BIAS+ARG0+3*ARGSZ]
   4158 	cmp	in2, 0
   4159 
   4160 	ble	.ede3.dec.finish
   4161 	STPTR	in5,  [%sp+BIAS+ARG0+5*ARGSZ]
   4162 
   4163 	LDPTR	[%fp+BIAS+ARG0+6*ARGSZ], local7          ! iv
   4164 
   4165 
   4166 ! load_little_endian
   4167 ! local7 in0 in1 local3 .LLE8
   4168 
   4169 	! first in memory to rightmost in register
   4170 
   4171 .LLE8:
   4172 	ldub	[local7+3], in0
   4173 
   4174 	ldub	[local7+2], local3
   4175 	sll	in0, 8, in0
   4176 	or	in0, local3, in0
   4177 
   4178 	ldub	[local7+1], local3
   4179 	sll	in0, 8, in0
   4180 	or	in0, local3, in0
   4181 
   4182 	ldub	[local7+0], local3
   4183 	sll	in0, 8, in0
   4184 	or	in0, local3, in0
   4185 
   4186 
   4187 	ldub	[local7+3+4], in1
   4188 
   4189 	ldub	[local7+2+4], local3
   4190 	sll	in1, 8, in1
   4191 	or	in1, local3, in1
   4192 
   4193 	ldub	[local7+1+4], local3
   4194 	sll	in1, 8, in1
   4195 	or	in1, local3, in1
   4196 
   4197 	ldub	[local7+0+4], local3
   4198 	sll	in1, 8, in1
   4199 	or	in1, local3, in1
   4200 .LLE8a:
   4201 
   4202 
   4203 
   4204 .ede3.dec.next.block:
   4205 
   4206 
   4207 
   4208 ! load_little_endian
   4209 ! local5 in5 out5 local3 .LLE9
   4210 
   4211 	! first in memory to rightmost in register
   4212 
   4213 .LLE9:
   4214 	ldub	[local5+3], in5
   4215 
   4216 	ldub	[local5+2], local3
   4217 	sll	in5, 8, in5
   4218 	or	in5, local3, in5
   4219 
   4220 	ldub	[local5+1], local3
   4221 	sll	in5, 8, in5
   4222 	or	in5, local3, in5
   4223 
   4224 	ldub	[local5+0], local3
   4225 	sll	in5, 8, in5
   4226 	or	in5, local3, in5
   4227 
   4228 
   4229 	ldub	[local5+3+4], out5
   4230 
   4231 	ldub	[local5+2+4], local3
   4232 	sll	out5, 8, out5
   4233 	or	out5, local3, out5
   4234 
   4235 	ldub	[local5+1+4], local3
   4236 	sll	out5, 8, out5
   4237 	or	out5, local3, out5
   4238 
   4239 	ldub	[local5+0+4], local3
   4240 	sll	out5, 8, out5
   4241 	or	out5, local3, out5
   4242 .LLE9a:
   4243 
   4244 
   4245 
   4246 	! parameter 6  1/2 for include encryption/decryption
   4247 	! parameter 7  1 for mov in1 to in3
   4248 	! parameter 8  1 for mov in3 to in4
   4249 	! parameter 9  1 for load ks3 and ks2 to in4 and in3
   4250 
   4251 
   4252 
   4253 ! ip_macro
   4254 ! in5 out5 in5 out5 in4 2 0 0 1
   4255 
   4256 	ld	[out2+256], local1
   4257 	srl	out5, 4, local4
   4258 
   4259 	xor	local4, in5, local4
   4260 	nop
   4261 
   4262 	ld	[out2+260], local2
   4263 	and	local4, local1, local4
   4264 
   4265 
   4266 
   4267 	ld	[out2+280], out4          ! loop counter
   4268 	sll	local4, 4, local1
   4269 	xor	in5, local4, in5
   4270 
   4271 	ld	[out2+264], local3
   4272 	srl	in5, 16, local4
   4273 	xor	out5, local1, out5
   4274 
   4275 	LDPTR	 [%sp+BIAS+ARG0+5*ARGSZ] , in4
   4276 	xor	local4, out5, local4
   4277 	nop	!sethi	%hi(DES_SPtrans), global1 ! sbox addr
   4278 
   4279 	LDPTR	 [%sp+BIAS+ARG0+4*ARGSZ] , in3
   4280 	and	local4, local2, local4
   4281 	nop	!or	global1, %lo(DES_SPtrans), global1   ! sbox addr
   4282 
   4283 	sll	local4, 16, local1
   4284 	xor	out5, local4, out5
   4285 
   4286 	srl	out5, 2, local4
   4287 	xor	in5, local1, in5
   4288 
   4289 	sethi	%hi(16711680), local5
   4290 	xor	local4, in5, local4
   4291 
   4292 	and	local4, local3, local4
   4293 	or	local5, 255, local5
   4294 
   4295 	sll	local4, 2, local2
   4296 	xor	in5, local4, in5
   4297 
   4298 	srl	in5, 8, local4
   4299 	xor	out5, local2, out5
   4300 
   4301 	xor	local4, out5, local4
   4302 	add	global1, 768, global4
   4303 
   4304 	and	local4, local5, local4
   4305 	add	global1, 1024, global5
   4306 
   4307 	ld	[out2+272], local7
   4308 	sll	local4, 8, local1
   4309 	xor	out5, local4, out5
   4310 
   4311 	srl	out5, 1, local4
   4312 	xor	in5, local1, in5
   4313 
   4314 	ld	[in4], out0                ! key 7531
   4315 	xor	local4, in5, local4
   4316 	add	global1, 256, global2
   4317 
   4318 	ld	[in4+4], out1              ! key 8642
   4319 	and	local4, local7, local4
   4320 	add	global1, 512, global3
   4321 
   4322 	sll	local4, 1, local1
   4323 	xor	in5, local4, in5
   4324 
   4325 	sll	in5, 3, local3
   4326 	xor	out5, local1, out5
   4327 
   4328 	sll	out5, 3, local2
   4329 	add	global1, 1280, local6     ! address sbox 8
   4330 
   4331 	srl	in5, 29, local4
   4332 	add	global1, 1792, out3       ! address sbox 8
   4333 
   4334 	srl	out5, 29, local1
   4335 	or	local4, local3, in5
   4336 
   4337 	or	local2, local1, out5
   4338 
   4339 
   4340 
   4341 
   4342 
   4343 		ld	[out2+284], local5     ! 0x0000FC00 used in the rounds
   4344 		or	local2, local1, out5
   4345 		xor	in5, out0, local1
   4346 
   4347 		call .des_dec.1
   4348 		and	local1, 252, local1
   4349 
   4350 
   4351  ! inc .des_dec ks3 in4
   4352 
   4353 	call .des_enc                     ! ks2 in3
   4354 	LDPTR	 [%sp+BIAS+ARG0+3*ARGSZ] , in4
   4355 
   4356 	call .des_dec                     ! ks1 in4
   4357 	nop
   4358 
   4359 
   4360 
   4361 ! fp_macro
   4362 ! out5 in5 0 1
   4363 
   4364 	! initially undo the rotate 3 left done after initial permutation
   4365 	! original left is received shifted 3 right and 29 left in local3/4
   4366 
   4367 	sll	in5, 29, local1
   4368 	or	local3, local4, out5
   4369 
   4370 	srl	in5, 3, in5
   4371 	sethi	%hi(0x55555555), local2
   4372 
   4373 	or	in5, local1, in5
   4374 	or	local2, %lo(0x55555555), local2
   4375 
   4376 	srl	in5, 1, local3
   4377 	sethi	%hi(0x00ff00ff), local1
   4378 	xor	local3, out5, local3
   4379 	or	local1, %lo(0x00ff00ff), local1
   4380 	and	local3, local2, local3
   4381 	sethi	%hi(0x33333333), local4
   4382 	sll	local3, 1, local2
   4383 
   4384 	xor	out5, local3, out5
   4385 
   4386 	srl	out5, 8, local3
   4387 	xor	in5, local2, in5
   4388 	xor	local3, in5, local3
   4389 	or	local4, %lo(0x33333333), local4
   4390 	and	local3, local1, local3
   4391 	sethi	%hi(0x0000ffff), local1
   4392 	sll	local3, 8, local2
   4393 
   4394 	xor	in5, local3, in5
   4395 
   4396 	srl	in5, 2, local3
   4397 	xor	out5, local2, out5
   4398 	xor	local3, out5, local3
   4399 	or	local1, %lo(0x0000ffff), local1
   4400 	and	local3, local4, local3
   4401 	sethi	%hi(0x0f0f0f0f), local4
   4402 	sll	local3, 2, local2
   4403 
   4404 	LDPTR  [%sp+BIAS+ARG0+0*ARGSZ] , local5
   4405 	xor	out5, local3, out5
   4406 
   4407 	LDPTR  [%sp+BIAS+ARG0+1*ARGSZ] , local7
   4408 	srl	out5, 16, local3
   4409 	xor	in5, local2, in5
   4410 	xor	local3, in5, local3
   4411 	or	local4, %lo(0x0f0f0f0f), local4
   4412 	and	local3, local1, local3
   4413 	sll	local3, 16, local2
   4414 
   4415 	xor	in5, local3, local1
   4416 
   4417 	srl	local1, 4, local3
   4418 	xor	out5, local2, out5
   4419 	xor	local3, out5, local3
   4420 	and	local3, local4, local3
   4421 	sll	local3, 4, local2
   4422 
   4423 	xor	out5, local3, out5
   4424 
   4425 	! optional store:
   4426 
   4427 
   4428 
   4429 	xor	local1, local2, in5
   4430 
   4431 
   4432 
   4433    ! 1 for input and output address local5/7
   4434 
   4435 	! in2 is bytes left to be stored
   4436 	! in2 is compared to 8 in the rounds
   4437 
   4438 	xor	out5, in0, out4
   4439 	bl	.ede3.dec.seven.or.less
   4440 	xor	in5, in1, global4
   4441 
   4442 
   4443 
   4444 ! load_little_endian_inc
   4445 ! local5 in0 in1 local3 .LLE10
   4446 
   4447 	! first in memory to rightmost in register
   4448 
   4449 .LLE10:
   4450 	ldub	[local5+3], in0
   4451 
   4452 	ldub	[local5+2], local3
   4453 	sll	in0, 8, in0
   4454 	or	in0, local3, in0
   4455 
   4456 	ldub	[local5+1], local3
   4457 	sll	in0, 8, in0
   4458 	or	in0, local3, in0
   4459 
   4460 	ldub	[local5+0], local3
   4461 	sll	in0, 8, in0
   4462 	or	in0, local3, in0
   4463 
   4464 	ldub	[local5+3+4], in1
   4465 	add	local5, 8, local5
   4466 
   4467 	ldub	[local5+2+4-8], local3
   4468 	sll	in1, 8, in1
   4469 	or	in1, local3, in1
   4470 
   4471 	ldub	[local5+1+4-8], local3
   4472 	sll	in1, 8, in1
   4473 	or	in1, local3, in1
   4474 
   4475 	ldub	[local5+0+4-8], local3
   4476 	sll	in1, 8, in1
   4477 	or	in1, local3, in1
   4478 .LLE10a:
   4479 
   4480    ! iv next block
   4481 
   4482 
   4483 
   4484 ! store_little_endian
   4485 ! local7 out4 global4 local3 .SLE7
   4486 
   4487 	! rightmost in register to first in memory
   4488 
   4489 .SLE7:
   4490 	and	out4, 255, local3
   4491 	stub	local3, [local7+0]
   4492 
   4493 	srl	out4, 8, local3
   4494 	and	local3, 255, local3
   4495 	stub	local3, [local7+1]
   4496 
   4497 	srl	out4, 16, local3
   4498 	and	local3, 255, local3
   4499 	stub	local3, [local7+2]
   4500 
   4501 	srl	out4, 24, local3
   4502 	stub	local3, [local7+3]
   4503 
   4504 
   4505 	and	global4, 255, local3
   4506 	stub	local3, [local7+0+4]
   4507 
   4508 	srl	global4, 8, local3
   4509 	and	local3, 255, local3
   4510 	stub	local3, [local7+1+4]
   4511 
   4512 	srl	global4, 16, local3
   4513 	and	local3, 255, local3
   4514 	stub	local3, [local7+2+4]
   4515 
   4516 	srl	global4, 24, local3
   4517 	stub	local3, [local7+3+4]
   4518 
   4519 .SLE7a:
   4520 
   4521   ! block
   4522 
   4523 	STPTR	local5,  [%sp+BIAS+ARG0+0*ARGSZ]
   4524 	addcc   in2, -8, in2
   4525 	add	local7, 8, local7
   4526 
   4527 	bg	.ede3.dec.next.block
   4528 	STPTR	local7,  [%sp+BIAS+ARG0+1*ARGSZ]
   4529 
   4530 .ede3.dec.store.iv:
   4531 
   4532 	LDPTR	[%fp+BIAS+ARG0+6*ARGSZ], local4          ! ivec
   4533 
   4534 
   4535 ! store_little_endian
   4536 ! local4 in0 in1 local5 .SLE8
   4537 
   4538 	! rightmost in register to first in memory
   4539 
   4540 .SLE8:
   4541 	and	in0, 255, local5
   4542 	stub	local5, [local4+0]
   4543 
   4544 	srl	in0, 8, local5
   4545 	and	local5, 255, local5
   4546 	stub	local5, [local4+1]
   4547 
   4548 	srl	in0, 16, local5
   4549 	and	local5, 255, local5
   4550 	stub	local5, [local4+2]
   4551 
   4552 	srl	in0, 24, local5
   4553 	stub	local5, [local4+3]
   4554 
   4555 
   4556 	and	in1, 255, local5
   4557 	stub	local5, [local4+0+4]
   4558 
   4559 	srl	in1, 8, local5
   4560 	and	local5, 255, local5
   4561 	stub	local5, [local4+1+4]
   4562 
   4563 	srl	in1, 16, local5
   4564 	and	local5, 255, local5
   4565 	stub	local5, [local4+2+4]
   4566 
   4567 	srl	in1, 24, local5
   4568 	stub	local5, [local4+3+4]
   4569 
   4570 .SLE8a:
   4571 
   4572   ! ivec
   4573 
   4574 .ede3.dec.finish:
   4575 
   4576 	ret
   4577 	restore
   4578 
   4579 .ede3.dec.seven.or.less:
   4580 
   4581 
   4582 
   4583 ! load_little_endian_inc
   4584 ! local5 in0 in1 local3 .LLE14
   4585 
   4586 	! first in memory to rightmost in register
   4587 
   4588 .LLE14:
   4589 	ldub	[local5+3], in0
   4590 
   4591 	ldub	[local5+2], local3
   4592 	sll	in0, 8, in0
   4593 	or	in0, local3, in0
   4594 
   4595 	ldub	[local5+1], local3
   4596 	sll	in0, 8, in0
   4597 	or	in0, local3, in0
   4598 
   4599 	ldub	[local5+0], local3
   4600 	sll	in0, 8, in0
   4601 	or	in0, local3, in0
   4602 
   4603 	ldub	[local5+3+4], in1
   4604 	add	local5, 8, local5
   4605 
   4606 	ldub	[local5+2+4-8], local3
   4607 	sll	in1, 8, in1
   4608 	or	in1, local3, in1
   4609 
   4610 	ldub	[local5+1+4-8], local3
   4611 	sll	in1, 8, in1
   4612 	or	in1, local3, in1
   4613 
   4614 	ldub	[local5+0+4-8], local3
   4615 	sll	in1, 8, in1
   4616 	or	in1, local3, in1
   4617 .LLE14a:
   4618 
   4619      ! iv
   4620 
   4621 
   4622 
   4623 ! store_n_bytes
   4624 ! local7 in2 local3 local4 .SNB2 .ede3.dec.store.iv .SNB2 .ede3.dec.store.iv
   4625 
   4626 .SNB2.0:	call	.+8
   4627 	sll	in2, 2, local4
   4628 
   4629 	add	%o7,.SNB2.jmp.table-.SNB2.0,local3
   4630 
   4631 	add	local3, local4, local3
   4632 
   4633 	ld	[local3], local3
   4634 
   4635 	jmp	%o7+local3
   4636 	nop
   4637 
   4638 .SNB2.7:
   4639 	srl	global4, 16, local3
   4640 	and	local3, 0xff, local3
   4641 	stub	local3, [local7+6]
   4642 .SNB2.6:
   4643 	srl	global4, 8, local3
   4644 	and	local3, 0xff, local3
   4645 	stub	local3, [local7+5]
   4646 .SNB2.5:
   4647 	and	global4, 0xff, local3
   4648 	stub	local3, [local7+4]
   4649 .SNB2.4:
   4650 	srl	out4, 24, local3
   4651 	stub	local3, [local7+3]
   4652 .SNB2.3:
   4653 	srl	out4, 16, local3
   4654 	and	local3, 0xff, local3
   4655 	stub	local3, [local7+2]
   4656 .SNB2.2:
   4657 	srl	out4, 8, local3
   4658 	and	local3, 0xff, local3
   4659 	stub	local3, [local7+1]
   4660 .SNB2.1:
   4661 	and	out4, 0xff, local3
   4662 
   4663 
   4664 	ba	.ede3.dec.store.iv
   4665 	stub	local3, [local7]
   4666 
   4667 	.align 4
   4668 
   4669 .SNB2.jmp.table:
   4670 
   4671 	.word	0
   4672 	.word	.SNB2.1-.SNB2.0
   4673 	.word	.SNB2.2-.SNB2.0
   4674 	.word	.SNB2.3-.SNB2.0
   4675 	.word	.SNB2.4-.SNB2.0
   4676 	.word	.SNB2.5-.SNB2.0
   4677 	.word	.SNB2.6-.SNB2.0
   4678 	.word	.SNB2.7-.SNB2.0
   4679 
   4680 
   4681 
   4682 .DES_ede3_cbc_encrypt.end:
   4683 	.size	 DES_ede3_cbc_encrypt,.DES_ede3_cbc_encrypt.end-DES_ede3_cbc_encrypt
   4684 
   4685 	.align	256
   4686 	.type	 .des_and,#object
   4687 	.size	 .des_and,284
   4688 
   4689 .des_and:
   4690 
   4691 ! This table is used for AND 0xFC when it is known that register
   4692 ! bits 8-31 are zero. Makes it possible to do three arithmetic
   4693 ! operations in one cycle.
   4694 
   4695 	.byte  0, 0, 0, 0, 4, 4, 4, 4
   4696 	.byte  8, 8, 8, 8, 12, 12, 12, 12
   4697 	.byte  16, 16, 16, 16, 20, 20, 20, 20
   4698 	.byte  24, 24, 24, 24, 28, 28, 28, 28
   4699 	.byte  32, 32, 32, 32, 36, 36, 36, 36
   4700 	.byte  40, 40, 40, 40, 44, 44, 44, 44
   4701 	.byte  48, 48, 48, 48, 52, 52, 52, 52
   4702 	.byte  56, 56, 56, 56, 60, 60, 60, 60
   4703 	.byte  64, 64, 64, 64, 68, 68, 68, 68
   4704 	.byte  72, 72, 72, 72, 76, 76, 76, 76
   4705 	.byte  80, 80, 80, 80, 84, 84, 84, 84
   4706 	.byte  88, 88, 88, 88, 92, 92, 92, 92
   4707 	.byte  96, 96, 96, 96, 100, 100, 100, 100
   4708 	.byte  104, 104, 104, 104, 108, 108, 108, 108
   4709 	.byte  112, 112, 112, 112, 116, 116, 116, 116
   4710 	.byte  120, 120, 120, 120, 124, 124, 124, 124
   4711 	.byte  128, 128, 128, 128, 132, 132, 132, 132
   4712 	.byte  136, 136, 136, 136, 140, 140, 140, 140
   4713 	.byte  144, 144, 144, 144, 148, 148, 148, 148
   4714 	.byte  152, 152, 152, 152, 156, 156, 156, 156
   4715 	.byte  160, 160, 160, 160, 164, 164, 164, 164
   4716 	.byte  168, 168, 168, 168, 172, 172, 172, 172
   4717 	.byte  176, 176, 176, 176, 180, 180, 180, 180
   4718 	.byte  184, 184, 184, 184, 188, 188, 188, 188
   4719 	.byte  192, 192, 192, 192, 196, 196, 196, 196
   4720 	.byte  200, 200, 200, 200, 204, 204, 204, 204
   4721 	.byte  208, 208, 208, 208, 212, 212, 212, 212
   4722 	.byte  216, 216, 216, 216, 220, 220, 220, 220
   4723 	.byte  224, 224, 224, 224, 228, 228, 228, 228
   4724 	.byte  232, 232, 232, 232, 236, 236, 236, 236
   4725 	.byte  240, 240, 240, 240, 244, 244, 244, 244
   4726 	.byte  248, 248, 248, 248, 252, 252, 252, 252
   4727 
   4728 	! 5 numbers for initial/final permutation
   4729 
   4730 	.word   0x0f0f0f0f                ! offset 256
   4731 	.word	0x0000ffff                ! 260
   4732 	.word	0x33333333                ! 264
   4733 	.word	0x00ff00ff                ! 268
   4734 	.word	0x55555555                ! 272
   4735 
   4736 	.word	0                         ! 276
   4737 	.word	LOOPS                     ! 280
   4738 	.word	0x0000FC00                ! 284
   4739 
   4740 	.global	DES_SPtrans
   4741 	.type	DES_SPtrans,#object
   4742 	.size	DES_SPtrans,2048
   4743 .align	64
   4744 DES_SPtrans:
   4745 _PIC_DES_SPtrans:
   4746 	! nibble 0
   4747 	.word	0x02080800, 0x00080000, 0x02000002, 0x02080802
   4748 	.word	0x02000000, 0x00080802, 0x00080002, 0x02000002
   4749 	.word	0x00080802, 0x02080800, 0x02080000, 0x00000802
   4750 	.word	0x02000802, 0x02000000, 0x00000000, 0x00080002
   4751 	.word	0x00080000, 0x00000002, 0x02000800, 0x00080800
   4752 	.word	0x02080802, 0x02080000, 0x00000802, 0x02000800
   4753 	.word	0x00000002, 0x00000800, 0x00080800, 0x02080002
   4754 	.word	0x00000800, 0x02000802, 0x02080002, 0x00000000
   4755 	.word	0x00000000, 0x02080802, 0x02000800, 0x00080002
   4756 	.word	0x02080800, 0x00080000, 0x00000802, 0x02000800
   4757 	.word	0x02080002, 0x00000800, 0x00080800, 0x02000002
   4758 	.word	0x00080802, 0x00000002, 0x02000002, 0x02080000
   4759 	.word	0x02080802, 0x00080800, 0x02080000, 0x02000802
   4760 	.word	0x02000000, 0x00000802, 0x00080002, 0x00000000
   4761 	.word	0x00080000, 0x02000000, 0x02000802, 0x02080800
   4762 	.word	0x00000002, 0x02080002, 0x00000800, 0x00080802
   4763 	! nibble 1
   4764 	.word	0x40108010, 0x00000000, 0x00108000, 0x40100000
   4765 	.word	0x40000010, 0x00008010, 0x40008000, 0x00108000
   4766 	.word	0x00008000, 0x40100010, 0x00000010, 0x40008000
   4767 	.word	0x00100010, 0x40108000, 0x40100000, 0x00000010
   4768 	.word	0x00100000, 0x40008010, 0x40100010, 0x00008000
   4769 	.word	0x00108010, 0x40000000, 0x00000000, 0x00100010
   4770 	.word	0x40008010, 0x00108010, 0x40108000, 0x40000010
   4771 	.word	0x40000000, 0x00100000, 0x00008010, 0x40108010
   4772 	.word	0x00100010, 0x40108000, 0x40008000, 0x00108010
   4773 	.word	0x40108010, 0x00100010, 0x40000010, 0x00000000
   4774 	.word	0x40000000, 0x00008010, 0x00100000, 0x40100010
   4775 	.word	0x00008000, 0x40000000, 0x00108010, 0x40008010
   4776 	.word	0x40108000, 0x00008000, 0x00000000, 0x40000010
   4777 	.word	0x00000010, 0x40108010, 0x00108000, 0x40100000
   4778 	.word	0x40100010, 0x00100000, 0x00008010, 0x40008000
   4779 	.word	0x40008010, 0x00000010, 0x40100000, 0x00108000
   4780 	! nibble 2
   4781 	.word	0x04000001, 0x04040100, 0x00000100, 0x04000101
   4782 	.word	0x00040001, 0x04000000, 0x04000101, 0x00040100
   4783 	.word	0x04000100, 0x00040000, 0x04040000, 0x00000001
   4784 	.word	0x04040101, 0x00000101, 0x00000001, 0x04040001
   4785 	.word	0x00000000, 0x00040001, 0x04040100, 0x00000100
   4786 	.word	0x00000101, 0x04040101, 0x00040000, 0x04000001
   4787 	.word	0x04040001, 0x04000100, 0x00040101, 0x04040000
   4788 	.word	0x00040100, 0x00000000, 0x04000000, 0x00040101
   4789 	.word	0x04040100, 0x00000100, 0x00000001, 0x00040000
   4790 	.word	0x00000101, 0x00040001, 0x04040000, 0x04000101
   4791 	.word	0x00000000, 0x04040100, 0x00040100, 0x04040001
   4792 	.word	0x00040001, 0x04000000, 0x04040101, 0x00000001
   4793 	.word	0x00040101, 0x04000001, 0x04000000, 0x04040101
   4794 	.word	0x00040000, 0x04000100, 0x04000101, 0x00040100
   4795 	.word	0x04000100, 0x00000000, 0x04040001, 0x00000101
   4796 	.word	0x04000001, 0x00040101, 0x00000100, 0x04040000
   4797 	! nibble 3
   4798 	.word	0x00401008, 0x10001000, 0x00000008, 0x10401008
   4799 	.word	0x00000000, 0x10400000, 0x10001008, 0x00400008
   4800 	.word	0x10401000, 0x10000008, 0x10000000, 0x00001008
   4801 	.word	0x10000008, 0x00401008, 0x00400000, 0x10000000
   4802 	.word	0x10400008, 0x00401000, 0x00001000, 0x00000008
   4803 	.word	0x00401000, 0x10001008, 0x10400000, 0x00001000
   4804 	.word	0x00001008, 0x00000000, 0x00400008, 0x10401000
   4805 	.word	0x10001000, 0x10400008, 0x10401008, 0x00400000
   4806 	.word	0x10400008, 0x00001008, 0x00400000, 0x10000008
   4807 	.word	0x00401000, 0x10001000, 0x00000008, 0x10400000
   4808 	.word	0x10001008, 0x00000000, 0x00001000, 0x00400008
   4809 	.word	0x00000000, 0x10400008, 0x10401000, 0x00001000
   4810 	.word	0x10000000, 0x10401008, 0x00401008, 0x00400000
   4811 	.word	0x10401008, 0x00000008, 0x10001000, 0x00401008
   4812 	.word	0x00400008, 0x00401000, 0x10400000, 0x10001008
   4813 	.word	0x00001008, 0x10000000, 0x10000008, 0x10401000
   4814 	! nibble 4
   4815 	.word	0x08000000, 0x00010000, 0x00000400, 0x08010420
   4816 	.word	0x08010020, 0x08000400, 0x00010420, 0x08010000
   4817 	.word	0x00010000, 0x00000020, 0x08000020, 0x00010400
   4818 	.word	0x08000420, 0x08010020, 0x08010400, 0x00000000
   4819 	.word	0x00010400, 0x08000000, 0x00010020, 0x00000420
   4820 	.word	0x08000400, 0x00010420, 0x00000000, 0x08000020
   4821 	.word	0x00000020, 0x08000420, 0x08010420, 0x00010020
   4822 	.word	0x08010000, 0x00000400, 0x00000420, 0x08010400
   4823 	.word	0x08010400, 0x08000420, 0x00010020, 0x08010000
   4824 	.word	0x00010000, 0x00000020, 0x08000020, 0x08000400
   4825 	.word	0x08000000, 0x00010400, 0x08010420, 0x00000000
   4826 	.word	0x00010420, 0x08000000, 0x00000400, 0x00010020
   4827 	.word	0x08000420, 0x00000400, 0x00000000, 0x08010420
   4828 	.word	0x08010020, 0x08010400, 0x00000420, 0x00010000
   4829 	.word	0x00010400, 0x08010020, 0x08000400, 0x00000420
   4830 	.word	0x00000020, 0x00010420, 0x08010000, 0x08000020
   4831 	! nibble 5
   4832 	.word	0x80000040, 0x00200040, 0x00000000, 0x80202000
   4833 	.word	0x00200040, 0x00002000, 0x80002040, 0x00200000
   4834 	.word	0x00002040, 0x80202040, 0x00202000, 0x80000000
   4835 	.word	0x80002000, 0x80000040, 0x80200000, 0x00202040
   4836 	.word	0x00200000, 0x80002040, 0x80200040, 0x00000000
   4837 	.word	0x00002000, 0x00000040, 0x80202000, 0x80200040
   4838 	.word	0x80202040, 0x80200000, 0x80000000, 0x00002040
   4839 	.word	0x00000040, 0x00202000, 0x00202040, 0x80002000
   4840 	.word	0x00002040, 0x80000000, 0x80002000, 0x00202040
   4841 	.word	0x80202000, 0x00200040, 0x00000000, 0x80002000
   4842 	.word	0x80000000, 0x00002000, 0x80200040, 0x00200000
   4843 	.word	0x00200040, 0x80202040, 0x00202000, 0x00000040
   4844 	.word	0x80202040, 0x00202000, 0x00200000, 0x80002040
   4845 	.word	0x80000040, 0x80200000, 0x00202040, 0x00000000
   4846 	.word	0x00002000, 0x80000040, 0x80002040, 0x80202000
   4847 	.word	0x80200000, 0x00002040, 0x00000040, 0x80200040
   4848 	! nibble 6
   4849 	.word	0x00004000, 0x00000200, 0x01000200, 0x01000004
   4850 	.word	0x01004204, 0x00004004, 0x00004200, 0x00000000
   4851 	.word	0x01000000, 0x01000204, 0x00000204, 0x01004000
   4852 	.word	0x00000004, 0x01004200, 0x01004000, 0x00000204
   4853 	.word	0x01000204, 0x00004000, 0x00004004, 0x01004204
   4854 	.word	0x00000000, 0x01000200, 0x01000004, 0x00004200
   4855 	.word	0x01004004, 0x00004204, 0x01004200, 0x00000004
   4856 	.word	0x00004204, 0x01004004, 0x00000200, 0x01000000
   4857 	.word	0x00004204, 0x01004000, 0x01004004, 0x00000204
   4858 	.word	0x00004000, 0x00000200, 0x01000000, 0x01004004
   4859 	.word	0x01000204, 0x00004204, 0x00004200, 0x00000000
   4860 	.word	0x00000200, 0x01000004, 0x00000004, 0x01000200
   4861 	.word	0x00000000, 0x01000204, 0x01000200, 0x00004200
   4862 	.word	0x00000204, 0x00004000, 0x01004204, 0x01000000
   4863 	.word	0x01004200, 0x00000004, 0x00004004, 0x01004204
   4864 	.word	0x01000004, 0x01004200, 0x01004000, 0x00004004
   4865 	! nibble 7
   4866 	.word	0x20800080, 0x20820000, 0x00020080, 0x00000000
   4867 	.word	0x20020000, 0x00800080, 0x20800000, 0x20820080
   4868 	.word	0x00000080, 0x20000000, 0x00820000, 0x00020080
   4869 	.word	0x00820080, 0x20020080, 0x20000080, 0x20800000
   4870 	.word	0x00020000, 0x00820080, 0x00800080, 0x20020000
   4871 	.word	0x20820080, 0x20000080, 0x00000000, 0x00820000
   4872 	.word	0x20000000, 0x00800000, 0x20020080, 0x20800080
   4873 	.word	0x00800000, 0x00020000, 0x20820000, 0x00000080
   4874 	.word	0x00800000, 0x00020000, 0x20000080, 0x20820080
   4875 	.word	0x00020080, 0x20000000, 0x00000000, 0x00820000
   4876 	.word	0x20800080, 0x20020080, 0x20020000, 0x00800080
   4877 	.word	0x20820000, 0x00000080, 0x00800080, 0x20020000
   4878 	.word	0x20820080, 0x00800000, 0x20800000, 0x20000080
   4879 	.word	0x00820000, 0x00020080, 0x20020080, 0x20800000
   4880 	.word	0x00000080, 0x20820000, 0x00820080, 0x00000000
   4881 	.word	0x20000000, 0x20800080, 0x00020000, 0x00820080
   4882 
   4883