-problem solving: endianess conversion (and coding style)

This commit is contained in:
Christian Grothoff 2015-06-12 09:09:42 +02:00
parent 48c8aaf0d7
commit 548e19e9fd
2 changed files with 41 additions and 51 deletions

View File

@ -18,12 +18,11 @@
* @brief Interpreter library for mint database performance analysis
* @author Nicolas Fournier
*/
#include "../include/platform.h"
#include <gnunet/gnunet_crypto_lib.h>
#include "platform.h"
#include "perf_taler_mintdb_init.h"
#include <gnunet/gnunet_signatures.h>
#include "../include/taler_mintdb_plugin.h"
#include "../include/taler_signatures.h"
#include "../include/taler_amount_lib.h"
#include "taler_signatures.h"
#include "taler_amount_lib.h"
#define CURRENCY "EUR"
@ -35,20 +34,18 @@
struct TALER_MINTDB_CollectableBlindcoin *
collectable_blindcoin_init ()
{
struct GNUNET_CRYPTO_rsa_PrivateKey *denomination_key;
struct GNUNET_CRYPTO_EddsaPrivateKey *reserve_sig_key;
// indent by 2 spaces
struct TALER_MINTDB_CollectableBlindcoin *coin =
GNUNET_new (struct TALER_MINTDB_CollectableBlindcoin);
struct GNUNET_CRYPTO_EddsaPrivateKey *reserve_sig_key;
GNUNET_assert (NULL !=
(reserve_sig_key = GNUNET_CRYPTO_eddsa_key_create ())
);
struct GNUNET_CRYPTO_rsa_PrivateKey *denomination_key ;
GNUNET_assert (NULL !=
(denomination_key = GNUNET_CRYPTO_rsa_private_key_create (512))
);
GNUNET_assert (NULL ==
(coin->denom_pub.rsa_public_key =
GNUNET_CRYPTO_rsa_private_key_get_public (denomination_key))
@ -198,14 +195,12 @@ struct TALER_MINTDB_Deposit *
deposit_init ()
{
static int transaction_id = 0;
struct TALER_MINTDB_Deposit *deposit;
GNUNET_assert (NULL !=
(deposit = GNUNET_new (struct TALER_MINTDB_Deposit)
));
deposit-> transaction_id = transaction_id;
GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount (CURRENCY ":1.1", &deposit->amount_with_fee)
);
@ -240,16 +235,14 @@ deposit_init ()
GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX);
unsigned_data.purpose.size = sizeof (unsigned_data);
unsigned_data.purpose.purpose = GNUNET_SIGNATURE_PURPOSE_TEST;
unsigned_data.purpose.size = htonl (sizeof (struct u32_presign));
unsigned_data.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TEST);
unsigned_data.data = random_int;
GNUNET_assert (GNUNET_OK ==
GNUNET_CRYPTO_eddsa_sign (eddsa_prvt,
(struct GNUNET_CRYPTO_EccSignaturePurpose *) &unsigned_data,
&deposit->csig.eddsa_signature)
);
&unsigned_data.purpose,
&deposit->csig.eddsa_signature));
GNUNET_CRYPTO_eddsa_key_clear (eddsa_prvt);
}

View File

@ -21,10 +21,7 @@
#ifndef __PERF_TALER_MINTDB_INIT_H___
#define __PERF_TALER_MINTDB_INIT_H___
#include "../include/platform.h"
#include "../include/taler_mintdb_lib.h"
#include "../include/taler_mintdb_plugin.h"
#include "taler_mintdb_plugin.h"
#define CURRENCY "EUR"