|
1 /* |
|
2 * This product includes cryptographic software developed by the OpenSSL |
|
3 * Project for use in the OpenSSL Toolkit (http://www.openssl.org/). |
|
4 */ |
|
5 |
|
6 /* |
|
7 * ==================================================================== |
|
8 * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. |
|
9 * |
|
10 * Redistribution and use in source and binary forms, with or without |
|
11 * modification, are permitted provided that the following conditions |
|
12 * are met: |
|
13 * |
|
14 * 1. Redistributions of source code must retain the above copyright |
|
15 * notice, this list of conditions and the following disclaimer. |
|
16 * |
|
17 * 2. Redistributions in binary form must reproduce the above copyright |
|
18 * notice, this list of conditions and the following disclaimer in |
|
19 * the documentation and/or other materials provided with the |
|
20 * distribution. |
|
21 * |
|
22 * 3. All advertising materials mentioning features or use of this |
|
23 * software must display the following acknowledgment: |
|
24 * "This product includes software developed by the OpenSSL Project |
|
25 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" |
|
26 * |
|
27 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to |
|
28 * endorse or promote products derived from this software without |
|
29 * prior written permission. For written permission, please contact |
|
30 * [email protected]. |
|
31 * |
|
32 * 5. Products derived from this software may not be called "OpenSSL" |
|
33 * nor may "OpenSSL" appear in their names without prior written |
|
34 * permission of the OpenSSL Project. |
|
35 * |
|
36 * 6. Redistributions of any form whatsoever must retain the following |
|
37 * acknowledgment: |
|
38 * "This product includes software developed by the OpenSSL Project |
|
39 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" |
|
40 * |
|
41 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY |
|
42 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
44 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR |
|
45 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
46 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
|
47 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
|
48 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
|
49 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
|
50 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
|
51 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
|
52 * OF THE POSSIBILITY OF SUCH DAMAGE. |
|
53 * ==================================================================== |
|
54 */ |
|
55 |
|
56 /* |
|
57 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
|
58 */ |
|
59 |
|
60 #ifndef ENG_T4_AES_ASM_H |
|
61 #define ENG_T4_AES_ASM_H |
|
62 |
|
63 /* |
|
64 * SPARC AES assembly language functions. |
|
65 * |
|
66 * Based on Solaris file aes_impl.h. |
|
67 */ |
|
68 |
|
69 #ifdef __cplusplus |
|
70 extern "C" { |
|
71 #endif |
|
72 |
|
73 #include <sys/types.h> |
|
74 |
|
75 #if (defined(sun4v) || defined(__sparcv9) || defined(__sparcv8plus) || \ |
|
76 defined(__sparcv8)) && ! defined(OPENSSL_NO_ASM) |
|
77 |
|
78 extern void t4_aes_expand128(uint64_t *rk, const uint32_t *key); |
|
79 extern void t4_aes_expand192(uint64_t *rk, const uint32_t *key); |
|
80 extern void t4_aes_expand256(uint64_t *rk, const uint32_t *key); |
|
81 extern void t4_aes_encrypt128(const uint64_t *rk, const uint32_t *pt, |
|
82 uint32_t *ct); |
|
83 extern void t4_aes_encrypt192(const uint64_t *rk, const uint32_t *pt, |
|
84 uint32_t *ct); |
|
85 extern void t4_aes_encrypt256(const uint64_t *rk, const uint32_t *pt, |
|
86 uint32_t *ct); |
|
87 extern void t4_aes_decrypt128(const uint64_t *rk, const uint32_t *ct, |
|
88 uint32_t *pt); |
|
89 extern void t4_aes_decrypt192(const uint64_t *rk, const uint32_t *ct, |
|
90 uint32_t *pt); |
|
91 extern void t4_aes_decrypt256(const uint64_t *rk, const uint32_t *ct, |
|
92 uint32_t *pt); |
|
93 extern void t4_aes128_load_keys_for_encrypt(uint64_t *ks); |
|
94 extern void t4_aes192_load_keys_for_encrypt(uint64_t *ks); |
|
95 extern void t4_aes256_load_keys_for_encrypt(uint64_t *ks); |
|
96 extern void t4_aes128_ecb_encrypt(uint64_t *ks, uint64_t *asm_in, |
|
97 uint64_t *asm_out, size_t amount_to_encrypt, uint64_t *dummy); |
|
98 extern void t4_aes192_ecb_encrypt(uint64_t *ks, uint64_t *asm_in, |
|
99 uint64_t *asm_out, size_t amount_to_encrypt, uint64_t *dummy); |
|
100 extern void t4_aes256_ecb_encrypt(uint64_t *ks, uint64_t *asm_in, |
|
101 uint64_t *asm_out, size_t amount_to_encrypt, uint64_t *dummy); |
|
102 extern void t4_aes128_cbc_encrypt(uint64_t *ks, uint64_t *asm_in, |
|
103 uint64_t *asm_out, size_t amount_to_encrypt, uint64_t *iv); |
|
104 extern void t4_aes192_cbc_encrypt(uint64_t *ks, uint64_t *asm_in, |
|
105 uint64_t *asm_out, size_t amount_to_encrypt, uint64_t *iv); |
|
106 extern void t4_aes256_cbc_encrypt(uint64_t *ks, uint64_t *asm_in, |
|
107 uint64_t *asm_out, size_t amount_to_encrypt, uint64_t *iv); |
|
108 extern void t4_aes128_ctr_crypt(uint64_t *ks, uint64_t *asm_in, |
|
109 uint64_t *asm_out, size_t amount_to_encrypt, uint64_t *iv); |
|
110 extern void t4_aes192_ctr_crypt(uint64_t *ks, uint64_t *asm_in, |
|
111 uint64_t *asm_out, size_t amount_to_encrypt, uint64_t *iv); |
|
112 extern void t4_aes256_ctr_crypt(uint64_t *ks, uint64_t *asm_in, |
|
113 uint64_t *asm_out, size_t amount_to_encrypt, uint64_t *iv); |
|
114 extern void t4_aes128_cfb128_encrypt(uint64_t *ks, uint64_t *asm_in, |
|
115 uint64_t *asm_out, size_t amount_to_encrypt, uint64_t *iv); |
|
116 extern void t4_aes192_cfb128_encrypt(uint64_t *ks, uint64_t *asm_in, |
|
117 uint64_t *asm_out, size_t amount_to_encrypt, uint64_t *iv); |
|
118 extern void t4_aes256_cfb128_encrypt(uint64_t *ks, uint64_t *asm_in, |
|
119 uint64_t *asm_out, size_t amount_to_encrypt, uint64_t *iv); |
|
120 extern void t4_aes128_load_keys_for_decrypt(uint64_t *ks); |
|
121 extern void t4_aes192_load_keys_for_decrypt(uint64_t *ks); |
|
122 extern void t4_aes256_load_keys_for_decrypt(uint64_t *ks); |
|
123 extern void t4_aes128_ecb_decrypt(uint64_t *ks, uint64_t *asm_in, |
|
124 uint64_t *asm_out, size_t amount_to_decrypt, uint64_t *dummy); |
|
125 extern void t4_aes192_ecb_decrypt(uint64_t *ks, uint64_t *asm_in, |
|
126 uint64_t *asm_out, size_t amount_to_decrypt, uint64_t *dummy); |
|
127 extern void t4_aes256_ecb_decrypt(uint64_t *ks, uint64_t *asm_in, |
|
128 uint64_t *asm_out, size_t amount_to_decrypt, uint64_t *dummy); |
|
129 extern void t4_aes128_cbc_decrypt(uint64_t *ks, uint64_t *asm_in, |
|
130 uint64_t *asm_out, size_t amount_to_decrypt, uint64_t *iv); |
|
131 extern void t4_aes192_cbc_decrypt(uint64_t *ks, uint64_t *asm_in, |
|
132 uint64_t *asm_out, size_t amount_to_decrypt, uint64_t *iv); |
|
133 extern void t4_aes256_cbc_decrypt(uint64_t *ks, uint64_t *asm_in, |
|
134 uint64_t *asm_out, size_t amount_to_decrypt, uint64_t *iv); |
|
135 extern void t4_aes128_cfb128_decrypt(uint64_t *ks, uint64_t *asm_in, |
|
136 uint64_t *asm_out, size_t amount_to_decrypt, uint64_t *iv); |
|
137 extern void t4_aes192_cfb128_decrypt(uint64_t *ks, uint64_t *asm_in, |
|
138 uint64_t *asm_out, size_t amount_to_decrypt, uint64_t *iv); |
|
139 extern void t4_aes256_cfb128_decrypt(uint64_t *ks, uint64_t *asm_in, |
|
140 uint64_t *asm_out, size_t amount_to_decrypt, uint64_t *iv); |
|
141 |
|
142 #endif /* (sun4v||__sparv9||__sparcv8plus||__sparvc8) && !OPENSSL_NO_ASM */ |
|
143 |
|
144 #ifdef __cplusplus |
|
145 } |
|
146 #endif |
|
147 #endif /* ENG_T4_AES_ASM_H */ |