#ifndef _AES_H
#define _AES_H
#if defined(__cplusplus)
extern "C"
{
#endif
#define AES_128
#define AES_192
#define AES_256
#define AES_VAR
#define AES_MODES
#define AES_ENCRYPT
#define AES_DECRYPT
#define AES_ERR_CHK
#define AES_REV_DKS
#define AES_BLOCK_SIZE 16
#define N_COLS 4
typedef unsigned long uint_32t;
typedef unsigned char uint_8t;
typedef unsigned short uint_16t;
typedef unsigned char aes_08t;
typedef unsigned long aes_32t;
#define void_ret void
#define int_ret int
#if defined( AES_VAR ) || defined( AES_256 )
#define KS_LENGTH 60
#elif defined( AES_192 )
#define KS_LENGTH 52
#else
#define KS_LENGTH 44
#endif
#if defined (__i386__)
#if defined( AES_ERR_CHK )
#define aes_rval int_ret
#else
#define aes_rval void_ret
#endif
typedef union
{ uint_32t l;
uint_8t b[4];
} aes_inf;
typedef struct
{ uint_32t ks[KS_LENGTH];
aes_inf inf;
} aes_encrypt_ctx;
typedef struct
{ uint_32t ks[KS_LENGTH];
aes_inf inf;
} aes_decrypt_ctx;
#else
#if defined( AES_ERR_CHK )
#define aes_ret int
#define aes_good 0
#define aes_error -1
#else
#define aes_ret void
#endif
#define aes_rval aes_ret
typedef struct
{ aes_32t ks[KS_LENGTH];
aes_32t rn;
} aes_encrypt_ctx;
typedef struct
{ aes_32t ks[KS_LENGTH];
aes_32t rn;
} aes_decrypt_ctx;
#endif
typedef struct
{
aes_decrypt_ctx decrypt;
aes_encrypt_ctx encrypt;
} aes_ctx;
void gen_tabs(void);
#if defined( AES_ENCRYPT )
#if defined(AES_128) || defined(AES_VAR)
aes_rval aes_encrypt_key128(const unsigned char *key, aes_encrypt_ctx cx[1]);
#endif
#if defined(AES_192) || defined(AES_VAR)
aes_rval aes_encrypt_key192(const unsigned char *key, aes_encrypt_ctx cx[1]);
#endif
#if defined(AES_256) || defined(AES_VAR)
aes_rval aes_encrypt_key256(const unsigned char *key, aes_encrypt_ctx cx[1]);
#endif
#if defined(AES_VAR)
aes_rval aes_encrypt_key(const unsigned char *key, int key_len, aes_encrypt_ctx cx[1]);
#endif
#if defined (__i386__)
aes_rval aes_encrypt(const unsigned char *in, unsigned char *out, const aes_encrypt_ctx cx[1]);
#endif
aes_rval aes_encrypt_cbc(const unsigned char *in_blk, const unsigned char *in_iv, unsigned int num_blk,
unsigned char *out_blk, const aes_encrypt_ctx cx[1]);
#endif
#if defined( AES_DECRYPT )
#if defined(AES_128) || defined(AES_VAR)
aes_rval aes_decrypt_key128(const unsigned char *key, aes_decrypt_ctx cx[1]);
#endif
#if defined(AES_192) || defined(AES_VAR)
aes_rval aes_decrypt_key192(const unsigned char *key, aes_decrypt_ctx cx[1]);
#endif
#if defined(AES_256) || defined(AES_VAR)
aes_rval aes_decrypt_key256(const unsigned char *key, aes_decrypt_ctx cx[1]);
#endif
#if defined(AES_VAR)
aes_rval aes_decrypt_key(const unsigned char *key, int key_len, aes_decrypt_ctx cx[1]);
#endif
#if defined (__i386__)
aes_rval aes_decrypt(const unsigned char *in, unsigned char *out, const aes_decrypt_ctx cx[1]);
#endif
aes_rval aes_decrypt_cbc(const unsigned char *in_blk, const unsigned char *in_iv, unsigned int num_blk,
unsigned char *out_blk, const aes_decrypt_ctx cx[1]);
#endif
#if defined(__cplusplus)
}
#endif
#endif