Mercurial > dropbear
comparison libtomcrypt/demos/multi.c @ 1439:8d24733026c5 coverity
merge
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 24 Jun 2017 23:33:16 +0800 |
parents | f849a5ca2efc |
children |
comparison
equal
deleted
inserted
replaced
1400:238a439670f5 | 1439:8d24733026c5 |
---|---|
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$ */ |