From 816bab695d6a7f4e359865e83b687d45ff66a2b1 Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Tue, 1 Feb 2022 15:48:52 +0100 Subject: GNS: Fix revocation wire format --- src/revocation/gnunet-revocation-tvg.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/revocation/gnunet-revocation-tvg.c') 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 @@ #define TEST_EPOCHS 2 #define TEST_DIFFICULTY 5 +static char* d_pkey = +"6fea32c05af58bfa979553d188605fd57d8bf9cc263b78d5f7478c07b998ed70"; + +int parsehex(char *src, char *dst, size_t dstlen, int invert) +{ + char *line = src; + char *data = line; + int off; + int read_byte; + int data_len = 0; + + while (sscanf(data, " %02x%n", &read_byte, &off) == 1) { + if (invert) + dst[dstlen - 1 - data_len++] = read_byte; + else + dst[data_len++] = read_byte; + data += off; + } + return data_len; +} + + static void print_bytes_ (void *buf, size_t buf_len, @@ -87,6 +109,7 @@ run (void *cls, id_priv.type = htonl (GNUNET_IDENTITY_TYPE_ECDSA); GNUNET_CRYPTO_ecdsa_key_create (&id_priv.ecdsa_key); + parsehex(d_pkey,(char*)&id_priv.ecdsa_key, sizeof (id_priv.ecdsa_key), 1); GNUNET_IDENTITY_key_get_public (&id_priv, &id_pub); GNUNET_STRINGS_data_to_string (&id_pub, -- cgit v1.2.3