xref: /isa-l_crypto/include/aes_keyexp.h (revision cb5bcf4bd97d613e01e46f9941ec2cff2fa58a33)
1 /**********************************************************************
2   Copyright(c) 2011-2016 Intel Corporation All rights reserved.
3 
4   Redistribution and use in source and binary forms, with or without
5   modification, are permitted provided that the following conditions
6   are met:
7     * Redistributions of source code must retain the above copyright
8       notice, this list of conditions and the following disclaimer.
9     * Redistributions in binary form must reproduce the above copyright
10       notice, this list of conditions and the following disclaimer in
11       the documentation and/or other materials provided with the
12       distribution.
13     * Neither the name of Intel Corporation nor the names of its
14       contributors may be used to endorse or promote products derived
15       from this software without specific prior written permission.
16 
17   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 **********************************************************************/
29 
30 #ifndef _KEYEXP_128_H
31 #define _KEYEXP_128_H
32 
33 /**
34  *  @file aes_keyexp.h
35  *  @brief AES key expansion functions
36  *
37  * This defines the interface to key expansion functions.
38  */
39 
40 #include <stdint.h>
41 #include "types.h"
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 /** @brief AES key expansion 128 bit
48  *
49  * @requires SSE4.1
50  * @deprecated Please use isal_aes_keyexp_128() instead.
51  */
52 ISAL_DEPRECATED("Please use isal_aes_keyexp_128() instead")
53 void
54 aes_keyexp_128(const uint8_t *key,   //!< input key for AES-128, 16 bytes
55                uint8_t *exp_key_enc, //!< expanded encryption keys, 16*11 bytes
56                uint8_t *exp_key_dec  //!< expanded decryption keys, 16*11 bytes
57 );
58 
59 /** @brief AES key expansion 192 bit
60  *
61  * @requires SSE4.1
62  * @deprecated Please use isal_aes_keyexp_192() instead.
63  */
64 ISAL_DEPRECATED("Please use isal_aes_keyexp_192() instead")
65 void
66 aes_keyexp_192(const uint8_t *key,   //!< input key for AES-192, 16*1.5 bytes
67                uint8_t *exp_key_enc, //!< expanded encryption keys, 16*13 bytes
68                uint8_t *exp_key_dec  //!< expanded decryption keys, 16*13 bytes
69 );
70 
71 /** @brief AES key expansion 256 bit
72  *
73  * @requires SSE4.1
74  * @deprecated Please use isal_aes_keyexp_256() instead.
75  */
76 ISAL_DEPRECATED("Please use isal_aes_keyexp_256() instead")
77 void
78 aes_keyexp_256(const uint8_t *key,   //!< input key for AES-256, 16*2 bytes
79                uint8_t *exp_key_enc, //!< expanded encryption keys, 16*15 bytes
80                uint8_t *exp_key_dec  //!< expanded decryption keys, 16*15 bytes
81 );
82 
83 /**
84  * @brief AES key expansion 128 bit
85  * @requires AES extensions and SSE4.1 for x86 or ASIMD for ARM
86  * @return Operation status
87  * @retval 0 on success
88  * @retval Non-zero \a ISAL_CRYPTO_ERR on failure
89  */
90 int
91 isal_aes_keyexp_128(const uint8_t *key,   //!< input key for AES-128, 16 bytes
92                     uint8_t *exp_key_enc, //!< expanded encryption keys, 16*11 bytes
93                     uint8_t *exp_key_dec  //!< expanded decryption keys, 16*11 bytes
94 );
95 
96 /**
97  * @brief AES key expansion 192 bit
98  * @requires AES extensions and SSE4.1 for x86 or ASIMD for ARM
99  * @return Operation status
100  * @retval 0 on success
101  * @retval Non-zero \a ISAL_CRYPTO_ERR on failure
102  */
103 int
104 isal_aes_keyexp_192(const uint8_t *key,   //!< input key for AES-192, 24 bytes
105                     uint8_t *exp_key_enc, //!< expanded encryption keys, 16*13 bytes
106                     uint8_t *exp_key_dec  //!< expanded decryption keys, 16*13 bytes
107 );
108 
109 /**
110  * @brief AES key expansion 256 bit
111  * @requires AES extensions and SSE4.1 for x86 or ASIMD for ARM
112  * @return Operation status
113  * @retval 0 on success
114  * @retval Non-zero \a ISAL_CRYPTO_ERR on failure
115  */
116 int
117 isal_aes_keyexp_256(const uint8_t *key,   //!< input key for AES-256, 32 bytes
118                     uint8_t *exp_key_enc, //!< expanded encryption keys, 16*15 bytes
119                     uint8_t *exp_key_dec  //!< expanded decryption keys, 16*15 bytes
120 );
121 
122 #ifdef __cplusplus
123 }
124 #endif //__cplusplus
125 #endif // ifndef _KEYEXP_128_H
126