This source file includes following definitions.
- main
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 #include <config.h>
19
20 #include "gc.h"
21
22 #include <stdio.h>
23 #include <string.h>
24
25 int
26 main (int argc, char *argv[])
27 {
28 Gc_rc rc;
29
30 rc = gc_init ();
31 if (rc != GC_OK)
32 {
33 printf ("gc_init() failed\n");
34 return 1;
35 }
36
37
38
39 {
40 char *key =
41 "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b";
42 size_t key_len = 16;
43 char *data = "Hi There";
44 size_t data_len = 8;
45 char *digest =
46 "\x92\x94\x72\x7a\x36\x38\xbb\x1c\x13\xf4\x8e\xf8\x15\x8b\xfc\x9d";
47 char out[16];
48
49
50
51
52
53
54
55
56
57 if (gc_hmac_md5 (key, key_len, data, data_len, out) != 0)
58 {
59 printf ("call failure\n");
60 return 1;
61 }
62
63 if (memcmp (digest, out, 16) != 0)
64 {
65 size_t i;
66 printf ("hash 1 mismatch. expected:\n");
67 for (i = 0; i < 16; i++)
68 printf ("%02x ", digest[i] & 0xFF);
69 printf ("\ncomputed:\n");
70 for (i = 0; i < 16; i++)
71 printf ("%02x ", out[i] & 0xFF);
72 printf ("\n");
73 return 1;
74 }
75 }
76
77 gc_done ();
78
79 return 0;
80 }