comparison omac_test.c @ 143:5d99163f7e32 libtomcrypt-orig

import of libtomcrypt 0.99
author Matt Johnston <matt@ucc.asn.au>
date Sun, 19 Dec 2004 11:34:45 +0000
parents 7faae8f46238
children
comparison
equal deleted inserted replaced
15:6362d3854bb4 143:5d99163f7e32
63 0xfc, 0x49, 0x74, 0x17, 0x79, 0x36, 0x3c, 0xfe } 63 0xfc, 0x49, 0x74, 0x17, 0x79, 0x36, 0x3c, 0xfe }
64 } 64 }
65 65
66 }; 66 };
67 unsigned char out[16]; 67 unsigned char out[16];
68 int x, y, err, idx; 68 int x, err, idx;
69 unsigned long len; 69 unsigned long len;
70 70
71 71
72 /* AES can be under rijndael or aes... try to find it */ 72 /* AES can be under rijndael or aes... try to find it */
73 if ((idx = find_cipher("aes")) == -1) { 73 if ((idx = find_cipher("aes")) == -1) {
81 if ((err = omac_memory(idx, tests[x].key, tests[x].keylen, tests[x].msg, tests[x].msglen, out, &len)) != CRYPT_OK) { 81 if ((err = omac_memory(idx, tests[x].key, tests[x].keylen, tests[x].msg, tests[x].msglen, out, &len)) != CRYPT_OK) {
82 return err; 82 return err;
83 } 83 }
84 84
85 if (memcmp(out, tests[x].tag, 16) != 0) { 85 if (memcmp(out, tests[x].tag, 16) != 0) {
86 #if 0
87 int y;
86 printf("\n\nTag: "); 88 printf("\n\nTag: ");
87 for (y = 0; y < 16; y++) printf("%02x", out[y]); printf("\n\n"); 89 for (y = 0; y < 16; y++) printf("%02x", out[y]); printf("\n\n");
90 #endif
88 return CRYPT_FAIL_TESTVECTOR; 91 return CRYPT_FAIL_TESTVECTOR;
89 } 92 }
90 } 93 }
91 return CRYPT_OK; 94 return CRYPT_OK;
92 #endif 95 #endif