
namespace _innovaphone_aes {

#define FPU_CONTEXT_SAVE_RESTORE_GLUE_CODE	0

#define AES_MIN_KEY_SIZE	16
#define AES_MAX_KEY_SIZE	32
#define AES_KEYSIZE_128		16
#define AES_KEYSIZE_192		24
#define AES_KEYSIZE_256		32
#define AES_BLOCK_SIZE		16
#define AES_MAX_KEYLENGTH	(15 * 16)
#define AES_MAX_KEYLENGTH_U32	(AES_MAX_KEYLENGTH / sizeof(dword))
#define AESNI_ALIGN	16

	typedef struct _crypto_aesni_ctx {
		dword __attribute__((aligned(16)))	key_enc[AES_MAX_KEYLENGTH_U32];
		dword  __attribute__((aligned(16)))	key_dec[AES_MAX_KEYLENGTH_U32];
		dword								key_length;
	} crypto_aesni_ctx;

	inline crypto_aesni_ctx* aesni_from_raw_contect(void* raw_context);
	int aesni_set_key_glue(void* raw_context, const byte* in_key, unsigned int key_len);
	void aesni_enc_glue(void* raw_context, byte* out, const byte* in);
	void aesni_dec_glue(void* raw_context, byte* out, const byte* in);
	void aesni_ecb_enc_glue(void* raw_context, byte* out, const byte* in, size_t len);
	void aesni_ecb_dec_glue(void* raw_context, byte* out, const byte* in, size_t len);

	extern bool has_cpu_aesni;

}
