comparison libtomcrypt/src/encauth/eax/eax_test.c @ 382:0cbe8f6dbf9e

propagate from branch 'au.asn.ucc.matt.ltc.dropbear' (head 2af22fb4e878750b88f80f90d439b316d229796f) to branch 'au.asn.ucc.matt.dropbear' (head 02c413252c90e9de8e03d91e9939dde3029f5c0a)
author Matt Johnston <matt@ucc.asn.au>
date Thu, 11 Jan 2007 02:41:05 +0000
parents 1b9e69c058d2
children f849a5ca2efc
comparison
equal deleted inserted replaced
379:b66a00272a90 382:0cbe8f6dbf9e
4 * algorithms in a highly modular and flexible manner. 4 * algorithms in a highly modular and flexible manner.
5 * 5 *
6 * The library is free for all purposes without any express 6 * The library is free for all purposes without any express
7 * guarantee it works. 7 * guarantee it works.
8 * 8 *
9 * Tom St Denis, [email protected], http://libtomcrypt.org 9 * Tom St Denis, [email protected], http://libtomcrypt.com
10 */ 10 */
11 11
12 /** 12 /**
13 @file eax_test.c 13 @file eax_test.c
14 EAX implementation, self-test, by Tom St Denis 14 EAX implementation, self-test, by Tom St Denis
229 if ((err = eax_encrypt_authenticate_memory(idx, tests[x].key, tests[x].keylen, 229 if ((err = eax_encrypt_authenticate_memory(idx, tests[x].key, tests[x].keylen,
230 tests[x].nonce, tests[x].noncelen, tests[x].header, tests[x].headerlen, 230 tests[x].nonce, tests[x].noncelen, tests[x].header, tests[x].headerlen,
231 tests[x].plaintext, tests[x].msglen, outct, outtag, &len)) != CRYPT_OK) { 231 tests[x].plaintext, tests[x].msglen, outct, outtag, &len)) != CRYPT_OK) {
232 return err; 232 return err;
233 } 233 }
234 if (memcmp(outct, tests[x].ciphertext, tests[x].msglen) || memcmp(outtag, tests[x].tag, len)) { 234 if (XMEMCMP(outct, tests[x].ciphertext, tests[x].msglen) || XMEMCMP(outtag, tests[x].tag, len)) {
235 #if 0 235 #if 0
236 unsigned long y; 236 unsigned long y;
237 printf("\n\nFailure: \nCT:\n"); 237 printf("\n\nFailure: \nCT:\n");
238 for (y = 0; y < (unsigned long)tests[x].msglen; ) { 238 for (y = 0; y < (unsigned long)tests[x].msglen; ) {
239 printf("0x%02x", outct[y]); 239 printf("0x%02x", outct[y]);
254 if ((err = eax_decrypt_verify_memory(idx, tests[x].key, tests[x].keylen, 254 if ((err = eax_decrypt_verify_memory(idx, tests[x].key, tests[x].keylen,
255 tests[x].nonce, tests[x].noncelen, tests[x].header, tests[x].headerlen, 255 tests[x].nonce, tests[x].noncelen, tests[x].header, tests[x].headerlen,
256 outct, tests[x].msglen, outct, outtag, len, &res)) != CRYPT_OK) { 256 outct, tests[x].msglen, outct, outtag, len, &res)) != CRYPT_OK) {
257 return err; 257 return err;
258 } 258 }
259 if ((res != 1) || memcmp(outct, tests[x].plaintext, tests[x].msglen)) { 259 if ((res != 1) || XMEMCMP(outct, tests[x].plaintext, tests[x].msglen)) {
260 #if 0 260 #if 0
261 unsigned long y; 261 unsigned long y;
262 printf("\n\nFailure (res == %d): \nPT:\n", res); 262 printf("\n\nFailure (res == %d): \nPT:\n", res);
263 for (y = 0; y < (unsigned long)tests[x].msglen; ) { 263 for (y = 0; y < (unsigned long)tests[x].msglen; ) {
264 printf("0x%02x", outct[y]); 264 printf("0x%02x", outct[y]);
276 } 276 }
277 277
278 #endif /* EAX_MODE */ 278 #endif /* EAX_MODE */
279 279
280 /* $Source: /cvs/libtom/libtomcrypt/src/encauth/eax/eax_test.c,v $ */ 280 /* $Source: /cvs/libtom/libtomcrypt/src/encauth/eax/eax_test.c,v $ */
281 /* $Revision: 1.3 $ */ 281 /* $Revision: 1.5 $ */
282 /* $Date: 2005/05/05 14:35:58 $ */ 282 /* $Date: 2006/11/01 09:28:17 $ */