gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: -fix FTBFS and other bugs


From: gnunet
Subject: [taler-exchange] branch master updated: -fix FTBFS and other bugs
Date: Sat, 04 Mar 2023 18:19:21 +0100

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

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 2ad12de6 -fix FTBFS and other bugs
2ad12de6 is described below

commit 2ad12de668b81e284708e5386a0fe90971f088cd
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sat Mar 4 18:19:18 2023 +0100

    -fix FTBFS and other bugs
---
 src/util/crypto_confirmation.c | 71 ++++++++++++++++++++----------------------
 1 file changed, 33 insertions(+), 38 deletions(-)

diff --git a/src/util/crypto_confirmation.c b/src/util/crypto_confirmation.c
index 6c6b7fb4..6e5881e1 100644
--- a/src/util/crypto_confirmation.c
+++ b/src/util/crypto_confirmation.c
@@ -21,7 +21,7 @@
  */
 #include "platform.h"
 #include "taler_util.h"
-#include <taler/taler_mhd_lib.h>
+#include "taler_mhd_lib.h"
 #include <gnunet/gnunet_db_lib.h>
 #include <gcrypt.h>
 
@@ -29,7 +29,7 @@
  * How long is a TOTP code valid?
  */
 #define TOTP_VALIDITY_PERIOD GNUNET_TIME_relative_multiply ( \
-   GNUNET_TIME_UNIT_SECONDS, 30)
+    GNUNET_TIME_UNIT_SECONDS, 30)
 
 /**
  * Range of time we allow (plus-minus).
@@ -37,7 +37,6 @@
 #define TIME_INTERVAL_RANGE 2
 
 
-
 /**
  * Compute TOTP code at current time with offset
  * @a time_off for the @a key.
@@ -131,26 +130,22 @@ base32decode (const char *val,
    * 32 characters for decoding, using RFC 3548.
    */
   static const char *decTable__ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
-  unsigned int wpos;
-  unsigned int rpos;
-  unsigned int bits;
-  unsigned int vbit;
-  unsigned char *udata;
+  unsigned char *udata = key;
+  unsigned int wpos = 0;
+  unsigned int rpos = 0;
+  unsigned int bits = 0;
+  unsigned int vbit = 0;
 
-  udata = val;
-  vbit = 0;
-  wpos = 0;
-  rpos = 0;
-  bits = 0;
   while ((rpos < val_size) || (vbit >= 8))
   {
     if ((rpos < val_size) && (vbit < 8))
     {
       char c = val[rpos++];
-      if (c == '=') { // padding character
+      if (c == '=')   // padding character
+      {
         break;
       }
-      const char *p = strchr(decTable__, toupper(c));
+      const char *p = strchr (decTable__, toupper (c));
       if (! p)
       { // invalid character
         return -1;
@@ -178,29 +173,29 @@ executive_totp (void *h_key,
   ret = NULL;
 
   for (int i = -TIME_INTERVAL_RANGE; i<= TIME_INTERVAL_RANGE; i++)
+  {
+    code = compute_totp (ts,
+                         i,
+                         h_key,
+                         h_key_len);
+    if (NULL == ret)
     {
-      code = compute_totp (ts,
-                           i,
-                           h_key,
-                           h_key_len);
-      if (NULL == ret)
-      {
-        GNUNET_asprintf (&ret,
-                         "%llu",
-                         (unsigned long long) code);
-      }
-      else
-      {
-        char *tmp;
+      GNUNET_asprintf (&ret,
+                       "%llu",
+                       (unsigned long long) code);
+    }
+    else
+    {
+      char *tmp;
 
-        GNUNET_asprintf (&tmp,
-                         "%s\n%llu",
-                         ret,
-                         (unsigned long long) code);
-        GNUNET_free (ret);
-        ret = tmp;
-      }
+      GNUNET_asprintf (&tmp,
+                       "%s\n%llu",
+                       ret,
+                       (unsigned long long) code);
+      GNUNET_free (ret);
+      ret = tmp;
     }
+  }
   return ret;
 
 }
@@ -263,13 +258,13 @@ TALER_build_pos_confirmation (const char *pos_key,
     return ret;
   case TALER_MCA_WITH_PRICE:
     {
-      struct GNUNET_HashCode *hkey;
+      struct GNUNET_HashCode hkey;
       struct TALER_AmountNBO ntotal;
 
       TALER_amount_hton (&ntotal,
                          total);
       GNUNET_assert (GNUNET_YES ==
-                     GNUNET_CRYPTO_kdf (hkey,
+                     GNUNET_CRYPTO_kdf (&hkey,
                                         sizeof (hkey),
                                         &ntotal,
                                         sizeof (ntotal),
@@ -278,7 +273,7 @@ TALER_build_pos_confirmation (const char *pos_key,
                                         NULL,
                                         0));
       GNUNET_free (key);
-      ret = executive_totp (hkey,
+      ret = executive_totp (&hkey,
                             sizeof(hkey),
                             ts);
       GNUNET_free (key);

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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