gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-anastasis] branch master updated (da080ef -> a1e290c)


From: gnunet
Subject: [taler-anastasis] branch master updated (da080ef -> a1e290c)
Date: Sun, 29 Mar 2020 18:21:42 +0200

This is an automated email from the git hooks/post-receive script.

dennis-neufeld pushed a change to branch master
in repository anastasis.

    from da080ef  minor style fixes
     new 5ab9ede  Learned something about json_t and sizeof()...
     new a1e290c  merge

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/util/anastasis_crypto.c      |  7 +++++--
 src/util/test_anastasis_crypto.c | 18 +++++++++---------
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/src/util/anastasis_crypto.c b/src/util/anastasis_crypto.c
index aed3038..59a3861 100644
--- a/src/util/anastasis_crypto.c
+++ b/src/util/anastasis_crypto.c
@@ -209,9 +209,11 @@ ANASTASIS_CRYPTO_user_identifier_derive (
   const json_t *id_data,
   struct ANASTASIS_CRYPTO_UserIdentifier *id)
 {
+  char *json_enc;
+  json_enc = json_dumps (id_data, 0);
   GNUNET_assert (0 ==
-                 gcry_kdf_derive (id_data,
-                                  sizeof (*id_data),
+                 gcry_kdf_derive (json_enc,
+                                  strlen (json_enc),
                                   GCRY_KDF_SCRYPT,
                                   1, // subalgo
                                   "SERVER_SALT", // FIXME: Set real salt 
value!!!
@@ -220,6 +222,7 @@ ANASTASIS_CRYPTO_user_identifier_derive (
                                   sizeof (struct
                                           ANASTASIS_CRYPTO_UserIdentifier),
                                   id));
+  GNUNET_free (json_enc);
 }
 
 
diff --git a/src/util/test_anastasis_crypto.c b/src/util/test_anastasis_crypto.c
index 97ef7e9..6be5792 100644
--- a/src/util/test_anastasis_crypto.c
+++ b/src/util/test_anastasis_crypto.c
@@ -43,14 +43,14 @@ test_user_identifier_derive (void)
   struct ANASTASIS_CRYPTO_UserIdentifier id_3;
 
   // sample data 1
-  id_data_1 = json_array ();
-  json_array_append (id_data_1, json_string ("Hallo"));
+  id_data_1 = json_object ();
+  json_object_set_new (id_data_1, "arg1", json_string ("Hallo"));
   // sample data 2, equal to sample data 1
-  id_data_2 = json_array ();
-  json_array_append (id_data_2, json_string ("Hallo"));
+  id_data_2 = json_object ();
+  json_object_set_new (id_data_2, "arg1", json_string ("Hallo"));
   // sample data 3, differs
-  id_data_3 = json_array ();
-  json_array_append (id_data_3, json_string ("Hallo2"));
+  id_data_3 = json_object ();
+  json_object_set_new (id_data_3, "arg1", json_string ("Hallo2"));
 
   ANASTASIS_CRYPTO_user_identifier_derive (id_data_1, &id_1);
   ANASTASIS_CRYPTO_user_identifier_derive (id_data_2, &id_2);
@@ -82,11 +82,11 @@ test_recovery_document (void)
   void *plaintext;
   size_t size_plaintext;
   struct ANASTASIS_CRYPTO_UserIdentifier id;
+  json_t *id_data = json_object ();
   const char *test = "TEST_ERD";
 
-  GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE,
-                              &id,
-                              sizeof (struct ANASTASIS_CRYPTO_UserIdentifier));
+  json_object_set_new (id_data, "arg1", json_string ("ID_DATA"));
+  ANASTASIS_CRYPTO_user_identifier_derive (id_data, &id);
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "ERD_BEFORE:   %s\n",

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]