4 * Header file declaring AES functions.
6 * Copied from the upstream qemu git tree revision
7 * 55616505876d6683130076b810a27c7889321560
8 * but was introduced there by Fabrice Bellard in
9 * e4d4fe3c34cdd6e26f9b9975efec7d1e81ad00b6
11 * git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1036 \
12 * c046a42c-6fe2-441c-8c8c-71466251a162
14 * Modified by Ian Jackson to change the guard #define from
15 * QEMU_AES_H to AES_H and to add some needed system #include's.
17 * The header file doesn't appear to have a separate copyright notice
18 * but is clearly a lightly edited (by Bellard) version of code from
19 * Rijmen, Bosselaers and Barreto.
21 * The original is from rijndael-alg-fst.c, with this copyright
26 * @version 3.0 (December 2000)
28 * Optimised ANSI C code for the Rijndael cipher (now AES)
30 * @author Vincent Rijmen <vincent.rijmen@esat.kuleuven.ac.be>
31 * @author Antoon Bosselaers <antoon.bosselaers@esat.kuleuven.ac.be>
32 * @author Paulo Barreto <paulo.barreto@terra.com.br>
34 * This code is hereby placed in the public domain.
36 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS
37 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
38 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
39 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
40 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
41 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
42 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
43 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
44 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
45 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
46 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
58 #define AES_BLOCK_SIZE 16
61 uint32_t rd_key[4 *(AES_MAXNR + 1)];
64 typedef struct aes_key_st AES_KEY;
66 int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
68 int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
71 void AES_encrypt(const unsigned char *in, unsigned char *out,
73 void AES_decrypt(const unsigned char *in, unsigned char *out,
75 void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
76 const unsigned long length, const AES_KEY *key,
77 unsigned char *ivec, const int enc);