ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Crypt-Twofish2/aes.h
(Generate patch)

Comparing Crypt-Twofish2/aes.h (file contents):
Revision 1.1 by root, Sat Sep 6 22:10:54 2003 UTC vs.
Revision 1.2 by root, Wed Dec 1 02:12:30 2010 UTC

120 DWORD cipherSig; /* set to VALID_SIG by cipherInit() */ 120 DWORD cipherSig; /* set to VALID_SIG by cipherInit() */
121 DWORD iv32[BLOCK_SIZE/32]; /* CBC IV bytes arranged as dwords */ 121 DWORD iv32[BLOCK_SIZE/32]; /* CBC IV bytes arranged as dwords */
122 } cipherInstance; 122 } cipherInstance;
123 123
124/* Function protoypes */ 124/* Function protoypes */
125int makeKey(keyInstance *key, BYTE direction, int keyLen, char *keyMaterial); 125static int makeKey(keyInstance *key, BYTE direction, int keyLen, char *keyMaterial);
126 126
127int cipherInit(cipherInstance *cipher, BYTE mode, char *IV); 127static int cipherInit(cipherInstance *cipher, BYTE mode, char *IV);
128 128
129int blockEncrypt(cipherInstance *cipher, keyInstance *key, BYTE *input, 129static int blockEncrypt(cipherInstance *cipher, keyInstance *key, BYTE *input,
130 int inputLen, BYTE *outBuffer); 130 int inputLen, BYTE *outBuffer);
131 131
132int blockDecrypt(cipherInstance *cipher, keyInstance *key, BYTE *input, 132static int blockDecrypt(cipherInstance *cipher, keyInstance *key, BYTE *input,
133 int inputLen, BYTE *outBuffer); 133 int inputLen, BYTE *outBuffer);
134 134
135int reKey(keyInstance *key); /* do key schedule using modified key.keyDwords */ 135static int reKey(keyInstance *key); /* do key schedule using modified key.keyDwords */
136 136
137/* API to check table usage, for use in ECB_TBL KAT */ 137/* API to check table usage, for use in ECB_TBL KAT */
138#define TAB_DISABLE 0 138#define TAB_DISABLE 0
139#define TAB_ENABLE 1 139#define TAB_ENABLE 1
140#define TAB_RESET 2 140#define TAB_RESET 2
141#define TAB_QUERY 3 141#define TAB_QUERY 3
142#define TAB_MIN_QUERY 50 142#define TAB_MIN_QUERY 50
143int TableOp(int op); 143static int TableOp(int op);
144 144
145 145
146#define CONST /* helpful C++ syntax sugar, NOP for ANSI C */ 146#define CONST /* helpful C++ syntax sugar, NOP for ANSI C */
147 147
148#if BLOCK_SIZE == 128 /* optimize block copies */ 148#if BLOCK_SIZE == 128 /* optimize block copies */
192#include <stdlib.h> 192#include <stdlib.h>
193#include <time.h> 193#include <time.h>
194#include <string.h> 194#include <string.h>
195 195
196#define MAX_BLK_CNT 4 /* max # blocks per call in TestTwofish */ 196#define MAX_BLK_CNT 4 /* max # blocks per call in TestTwofish */
197int TestTwofish(int mode,int keySize) /* keySize must be 128, 192, or 256 */ 197static int TestTwofish(int mode,int keySize) /* keySize must be 128, 192, or 256 */
198 { /* return 0 iff test passes */ 198 { /* return 0 iff test passes */
199 keyInstance ki; /* key information, including tables */ 199 keyInstance ki; /* key information, including tables */
200 cipherInstance ci; /* keeps mode (ECB, CBC) and IV */ 200 cipherInstance ci; /* keeps mode (ECB, CBC) and IV */
201 BYTE plainText[MAX_BLK_CNT*(BLOCK_SIZE/8)]; 201 BYTE plainText[MAX_BLK_CNT*(BLOCK_SIZE/8)];
202 BYTE cipherText[MAX_BLK_CNT*(BLOCK_SIZE/8)]; 202 BYTE cipherText[MAX_BLK_CNT*(BLOCK_SIZE/8)];

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines