blob: 4cd34ee54a94da0ac2725b9c3da82776272234dc [file] [log] [blame]
Marcelo H. Cerri86765902015-02-06 14:57:22 -02001#include <linux/types.h>
2#include <crypto/aes.h>
3
4#define AES_BLOCK_MASK (~(AES_BLOCK_SIZE-1))
5
6struct aes_key {
Herbert Xu4beb1062015-06-15 16:55:46 +08007 u8 key[AES_MAX_KEYLENGTH];
8 int rounds;
Marcelo H. Cerri86765902015-02-06 14:57:22 -02009};
10
11int aes_p8_set_encrypt_key(const u8 *userKey, const int bits,
Herbert Xu4beb1062015-06-15 16:55:46 +080012 struct aes_key *key);
Marcelo H. Cerri86765902015-02-06 14:57:22 -020013int aes_p8_set_decrypt_key(const u8 *userKey, const int bits,
Herbert Xu4beb1062015-06-15 16:55:46 +080014 struct aes_key *key);
Marcelo H. Cerri86765902015-02-06 14:57:22 -020015void aes_p8_encrypt(const u8 *in, u8 *out, const struct aes_key *key);
Herbert Xu4beb1062015-06-15 16:55:46 +080016void aes_p8_decrypt(const u8 *in, u8 *out, const struct aes_key *key);
Marcelo H. Cerri86765902015-02-06 14:57:22 -020017void aes_p8_cbc_encrypt(const u8 *in, u8 *out, size_t len,
Herbert Xu4beb1062015-06-15 16:55:46 +080018 const struct aes_key *key, u8 *iv, const int enc);
Marcelo H. Cerri86765902015-02-06 14:57:22 -020019void aes_p8_ctr32_encrypt_blocks(const u8 *in, u8 *out,
Herbert Xu4beb1062015-06-15 16:55:46 +080020 size_t len, const struct aes_key *key,
21 const u8 *iv);