diff options
Diffstat (limited to 'src/revocation/gnunet-revocation-tvg.c')
-rw-r--r-- | src/revocation/gnunet-revocation-tvg.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/revocation/gnunet-revocation-tvg.c b/src/revocation/gnunet-revocation-tvg.c index 0838cecc4..f1d4b0334 100644 --- a/src/revocation/gnunet-revocation-tvg.c +++ b/src/revocation/gnunet-revocation-tvg.c | |||
@@ -34,6 +34,28 @@ | |||
34 | #define TEST_EPOCHS 2 | 34 | #define TEST_EPOCHS 2 |
35 | #define TEST_DIFFICULTY 5 | 35 | #define TEST_DIFFICULTY 5 |
36 | 36 | ||
37 | static char* d_pkey = | ||
38 | "6fea32c05af58bfa979553d188605fd57d8bf9cc263b78d5f7478c07b998ed70"; | ||
39 | |||
40 | int parsehex(char *src, char *dst, size_t dstlen, int invert) | ||
41 | { | ||
42 | char *line = src; | ||
43 | char *data = line; | ||
44 | int off; | ||
45 | int read_byte; | ||
46 | int data_len = 0; | ||
47 | |||
48 | while (sscanf(data, " %02x%n", &read_byte, &off) == 1) { | ||
49 | if (invert) | ||
50 | dst[dstlen - 1 - data_len++] = read_byte; | ||
51 | else | ||
52 | dst[data_len++] = read_byte; | ||
53 | data += off; | ||
54 | } | ||
55 | return data_len; | ||
56 | } | ||
57 | |||
58 | |||
37 | static void | 59 | static void |
38 | print_bytes_ (void *buf, | 60 | print_bytes_ (void *buf, |
39 | size_t buf_len, | 61 | size_t buf_len, |
@@ -87,6 +109,7 @@ run (void *cls, | |||
87 | 109 | ||
88 | id_priv.type = htonl (GNUNET_IDENTITY_TYPE_ECDSA); | 110 | id_priv.type = htonl (GNUNET_IDENTITY_TYPE_ECDSA); |
89 | GNUNET_CRYPTO_ecdsa_key_create (&id_priv.ecdsa_key); | 111 | GNUNET_CRYPTO_ecdsa_key_create (&id_priv.ecdsa_key); |
112 | parsehex(d_pkey,(char*)&id_priv.ecdsa_key, sizeof (id_priv.ecdsa_key), 1); | ||
90 | GNUNET_IDENTITY_key_get_public (&id_priv, | 113 | GNUNET_IDENTITY_key_get_public (&id_priv, |
91 | &id_pub); | 114 | &id_pub); |
92 | GNUNET_STRINGS_data_to_string (&id_pub, | 115 | GNUNET_STRINGS_data_to_string (&id_pub, |