[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] 12/13: Some error fixes
From: |
gnunet |
Subject: |
[taler-anastasis] 12/13: Some error fixes |
Date: |
Sun, 03 May 2020 18:02:36 +0200 |
This is an automated email from the git hooks/post-receive script.
dennis-neufeld pushed a commit to branch master
in repository anastasis.
commit c21e04628bf63dc065fa3b3cc9725e7d112b044d
Author: Dennis Neufeld <address@hidden>
AuthorDate: Sun May 3 15:29:07 2020 +0000
Some error fixes
---
src/lib/anastasis.c | 27 ++++++++++++++++++++-------
src/lib/testing_cmd_policy_create.c | 6 +++++-
src/lib/testing_cmd_truth_upload.c | 1 -
src/util/anastasis_crypto.c | 6 +++++-
src/util/test_anastasis_crypto.c | 6 +++---
5 files changed, 33 insertions(+), 13 deletions(-)
diff --git a/src/lib/anastasis.c b/src/lib/anastasis.c
index ed226e2..18fa0a0 100644
--- a/src/lib/anastasis.c
+++ b/src/lib/anastasis.c
@@ -771,8 +771,13 @@ ANASTASIS_truth_upload (struct GNUNET_CURL_Context *ctx,
t->method = method;
t->instructions = instructions;
t->mime_type = mime_type;
- uuid_generate (t->uuid);
+ uuid_generate (t->uuid);
+ GNUNET_assert (NULL != &t->uuid);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "At %s:%d uuid is %s-%llu b\n", __FILE__, __LINE__,
+ TALER_B2S (&t->uuid),
+ (unsigned long long) sizeof (t->uuid));
GNUNET_assert (NULL != id_data);
GNUNET_assert (NULL != salt);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -913,12 +918,12 @@ ANASTASIS_policy_create (struct ANASTASIS_Truth *truths[],
struct ANASTASIS_CRYPTO_KeyShareP key_shares[truths_len];
uuid_t uuids[truths_len];
- GNUNET_assert (NULL != truths);
+ GNUNET_assert (NULL != *truths);
GNUNET_assert (truths_len > 0);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"At %s:%d truth array is %s\n", __FILE__, __LINE__,
- TALER_b2s (*truths,
+ TALER_b2s (truths,
truths_len
* sizeof (struct ANASTASIS_Truth)));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -927,17 +932,25 @@ ANASTASIS_policy_create (struct ANASTASIS_Truth *truths[],
for (unsigned int i = 0; i < truths_len; i++)
{
- key_shares[i] = truths[i]->key_share;
+ struct ANASTASIS_Truth *truth;
+ truth = truths;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "At %s:%d truth is %s-%llu b\n", __FILE__, __LINE__,
+ TALER_B2S (truth),
+ (unsigned long long) sizeof (struct ANASTASIS_Truth));
+ key_shares[i] = truth->key_share;
GNUNET_assert (NULL != &key_shares[i]);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"At %s:%d key share is %s-%llu b\n", __FILE__, __LINE__,
TALER_B2S (&key_shares[i]),
(unsigned long long) sizeof (key_shares[i]));
- GNUNET_memcpy (uuids[i], truths[i]->uuid, sizeof(uuids[i]));
+ uuid_copy (&uuids[i], &truth->uuid);
GNUNET_assert (NULL != &uuids[i]);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "At %s:%d uuid is %lu\n", __FILE__, __LINE__,
- uuids[i]);
+ "At %s:%d uuid is %s-%llu b\n", __FILE__, __LINE__,
+ TALER_B2S (&uuids[i]),
+ (unsigned long long) sizeof (uuids[i]));
+ truths++;
}
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE,
&p->salt,
diff --git a/src/lib/testing_cmd_policy_create.c
b/src/lib/testing_cmd_policy_create.c
index 6454df1..cce0f25 100644
--- a/src/lib/testing_cmd_policy_create.c
+++ b/src/lib/testing_cmd_policy_create.c
@@ -162,11 +162,15 @@ policy_create_run (void *cls,
GNUNET_assert (0 ==
GNUNET_memcmp (&truths[i],
truth));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "At %s:%d truth is %s-%llu b\n", __FILE__, __LINE__,
+ TALER_B2S (&truths[i]),
+ (unsigned long long) sizeof (truths[i]));
}
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"At %s:%d truth array is %s\n", __FILE__, __LINE__,
- TALER_b2s (truths,
+ TALER_b2s (&truths,
pcs->cmd_label_array_length
* sizeof (struct Truth)));
pcs->policy = ANASTASIS_policy_create (&truths,
diff --git a/src/lib/testing_cmd_truth_upload.c
b/src/lib/testing_cmd_truth_upload.c
index d4dfe32..519fcab 100644
--- a/src/lib/testing_cmd_truth_upload.c
+++ b/src/lib/testing_cmd_truth_upload.c
@@ -131,7 +131,6 @@ truth_upload_cb (void *cls,
return;
}
tus->truth = t;
-
TALER_TESTING_interpreter_next (tus->is);
}
diff --git a/src/util/anastasis_crypto.c b/src/util/anastasis_crypto.c
index 27c79f8..c44243e 100644
--- a/src/util/anastasis_crypto.c
+++ b/src/util/anastasis_crypto.c
@@ -323,20 +323,24 @@ ANASTASIS_CRYPTO_user_identifier_derive (
struct ANASTASIS_CRYPTO_UserIdentifierP *id)
{
char *json_enc;
+ const char *salt_str;
GNUNET_assert (NULL != id_data);
GNUNET_assert (NULL != server_salt);
+ salt_str = GNUNET_STRINGS_data_to_string_alloc (server_salt,
+ sizeof (*server_salt));
json_enc = json_dumps (id_data,
JSON_COMPACT | JSON_SORT_KEYS);
GNUNET_assert (NULL != json_enc);
- GNUNET_CRYPTO_pow_hash (server_salt,
+ GNUNET_CRYPTO_pow_hash (salt_str,
json_enc,
strlen (json_enc),
&id->hash);
free (json_enc);
json_decref (id_data);
+ GNUNET_free (salt_str);
GNUNET_assert (NULL != id);
}
diff --git a/src/util/test_anastasis_crypto.c b/src/util/test_anastasis_crypto.c
index 6a43fdf..9171119 100644
--- a/src/util/test_anastasis_crypto.c
+++ b/src/util/test_anastasis_crypto.c
@@ -315,9 +315,9 @@ test_public_key_derive ()
json_t *id_data = json_object ();
- GNUNET_CRYPTO_hash_from_string2 ("Server Salt",
- strlen ("Server Salt"),
- &server_salt.salt);
+ GNUNET_CRYPTO_hash ("Server Salt",
+ strlen ("Server Salt"),
+ &server_salt.salt);
json_object_set_new (id_data, "arg1", json_string ("ID_DATA"));
ANASTASIS_CRYPTO_user_identifier_derive (id_data,
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [taler-anastasis] 01/13: json_dumps with JSON_COMPACT and JSON_SORT_KEYS, (continued)
- [taler-anastasis] 01/13: json_dumps with JSON_COMPACT and JSON_SORT_KEYS, gnunet, 2020/05/03
- [taler-anastasis] 06/13: big O to small o, json_pack, gnunet, 2020/05/03
- [taler-anastasis] 04/13: changed user identifier derivation to use GNUNET_CRYPTO_hash_pow(), gnunet, 2020/05/03
- [taler-anastasis] 02/13: deleted salt cb etc. from anastasis.c, gnunet, 2020/05/03
- [taler-anastasis] 09/13: created policy trait, gnunet, 2020/05/03
- [taler-anastasis] 10/13: modified Makefile, gnunet, 2020/05/03
- [taler-anastasis] 08/13: Initial work on testing policy creation, gnunet, 2020/05/03
- [taler-anastasis] 03/13: changed user identifier derivation to use GNUNET_CRYPTO_hash_pow(), gnunet, 2020/05/03
- [taler-anastasis] 05/13: modified truth trait, gnunet, 2020/05/03
- [taler-anastasis] 07/13: fixed http server not shutting down, gnunet, 2020/05/03
- [taler-anastasis] 12/13: Some error fixes,
gnunet <=
- [taler-anastasis] 11/13: worked on testing policy creation, gnunet, 2020/05/03
- [taler-anastasis] 13/13: fixed truth array problems, gnunet, 2020/05/03