-fix FTBFS and other bugs
This commit is contained in:
parent
4eb2c3e78c
commit
2ad12de668
@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include "taler_util.h"
|
#include "taler_util.h"
|
||||||
#include <taler/taler_mhd_lib.h>
|
#include "taler_mhd_lib.h"
|
||||||
#include <gnunet/gnunet_db_lib.h>
|
#include <gnunet/gnunet_db_lib.h>
|
||||||
#include <gcrypt.h>
|
#include <gcrypt.h>
|
||||||
|
|
||||||
@ -37,7 +37,6 @@
|
|||||||
#define TIME_INTERVAL_RANGE 2
|
#define TIME_INTERVAL_RANGE 2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute TOTP code at current time with offset
|
* Compute TOTP code at current time with offset
|
||||||
* @a time_off for the @a key.
|
* @a time_off for the @a key.
|
||||||
@ -131,26 +130,22 @@ base32decode (const char *val,
|
|||||||
* 32 characters for decoding, using RFC 3548.
|
* 32 characters for decoding, using RFC 3548.
|
||||||
*/
|
*/
|
||||||
static const char *decTable__ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
static const char *decTable__ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
||||||
unsigned int wpos;
|
unsigned char *udata = key;
|
||||||
unsigned int rpos;
|
unsigned int wpos = 0;
|
||||||
unsigned int bits;
|
unsigned int rpos = 0;
|
||||||
unsigned int vbit;
|
unsigned int bits = 0;
|
||||||
unsigned char *udata;
|
unsigned int vbit = 0;
|
||||||
|
|
||||||
udata = val;
|
|
||||||
vbit = 0;
|
|
||||||
wpos = 0;
|
|
||||||
rpos = 0;
|
|
||||||
bits = 0;
|
|
||||||
while ((rpos < val_size) || (vbit >= 8))
|
while ((rpos < val_size) || (vbit >= 8))
|
||||||
{
|
{
|
||||||
if ((rpos < val_size) && (vbit < 8))
|
if ((rpos < val_size) && (vbit < 8))
|
||||||
{
|
{
|
||||||
char c = val[rpos++];
|
char c = val[rpos++];
|
||||||
if (c == '=') { // padding character
|
if (c == '=') // padding character
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
const char *p = strchr(decTable__, toupper(c));
|
const char *p = strchr (decTable__, toupper (c));
|
||||||
if (! p)
|
if (! p)
|
||||||
{ // invalid character
|
{ // invalid character
|
||||||
return -1;
|
return -1;
|
||||||
@ -263,13 +258,13 @@ TALER_build_pos_confirmation (const char *pos_key,
|
|||||||
return ret;
|
return ret;
|
||||||
case TALER_MCA_WITH_PRICE:
|
case TALER_MCA_WITH_PRICE:
|
||||||
{
|
{
|
||||||
struct GNUNET_HashCode *hkey;
|
struct GNUNET_HashCode hkey;
|
||||||
struct TALER_AmountNBO ntotal;
|
struct TALER_AmountNBO ntotal;
|
||||||
|
|
||||||
TALER_amount_hton (&ntotal,
|
TALER_amount_hton (&ntotal,
|
||||||
total);
|
total);
|
||||||
GNUNET_assert (GNUNET_YES ==
|
GNUNET_assert (GNUNET_YES ==
|
||||||
GNUNET_CRYPTO_kdf (hkey,
|
GNUNET_CRYPTO_kdf (&hkey,
|
||||||
sizeof (hkey),
|
sizeof (hkey),
|
||||||
&ntotal,
|
&ntotal,
|
||||||
sizeof (ntotal),
|
sizeof (ntotal),
|
||||||
@ -278,7 +273,7 @@ TALER_build_pos_confirmation (const char *pos_key,
|
|||||||
NULL,
|
NULL,
|
||||||
0));
|
0));
|
||||||
GNUNET_free (key);
|
GNUNET_free (key);
|
||||||
ret = executive_totp (hkey,
|
ret = executive_totp (&hkey,
|
||||||
sizeof(hkey),
|
sizeof(hkey),
|
||||||
ts);
|
ts);
|
||||||
GNUNET_free (key);
|
GNUNET_free (key);
|
||||||
|
Loading…
Reference in New Issue
Block a user