components/openssl/openssl-1.0.1/engines/t4/t4_aes.S
branchs11-update
changeset 2593 b92e6df5eaf0
parent 603 1b966e9a6b03
equal deleted inserted replaced
2592:a7d8d41eeab2 2593:b92e6df5eaf0
       
     1 /*
       
     2  * ====================================================================
       
     3  * Copyright (c) 1998-2011 The OpenSSL Project.  All rights reserved.
       
     4  *
       
     5  * Redistribution and use in source and binary forms, with or without
       
     6  * modification, are permitted provided that the following conditions
       
     7  * are met:
       
     8  *
       
     9  * 1. Redistributions of source code must retain the above copyright
       
    10  *    notice, this list of conditions and the following disclaimer.
       
    11  *
       
    12  * 2. Redistributions in binary form must reproduce the above copyright
       
    13  *    notice, this list of conditions and the following disclaimer in
       
    14  *    the documentation and/or other materials provided with the
       
    15  *    distribution.
       
    16  *
       
    17  * 3. All advertising materials mentioning features or use of this
       
    18  *    software must display the following acknowledgment:
       
    19  *    "This product includes software developed by the OpenSSL Project
       
    20  *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
       
    21  *
       
    22  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
       
    23  *    endorse or promote products derived from this software without
       
    24  *    prior written permission. For written permission, please contact
       
    25  *    [email protected].
       
    26  *
       
    27  * 5. Products derived from this software may not be called "OpenSSL"
       
    28  *    nor may "OpenSSL" appear in their names without prior written
       
    29  *    permission of the OpenSSL Project.
       
    30  *
       
    31  * 6. Redistributions of any form whatsoever must retain the following
       
    32  *    acknowledgment:
       
    33  *    "This product includes software developed by the OpenSSL Project
       
    34  *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
       
    35  *
       
    36  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
       
    37  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
       
    38  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
       
    39  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
       
    40  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
       
    41  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
       
    42  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
       
    43  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
       
    44  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
       
    45  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
       
    46  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
       
    47  * OF THE POSSIBILITY OF SUCH DAMAGE.
       
    48  * ====================================================================
       
    49  */
       
    50 
       
    51 /*
       
    52  * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
       
    53  */
       
    54 
       
    55 /*LINTLIBRARY*/
       
    56 
       
    57 #if defined(lint) || defined(__lint)
       
    58 
       
    59 
       
    60 #include <sys/types.h>
       
    61 
       
    62 /*ARGSUSED*/
       
    63 void t4_aes_expand128(uint64_t *rk, const uint32_t *key)
       
    64 { return; }
       
    65 
       
    66 /*ARGSUSED*/
       
    67 void t4_aes_expand192(uint64_t *rk, const uint32_t *key)
       
    68 { return; }
       
    69 
       
    70 /*ARGSUSED*/
       
    71 void t4_aes_expand256(uint64_t *rk, const uint32_t *key)
       
    72 { return; }
       
    73 
       
    74 void t4_aes128_load_keys_for_encrypt(uint64_t *ks)
       
    75 { return; }
       
    76 
       
    77 /*ARGSUSED*/
       
    78 void t4_aes192_load_keys_for_encrypt(uint64_t *ks)
       
    79 { return; }
       
    80 
       
    81 /*ARGSUSED*/
       
    82 void t4_aes256_load_keys_for_encrypt(uint64_t *ks)
       
    83 { return; }
       
    84 
       
    85 /*ARGSUSED*/
       
    86 void t4_aes128_ecb_encrypt(uint64_t *ks, uint64_t *asm_in,
       
    87     uint64_t * asm_out, size_t amount_to_encrypt, uint64_t *iv)
       
    88 { return; }
       
    89 
       
    90 /*ARGSUSED*/
       
    91 void t4_aes192_ecb_encrypt(uint64_t *ks, uint64_t *asm_in,
       
    92     uint64_t * asm_out, size_t amount_to_encrypt, uint64_t *iv)
       
    93 { return; }
       
    94 
       
    95 /*ARGSUSED*/
       
    96 void t4_aes256_ecb_encrypt(uint64_t *ks, uint64_t *asm_in,
       
    97     uint64_t * asm_out, size_t amount_to_encrypt, uint64_t *iv)
       
    98 { return; }
       
    99 
       
   100 /*ARGSUSED*/
       
   101 void t4_aes128_cbc_encrypt(uint64_t *ks, uint64_t *asm_in,
       
   102     uint64_t * asm_out, size_t amount_to_encrypt, uint64_t *iv)
       
   103 { return; }
       
   104 
       
   105 /*ARGSUSED*/
       
   106 void t4_aes192_cbc_encrypt(uint64_t *ks, uint64_t *asm_in,
       
   107     uint64_t * asm_out, size_t amount_to_encrypt, uint64_t *iv)
       
   108 { return; }
       
   109 
       
   110 /*ARGSUSED*/
       
   111 void t4_aes256_cbc_encrypt(uint64_t *ks, uint64_t *asm_in,
       
   112     uint64_t * asm_out, size_t amount_to_encrypt, uint64_t *iv)
       
   113 { return; }
       
   114 
       
   115 /*ARGSUSED*/
       
   116 void t4_aes128_ctr_crypt(uint64_t *ks, uint64_t *asm_in,
       
   117     uint64_t * asm_out, size_t amount_to_encrypt, uint64_t *iv)
       
   118 { return; }
       
   119 
       
   120 /*ARGSUSED*/
       
   121 void t4_aes192_ctr_crypt(uint64_t *ks, uint64_t *asm_in,
       
   122     uint64_t * asm_out, size_t amount_to_encrypt, uint64_t *iv)
       
   123 { return; }
       
   124 
       
   125 /*ARGSUSED*/
       
   126 void t4_aes256_ctr_crypt(uint64_t *ks, uint64_t *asm_in,
       
   127     uint64_t * asm_out, size_t amount_to_encrypt, uint64_t *iv)
       
   128 { return; }
       
   129 
       
   130 /*ARGSUSED*/
       
   131 void t4_aes128_cfb128_encrypt(uint64_t *ks, uint64_t *asm_in,
       
   132     uint64_t * asm_out, size_t amount_to_encrypt, uint64_t *iv)
       
   133 { return; }
       
   134 
       
   135 /*ARGSUSED*/
       
   136 void t4_aes192_cfb128_encrypt(uint64_t *ks, uint64_t *asm_in,
       
   137     uint64_t * asm_out, size_t amount_to_encrypt, uint64_t *iv)
       
   138 { return; }
       
   139 
       
   140 /*ARGSUSED*/
       
   141 void t4_aes256_cfb128_encrypt(uint64_t *ks, uint64_t *asm_in,
       
   142     uint64_t * asm_out, size_t amount_to_encrypt, uint64_t *iv)
       
   143 { return; }
       
   144 
       
   145 void t4_aes128_load_keys_for_decrypt(uint64_t *ks)
       
   146 { return; }
       
   147 
       
   148 /*ARGSUSED*/
       
   149 void t4_aes192_load_keys_for_decrypt(uint64_t *ks)
       
   150 { return; }
       
   151 
       
   152 /*ARGSUSED*/
       
   153 void t4_aes256_load_keys_for_decrypt(uint64_t *ks)
       
   154 { return; }
       
   155 
       
   156 /*ARGSUSED*/
       
   157 void t4_aes128_ecb_decrypt(uint64_t *ks, uint64_t *asm_in,
       
   158     uint64_t * asm_out, size_t amount_to_encrypt, uint64_t *iv)
       
   159 { return; }
       
   160 
       
   161 /*ARGSUSED*/
       
   162 void t4_aes192_ecb_decrypt(uint64_t *ks, uint64_t *asm_in,
       
   163     uint64_t * asm_out, size_t amount_to_encrypt, uint64_t *iv)
       
   164 { return; }
       
   165 
       
   166 /*ARGSUSED*/
       
   167 void t4_aes256_ecb_decrypt(uint64_t *ks, uint64_t *asm_in,
       
   168     uint64_t * asm_out, size_t amount_to_encrypt, uint64_t *iv)
       
   169 { return; }
       
   170 
       
   171 /*ARGSUSED*/
       
   172 void t4_aes128_cbc_decrypt(uint64_t *ks, uint64_t *asm_in,
       
   173     uint64_t * asm_out, size_t amount_to_encrypt, uint64_t *iv)
       
   174 { return; }
       
   175 
       
   176 /*ARGSUSED*/
       
   177 void t4_aes192_cbc_decrypt(uint64_t *ks, uint64_t *asm_in,
       
   178     uint64_t * asm_out, size_t amount_to_encrypt, uint64_t *iv)
       
   179 { return; }
       
   180 
       
   181 /*ARGSUSED*/
       
   182 void t4_aes256_cbc_decrypt(uint64_t *ks, uint64_t *asm_in,
       
   183     uint64_t * asm_out, size_t amount_to_encrypt, uint64_t *iv)
       
   184 { return; }
       
   185 
       
   186 /*ARGSUSED*/
       
   187 void t4_aes128_cfb128_decrypt(uint64_t *ks, uint64_t *asm_in,
       
   188     uint64_t * asm_out, size_t amount_to_encrypt, uint64_t *iv)
       
   189 { return; }
       
   190 
       
   191 /*ARGSUSED*/
       
   192 void t4_aes192_cfb128_decrypt(uint64_t *ks, uint64_t *asm_in,
       
   193     uint64_t * asm_out, size_t amount_to_encrypt, uint64_t *iv)
       
   194 { return; }
       
   195 
       
   196 /*ARGSUSED*/
       
   197 void t4_aes256_cfb128_decrypt(uint64_t *ks, uint64_t *asm_in,
       
   198     uint64_t * asm_out, size_t amount_to_encrypt, uint64_t *iv)
       
   199 { return; }
       
   200 
       
   201 #else	/* lint || __lint */
       
   202 
       
   203 #include<sys/asm_linkage.h>
       
   204 
       
   205 
       
   206 	ENTRY(t4_aes_expand128)
       
   207 
       
   208 !load key
       
   209 	ld	[%o1], %f0
       
   210 	ld	[%o1 + 0x4], %f1
       
   211 	ld	[%o1 + 0x8], %f2
       
   212 	ld	[%o1 + 0xc], %f3
       
   213 
       
   214 !expand the key
       
   215 	!aes_kexpand1 %f0, %f2, 0x0, %f4
       
   216 	!aes_kexpand2 %f2, %f4, %f6
       
   217 	!aes_kexpand1 %f4, %f6, 0x1, %f8
       
   218 	!aes_kexpand2 %f6, %f8, %f10
       
   219 	!aes_kexpand1 %f8, %f10, 0x2, %f12
       
   220 	!aes_kexpand2 %f10, %f12, %f14
       
   221 	!aes_kexpand1 %f12, %f14, 0x3, %f16
       
   222 	!aes_kexpand2 %f14, %f16, %f18
       
   223 	!aes_kexpand1 %f16, %f18, 0x4, %f20
       
   224 	!aes_kexpand2 %f18, %f20, %f22
       
   225 	!aes_kexpand1 %f20, %f22, 0x5, %f24
       
   226 	!aes_kexpand2 %f22, %f24, %f26
       
   227 	!aes_kexpand1 %f24, %f26, 0x6, %f28
       
   228 	!aes_kexpand2 %f26, %f28, %f30
       
   229 	!aes_kexpand1 %f28, %f30, 0x7, %f32
       
   230 	!aes_kexpand2 %f30, %f32, %f34
       
   231 	!aes_kexpand1 %f32, %f34, 0x8, %f36
       
   232 	!aes_kexpand2 %f34, %f36, %f38
       
   233 	!aes_kexpand1 %f36, %f38, 0x9, %f40
       
   234 	!aes_kexpand2 %f38, %f40, %f42
       
   235 	.byte	0x88, 0xc8, 0x01, 0x02
       
   236 	.byte	0x8d, 0xb0, 0xa6, 0x24
       
   237 	.byte	0x90, 0xc9, 0x03, 0x06
       
   238 	.byte	0x95, 0xb1, 0xa6, 0x28
       
   239 	.byte	0x98, 0xca, 0x05, 0x0a
       
   240 	.byte	0x9d, 0xb2, 0xa6, 0x2c
       
   241 	.byte	0xa0, 0xcb, 0x07, 0x0e
       
   242 	.byte	0xa5, 0xb3, 0xa6, 0x30
       
   243 	.byte	0xa8, 0xcc, 0x09, 0x12
       
   244 	.byte	0xad, 0xb4, 0xa6, 0x34
       
   245 	.byte	0xb0, 0xcd, 0x0b, 0x16
       
   246 	.byte	0xb5, 0xb5, 0xa6, 0x38
       
   247 	.byte	0xb8, 0xce, 0x0d, 0x1a
       
   248 	.byte	0xbd, 0xb6, 0xa6, 0x3c
       
   249 	.byte	0x82, 0xcf, 0x0f, 0x1e
       
   250 	.byte	0x87, 0xb7, 0xa6, 0x21
       
   251 	.byte	0x8a, 0xc8, 0x51, 0x03
       
   252 	.byte	0x8f, 0xb0, 0xe6, 0x25
       
   253 	.byte	0x92, 0xc9, 0x53, 0x07
       
   254 	.byte	0x97, 0xb1, 0xe6, 0x29
       
   255 
       
   256 !copy expanded key back into array
       
   257 	std	%f4, [%o0]
       
   258 	std	%f6, [%o0 + 0x8]
       
   259 	std	%f8, [%o0 + 0x10]
       
   260 	std	%f10, [%o0 + 0x18]
       
   261 	std	%f12, [%o0 + 0x20]
       
   262 	std	%f14, [%o0 + 0x28]
       
   263 	std	%f16, [%o0 + 0x30]
       
   264 	std	%f18, [%o0 + 0x38]
       
   265 	std	%f20, [%o0 + 0x40]
       
   266 	std	%f22, [%o0 + 0x48]
       
   267 	std	%f24, [%o0 + 0x50]
       
   268 	std	%f26, [%o0 + 0x58]
       
   269 	std	%f28, [%o0 + 0x60]
       
   270 	std	%f30, [%o0 + 0x68]
       
   271 	std	%f32, [%o0 + 0x70]
       
   272 	std	%f34, [%o0 + 0x78]
       
   273 	std	%f36, [%o0 + 0x80]
       
   274 	std	%f38, [%o0 + 0x88]
       
   275 	std	%f40, [%o0 + 0x90]
       
   276 	retl
       
   277 	std	%f42, [%o0 + 0x98]
       
   278 
       
   279 	SET_SIZE(t4_aes_expand128)
       
   280 
       
   281 
       
   282 	ENTRY(t4_aes_expand192)
       
   283 
       
   284 !load key
       
   285 	ld	[%o1], %f0
       
   286 	ld	[%o1 + 0x4], %f1
       
   287 	ld	[%o1 + 0x8], %f2
       
   288 	ld	[%o1 + 0xc], %f3
       
   289 	ld	[%o1 + 0x10], %f4
       
   290 	ld	[%o1 + 0x14], %f5
       
   291 
       
   292 !expand the key
       
   293 	!aes_kexpand1 %f0, %f4, 0x0, %f6
       
   294 	!aes_kexpand2 %f2, %f6, %f8
       
   295 	!aes_kexpand2 %f4, %f8, %f10
       
   296 
       
   297 	!aes_kexpand1 %f6, %f10, 0x1, %f12
       
   298 	!aes_kexpand2 %f8, %f12, %f14
       
   299 	!aes_kexpand2 %f10, %f14, %f16
       
   300 
       
   301 	!aes_kexpand1 %f12, %f16, 0x2, %f18
       
   302 	!aes_kexpand2 %f14, %f18, %f20
       
   303 	!aes_kexpand2 %f16, %f20, %f22
       
   304 
       
   305 	!aes_kexpand1 %f18, %f22, 0x3, %f24
       
   306 	!aes_kexpand2 %f20, %f24, %f26
       
   307 	!aes_kexpand2 %f22, %f26, %f28
       
   308 
       
   309 	!aes_kexpand1 %f24, %f28, 0x4, %f30
       
   310 	!aes_kexpand2 %f26, %f30, %f32
       
   311 	!aes_kexpand2 %f28, %f32, %f34
       
   312 
       
   313 	!aes_kexpand1 %f30, %f34, 0x5, %f36
       
   314 	!aes_kexpand2 %f32, %f36, %f38
       
   315 	!aes_kexpand2 %f34, %f38, %f40
       
   316 
       
   317 	!aes_kexpand1 %f36, %f40, 0x6, %f42
       
   318 	!aes_kexpand2 %f38, %f42, %f44
       
   319 	!aes_kexpand2 %f40, %f44, %f46
       
   320 
       
   321 	!aes_kexpand1 %f42, %f46, 0x7, %f48
       
   322 	!aes_kexpand2 %f44, %f48, %f50
       
   323 	.byte	0x8c, 0xc8, 0x01, 0x04
       
   324 	.byte	0x91, 0xb0, 0xa6, 0x26
       
   325 	.byte	0x95, 0xb1, 0x26, 0x28
       
   326 	.byte	0x98, 0xc9, 0x83, 0x0a
       
   327 	.byte	0x9d, 0xb2, 0x26, 0x2c
       
   328 	.byte	0xa1, 0xb2, 0xa6, 0x2e
       
   329 	.byte	0xa4, 0xcb, 0x05, 0x10
       
   330 	.byte	0xa9, 0xb3, 0xa6, 0x32
       
   331 	.byte	0xad, 0xb4, 0x26, 0x34
       
   332 	.byte	0xb0, 0xcc, 0x87, 0x16
       
   333 	.byte	0xb5, 0xb5, 0x26, 0x38
       
   334 	.byte	0xb9, 0xb5, 0xa6, 0x3a
       
   335 	.byte	0xbc, 0xce, 0x09, 0x1c
       
   336 	.byte	0x83, 0xb6, 0xa6, 0x3e
       
   337 	.byte	0x87, 0xb7, 0x26, 0x21
       
   338 	.byte	0x8a, 0xcf, 0x8b, 0x03
       
   339 	.byte	0x8f, 0xb0, 0x66, 0x25
       
   340 	.byte	0x93, 0xb0, 0xe6, 0x27
       
   341 	.byte	0x96, 0xc9, 0x4d, 0x09
       
   342 	.byte	0x9b, 0xb1, 0xe6, 0x2b
       
   343 	.byte	0x9f, 0xb2, 0x66, 0x2d
       
   344 	.byte	0xa2, 0xca, 0xcf, 0x0f
       
   345 	.byte	0xa7, 0xb3, 0x66, 0x31
       
   346 
       
   347 !copy expanded key back into array
       
   348 	std	%f6, [%o0]
       
   349 	std	%f8, [%o0 + 0x8]
       
   350 	std	%f10, [%o0 + 0x10]
       
   351 	std	%f12, [%o0 + 0x18]
       
   352 	std	%f14, [%o0 + 0x20]
       
   353 	std	%f16, [%o0 + 0x28]
       
   354 	std	%f18, [%o0 + 0x30]
       
   355 	std	%f20, [%o0 + 0x38]
       
   356 	std	%f22, [%o0 + 0x40]
       
   357 	std	%f24, [%o0 + 0x48]
       
   358 	std	%f26, [%o0 + 0x50]
       
   359 	std	%f28, [%o0 + 0x58]
       
   360 	std	%f30, [%o0 + 0x60]
       
   361 	std	%f32, [%o0 + 0x68]
       
   362 	std	%f34, [%o0 + 0x70]
       
   363 	std	%f36, [%o0 + 0x78]
       
   364 	std	%f38, [%o0 + 0x80]
       
   365 	std	%f40, [%o0 + 0x88]
       
   366 	std	%f42, [%o0 + 0x90]
       
   367 	std	%f44, [%o0 + 0x98]
       
   368 	std	%f46, [%o0 + 0xa0]
       
   369 	std	%f48, [%o0 + 0xa8]
       
   370 	retl
       
   371 	std	%f50, [%o0 + 0xb0]
       
   372 
       
   373 	SET_SIZE(t4_aes_expand192)
       
   374 
       
   375 
       
   376 	ENTRY(t4_aes_expand256)
       
   377 
       
   378 !load key
       
   379 	ld	[%o1], %f0
       
   380 	ld	[%o1 + 0x4], %f1
       
   381 	ld	[%o1 + 0x8], %f2
       
   382 	ld	[%o1 + 0xc], %f3
       
   383 	ld	[%o1 + 0x10], %f4
       
   384 	ld	[%o1 + 0x14], %f5
       
   385 	ld	[%o1 + 0x18], %f6
       
   386 	ld	[%o1 + 0x1c], %f7
       
   387 
       
   388 !expand the key
       
   389 	!aes_kexpand1 %f0, %f6, 0x0, %f8
       
   390 	!aes_kexpand2 %f2, %f8, %f10
       
   391 	!aes_kexpand0 %f4, %f10, %f12
       
   392 	!aes_kexpand2 %f6, %f12, %f14
       
   393 
       
   394 	!aes_kexpand1 %f8, %f14, 0x1, %f16
       
   395 	!aes_kexpand2 %f10, %f16, %f18
       
   396 	!aes_kexpand0 %f12, %f18, %f20
       
   397 	!aes_kexpand2 %f14, %f20, %f22
       
   398 
       
   399 	!aes_kexpand1 %f16, %f22, 0x2, %f24
       
   400 	!aes_kexpand2 %f18, %f24, %f26
       
   401 	!aes_kexpand0 %f20, %f26, %f28
       
   402 	!aes_kexpand2 %f22, %f28, %f30
       
   403 
       
   404 	!aes_kexpand1 %f24, %f30, 0x3, %f32
       
   405 	!aes_kexpand2 %f26, %f32, %f34
       
   406 	!aes_kexpand0 %f28, %f34, %f36
       
   407 	!aes_kexpand2 %f30, %f36, %f38
       
   408 
       
   409 	!aes_kexpand1 %f32, %f38, 0x4, %f40
       
   410 	!aes_kexpand2 %f34, %f40, %f42
       
   411 	!aes_kexpand0 %f36, %f42, %f44
       
   412 	!aes_kexpand2 %f38, %f44, %f46
       
   413 
       
   414 	!aes_kexpand1 %f40, %f46, 0x5, %f48
       
   415 	!aes_kexpand2 %f42, %f48, %f50
       
   416 	!aes_kexpand0 %f44, %f50, %f52
       
   417 	!aes_kexpand2 %f46, %f52, %f54
       
   418 
       
   419 	!aes_kexpand1 %f48, %f54, 0x6, %f56
       
   420 	!aes_kexpand2 %f50, %f56, %f58
       
   421 	.byte	0x90, 0xc8, 0x01, 0x06
       
   422 	.byte	0x95, 0xb0, 0xa6, 0x28
       
   423 	.byte	0x99, 0xb1, 0x26, 0x0a
       
   424 	.byte	0x9d, 0xb1, 0xa6, 0x2c
       
   425 	.byte	0xa0, 0xca, 0x03, 0x0e
       
   426 	.byte	0xa5, 0xb2, 0xa6, 0x30
       
   427 	.byte	0xa9, 0xb3, 0x26, 0x12
       
   428 	.byte	0xad, 0xb3, 0xa6, 0x34
       
   429 	.byte	0xb0, 0xcc, 0x05, 0x16
       
   430 	.byte	0xb5, 0xb4, 0xa6, 0x38
       
   431 	.byte	0xb9, 0xb5, 0x26, 0x1a
       
   432 	.byte	0xbd, 0xb5, 0xa6, 0x3c
       
   433 	.byte	0x82, 0xce, 0x07, 0x1e
       
   434 	.byte	0x87, 0xb6, 0xa6, 0x21
       
   435 	.byte	0x8b, 0xb7, 0x26, 0x03
       
   436 	.byte	0x8f, 0xb7, 0xa6, 0x25
       
   437 	.byte	0x92, 0xc8, 0x49, 0x07
       
   438 	.byte	0x97, 0xb0, 0xe6, 0x29
       
   439 	.byte	0x9b, 0xb1, 0x66, 0x0b
       
   440 	.byte	0x9f, 0xb1, 0xe6, 0x2d
       
   441 	.byte	0xa2, 0xca, 0x4b, 0x0f
       
   442 	.byte	0xa7, 0xb2, 0xe6, 0x31
       
   443 	.byte	0xab, 0xb3, 0x66, 0x13
       
   444 	.byte	0xaf, 0xb3, 0xe6, 0x35
       
   445 	.byte	0xb2, 0xcc, 0x4d, 0x17
       
   446 	.byte	0xb7, 0xb4, 0xe6, 0x39
       
   447 
       
   448 !copy expanded key back into array
       
   449 	std	%f8, [%o0]
       
   450 	std	%f10, [%o0 + 0x8]
       
   451 	std	%f12, [%o0 + 0x10]
       
   452 	std	%f14, [%o0 + 0x18]
       
   453 	std	%f16, [%o0 + 0x20]
       
   454 	std	%f18, [%o0 + 0x28]
       
   455 	std	%f20, [%o0 + 0x30]
       
   456 	std	%f22, [%o0 + 0x38]
       
   457 	std	%f24, [%o0 + 0x40]
       
   458 	std	%f26, [%o0 + 0x48]
       
   459 	std	%f28, [%o0 + 0x50]
       
   460 	std	%f30, [%o0 + 0x58]
       
   461 	std	%f32, [%o0 + 0x60]
       
   462 	std	%f34, [%o0 + 0x68]
       
   463 	std	%f36, [%o0 + 0x70]
       
   464 	std	%f38, [%o0 + 0x78]
       
   465 	std	%f40, [%o0 + 0x80]
       
   466 	std	%f42, [%o0 + 0x88]
       
   467 	std	%f44, [%o0 + 0x90]
       
   468 	std	%f46, [%o0 + 0x98]
       
   469 	std	%f48, [%o0 + 0xa0]
       
   470 	std	%f50, [%o0 + 0xa8]
       
   471 	std	%f52, [%o0 + 0xb0]
       
   472 	std	%f54, [%o0 + 0xb8]
       
   473 	std	%f56, [%o0 + 0xc0]
       
   474 	retl
       
   475 	std	%f58, [%o0 + 0xc8]
       
   476 
       
   477 	SET_SIZE(t4_aes_expand256)
       
   478 
       
   479 
       
   480 #define	FIRST_TWO_EROUNDS \
       
   481 	.byte	0xb2, 0xc8, 0x3e, 0x1d ; \
       
   482 	.byte	0xb6, 0xc8, 0xbe, 0x3d ; \
       
   483 	.byte	0xba, 0xc9, 0x36, 0x19 ; \
       
   484 	.byte	0xbe, 0xc9, 0xb6, 0x39
       
   485 	!aes_eround01	%f0, %f60, %f62, %f56 ; \
       
   486 	!aes_eround23	%f2, %f60, %f62, %f58 ; \
       
   487 	!aes_eround01	%f4, %f56, %f58, %f60 ; \
       
   488 	!aes_eround23	%f6, %f56, %f58, %f62
       
   489 
       
   490 #define	MID_TWO_EROUNDS \
       
   491 	.byte	0xb2, 0xca, 0x3e, 0x1d ; \
       
   492 	.byte	0xb6, 0xca, 0xbe, 0x3d ; \
       
   493 	.byte	0xba, 0xcb, 0x36, 0x19 ; \
       
   494 	.byte	0xbe, 0xcb, 0xb6, 0x39
       
   495 	!aes_eround01	%f8, %f60, %f62, %f56 ; \
       
   496 	!aes_eround23	%f10, %f60, %f62, %f58 ; \
       
   497 	!aes_eround01	%f12, %f56, %f58, %f60 ; \
       
   498 	!aes_eround23	%f14, %f56, %f58, %f62
       
   499 
       
   500 #define	MID_TWO_EROUNDS_2 \
       
   501 	.byte	0x8c, 0xca, 0x04, 0x00 ; \
       
   502 	.byte	0x88, 0xca, 0x84, 0x20 ; \
       
   503 	.byte	0xb2, 0xca, 0x3e, 0x1d ; \
       
   504 	.byte	0xb6, 0xca, 0xbe, 0x3d ; \
       
   505 	.byte	0x80, 0xcb, 0x08, 0x06 ; \
       
   506 	.byte	0x84, 0xcb, 0x88, 0x26 ; \
       
   507 	.byte	0xba, 0xcb, 0x36, 0x19 ; \
       
   508 	.byte	0xbe, 0xcb, 0xb6, 0x39
       
   509 	!aes_eround01	%f8, %f0, %f2, %f6 ; \
       
   510 	!aes_eround23	%f10, %f0, %f2, %f4 ; \
       
   511 	!aes_eround01	%f8, %f60, %f62, %f56 ; \
       
   512 	!aes_eround23	%f10, %f60, %f62, %f58 ; \
       
   513 	!aes_eround01	%f12, %f6, %f4, %f0 ; \
       
   514 	!aes_eround23	%f14, %f6, %f4, %f2 ; \
       
   515 	!aes_eround01	%f12, %f56, %f58, %f60 ; \
       
   516 	!aes_eround23	%f14, %f56, %f58, %f62
       
   517 
       
   518 #define	TEN_EROUNDS \
       
   519 	.byte	0xb2, 0xcc, 0x3e, 0x1d ; \
       
   520 	.byte	0xb6, 0xcc, 0xbe, 0x3d ; \
       
   521 	.byte	0xba, 0xcd, 0x36, 0x19 ; \
       
   522 	.byte	0xbe, 0xcd, 0xb6, 0x39 ; \
       
   523 	.byte	0xb2, 0xce, 0x3e, 0x1d ; \
       
   524 	.byte	0xb6, 0xce, 0xbe, 0x3d ; \
       
   525 	.byte	0xba, 0xcf, 0x36, 0x19 ; \
       
   526 	.byte	0xbe, 0xcf, 0xb6, 0x39 ; \
       
   527 	.byte	0xb2, 0xc8, 0x7e, 0x1d ; \
       
   528 	.byte	0xb6, 0xc8, 0xfe, 0x3d ; \
       
   529 	.byte	0xba, 0xc9, 0x76, 0x19 ; \
       
   530 	.byte	0xbe, 0xc9, 0xf6, 0x39 ; \
       
   531 	.byte	0xb2, 0xca, 0x7e, 0x1d ; \
       
   532 	.byte	0xb6, 0xca, 0xfe, 0x3d ; \
       
   533 	.byte	0xba, 0xcb, 0x76, 0x19 ; \
       
   534 	.byte	0xbe, 0xcb, 0xf6, 0x39 ; \
       
   535 	.byte	0xb2, 0xcc, 0x7e, 0x1d ; \
       
   536 	.byte	0xb6, 0xcc, 0xfe, 0x3d ; \
       
   537 	.byte	0xba, 0xcd, 0x76, 0x99 ; \
       
   538 	.byte	0xbe, 0xcd, 0xf6, 0xb9
       
   539 	!aes_eround01	%f16, %f60, %f62, %f56 ; \
       
   540 	!aes_eround23	%f18, %f60, %f62, %f58 ; \
       
   541 	!aes_eround01	%f20, %f56, %f58, %f60 ; \
       
   542 	!aes_eround23	%f22, %f56, %f58, %f62 ; \
       
   543 	!aes_eround01	%f24, %f60, %f62, %f56 ; \
       
   544 	!aes_eround23	%f26, %f60, %f62, %f58 ; \
       
   545 	!aes_eround01	%f28, %f56, %f58, %f60 ; \
       
   546 	!aes_eround23	%f30, %f56, %f58, %f62 ; \
       
   547 	!aes_eround01	%f32, %f60, %f62, %f56 ; \
       
   548 	!aes_eround23	%f34, %f60, %f62, %f58 ; \
       
   549 	!aes_eround01	%f36, %f56, %f58, %f60 ; \
       
   550 	!aes_eround23	%f38, %f56, %f58, %f62 ; \
       
   551 	!aes_eround01	%f40, %f60, %f62, %f56 ; \
       
   552 	!aes_eround23	%f42, %f60, %f62, %f58 ; \
       
   553 	!aes_eround01	%f44, %f56, %f58, %f60 ; \
       
   554 	!aes_eround23	%f46, %f56, %f58, %f62 ; \
       
   555 	!aes_eround01	%f48, %f60, %f62, %f56 ; \
       
   556 	!aes_eround23	%f50, %f60, %f62, %f58 ; \
       
   557 	!aes_eround01_l	%f52, %f56, %f58, %f60 ; \
       
   558 	!aes_eround23_l	%f54, %f56, %f58, %f62
       
   559 
       
   560 #define	TEN_EROUNDS_2 \
       
   561 	.byte	0x8c, 0xcc, 0x04, 0x00 ; \
       
   562 	.byte	0x88, 0xcc, 0x84, 0x20 ; \
       
   563 	.byte	0xb2, 0xcc, 0x3e, 0x1d ; \
       
   564 	.byte	0xb6, 0xcc, 0xbe, 0x3d ; \
       
   565 	.byte	0x80, 0xcd, 0x08, 0x06 ; \
       
   566 	.byte	0x84, 0xcd, 0x88, 0x26 ; \
       
   567 	.byte	0xba, 0xcd, 0x36, 0x19 ; \
       
   568 	.byte	0xbe, 0xcd, 0xb6, 0x39 ; \
       
   569 	.byte	0x8c, 0xce, 0x04, 0x00 ; \
       
   570 	.byte	0x88, 0xce, 0x84, 0x20 ; \
       
   571 	.byte	0xb2, 0xce, 0x3e, 0x1d ; \
       
   572 	.byte	0xb6, 0xce, 0xbe, 0x3d ; \
       
   573 	.byte	0x80, 0xcf, 0x08, 0x06 ; \
       
   574 	.byte	0x84, 0xcf, 0x88, 0x26 ; \
       
   575 	.byte	0xba, 0xcf, 0x36, 0x19 ; \
       
   576 	.byte	0xbe, 0xcf, 0xb6, 0x39 ; \
       
   577 	.byte	0x8c, 0xc8, 0x44, 0x00 ; \
       
   578 	.byte	0x88, 0xc8, 0xc4, 0x20 ; \
       
   579 	.byte	0xb2, 0xc8, 0x7e, 0x1d ; \
       
   580 	.byte	0xb6, 0xc8, 0xfe, 0x3d ; \
       
   581 	.byte	0x80, 0xc9, 0x48, 0x06 ; \
       
   582 	.byte	0x84, 0xc9, 0xc8, 0x26 ; \
       
   583 	.byte	0xba, 0xc9, 0x76, 0x19 ; \
       
   584 	.byte	0xbe, 0xc9, 0xf6, 0x39 ; \
       
   585 	.byte	0x8c, 0xca, 0x44, 0x00 ; \
       
   586 	.byte	0x88, 0xca, 0xc4, 0x20 ; \
       
   587 	.byte	0xb2, 0xca, 0x7e, 0x1d ; \
       
   588 	.byte	0xb6, 0xca, 0xfe, 0x3d ; \
       
   589 	.byte	0x80, 0xcb, 0x48, 0x06 ; \
       
   590 	.byte	0x84, 0xcb, 0xc8, 0x26 ; \
       
   591 	.byte	0xba, 0xcb, 0x76, 0x19 ; \
       
   592 	.byte	0xbe, 0xcb, 0xf6, 0x39 ; \
       
   593 	.byte	0x8c, 0xcc, 0x44, 0x00 ; \
       
   594 	.byte	0x88, 0xcc, 0xc4, 0x20 ; \
       
   595 	.byte	0xb2, 0xcc, 0x7e, 0x1d ; \
       
   596 	.byte	0xb6, 0xcc, 0xfe, 0x3d ; \
       
   597 	.byte	0x80, 0xcd, 0x48, 0x86 ; \
       
   598 	.byte	0x84, 0xcd, 0xc8, 0xa6 ; \
       
   599 	.byte	0xba, 0xcd, 0x76, 0x99 ; \
       
   600 	.byte	0xbe, 0xcd, 0xf6, 0xb9
       
   601 	!aes_eround01	%f16, %f0, %f2, %f6 ; \
       
   602 	!aes_eround23	%f18, %f0, %f2, %f4 ; \
       
   603 	!aes_eround01	%f16, %f60, %f62, %f56 ; \
       
   604 	!aes_eround23	%f18, %f60, %f62, %f58 ; \
       
   605 	!aes_eround01	%f20, %f6, %f4, %f0 ; \
       
   606 	!aes_eround23	%f22, %f6, %f4, %f2 ; \
       
   607 	!aes_eround01	%f20, %f56, %f58, %f60 ; \
       
   608 	!aes_eround23	%f22, %f56, %f58, %f62 ; \
       
   609 	!aes_eround01	%f24, %f0, %f2, %f6 ; \
       
   610 	!aes_eround23	%f26, %f0, %f2, %f4 ; \
       
   611 	!aes_eround01	%f24, %f60, %f62, %f56 ; \
       
   612 	!aes_eround23	%f26, %f60, %f62, %f58 ; \
       
   613 	!aes_eround01	%f28, %f6, %f4, %f0 ; \
       
   614 	!aes_eround23	%f30, %f6, %f4, %f2 ; \
       
   615 	!aes_eround01	%f28, %f56, %f58, %f60 ; \
       
   616 	!aes_eround23	%f30, %f56, %f58, %f62 ; \
       
   617 	!aes_eround01	%f32, %f0, %f2, %f6 ; \
       
   618 	!aes_eround23	%f34, %f0, %f2, %f4 ; \
       
   619 	!aes_eround01	%f32, %f60, %f62, %f56 ; \
       
   620 	!aes_eround23	%f34, %f60, %f62, %f58 ; \
       
   621 	!aes_eround01	%f36, %f6, %f4, %f0 ; \
       
   622 	!aes_eround23	%f38, %f6, %f4, %f2 ; \
       
   623 	!aes_eround01	%f36, %f56, %f58, %f60 ; \
       
   624 	!aes_eround23	%f38, %f56, %f58, %f62 ; \
       
   625 	!aes_eround01	%f40, %f0, %f2, %f6 ; \
       
   626 	!aes_eround23	%f42, %f0, %f2, %f4 ; \
       
   627 	!aes_eround01	%f40, %f60, %f62, %f56 ; \
       
   628 	!aes_eround23	%f42, %f60, %f62, %f58 ; \
       
   629 	!aes_eround01	%f44, %f6, %f4, %f0 ; \
       
   630 	!aes_eround23	%f46, %f6, %f4, %f2 ; \
       
   631 	!aes_eround01	%f44, %f56, %f58, %f60 ; \
       
   632 	!aes_eround23	%f46, %f56, %f58, %f62 ; \
       
   633 	!aes_eround01	%f48, %f0, %f2, %f6 ; \
       
   634 	!aes_eround23	%f50, %f0, %f2, %f4 ; \
       
   635 	!aes_eround01	%f48, %f60, %f62, %f56 ; \
       
   636 	!aes_eround23	%f50, %f60, %f62, %f58 ; \
       
   637 	!aes_eround01_l	%f52, %f6, %f4, %f0 ; \
       
   638 	!aes_eround23_l	%f54, %f6, %f4, %f2 ; \
       
   639 	!aes_eround01_l	%f52, %f56, %f58, %f60 ; \
       
   640 	!aes_eround23_l	%f54, %f56, %f58, %f62
       
   641 
       
   642 #define	TWELVE_EROUNDS \
       
   643 	MID_TWO_EROUNDS	; \
       
   644 	TEN_EROUNDS
       
   645 
       
   646 #define	TWELVE_EROUNDS_2 \
       
   647 	MID_TWO_EROUNDS_2	; \
       
   648 	TEN_EROUNDS_2
       
   649 
       
   650 #define	FOURTEEN_EROUNDS \
       
   651 	FIRST_TWO_EROUNDS ; \
       
   652 	TWELVE_EROUNDS
       
   653 
       
   654 #define	FOURTEEN_EROUNDS_2 \
       
   655 	.byte	0xb0, 0xc8, 0x2c, 0x14 ; \
       
   656 	.byte	0xac, 0xc8, 0xac, 0x34 ; \
       
   657 	ldd	[%o0 + 0x60], %f20 ; \
       
   658 	.byte	0xb2, 0xc8, 0x3e, 0x1d ; \
       
   659 	.byte	0xb6, 0xc8, 0xbe, 0x3d ; \
       
   660 	.byte	0x80, 0xc9, 0x2c, 0x18 ; \
       
   661 	.byte	0x84, 0xc9, 0xac, 0x38 ;\
       
   662 	ldd	[%o0 + 0x68], %f22 ; \
       
   663 	.byte	0xba, 0xc9, 0x36, 0x19 ; \
       
   664 	ldd	[%o0 + 0x70], %f24 ; \
       
   665 	.byte	0xbe, 0xc9, 0xb6, 0x39 ; \
       
   666 	.byte	0x8c, 0xca, 0x04, 0x00 ; \
       
   667 	.byte	0x88, 0xca, 0x84, 0x20 ; \
       
   668 	.byte	0xb2, 0xca, 0x3e, 0x1d ; \
       
   669 	.byte	0xb6, 0xca, 0xbe, 0x3d ; \
       
   670 	.byte	0x80, 0xcb, 0x08, 0x06 ; \
       
   671 	.byte	0x84, 0xcb, 0x88, 0x26 ; \
       
   672 	.byte	0xba, 0xcb, 0x36, 0x19 ; \
       
   673 	.byte	0xbe, 0xcb, 0xb6, 0x39 ; \
       
   674 	.byte	0x8c, 0xcc, 0x04, 0x00 ; \
       
   675 	.byte	0x88, 0xcc, 0x84, 0x20 ; \
       
   676 	.byte	0xb2, 0xcc, 0x3e, 0x1d ; \
       
   677 	.byte	0xb6, 0xcc, 0xbe, 0x3d ; \
       
   678 	.byte	0x80, 0xcd, 0x08, 0x06 ; \
       
   679 	.byte	0x84, 0xcd, 0x88, 0x26 ; \
       
   680 	.byte	0xba, 0xcd, 0x36, 0x19 ; \
       
   681 	.byte	0xbe, 0xcd, 0xb6, 0x39 ; \
       
   682 	.byte	0x8c, 0xce, 0x04, 0x00 ; \
       
   683 	.byte	0x88, 0xce, 0x84, 0x20 ; \
       
   684 	.byte	0xb2, 0xce, 0x3e, 0x1d ; \
       
   685 	.byte	0xb6, 0xce, 0xbe, 0x3d ; \
       
   686 	.byte	0x80, 0xcf, 0x08, 0x06 ; \
       
   687 	.byte	0x84, 0xcf, 0x88, 0x26 ; \
       
   688 	.byte	0xba, 0xcf, 0x36, 0x19 ; \
       
   689 	.byte	0xbe, 0xcf, 0xb6, 0x39 ; \
       
   690 	.byte	0x8c, 0xc8, 0x44, 0x00 ; \
       
   691 	.byte	0x88, 0xc8, 0xc4, 0x20 ; \
       
   692 	.byte	0xb2, 0xc8, 0x7e, 0x1d ; \
       
   693 	.byte	0xb6, 0xc8, 0xfe, 0x3d ; \
       
   694 	.byte	0x80, 0xc9, 0x48, 0x06 ; \
       
   695 	.byte	0x84, 0xc9, 0xc8, 0x26 ; \
       
   696 	.byte	0xba, 0xc9, 0x76, 0x19 ; \
       
   697 	.byte	0xbe, 0xc9, 0xf6, 0x39 ; \
       
   698 	.byte	0x8c, 0xca, 0x44, 0x00 ; \
       
   699 	.byte	0x88, 0xca, 0xc4, 0x20 ; \
       
   700 	.byte	0xb2, 0xca, 0x7e, 0x1d ; \
       
   701 	.byte	0xb6, 0xca, 0xfe, 0x3d ; \
       
   702 	.byte	0x80, 0xcb, 0x48, 0x06 ; \
       
   703 	.byte	0x84, 0xcb, 0xc8, 0x26 ; \
       
   704 	.byte	0xba, 0xcb, 0x76, 0x19 ; \
       
   705 	.byte	0xbe, 0xcb, 0xf6, 0x39 ; \
       
   706 	.byte	0x8c, 0xcc, 0x44, 0x00 ; \
       
   707 	.byte	0x88, 0xcc, 0xc4, 0x20 ; \
       
   708 	ldd	[%o0 + 0x10], %f0 ; \
       
   709 	.byte	0xb2, 0xcc, 0x7e, 0x1d ; \
       
   710 	ldd	[%o0 + 0x18], %f2 ; \
       
   711 	.byte	0xb6, 0xcc, 0xfe, 0x3d ; \
       
   712 	.byte	0xa8, 0xcd, 0x48, 0x86 ; \
       
   713 	.byte	0xac, 0xcd, 0xc8, 0xa6 ; \
       
   714 	ldd	[%o0 + 0x20], %f4 ; \
       
   715 	.byte	0xba, 0xcd, 0x76, 0x99 ; \
       
   716 	ldd	[%o0 + 0x28], %f6 ; \
       
   717 	.byte	0xbe, 0xcd, 0xf6, 0xb9
       
   718 	!aes_eround01	%f0, %f20, %f22, %f24 ; \
       
   719 	!aes_eround23	%f2, %f20, %f22, %f22 ; \
       
   720 	!ldd	[%o0 + 0x60], %f20 ; \
       
   721 	!aes_eround01	%f0, %f60, %f62, %f56 ; \
       
   722 	!aes_eround23	%f2, %f60, %f62, %f58 ; \
       
   723 	!aes_eround01	%f4, %f24, %f22, %f0 ; \
       
   724 	!aes_eround23	%f6, %f24, %f22, %f2 ; \
       
   725 	!ldd	[%o0 + 0x68], %f22 ; \
       
   726 	!aes_eround01	%f4, %f56, %f58, %f60 ; \
       
   727 	!ldd	[%o0 + 0x70], %f24 ; \
       
   728 	!aes_eround23	%f6, %f56, %f58, %f62 ; \
       
   729 	!aes_eround01	%f8, %f0, %f2, %f6 ; \
       
   730 	!aes_eround23	%f10, %f0, %f2, %f4 ; \
       
   731 	!aes_eround01	%f8, %f60, %f62, %f56 ; \
       
   732 	!aes_eround23	%f10, %f60, %f62, %f58 ; \
       
   733 	!aes_eround01	%f12, %f6, %f4, %f0 ; \
       
   734 	!aes_eround23	%f14, %f6, %f4, %f2 ; \
       
   735 	!aes_eround01	%f12, %f56, %f58, %f60 ; \
       
   736 	!aes_eround23	%f14, %f56, %f58, %f62 ; \
       
   737 	!aes_eround01	%f16, %f0, %f2, %f6 ; \
       
   738 	!aes_eround23	%f18, %f0, %f2, %f4 ; \
       
   739 	!aes_eround01	%f16, %f60, %f62, %f56 ; \
       
   740 	!aes_eround23	%f18, %f60, %f62, %f58 ; \
       
   741 	!aes_eround01	%f20, %f6, %f4, %f0 ; \
       
   742 	!aes_eround23	%f22, %f6, %f4, %f2 ; \
       
   743 	!aes_eround01	%f20, %f56, %f58, %f60 ; \
       
   744 	!aes_eround23	%f22, %f56, %f58, %f62 ; \
       
   745 	!aes_eround01	%f24, %f0, %f2, %f6 ; \
       
   746 	!aes_eround23	%f26, %f0, %f2, %f4 ; \
       
   747 	!aes_eround01	%f24, %f60, %f62, %f56 ; \
       
   748 	!aes_eround23	%f26, %f60, %f62, %f58 ; \
       
   749 	!aes_eround01	%f28, %f6, %f4, %f0 ; \
       
   750 	!aes_eround23	%f30, %f6, %f4, %f2 ; \
       
   751 	!aes_eround01	%f28, %f56, %f58, %f60 ; \
       
   752 	!aes_eround23	%f30, %f56, %f58, %f62 ; \
       
   753 	!aes_eround01	%f32, %f0, %f2, %f6 ; \
       
   754 	!aes_eround23	%f34, %f0, %f2, %f4 ; \
       
   755 	!aes_eround01	%f32, %f60, %f62, %f56 ; \
       
   756 	!aes_eround23	%f34, %f60, %f62, %f58 ; \
       
   757 	!aes_eround01	%f36, %f6, %f4, %f0 ; \
       
   758 	!aes_eround23	%f38, %f6, %f4, %f2 ; \
       
   759 	!aes_eround01	%f36, %f56, %f58, %f60 ; \
       
   760 	!aes_eround23	%f38, %f56, %f58, %f62 ; \
       
   761 	!aes_eround01	%f40, %f0, %f2, %f6 ; \
       
   762 	!aes_eround23	%f42, %f0, %f2, %f4 ; \
       
   763 	!aes_eround01	%f40, %f60, %f62, %f56 ; \
       
   764 	!aes_eround23	%f42, %f60, %f62, %f58 ; \
       
   765 	!aes_eround01	%f44, %f6, %f4, %f0 ; \
       
   766 	!aes_eround23	%f46, %f6, %f4, %f2 ; \
       
   767 	!aes_eround01	%f44, %f56, %f58, %f60 ; \
       
   768 	!aes_eround23	%f46, %f56, %f58, %f62 ; \
       
   769 	!aes_eround01	%f48, %f0, %f2, %f6 ; \
       
   770 	!aes_eround23	%f50, %f0, %f2, %f4 ; \
       
   771 	!ldd	[%o0 + 0x10], %f0 ; \
       
   772 	!aes_eround01	%f48, %f60, %f62, %f56 ; \
       
   773 	!ldd	[%o0 + 0x18], %f2 ; \
       
   774 	!aes_eround23	%f50, %f60, %f62, %f58 ; \
       
   775 	!aes_eround01_l	%f52, %f6, %f4, %f20 ; \
       
   776 	!aes_eround23_l	%f54, %f6, %f4, %f22 ; \
       
   777 	!ldd	[%o0 + 0x20], %f4 ; \
       
   778 	!aes_eround01_l	%f52, %f56, %f58, %f60 ; \
       
   779 	!ldd	[%o0 + 0x28], %f6 ; \
       
   780 	!aes_eround23_l	%f54, %f56, %f58, %f62
       
   781 
       
   782 #define	FIRST_TWO_DROUNDS \
       
   783 	.byte	0xb2, 0xc8, 0x3e, 0x5d ; \
       
   784 	.byte	0xb6, 0xc8, 0xbe, 0x7d ; \
       
   785 	.byte	0xba, 0xc9, 0x36, 0x59 ; \
       
   786 	.byte	0xbe, 0xc9, 0xb6, 0x79
       
   787 	!aes_dround01	%f0, %f60, %f62, %f56 ; \
       
   788 	!aes_dround23	%f2, %f60, %f62, %f58 ; \
       
   789 	!aes_dround01	%f4, %f56, %f58, %f60 ; \
       
   790 	!aes_dround23	%f6, %f56, %f58, %f62
       
   791 
       
   792 #define	MID_TWO_DROUNDS \
       
   793 	.byte	0xb2, 0xca, 0x3e, 0x5d ; \
       
   794 	.byte	0xb6, 0xca, 0xbe, 0x7d ; \
       
   795 	.byte	0xba, 0xcb, 0x36, 0x59 ; \
       
   796 	.byte	0xbe, 0xcb, 0xb6, 0x79
       
   797 	!aes_dround01	%f8, %f60, %f62, %f56 ; \
       
   798 	!aes_dround23	%f10, %f60, %f62, %f58 ; \
       
   799 	!aes_dround01	%f12, %f56, %f58, %f60 ; \
       
   800 	!aes_dround23	%f14, %f56, %f58, %f62
       
   801 
       
   802 #define	MID_TWO_DROUNDS_2 \
       
   803 	.byte	0x8c, 0xca, 0x04, 0x40 ; \
       
   804 	.byte	0x88, 0xca, 0x84, 0x60 ; \
       
   805 	.byte	0xb2, 0xca, 0x3e, 0x5d ; \
       
   806 	.byte	0xb6, 0xca, 0xbe, 0x7d ; \
       
   807 	.byte	0x80, 0xcb, 0x08, 0x46 ; \
       
   808 	.byte	0x84, 0xcb, 0x88, 0x66 ; \
       
   809 	.byte	0xba, 0xcb, 0x36, 0x59 ; \
       
   810 	.byte	0xbe, 0xcb, 0xb6, 0x79
       
   811 	!aes_dround01	%f8, %f0, %f2, %f6 ; \
       
   812 	!aes_dround23	%f10, %f0, %f2, %f4 ; \
       
   813 	!aes_dround01	%f8, %f60, %f62, %f56 ; \
       
   814 	!aes_dround23	%f10, %f60, %f62, %f58 ; \
       
   815 	!aes_dround01	%f12, %f6, %f4, %f0 ; \
       
   816 	!aes_dround23	%f14, %f6, %f4, %f2 ; \
       
   817 	!aes_dround01	%f12, %f56, %f58, %f60 ; \
       
   818 	!aes_dround23	%f14, %f56, %f58, %f62
       
   819 
       
   820 #define	TEN_DROUNDS \
       
   821 	.byte	0xb2, 0xcc, 0x3e, 0x5d ; \
       
   822 	.byte	0xb6, 0xcc, 0xbe, 0x7d ; \
       
   823 	.byte	0xba, 0xcd, 0x36, 0x59 ; \
       
   824 	.byte	0xbe, 0xcd, 0xb6, 0x79 ; \
       
   825 	.byte	0xb2, 0xce, 0x3e, 0x5d ; \
       
   826 	.byte	0xb6, 0xce, 0xbe, 0x7d ; \
       
   827 	.byte	0xba, 0xcf, 0x36, 0x59 ; \
       
   828 	.byte	0xbe, 0xcf, 0xb6, 0x79 ; \
       
   829 	.byte	0xb2, 0xc8, 0x7e, 0x5d ; \
       
   830 	.byte	0xb6, 0xc8, 0xfe, 0x7d ; \
       
   831 	.byte	0xba, 0xc9, 0x76, 0x59 ; \
       
   832 	.byte	0xbe, 0xc9, 0xf6, 0x79 ; \
       
   833 	.byte	0xb2, 0xca, 0x7e, 0x5d ; \
       
   834 	.byte	0xb6, 0xca, 0xfe, 0x7d ; \
       
   835 	.byte	0xba, 0xcb, 0x76, 0x59 ; \
       
   836 	.byte	0xbe, 0xcb, 0xf6, 0x79 ; \
       
   837 	.byte	0xb2, 0xcc, 0x7e, 0x5d ; \
       
   838 	.byte	0xb6, 0xcc, 0xfe, 0x7d ; \
       
   839 	.byte	0xba, 0xcd, 0x76, 0xd9 ; \
       
   840 	.byte	0xbe, 0xcd, 0xf6, 0xf9
       
   841 	!aes_dround01	%f16, %f60, %f62, %f56 ; \
       
   842 	!aes_dround23	%f18, %f60, %f62, %f58 ; \
       
   843 	!aes_dround01	%f20, %f56, %f58, %f60 ; \
       
   844 	!aes_dround23	%f22, %f56, %f58, %f62 ; \
       
   845 	!aes_dround01	%f24, %f60, %f62, %f56 ; \
       
   846 	!aes_dround23	%f26, %f60, %f62, %f58 ; \
       
   847 	!aes_dround01	%f28, %f56, %f58, %f60 ; \
       
   848 	!aes_dround23	%f30, %f56, %f58, %f62 ; \
       
   849 	!aes_dround01	%f32, %f60, %f62, %f56 ; \
       
   850 	!aes_dround23	%f34, %f60, %f62, %f58 ; \
       
   851 	!aes_dround01	%f36, %f56, %f58, %f60 ; \
       
   852 	!aes_dround23	%f38, %f56, %f58, %f62 ; \
       
   853 	!aes_dround01	%f40, %f60, %f62, %f56 ; \
       
   854 	!aes_dround23	%f42, %f60, %f62, %f58 ; \
       
   855 	!aes_dround01	%f44, %f56, %f58, %f60 ; \
       
   856 	!aes_dround23	%f46, %f56, %f58, %f62 ; \
       
   857 	!aes_dround01	%f48, %f60, %f62, %f56 ; \
       
   858 	!aes_dround23	%f50, %f60, %f62, %f58 ; \
       
   859 	!aes_dround01_l	%f52, %f56, %f58, %f60 ; \
       
   860 	!aes_dround23_l	%f54, %f56, %f58, %f62
       
   861 
       
   862 #define	TEN_DROUNDS_2 \
       
   863 	.byte	0x8c, 0xcc, 0x04, 0x40 ; \
       
   864 	.byte	0x88, 0xcc, 0x84, 0x60 ; \
       
   865 	.byte	0xb2, 0xcc, 0x3e, 0x5d ; \
       
   866 	.byte	0xb6, 0xcc, 0xbe, 0x7d ; \
       
   867 	.byte	0x80, 0xcd, 0x08, 0x46 ; \
       
   868 	.byte	0x84, 0xcd, 0x88, 0x66 ; \
       
   869 	.byte	0xba, 0xcd, 0x36, 0x59 ; \
       
   870 	.byte	0xbe, 0xcd, 0xb6, 0x79 ; \
       
   871 	.byte	0x8c, 0xce, 0x04, 0x40 ; \
       
   872 	.byte	0x88, 0xce, 0x84, 0x60 ; \
       
   873 	.byte	0xb2, 0xce, 0x3e, 0x5d ; \
       
   874 	.byte	0xb6, 0xce, 0xbe, 0x7d ; \
       
   875 	.byte	0x80, 0xcf, 0x08, 0x46 ; \
       
   876 	.byte	0x84, 0xcf, 0x88, 0x66 ; \
       
   877 	.byte	0xba, 0xcf, 0x36, 0x59 ; \
       
   878 	.byte	0xbe, 0xcf, 0xb6, 0x79 ; \
       
   879 	.byte	0x8c, 0xc8, 0x44, 0x40 ; \
       
   880 	.byte	0x88, 0xc8, 0xc4, 0x60 ; \
       
   881 	.byte	0xb2, 0xc8, 0x7e, 0x5d ; \
       
   882 	.byte	0xb6, 0xc8, 0xfe, 0x7d ; \
       
   883 	.byte	0x80, 0xc9, 0x48, 0x46 ; \
       
   884 	.byte	0x84, 0xc9, 0xc8, 0x66 ; \
       
   885 	.byte	0xba, 0xc9, 0x76, 0x59 ; \
       
   886 	.byte	0xbe, 0xc9, 0xf6, 0x79 ; \
       
   887 	.byte	0x8c, 0xca, 0x44, 0x40 ; \
       
   888 	.byte	0x88, 0xca, 0xc4, 0x60 ; \
       
   889 	.byte	0xb2, 0xca, 0x7e, 0x5d ; \
       
   890 	.byte	0xb6, 0xca, 0xfe, 0x7d ; \
       
   891 	.byte	0x80, 0xcb, 0x48, 0x46 ; \
       
   892 	.byte	0x84, 0xcb, 0xc8, 0x66 ; \
       
   893 	.byte	0xba, 0xcb, 0x76, 0x59 ; \
       
   894 	.byte	0xbe, 0xcb, 0xf6, 0x79 ; \
       
   895 	.byte	0x8c, 0xcc, 0x44, 0x40 ; \
       
   896 	.byte	0x88, 0xcc, 0xc4, 0x60 ; \
       
   897 	.byte	0xb2, 0xcc, 0x7e, 0x5d ; \
       
   898 	.byte	0xb6, 0xcc, 0xfe, 0x7d ; \
       
   899 	.byte	0x80, 0xcd, 0x48, 0xc6 ; \
       
   900 	.byte	0x84, 0xcd, 0xc8, 0xe6 ; \
       
   901 	.byte	0xba, 0xcd, 0x76, 0xd9 ; \
       
   902 	.byte	0xbe, 0xcd, 0xf6, 0xf9
       
   903 	!aes_dround01	%f16, %f0, %f2, %f6 ; \
       
   904 	!aes_dround23	%f18, %f0, %f2, %f4 ; \
       
   905 	!aes_dround01	%f16, %f60, %f62, %f56 ; \
       
   906 	!aes_dround23	%f18, %f60, %f62, %f58 ; \
       
   907 	!aes_dround01	%f20, %f6, %f4, %f0 ; \
       
   908 	!aes_dround23	%f22, %f6, %f4, %f2 ; \
       
   909 	!aes_dround01	%f20, %f56, %f58, %f60 ; \
       
   910 	!aes_dround23	%f22, %f56, %f58, %f62 ; \
       
   911 	!aes_dround01	%f24, %f0, %f2, %f6 ; \
       
   912 	!aes_dround23	%f26, %f0, %f2, %f4 ; \
       
   913 	!aes_dround01	%f24, %f60, %f62, %f56 ; \
       
   914 	!aes_dround23	%f26, %f60, %f62, %f58 ; \
       
   915 	!aes_dround01	%f28, %f6, %f4, %f0 ; \
       
   916 	!aes_dround23	%f30, %f6, %f4, %f2 ; \
       
   917 	!aes_dround01	%f28, %f56, %f58, %f60 ; \
       
   918 	!aes_dround23	%f30, %f56, %f58, %f62 ; \
       
   919 	!aes_dround01	%f32, %f0, %f2, %f6 ; \
       
   920 	!aes_dround23	%f34, %f0, %f2, %f4 ; \
       
   921 	!aes_dround01	%f32, %f60, %f62, %f56 ; \
       
   922 	!aes_dround23	%f34, %f60, %f62, %f58 ; \
       
   923 	!aes_dround01	%f36, %f6, %f4, %f0 ; \
       
   924 	!aes_dround23	%f38, %f6, %f4, %f2 ; \
       
   925 	!aes_dround01	%f36, %f56, %f58, %f60 ; \
       
   926 	!aes_dround23	%f38, %f56, %f58, %f62 ; \
       
   927 	!aes_dround01	%f40, %f0, %f2, %f6 ; \
       
   928 	!aes_dround23	%f42, %f0, %f2, %f4 ; \
       
   929 	!aes_dround01	%f40, %f60, %f62, %f56 ; \
       
   930 	!aes_dround23	%f42, %f60, %f62, %f58 ; \
       
   931 	!aes_dround01	%f44, %f6, %f4, %f0 ; \
       
   932 	!aes_dround23	%f46, %f6, %f4, %f2 ; \
       
   933 	!aes_dround01	%f44, %f56, %f58, %f60 ; \
       
   934 	!aes_dround23	%f46, %f56, %f58, %f62 ; \
       
   935 	!aes_dround01	%f48, %f0, %f2, %f6 ; \
       
   936 	!aes_dround23	%f50, %f0, %f2, %f4 ; \
       
   937 	!aes_dround01	%f48, %f60, %f62, %f56 ; \
       
   938 	!aes_dround23	%f50, %f60, %f62, %f58 ; \
       
   939 	!aes_dround01_l	%f52, %f6, %f4, %f0 ; \
       
   940 	!aes_dround23_l	%f54, %f6, %f4, %f2 ; \
       
   941 	!aes_dround01_l	%f52, %f56, %f58, %f60 ; \
       
   942 	!aes_dround23_l	%f54, %f56, %f58, %f62
       
   943 
       
   944 #define	TWELVE_DROUNDS \
       
   945 	MID_TWO_DROUNDS	; \
       
   946 	TEN_DROUNDS
       
   947 
       
   948 #define	TWELVE_DROUNDS_2 \
       
   949 	MID_TWO_DROUNDS_2	; \
       
   950 	TEN_DROUNDS_2
       
   951 
       
   952 #define	FOURTEEN_DROUNDS \
       
   953 	FIRST_TWO_DROUNDS ; \
       
   954 	TWELVE_DROUNDS
       
   955 
       
   956 #define	FOURTEEN_DROUNDS_2 \
       
   957 	.byte	0xb0, 0xc8, 0x2c, 0x54 ; \
       
   958 	.byte	0xac, 0xc8, 0xac, 0x74 ; \
       
   959 	ldd	[%o0 + 0x80], %f20 ; \
       
   960 	.byte	0xb2, 0xc8, 0x3e, 0x5d ; \
       
   961 	.byte	0xb6, 0xc8, 0xbe, 0x7d ; \
       
   962 	.byte	0x80, 0xc9, 0x2c, 0x58 ; \
       
   963 	.byte	0x84, 0xc9, 0xac, 0x78 ; \
       
   964 	ldd	[%o0 + 0x88], %f22 ; \
       
   965 	.byte	0xba, 0xc9, 0x36, 0x59 ; \
       
   966 	ldd	[%o0 + 0x70], %f24 ; \
       
   967 	.byte	0xbe, 0xc9, 0xb6, 0x79 ; \
       
   968 	.byte	0x8c, 0xca, 0x04, 0x40 ; \
       
   969 	.byte	0x88, 0xca, 0x84, 0x60 ; \
       
   970 	.byte	0xb2, 0xca, 0x3e, 0x5d ; \
       
   971 	.byte	0xb6, 0xca, 0xbe, 0x7d ; \
       
   972 	.byte	0x80, 0xcb, 0x08, 0x46 ; \
       
   973 	.byte	0x84, 0xcb, 0x88, 0x66 ; \
       
   974 	.byte	0xba, 0xcb, 0x36, 0x59 ; \
       
   975 	.byte	0xbe, 0xcb, 0xb6, 0x79 ; \
       
   976 	.byte	0x8c, 0xcc, 0x04, 0x40 ; \
       
   977 	.byte	0x88, 0xcc, 0x84, 0x60 ; \
       
   978 	.byte	0xb2, 0xcc, 0x3e, 0x5d ; \
       
   979 	.byte	0xb6, 0xcc, 0xbe, 0x7d ; \
       
   980 	.byte	0x80, 0xcd, 0x08, 0x46 ; \
       
   981 	.byte	0x84, 0xcd, 0x88, 0x66 ; \
       
   982 	.byte	0xba, 0xcd, 0x36, 0x59 ; \
       
   983 	.byte	0xbe, 0xcd, 0xb6, 0x79 ; \
       
   984 	.byte	0x8c, 0xce, 0x04, 0x40 ; \
       
   985 	.byte	0x88, 0xce, 0x84, 0x60 ; \
       
   986 	.byte	0xb2, 0xce, 0x3e, 0x5d ; \
       
   987 	.byte	0xb6, 0xce, 0xbe, 0x7d ; \
       
   988 	.byte	0x80, 0xcf, 0x08, 0x46 ; \
       
   989 	.byte	0x84, 0xcf, 0x88, 0x66 ; \
       
   990 	.byte	0xba, 0xcf, 0x36, 0x59 ; \
       
   991 	.byte	0xbe, 0xcf, 0xb6, 0x79 ; \
       
   992 	.byte	0x8c, 0xc8, 0x44, 0x40 ; \
       
   993 	.byte	0x88, 0xc8, 0xc4, 0x60 ; \
       
   994 	.byte	0xb2, 0xc8, 0x7e, 0x5d ; \
       
   995 	.byte	0xb6, 0xc8, 0xfe, 0x7d ; \
       
   996 	.byte	0x80, 0xc9, 0x48, 0x46 ; \
       
   997 	.byte	0x84, 0xc9, 0xc8, 0x66 ; \
       
   998 	.byte	0xba, 0xc9, 0x76, 0x59 ; \
       
   999 	.byte	0xbe, 0xc9, 0xf6, 0x79 ; \
       
  1000 	.byte	0x8c, 0xca, 0x44, 0x40 ; \
       
  1001 	.byte	0x88, 0xca, 0xc4, 0x60 ; \
       
  1002 	.byte	0xb2, 0xca, 0x7e, 0x5d ; \
       
  1003 	.byte	0xb6, 0xca, 0xfe, 0x7d ; \
       
  1004 	.byte	0x80, 0xcb, 0x48, 0x46 ; \
       
  1005 	.byte	0x84, 0xcb, 0xc8, 0x66 ; \
       
  1006 	.byte	0xba, 0xcb, 0x76, 0x59 ; \
       
  1007 	.byte	0xbe, 0xcb, 0xf6, 0x79 ; \
       
  1008 	.byte	0x8c, 0xcc, 0x44, 0x40 ; \
       
  1009 	.byte	0x88, 0xcc, 0xc4, 0x60 ; \
       
  1010 	ldd	[%o0 + 0xd0], %f0 ; \
       
  1011 	.byte	0xb2, 0xcc, 0x7e, 0x5d ; \
       
  1012 	ldd	[%o0 + 0xd8], %f2 ; \
       
  1013 	.byte	0xb6, 0xcc, 0xfe, 0x7d ; \
       
  1014 	.byte	0xa8, 0xcd, 0x48, 0xc6 ; \
       
  1015 	.byte	0xac, 0xcd, 0xc8, 0xe6 ; \
       
  1016 	ldd	[%o0 + 0xc0], %f4 ; \
       
  1017 	.byte	0xba, 0xcd, 0x76, 0xd9 ; \
       
  1018 	ldd	[%o0 + 0xc8], %f6 ; \
       
  1019 	.byte	0xbe, 0xcd, 0xf6, 0xf9
       
  1020 	!aes_dround01	%f0, %f20, %f22, %f24 ; \
       
  1021 	!aes_dround23	%f2, %f20, %f22, %f22 ; \
       
  1022 	!ldd	[%o0 + 0x80], %f20 ; \
       
  1023 	!aes_dround01	%f0, %f60, %f62, %f56 ; \
       
  1024 	!aes_dround23	%f2, %f60, %f62, %f58 ; \
       
  1025 	!aes_dround01	%f4, %f24, %f22, %f0 ; \
       
  1026 	!aes_dround23	%f6, %f24, %f22, %f2 ; \
       
  1027 	!ldd	[%o0 + 0x88], %f22 ; \
       
  1028 	!aes_dround01	%f4, %f56, %f58, %f60 ; \
       
  1029 	!ldd	[%o0 + 0x70], %f24 ; \
       
  1030 	!aes_dround23	%f6, %f56, %f58, %f62 ; \
       
  1031 	!aes_dround01	%f8, %f0, %f2, %f6 ; \
       
  1032 	!aes_dround23	%f10, %f0, %f2, %f4 ; \
       
  1033 	!aes_dround01	%f8, %f60, %f62, %f56 ; \
       
  1034 	!aes_dround23	%f10, %f60, %f62, %f58 ; \
       
  1035 	!aes_dround01	%f12, %f6, %f4, %f0 ; \
       
  1036 	!aes_dround23	%f14, %f6, %f4, %f2 ; \
       
  1037 	!aes_dround01	%f12, %f56, %f58, %f60 ; \
       
  1038 	!aes_dround23	%f14, %f56, %f58, %f62 ; \
       
  1039 	!aes_dround01	%f16, %f0, %f2, %f6 ; \
       
  1040 	!aes_dround23	%f18, %f0, %f2, %f4 ; \
       
  1041 	!aes_dround01	%f16, %f60, %f62, %f56 ; \
       
  1042 	!aes_dround23	%f18, %f60, %f62, %f58 ; \
       
  1043 	!aes_dround01	%f20, %f6, %f4, %f0 ; \
       
  1044 	!aes_dround23	%f22, %f6, %f4, %f2 ; \
       
  1045 	!aes_dround01	%f20, %f56, %f58, %f60 ; \
       
  1046 	!aes_dround23	%f22, %f56, %f58, %f62 ; \
       
  1047 	!aes_dround01	%f24, %f0, %f2, %f6 ; \
       
  1048 	!aes_dround23	%f26, %f0, %f2, %f4 ; \
       
  1049 	!aes_dround01	%f24, %f60, %f62, %f56 ; \
       
  1050 	!aes_dround23	%f26, %f60, %f62, %f58 ; \
       
  1051 	!aes_dround01	%f28, %f6, %f4, %f0 ; \
       
  1052 	!aes_dround23	%f30, %f6, %f4, %f2 ; \
       
  1053 	!aes_dround01	%f28, %f56, %f58, %f60 ; \
       
  1054 	!aes_dround23	%f30, %f56, %f58, %f62 ; \
       
  1055 	!aes_dround01	%f32, %f0, %f2, %f6 ; \
       
  1056 	!aes_dround23	%f34, %f0, %f2, %f4 ; \
       
  1057 	!aes_dround01	%f32, %f60, %f62, %f56 ; \
       
  1058 	!aes_dround23	%f34, %f60, %f62, %f58 ; \
       
  1059 	!aes_dround01	%f36, %f6, %f4, %f0 ; \
       
  1060 	!aes_dround23	%f38, %f6, %f4, %f2 ; \
       
  1061 	!aes_dround01	%f36, %f56, %f58, %f60 ; \
       
  1062 	!aes_dround23	%f38, %f56, %f58, %f62 ; \
       
  1063 	!aes_dround01	%f40, %f0, %f2, %f6 ; \
       
  1064 	!aes_dround23	%f42, %f0, %f2, %f4 ; \
       
  1065 	!aes_dround01	%f40, %f60, %f62, %f56 ; \
       
  1066 	!aes_dround23	%f42, %f60, %f62, %f58 ; \
       
  1067 	!aes_dround01	%f44, %f6, %f4, %f0 ; \
       
  1068 	!aes_dround23	%f46, %f6, %f4, %f2 ; \
       
  1069 	!aes_dround01	%f44, %f56, %f58, %f60 ; \
       
  1070 	!aes_dround23	%f46, %f56, %f58, %f62 ; \
       
  1071 	!aes_dround01	%f48, %f0, %f2, %f6 ; \
       
  1072 	!aes_dround23	%f50, %f0, %f2, %f4 ; \
       
  1073 	!ldd	[%o0 + 0xd0], %f0 ; \
       
  1074 	!aes_dround01	%f48, %f60, %f62, %f56 ; \
       
  1075 	!ldd	[%o0 + 0xd8], %f2 ; \
       
  1076 	!aes_dround23	%f50, %f60, %f62, %f58 ; \
       
  1077 	!aes_dround01_l	%f52, %f6, %f4, %f20 ; \
       
  1078 	!aes_dround23_l	%f54, %f6, %f4, %f22 ; \
       
  1079 	!ldd	[%o0 + 0xc0], %f4 ; \
       
  1080 	!aes_dround01_l	%f52, %f56, %f58, %f60 ; \
       
  1081 	!ldd	[%o0 + 0xc8], %f6 ; \
       
  1082 	!aes_dround23_l	%f54, %f56, %f58, %f62
       
  1083 
       
  1084 
       
  1085 	ENTRY(t4_aes128_load_keys_for_encrypt)
       
  1086 
       
  1087 	ldd	[%o0 + 0x10], %f16
       
  1088 	ldd	[%o0 + 0x18], %f18
       
  1089 	ldd	[%o0 + 0x20], %f20
       
  1090 	ldd	[%o0 + 0x28], %f22
       
  1091 	ldd	[%o0 + 0x30], %f24
       
  1092 	ldd	[%o0 + 0x38], %f26
       
  1093 	ldd	[%o0 + 0x40], %f28
       
  1094 	ldd	[%o0 + 0x48], %f30
       
  1095 	ldd	[%o0 + 0x50], %f32
       
  1096 	ldd	[%o0 + 0x58], %f34
       
  1097 	ldd	[%o0 + 0x60], %f36
       
  1098 	ldd	[%o0 + 0x68], %f38
       
  1099 	ldd	[%o0 + 0x70], %f40
       
  1100 	ldd	[%o0 + 0x78], %f42
       
  1101 	ldd	[%o0 + 0x80], %f44
       
  1102 	ldd	[%o0 + 0x88], %f46
       
  1103 	ldd	[%o0 + 0x90], %f48
       
  1104 	ldd	[%o0 + 0x98], %f50
       
  1105 	ldd	[%o0 + 0xa0], %f52
       
  1106 	retl
       
  1107 	ldd	[%o0 + 0xa8], %f54
       
  1108 
       
  1109 	SET_SIZE(t4_aes128_load_keys_for_encrypt)
       
  1110 
       
  1111 
       
  1112 	ENTRY(t4_aes192_load_keys_for_encrypt)
       
  1113 
       
  1114 	ldd	[%o0 + 0x10], %f8
       
  1115 	ldd	[%o0 + 0x18], %f10
       
  1116 	ldd	[%o0 + 0x20], %f12
       
  1117 	ldd	[%o0 + 0x28], %f14
       
  1118 	ldd	[%o0 + 0x30], %f16
       
  1119 	ldd	[%o0 + 0x38], %f18
       
  1120 	ldd	[%o0 + 0x40], %f20
       
  1121 	ldd	[%o0 + 0x48], %f22
       
  1122 	ldd	[%o0 + 0x50], %f24
       
  1123 	ldd	[%o0 + 0x58], %f26
       
  1124 	ldd	[%o0 + 0x60], %f28
       
  1125 	ldd	[%o0 + 0x68], %f30
       
  1126 	ldd	[%o0 + 0x70], %f32
       
  1127 	ldd	[%o0 + 0x78], %f34
       
  1128 	ldd	[%o0 + 0x80], %f36
       
  1129 	ldd	[%o0 + 0x88], %f38
       
  1130 	ldd	[%o0 + 0x90], %f40
       
  1131 	ldd	[%o0 + 0x98], %f42
       
  1132 	ldd	[%o0 + 0xa0], %f44
       
  1133 	ldd	[%o0 + 0xa8], %f46
       
  1134 	ldd	[%o0 + 0xb0], %f48
       
  1135 	ldd	[%o0 + 0xb8], %f50
       
  1136 	ldd	[%o0 + 0xc0], %f52
       
  1137 	retl
       
  1138 	ldd	[%o0 + 0xc8], %f54
       
  1139 
       
  1140 	SET_SIZE(t4_aes192_load_keys_for_encrypt)
       
  1141 
       
  1142 
       
  1143 	ENTRY(t4_aes256_load_keys_for_encrypt)
       
  1144 
       
  1145 	ldd	[%o0 + 0x10], %f0
       
  1146 	ldd	[%o0 + 0x18], %f2
       
  1147 	ldd	[%o0 + 0x20], %f4
       
  1148 	ldd	[%o0 + 0x28], %f6
       
  1149 	ldd	[%o0 + 0x30], %f8
       
  1150 	ldd	[%o0 + 0x38], %f10
       
  1151 	ldd	[%o0 + 0x40], %f12
       
  1152 	ldd	[%o0 + 0x48], %f14
       
  1153 	ldd	[%o0 + 0x50], %f16
       
  1154 	ldd	[%o0 + 0x58], %f18
       
  1155 	ldd	[%o0 + 0x60], %f20
       
  1156 	ldd	[%o0 + 0x68], %f22
       
  1157 	ldd	[%o0 + 0x70], %f24
       
  1158 	ldd	[%o0 + 0x78], %f26
       
  1159 	ldd	[%o0 + 0x80], %f28
       
  1160 	ldd	[%o0 + 0x88], %f30
       
  1161 	ldd	[%o0 + 0x90], %f32
       
  1162 	ldd	[%o0 + 0x98], %f34
       
  1163 	ldd	[%o0 + 0xa0], %f36
       
  1164 	ldd	[%o0 + 0xa8], %f38
       
  1165 	ldd	[%o0 + 0xb0], %f40
       
  1166 	ldd	[%o0 + 0xb8], %f42
       
  1167 	ldd	[%o0 + 0xc0], %f44
       
  1168 	ldd	[%o0 + 0xc8], %f46
       
  1169 	ldd	[%o0 + 0xd0], %f48
       
  1170 	ldd	[%o0 + 0xd8], %f50
       
  1171 	ldd	[%o0 + 0xe0], %f52
       
  1172 	retl
       
  1173 	ldd	[%o0 + 0xe8], %f54
       
  1174 
       
  1175 	SET_SIZE(t4_aes256_load_keys_for_encrypt)
       
  1176 
       
  1177 
       
  1178 #define	TEST_PARALLEL_ECB_ENCRYPT
       
  1179 #ifdef	TEST_PARALLEL_ECB_ENCRYPT
       
  1180 	ENTRY(t4_aes128_ecb_encrypt)
       
  1181 
       
  1182 	ldx	[%o0], %g1	! ks[0]
       
  1183 	ldx	[%o0 + 8], %g2	! ks[1]
       
  1184 	and	%o3, 16, %o4
       
  1185 	brz	%o4, ecbenc128_loop
       
  1186 	nop
       
  1187 
       
  1188 	ldx	[%o1], %g3	!input
       
  1189 	ldx	[%o1 + 8], %g4	!input
       
  1190 	xor	%g1, %g3, %g3	!input ^ ks[0-1]
       
  1191 	xor	%g2, %g4, %g4	!input ^ ks[0-1]
       
  1192 	movxtod	%g3, %f60
       
  1193 	movxtod	%g4, %f62
       
  1194 
       
  1195 	TEN_EROUNDS
       
  1196 
       
  1197 	std	%f60, [%o2]
       
  1198 	std	%f62, [%o2 + 8]
       
  1199 
       
  1200 	add	%o1, 16, %o1
       
  1201 	subcc	%o3, 16, %o3
       
  1202 	be	ecbenc128_loop_end
       
  1203 	add	%o2, 16, %o2
       
  1204 
       
  1205 ecbenc128_loop:
       
  1206 	ldx	[%o1], %g3	!input
       
  1207 	ldx	[%o1 + 8], %g4	!input
       
  1208 	xor	%g1, %g3, %g3	!input ^ ks[0-1]
       
  1209 	xor	%g2, %g4, %g4	!input ^ ks[0-1]
       
  1210 	movxtod	%g3, %f0
       
  1211 	movxtod	%g4, %f2
       
  1212 	ldx	[%o1 + 16], %g3	!input
       
  1213 	ldx	[%o1 + 24], %g4	!input
       
  1214 	xor	%g1, %g3, %g3	!input ^ ks[0-1]
       
  1215 	xor	%g2, %g4, %g4	!input ^ ks[0-1]
       
  1216 	movxtod	%g3, %f60
       
  1217 	movxtod	%g4, %f62
       
  1218 
       
  1219 	TEN_EROUNDS_2
       
  1220 
       
  1221 	std	%f0, [%o2]
       
  1222 	std	%f2, [%o2 + 8]
       
  1223 
       
  1224 	std	%f60, [%o2 + 16]
       
  1225 	std	%f62, [%o2 + 24]
       
  1226 
       
  1227 	add	%o1, 32, %o1
       
  1228 	subcc	%o3, 32, %o3
       
  1229 	bne	ecbenc128_loop
       
  1230 	add	%o2, 32, %o2
       
  1231 ecbenc128_loop_end:
       
  1232 	retl
       
  1233 	nop
       
  1234 
       
  1235 	SET_SIZE(t4_aes128_ecb_encrypt)
       
  1236 
       
  1237 
       
  1238 	ENTRY(t4_aes192_ecb_encrypt)
       
  1239 
       
  1240 	ldx	[%o0], %g1	! ks[0]
       
  1241 	ldx	[%o0 + 8], %g2	! ks[1]
       
  1242 	and	%o3, 16, %o4
       
  1243 	brz	%o4, ecbenc192_loop
       
  1244 	nop
       
  1245 
       
  1246 	ldx	[%o1], %g3	!input
       
  1247 	ldx	[%o1 + 8], %g4	!input
       
  1248 	xor	%g1, %g3, %g3	!input ^ ks[0-1]
       
  1249 	xor	%g2, %g4, %g4	!input ^ ks[0-1]
       
  1250 	movxtod	%g3, %f60
       
  1251 	movxtod	%g4, %f62
       
  1252 
       
  1253 	TWELVE_EROUNDS
       
  1254 
       
  1255 	std	%f60, [%o2]
       
  1256 	std	%f62, [%o2 + 8]
       
  1257 
       
  1258 	add	%o1, 16, %o1
       
  1259 	subcc	%o3, 16, %o3
       
  1260 	be	ecbenc192_loop_end
       
  1261 	add	%o2, 16, %o2
       
  1262 
       
  1263 ecbenc192_loop:
       
  1264 	ldx	[%o1], %g3	!input
       
  1265 	ldx	[%o1 + 8], %g4	!input
       
  1266 	xor	%g1, %g3, %g3	!input ^ ks[0-1]
       
  1267 	xor	%g2, %g4, %g4	!input ^ ks[0-1]
       
  1268 	movxtod	%g3, %f0
       
  1269 	movxtod	%g4, %f2
       
  1270 	ldx	[%o1 + 16], %g3	!input
       
  1271 	ldx	[%o1 + 24], %g4	!input
       
  1272 	xor	%g1, %g3, %g3	!input ^ ks[0-1]
       
  1273 	xor	%g2, %g4, %g4	!input ^ ks[0-1]
       
  1274 	movxtod	%g3, %f60
       
  1275 	movxtod	%g4, %f62
       
  1276 
       
  1277 	TWELVE_EROUNDS_2
       
  1278 
       
  1279 	std	%f0, [%o2]
       
  1280 	std	%f2, [%o2 + 8]
       
  1281 
       
  1282 	std	%f60, [%o2 + 16]
       
  1283 	std	%f62, [%o2 + 24]
       
  1284 
       
  1285 	add	%o1, 32, %o1
       
  1286 	subcc	%o3, 32, %o3
       
  1287 	bne	ecbenc192_loop
       
  1288 	add	%o2, 32, %o2
       
  1289 ecbenc192_loop_end:
       
  1290 	retl
       
  1291 	nop
       
  1292 
       
  1293 	SET_SIZE(t4_aes192_ecb_encrypt)
       
  1294 
       
  1295 
       
  1296 	ENTRY(t4_aes256_ecb_encrypt)
       
  1297 
       
  1298 	ldx	[%o0], %g1	! ks[0]
       
  1299 	ldx	[%o0 + 8], %g2	! ks[1]
       
  1300 	and	%o3, 16, %o4
       
  1301 	brz	%o4, ecbenc256_loop
       
  1302 	nop
       
  1303 
       
  1304 	ldx	[%o1], %g3	!input
       
  1305 	ldx	[%o1 + 8], %g4	!input
       
  1306 	xor	%g1, %g3, %g3	!input ^ ks[0-1]
       
  1307 	xor	%g2, %g4, %g4	!input ^ ks[0-1]
       
  1308 	movxtod	%g3, %f60
       
  1309 	movxtod	%g4, %f62
       
  1310 
       
  1311 	FOURTEEN_EROUNDS
       
  1312 
       
  1313 	std	%f60, [%o2]
       
  1314 	std	%f62, [%o2 + 8]
       
  1315 
       
  1316 	add	%o1, 16, %o1
       
  1317 	subcc	%o3, 16, %o3
       
  1318 	be	ecbenc256_loop_end
       
  1319 	add	%o2, 16, %o2
       
  1320 
       
  1321 ecbenc256_loop:
       
  1322 	ldx	[%o1], %g3	!input
       
  1323 	ldx	[%o1 + 8], %g4	!input
       
  1324 	xor	%g1, %g3, %g3	!input ^ ks[0-1]
       
  1325 	xor	%g2, %g4, %g4	!input ^ ks[0-1]
       
  1326 	movxtod	%g3, %f20
       
  1327 	movxtod	%g4, %f22
       
  1328 	ldx	[%o1 + 16], %g3	!input
       
  1329 	ldx	[%o1 + 24], %g4	!input
       
  1330 	xor	%g1, %g3, %g3	!input ^ ks[0-1]
       
  1331 	xor	%g2, %g4, %g4	!input ^ ks[0-1]
       
  1332 	movxtod	%g3, %f60
       
  1333 	movxtod	%g4, %f62
       
  1334 
       
  1335 	FOURTEEN_EROUNDS_2
       
  1336 
       
  1337 	std	%f20, [%o2]
       
  1338 	std	%f22, [%o2 + 8]
       
  1339 
       
  1340 	std	%f60, [%o2 + 16]
       
  1341 	std	%f62, [%o2 + 24]
       
  1342 
       
  1343 	add	%o1, 32, %o1
       
  1344 	subcc	%o3, 32, %o3
       
  1345 	bne	ecbenc256_loop
       
  1346 	add	%o2, 32, %o2
       
  1347 
       
  1348 	ldd	[%o0 + 0x60], %f20
       
  1349 	ldd	[%o0 + 0x68], %f22
       
  1350 
       
  1351 ecbenc256_loop_end:
       
  1352 	retl
       
  1353 	nop
       
  1354 
       
  1355 	SET_SIZE(t4_aes256_ecb_encrypt)
       
  1356 
       
  1357 #else
       
  1358 
       
  1359 	ENTRY(t4_aes128_ecb_encrypt)
       
  1360 
       
  1361 	ldx	[%o0], %g1	! ks[0]
       
  1362 	ldx	[%o0 + 8], %g2	! ks[1]
       
  1363 
       
  1364 ecbenc128_loop:
       
  1365 	ldx	[%o1], %g3	!input
       
  1366 	ldx	[%o1 + 8], %g4	!input
       
  1367 	xor	%g1, %g3, %g3	!input ^ ks[0-1]
       
  1368 	xor	%g2, %g4, %g4	!input ^ ks[0-1]
       
  1369 	movxtod	%g3, %f60
       
  1370 	movxtod	%g4, %f62
       
  1371 
       
  1372 	TEN_EROUNDS
       
  1373 
       
  1374 	std	%f60, [%o2]
       
  1375 	std	%f62, [%o2 + 8]
       
  1376 
       
  1377 	add	%o1, 16, %o1
       
  1378 	subcc	%o3, 16, %o3
       
  1379 	bne	ecbenc128_loop
       
  1380 	add	%o2, 16, %o2
       
  1381 
       
  1382 	retl
       
  1383 	nop
       
  1384 
       
  1385 	SET_SIZE(t4_aes128_ecb_encrypt)
       
  1386 
       
  1387 
       
  1388 	ENTRY(t4_aes192_ecb_encrypt)
       
  1389 
       
  1390 	ldx	[%o0], %g1	! ks[0]
       
  1391 	ldx	[%o0 + 8], %g2	! ks[1]
       
  1392 
       
  1393 ecbenc192_loop:
       
  1394 	ldx	[%o1], %g3	!input
       
  1395 	ldx	[%o1 + 8], %g4	!input
       
  1396 	xor	%g1, %g3, %g3	!input ^ ks[0-1]
       
  1397 	xor	%g2, %g4, %g4	!input ^ ks[0-1]
       
  1398 	movxtod	%g3, %f60
       
  1399 	movxtod	%g4, %f62
       
  1400 
       
  1401 	TWELVE_EROUNDS
       
  1402 
       
  1403 	std	%f60, [%o2]
       
  1404 	std	%f62, [%o2 + 8]
       
  1405 
       
  1406 	add	%o1, 16, %o1
       
  1407 	subcc	%o3, 16, %o3
       
  1408 	bne	ecbenc192_loop
       
  1409 	add	%o2, 16, %o2
       
  1410 
       
  1411 	retl
       
  1412 	nop
       
  1413 
       
  1414 	SET_SIZE(t4_aes192_ecb_encrypt)
       
  1415 
       
  1416 
       
  1417 	ENTRY(t4_aes256_ecb_encrypt)
       
  1418 
       
  1419 	ldx	[%o0], %g1	! ks[0]
       
  1420 	ldx	[%o0 + 8], %g2	! ks[1]
       
  1421 
       
  1422 ecbenc256_loop:
       
  1423 	ldx	[%o1], %g3	!input
       
  1424 	ldx	[%o1 + 8], %g4	!input
       
  1425 	xor	%g1, %g3, %g3	!input ^ ks[0-1]
       
  1426 	xor	%g2, %g4, %g4	!input ^ ks[0-1]
       
  1427 	movxtod	%g3, %f60
       
  1428 	movxtod	%g4, %f62
       
  1429 
       
  1430 	FOURTEEN_EROUNDS
       
  1431 
       
  1432 	std	%f60, [%o2]
       
  1433 	std	%f62, [%o2 + 8]
       
  1434 
       
  1435 	add	%o1, 16, %o1
       
  1436 	subcc	%o3, 16, %o3
       
  1437 	bne	ecbenc256_loop
       
  1438 	add	%o2, 16, %o2
       
  1439 
       
  1440 	retl
       
  1441 	nop
       
  1442 
       
  1443 	SET_SIZE(t4_aes256_ecb_encrypt)
       
  1444 #endif
       
  1445 
       
  1446 
       
  1447 	ENTRY(t4_aes128_cbc_encrypt)
       
  1448 
       
  1449 	ldd	[%o4], %f60	! IV
       
  1450 	ldd	[%o4 +8], %f62	! IV
       
  1451 	ldx	[%o0], %g1	! ks[0]
       
  1452 	ldx	[%o0 + 8], %g2	! ks[1]
       
  1453 
       
  1454 cbcenc128_loop:
       
  1455 	ldx	[%o1], %g3	!input
       
  1456 	ldx	[%o1 + 8], %g4	!input
       
  1457 	xor	%g1, %g3, %g3	!input ^ ks[0-1]
       
  1458 	xor	%g2, %g4, %g4	!input ^ ks[0-1]
       
  1459 	movxtod	%g3, %f56
       
  1460 	movxtod	%g4, %f58
       
  1461 	fxor	%f60, %f56, %f60
       
  1462 	fxor	%f62, %f58, %f62
       
  1463 
       
  1464 	TEN_EROUNDS
       
  1465 
       
  1466 	std	%f60, [%o2]
       
  1467 	std	%f62, [%o2 + 8]
       
  1468 
       
  1469 	add	%o1, 16, %o1
       
  1470 	subcc	%o3, 16, %o3
       
  1471 	bne	cbcenc128_loop
       
  1472 	add	%o2, 16, %o2
       
  1473 
       
  1474 	std	%f60, [%o4]
       
  1475 	retl
       
  1476 	std	%f62, [%o4 + 8]
       
  1477 
       
  1478 	SET_SIZE(t4_aes128_cbc_encrypt)
       
  1479 
       
  1480 
       
  1481 	ENTRY(t4_aes192_cbc_encrypt)
       
  1482 
       
  1483 	ldd	[%o4], %f60	! IV
       
  1484 	ldd	[%o4 + 8], %f62	! IV
       
  1485 	ldx	[%o0], %g1	! ks[0]
       
  1486 	ldx	[%o0 + 8], %g2	! ks[1]
       
  1487 
       
  1488 cbcenc192_loop:
       
  1489 	ldx	[%o1], %g3	!input
       
  1490 	ldx	[%o1 + 8], %g4	!input
       
  1491 	xor	%g1, %g3, %g3	!input ^ ks[0-1]
       
  1492 	xor	%g2, %g4, %g4	!input ^ ks[0-1]
       
  1493 	movxtod	%g3, %f56
       
  1494 	movxtod	%g4, %f58
       
  1495 	fxor	%f60, %f56, %f60
       
  1496 	fxor	%f62, %f58, %f62
       
  1497 
       
  1498 	TWELVE_EROUNDS
       
  1499 
       
  1500 	std	%f60, [%o2]
       
  1501 	std	%f62, [%o2 + 8]
       
  1502 
       
  1503 	add	%o1, 16, %o1
       
  1504 	subcc	%o3, 16, %o3
       
  1505 	bne	cbcenc192_loop
       
  1506 	add	%o2, 16, %o2
       
  1507 
       
  1508 	std	%f60, [%o4]
       
  1509 	retl
       
  1510 	std	%f62, [%o4 + 8]
       
  1511 
       
  1512 	SET_SIZE(t4_aes192_cbc_encrypt)
       
  1513 
       
  1514 
       
  1515 	ENTRY(t4_aes256_cbc_encrypt)
       
  1516 
       
  1517 	ldd	[%o4], %f60	! IV
       
  1518 	ldd	[%o4 + 8], %f62	! IV
       
  1519 	ldx	[%o0], %g1	! ks[0]
       
  1520 	ldx	[%o0 + 8], %g2	! ks[1]
       
  1521 
       
  1522 cbcenc256_loop:
       
  1523 	ldx	[%o1], %g3	!input
       
  1524 	ldx	[%o1 + 8], %g4	!input
       
  1525 	xor	%g1, %g3, %g3	!input ^ ks[0-1]
       
  1526 	xor	%g2, %g4, %g4	!input ^ ks[0-1]
       
  1527 	movxtod	%g3, %f56
       
  1528 	movxtod	%g4, %f58
       
  1529 	fxor	%f60, %f56, %f60
       
  1530 	fxor	%f62, %f58, %f62
       
  1531 
       
  1532 	FOURTEEN_EROUNDS
       
  1533 
       
  1534 	std	%f60, [%o2]
       
  1535 	std	%f62, [%o2 + 8]
       
  1536 
       
  1537 	add	%o1, 16, %o1
       
  1538 	subcc	%o3, 16, %o3
       
  1539 	bne	cbcenc256_loop
       
  1540 	add	%o2, 16, %o2
       
  1541 
       
  1542 	std	%f60, [%o4]
       
  1543 	retl
       
  1544 	std	%f62, [%o4 + 8]
       
  1545 
       
  1546 	SET_SIZE(t4_aes256_cbc_encrypt)
       
  1547 
       
  1548 
       
  1549 #define	 TEST_PARALLEL_CTR_CRYPT
       
  1550 #ifdef	TEST_PARALLEL_CTR_CRYPT
       
  1551 	ENTRY(t4_aes128_ctr_crypt)
       
  1552 
       
  1553 	ldx	[%o4], %g3	! IV
       
  1554 	ldx	[%o4 +8], %g4	! IV
       
  1555 	ldx	[%o0], %g1	! ks[0]
       
  1556 	ldx	[%o0 + 8], %g2	! ks[1]
       
  1557 	and	%o3, 16, %g5
       
  1558 	brz, %g5, ctr128_loop
       
  1559 
       
  1560 	xor	%g1, %g3, %g5
       
  1561 	movxtod	%g5, %f60
       
  1562 	xor	%g2, %g4, %g5
       
  1563 	movxtod	%g5, %f62
       
  1564 	inc	%g4
       
  1565 
       
  1566 	TEN_EROUNDS
       
  1567 
       
  1568 	ldd	[%o1], %f56	!input
       
  1569 	ldd	[%o1 + 8], %f58	!input
       
  1570 	fxor	%f60, %f56, %f60
       
  1571 	fxor	%f62, %f58, %f62
       
  1572 	std	%f60, [%o2]
       
  1573 	std	%f62, [%o2 + 8]
       
  1574 
       
  1575 	add	%o1, 16, %o1
       
  1576 	subcc	%o3, 16, %o3
       
  1577 	be	ctr128_loop_end
       
  1578 	add	%o2, 16, %o2
       
  1579 
       
  1580 ctr128_loop:
       
  1581 	xor	%g1, %g3, %g5
       
  1582 	movxtod	%g5, %f0
       
  1583 	xor	%g2, %g4, %g5
       
  1584 	movxtod	%g5, %f2
       
  1585 	inc	%g4
       
  1586 
       
  1587 	xor	%g1, %g3, %g5
       
  1588 	movxtod	%g5, %f60
       
  1589 	xor	%g2, %g4, %g5
       
  1590 	movxtod	%g5, %f62
       
  1591 	inc	%g4
       
  1592 
       
  1593 	TEN_EROUNDS_2
       
  1594 
       
  1595 	ldd	[%o1], %f6		!input
       
  1596 	ldd	[%o1 + 8], %f4		!input
       
  1597 	ldd	[%o1 + 16], %f56	!input
       
  1598 	ldd	[%o1 + 24], %f58	!input
       
  1599 	fxor	%f0, %f6, %f0
       
  1600 	fxor	%f2, %f4, %f2
       
  1601 	fxor	%f60, %f56, %f60
       
  1602 	fxor	%f62, %f58, %f62
       
  1603 	std	%f0, [%o2]
       
  1604 	std	%f2, [%o2 + 8]
       
  1605 	std	%f60, [%o2 + 16]
       
  1606 	std	%f62, [%o2 + 24]
       
  1607 
       
  1608 	add	%o1, 32, %o1
       
  1609 	subcc	%o3, 32, %o3
       
  1610 	bne	ctr128_loop
       
  1611 	add	%o2, 32, %o2
       
  1612 
       
  1613 ctr128_loop_end:
       
  1614 	stx	%g3, [%o4]
       
  1615 	retl
       
  1616 	stx	%g4, [%o4 + 8]
       
  1617 
       
  1618 	SET_SIZE(t4_aes128_ctr_crypt)
       
  1619 
       
  1620 
       
  1621 	ENTRY(t4_aes192_ctr_crypt)
       
  1622 
       
  1623 	ldx	[%o4], %g3	! IV
       
  1624 	ldx	[%o4 +8], %g4	! IV
       
  1625 	ldx	[%o0], %g1	! ks[0]
       
  1626 	ldx	[%o0 + 8], %g2	! ks[1]
       
  1627 	and	%o3, 16, %g5
       
  1628 	brz, %g5, ctr192_loop
       
  1629 
       
  1630 	xor	%g1, %g3, %g5
       
  1631 	movxtod	%g5, %f60
       
  1632 	xor	%g2, %g4, %g5
       
  1633 	movxtod	%g5, %f62
       
  1634 	inc	%g4
       
  1635 
       
  1636 	TWELVE_EROUNDS
       
  1637 
       
  1638 	ldd	[%o1], %f56	!input
       
  1639 	ldd	[%o1 + 8], %f58	!input
       
  1640 	fxor	%f60, %f56, %f60
       
  1641 	fxor	%f62, %f58, %f62
       
  1642 	std	%f60, [%o2]
       
  1643 	std	%f62, [%o2 + 8]
       
  1644 
       
  1645 	add	%o1, 16, %o1
       
  1646 	subcc	%o3, 16, %o3
       
  1647 	be	ctr192_loop_end
       
  1648 	add	%o2, 16, %o2
       
  1649 
       
  1650 ctr192_loop:
       
  1651 	xor	%g1, %g3, %g5
       
  1652 	movxtod	%g5, %f0
       
  1653 	xor	%g2, %g4, %g5
       
  1654 	movxtod	%g5, %f2
       
  1655 	inc	%g4
       
  1656 
       
  1657 	xor	%g1, %g3, %g5
       
  1658 	movxtod	%g5, %f60
       
  1659 	xor	%g2, %g4, %g5
       
  1660 	movxtod	%g5, %f62
       
  1661 	inc	%g4
       
  1662 
       
  1663 	TWELVE_EROUNDS_2
       
  1664 
       
  1665 	ldd	[%o1], %f6		!input
       
  1666 	ldd	[%o1 + 8], %f4		!input
       
  1667 	ldd	[%o1 + 16], %f56	!input
       
  1668 	ldd	[%o1 + 24], %f58	!input
       
  1669 	fxor	%f0, %f6, %f0
       
  1670 	fxor	%f2, %f4, %f2
       
  1671 	fxor	%f60, %f56, %f60
       
  1672 	fxor	%f62, %f58, %f62
       
  1673 	std	%f0, [%o2]
       
  1674 	std	%f2, [%o2 + 8]
       
  1675 	std	%f60, [%o2 + 16]
       
  1676 	std	%f62, [%o2 + 24]
       
  1677 
       
  1678 	add	%o1, 32, %o1
       
  1679 	subcc	%o3, 32, %o3
       
  1680 	bne	ctr192_loop
       
  1681 	add	%o2, 32, %o2
       
  1682 
       
  1683 ctr192_loop_end:
       
  1684 	stx	%g3, [%o4]
       
  1685 	retl
       
  1686 	stx	%g4, [%o4 + 8]
       
  1687 
       
  1688 	SET_SIZE(t4_aes192_ctr_crypt)
       
  1689 
       
  1690 
       
  1691 	ENTRY(t4_aes256_ctr_crypt)
       
  1692 
       
  1693 	ldx	[%o4], %g3	! IV
       
  1694 	ldx	[%o4 +8], %g4	! IV
       
  1695 	ldx	[%o0], %g1	! ks[0]
       
  1696 	ldx	[%o0 + 8], %g2	! ks[1]
       
  1697 	and	%o3, 16, %g5
       
  1698 	brz,	%g5, ctr256_loop
       
  1699 
       
  1700 	xor	%g1, %g3, %g5
       
  1701 	movxtod	%g5, %f60
       
  1702 	xor	%g2, %g4, %g5
       
  1703 	movxtod	%g5, %f62
       
  1704 	inc	%g4
       
  1705 
       
  1706 	FOURTEEN_EROUNDS
       
  1707 
       
  1708 	ldd	[%o1], %f56	!input
       
  1709 	ldd	[%o1 + 8], %f58	!input
       
  1710 	fxor	%f60, %f56, %f60
       
  1711 	fxor	%f62, %f58, %f62
       
  1712 	std	%f60, [%o2]
       
  1713 	std	%f62, [%o2 + 8]
       
  1714 
       
  1715 	add	%o1, 16, %o1
       
  1716 	subcc	%o3, 16, %o3
       
  1717 	be	ctr256_loop_end
       
  1718 	add	%o2, 16, %o2
       
  1719 
       
  1720 ctr256_loop:
       
  1721 	xor	%g1, %g3, %g5
       
  1722 	movxtod	%g5, %f20
       
  1723 	xor	%g2, %g4, %g5
       
  1724 	movxtod	%g5, %f22
       
  1725 	inc	%g4
       
  1726 
       
  1727 	xor	%g1, %g3, %g5
       
  1728 	movxtod	%g5, %f60
       
  1729 	xor	%g2, %g4, %g5
       
  1730 	movxtod	%g5, %f62
       
  1731 	inc	%g4
       
  1732 
       
  1733 	FOURTEEN_EROUNDS_2
       
  1734 
       
  1735 	ldd	[%o1], %f56		!input
       
  1736 	ldd	[%o1 + 8], %f58		!input
       
  1737 	fxor	%f20, %f56, %f20
       
  1738 	fxor	%f22, %f58, %f22
       
  1739 	ldd	[%o1 + 16], %f56	!input
       
  1740 	ldd	[%o1 + 24], %f58	!input
       
  1741 	fxor	%f60, %f56, %f60
       
  1742 	fxor	%f62, %f58, %f62
       
  1743 	std	%f20, [%o2]
       
  1744 	std	%f22, [%o2 + 8]
       
  1745 	std	%f60, [%o2 + 16]
       
  1746 	std	%f62, [%o2 + 24]
       
  1747 
       
  1748 	add	%o1, 32, %o1
       
  1749 	subcc	%o3, 32, %o3
       
  1750 	bne	ctr256_loop
       
  1751 	add	%o2, 32, %o2
       
  1752 
       
  1753 	ldd	[%o0 + 0x60], %f20
       
  1754 	ldd	[%o0 + 0x68], %f22
       
  1755 
       
  1756 ctr256_loop_end:
       
  1757 	stx	%g3, [%o4]
       
  1758 	retl
       
  1759 	stx	%g4, [%o4 + 8]
       
  1760 
       
  1761 	SET_SIZE(t4_aes256_ctr_crypt)
       
  1762 
       
  1763 #else
       
  1764 
       
  1765 	ENTRY(t4_aes128_ctr_crypt)
       
  1766 
       
  1767 	ldx	[%o4], %g3	! IV
       
  1768 	ldx	[%o4 +8], %g4	! IV
       
  1769 	ldx	[%o0], %g1	! ks[0]
       
  1770 	ldx	[%o0 + 8], %g2	! ks[1]
       
  1771 
       
  1772 ctr128_loop:
       
  1773 	xor	%g1, %g3, %g5
       
  1774 	movxtod	%g5, %f60
       
  1775 	xor	%g2, %g4, %g5
       
  1776 	movxtod	%g5, %f62
       
  1777 	inc	%g4
       
  1778 
       
  1779 	TEN_EROUNDS
       
  1780 
       
  1781 	ldd	[%o1], %f56	!input
       
  1782 	ldd	[%o1 + 8], %f58	!input
       
  1783 	fxor	%f60, %f56, %f60
       
  1784 	fxor	%f62, %f58, %f62
       
  1785 	std	%f60, [%o2]
       
  1786 	std	%f62, [%o2 + 8]
       
  1787 
       
  1788 	add	%o1, 16, %o1
       
  1789 	subcc	%o3, 16, %o3
       
  1790 	bne	ctr128_loop
       
  1791 	add	%o2, 16, %o2
       
  1792 
       
  1793 	stx	%g3, [%o4]
       
  1794 	retl
       
  1795 	stx	%g4, [%o4 + 8]
       
  1796 
       
  1797 	SET_SIZE(t4_aes128_ctr_crypt)
       
  1798 
       
  1799 	ENTRY(t4_aes192_ctr_crypt)
       
  1800 
       
  1801 	ldx	[%o4], %g3	! IV
       
  1802 	ldx	[%o4 +8], %g4	! IV
       
  1803 	ldx	[%o0], %g1	! ks[0]
       
  1804 	ldx	[%o0 + 8], %g2	! ks[1]
       
  1805 
       
  1806 ctr192_loop:
       
  1807 	xor	%g1, %g3, %g5
       
  1808 	movxtod	%g5, %f60
       
  1809 	xor	%g2, %g4, %g5
       
  1810 	movxtod	%g5, %f62
       
  1811 	inc	%g4
       
  1812 
       
  1813 	TWELVE_EROUNDS
       
  1814 
       
  1815 	ldd	[%o1], %f56	!input
       
  1816 	ldd	[%o1 + 8], %f58	!input
       
  1817 	fxor	%f60, %f56, %f60
       
  1818 	fxor	%f62, %f58, %f62
       
  1819 	std	%f60, [%o2]
       
  1820 	std	%f62, [%o2 + 8]
       
  1821 
       
  1822 	add	%o1, 16, %o1
       
  1823 	subcc	%o3, 16, %o3
       
  1824 	bne	ctr192_loop
       
  1825 	add	%o2, 16, %o2
       
  1826 
       
  1827 	stx	%g3, [%o4]
       
  1828 	retl
       
  1829 	stx	%g4, [%o4 + 8]
       
  1830 
       
  1831 	SET_SIZE(t4_aes192_ctr_crypt)
       
  1832 
       
  1833 
       
  1834 	ENTRY(t4_aes256_ctr_crypt)
       
  1835 
       
  1836 	ldx	[%o4], %g3	! IV
       
  1837 	ldx	[%o4 +8], %g4	! IV
       
  1838 	ldx	[%o0], %g1	! ks[0]
       
  1839 	ldx	[%o0 + 8], %g2	! ks[1]
       
  1840 
       
  1841 ctr256_loop:
       
  1842 	xor	%g1, %g3, %g5
       
  1843 	movxtod	%g5, %f60
       
  1844 	xor	%g2, %g4, %g5
       
  1845 	movxtod	%g5, %f62
       
  1846 	inc	%g4
       
  1847 
       
  1848 	FOURTEEN_EROUNDS
       
  1849 
       
  1850 	ldd	[%o1], %f56	!input
       
  1851 	ldd	[%o1 + 8], %f58	!input
       
  1852 	fxor	%f60, %f56, %f60
       
  1853 	fxor	%f62, %f58, %f62
       
  1854 	std	%f60, [%o2]
       
  1855 	std	%f62, [%o2 + 8]
       
  1856 
       
  1857 	add	%o1, 16, %o1
       
  1858 	subcc	%o3, 16, %o3
       
  1859 	bne	ctr256_loop
       
  1860 	add	%o2, 16, %o2
       
  1861 
       
  1862 	stx	%g3, [%o4]
       
  1863 	retl
       
  1864 	stx	%g4, [%o4 + 8]
       
  1865 
       
  1866 	SET_SIZE(t4_aes256_ctr_crypt)
       
  1867 
       
  1868 #endif
       
  1869 
       
  1870 	ENTRY(t4_aes128_cfb128_encrypt)
       
  1871 
       
  1872 	ldd	[%o4], %f60	! IV
       
  1873 	ldd	[%o4 +8], %f62	! IV
       
  1874 	ldx	[%o0], %g1	! ks[0]
       
  1875 	ldx	[%o0 + 8], %g2	! ks[1]
       
  1876 
       
  1877 cfb128_128_loop:
       
  1878 	movxtod	%g1, %f56
       
  1879 	movxtod	%g2, %f58
       
  1880 	fxor	%f60, %f56, %f60
       
  1881 	fxor	%f62, %f58, %f62
       
  1882 
       
  1883 	TEN_EROUNDS
       
  1884 
       
  1885 	ldd	[%o1], %f56	!input
       
  1886 	ldd	[%o1 + 8], %f58	!input
       
  1887 	fxor	%f60, %f56, %f60
       
  1888 	fxor	%f62, %f58, %f62
       
  1889 
       
  1890 	std	%f60, [%o2]
       
  1891 	std	%f62, [%o2 + 8]
       
  1892 
       
  1893 	add	%o1, 16, %o1
       
  1894 	subcc	%o3, 16, %o3
       
  1895 	bne	cfb128_128_loop
       
  1896 	add	%o2, 16, %o2
       
  1897 
       
  1898 	std	%f60, [%o4]
       
  1899 	retl
       
  1900 	std	%f62, [%o4 + 8]
       
  1901 
       
  1902 	SET_SIZE(t4_aes128_cfb128_encrypt)
       
  1903 
       
  1904 
       
  1905 	ENTRY(t4_aes192_cfb128_encrypt)
       
  1906 
       
  1907 	ldd	[%o4], %f60	! IV
       
  1908 	ldd	[%o4 +8], %f62	! IV
       
  1909 	ldx	[%o0], %g1	! ks[0]
       
  1910 	ldx	[%o0 + 8], %g2	! ks[1]
       
  1911 
       
  1912 cfb128_192_loop:
       
  1913 	movxtod	%g1, %f56
       
  1914 	movxtod	%g2, %f58
       
  1915 	fxor	%f60, %f56, %f60
       
  1916 	fxor	%f62, %f58, %f62
       
  1917 
       
  1918 	TWELVE_EROUNDS
       
  1919 
       
  1920 	ldd	[%o1], %f56	!input
       
  1921 	ldd	[%o1 + 8], %f58	!input
       
  1922 	fxor	%f60, %f56, %f60
       
  1923 	fxor	%f62, %f58, %f62
       
  1924 
       
  1925 	std	%f60, [%o2]
       
  1926 	std	%f62, [%o2 + 8]
       
  1927 
       
  1928 	add	%o1, 16, %o1
       
  1929 	subcc	%o3, 16, %o3
       
  1930 	bne	cfb128_192_loop
       
  1931 	add	%o2, 16, %o2
       
  1932 
       
  1933 	std	%f60, [%o4]
       
  1934 	retl
       
  1935 	std	%f62, [%o4 + 8]
       
  1936 
       
  1937 	SET_SIZE(t4_aes192_cfb128_encrypt)
       
  1938 
       
  1939 
       
  1940 	ENTRY(t4_aes256_cfb128_encrypt)
       
  1941 
       
  1942 	ldd	[%o4], %f60	! IV
       
  1943 	ldd	[%o4 +8], %f62	! IV
       
  1944 	ldx	[%o0], %g1	! ks[0]
       
  1945 	ldx	[%o0 + 8], %g2	! ks[1]
       
  1946 
       
  1947 cfb128_256_loop:
       
  1948 	movxtod	%g1, %f56
       
  1949 	movxtod	%g2, %f58
       
  1950 	fxor	%f60, %f56, %f60
       
  1951 	fxor	%f62, %f58, %f62
       
  1952 
       
  1953 	FOURTEEN_EROUNDS
       
  1954 
       
  1955 	ldd	[%o1], %f56	!input
       
  1956 	ldd	[%o1 + 8], %f58	!input
       
  1957 	fxor	%f60, %f56, %f60
       
  1958 	fxor	%f62, %f58, %f62
       
  1959 
       
  1960 	std	%f60, [%o2]
       
  1961 	std	%f62, [%o2 + 8]
       
  1962 
       
  1963 	add	%o1, 16, %o1
       
  1964 	subcc	%o3, 16, %o3
       
  1965 	bne	cfb128_256_loop
       
  1966 	add	%o2, 16, %o2
       
  1967 
       
  1968 	std	%f60, [%o4]
       
  1969 	retl
       
  1970 	std	%f62, [%o4 + 8]
       
  1971 
       
  1972 	SET_SIZE(t4_aes256_cfb128_encrypt)
       
  1973 
       
  1974 
       
  1975 	ENTRY(t4_aes128_load_keys_for_decrypt)
       
  1976 
       
  1977 	ldd	[%o0], %f52
       
  1978 	ldd	[%o0 + 0x8], %f54
       
  1979 	ldd	[%o0 + 0x10], %f48
       
  1980 	ldd	[%o0 + 0x18], %f50
       
  1981 	ldd	[%o0 + 0x20], %f44
       
  1982 	ldd	[%o0 + 0x28], %f46
       
  1983 	ldd	[%o0 + 0x30], %f40
       
  1984 	ldd	[%o0 + 0x38], %f42
       
  1985 	ldd	[%o0 + 0x40], %f36
       
  1986 	ldd	[%o0 + 0x48], %f38
       
  1987 	ldd	[%o0 + 0x50], %f32
       
  1988 	ldd	[%o0 + 0x58], %f34
       
  1989 	ldd	[%o0 + 0x60], %f28
       
  1990 	ldd	[%o0 + 0x68], %f30
       
  1991 	ldd	[%o0 + 0x70], %f24
       
  1992 	ldd	[%o0 + 0x78], %f26
       
  1993 	ldd	[%o0 + 0x80], %f20
       
  1994 	ldd	[%o0 + 0x88], %f22
       
  1995 	ldd	[%o0 + 0x90], %f16
       
  1996 	retl
       
  1997 	ldd	[%o0 + 0x98], %f18
       
  1998 
       
  1999 	SET_SIZE(t4_aes128_load_keys_for_decrypt)
       
  2000 
       
  2001 
       
  2002 	ENTRY(t4_aes192_load_keys_for_decrypt)
       
  2003 
       
  2004 	ldd	[%o0], %f52
       
  2005 	ldd	[%o0 + 0x8], %f54
       
  2006 	ldd	[%o0 + 0x10], %f48
       
  2007 	ldd	[%o0 + 0x18], %f50
       
  2008 	ldd	[%o0 + 0x20], %f44
       
  2009 	ldd	[%o0 + 0x28], %f46
       
  2010 	ldd	[%o0 + 0x30], %f40
       
  2011 	ldd	[%o0 + 0x38], %f42
       
  2012 	ldd	[%o0 + 0x40], %f36
       
  2013 	ldd	[%o0 + 0x48], %f38
       
  2014 	ldd	[%o0 + 0x50], %f32
       
  2015 	ldd	[%o0 + 0x58], %f34
       
  2016 	ldd	[%o0 + 0x60], %f28
       
  2017 	ldd	[%o0 + 0x68], %f30
       
  2018 	ldd	[%o0 + 0x70], %f24
       
  2019 	ldd	[%o0 + 0x78], %f26
       
  2020 	ldd	[%o0 + 0x80], %f20
       
  2021 	ldd	[%o0 + 0x88], %f22
       
  2022 	ldd	[%o0 + 0x90], %f16
       
  2023 	ldd	[%o0 + 0x98], %f18
       
  2024 	ldd	[%o0 + 0xa0], %f12
       
  2025 	ldd	[%o0 + 0xa8], %f14
       
  2026 	ldd	[%o0 + 0xb0], %f8
       
  2027 	retl
       
  2028 	ldd	[%o0 + 0xb8], %f10
       
  2029 
       
  2030 	SET_SIZE(t4_aes192_load_keys_for_decrypt)
       
  2031 
       
  2032 
       
  2033 	ENTRY(t4_aes256_load_keys_for_decrypt)
       
  2034 
       
  2035 
       
  2036 	ldd	[%o0], %f52
       
  2037 	ldd	[%o0 + 0x8], %f54
       
  2038 	ldd	[%o0 + 0x10], %f48
       
  2039 	ldd	[%o0 + 0x18], %f50
       
  2040 	ldd	[%o0 + 0x20], %f44
       
  2041 	ldd	[%o0 + 0x28], %f46
       
  2042 	ldd	[%o0 + 0x30], %f40
       
  2043 	ldd	[%o0 + 0x38], %f42
       
  2044 	ldd	[%o0 + 0x40], %f36
       
  2045 	ldd	[%o0 + 0x48], %f38
       
  2046 	ldd	[%o0 + 0x50], %f32
       
  2047 	ldd	[%o0 + 0x58], %f34
       
  2048 	ldd	[%o0 + 0x60], %f28
       
  2049 	ldd	[%o0 + 0x68], %f30
       
  2050 	ldd	[%o0 + 0x70], %f24
       
  2051 	ldd	[%o0 + 0x78], %f26
       
  2052 	ldd	[%o0 + 0x80], %f20
       
  2053 	ldd	[%o0 + 0x88], %f22
       
  2054 	ldd	[%o0 + 0x90], %f16
       
  2055 	ldd	[%o0 + 0x98], %f18
       
  2056 	ldd	[%o0 + 0xa0], %f12
       
  2057 	ldd	[%o0 + 0xa8], %f14
       
  2058 	ldd	[%o0 + 0xb0], %f8
       
  2059 	ldd	[%o0 + 0xb8], %f10
       
  2060 	ldd	[%o0 + 0xc0], %f4
       
  2061 	ldd	[%o0 + 0xc8], %f6
       
  2062 	ldd	[%o0 + 0xd0], %f0
       
  2063 	retl
       
  2064 	ldd	[%o0 + 0xd8], %f2
       
  2065 
       
  2066 	SET_SIZE(t4_aes256_load_keys_for_decrypt)
       
  2067 
       
  2068 
       
  2069 #define	 TEST_PARALLEL_ECB_DECRYPT
       
  2070 #ifdef	TEST_PARALLEL_ECB_DECRYPT
       
  2071 	ENTRY(t4_aes128_ecb_decrypt)
       
  2072 
       
  2073 	ldx	[%o0 + 0xa0], %g1	!ks[last-1]
       
  2074 	ldx	[%o0 + 0xa8], %g2	!ks[last]
       
  2075 	and	%o3, 16, %o4
       
  2076 	brz	%o4, ecbdec128_loop
       
  2077 	nop
       
  2078 
       
  2079 	ldx	[%o1], %o4
       
  2080 	ldx	[%o1 + 8], %o5
       
  2081 	xor	%g1, %o4, %g3	!initial ARK
       
  2082 	movxtod	%g3, %f60
       
  2083 	xor	%g2, %o5, %g3	!initial ARK
       
  2084 	movxtod	%g3, %f62
       
  2085 
       
  2086 	TEN_DROUNDS
       
  2087 
       
  2088 	std	%f60, [%o2]
       
  2089 	std	%f62, [%o2 + 0x8]
       
  2090 
       
  2091 	add	%o1, 16, %o1
       
  2092 	subcc	%o3, 16, %o3
       
  2093 	be	ecbdec128_loop_end
       
  2094 	add	%o2, 16, %o2
       
  2095 
       
  2096 ecbdec128_loop:
       
  2097 	ldx	[%o1], %o4
       
  2098 	ldx	[%o1 + 8], %o5
       
  2099 	xor	%g1, %o4, %g3	!initial ARK
       
  2100 	movxtod	%g3, %f0
       
  2101 	xor	%g2, %o5, %g3	!initial ARK
       
  2102 	movxtod	%g3, %f2
       
  2103 	ldx	[%o1 + 16], %o4
       
  2104 	ldx	[%o1 + 24], %o5
       
  2105 	xor	%g1, %o4, %g3	!initial ARK
       
  2106 	movxtod	%g3, %f60
       
  2107 	xor	%g2, %o5, %g3	!initial ARK
       
  2108 	movxtod	%g3, %f62
       
  2109 
       
  2110 	TEN_DROUNDS_2
       
  2111 
       
  2112 	std	%f0, [%o2]
       
  2113 	std	%f2, [%o2 + 8]
       
  2114 	std	%f60, [%o2 + 16]
       
  2115 	std	%f62, [%o2 + 24]
       
  2116 
       
  2117 	add	%o1, 32, %o1
       
  2118 	subcc	%o3, 32, %o3
       
  2119 	bne	ecbdec128_loop
       
  2120 	add	%o2, 32, %o2
       
  2121 ecbdec128_loop_end:
       
  2122 
       
  2123 	retl
       
  2124 	nop
       
  2125 
       
  2126 	SET_SIZE(t4_aes128_ecb_decrypt)
       
  2127 
       
  2128 	ENTRY(t4_aes192_ecb_decrypt)
       
  2129 
       
  2130 	ldx	[%o0 + 0xc0], %g1	!ks[last-1]
       
  2131 	ldx	[%o0 + 0xc8], %g2	!ks[last]
       
  2132 	and	%o3, 16, %o4
       
  2133 	brz	%o4, ecbdec192_loop
       
  2134 	nop
       
  2135 
       
  2136 	ldx	[%o1], %o4
       
  2137 	ldx	[%o1 + 8], %o5
       
  2138 	xor	%g1, %o4, %g3	!initial ARK
       
  2139 	movxtod	%g3, %f60
       
  2140 	xor	%g2, %o5, %g3	!initial ARK
       
  2141 	movxtod	%g3, %f62
       
  2142 
       
  2143 	TWELVE_DROUNDS
       
  2144 
       
  2145 	std	%f60, [%o2]
       
  2146 	std	%f62, [%o2 + 0x8]
       
  2147 
       
  2148 	add	%o1, 16, %o1
       
  2149 	subcc	%o3, 16, %o3
       
  2150 	be	ecbdec192_loop_end
       
  2151 	add	%o2, 16, %o2
       
  2152 
       
  2153 ecbdec192_loop:
       
  2154 	ldx	[%o1], %o4
       
  2155 	ldx	[%o1 + 8], %o5
       
  2156 	xor	%g1, %o4, %g3	!initial ARK
       
  2157 	movxtod	%g3, %f0
       
  2158 	xor	%g2, %o5, %g3	!initial ARK
       
  2159 	movxtod	%g3, %f2
       
  2160 	ldx	[%o1 + 16], %o4
       
  2161 	ldx	[%o1 + 24], %o5
       
  2162 	xor	%g1, %o4, %g3	!initial ARK
       
  2163 	movxtod	%g3, %f60
       
  2164 	xor	%g2, %o5, %g3	!initial ARK
       
  2165 	movxtod	%g3, %f62
       
  2166 
       
  2167 	TWELVE_DROUNDS_2
       
  2168 
       
  2169 	std	%f0, [%o2]
       
  2170 	std	%f2, [%o2 + 8]
       
  2171 	std	%f60, [%o2 + 16]
       
  2172 	std	%f62, [%o2 + 24]
       
  2173 
       
  2174 	add	%o1, 32, %o1
       
  2175 	subcc	%o3, 32, %o3
       
  2176 	bne	ecbdec192_loop
       
  2177 	add	%o2, 32, %o2
       
  2178 ecbdec192_loop_end:
       
  2179 
       
  2180 	retl
       
  2181 	nop
       
  2182 
       
  2183 	SET_SIZE(t4_aes192_ecb_decrypt)
       
  2184 
       
  2185 
       
  2186 	ENTRY(t4_aes256_ecb_decrypt)
       
  2187 
       
  2188 	ldx	[%o0 + 0xe0], %g1	!ks[last-1]
       
  2189 	ldx	[%o0 + 0xe8], %g2	!ks[last]
       
  2190 	and	%o3, 16, %o4
       
  2191 	brz	%o4, ecbdec256_loop
       
  2192 	nop
       
  2193 
       
  2194 	ldx	[%o1], %o4
       
  2195 	ldx	[%o1 + 8], %o5
       
  2196 	xor	%g1, %o4, %g3	!initial ARK
       
  2197 	movxtod	%g3, %f60
       
  2198 	xor	%g2, %o5, %g3	!initial ARK
       
  2199 	movxtod	%g3, %f62
       
  2200 
       
  2201 	FOURTEEN_DROUNDS
       
  2202 
       
  2203 	std	%f60, [%o2]
       
  2204 	std	%f62, [%o2 + 0x8]
       
  2205 
       
  2206 	add	%o1, 16, %o1
       
  2207 	subcc	%o3, 16, %o3
       
  2208 	be	ecbdec256_loop_end
       
  2209 	add	%o2, 16, %o2
       
  2210 
       
  2211 ecbdec256_loop:
       
  2212 	ldx	[%o1], %o4
       
  2213 	ldx	[%o1 + 8], %o5
       
  2214 	xor	%g1, %o4, %g3	!initial ARK
       
  2215 	movxtod	%g3, %f20
       
  2216 	xor	%g2, %o5, %g3	!initial ARK
       
  2217 	movxtod	%g3, %f22
       
  2218 	ldx	[%o1 + 16], %o4
       
  2219 	ldx	[%o1 + 24], %o5
       
  2220 	xor	%g1, %o4, %g3	!initial ARK
       
  2221 	movxtod	%g3, %f60
       
  2222 	xor	%g2, %o5, %g3	!initial ARK
       
  2223 	movxtod	%g3, %f62
       
  2224 
       
  2225 	FOURTEEN_DROUNDS_2
       
  2226 
       
  2227 	std	%f20, [%o2]
       
  2228 	std	%f22, [%o2 + 8]
       
  2229 	std	%f60, [%o2 + 16]
       
  2230 	std	%f62, [%o2 + 24]
       
  2231 
       
  2232 	add	%o1, 32, %o1
       
  2233 	subcc	%o3, 32, %o3
       
  2234 	bne	ecbdec256_loop
       
  2235 	add	%o2, 32, %o2
       
  2236 
       
  2237 	ldd	[%o0 + 0x80], %f20
       
  2238 	ldd	[%o0 + 0x88], %f22
       
  2239 
       
  2240 ecbdec256_loop_end:
       
  2241 
       
  2242 	retl
       
  2243 	nop
       
  2244 
       
  2245 	SET_SIZE(t4_aes256_ecb_decrypt)
       
  2246 
       
  2247 #else
       
  2248 
       
  2249 	ENTRY(t4_aes128_ecb_decrypt)
       
  2250 
       
  2251 	ldx	[%o0 + 0xa0], %g1	!ks[last-1]
       
  2252 	ldx	[%o0 + 0xa8], %g2	!ks[last]
       
  2253 
       
  2254 ecbdec128_loop:
       
  2255 	ldx	[%o1], %o4
       
  2256 	ldx	[%o1 + 8], %o5
       
  2257 	xor	%g1, %o4, %g3	!initial ARK
       
  2258 	movxtod	%g3, %f60
       
  2259 	xor	%g2, %o5, %g3	!initial ARK
       
  2260 	movxtod	%g3, %f62
       
  2261 
       
  2262 	TEN_DROUNDS
       
  2263 
       
  2264 	std	%f60, [%o2]
       
  2265 	std	%f62, [%o2 + 0x8]
       
  2266 
       
  2267 	add	%o1, 16, %o1
       
  2268 	subcc	%o3, 16, %o3
       
  2269 	bne	ecbdec128_loop
       
  2270 	add	%o2, 16, %o2
       
  2271 
       
  2272 	retl
       
  2273 	nop
       
  2274 
       
  2275 	SET_SIZE(t4_aes128_ecb_decrypt)
       
  2276 
       
  2277 
       
  2278 	ENTRY(t4_aes192_ecb_decrypt)
       
  2279 
       
  2280 	ldx	[%o0 + 0xc0], %g1	!ks[last-1]
       
  2281 	ldx	[%o0 + 0xc8], %g2	!ks[last]
       
  2282 
       
  2283 ecbdec192_loop:
       
  2284 	ldx	[%o1], %o4
       
  2285 	ldx	[%o1 + 8], %o5
       
  2286 	xor	%g1, %o4, %g3	!initial ARK
       
  2287 	movxtod	%g3, %f60
       
  2288 	xor	%g2, %o5, %g3	!initial ARK
       
  2289 	movxtod	%g3, %f62
       
  2290 
       
  2291 	TWELVE_DROUNDS
       
  2292 
       
  2293 	std	%f60, [%o2]
       
  2294 	std	%f62, [%o2 + 0x8]
       
  2295 
       
  2296 	add	%o1, 16, %o1
       
  2297 	subcc	%o3, 16, %o3
       
  2298 	bne	ecbdec192_loop
       
  2299 	add	%o2, 16, %o2
       
  2300 
       
  2301 	retl
       
  2302 	nop
       
  2303 
       
  2304 	SET_SIZE(t4_aes192_ecb_decrypt)
       
  2305 
       
  2306 
       
  2307 	ENTRY(t4_aes256_ecb_decrypt)
       
  2308 
       
  2309 	ldx	[%o0 + 0xe0], %g1	!ks[last-1]
       
  2310 	ldx	[%o0 + 0xe8], %g2	!ks[last]
       
  2311 
       
  2312 ecbdec256_loop:
       
  2313 	ldx	[%o1], %o4
       
  2314 	ldx	[%o1 + 8], %o5
       
  2315 	xor	%g1, %o4, %g3	!initial ARK
       
  2316 	movxtod	%g3, %f60
       
  2317 	xor	%g2, %o5, %g3	!initial ARK
       
  2318 	movxtod	%g3, %f62
       
  2319 
       
  2320 	FOURTEEN_DROUNDS
       
  2321 
       
  2322 	std	%f60, [%o2]
       
  2323 	std	%f62, [%o2 + 0x8]
       
  2324 
       
  2325 	add	%o1, 16, %o1
       
  2326 	subcc	%o3, 16, %o3
       
  2327 	bne	ecbdec256_loop
       
  2328 	add	%o2, 16, %o2
       
  2329 
       
  2330 	retl
       
  2331 	nop
       
  2332 
       
  2333 	SET_SIZE(t4_aes256_ecb_decrypt)
       
  2334 
       
  2335 #endif
       
  2336 
       
  2337 #define	TEST_PARALLEL_CBC_DECRYPT
       
  2338 #ifdef	EST_PARALLEL_CBC_DECRYPT
       
  2339 		ENTRY(t4_aes128_cbc_decrypt)
       
  2340 
       
  2341 	save	%sp, -SA(MINFRAME), %sp
       
  2342 	ldx	[%i4], %o0		!IV
       
  2343 	ldx	[%i4 + 8], %o1		!IV
       
  2344 	ldx	[%i0 + 0xa0], %o2	!ks[last-1]
       
  2345 	ldx	[%i0 + 0xa8], %o3	!ks[last]
       
  2346 	and	%i3, 16, %o4
       
  2347 	brz	%o4, cbcdec128_loop
       
  2348 	nop
       
  2349 
       
  2350 	ldx	[%i1], %o4
       
  2351 	ldx	[%i1 + 8], %o5
       
  2352 	xor	%o2, %o4, %g1	!initial ARK
       
  2353 	movxtod	%g1, %f60
       
  2354 	xor	%o3, %o5, %g1	!initial ARK
       
  2355 	movxtod	%g1, %f62
       
  2356 
       
  2357 	TEN_DROUNDS
       
  2358 
       
  2359 	movxtod	%o0, %f56
       
  2360 	movxtod	%o1, %f58
       
  2361 	mov	%o4, %o0	!save last block as next IV
       
  2362 	mov	%o5, %o1
       
  2363 	fxor	%f56, %f60, %f60	!add in previous IV
       
  2364 	fxor	%f58, %f62, %f62
       
  2365 
       
  2366 	std	%f60, [%i2]
       
  2367 	std	%f62, [%i2 + 0x8]
       
  2368 
       
  2369 	add	%i1, 16, %i1
       
  2370 	subcc	%i3, 16, %i3
       
  2371 	be	cbcdec128_loop_end
       
  2372 	add	%i2, 16, %i2
       
  2373 
       
  2374 
       
  2375 cbcdec128_loop:
       
  2376 	ldx	[%i1], %g4
       
  2377 	ldx	[%i1 + 8], %g5
       
  2378 	xor	%o2, %g4, %g1	!initial ARK
       
  2379 	movxtod	%g1, %f0
       
  2380 	xor	%o3, %g5, %g1	!initial ARK
       
  2381 	movxtod	%g1, %f2
       
  2382 
       
  2383 	ldx	[%i1 + 16], %o4
       
  2384 	ldx	[%i1 + 24], %o5
       
  2385 	xor	%o2, %o4, %g1	!initial ARK
       
  2386 	movxtod	%g1, %f60
       
  2387 	xor	%o3, %o5, %g1	!initial ARK
       
  2388 	movxtod	%g1, %f62
       
  2389 
       
  2390 	TEN_DROUNDS_2
       
  2391 
       
  2392 	movxtod	%o0, %f6
       
  2393 	movxtod	%o1, %f4
       
  2394 	fxor	%f6, %f0, %f0	!add in previous IV
       
  2395 	fxor	%f4, %f2, %f2
       
  2396 
       
  2397 	std	%f0, [%i2]
       
  2398 	std	%f2, [%i2 + 8]
       
  2399 
       
  2400 	movxtod	%g4, %f56
       
  2401 	movxtod	%g5, %f58
       
  2402 	mov	%o4, %o0	!save last block as next IV
       
  2403 	mov	%o5, %o1
       
  2404 	fxor	%f56, %f60, %f60	!add in previous IV
       
  2405 	fxor	%f58, %f62, %f62
       
  2406 
       
  2407 	std	%f60, [%i2 + 16]
       
  2408 	std	%f62, [%i2 + 24]
       
  2409 
       
  2410 	add	%i1, 32, %i1
       
  2411 	subcc	%i3, 32, %i3
       
  2412 	bne	cbcdec128_loop
       
  2413 	add	%i2, 32, %i2
       
  2414 
       
  2415 cbcdec128_loop_end:
       
  2416 	stx	%o0, [%i4]
       
  2417 	stx	%o1, [%i4 + 8]
       
  2418 	ret
       
  2419 	restore
       
  2420 
       
  2421 	SET_SIZE(t4_aes128_cbc_decrypt)
       
  2422 
       
  2423 
       
  2424 	ENTRY(t4_aes192_cbc_decrypt)
       
  2425 
       
  2426 	save	%sp, -SA(MINFRAME), %sp
       
  2427 	ldx	[%i4], %o0		!IV
       
  2428 	ldx	[%i4 + 8], %o1		!IV
       
  2429 	ldx	[%i0 + 0xc0], %o2	!ks[last-1]
       
  2430 	ldx	[%i0 + 0xc8], %o3	!ks[last]
       
  2431 	and	%i3, 16, %o4
       
  2432 	brz	%o4, cbcdec192_loop
       
  2433 	nop
       
  2434 
       
  2435 	ldx	[%i1], %o4
       
  2436 	ldx	[%i1 + 8], %o5
       
  2437 	xor	%o2, %o4, %g1	!initial ARK
       
  2438 	movxtod	%g1, %f60
       
  2439 	xor	%o3, %o5, %g1	!initial ARK
       
  2440 	movxtod	%g1, %f62
       
  2441 
       
  2442 	TWELVE_DROUNDS
       
  2443 
       
  2444 	movxtod	%o0, %f56
       
  2445 	movxtod	%o1, %f58
       
  2446 	mov	%o4, %o0	!save last block as next IV
       
  2447 	mov	%o5, %o1
       
  2448 	fxor	%f56, %f60, %f60	!add in previous IV
       
  2449 	fxor	%f58, %f62, %f62
       
  2450 
       
  2451 	std	%f60, [%i2]
       
  2452 	std	%f62, [%i2 + 0x8]
       
  2453 
       
  2454 	add	%i1, 16, %i1
       
  2455 	subcc	%i3, 16, %i3
       
  2456 	be	cbcdec192_loop_end
       
  2457 	add	%i2, 16, %i2
       
  2458 
       
  2459 
       
  2460 cbcdec192_loop:
       
  2461 	ldx	[%i1], %g4
       
  2462 	ldx	[%i1 + 8], %g5
       
  2463 	xor	%o2, %g4, %g1	!initial ARK
       
  2464 	movxtod	%g1, %f0
       
  2465 	xor	%o3, %g5, %g1	!initial ARK
       
  2466 	movxtod	%g1, %f2
       
  2467 
       
  2468 	ldx	[%i1 + 16], %o4
       
  2469 	ldx	[%i1 + 24], %o5
       
  2470 	xor	%o2, %o4, %g1	!initial ARK
       
  2471 	movxtod	%g1, %f60
       
  2472 	xor	%o3, %o5, %g1	!initial ARK
       
  2473 	movxtod	%g1, %f62
       
  2474 
       
  2475 	TWELVE_DROUNDS_2
       
  2476 
       
  2477 	movxtod	%o0, %f6
       
  2478 	movxtod	%o1, %f4
       
  2479 	fxor	%f6, %f0, %f0	!add in previous IV
       
  2480 	fxor	%f4, %f2, %f2
       
  2481 
       
  2482 	std	%f0, [%i2]
       
  2483 	std	%f2, [%i2 + 8]
       
  2484 
       
  2485 	movxtod	%g4, %f56
       
  2486 	movxtod	%g5, %f58
       
  2487 	mov	%o4, %o0	!save last block as next IV
       
  2488 	mov	%o5, %o1
       
  2489 	fxor	%f56, %f60, %f60	!add in previous IV
       
  2490 	fxor	%f58, %f62, %f62
       
  2491 
       
  2492 	std	%f60, [%i2 + 16]
       
  2493 	std	%f62, [%i2 + 24]
       
  2494 
       
  2495 	add	%i1, 32, %i1
       
  2496 	subcc	%i3, 32, %i3
       
  2497 	bne	cbcdec192_loop
       
  2498 	add	%i2, 32, %i2
       
  2499 
       
  2500 cbcdec192_loop_end:
       
  2501 	stx	%o0, [%i4]
       
  2502 	stx	%o1, [%i4 + 8]
       
  2503 	ret
       
  2504 	restore
       
  2505 
       
  2506 	SET_SIZE(t4_aes192_cbc_decrypt)
       
  2507 
       
  2508 
       
  2509 	ENTRY(t4_aes256_cbc_decrypt)
       
  2510 
       
  2511 	save	%sp, -SA(MINFRAME), %sp
       
  2512 	mov	%i0, %o0		!FOURTEEN_DROUNDS uses %o0
       
  2513 	ldx	[%i4], %g2		!IV
       
  2514 	ldx	[%i4 + 8], %o1		!IV
       
  2515 	ldx	[%o0 + 0xe0], %o2	!ks[last-1]
       
  2516 	ldx	[%o0 + 0xe8], %o3	!ks[last]
       
  2517 	and	%i3, 16, %o4
       
  2518 	brz	%o4, cbcdec256_loop
       
  2519 	nop
       
  2520 
       
  2521 	ldx	[%i1], %o4
       
  2522 	ldx	[%i1 + 8], %o5
       
  2523 	xor	%o2, %o4, %g1	!initial ARK
       
  2524 	movxtod	%g1, %f60
       
  2525 	xor	%o3, %o5, %g1	!initial ARK
       
  2526 	movxtod	%g1, %f62
       
  2527 
       
  2528 	FOURTEEN_DROUNDS
       
  2529 
       
  2530 	movxtod	%g2, %f56
       
  2531 	movxtod	%o1, %f58
       
  2532 	mov	%o4, %g2	!save last block as next IV
       
  2533 	mov	%o5, %o1
       
  2534 	fxor	%f56, %f60, %f60	!add in previous IV
       
  2535 	fxor	%f58, %f62, %f62
       
  2536 
       
  2537 	std	%f60, [%i2]
       
  2538 	std	%f62, [%i2 + 0x8]
       
  2539 
       
  2540 	add	%i1, 16, %i1
       
  2541 	subcc	%i3, 16, %i3
       
  2542 	be	cbcdec256_loop_end
       
  2543 	add	%i2, 16, %i2
       
  2544 
       
  2545 
       
  2546 cbcdec256_loop:
       
  2547 	ldx	[%i1], %g4
       
  2548 	ldx	[%i1 + 8], %g5
       
  2549 	xor	%o2, %g4, %g1	!initial ARK
       
  2550 	movxtod	%g1, %f20
       
  2551 	xor	%o3, %g5, %g1	!initial ARK
       
  2552 	movxtod	%g1, %f22
       
  2553 
       
  2554 	ldx	[%i1 + 16], %o4
       
  2555 	ldx	[%i1 + 24], %o5
       
  2556 	xor	%o2, %o4, %g1	!initial ARK
       
  2557 	movxtod	%g1, %f60
       
  2558 	xor	%o3, %o5, %g1	!initial ARK
       
  2559 	movxtod	%g1, %f62
       
  2560 
       
  2561 	FOURTEEN_DROUNDS_2
       
  2562 
       
  2563 	movxtod	%g2, %f56
       
  2564 	movxtod	%o1, %f58
       
  2565 	fxor	%f56, %f20, %f20	!add in previous IV
       
  2566 	fxor	%f58, %f22, %f22
       
  2567 
       
  2568 	std	%f20, [%i2]
       
  2569 	std	%f22, [%i2 + 8]
       
  2570 
       
  2571 	movxtod	%g4, %f56
       
  2572 	movxtod	%g5, %f58
       
  2573 	mov	%o4, %g2	!save last block as next IV
       
  2574 	mov	%o5, %o1
       
  2575 	fxor	%f56, %f60, %f60	!add in previous IV
       
  2576 	fxor	%f58, %f62, %f62
       
  2577 
       
  2578 	std	%f60, [%i2 + 16]
       
  2579 	std	%f62, [%i2 + 24]
       
  2580 
       
  2581 	add	%i1, 32, %i1
       
  2582 	subcc	%i3, 32, %i3
       
  2583 	bne	cbcdec256_loop
       
  2584 	add	%i2, 32, %i2
       
  2585 
       
  2586 	ldd	[%o0 + 0x80], %f20
       
  2587 	ldd	[%o0 + 0x88], %f22
       
  2588 
       
  2589 cbcdec256_loop_end:
       
  2590 	stx	%g2, [%i4]
       
  2591 	stx	%o1, [%i4 + 8]
       
  2592 	ret
       
  2593 	restore
       
  2594 
       
  2595 	SET_SIZE(t4_aes256_cbc_decrypt)
       
  2596 
       
  2597 #else
       
  2598 
       
  2599 	ENTRY(t4_aes128_cbc_decrypt)
       
  2600 
       
  2601 	save	%sp, -SA(MINFRAME), %sp
       
  2602 	ldx	[%i4], %o0		!IV
       
  2603 	ldx	[%i4 + 8], %o1		!IV
       
  2604 	ldx	[%i0 + 0xa0], %o2	!ks[last-1]
       
  2605 	ldx	[%i0 + 0xa8], %o3	!ks[last]
       
  2606 
       
  2607 cbcdec128_loop:
       
  2608 	ldx	[%i1], %o4
       
  2609 	ldx	[%i1 + 8], %o5
       
  2610 	xor	%o2, %o4, %g1	!initial ARK
       
  2611 	movxtod	%g1, %f60
       
  2612 	xor	%o3, %o5, %g1	!initial ARK
       
  2613 	movxtod	%g1, %f62
       
  2614 
       
  2615 	TEN_DROUNDS
       
  2616 
       
  2617 	movxtod	%o0, %f56
       
  2618 	movxtod	%o1, %f58
       
  2619 	mov	%o4, %o0	!save last block as next IV
       
  2620 	mov	%o5, %o1
       
  2621 	fxor	%f56, %f60, %f60	!add in previous IV
       
  2622 	fxor	%f58, %f62, %f62
       
  2623 
       
  2624 	std	%f60, [%i2]
       
  2625 	std	%f62, [%i2 + 0x8]
       
  2626 
       
  2627 	add	%i1, 16, %i1
       
  2628 	subcc	%i3, 16, %i3
       
  2629 	bne	cbcdec128_loop
       
  2630 	add	%i2, 16, %i2
       
  2631 
       
  2632 	stx	%o0, [%i4]
       
  2633 	stx	%o1, [%i4 + 8]
       
  2634 	ret
       
  2635 	restore
       
  2636 
       
  2637 	SET_SIZE(t4_aes128_cbc_decrypt)
       
  2638 
       
  2639 
       
  2640 	ENTRY(t4_aes192_cbc_decrypt)
       
  2641 
       
  2642 	save	%sp, -SA(MINFRAME), %sp
       
  2643 	ldx	[%i4], %o0		!IV
       
  2644 	ldx	[%i4 + 8], %o1		!IV
       
  2645 	ldx	[%i0 + 0xc0], %o2	!ks[last-1]
       
  2646 	ldx	[%i0 + 0xc8], %o3	!ks[last]
       
  2647 
       
  2648 cbcdec192_loop:
       
  2649 	ldx	[%i1], %o4
       
  2650 	ldx	[%i1 + 8], %o5
       
  2651 	xor	%o2, %o4, %g1	!initial ARK
       
  2652 	movxtod	%g1, %f60
       
  2653 	xor	%o3, %o5, %g1	!initial ARK
       
  2654 	movxtod	%g1, %f62
       
  2655 
       
  2656 	TWELVE_DROUNDS
       
  2657 
       
  2658 	movxtod	%o0, %f56
       
  2659 	movxtod	%o1, %f58
       
  2660 	mov	%o4, %o0	!save last block as next IV
       
  2661 	mov	%o5, %o1
       
  2662 	fxor	%f56, %f60, %f60	!add in previous IV
       
  2663 	fxor	%f58, %f62, %f62
       
  2664 
       
  2665 	std	%f60, [%i2]
       
  2666 	std	%f62, [%i2 + 0x8]
       
  2667 
       
  2668 	add	%i1, 16, %i1
       
  2669 	subcc	%i3, 16, %i3
       
  2670 	bne	cbcdec192_loop
       
  2671 	add	%i2, 16, %i2
       
  2672 
       
  2673 	stx	%o0, [%i4]
       
  2674 	stx	%o1, [%i4 + 8]
       
  2675 	ret
       
  2676 	restore
       
  2677 
       
  2678 	SET_SIZE(t4_aes192_cbc_decrypt)
       
  2679 
       
  2680 
       
  2681 	ENTRY(t4_aes256_cbc_decrypt)
       
  2682 
       
  2683 	save	%sp, -SA(MINFRAME), %sp
       
  2684 	ldx	[%i4], %o0		!IV
       
  2685 	ldx	[%i4 + 8], %o1		!IV
       
  2686 	ldx	[%i0 + 0xe0], %o2	!ks[last-1]
       
  2687 	ldx	[%i0 + 0xe8], %o3	!ks[last]
       
  2688 
       
  2689 cbcdec256_loop:
       
  2690 	ldx	[%i1], %o4
       
  2691 	ldx	[%i1 + 8], %o5
       
  2692 	xor	%o2, %o4, %g1	!initial ARK
       
  2693 	movxtod	%g1, %f60
       
  2694 	xor	%o3, %o5, %g1	!initial ARK
       
  2695 	movxtod	%g1, %f62
       
  2696 
       
  2697 	FOURTEEN_DROUNDS
       
  2698 
       
  2699 	movxtod	%o0, %f56
       
  2700 	movxtod	%o1, %f58
       
  2701 	mov	%o4, %o0	!save last block as next IV
       
  2702 	mov	%o5, %o1
       
  2703 	fxor	%f56, %f60, %f60	!add in previous IV
       
  2704 	fxor	%f58, %f62, %f62
       
  2705 
       
  2706 	std	%f60, [%i2]
       
  2707 	std	%f62, [%i2 + 0x8]
       
  2708 
       
  2709 	add	%i1, 16, %i1
       
  2710 	subcc	%i3, 16, %i3
       
  2711 	bne	cbcdec256_loop
       
  2712 	add	%i2, 16, %i2
       
  2713 
       
  2714 	stx	%o0, [%i4]
       
  2715 	stx	%o1, [%i4 + 8]
       
  2716 	ret
       
  2717 	restore
       
  2718 
       
  2719 	SET_SIZE(t4_aes256_cbc_decrypt)
       
  2720 
       
  2721 #endif
       
  2722 
       
  2723 #define	TEST_PARALLEL_CFB128_DECRYPT
       
  2724 #ifdef	TEST_PARALLEL_CFB128_DECRYPT
       
  2725 
       
  2726 	ENTRY(t4_aes128_cfb128_decrypt)
       
  2727 
       
  2728 	ldd	[%o4], %f56	!IV
       
  2729 	ldd	[%o4 + 8], %f58	!IV
       
  2730 	ldx	[%o0], %g1	! ks[0]
       
  2731 	ldx	[%o0 + 8], %g2	! ks[1]
       
  2732 	and	%o3, 16, %o5
       
  2733 	brz	%o5, cfb128dec_128_loop
       
  2734 
       
  2735 	movxtod	%g1, %f60
       
  2736 	movxtod	%g2, %f62
       
  2737 	fxor	%f60, %f56, %f60
       
  2738 	fxor	%f62, %f58, %f62
       
  2739 
       
  2740 	/* CFB mode uses encryption for the decrypt operation */
       
  2741 	TEN_EROUNDS
       
  2742 
       
  2743 	ldd	[%o1], %f56	!input
       
  2744 	ldd	[%o1 + 8], %f58	!input
       
  2745 	fxor	%f60, %f56, %f60
       
  2746 	fxor	%f62, %f58, %f62
       
  2747 
       
  2748 	std	%f60, [%o2]
       
  2749 	std	%f62, [%o2 + 8]
       
  2750 
       
  2751 	add	%o1, 16, %o1
       
  2752 	subcc	%o3, 16, %o3
       
  2753 	be	cfb128dec_128_loop_end
       
  2754 	add	%o2, 16, %o2
       
  2755 
       
  2756 cfb128dec_128_loop:
       
  2757 	ldd	[%o1], %f6	!input
       
  2758 	ldd	[%o1 + 8], %f4	!input
       
  2759 	movxtod	%g1, %f60
       
  2760 	movxtod	%g2, %f62
       
  2761 	fxor	%f60, %f6, %f0
       
  2762 	fxor	%f62, %f4, %f2
       
  2763 	fxor	%f60, %f56, %f60
       
  2764 	fxor	%f62, %f58, %f62
       
  2765 
       
  2766 	/* CFB mode uses encryption for the decrypt operation */
       
  2767 	TEN_EROUNDS_2
       
  2768 
       
  2769 	ldd	[%o1], %f6	!input
       
  2770 	ldd	[%o1 + 8], %f4	!input
       
  2771 	ldd	[%o1 + 16], %f56	!input
       
  2772 	ldd	[%o1 + 24], %f58	!input
       
  2773 
       
  2774 	fxor	%f60, %f6, %f6
       
  2775 	fxor	%f62, %f4, %f4
       
  2776 	fxor	%f0, %f56, %f60
       
  2777 	fxor	%f2, %f58, %f62
       
  2778 
       
  2779 	std	%f6, [%o2]
       
  2780 	std	%f4, [%o2 + 8]
       
  2781 	std	%f60, [%o2 + 16]
       
  2782 	std	%f62, [%o2 + 24]
       
  2783 
       
  2784 	add	%o1, 32, %o1
       
  2785 	subcc	%o3, 32, %o3
       
  2786 	bne	cfb128dec_128_loop
       
  2787 	add	%o2, 32, %o2
       
  2788 
       
  2789 cfb128dec_128_loop_end:
       
  2790 	std	%f56, [%o4]
       
  2791 	retl
       
  2792 	std	%f58, [%o4 + 8]
       
  2793 
       
  2794 	SET_SIZE(t4_aes128_cfb128_decrypt)
       
  2795 
       
  2796 
       
  2797 	ENTRY(t4_aes192_cfb128_decrypt)
       
  2798 
       
  2799 	ldd	[%o4], %f56	!IV
       
  2800 	ldd	[%o4 + 8], %f58	!IV
       
  2801 	ldx	[%o0], %g1	! ks[0]
       
  2802 	ldx	[%o0 + 8], %g2	! ks[1]
       
  2803 	and	%o3, 16, %o5
       
  2804 	brz	%o5, cfb128dec_192_loop
       
  2805 
       
  2806 	movxtod	%g1, %f60
       
  2807 	movxtod	%g2, %f62
       
  2808 	fxor	%f60, %f56, %f60
       
  2809 	fxor	%f62, %f58, %f62
       
  2810 
       
  2811 	/* CFB mode uses encryption for the decrypt operation */
       
  2812 	TWELVE_EROUNDS
       
  2813 
       
  2814 	ldd	[%o1], %f56	!input
       
  2815 	ldd	[%o1 + 8], %f58	!input
       
  2816 	fxor	%f60, %f56, %f60
       
  2817 	fxor	%f62, %f58, %f62
       
  2818 
       
  2819 	std	%f60, [%o2]
       
  2820 	std	%f62, [%o2 + 8]
       
  2821 
       
  2822 	add	%o1, 16, %o1
       
  2823 	subcc	%o3, 16, %o3
       
  2824 	be	cfb128dec_192_loop_end
       
  2825 	add	%o2, 16, %o2
       
  2826 
       
  2827 cfb128dec_192_loop:
       
  2828 	ldd	[%o1], %f6	!input
       
  2829 	ldd	[%o1 + 8], %f4	!input
       
  2830 	movxtod	%g1, %f60
       
  2831 	movxtod	%g2, %f62
       
  2832 	fxor	%f60, %f6, %f0
       
  2833 	fxor	%f62, %f4, %f2
       
  2834 	fxor	%f60, %f56, %f60
       
  2835 	fxor	%f62, %f58, %f62
       
  2836 
       
  2837 	/* CFB mode uses encryption for the decrypt operation */
       
  2838 	TWELVE_EROUNDS_2
       
  2839 
       
  2840 	ldd	[%o1], %f6	!input
       
  2841 	ldd	[%o1 + 8], %f4	!input
       
  2842 	ldd	[%o1 + 16], %f56	!input
       
  2843 	ldd	[%o1 + 24], %f58	!input
       
  2844 
       
  2845 	fxor	%f60, %f6, %f6
       
  2846 	fxor	%f62, %f4, %f4
       
  2847 	fxor	%f0, %f56, %f60
       
  2848 	fxor	%f2, %f58, %f62
       
  2849 
       
  2850 	std	%f6, [%o2]
       
  2851 	std	%f4, [%o2 + 8]
       
  2852 	std	%f60, [%o2 + 16]
       
  2853 	std	%f62, [%o2 + 24]
       
  2854 
       
  2855 	add	%o1, 32, %o1
       
  2856 	subcc	%o3, 32, %o3
       
  2857 	bne	cfb128dec_192_loop
       
  2858 	add	%o2, 32, %o2
       
  2859 
       
  2860 cfb128dec_192_loop_end:
       
  2861 	std	%f56, [%o4]
       
  2862 	retl
       
  2863 	std	%f58, [%o4 + 8]
       
  2864 
       
  2865 	SET_SIZE(t4_aes192_cfb128_decrypt)
       
  2866 
       
  2867 
       
  2868 	ENTRY(t4_aes256_cfb128_decrypt)
       
  2869 
       
  2870 	ldd	[%o4], %f56	!IV
       
  2871 	ldd	[%o4 + 8], %f58	!IV
       
  2872 	ldx	[%o0], %g1	! ks[0]
       
  2873 	ldx	[%o0 + 8], %g2	! ks[1]
       
  2874 	and	%o3, 16, %o5
       
  2875 	brz	%o5, cfb128dec_256_loop
       
  2876 
       
  2877 	movxtod	%g1, %f60
       
  2878 	movxtod	%g2, %f62
       
  2879 	fxor	%f60, %f56, %f60
       
  2880 	fxor	%f62, %f58, %f62
       
  2881 
       
  2882 	/* CFB mode uses encryption for the decrypt operation */
       
  2883 	FOURTEEN_EROUNDS
       
  2884 
       
  2885 	ldd	[%o1], %f56	!input
       
  2886 	ldd	[%o1 + 8], %f58	!input
       
  2887 	fxor	%f60, %f56, %f60
       
  2888 	fxor	%f62, %f58, %f62
       
  2889 
       
  2890 	std	%f60, [%o2]
       
  2891 	std	%f62, [%o2 + 8]
       
  2892 
       
  2893 	add	%o1, 16, %o1
       
  2894 	subcc	%o3, 16, %o3
       
  2895 	be	cfb128dec_256_loop_end
       
  2896 	add	%o2, 16, %o2
       
  2897 
       
  2898 cfb128dec_256_loop:
       
  2899 	ldd	[%o1], %f20	!input
       
  2900 	ldd	[%o1 + 8], %f22	!input
       
  2901 	movxtod	%g1, %f60
       
  2902 	movxtod	%g2, %f62
       
  2903 	fxor	%f60, %f20, %f20
       
  2904 	fxor	%f62, %f22, %f22
       
  2905 	fxor	%f60, %f56, %f60
       
  2906 	fxor	%f62, %f58, %f62
       
  2907 
       
  2908 	/* CFB mode uses encryption for the decrypt operation */
       
  2909 	FOURTEEN_EROUNDS_2
       
  2910 
       
  2911 	ldd	[%o1 + 16], %f56	!input
       
  2912 	ldd	[%o1 + 24], %f58	!input
       
  2913 	fxor	%f20, %f56, %f20
       
  2914 	fxor	%f22, %f58, %f22
       
  2915 	std	%f20, [%o2 + 16]
       
  2916 	std	%f22, [%o2 + 24]
       
  2917 
       
  2918 	ldd	[%o1], %f20	!input
       
  2919 	ldd	[%o1 + 8], %f22	!input
       
  2920 
       
  2921 	fxor	%f60, %f20, %f20
       
  2922 	fxor	%f62, %f22, %f22
       
  2923 
       
  2924 	std	%f20, [%o2]
       
  2925 	std	%f22, [%o2 + 8]
       
  2926 
       
  2927 	add	%o1, 32, %o1
       
  2928 	subcc	%o3, 32, %o3
       
  2929 	bne	cfb128dec_256_loop
       
  2930 	add	%o2, 32, %o2
       
  2931 
       
  2932 	ldd	[%o0 + 0x60], %f20
       
  2933 	ldd	[%o0 + 0x68], %f22
       
  2934 
       
  2935 cfb128dec_256_loop_end:
       
  2936 	std	%f56, [%o4]
       
  2937 	retl
       
  2938 	std	%f58, [%o4 + 8]
       
  2939 
       
  2940 	SET_SIZE(t4_aes256_cfb128_decrypt)
       
  2941 
       
  2942 #else
       
  2943 	ENTRY(t4_aes128_cfb128_decrypt)
       
  2944 
       
  2945 	ldd	[%o4], %f56	!IV
       
  2946 	ldd	[%o4 + 8], %f58	!IV
       
  2947 	ldx	[%o0], %g1	! ks[0]
       
  2948 	ldx	[%o0 + 8], %g2	! ks[1]
       
  2949 
       
  2950 cfb128dec_128_loop:
       
  2951 	movxtod	%g1, %f60
       
  2952 	movxtod	%g2, %f62
       
  2953 	fxor	%f60, %f56, %f60
       
  2954 	fxor	%f62, %f58, %f62
       
  2955 
       
  2956 	/* CFB mode uses encryption for the decrypt operation */
       
  2957 	TEN_EROUNDS
       
  2958 
       
  2959 	ldd	[%o1], %f56	!input
       
  2960 	ldd	[%o1 + 8], %f58	!input
       
  2961 	fxor	%f60, %f56, %f60
       
  2962 	fxor	%f62, %f58, %f62
       
  2963 
       
  2964 	std	%f60, [%o2]
       
  2965 	std	%f62, [%o2 + 8]
       
  2966 
       
  2967 	add	%o1, 16, %o1
       
  2968 	subcc	%o3, 16, %o3
       
  2969 	bne	cfb128dec_128_loop
       
  2970 	add	%o2, 16, %o2
       
  2971 
       
  2972 	std	%f56, [%o4]
       
  2973 	retl
       
  2974 	std	%f58, [%o4 + 8]
       
  2975 
       
  2976 	SET_SIZE(t4_aes128_cfb128_decrypt)
       
  2977 
       
  2978 
       
  2979 	ENTRY(t4_aes192_cfb128_decrypt)
       
  2980 
       
  2981 	ldd	[%o4], %f56	!IV
       
  2982 	ldd	[%o4 + 8], %f58	!IV
       
  2983 	ldx	[%o0], %g1	! ks[0]
       
  2984 	ldx	[%o0 + 8], %g2	! ks[1]
       
  2985 
       
  2986 cfb128dec_192_loop:
       
  2987 	movxtod	%g1, %f60
       
  2988 	movxtod	%g2, %f62
       
  2989 	fxor	%f60, %f56, %f60
       
  2990 	fxor	%f62, %f58, %f62
       
  2991 
       
  2992 	/* CFB mode uses encryption for the decrypt operation */
       
  2993 	TWELVE_EROUNDS
       
  2994 
       
  2995 	ldd	[%o1], %f56	!input
       
  2996 	ldd	[%o1 + 8], %f58	!input
       
  2997 	fxor	%f60, %f56, %f60
       
  2998 	fxor	%f62, %f58, %f62
       
  2999 
       
  3000 	std	%f60, [%o2]
       
  3001 	std	%f62, [%o2 + 8]
       
  3002 
       
  3003 	add	%o1, 16, %o1
       
  3004 	subcc	%o3, 16, %o3
       
  3005 	bne	cfb128dec_192_loop
       
  3006 	add	%o2, 16, %o2
       
  3007 
       
  3008 	std	%f56, [%o4]
       
  3009 	retl
       
  3010 	std	%f58, [%o4 + 8]
       
  3011 
       
  3012 	SET_SIZE(t4_aes192_cfb128_decrypt)
       
  3013 
       
  3014 
       
  3015 	ENTRY(t4_aes256_cfb128_decrypt)
       
  3016 
       
  3017 	ldd	[%o4], %f56	!IV
       
  3018 	ldd	[%o4 + 8], %f58	!IV
       
  3019 	ldx	[%o0], %g1	! ks[0]
       
  3020 	ldx	[%o0 + 8], %g2	! ks[1]
       
  3021 
       
  3022 cfb128dec_256_loop:
       
  3023 	movxtod	%g1, %f60
       
  3024 	movxtod	%g2, %f62
       
  3025 	fxor	%f60, %f56, %f60
       
  3026 	fxor	%f62, %f58, %f62
       
  3027 
       
  3028 	/* CFB mode uses encryption for the decrypt operation */
       
  3029 	FOURTEEN_EROUNDS
       
  3030 
       
  3031 	ldd	[%o1], %f56	!input
       
  3032 	ldd	[%o1 + 8], %f58	!input
       
  3033 	fxor	%f60, %f56, %f60
       
  3034 	fxor	%f62, %f58, %f62
       
  3035 
       
  3036 	std	%f60, [%o2]
       
  3037 	std	%f62, [%o2 + 8]
       
  3038 
       
  3039 	add	%o1, 16, %o1
       
  3040 	subcc	%o3, 16, %o3
       
  3041 	bne	cfb128dec_256_loop
       
  3042 	add	%o2, 16, %o2
       
  3043 
       
  3044 	std	%f56, [%o4]
       
  3045 	retl
       
  3046 	std	%f58, [%o4 + 8]
       
  3047 
       
  3048 	SET_SIZE(t4_aes256_cfb128_decrypt)
       
  3049 
       
  3050 #endif
       
  3051 
       
  3052 #endif	/* lint || __lint */