181{
182 int i, j;
183 unsigned char key[8], plain[8], crypt[8], buffer[8];
184 unsigned char cbc_buffer[32], cbc_iv_buf[8];
185
186 printf
187 ("Testing DES in ECB mode .................................................. ");
188 fflush(stdout);
190 for (j = 0; j < 8; j++) {
194 }
195 memcpy(buffer, crypt, 8);
197 if (memcmp(buffer, plain, 8) != 0) {
198 printf("FAIL\n");
199 goto abort_ecb;
200 }
201 memcpy(buffer, plain, 8);
203 if (memcmp(buffer, crypt, 8) != 0) {
204 printf("FAIL\n");
205 goto abort_ecb;
206 }
208 if (memcmp(buffer, plain, 8) != 0) {
209 printf("FAIL\n");
210 goto abort_ecb;
211 }
212 }
213 printf("Ok\n");
214 abort_ecb:
215
216 printf
217 ("Testing DES in CBC mode .................................................. ");
218 fflush(stdout);
220 memcpy(cbc_iv_buf,
cbc_iv, 8);
222 if (memcmp(cbc_buffer,
cbc_ok, 32) != 0) {
223 printf("FAIL\n");
224 return -1;
225 }
226 memcpy(cbc_iv_buf,
cbc_iv, 8);
228 if (memcmp(cbc_buffer,
cbc_data, 32) != 0) {
229 printf("FAIL\n");
230 return -1;
231 }
232 printf("Ok\n");
233 return 0;
234}
#define qfDES_ECB_e(_key, _data, _size)
#define qfDES_ECB_d(_key, _data, _size)
#define qfDES_CBC_e(_key, _data, _size, _initVec)
#define qfDES_CBC_d(_key, _data, _size, _initVec)
static unsigned char cbc_ok[32]
static unsigned char cbc_iv[8]
static unsigned char cbc_key[8]
static unsigned char crypt_data[NUM_TESTS][8]
static unsigned char key_data[NUM_TESTS][8]
static unsigned char cbc_data[32]
static unsigned char plain_data[NUM_TESTS][8]