From 82be09d8a5d20b0963802f829964f3aa69ba9069 Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Fri, 22 Mar 2013 11:08:21 +0000 Subject: [PATCH] more check --- src/util/test_strings_to_data.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/util/test_strings_to_data.c b/src/util/test_strings_to_data.c index e0f02325e..daf228ead 100644 --- a/src/util/test_strings_to_data.c +++ b/src/util/test_strings_to_data.c @@ -32,17 +32,24 @@ main (int argc, char *argv[]) { GNUNET_log_setup ("util", "DEBUG", NULL); char *conv; + char buf[255]; + char *end; struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded src; struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded dest; memset (&src, '\1', sizeof (src)); memset (&dest, '\2', sizeof (dest)); + end = GNUNET_STRINGS_data_to_string (&src, sizeof (src), buf, 255); + end[0] = '\0'; + fprintf (stderr, "Key `%s'\n",buf); + GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_ecc_public_key_from_string (buf, strlen (buf), &dest)); conv = GNUNET_CRYPTO_ecc_public_key_to_string (&src); GNUNET_assert (NULL != conv); fprintf (stderr, "Key `%s'\n",conv); - //GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_ecc_public_key_from_string (conv, strlen (conv), &dest)); + + GNUNET_assert (GNUNET_OK == GNUNET_STRINGS_string_to_data (conv, strlen (conv), (unsigned char *) &dest, sizeof (dest))); GNUNET_assert (0 == memcmp (&src, &dest, sizeof (dest))); -- 2.25.1