2 * Copyright (c) 2011 The Chromium OS Authors.
3 * (C) Copyright 2010 - 2011 NVIDIA Corporation <www.nvidia.com>
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 * AES encryption library, with small code size, supporting only 128-bit AES
30 * AES is a stream cipher which works a block at a time, with each block
31 * in this case being AES_KEY_LENGTH bytes.
35 AES_STATECOLS = 4, /* columns in the state & expanded key */
36 AES_KEYCOLS = 4, /* columns in a key */
37 AES_ROUNDS = 10, /* rounds in encryption */
39 AES_KEY_LENGTH = 128 / 8,
40 AES_EXPAND_KEY_LENGTH = 4 * AES_STATECOLS * (AES_ROUNDS + 1),
44 * Expand a key into a key schedule, which is then used for the other
47 * \param key Key, of length AES_KEY_LENGTH bytes
48 * \param expkey Buffer to place expanded key, AES_EXPAND_KEY_LENGTH
50 void aes_expand_key(u8 *key, u8 *expkey);
53 * Encrypt a single block of data
56 * expkey Expanded key to use for encryption (from aes_expand_key())
59 void aes_encrypt(u8 *in, u8 *expkey, u8 *out);
62 * Decrypt a single block of data
65 * expkey Expanded key to use for decryption (from aes_expand_key())
68 void aes_decrypt(u8 *in, u8 *expkey, u8 *out);
70 #endif /* _AES_REF_H_ */