Main Page Modules Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages

# Aes.h File Reference

`#include <stdio.h>`
`#include "platform.h"`

Include dependency graph for TwoFish/aes.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Compounds
struct | cipherInstance
struct | keyInstance
## Defines
#define | DIR_ENCRYPT 0
#define | DIR_DECRYPT 1
#define | MODE_ECB 1
#define | MODE_CBC 2
#define | MODE_CFB1 3
#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 | MAX_KEY_SIZE 64
#define | MAX_IV_SIZE 16
#define | BAD_INPUT_LEN -6
#define | BAD_PARAMS -7
#define | BAD_IV_MAT -8
#define | BAD_ENDIAN -9
#define | BAD_ALIGN32 -10
#define | BLOCK_SIZE 128
#define | MAX_ROUNDS 16
#define | ROUNDS_128 16
#define | ROUNDS_192 16
#define | ROUNDS_256 16
#define | MAX_KEY_BITS 256
#define | MIN_KEY_BITS 128
#define | VALID_SIG 0x48534946
#define | MCT_OUTER 400
#define | MCT_INNER 10000
#define | REENTRANT 1
#define | INPUT_WHITEN 0
#define | OUTPUT_WHITEN ( INPUT_WHITEN + BLOCK_SIZE/32)
#define | ROUND_SUBKEYS (OUTPUT_WHITEN + BLOCK_SIZE/32)
#define | TOTAL_SUBKEYS (ROUND_SUBKEYS + 2*MAX_ROUNDS)
#define | TAB_DISABLE 0
#define | TAB_ENABLE 1
#define | TAB_RESET 2
#define | TAB_QUERY 3
#define | TAB_MIN_QUERY 50
#define | Copy1(d, s, N) ((DWORD *)(d))[N] = ((DWORD *)(s))[N]
#define | BlockCopy(d, s) { Copy1(d,s,0);Copy1(d,s,1);Copy1(d,s,2);Copy1(d,s,3); }
## Typedefs
typedef unsigned char | BYTE
typedef unsigned long | DWORD
typedef DWORD | fullSbox [4][256]
## Functions
int | makeKey (keyInstance *key, BYTE direction, int keyLen, char *keyMaterial)
int | cipherInit (cipherInstance *cipher, BYTE mode, char *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 | reKey (keyInstance *key)
int | TableOp (int op)

## Define Documentation

#define BAD_ALIGN32 -10

#define BAD_CIPHER_MODE -4

#define BAD_CIPHER_STATE -5

#define BAD_ENDIAN -9

#define BAD_INPUT_LEN -6

#define BAD_IV_MAT -8

#define BAD_KEY_DIR -1

#define BAD_KEY_INSTANCE -3

#define BAD_KEY_MAT -2

#define BAD_PARAMS -7

#define BLOCK_SIZE 128

#define BlockCopy | ( | d,
|  | s |  | ) | { Copy1(d,s,0);Copy1(d,s,1);Copy1(d,s,2);Copy1(d,s,3); }

#define Copy1 | ( | d,
|  | s,
|  | N |  | ) | ((DWORD *)(d))[N] = ((DWORD *)(s))[N]

#define DIR_DECRYPT 1

#define DIR_ENCRYPT 0

#define FALSE 0

#define INPUT_WHITEN 0

#define MAX_IV_SIZE 16

#define MAX_KEY_BITS 256

#define MAX_KEY_SIZE 64

#define MAX_ROUNDS 16

#define MCT_INNER 10000

#define MCT_OUTER 400

#define MIN_KEY_BITS 128

#define MODE_CBC 2

#define MODE_CFB1 3

#define MODE_ECB 1

#define OUTPUT_WHITEN ( INPUT_WHITEN + BLOCK_SIZE/32)

#define REENTRANT 1

#define ROUND_SUBKEYS (OUTPUT_WHITEN + BLOCK_SIZE/32)

#define ROUNDS_128 16

#define ROUNDS_192 16

#define ROUNDS_256 16

#define TAB_DISABLE 0

#define TAB_ENABLE 1

#define TAB_MIN_QUERY 50

#define TAB_QUERY 3

#define TAB_RESET 2

#define TOTAL_SUBKEYS (ROUND_SUBKEYS + 2*MAX_ROUNDS)

#define TRUE 1

#define VALID_SIG 0x48534946

## Typedef Documentation

typedef unsigned char BYTE

typedef unsigned long DWORD

typedef DWORD fullSbox[4][256]

## Function Documentation

int blockDecrypt | ( | cipherInstance * | cipher,
|  | keyInstance * | key,
|  | BYTE * | input,
|  | int | inputLen,
|  | BYTE * | outBuffer
| ) |

int blockEncrypt | ( | cipherInstance * | cipher,
|  | keyInstance * | key,
|  | BYTE * | input,
|  | int | inputLen,
|  | BYTE * | outBuffer
| ) |

int cipherInit | ( | cipherInstance * | cipher,
|  | BYTE | mode,
|  | char * | IV
| ) |

int makeKey | ( | keyInstance * | key,
|  | BYTE | direction,
|  | int | keyLen,
|  | char * | keyMaterial
| ) |

int reKey | ( | keyInstance * | key | ) |

int TableOp | ( | int | op | ) |