Commit 5ce26f3b authored by Ard Biesheuvel's avatar Ard Biesheuvel

ARM: move AES typedefs and function prototypes to separate header

Put the struct definitions for AES keys and the asm function prototypes in a
separate header and export the asm functions from the module.
This allows other drivers to use them directly.
Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
parent cf154b7e
...@@ -6,22 +6,12 @@ ...@@ -6,22 +6,12 @@
#include <linux/crypto.h> #include <linux/crypto.h>
#include <crypto/aes.h> #include <crypto/aes.h>
#define AES_MAXNR 14 #include "aes_glue.h"
typedef struct { EXPORT_SYMBOL(AES_encrypt);
unsigned int rd_key[4 *(AES_MAXNR + 1)]; EXPORT_SYMBOL(AES_decrypt);
int rounds; EXPORT_SYMBOL(private_AES_set_encrypt_key);
} AES_KEY; EXPORT_SYMBOL(private_AES_set_decrypt_key);
struct AES_CTX {
AES_KEY enc_key;
AES_KEY dec_key;
};
asmlinkage void AES_encrypt(const u8 *in, u8 *out, AES_KEY *ctx);
asmlinkage void AES_decrypt(const u8 *in, u8 *out, AES_KEY *ctx);
asmlinkage int private_AES_set_decrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key);
asmlinkage int private_AES_set_encrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key);
static void aes_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) static void aes_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
{ {
...@@ -81,7 +71,7 @@ static struct crypto_alg aes_alg = { ...@@ -81,7 +71,7 @@ static struct crypto_alg aes_alg = {
.cipher = { .cipher = {
.cia_min_keysize = AES_MIN_KEY_SIZE, .cia_min_keysize = AES_MIN_KEY_SIZE,
.cia_max_keysize = AES_MAX_KEY_SIZE, .cia_max_keysize = AES_MAX_KEY_SIZE,
.cia_setkey = aes_set_key, .cia_setkey = aes_set_key,
.cia_encrypt = aes_encrypt, .cia_encrypt = aes_encrypt,
.cia_decrypt = aes_decrypt .cia_decrypt = aes_decrypt
} }
......
#define AES_MAXNR 14
struct AES_KEY {
unsigned int rd_key[4 * (AES_MAXNR + 1)];
int rounds;
};
struct AES_CTX {
struct AES_KEY enc_key;
struct AES_KEY dec_key;
};
asmlinkage void AES_encrypt(const u8 *in, u8 *out, struct AES_KEY *ctx);
asmlinkage void AES_decrypt(const u8 *in, u8 *out, struct AES_KEY *ctx);
asmlinkage int private_AES_set_decrypt_key(const unsigned char *userKey,
const int bits, struct AES_KEY *key);
asmlinkage int private_AES_set_encrypt_key(const unsigned char *userKey,
const int bits, struct AES_KEY *key);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment