comparison libtomcrypt/demos/multi.c @ 1435:f849a5ca2efc

update to libtomcrypt 1.17 (with Dropbear changes)
author Matt Johnston <matt@ucc.asn.au>
date Sat, 24 Jun 2017 17:50:50 +0800
parents 0cbe8f6dbf9e
children
comparison
equal deleted inserted replaced
1434:27b9ddb06b09 1435:f849a5ca2efc
31 if (len != len2 || memcmp(buf[0], buf[1], len)) { 31 if (len != len2 || memcmp(buf[0], buf[1], len)) {
32 printf("Failed: %d %lu %lu\n", __LINE__, len, len2); 32 printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
33 return EXIT_FAILURE; 33 return EXIT_FAILURE;
34 } 34 }
35 35
36 /* HMAC */ 36 /* LTC_HMAC */
37 len = sizeof(buf[0]); 37 len = sizeof(buf[0]);
38 hmac_memory(find_hash("sha256"), key, 16, (unsigned char*)"hello", 5, buf[0], &len); 38 hmac_memory(find_hash("sha256"), key, 16, (unsigned char*)"hello", 5, buf[0], &len);
39 len2 = sizeof(buf[0]); 39 len2 = sizeof(buf[0]);
40 hmac_memory_multi(find_hash("sha256"), key, 16, buf[1], &len2, (unsigned char*)"hello", 5UL, NULL); 40 hmac_memory_multi(find_hash("sha256"), key, 16, buf[1], &len2, (unsigned char*)"hello", 5UL, NULL);
41 if (len != len2 || memcmp(buf[0], buf[1], len)) { 41 if (len != len2 || memcmp(buf[0], buf[1], len)) {
53 if (len != len2 || memcmp(buf[0], buf[1], len)) { 53 if (len != len2 || memcmp(buf[0], buf[1], len)) {
54 printf("Failed: %d %lu %lu\n", __LINE__, len, len2); 54 printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
55 return EXIT_FAILURE; 55 return EXIT_FAILURE;
56 } 56 }
57 57
58 /* OMAC */ 58 /* LTC_OMAC */
59 len = sizeof(buf[0]); 59 len = sizeof(buf[0]);
60 omac_memory(find_cipher("aes"), key, 16, (unsigned char*)"hello", 5, buf[0], &len); 60 omac_memory(find_cipher("aes"), key, 16, (unsigned char*)"hello", 5, buf[0], &len);
61 len2 = sizeof(buf[0]); 61 len2 = sizeof(buf[0]);
62 omac_memory_multi(find_cipher("aes"), key, 16, buf[1], &len2, (unsigned char*)"hello", 5UL, NULL); 62 omac_memory_multi(find_cipher("aes"), key, 16, buf[1], &len2, (unsigned char*)"hello", 5UL, NULL);
63 if (len != len2 || memcmp(buf[0], buf[1], len)) { 63 if (len != len2 || memcmp(buf[0], buf[1], len)) {
103 printf("All passed\n"); 103 printf("All passed\n");
104 return EXIT_SUCCESS; 104 return EXIT_SUCCESS;
105 } 105 }
106 106
107 107
108 /* $Source: /cvs/libtom/libtomcrypt/demos/multi.c,v $ */ 108 /* $Source$ */
109 /* $Revision: 1.3 $ */ 109 /* $Revision$ */
110 /* $Date: 2006/06/07 22:25:09 $ */ 110 /* $Date$ */