#ifndef _RIJNDAEL_API_REF_H_
#define _RIJNDAEL_API_REF_H_
#include <stdio.h>
#include "rijndael-alg-ref.h"
#ifdef __cplusplus
extern "C" {
#endif
#define DIR_ENCRYPT 0
#define DIR_DECRYPT 1
#define MODE_ECB 1
#define MODE_CBC 2
#define TRUE 1
#define FALSE 0
#define BAD_KEY_DIR -1
#define BAD_KEY_MAT -2
#define BAD_KEY_INSTANCE -3
#define BAD_CIPHER_MODE -4
#define BAD_CIPHER_STATE -5
#define BAD_CIPHER_INSTANCE -7
#define MAX_AES_KEY_SIZE (MAX_AES_KEY_BITS / 8)
#define MAX_AES_BLOCK_SIZE (MAX_AES_BLOCK_BITS / 8)
#define MAX_AES_IV_SIZE MAX_AES_BLOCK_SIZE
typedef unsigned char BYTE;
typedef struct {
BYTE direction;
int keyLen;
int blockLen;
word8 keySched[MAXROUNDS+1][4][MAXBC];
} keyInstance;
typedef struct {
BYTE mode;
word8 chainBlock[4][MAXBC];
int blockLen;
} cipherInstance;
int _makeKey(
keyInstance *key,
BYTE direction,
int keyLen, int blockLen, BYTE *keyMaterial);
int _cipherInit(
cipherInstance *cipher,
BYTE mode,
int blockLen, BYTE *IV);
int _blockEncrypt(
cipherInstance *cipher,
keyInstance *key,
BYTE *input,
int inputLen, BYTE *outBuffer);
int _blockDecrypt(
cipherInstance *cipher,
keyInstance *key,
BYTE *input,
int inputLen, BYTE *outBuffer);
int _rijndaelBlockEncrypt(
cipherInstance *cipher,
keyInstance *key,
BYTE *input,
BYTE *outBuffer);
int _rijndaelBlockDecrypt(
cipherInstance *cipher,
keyInstance *key,
BYTE *input,
BYTE *outBuffer);
#ifdef __cplusplus
}
#endif // cplusplus
#endif // RIJNDAEL_API_REF