gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] 02/02: modified debugging logs


From: gnunet
Subject: [taler-anastasis] 02/02: modified debugging logs
Date: Thu, 23 Apr 2020 09:46:03 +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 a48ad99b3459d328ae8c38aad3050141219a1bca
Author: Dennis Neufeld <address@hidden>
AuthorDate: Wed Apr 22 16:17:24 2020 +0000

    modified debugging logs
---
 src/lib/testing_api_cmd_truth_store.c | 18 ++++-----
 src/util/anastasis_crypto.c           | 73 +++++++++++++++++++++--------------
 2 files changed, 52 insertions(+), 39 deletions(-)

diff --git a/src/lib/testing_api_cmd_truth_store.c 
b/src/lib/testing_api_cmd_truth_store.c
index 9f3eab8..d6b297a 100644
--- a/src/lib/testing_api_cmd_truth_store.c
+++ b/src/lib/testing_api_cmd_truth_store.c
@@ -394,12 +394,14 @@ ANASTASIS_TESTING_make_truth_example (const char *method,
 
   GNUNET_assert (NULL != &answer);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Hashed answer in truth example: %s\n",
-              TALER_B2S (&answer));
+              "At %s:%d Hashed answer is %s-%llu b\n", __FILE__, __LINE__,
+              TALER_B2S (&answer),
+              (unsigned long long) sizeof (answer));
   GNUNET_assert (NULL != &key);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "TruthKey in truth example: %s\n",
-              TALER_B2S (&key));
+              "At %s:%d TruthKey is %s-%llu b\n", __FILE__, __LINE__,
+              TALER_B2S (&key),
+              (unsigned long long) sizeof (key));
 
   GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
                               &keyshare_data,
@@ -414,11 +416,9 @@ ANASTASIS_TESTING_make_truth_example (const char *method,
                                   &size_encrypted_truth);
   GNUNET_assert (NULL != encrypted_truth);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Encrypted truth in json: %s\n",
-              TALER_b2s (encrypted_truth, size_encrypted_truth));
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Encrypted truth size: %lu\n",
-              size_encrypted_truth);
+              "At %s:%d encrypted_truth is %s-%llu b\n", __FILE__, __LINE__,
+              TALER_b2s (encrypted_truth, size_encrypted_truth),
+              (unsigned long long) size_encrypted_truth);
 
   truth_data = json_pack ("{s:o," /* keyshare_data */
                           " s:s," /* method */
diff --git a/src/util/anastasis_crypto.c b/src/util/anastasis_crypto.c
index cf05ea4..582f221 100644
--- a/src/util/anastasis_crypto.c
+++ b/src/util/anastasis_crypto.c
@@ -96,13 +96,13 @@ anastasis_encrypt (const void *key,
   char *ciphertext;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "KEY_E:   %s\n",
-              TALER_b2s (key,
-                         key_len));
+              "At %s:%d KEY_E is %s-%llu b\n", __FILE__, __LINE__,
+              TALER_b2s (key, key_len),
+              (unsigned long long) key_len);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "PLAINTEXT_E:   %s\n",
-              TALER_b2s (data,
-                         data_size));
+              "At %s:%d PLAINTEXT_E is %s-%llu b\n", __FILE__, __LINE__,
+              TALER_b2s (data, data_size),
+              (unsigned long long) data_size);
 
   *res_size = data_size
               + sizeof (struct ANASTASIS_CRYPTO_Nonce)
@@ -124,8 +124,9 @@ anastasis_encrypt (const void *key,
               &sym_key,
               &iv);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "NONCE_E:   %s\n",
-              TALER_B2S (nonce));
+              "At %s:%d NONCE_E is %s-%llu b\n", __FILE__, __LINE__,
+              TALER_B2S (nonce),
+              (unsigned long long) sizeof (*nonce));
   GNUNET_assert (0 ==
                  gcry_cipher_open (&cipher,
                                    GCRY_CIPHER_AES256,
@@ -147,20 +148,22 @@ anastasis_encrypt (const void *key,
                                       data,
                                       data_size));
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "CIPHERTEXT_E:   %s\n",
-              TALER_b2s (ciphertext,
-                         strlen (ciphertext)));
+              "At %s:%d CIPHERTEXT_E is %s-%llu b\n", __FILE__, __LINE__,
+              TALER_b2s (ciphertext, data_size),
+              (unsigned long long) data_size);
   GNUNET_assert (0 ==
                  gcry_cipher_gettag (cipher,
                                      tag,
                                      sizeof (struct ANASTASIS_CRYPTO_AesTag)));
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "TAG_E:   %s\n",
-              TALER_B2S (tag));
+              "At %s:%d TAG_E is %s-%llu b\n", __FILE__, __LINE__,
+              TALER_B2S (tag),
+              (unsigned long long) sizeof (*tag));
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "RES_E:   %s\n",
-              TALER_b2s (*res,
-                         *res_size));
+              "At %s:%d RES_E is %s-%llu b\n", __FILE__, __LINE__,
+              TALER_b2s (*res, *res_size),
+              (unsigned long long) *res_size);
+
   gcry_cipher_close (cipher);
 }
 
@@ -185,10 +188,6 @@ anastasis_decrypt (const void *key,
                    void **res,
                    size_t *res_size)
 {
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "KEY_D:   %s\n",
-              TALER_b2s (key,
-                         key_len));
   struct ANASTASIS_CRYPTO_Nonce *nonce;
   gcry_cipher_hd_t cipher;
   struct ANASTASIS_CRYPTO_SymKey sym_key;
@@ -197,6 +196,15 @@ anastasis_decrypt (const void *key,
   struct ANASTASIS_CRYPTO_AesTag *tag;
   char *ciphertext;
 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "At %s:%d KEY_D is %s-%llu b\n", __FILE__, __LINE__,
+              TALER_b2s (key, key_len),
+              (unsigned long long) key_len);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "At %s:%d INPUT_D is %s-%llu b\n", __FILE__, __LINE__,
+              TALER_b2s (data, data_size),
+              (unsigned long long) data_size);
+
   *res_size = data_size
               - sizeof (struct ANASTASIS_CRYPTO_Nonce)
               - sizeof (struct ANASTASIS_CRYPTO_AesTag);
@@ -204,19 +212,24 @@ anastasis_decrypt (const void *key,
   GNUNET_assert (*res_size == data_size
                  - sizeof (struct ANASTASIS_CRYPTO_Nonce)
                  - sizeof (struct ANASTASIS_CRYPTO_AesTag));
+
   nonce = (struct ANASTASIS_CRYPTO_Nonce *) data;
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "NONCE_D:   %s\n",
-              TALER_B2S (nonce));
+              "At %s:%d NONCE_D is %s-%llu b\n", __FILE__, __LINE__,
+              TALER_B2S (nonce),
+              (unsigned long long) sizeof (*nonce));
+
   tag = (struct ANASTASIS_CRYPTO_AesTag *) &nonce[1];
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "TAG_D:   %s\n",
-              TALER_B2S (tag));
+              "At %s:%d TAG_D is %s-%llu b\n", __FILE__, __LINE__,
+              TALER_B2S (tag),
+              (unsigned long long) sizeof (*tag));
+
   ciphertext = (char *) &tag[1];
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "CIPHERTEXT_D:   %s\n",
-              TALER_b2s (ciphertext,
-                         strlen (ciphertext)));
+              "At %s:%d CIPHERTEXT_D is %s-%llu b\n", __FILE__, __LINE__,
+              TALER_b2s (ciphertext, *res_size),
+              (unsigned long long) *res_size);
 
   get_iv_key (key,
               key_len,
@@ -244,9 +257,9 @@ anastasis_decrypt (const void *key,
                                            ciphertext,
                                            *res_size));
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "PLAINTEXT_D:   %s\n",
-              TALER_b2s (*res,
-                         *res_size));
+              "At %s:%d PLAINTEXT_D is %s-%llu b\n", __FILE__, __LINE__,
+              TALER_b2s (*res, *res_size),
+              (unsigned long long) *res_size);
   GNUNET_assert (0 ==
                  gcry_cipher_checktag (cipher,
                                        tag,

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



reply via email to

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