summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcello Stanisci <marcello.stanisci@inria.fr>2015-08-11 15:49:38 +0200
committerMarcello Stanisci <marcello.stanisci@inria.fr>2015-08-11 15:49:38 +0200
commit87f1602acacfc1a8ae67f2b5eca3bd355018ffd6 (patch)
tree3186537d65dbc29721e3adf24f4efb5b03550a36
parenta4845fb67d4c58a2fe17d6f82f005dbaa0c93b87 (diff)
downloadmerchant-87f1602acacfc1a8ae67f2b5eca3bd355018ffd6.tar.gz
merchant-87f1602acacfc1a8ae67f2b5eca3bd355018ffd6.tar.bz2
merchant-87f1602acacfc1a8ae67f2b5eca3bd355018ffd6.zip
getting rid of in_tree includes
-rw-r--r--src/backend/taler-mint-httpd.h127
-rw-r--r--src/backend/taler_amount_lib.h273
-rw-r--r--src/backend/taler_crypto_lib.h569
-rw-r--r--src/backend/taler_json_lib.h181
-rw-r--r--src/backend/taler_mintdb_lib.h224
-rw-r--r--src/backend/taler_mintdb_plugin.h1218
-rw-r--r--src/backend/taler_signatures.h653
-rw-r--r--src/backend/taler_util.h162
8 files changed, 0 insertions, 3407 deletions
diff --git a/src/backend/taler-mint-httpd.h b/src/backend/taler-mint-httpd.h
deleted file mode 100644
index a54e5aa2..00000000
--- a/src/backend/taler-mint-httpd.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- This file is part of TALER
- Copyright (C) 2014, 2015 GNUnet e.V.
-
- TALER is free software; you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License along with
- TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
-*/
-/**
- * @file taler-mint-httpd.h
- * @brief Global declarations for the mint
- * @author Florian Dold
- * @author Benedikt Mueller
- * @author Christian Grothoff
- *
- * FIXME: Consider which of these need to really be globals...
- */
-#ifndef TALER_MINT_HTTPD_H
-#define TALER_MINT_HTTPD_H
-
-#include <microhttpd.h>
-
-/**
- * Which currency is used by this mint?
- */
-extern char *TMH_mint_currency_string;
-
-/**
- * The mint's configuration.
- */
-extern struct GNUNET_CONFIGURATION_Handle *cfg;
-
-/**
- * Are we running in test mode?
- */
-extern int TMH_test_mode;
-
-/**
- * Main directory with mint data.
- */
-extern char *TMH_mint_directory;
-
-/**
- * In which format does this MINT expect wiring instructions?
- */
-extern char *TMH_expected_wire_format;
-
-/**
- * Master public key (according to the
- * configuration in the mint directory).
- */
-extern struct GNUNET_CRYPTO_EddsaPublicKey TMH_master_public_key;
-
-/**
- * Private key of the mint we use to sign messages.
- */
-extern struct GNUNET_CRYPTO_EddsaPrivateKey TMH_mint_private_signing_key;
-
-/**
- * Our DB plugin.
- */
-extern struct TALER_MINTDB_Plugin *TMH_plugin;
-
-
-/**
- * @brief Struct describing an URL and the handler for it.
- */
-struct TMH_RequestHandler
-{
-
- /**
- * URL the handler is for.
- */
- const char *url;
-
- /**
- * Method the handler is for, NULL for "all".
- */
- const char *method;
-
- /**
- * Mime type to use in reply (hint, can be NULL).
- */
- const char *mime_type;
-
- /**
- * Raw data for the @e handler
- */
- const void *data;
-
- /**
- * Number of bytes in @e data, 0 for 0-terminated.
- */
- size_t data_size;
-
- /**
- * Function to call to handle the request.
- *
- * @param rh this struct
- * @param mime_type the @e mime_type for the reply (hint, can be NULL)
- * @param connection the MHD connection to handle
- * @param[in,out] connection_cls the connection's closure (can be updated)
- * @param upload_data upload data
- * @param[in,out] upload_data_size number of bytes (left) in @a upload_data
- * @return MHD result code
- */
- int (*handler)(struct TMH_RequestHandler *rh,
- struct MHD_Connection *connection,
- void **connection_cls,
- const char *upload_data,
- size_t *upload_data_size);
-
- /**
- * Default response code.
- */
- int response_code;
-};
-
-
-#endif
diff --git a/src/backend/taler_amount_lib.h b/src/backend/taler_amount_lib.h
deleted file mode 100644
index 8661ed91..00000000
--- a/src/backend/taler_amount_lib.h
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- This file is part of TALER
- Copyright (C) 2014, 2015 Christian Grothoff (and other contributing authors)
-
- TALER is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
-*/
-/**
- * @file include/taler_amount_lib.h
- * @brief amount-representation utility functions
- * @author Sree Harsha Totakura <sreeharsha@totakura.in>
- */
-#ifndef TALER_AMOUNT_LIB_H
-#define TALER_AMOUNT_LIB_H
-
-#ifdef __cplusplus
-extern "C"
-{
-#if 0 /* keep Emacsens' auto-indent happy */
-}
-#endif
-#endif
-
-#include <gnunet/platform.h>
-
-
-/**
- * @brief Number of characters (plus 1 for 0-termination) we use to
- * represent currency names (i.e. EUR, USD, etc.). We use 8+4 for
- * alignment in the `struct TALER_Amount`. The amount is typically an
- * ISO 4217 currency code when an alpha-numeric 3-digit code is used.
- * For regional currencies, the first character should be a "*" followed
- * by a region-specific name (i.e. "*BRETAGNEFR").
- */
-#define TALER_CURRENCY_LEN 12
-
-/**
- * Taler currency length as a string.
- */
-#define TALER_CURRENCY_LEN_STR "12"
-
-/**
- * @brief The "fraction" value in a `struct TALER_Amount` represents which
- * fraction of the "main" value?
- *
- * Note that we need sub-cent precision here as transaction fees might
- * be that low, and as we want to support microdonations.
- */
-#define TALER_AMOUNT_FRAC_BASE 1000000
-
-/**
- * @brief How many digits behind the comma are required to represent the
- * fractional value in human readable decimal format? Must match
- * lg(#TALER_AMOUNT_FRAC_BASE).
- */
-#define TALER_AMOUNT_FRAC_LEN 6
-
-
-GNUNET_NETWORK_STRUCT_BEGIN
-
-
-/**
- * @brief Amount, encoded for network transmission.
- */
-struct TALER_AmountNBO
-{
- /**
- * Value in the main currency, in NBO.
- */
- uint64_t value GNUNET_PACKED;
-
- /**
- * Additinal fractional value, in NBO.
- */
- uint32_t fraction GNUNET_PACKED;
-
- /**
- * Type of the currency being represented.
- */
- char currency[TALER_CURRENCY_LEN];
-};
-
-GNUNET_NETWORK_STRUCT_END
-
-
-/**
- * @brief Representation of monetary value in a given currency.
- */
-struct TALER_Amount
-{
- /**
- * Value (numerator of fraction)
- */
- uint64_t value;
-
- /**
- * Fraction (denominator of fraction)
- */
- uint32_t fraction;
-
- /**
- * Currency string, left adjusted and padded with zeros. All zeros
- * for "invalid" values.
- */
- char currency[TALER_CURRENCY_LEN];
-};
-
-
-/**
- * Parse denomination description, in the format "T:V.F".
- *
- * @param str denomination description
- * @param denom denomination to write the result to
- * @return #GNUNET_OK if the string is a valid denomination specification,
- * #GNUNET_SYSERR if it is invalid.
- */
-int
-TALER_string_to_amount (const char *str,
- struct TALER_Amount *denom);
-
-
-/**
- * Get the value of "zero" in a particular currency.
- *
- * @param cur currency description
- * @param denom denomination to write the result to
- * @return #GNUNET_OK if @a cur is a valid currency specification,
- * #GNUNET_SYSERR if it is invalid.
- */
-int
-TALER_amount_get_zero (const char *cur,
- struct TALER_Amount *denom);
-
-
-/**
- * Convert amount from host to network representation.
- *
- * @param res where to store amount in network representation
- * @param d amount in host representation
- */
-void
-TALER_amount_hton (struct TALER_AmountNBO *res,
- const struct TALER_Amount *d);
-
-
-/**
- * Convert amount from network to host representation.
- *
- * @param res where to store amount in host representation
- * @param dn amount in network representation
- */
-void
-TALER_amount_ntoh (struct TALER_Amount *res,
- const struct TALER_AmountNBO *dn);
-
-
-/**
- * Compare the value/fraction of two amounts. Does not compare the currency.
- * Comparing amounts of different currencies will cause the program to abort().
- * If unsure, check with #TALER_amount_cmp_currency() first to be sure that
- * the currencies of the two amounts are identical.
- *
- * @param a1 first amount
- * @param a2 second amount
- * @return result of the comparison
- * -1 if `a1 < a2`
- * 1 if `a1 > a2`
- * 0 if `a1 == a2`.
- */
-int
-TALER_amount_cmp (const struct TALER_Amount *a1,
- const struct TALER_Amount *a2);
-
-
-/**
- * Test if @a a1 and @a a2 are the same currency.
- *
- * @param a1 amount to test
- * @param a2 amount to test
- * @return #GNUNET_YES if @a a1 and @a a2 are the same currency
- * #GNUNET_NO if the currencies are different
- * #GNUNET_SYSERR if either amount is invalid
- */
-int
-TALER_amount_cmp_currency (const struct TALER_Amount *a1,
- const struct TALER_Amount *a2);
-
-
-/**
- * Test if @a a1 and @a a2 are the same currency, NBO variant.
- *
- * @param a1 amount to test
- * @param a2 amount to test
- * @return #GNUNET_YES if @a a1 and @a a2 are the same currency
- * #GNUNET_NO if the currencies are different
- * #GNUNET_SYSERR if either amount is invalid
- */
-int
-TALER_amount_cmp_currency_nbo (const struct TALER_AmountNBO *a1,
- const struct TALER_AmountNBO *a2);
-
-
-/**
- * Perform saturating subtraction of amounts.
- *
- * @param diff where to store (@a a1 - @a a2), or invalid if @a a2 > @a a1
- * @param a1 amount to subtract from
- * @param a2 amount to subtract
- * @return #GNUNET_OK if the subtraction worked,
- * #GNUNET_NO if @a a1 = @a a2
- * #GNUNET_SYSERR if @a a2 > @a a1 or currencies are incompatible;
- * @a diff is set to invalid
- */
-int
-TALER_amount_subtract (struct TALER_Amount *diff,
- const struct TALER_Amount *a1,
- const struct TALER_Amount *a2);
-
-
-/**
- * Perform addition of amounts.
- *
- * @param sum where to store @a a1 + @a a2, set to "invalid" on overflow
- * @param a1 first amount to add
- * @param a2 second amount to add
- * @return #GNUNET_OK if the addition worked,
- * #GNUNET_SYSERR on overflow
- */
-int
-TALER_amount_add (struct TALER_Amount *sum,
- const struct TALER_Amount *a1,
- const struct TALER_Amount *a2);
-
-
-/**
- * Normalize the given amount.
- *
- * @param amount amount to normalize
- * @return #GNUNET_OK if normalization worked
- * #GNUNET_NO if value was already normalized
- * #GNUNET_SYSERR if value was invalid or could not be normalized
- */
-int
-TALER_amount_normalize (struct TALER_Amount *amount);
-
-
-/**
- * Convert amount to string.
- *
- * @param amount amount to convert to string
- * @return freshly allocated string representation,
- * NULL if the @a amount was invalid
- */
-char *
-TALER_amount_to_string (const struct TALER_Amount *amount);
-
-#if 0 /* keep Emacsens' auto-indent happy */
-{
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
diff --git a/src/backend/taler_crypto_lib.h b/src/backend/taler_crypto_lib.h
deleted file mode 100644
index 4126894a..00000000
--- a/src/backend/taler_crypto_lib.h
+++ /dev/null
@@ -1,569 +0,0 @@
-/*
- This file is part of TALER
- Copyright (C) 2014, 2015 Christian Grothoff (and other contributing authors)
-
- TALER is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
-*/
-/**
- * @file include/taler_crypto_lib.h
- * @brief taler-specific crypto functions
- * @author Sree Harsha Totakura <sreeharsha@totakura.in>
- * @author Christian Grothoff <christian@grothoff.org>
- */
-#ifndef TALER_CRYPTO_LIB_H
-#define TALER_CRYPTO_LIB_H
-
-#if HAVE_GNUNET_GNUNET_UTIL_LIB_H
-#include <gnunet/gnunet_util_lib.h>
-#include "taler_util.h"
-#elif HAVE_GNUNET_GNUNET_UTIL_TALER_WALLET_LIB_H
-#include <gnunet/gnunet_util_taler_wallet_lib.h>
-#include "taler_util_wallet.h"
-#endif
-
-#include <gcrypt.h>
-
-
-/* ****************** Coin crypto primitives ************* */
-
-GNUNET_NETWORK_STRUCT_BEGIN
-
-/**
- * @brief Type of public keys for Taler reserves.
- */
-struct TALER_ReservePublicKeyP
-{
- /**
- * Taler uses EdDSA for reserves.
- */
- struct GNUNET_CRYPTO_EddsaPublicKey eddsa_pub;
-};
-
-
-/**
- * @brief Type of private keys for Taler reserves.
- */
-struct TALER_ReservePrivateKeyP
-{
- /**
- * Taler uses EdDSA for reserves.
- */
- struct GNUNET_CRYPTO_EddsaPrivateKey eddsa_priv;
-};
-
-
-/**
- * @brief Type of signatures used with Taler reserves.
- */
-struct TALER_ReserveSignatureP
-{
- /**
- * Taler uses EdDSA for reserves.
- */
- struct GNUNET_CRYPTO_EddsaSignature eddsa_signature;
-};
-
-
-/**
- * @brief Type of public keys to for merchant authorizations.
- * Merchants can issue refunds using the corresponding
- * private key.
- */
-struct TALER_MerchantPublicKeyP
-{
- /**
- * Taler uses EdDSA for merchants.
- */
- struct GNUNET_CRYPTO_EddsaPublicKey eddsa_pub;
-};
-
-
-/**
- * @brief Type of private keys for merchant authorizations.
- * Merchants can issue refunds using the corresponding
- * private key.
- */
-struct TALER_MerchantPrivateKeyP
-{
- /**
- * Taler uses EdDSA for merchants.
- */
- struct GNUNET_CRYPTO_EddsaPrivateKey eddsa_priv;
-};
-
-
-/**
- * @brief Type of transfer public keys used during refresh
- * operations.
- */
-struct TALER_TransferPublicKeyP
-{
- /**
- * Taler uses ECDHE for transfer keys.
- */
- struct GNUNET_CRYPTO_EcdhePublicKey ecdhe_pub;
-};
-
-
-/**
- * @brief Type of transfer public keys used during refresh
- * operations.
- */
-struct TALER_TransferPrivateKeyP
-{
- /**
- * Taler uses ECDHE for melting session keys.
- */
- struct GNUNET_CRYPTO_EcdhePrivateKey ecdhe_priv;
-};
-
-
-/**
- * @brief Type of online public keys used by the mint to sign
- * messages.
- */
-struct TALER_MintPublicKeyP
-{
- /**
- * Taler uses EdDSA for online mint message signing.
- */
- struct GNUNET_CRYPTO_EddsaPublicKey eddsa_pub;
-};
-
-
-/**
- * @brief Type of online public keys used by the mint to
- * sign messages.
- */
-struct TALER_MintPrivateKeyP
-{
- /**
- * Taler uses EdDSA for online signatures sessions.
- */
- struct GNUNET_CRYPTO_EddsaPrivateKey eddsa_priv;
-};
-
-
-/**
- * @brief Type of signatures used by the mint to sign messages online.
- */
-struct TALER_MintSignatureP
-{
- /**
- * Taler uses EdDSA for online signatures sessions.
- */
- struct GNUNET_CRYPTO_EddsaSignature eddsa_signature;
-};
-
-
-/**
- * @brief Type of the offline master public key used by the mint.
- */
-struct TALER_MasterPublicKeyP
-{
- /**
- * Taler uses EdDSA for the long-term offline master key.
- */
- struct GNUNET_CRYPTO_EddsaPublicKey eddsa_pub;
-};
-
-
-/**
- * @brief Type of the public key used by the auditor.
- */
-struct TALER_AuditorPublicKeyP
-{
- /**
- * Taler uses EdDSA for the auditor's signing key.
- */
- struct GNUNET_CRYPTO_EddsaPublicKey eddsa_pub;
-};
-
-
-/**
- * @brief Type of the offline master public keys used by the mint.
- */
-struct TALER_MasterPrivateKeyP
-{
- /**
- * Taler uses EdDSA for the long-term offline master key.
- */
- struct GNUNET_CRYPTO_EddsaPrivateKey eddsa_priv;
-};
-
-
-/**
- * @brief Type of signatures by the offline master public key used by the mint.
- */
-struct TALER_MasterSignatureP
-{
- /**
- * Taler uses EdDSA for the long-term offline master key.
- */
- struct GNUNET_CRYPTO_EddsaSignature eddsa_signature;
-};
-
-
-
-/**
- * @brief Type of public keys for Taler coins. The same key material is used
- * for EdDSA and ECDHE operations.
- */
-struct TALER_CoinSpendPublicKeyP
-{
- /**
- * Taler uses EdDSA for coins when signing deposit requests.
- */
- struct GNUNET_CRYPTO_EddsaPublicKey eddsa_pub;
-
-};
-
-
-/**
- * @brief Type of private keys for Taler coins. The same key material is used
- * for EdDSA and ECDHE operations.
- */
-struct TALER_CoinSpendPrivateKeyP
-{
- /**
- * Taler uses EdDSA for coins when signing deposit requests.
- */
- struct GNUNET_CRYPTO_EddsaPrivateKey eddsa_priv;
-};
-
-
-/**
- * @brief Type of signatures made with Taler coins.
- */
-struct TALER_CoinSpendSignatureP
-{
- /**
- * Taler uses EdDSA for coins.
- */
- struct GNUNET_CRYPTO_EddsaSignature eddsa_signature;
-};
-
-
-GNUNET_NETWORK_STRUCT_END
-
-/**
- * @brief Type of blinding keys for Taler.
- */
-struct TALER_DenominationBlindingKey
-{
- /**
- * Taler uses RSA for blinding.
- */
- struct GNUNET_CRYPTO_rsa_BlindingKey *rsa_blinding_key;
-};
-
-
-/**
- * @brief Type of (unblinded) coin signatures for Taler.
- */
-struct TALER_DenominationSignature
-{
- /**
- * Taler uses RSA for blinding.
- */
- struct GNUNET_CRYPTO_rsa_Signature *rsa_signature;
-};
-
-
-/**
- * @brief Type of public signing keys for verifying blindly signed coins.
- */
-struct TALER_DenominationPublicKey
-{
- /**
- * Taler uses RSA for signing coins.
- */
- struct GNUNET_CRYPTO_rsa_PublicKey *rsa_public_key;
-};
-
-
-/**
- * @brief Type of private signing keys for blind signing of coins.
- */
-struct TALER_DenominationPrivateKey
-{
- /**
- * Taler uses RSA for signing coins.
- */
- struct GNUNET_CRYPTO_rsa_PrivateKey *rsa_private_key;
-};
-
-
-/**
- * @brief Public information about a coin (including the public key
- * of the coin, the denomination key and the signature with
- * the denomination key).
- */
-struct TALER_CoinPublicInfo
-{
- /**
- * The coin's public key.
- */
- struct TALER_CoinSpendPublicKeyP coin_pub;
-
- /**
- * Public key representing the denomination of the coin
- * that is being deposited.
- */
- struct TALER_DenominationPublicKey denom_pub;
-
- /**
- * (Unblinded) signature over @e coin_pub with @e denom_pub,
- * which demonstrates that the coin is valid.
- */
- struct TALER_DenominationSignature denom_sig;
-};
-
-
-/**
- * Check if a coin is valid; that is, whether the denomination key exists,
- * is not expired, and the signature is correct.
- *
- * @param coin_public_info the coin public info to check for validity
- * @return #GNUNET_YES if the coin is valid,
- * #GNUNET_NO if it is invalid
- * #GNUNET_SYSERROR if an internal error occured
- */
-int
-TALER_test_coin_valid (const struct TALER_CoinPublicInfo *coin_public_info);
-
-
-/* ****************** Refresh crypto primitives ************* */
-
-
-GNUNET_NETWORK_STRUCT_BEGIN
-
-/**
- * @brief Secret used to decrypt the key to decrypt link secrets.
- */
-struct TALER_TransferSecretP
-{
- /**
- * Secret used to encrypt/decrypt the `struct TALER_LinkSecretP`.
- * Must be (currently) a hash as this is what
- * #GNUNET_CRYPTO_ecc_ecdh() returns to us.
- */
- struct GNUNET_HashCode key;
-};
-
-
-/**
- * @brief Secret used to decrypt refresh links.
- */
-struct TALER_LinkSecretP
-{
- /**
- * Secret used to decrypt the refresh link data.
- */
- char key[sizeof (struct GNUNET_HashCode)];
-};
-
-
-/**
- * @brief Encrypted secret used to decrypt refresh links.
- */
-struct TALER_EncryptedLinkSecretP
-{
- /**
- * Encrypted secret, must be the given size!
- */
- char enc[sizeof (struct TALER_LinkSecretP)];
-};
-
-
-/**
- * @brief Representation of an refresh link in cleartext.
- */
-struct TALER_RefreshLinkDecrypted
-{
-
- /**
- * Private key of the coin.
- */
- struct TALER_CoinSpendPrivateKeyP coin_priv;
-
- /**
- * Blinding key.
- */
- struct TALER_DenominationBlindingKey blinding_key;
-
-};
-
-
-GNUNET_NETWORK_STRUCT_END
-
-
-/**
- * @brief Representation of an encrypted refresh link.
- */
-struct TALER_RefreshLinkEncrypted
-{
-
- /**
- * Encrypted blinding key with @e blinding_key_enc_size bytes,
- * must be allocated at the end of this struct.
- */
- const char *blinding_key_enc;
-
- /**
- * Number of bytes in @e blinding_key_enc.
- */
- size_t blinding_key_enc_size;
-
- /**
- * Encrypted private key of the coin.
- */
- char coin_priv_enc[sizeof (struct TALER_CoinSpendPrivateKeyP)];
-
-};
-
-
-/**
- * Decrypt the shared @a secret from the information in the
- * encrypted link secret @e secret_enc using the transfer
- * private key and the coin's public key.
- *
- * @param secret_enc encrypted link secret
- * @param trans_priv transfer private key
- * @param coin_pub coin public key
- * @param[out] secret set to the shared secret
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
- */
-int
-TALER_link_decrypt_secret (const struct TALER_EncryptedLinkSecretP *secret_enc,
- const struct TALER_TransferPrivateKeyP *trans_priv,
- const struct TALER_CoinSpendPublicKeyP *coin_pub,
- struct TALER_LinkSecretP *secret);
-
-
-/**
- * Decrypt the shared @a secret from the information in the
- * encrypted link secret @e secret_enc using the transfer
- * public key and the coin's private key.
- *
- * @param secret_enc encrypted link secret
- * @param trans_pub transfer public key
- * @param coin_priv coin private key
- * @param[out] secret set to the shared secret
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
- */
-int
-TALER_link_decrypt_secret2 (const struct TALER_EncryptedLinkSecretP *secret_enc,
- const struct TALER_TransferPublicKeyP *trans_pub,
- const struct TALER_CoinSpendPrivateKeyP *coin_priv,
- struct TALER_LinkSecretP *secret);
-
-
-/**
- * Encrypt the shared @a secret to generate the encrypted link secret.
- * Also creates the transfer key.
- *
- * @param secret link secret to encrypt
- * @param coin_pub coin public key
- * @param[out] trans_priv set to transfer private key
- * @param[out] trans_pub set to transfer public key
- * @param[out] secret_enc set to the encryptd @a secret
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
- */
-int
-TALER_link_encrypt_secret (const struct TALER_LinkSecretP *secret,
- const struct TALER_CoinSpendPublicKeyP *coin_pub,
- struct TALER_TransferPrivateKeyP *trans_priv,
- struct TALER_TransferPublicKeyP *trans_pub,
- struct TALER_EncryptedLinkSecretP *secret_enc);
-
-
-/**
- * Use the @a trans_sec (from ECDHE) to decrypt the @a secret_enc
- * to obtain the @a secret to decrypt the linkage data.
- *
- * @param secret_enc encrypted secret
- * @param trans_sec transfer secret
- * @param secret shared secret for refresh link decryption
- * @return #GNUNET_OK on success
- */
-int
-TALER_transfer_decrypt (const struct TALER_EncryptedLinkSecretP *secret_enc,
- const struct TALER_TransferSecretP *trans_sec,
- struct TALER_LinkSecretP *secret);
-
-
-/**
- * Use the @a trans_sec (from ECDHE) to encrypt the @a secret
- * to obtain the @a secret_enc.
- *
- * @param secret shared secret for refresh link decryption
- * @param trans_sec transfer secret
- * @param[out] secret_enc encrypted secret
- * @return #GNUNET_OK on success
- */
-int
-TALER_transfer_encrypt (const struct TALER_LinkSecretP *secret,
- const struct TALER_TransferSecretP *trans_sec,
- struct TALER_EncryptedLinkSecretP *secret_enc);
-
-
-/**
- * Decrypt refresh link information.
- *
- * @param input encrypted refresh link data
- * @param secret shared secret to use for decryption
- * @return NULL on error
- */
-struct TALER_RefreshLinkDecrypted *
-TALER_refresh_decrypt (const struct TALER_RefreshLinkEncrypted *input,
- const struct TALER_LinkSecretP *secret);
-
-
-/**
- * Encrypt refresh link information.
- *
- * @param input plaintext refresh link data
- * @param secret shared secret to use for encryption
- * @return NULL on error (should never happen)
- */
-struct TALER_RefreshLinkEncrypted *
-TALER_refresh_encrypt (const struct TALER_RefreshLinkDecrypted *input,
- const struct TALER_LinkSecretP *secret);
-
-
-/**
- * Decode encrypted refresh link information from buffer.
- *
- * @param buf buffer with refresh link data
- * @param buf_len number of bytes in @a buf
- * @return NULL on error (@a buf_len too small)
- */
-struct TALER_RefreshLinkEncrypted *
-TALER_refresh_link_encrypted_decode (const char *buf,
- size_t buf_len);
-
-
-/**
- * Encode encrypted refresh link information to buffer.
- *
- * @param rle refresh link to encode
- * @param[out] buf_len set number of bytes returned
- * @return NULL on error, otherwise buffer with encoded @a rle
- */
-char *
-TALER_refresh_link_encrypted_encode (const struct TALER_RefreshLinkEncrypted *rle,
- size_t *buf_len);
-
-
-
-#endif
diff --git a/src/backend/taler_json_lib.h b/src/backend/taler_json_lib.h
deleted file mode 100644
index 5a13b9bc..00000000
--- a/src/backend/taler_json_lib.h
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- This file is part of TALER
- Copyright (C) 2014, 2015 Christian Grothoff (and other contributing authors)
-
- TALER is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
-*/
-/**
- * @file include/taler_json_lib.h
- * @brief helper functions for JSON processing using libjansson
- * @author Sree Harsha Totakura <sreeharsha@totakura.in>
- */
-#ifndef TALER_json_LIB_H_
-#define TALER_json_LIB_H_
-
-#include <jansson.h>
-
-/**
- * Print JSON parsing related error information
- */
-#define TALER_json_warn(error) \
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, \
- "JSON parsing failed at %s:%u: %s (%s)\n", \
- __FILE__, __LINE__, error.text, error.source)
-
-
-/**
- * Convert a TALER amount to a JSON object.
- *
- * @param amount the amount
- * @return a json object describing the amount
- */
-json_t *
-TALER_json_from_amount (const struct TALER_Amount *amount);
-
-
-/**
- * Convert absolute timestamp to a json string.
- *
- * @param stamp the time stamp
- * @return a json string with the timestamp in @a stamp
- */
-json_t *
-TALER_json_from_abs (struct GNUNET_TIME_Absolute stamp);
-
-
-/**
- * Convert a signature (with purpose) to a JSON object representation.
- *
- * @param purpose purpose of the signature
- * @param signature the signature
- * @return the JSON reporesentation of the signature with purpose
- */
-json_t *
-TALER_json_from_eddsa_sig (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
- const struct GNUNET_CRYPTO_EddsaSignature *signature);
-
-
-/**
- * Convert RSA public key to JSON.
- *
- * @param pk public key to convert
- * @return corresponding JSON encoding
- */
-json_t *
-TALER_json_from_rsa_public_key (struct GNUNET_CRYPTO_rsa_PublicKey *pk);
-
-
-/**
- * Convert RSA signature to JSON.
- *
- * @param sig signature to convert
- * @return corresponding JSON encoding
- */
-json_t *
-TALER_json_from_rsa_signature (struct GNUNET_CRYPTO_rsa_Signature *sig);
-
-
-/**
- * Convert binary data to a JSON string
- * with the base32crockford encoding.
- *
- * @param data binary data
- * @param size size of @a data in bytes
- * @return json string that encodes @a data
- */
-json_t *
-TALER_json_from_data (const void *data, size_t size);
-
-
-/**
- * Parse given JSON object to Amount
- *
- * @param json the json object representing Amount
- * @param[out] r_amount where the amount has to be written
- * @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
- */
-int
-TALER_json_to_amount (json_t *json,
- struct TALER_Amount *r_amount);
-
-/**
- * Parse given JSON object to absolute time.
- *
- * @param json the json object representing absolute time in seconds
- * @param[out] abs where the time has to be written
- * @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
- */
-int
-TALER_json_to_abs (json_t *json,
- struct GNUNET_TIME_Absolute *abs);
-
-/**
- * Parse given JSON object to data
- *
- * @param json the json object representing data
- * @param out the pointer to hold the parsed data.
- * @param out_size the size of @a out
- * @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
- */
-int
-TALER_json_to_data (json_t *json,
- void *out,
- size_t out_size);
-
-
-/**
- * Convert JSON to RSA public key.
- *
- * @param json JSON encoding to convert
- * @return corresponding public key
- */
-struct GNUNET_CRYPTO_rsa_PublicKey *
-TALER_json_to_rsa_public_key (json_t *json);
-
-
-/**
- * Convert JSON to RSA signature.
- *
- * @param json JSON encoding to convert
- * @return corresponding signature
- */
-struct GNUNET_CRYPTO_rsa_Signature *
-TALER_json_to_rsa_signature (json_t *json);
-
-
-/**
- * Hash a JSON for binary signing.
- *
- * @param[in] json some JSON value to hash
- * @param[out] hc resulting hash code
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
- */
-int
-TALER_hash_json (json_t *json,
- struct GNUNET_HashCode *hc);
-
-
-/**
- * Check if the given wire format JSON object is correctly formatted
- *
- * @param type the type of the wire format
- * @param wire the JSON wire format object
- * @return #GNUNET_YES if correctly formatted; #GNUNET_NO if not
- */
-int
-TALER_json_validate_wireformat (const char *type,
- const json_t *wire);
-
-
-#endif /* TALER_json_LIB_H_ */
-
-/* End of taler_json_lib.h */
diff --git a/src/backend/taler_mintdb_lib.h b/src/backend/taler_mintdb_lib.h
deleted file mode 100644
index 24f67761..00000000
--- a/src/backend/taler_mintdb_lib.h
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- This file is part of TALER
- Copyright (C) 2014, 2015 Christian Grothoff (and other contributing authors)
-
- TALER is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
-*/
-/**
- * @file include/taler_mintdb_lib.h
- * @brief IO operations for the mint's private keys
- * @author Florian Dold
- * @author Benedikt Mueller
- * @author Christian Grothoff
- */
-#ifndef TALER_MINTDB_LIB_H
-#define TALER_MINTDB_LIB_H
-
-#include "taler_signatures.h"
-
-/**
- * Subdirectroy under the mint's base directory which contains
- * the mint's signing keys.
- */
-#define TALER_MINTDB_DIR_SIGNING_KEYS "signkeys"
-
-/**
- * Subdirectory under the mint's base directory which contains
- * the mint's denomination keys.
- */
-#define TALER_MINTDB_DIR_DENOMINATION_KEYS "denomkeys"
-
-
-GNUNET_NETWORK_STRUCT_BEGIN
-
-/**
- * @brief On disk format used for a mint signing key. Signing keys are used
- * by the mint to affirm its messages, but not to create coins.
- * Includes the private key followed by the public information about
- * the signing key.
- */
-struct TALER_MINTDB_PrivateSigningKeyInformationP
-{
- /**
- * Private key part of the mint's signing key.
- */
- struct TALER_MintPrivateKeyP signkey_priv;
-
- /**
- * Public information about a mint signing key.
- */
- struct TALER_MintSigningKeyValidityPS issue;
-};
-
-
-/**
- * Information about a denomination key.
- */
-struct TALER_MINTDB_DenominationKeyInformationP
-{
-
- /**
- * Signature over this struct to affirm the validity of the key.
- */
- struct TALER_MasterSignatureP signature;
-
- /**
- * Signed properties of the denomination key.
- */
- struct TALER_DenominationKeyValidityPS properties;
-};
-
-
-GNUNET_NETWORK_STRUCT_END
-
-
-/**
- * @brief All information about a denomination key (which is used to
- * sign coins into existence).
- */
-struct TALER_MINTDB_DenominationKeyIssueInformation
-{
- /**
- * The private key of the denomination. Will be NULL if the private
- * key is not available (this is the case after the key has expired
- * for signing coins, but is still valid for depositing coins).
- */
- struct TALER_DenominationPrivateKey denom_priv;
-
- /**
- * Decoded denomination public key (the hash of it is in
- * @e issue, but we sometimes need the full public key as well).
- */
- struct TALER_DenominationPublicKey denom_pub;
-
- /**
- * Signed public information about a denomination key.
- */
- struct TALER_MINTDB_DenominationKeyInformationP issue;
-};
-
-
-/**
- * @brief Iterator over signing keys.
- *
- * @param cls closure
- * @param filename name of the file the key came from
- * @param ski the sign key
- * @return #GNUNET_OK to continue to iterate,
- * #GNUNET_NO to stop iteration with no error,
- * #GNUNET_SYSERR to abort iteration with error!
- */
-typedef int
-(*TALER_MINTDB_SigningKeyIterator)(void *cls,
- const char *filename,
- const struct TALER_MINTDB_PrivateSigningKeyInformationP *ski);
-
-
-/**
- * @brief Iterator over denomination keys.
- *
- * @param cls closure
- * @param dki the denomination key
- * @param alias coin alias
- * @return #GNUNET_OK to continue to iterate,
- * #GNUNET_NO to stop iteration with no error,
- * #GNUNET_SYSERR to abort iteration with error!
- */
-typedef int
-(*TALER_MINTDB_DenominationKeyIterator)(void *cls,
- const char *alias,
- const struct TALER_MINTDB_DenominationKeyIssueInformation *dki);
-
-
-
-/**
- * Call @a it for each signing key found in the @a mint_base_dir.
- *
- * @param mint_base_dir base directory for the mint,
- * the signing keys must be in the #TALER_MINTDB_DIR_SIGNING_KEYS
- * subdirectory
- * @param it function to call on each signing key
- * @param it_cls closure for @a it
- * @return number of files found (may not match
- * number of keys given to @a it as malformed
- * files are simply skipped), -1 on error
- */
-int
-TALER_MINTDB_signing_keys_iterate (const char *mint_base_dir,
- TALER_MINTDB_SigningKeyIterator it,
- void *it_cls);
-
-
-/**
- * Call @a it for each denomination key found in the @a mint_base_dir.
- *
- * @param mint_base_dir base directory for the mint,
- * the signing keys must be in the #TALER_MINTDB_DIR_DENOMINATION_KEYS
- * subdirectory
- * @param it function to call on each denomination key found
- * @param it_cls closure for @a it
- * @return -1 on error, 0 if no files were found, otherwise
- * a positive number (however, even with a positive
- * number it is possible that @a it was never called
- * as maybe none of the files were well-formed)
- */
-int
-TALER_MINTDB_denomination_keys_iterate (const char *mint_base_dir,
- TALER_MINTDB_DenominationKeyIterator it,
- void *it_cls);
-
-
-/**
- * Exports a denomination key to the given file.
- *
- * @param filename the file where to write the denomination key
- * @param dki the denomination key
- * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure.
- */
-int
-TALER_MINTDB_denomination_key_write (const char *filename,
- const struct TALER_MINTDB_DenominationKeyIssueInformation *dki);
-
-
-/**
- * Import a denomination key from the given file.
- *
- * @param filename the file to import the key from
- * @param[out] dki set to the imported denomination key
- * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure
- */
-int
-TALER_MINTDB_denomination_key_read (const char *filename,
- struct TALER_MINTDB_DenominationKeyIssueInformation *dki);
-
-
-/**
- * Initialize the plugin.
- *
- * @param cfg configuration to use
- * @return NULL on failure
- */
-struct TALER_MINTDB_Plugin *
-TALER_MINTDB_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg);
-
-
-/**
- * Shutdown the plugin.
- *
- * @param plugin plugin to unload
- */
-void
-TALER_MINTDB_plugin_unload (struct TALER_MINTDB_Plugin *plugin);
-
-
-
-#endif
diff --git a/src/backend/taler_mintdb_plugin.h b/src/backend/taler_mintdb_plugin.h
deleted file mode 100644
index 21d83d9d..00000000
--- a/src/backend/taler_mintdb_plugin.h
+++ /dev/null
@@ -1,1218 +0,0 @@
-/*
- This file is part of TALER
- Copyright (C) 2014, 2015 Christian Grothoff (and other contributing authors)
-
- TALER is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
-*/
-/**
- * @file include/taler_mintdb_plugin.h
- * @brief Low-level (statement-level) database access for the mint
- * @author Florian Dold
- * @author Christian Grothoff
- */
-#ifndef TALER_MINTDB_PLUGIN_H
-#define TALER_MINTDB_PLUGIN_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include "taler_mintdb_lib.h"
-
-
-/**
- * @brief Information we keep on bank transfer(s) that established a reserve.
- */
-struct TALER_MINTDB_BankTransfer
-{
-
- /**
- * Public key of the reserve that was filled.
- */
- struct TALER_ReservePublicKeyP reserve_pub;
-
- /**
- * Amount that was transferred to the mint.
- */
- struct TALER_Amount amount;
-
- /**
- * When did the mint receive the incoming transaction?
- * (This is the execution date of the mint's database,
- * the execution date of the bank should be in @e wire).
- */
- struct GNUNET_TIME_Absolute execution_date;
-
- /**
- * Detailed wire information about the transaction.
- */
- json_t *wire;
-
-};
-
-
-/**
- * @brief A summary of a Reserve
- */
-struct TALER_MINTDB_Reserve
-{
- /**
- * The reserve's public key. This uniquely identifies the reserve
- */
- struct TALER_ReservePublicKeyP pub;
-
- /**
- * The balance amount existing in the reserve
- */
- struct TALER_Amount balance;
-
- /**
- * The expiration date of this reserve
- */
- struct GNUNET_TIME_Absolute expiry;
-};
-
-
-/**
- * @brief Information we keep for a withdrawn coin to reproduce
- * the /withdraw operation if needed, and to have proof
- * that a reserve was drained by this amount.
- */
-struct TALER_MINTDB_CollectableBlindcoin
-{
-
- /**
- * Our signature over the (blinded) coin.
- */
- struct TALER_DenominationSignature sig;
-
- /**
- * Denomination key (which coin was generated).
- */
- struct TALER_DenominationPublicKey denom_pub;
-
- /**
- * Value of the coin being minted (matching the denomination key)
- * plus the transaction fee. We include this in what is being
- * signed so that we can verify a reserve's remaining total balance
- * without needing to access the respective denomination key
- * information each time.
- */
- struct TALER_Amount amount_with_fee;
-
- /**
- * Withdrawl fee charged by the mint. This must match the Mint's
- * denomination key's withdrawl fee. If the client puts in an
- * invalid withdrawl fee (too high or too low) that does not match
- * the Mint's denomination key, the withdraw operation is invalid
- * and will be rejected by the mint. The @e amount_with_fee minus
- * the @e withdraw_fee is must match the value of the generated
- * coin. We include this in what is being signed so that we can
- * verify a mint's accounting without needing to access the
- * respective denomination key information each time.
- */
- struct TALER_Amount withdraw_fee;
-
- /**
- * Public key of the reserve that was drained.
- */
- struct TALER_ReservePublicKeyP reserve_pub;
-
- /**
- * Hash over the blinded message, needed to verify
- * the @e reserve_sig.
- */
- struct GNUNET_HashCode h_coin_envelope;
-
- /**
- * Signature confirming the withdrawl, matching @e reserve_pub,
- * @e denom_pub and @e h_coin_envelope.
- */
- struct TALER_ReserveSignatureP reserve_sig;
-};
-
-
-
-/**
- * @brief Types of operations on a reserved.
- */
-enum TALER_MINTDB_ReserveOperation
-{
- /**
- * Money was deposited into the reserve via a bank transfer.
- */
- TALER_MINTDB_RO_BANK_TO_MINT = 0,
-
- /**
- * A Coin was withdrawn from the reserve using /withdraw.
- */
- TALER_MINTDB_RO_WITHDRAW_COIN = 1
-};
-
-
-/**
- * @brief Reserve history as a linked list. Lists all of the transactions
- * associated with this reserve (such as the bank transfers that
- * established the reserve and all /withdraw operations we have done
- * since).
- */
-struct TALER_MINTDB_ReserveHistory
-{
-
- /**
- * Next entry in the reserve history.
- */
- struct TALER_MINTDB_ReserveHistory *next;
-
- /**
- * Type of the event, determins @e details.
- */
- enum TALER_MINTDB_ReserveOperation type;
-
- /**
- * Details of the operation, depending on @e type.
- */
- union
- {
-
- /**
- * Details about a bank transfer to the mint.
- */
- struct TALER_MINTDB_BankTransfer *bank;
-
- /**
- * Details about a /withdraw operation.
- */
- struct TALER_MINTDB_CollectableBlindcoin *withdraw;
-
- } details;
-
-};
-
-
-/**
- * @brief Specification for a /deposit operation. The combination of
- * the coin's public key, the merchant's public key and the
- * transaction ID must be unique. While a coin can (theoretically) be
- * deposited at the same merchant twice (with partial spending), the
- * merchant must either use a different public key or a different
- * transaction ID for the two transactions. The same coin must not
- * be used twice at the same merchant for the same transaction
- * (as determined by transaction ID). (Note: we might want to
- * fix #3819 and include at least h_contract as well.)
- */
-struct TALER_MINTDB_Deposit
-{
- /**
- * Information about the coin that is being deposited.
- */
- struct TALER_CoinPublicInfo coin;
-
- /**
- * ECDSA signature affirming that the customer intends
- * this coin to be deposited at the merchant identified
- * by @e h_wire in relation to the contract identified
- * by @e h_contract.
- */
- struct TALER_CoinSpendSignatureP csig;
-
- /**
- * Public key of the merchant. Enables later identification
- * of the merchant in case of a need to rollback transactions.
- */
- struct TALER_MerchantPublicKeyP merchant_pub;
-
- /**
- * Hash over the contract between merchant and customer
- * (remains unknown to the Mint).
- */
- struct GNUNET_HashCode h_contract;
-
- /**
- * Hash of the (canonical) representation of @e wire, used
- * to check the signature on the request. Generated by
- * the mint from the detailed wire data provided by the
- * merchant.
- */
- struct GNUNET_HashCode h_wire;
-
- /**
- * Detailed wire information for executing the transaction.
- */
- json_t *wire;
-
- /**
- * Merchant-generated transaction ID to detect duplicate
- * transactions.
- */
- uint64_t transaction_id;
-
- /**
- * Time when this request was generated. Used, for example, to
- * assess when (roughly) the income was achieved for tax purposes.
- * Note that the Mint will only check that the timestamp is not "too
- * far" into the future (i.e. several days). The fact that the
- * timestamp falls within the validity period of the coin's
- * denomination key is irrelevant for the validity of the deposit
- * request, as obviously the customer and merchant could conspire to
- * set any timestamp. Also, the Mint must accept very old deposit
- * requests, as the merchant might have been unable to transmit the
- * deposit request in a timely fashion (so back-dating is not
- * prevented).
- */
- struct GNUNET_TIME_Absolute timestamp;
-
- /**
- * How much time does the merchant have to issue a refund request?
- * Zero if refunds are not allowed. After this time, the coin
- * cannot be refunded.
- */
- struct GNUNET_TIME_Absolute refund_deadline;
-
- /**
- * Fraction of the coin's remaining value to be deposited, including
- * depositing fee (if any). The coin is identified by @e coin_pub.
- */
- struct TALER_Amount amount_with_fee;
-
- /**
- * Depositing fee.
- */
- struct TALER_Amount deposit_fee;
-
-};
-
-
-/**
- * @brief Global information for a refreshing session. Includes
- * dimensions of the operation, security parameters and
- * client signatures from "/refresh/melt" and "/refresh/commit".
- */
-struct TALER_MINTDB_RefreshSession
-{
-
- /**
- * Number of coins we are melting.
- */
- uint16_t num_oldcoins;
-
- /**
- * Number of new coins we are creating.
- */
- uint16_t num_newcoins;
-
- /**
- * Index (smaller #TALER_CNC_KAPPA) which the mint has chosen to not
- * have revealed during cut and choose.
- */
- uint16_t noreveal_index;
-
-};
-
-
-/**
- * @brief Specification for coin in a /refresh/melt operation.
- */
-struct TALER_MINTDB_RefreshMelt
-{
- /**
- * Information about the coin that is being melted.
- */
- struct TALER_CoinPublicInfo coin;
-
- /**
- * Signature over the melting operation.
- */
- struct TALER_CoinSpendSignatureP coin_sig;
-
- /**
- * Hash of the refresh session this coin is melted into.
- */
- struct GNUNET_HashCode session_hash;
-
- /**
- * How much value is being melted? This amount includes the fees,
- * so the final amount contributed to the melt is this value minus
- * the fee for melting the coin. We include the fee in what is
- * being signed so that we can verify a reserve's remaining total
- * balance without needing to access the respective denomination key
- * information each time.
- */
- struct TALER_Amount amount_with_fee;
-
- /**
- * Melting fee charged by the mint. This must match the Mint's
- * denomination key's melting fee. If the client puts in an invalid
- * melting fee (too high or too low) that does not match the Mint's
- * denomination key, the melting operation is invalid and will be
- * rejected by the mint. The @e amount_with_fee minus the @e
- * melt_fee is the amount that will be credited to the melting
- * session.
- */
- struct TALER_Amount melt_fee;
-
-};
-
-
-/**
- * @brief We have as many `struct TALER_MINTDB_RefreshCommitCoin` as there are new
- * coins being created by the refresh (for each of the #TALER_CNC_KAPPA
- * sets). These are the coins we ask the mint to sign if the
- * respective set is selected.
- */
-struct TALER_MINTDB_RefreshCommitCoin
-{
-
- /**
- * Encrypted data allowing those able to decrypt it to derive
- * the private keys of the new coins created by the refresh.
- */
- struct TALER_RefreshLinkEncrypted *refresh_link;
-
- /**
- * Blinded message to be signed (in envelope), with @e coin_env_size bytes.
- */
- char *coin_ev;
-
- /**
- * Number of bytes in @e coin_ev.
- */
- size_t coin_ev_size;
-
-};
-
-
-GNUNET_NETWORK_STRUCT_BEGIN
-
-/**
- * @brief For each (old) coin being melted, we have a `struct
- * RefreshCommitLinkP` that allows the user to find the shared secret
- * to decrypt the respective refresh links for the new coins in the
- * `struct TALER_MINTDB_RefreshCommitCoin`.
- */
-struct TALER_MINTDB_RefreshCommitLinkP
-{
- /**
- * Transfer public key, used to decrypt the @e shared_secret_enc
- * in combintation with the corresponding private key of the
- * coin.
- */
- struct TALER_TransferPublicKeyP transfer_pub;
-
- /**
- * Encrypted shared secret to decrypt the link.
- */
- struct TALER_EncryptedLinkSecretP shared_secret_enc;
-};
-
-GNUNET_NETWORK_STRUCT_END
-
-
-
-/**
- * @brief Linked list of refresh information linked to a coin.
- */
-struct TALER_MINTDB_LinkDataList
-{
- /**
- * Information is stored in a NULL-terminated linked list.
- */
- struct TALER_MINTDB_LinkDataList *next;
-
- /**
- * Link data, used to recover the private key of the coin
- * by the owner of the old coin.
- */
- struct TALER_RefreshLinkEncrypted *link_data_enc;
-
- /**
- * Denomination public key, determines the value of the coin.
- */
- struct TALER_DenominationPublicKey denom_pub;
-
- /**
- * Signature over the blinded envelope.
- */
- struct TALER_DenominationSignature ev_sig;
-};
-
-
-/**
- * @brief Specification for a /lock operation.
- */
-struct TALER_MINTDB_LockOperation
-{
- /**
- * Information about the coin that is being locked.
- */
- struct TALER_CoinPublicInfo coin;
-
- /**
- * Signature over the locking operation.
- */
- struct TALER_CoinSpendSignatureP coin_sig;
-
- /**
- * How much value is being locked?
- */
- struct TALER_Amount amount;
-
- // FIXME: more needed...
-};
-
-
-/**
- * @brief Enumeration to classify the different types of transactions
- * that can be done with a coin.
- */
-enum TALER_MINTDB_TransactionType
-{
- /**
- * /deposit operation.
- */
- TALER_MINTDB_TT_DEPOSIT = 0,
-
- /**
- * /refresh/melt operation.
- */
- TALER_MINTDB_TT_REFRESH_MELT = 1,
-
- /**
- * /lock operation.
- */
- TALER_MINTDB_TT_LOCK = 2
-};
-
-
-/**
- * @brief List of transactions we performed for a particular coin.
- */
-struct TALER_MINTDB_TransactionList
-{
-
- /**
- * Next pointer in the NULL-terminated linked list.
- */
- struct TALER_MINTDB_TransactionList *next;
-
- /**
- * Type of the transaction, determines what is stored in @e details.
- */
- enum TALER_MINTDB_TransactionType type;
-
- /**
- * Details about the transaction, depending on @e type.
- */
- union
- {
-
- /**
- * Details if transaction was a /deposit operation.
- */
- struct TALER_MINTDB_Deposit *deposit;
-
- /**
- * Details if transaction was a /refresh/melt operation.
- */
- struct TALER_MINTDB_RefreshMelt *melt;
-
- /**
- * Details if transaction was a /lock operation.
- */
- struct TALER_MINTDB_LockOperation *lock;
-
- } details;
-
-};
-
-
-/**
- * @brief All of the information from a /refresh/melt commitment.
- */
-struct TALER_MINTDB_MeltCommitment
-{
-
- /**
- * Number of coins we are melting.
- */
- uint16_t num_oldcoins;
-
- /**
- * Number of new coins we are creating.
- */
- uint16_t num_newcoins;
-
- /**
- * Array of @e num_oldcoins melt operation details.
- */
- struct TALER_MINTDB_RefreshMelt *melts;
-
- /**
- * Array of @e num_newcoins denomination keys
- */
- struct TALER_DenominationPublicKey *denom_pubs;
-
- /**
- * 2D-Array of #TALER_CNC_KAPPA and @e num_newcoins commitments.
- */
- struct TALER_MINTDB_RefreshCommitCoin *commit_coins[TALER_CNC_KAPPA];
-
- /**
- * 2D-Array of #TALER_CNC_KAPPA and @e new_oldcoins links.
- */
- struct TALER_MINTDB_RefreshCommitLinkP *commit_links[TALER_CNC_KAPPA];
-};
-
-
-/**
- * @brief Handle for a database session (per-thread, for transactions).
- */
-struct TALER_MINTDB_Session;
-
-
-/**
- * Function called with the session hashes and transfer secret
- * information for a given coin.
- *
- * @param cls closure
- * @param session_hash a session the coin was melted in
- * @param transfer_pub public transfer key for the session
- * @param shared_secret_enc set to shared secret for the session
- */
-typedef void
-(*TALER_MINTDB_TransferDataCallback)(void *cls,
- const struct GNUNET_HashCode *session_hash,
- const struct TALER_TransferPublicKeyP *transfer_pub,
- const struct TALER_EncryptedLinkSecretP *shared_secret_enc);
-
-
-/**
- * @brief The plugin API, returned from the plugin's "init" function.
- * The argument given to "init" is simply a configuration handle.
- */
-struct TALER_MINTDB_Plugin
-{
-
- /**
- * Closure for all callbacks.
- */
- void *cls;
-
- /**
- * Name of the library which generated this plugin. Set by the
- * plugin loader.
- */
- char *library_name;
-
- /**
- * Get the thread-local database-handle.
- * Connect to the db if the connection does not exist yet.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param temporary #GNUNET_YES to use a temporary schema; #GNUNET_NO to use the
- * database default one
- * @param the database connection, or NULL on error
- */
- struct TALER_MINTDB_Session *
- (*get_session) (void *cls,
- int temporary);
-
-
- /**
- * Drop the temporary taler schema. This is only useful for testcases.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure
- */
- int
- (*drop_temporary) (void *cls,
- struct TALER_MINTDB_Session *db);
-
-
- /**
- * Create the necessary tables if they are not present
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param temporary should we use a temporary schema
- * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure
- */
- int
- (*create_tables) (void *cls,
- int temporary);
-
-
- /**
- * Start a transaction.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param session connection to use
- * @return #GNUNET_OK on success
- */
- int
- (*start) (void *cls,
- struct TALER_MINTDB_Session *session);
-
-
- /**
- * Commit a transaction.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param sesssion connection to use
- * @return #GNUNET_OK on success
- */
- int
- (*commit) (void *cls,
- struct TALER_MINTDB_Session *sesssion);
-
-
- /**
- * Abort/rollback a transaction.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param sesssion connection to use
- */
- void
- (*rollback) (void *cls,
- struct TALER_MINTDB_Session *sesssion);
-
-
- /**
- * Insert information about a denomination key and in particular
- * the properties (value, fees, expiration times) the coins signed
- * with this key have.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param sesssion connection to use
- * @param denom_pub the public key used for signing coins of this denomination
- * @param issue issuing information with value, fees and other info about the coin
- * @return #GNUNET_OK on success; #GNUNET_SYSERR on failure
- */
- int
- (*insert_denomination_info) (void *cls,
- struct TALER_MINTDB_Session *session,
- const struct TALER_DenominationPublicKey *denom_pub,
- const struct TALER_MINTDB_DenominationKeyInformationP *issue);
-
-
- /**
- * Fetch information about a denomination key.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param sesssion connection to use
- * @param denom_pub the public key used for signing coins of this denomination
- * @param[out] issue set to issue information with value, fees and other info about the coin, can be NULL
- * @return #GNUNET_OK on success; #GNUNET_NO if no record was found, #GNUNET_SYSERR on failure
- */
- int
- (*get_denomination_info) (void *cls,
- struct TALER_MINTDB_Session *session,
- const struct TALER_DenominationPublicKey *denom_pub,
- struct TALER_MINTDB_DenominationKeyInformationP *issue);
-
-
- /**
- * Get the summary of a reserve.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param db the database connection handle
- * @param[in,out] reserve the reserve data. The public key of the reserve should be set
- * in this structure; it is used to query the database. The balance
- * and expiration are then filled accordingly.
- * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure
- */
- int
- (*reserve_get) (void *cls,
- struct TALER_MINTDB_Session *db,
- struct TALER_MINTDB_Reserve *reserve);
-
-
- /**
- * Insert a incoming transaction into reserves. New reserves are
- * also created through this function. Note that this API call
- * starts (and stops) its own transaction scope (so the application
- * must not do so).
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param db the database connection handle
- * @param reserve_pub public key of the reserve
- * @param balance the amount that has to be added to the reserve
- * @param execution_time when was the amount added
- * @param details bank transaction details justifying the increment,
- * must be unique for each incoming transaction
- * @return #GNUNET_OK upon success; #GNUNET_NO if the given
- * @a details are already known for this @a reserve_pub,
- * #GNUNET_SYSERR upon failures (DB error, incompatible currency)
- */
- int
- (*reserves_in_insert) (void *cls,
- struct TALER_MINTDB_Session *db,
- const struct TALER_ReservePublicKeyP *reserve_pub,
- const struct TALER_Amount *balance,
- struct GNUNET_TIME_Absolute execution_time,
- const json_t *details);
-
-
- /**
- * Locate the response for a /withdraw request under the
- * key of the hash of the blinded message.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param sesssion database connection to use
- * @param h_blind hash of the blinded coin to be signed (will match
- * `h_coin_envelope` in the @a collectable to be returned)
- * @param collectable corresponding collectable coin (blind signature)
- * if a coin is found
- * @return #GNUNET_SYSERR on internal error
- * #GNUNET_NO if the collectable was not found
- * #GNUNET_YES on success
- */
- int
- (*get_withdraw_info) (void *cls,
- struct TALER_MINTDB_Session *sesssion,
- const struct GNUNET_HashCode *h_blind,
- struct TALER_MINTDB_CollectableBlindcoin *collectable);
-
-
- /**
- * Store collectable bit coin under the corresponding
- * hash of the blinded message.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param sesssion database connection to use
- * @param collectable corresponding collectable coin (blind signature)
- * if a coin is found
- * @return #GNUNET_SYSERR on internal error
- * #GNUNET_NO if the collectable was not found
- * #GNUNET_YES on success
- */
- int
- (*insert_withdraw_info) (void *cls,
- struct TALER_MINTDB_Session *sesssion,
- const struct TALER_MINTDB_CollectableBlindcoin *collectable);
-
-
- /**
- * Get all of the transaction history associated with the specified
- * reserve.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param sesssion connection to use
- * @param reserve_pub public key of the reserve
- * @return known transaction history (NULL if reserve is unknown)
- */
- struct TALER_MINTDB_ReserveHistory *
- (*get_reserve_history) (void *cls,
- struct TALER_MINTDB_Session *sesssion,
- const struct TALER_ReservePublicKeyP *reserve_pub);
-
-
- /**
- * Free memory associated with the given reserve history.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param rh history to free.
- */
- void
- (*free_reserve_history) (void *cls,
- struct TALER_MINTDB_ReserveHistory *rh);
-
-
- /**
- * Check if we have the specified deposit already in the database.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param sesssion database connection
- * @param deposit deposit to search for
- * @return #GNUNET_YES if we know this operation,
- * #GNUNET_NO if this deposit is unknown to us,
- * #GNUNET_SYSERR on DB error or if same coin(pub), merchant(pub) and
- * transaction ID are already in DB, but for different
- * other transaction details (contract, wiring details,
- * amount, etc.)
- */
- int
- (*have_deposit) (void *cls,
- struct TALER_MINTDB_Session *sesssion,
- const struct TALER_MINTDB_Deposit *deposit);
-
-
- /**
- * Insert information about deposited coin into the
- * database.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param sesssion connection to the database
- * @param deposit deposit information to store
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
- */
- int
- (*insert_deposit) (void *cls,
- struct TALER_MINTDB_Session *sesssion,
- const struct TALER_MINTDB_Deposit *deposit);
-
-
- /**
- * Lookup refresh session data under the given @a session_hash.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param sesssion database handle to use
- * @param session_hash hash over the melt to use for the lookup
- * @param[out] refresh_session where to store the result
- * @return #GNUNET_YES on success,
- * #GNUNET_NO if not found,
- * #GNUNET_SYSERR on DB failure
- */
- int
- (*get_refresh_session) (void *cls,
- struct TALER_MINTDB_Session *sesssion,
- const struct GNUNET_HashCode *session_hash,
- struct TALER_MINTDB_RefreshSession *refresh_session);
-
-
- /**
- * Store new refresh session data under the given @a session_hash.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param sesssion database handle to use
- * @param session_hash hash over the melt to use to locate the session
- * @param refresh_session session data to store
- * @return #GNUNET_YES on success,
- * #GNUNET_SYSERR on DB failure
- */
- int
- (*create_refresh_session) (void *cls,
- struct TALER_MINTDB_Session *sesssion,
- const struct GNUNET_HashCode *session_hash,
- const struct TALER_MINTDB_RefreshSession *refresh_session);
-
-
- /**
- * Store the given /refresh/melt request in the database.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param sesssion database connection
- * @param oldcoin_index index of the coin to store
- * @param melt coin melt operation details to store; includes
- * the session hash of the melt
- * @return #GNUNET_OK on success
- * #GNUNET_SYSERR on internal error
- */
- int
- (*insert_refresh_melt) (void *cls,
- struct TALER_MINTDB_Session *sesssion,
- uint16_t oldcoin_index,
- const struct TALER_MINTDB_RefreshMelt *melt);
-
-
- /**
- * Get information about melted coin details from the database.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param sesssion database connection
- * @param session_hash hash to identify refresh session
- * @param oldcoin_index index of the coin to retrieve
- * @param melt melt data to fill in, can be NULL
- * @return #GNUNET_OK on success
- * #GNUNET_SYSERR on internal error
- */
- int
- (*get_refresh_melt) (void *cls,
- struct TALER_MINTDB_Session *sesssion,
- const struct GNUNET_HashCode *session_hash,
- uint16_t oldcoin_index,
- struct TALER_MINTDB_RefreshMelt *melt);
-
-
- /**
- * Store in the database which coin(s) we want to create
- * in a given refresh operation.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param sesssion database connection
- * @param session_hash hash to identify refresh session
- * @param num_newcoins number of coins to generate, size of the @a denom_pubs array
- * @param denom_pubs array denominations of the coins to create
- * @return #GNUNET_OK on success
- * #GNUNET_SYSERR on internal error
- */
- int
- (*insert_refresh_order) (void *cls,
- struct TALER_MINTDB_Session *sesssion,
- const struct GNUNET_HashCode *session_hash,
- uint16_t num_newcoins,
- const struct TALER_DenominationPublicKey *denom_pubs);
-
-
- /**
- * Lookup in the database for the @a num_newcoins coins that we want to
- * create in the given refresh operation.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param sesssion database connection
- * @param session_hash hash to identify refresh session
- * @param num_newcoins size of the @a denom_pubs array
- * @param[out] denom_pubs where to write @a num_newcoins denomination keys
- * @return #GNUNET_OK on success
- * #GNUNET_SYSERR on internal error
- */
- int
- (*get_refresh_order) (void *cls,
- struct TALER_MINTDB_Session *sesssion,
- const struct GNUNET_HashCode *session_hash,
- uint16_t num_newcoins,
- struct TALER_DenominationPublicKey *denom_pubs);
-
-
- /**
- * Store information about the commitments of the given index @a i
- * for the given refresh session in the database.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param sesssion database connection to use
- * @param session_hash hash to identify refresh session
- * @param cnc_index cut and choose index (1st dimension), relating to #TALER_CNC_KAPPA
- * @param num_newcoins coin index size of the @a commit_coins array
- * @param commit_coin array of coin commitments to store
- * @return #GNUNET_OK on success
- * #GNUNET_SYSERR on error
- */
- int
- (*insert_refresh_commit_coins) (void *cls,
- struct TALER_MINTDB_Session *sesssion,
- const struct GNUNET_HashCode *session_hash,
- uint16_t cnc_index,
- uint16_t num_newcoins,
- const struct TALER_MINTDB_RefreshCommitCoin *commit_coins);
-
-
- /**
- * Obtain information about the commitment of the
- * given coin of the given refresh session from the database.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param sesssion database connection to use
- * @param session_hash hash to identify refresh session
- * @param cnc_index cut and choose set index (1st dimension)
- * @param num_coins size of the @a commit_coins array
- * @param[out] commit_coins array of coin commitments to return
- * @return #GNUNET_OK on success
- * #GNUNET_NO if not found
- * #GNUNET_SYSERR on error
- */
- int
- (*get_refresh_commit_coins) (void *cls,
- struct TALER_MINTDB_Session *sesssion,
- const struct GNUNET_HashCode *session_hash,
- uint16_t cnc_index,
- uint16_t num_coins,
- struct TALER_MINTDB_RefreshCommitCoin *commit_coins);
-
-
- /**
- * Store the commitment to the given (encrypted) refresh link data
- * for the given refresh session.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param sesssion database connection to use
- * @param session_hash hash to identify refresh session
- * @param cnc_index cut and choose index (1st dimension), relating to #TALER_CNC_KAPPA
- * @param num_links size of the @a commit_link array
- * @param commit_links array of link information to store
- * @return #GNUNET_SYSERR on internal error, #GNUNET_OK on success
- */
- int
- (*insert_refresh_commit_links) (void *cls,
- struct TALER_MINTDB_Session *sesssion,
- const struct GNUNET_HashCode *session_hash,
- uint16_t cnc_index,
- uint16_t num_links,
- const struct TALER_MINTDB_RefreshCommitLinkP *commit_links);
-
- /**
- * Obtain the commited (encrypted) refresh link data
- * for the given refresh session.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param sesssion database connection to use
- * @param session_hash hash to identify refresh session
- * @param cnc_index cut and choose index (1st dimension)
- * @param num_links size of the @a links array to return
- * @param[out] links array link information to return
- * @return #GNUNET_SYSERR on internal error,
- * #GNUNET_NO if commitment was not found
- * #GNUNET_OK on success
- */
- int
- (*get_refresh_commit_links) (void *cls,
- struct TALER_MINTDB_Session *sesssion,
- const struct GNUNET_HashCode *session_hash,
- uint16_t cnc_index,
- uint16_t num_links,
- struct TALER_MINTDB_RefreshCommitLinkP *links);
-
-
- /**
- * Get all of the information from the given melt commit operation.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param sesssion database connection to use
- * @param session_hash hash to identify refresh session
- * @return NULL if the @a session_hash does not correspond to any known melt
- * operation
- */
- struct TALER_MINTDB_MeltCommitment *
- (*get_melt_commitment) (void *cls,
- struct TALER_MINTDB_Session *sesssion,
- const struct GNUNET_HashCode *session_hash);
-
-
- /**
- * Free information about a melt commitment.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param mc melt commitment data to free
- */
- void
- (*free_melt_commitment) (void *cls,
- struct TALER_MINTDB_MeltCommitment *mc);
-
-
- /**
- * Insert signature of a new coin generated during refresh into
- * the database indexed by the refresh session and the index
- * of the coin. This data is later used should an old coin
- * be used to try to obtain the private keys during "/refresh/link".
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param sesssion database connection
- * @param session_hash hash to identify refresh session
- * @param newcoin_index coin index
- * @param ev_sig coin signature
- * @return #GNUNET_OK on success
- */
- int
- (*insert_refresh_out) (void *cls,
- struct TALER_MINTDB_Session *sesssion,
- const struct GNUNET_HashCode *session_hash,
- uint16_t newcoin_index,
- const struct TALER_DenominationSignature *ev_sig);
-
-
- /**
- * Obtain the link data of a coin, that is the encrypted link
- * information, the denomination keys and the signatures.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param sesssion database connection
- * @param session_hash session to get linkage data for
- * @return all known link data for the session
- */
- struct TALER_MINTDB_LinkDataList *
- (*get_link_data_list) (void *cls,
- struct TALER_MINTDB_Session *sesssion,
- const struct GNUNET_HashCode *session_hash);
-
-
- /**
- * Free memory of the link data list.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param ldl link data list to release
- */
- void
- (*free_link_data_list) (void *cls,
- struct TALER_MINTDB_LinkDataList *ldl);
-
-
- /**
- * Obtain shared secret and transfer public key from the public key of
- * the coin. This information and the link information returned by
- * @e get_link_data_list() enable the owner of an old coin to determine
- * the private keys of the new coins after the melt.
- *
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param sesssion database connection
- * @param coin_pub public key of the coin
- * @param tdc function to call for each session the coin was melted into
- * @param tdc_cls closure for @a tdc
- * @return #GNUNET_OK on success,
- * #GNUNET_NO on failure (not found)
- * #GNUNET_SYSERR on internal failure (database issue)
- */
- int
- (*get_transfer) (void *cls,
- struct TALER_MINTDB_Session *sesssion,
- const struct TALER_CoinSpendPublicKeyP *coin_pub,
- TALER_MINTDB_TransferDataCallback tdc,
- void *tdc_cls);
-
-
-
- /**
- * Test if the given /lock request is known to us.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param sesssion database connection
- * @param lock lock operation
- * @return #GNUNET_YES if known,
- * #GNUNET_NO if not,
- * #GNUNET_SYSERR on internal error
- */
- int
- (*have_lock) (void *cls,
- struct TALER_MINTDB_Session *sesssion,
- const struct TALER_MINTDB_LockOperation *lock);
-
-
- /**
- * Store the given /lock request in the database.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param sesssion database connection
- * @param lock lock operation
- * @return #GNUNET_OK on success
- * #GNUNET_SYSERR on internal error
- */
- int
- (*insert_lock) (void *cls,
- struct TALER_MINTDB_Session *sesssion,
- const struct TALER_MINTDB_LockOperation *lock);
-
-
- /**
- * Compile a list of all (historic) transactions performed
- * with the given coin (/refresh/melt and /deposit operations).
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param sesssion database connection
- * @param coin_pub coin to investigate
- * @return list of transactions, NULL if coin is fresh
- */
- struct TALER_MINTDB_TransactionList *
- (*get_coin_transactions) (void *cls,
- struct TALER_MINTDB_Session *sesssion,
- const struct TALER_CoinSpendPublicKeyP *coin_pub);
-
-
- /**
- * Free linked list of transactions.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param list list to free
- */
- void
- (*free_coin_transaction_list) (void *cls,
- struct TALER_MINTDB_TransactionList *list);
-
-
-};
-
-
-#endif /* _NEURO_MINT_DB_H */
diff --git a/src/backend/taler_signatures.h b/src/backend/taler_signatures.h
deleted file mode 100644
index 402e67fe..00000000
--- a/src/backend/taler_signatures.h
+++ /dev/null
@@ -1,653 +0,0 @@
-/*
- This file is part of TALER
- Copyright (C) 2014, 2015 Christian Grothoff (and other contributing authors)
-
- TALER is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
-*/
-/**
- * @file taler_signatures.h
- * @brief message formats and signature constants used to define
- * the binary formats of signatures in Taler
- * @author Florian Dold
- * @author Benedikt Mueller
- *
- * This file should define the constants and C structs that one needs
- * to know to implement Taler clients (wallets or merchants or
- * auditor) that need to produce or verify Taler signatures.
- */
-
-#ifndef TALER_SIGNATURES_H
-#define TALER_SIGNATURES_H
-
-#if HAVE_GNUNET_GNUNET_UTIL_LIB_H
-#include <gnunet/gnunet_util_lib.h>
-#elif HAVE_GNUNET_GNUNET_UTIL_TALER_WALLET_LIB_H
-#include <gnunet/gnunet_util_taler_wallet_lib.h>
-#endif
-
-#include "taler_amount_lib.h"
-#include "taler_crypto_lib.h"
-
-/**
- * Cut-and-choose size for refreshing. Client looses the gamble (of
- * unaccountable transfers) with probability 1/TALER_CNC_KAPPA. Refresh cost
- * increases linearly with TALER_CNC_KAPPA, and 3 is sufficient up to a
- * income/sales tax of 66% of total transaction value. As there is
- * no good reason to change this security parameter, we declare it
- * fixed and part of the protocol.
- */
-#define TALER_CNC_KAPPA 3
-
-/**
- * After what time do idle reserves "expire"? We might want to make
- * this a configuration option (eventually).
- */
-#define TALER_IDLE_RESERVE_EXPIRATION_TIME GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS, 5)
-
-/*********************************************/
-/* Mint offline signatures (with master key) */
-/*********************************************/
-
-/**
- * Purpose for signing public keys signed by the mint master key.
- */
-#define TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY 1024
-
-/**
- * Purpose for denomination keys signed by the mint master key.
- */
-#define TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY 1025
-
-
-/*********************************************/
-/* Mint online signatures (with signing key) */
-/*********************************************/
-
-/**
- * Purpose for the state of a reserve, signed by the mint's signing
- * key.
- */
-#define TALER_SIGNATURE_MINT_RESERVE_STATUS 1032
-
-/**
- * Signature where the Mint confirms a deposit request.
- */
-#define TALER_SIGNATURE_MINT_CONFIRM_DEPOSIT 1033
-
-/**
- * Signature where the mint (current signing key) confirms the
- * no-reveal index for cut-and-choose and the validity of the melted
- * coins.
- */
-#define TALER_SIGNATURE_MINT_CONFIRM_MELT 1034
-
-/**
- * Signature where the Mint confirms the full /keys response set.
- */
-#define TALER_SIGNATURE_MINT_KEY_SET 1035
-
-
-/*********************/
-/* Wallet signatures */
-/*********************/
-
-/**
- * Signature where the auditor confirms that he is
- * aware of certain denomination keys from the mint.
- */
-#define TALER_SIGNATURE_AUDITOR_MINT_KEYS 1064
-
-
-/***********************/
-/* Merchant signatures */
-/***********************/
-
-/**
- * Signature where the merchant confirms a contract (to the customer).
- */
-#define TALER_SIGNATURE_MERCHANT_CONTRACT 1101
-
-/**
- * Signature where the merchant confirms a refund (of a coin).
- */
-#define TALER_SIGNATURE_MERCHANT_REFUND 1102
-
-
-/*********************/
-/* Wallet signatures */
-/*********************/
-
-/**
- * Signature where the reserve key confirms a withdraw request.
- */
-#define TALER_SIGNATURE_WALLET_RESERVE_WITHDRAW 1200
-
-/**
- * Signature made by the wallet of a user to confirm a deposit of a coin.
- */
-#define TALER_SIGNATURE_WALLET_COIN_DEPOSIT 1201
-
-/**
- * Signature using a coin key confirming the melting of a coin.
- */
-#define TALER_SIGNATURE_WALLET_COIN_MELT 1202
-
-
-/*******************/
-/* Test signatures */
-/*******************/
-
-/**
- * EdDSA test signature.
- */
-#define TALER_SIGNATURE_CLIENT_TEST_EDDSA 1302
-
-/**
- * EdDSA test signature.
- */
-#define TALER_SIGNATURE_MINT_TEST_EDDSA 1303
-
-
-
-GNUNET_NETWORK_STRUCT_BEGIN
-
-/**
- * @brief Format used for to generate the signature on a request to withdraw
- * coins from a reserve.
- */
-struct TALER_WithdrawRequestPS
-{
-
- /**
- * Purpose must be #TALER_SIGNATURE_WALLET_RESERVE_WITHDRAW.
- * Used with an EdDSA signature of a `struct TALER_ReservePublicKeyP`.
- */
- struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
-
- /**
- * Reserve public key (which reserve to withdraw from). This is
- * the public key which must match the signature.
- */
- struct TALER_ReservePublicKeyP reserve_pub;
-
- /**
- * Value of the coin being minted (matching the denomination key)
- * plus the transaction fee. We include this in what is being
- * signed so that we can verify a reserve's remaining total balance
- * without needing to access the respective denomination key
- * information each time.
- */
- struct TALER_AmountNBO amount_with_fee;
-
- /**
- * Withdrawl fee charged by the mint. This must match the Mint's
- * denomination key's withdrawl fee. If the client puts in an
- * invalid withdrawl fee (too high or too low) that does not match
- * the Mint's denomination key, the withdraw operation is invalid
- * and will be rejected by the mint. The @e amount_with_fee minus
- * the @e withdraw_fee is must match the value of the generated
- * coin. We include this in what is being signed so that we can
- * verify a mint's accounting without needing to access the
- * respective denomination key information each time.
- */
- struct TALER_AmountNBO withdraw_fee;
-
- /**
- * Hash of the denomination public key for the coin that is withdrawn.
- */
- struct GNUNET_HashCode h_denomination_pub;
-
- /**
- * Hash of the (blinded) message to be signed by the Mint.
- */
- struct GNUNET_HashCode h_coin_envelope;
-};
-
-
-/**
- * @brief Format used to generate the signature on a request to deposit
- * a coin into the account of a merchant.
- */
-struct TALER_DepositRequestPS
-{
- /**
- * Purpose must be #TALER_SIGNATURE_WALLET_COIN_DEPOSIT.
- * Used for an EdDSA signature with the `struct TALER_CoinSpendPublicKeyP`.
- */
- struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
-
- /**
- * Hash over the contract for which this deposit is made.
- */
- struct GNUNET_HashCode h_contract;
-
- /**
- * Hash over the wiring information of the merchant.
- */
- struct GNUNET_HashCode h_wire;
-
- /**
- * Time when this request was generated. Used, for example, to
- * assess when (roughly) the income was achieved for tax purposes.
- * Note that the Mint will only check that the timestamp is not "too
- * far" into the future (i.e. several days). The fact that the
- * timestamp falls within the validity period of the coin's
- * denomination key is irrelevant for the validity of the deposit
- * request, as obviously the customer and merchant could conspire to
- * set any timestamp. Also, the Mint must accept very old deposit
- * requests, as the merchant might have been unable to transmit the
- * deposit request in a timely fashion (so back-dating is not
- * prevented).
- */
- struct GNUNET_TIME_AbsoluteNBO timestamp;
-
- /**
- * How much time does the merchant have to issue a refund request?
- * Zero if refunds are not allowed. After this time, the coin
- * cannot be refunded.
- */
- struct GNUNET_TIME_AbsoluteNBO refund_deadline;
-
- /**
- * Merchant-generated transaction ID to detect duplicate
- * transactions. The merchant must communicate a merchant-unique ID
- * to the customer for each transaction. Note that different coins
- * that are part of the same transaction can use the same
- * transaction ID. The transaction ID is useful for later disputes,
- * and the merchant's contract offer (@e h_contract) with the
- * customer should include the offer's term and transaction ID
- * signed with a key from the merchant.
- */
- uint64_t transaction_id GNUNET_PACKED;
-
- /**
- * Amount to be deposited, including deposit fee charged by the
- * mint. This is the total amount that the coin's value at the mint
- * will be reduced by.
- */
- struct TALER_AmountNBO amount_with_fee;
-
- /**
- * Depositing fee charged by the mint. This must match the Mint's
- * denomination key's depositing fee. If the client puts in an
- * invalid deposit fee (too high or too low) that does not match the
- * Mint's denomination key, the deposit operation is invalid and
- * will be rejected by the mint. The @e amount_with_fee minus the
- * @e deposit_fee is the amount that will be transferred to the
- * account identified by @e h_wire.
- */
- struct TALER_AmountNBO deposit_fee;
-
- /**
- * The Merchant's public key. Allows the merchant to later refund
- * the transaction. All zeros if nobody is allowed to refund the
- * transaction later.
- */
- struct TALER_MerchantPublicKeyP merchant;
-
- /**
- * The coin's public key. This is the value that must have been
- * signed (blindly) by the Mint. The deposit request is to be
- * signed by the corresponding private key (using EdDSA).
- */
- struct TALER_CoinSpendPublicKeyP coin_pub;
-
-};
-
-
-/**
- * @brief Format used to generate the signature on a confirmation
- * from the mint that a deposit request succeeded.
- */
-struct TALER_DepositConfirmationPS
-{
- /**
- * Purpose must be #TALER_SIGNATURE_MINT_CONFIRM_DEPOSIT. Signed
- * by a `struct TALER_MintPublicKeyP` using EdDSA.
- */
- struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
-
- /**
- * Hash over the contract for which this deposit is made.
- */
- struct GNUNET_HashCode h_contract;
-
- /**
- * Hash over the wiring information of the merchant.
- */
- struct GNUNET_HashCode h_wire;
-
- /**
- * Merchant-generated transaction ID to detect duplicate
- * transactions.
- */
- uint64_t transaction_id GNUNET_PACKED;
-
- /**
- * Time when this confirmation was generated.
- */
- struct GNUNET_TIME_AbsoluteNBO timestamp;
-
- /**
- * How much time does the @e merchant have to issue a refund
- * request? Zero if refunds are not allowed. After this time, the
- * coin cannot be refunded. Note that the wire transfer will not be
- * performed by the mint until the refund deadline. This value
- * is taken from the original deposit request.
- */
- struct GNUNET_TIME_AbsoluteNBO refund_deadline;
-
- /**
- * Amount to be deposited, excluding fee. Calculated from the
- * amount with fee and the fee from the deposit request.
- */
- struct TALER_AmountNBO amount_without_fee;
-
- /**
- * The coin's public key. This is the value that must have been
- * signed (blindly) by the Mint. The deposit request is to be
- * signed by the corresponding private key (using EdDSA).
- */
- struct TALER_CoinSpendPublicKeyP coin_pub;
-
- /**
- * The Merchant's public key. Allows the merchant to later refund
- * the transaction. All zeros if nobody is allowed to refund the
- * transaction later.
- */
- struct TALER_MerchantPublicKeyP merchant;
-
-};
-
-
-/**
- * @brief Message signed by a coin to indicate that the coin should be
- * melted.
- */
-struct TALER_RefreshMeltCoinAffirmationPS
-{
- /**
- * Purpose is #TALER_SIGNATURE_WALLET_COIN_MELT.
- * Used for an EdDSA signature with the `struct TALER_CoinSpendPublicKeyP`.
- */
- struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
-
- /**
- * Which melting session should the coin become a part of.
- */
- struct GNUNET_HashCode session_hash;
-
- /**
- * How much of the value of the coin should be melted? This amount
- * includes the fees, so the final amount contributed to the melt is
- * this value minus the fee for melting the coin. We include the
- * fee in what is being signed so that we can verify a reserve's
- * remaining total balance without needing to access the respective
- * denomination key information each time.
- */
- struct TALER_AmountNBO amount_with_fee;
-
- /**
- * Melting fee charged by the mint. This must match the Mint's
- * denomination key's melting fee. If the client puts in an invalid
- * melting fee (too high or too low) that does not match the Mint's
- * denomination key, the melting operation is invalid and will be
- * rejected by the mint. The @e amount_with_fee minus the @e
- * melt_fee is the amount that will be credited to the melting
- * session.
- */
- struct TALER_AmountNBO melt_fee;
-
- /**
- * The coin's public key. This is the value that must have been
- * signed (blindly) by the Mint. The deposit request is to be
- * signed by the corresponding private key (using EdDSA).
- */
- struct TALER_CoinSpendPublicKeyP coin_pub;
-};
-
-
-/**
- * @brief Format of the block signed by the Mint in response to a successful
- * "/refresh/melt" request. Hereby the mint affirms that all of the
- * coins were successfully melted. This also commits the mint to a
- * particular index to not be revealed during the refresh.
- */
-struct TALER_RefreshMeltConfirmationPS
-{
- /**
- * Purpose is #TALER_SIGNATURE_MINT_CONFIRM_MELT. Signed
- * by a `struct TALER_MintPublicKeyP` using EdDSA.
- */
- struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
-
- /**
- * Hash of the refresh session.
- */
- struct GNUNET_HashCode session_hash;
-
- /**
- * Index that the client will not have to reveal, in NBO.
- * Must be smaller than #TALER_CNC_KAPPA.
- */
- uint16_t noreveal_index GNUNET_PACKED;
-};
-
-
-/**
- * @brief Information about a signing key of the mint. Signing keys are used
- * to sign mint messages other than coins, i.e. to confirm that a
- * deposit was successful or that a refresh was accepted.
- */
-struct TALER_MintSigningKeyValidityPS
-{
- /**
- * Signature over the signing key (by the master key of the mint).
- *
- * FIXME: should be moved outside of the "PS" struct, this is ugly.
- * (and makes this struct different from all of the others)
- */
- struct TALER_MasterSignatureP signature;
-
- /**
- * Purpose is #TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY.
- */
- struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
-
- /**
- * Master public key of the mint corresponding to @e signature.
- * This is the long-term offline master key of the mint.
- */
- struct TALER_MasterPublicKeyP master_public_key;
-
- /**
- * When does this signing key begin to be valid?
- */
- struct GNUNET_TIME_AbsoluteNBO start;
-
- /**
- * When does this signing key expire? Note: This is currently when
- * the Mint will definitively stop using it. Signatures made with
- * the key remain valid until @e end. When checking validity periods,
- * clients should allow for some overlap between keys and tolerate
- * the use of either key during the overlap time (due to the
- * possibility of clock skew).
- */
- struct GNUNET_TIME_AbsoluteNBO expire;
-
- /**
- * When do signatures with this signing key become invalid? After
- * this point, these signatures cannot be used in (legal) disputes
- * anymore, as the Mint is then allowed to destroy its side of the
- * evidence. @e end is expected to be significantly larger than @e
- * expire (by a year or more).
- */
- struct GNUNET_TIME_AbsoluteNBO end;
-
- /**
- * The public online signing key that the mint will use
- * between @e start and @e expire.
- */
- struct TALER_MintPublicKeyP signkey_pub;
-};
-
-
-/**
- * @brief Signature made by the mint over the full set of keys, used
- * to detect cheating mints that give out different sets to
- * different users.
- */
-struct TALER_MintKeySetPS
-{
-
- /**
- * Purpose is #TALER_SIGNATURE_MINT_KEY_SET. Signed
- * by a `struct TALER_MintPublicKeyP` using EdDSA.
- */
- struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
-
- /**
- * Time of the key set issue.
- */
- struct GNUNET_TIME_AbsoluteNBO list_issue_date;
-
- /**
- * Hash over the various denomination signing keys returned.
- */
- struct GNUNET_HashCode hc;
-};
-
-
-/**
- * @brief Information about a denomination key. Denomination keys
- * are used to sign coins of a certain value into existence.
- */
-struct TALER_DenominationKeyValidityPS
-{
-
- /**
- * Purpose is #TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY.
- */
- struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
-
- /**
- * The long-term offline master key of the mint that was
- * used to create @e signature.
- */
- struct TALER_MasterPublicKeyP master;
-
- /**
- * Start time of the validity period for this key.
- */
- struct GNUNET_TIME_AbsoluteNBO start;
-
- /**
- * The mint will sign fresh coins between @e start and this time.
- * @e expire_withdraw will be somewhat larger than @e start to
- * ensure a sufficiently large anonymity set, while also allowing
- * the Mint to limit the financial damage in case of a key being
- * compromised. Thus, mints with low volume are expected to have a
- * longer withdraw period (@e expire_withdraw - @e start) than mints
- * with high transaction volume. The period may also differ between
- * types of coins. A mint may also have a few denomination keys
- * with the same value with overlapping validity periods, to address
- * issues such as clock skew.
- */
- struct GNUNET_TIME_AbsoluteNBO expire_withdraw;
-
- /**
- * Coins signed with the denomination key must be spent or refreshed
- * between @e start and this expiration time. After this time, the
- * mint will refuse transactions involving this key as it will
- * "drop" the table with double-spending information (shortly after)
- * this time. Note that wallets should refresh coins significantly
- * before this time to be on the safe side. @e expire_spend must be
- * significantly larger than @e expire_withdraw (by months or even
- * years).
- */
- struct GNUNET_TIME_AbsoluteNBO expire_spend;
-
- /**
- * When do signatures with this denomination key become invalid?
- * After this point, these signatures cannot be used in (legal)
- * disputes anymore, as the Mint is then allowed to destroy its side
- * of the evidence. @e expire_legal is expected to be significantly
- * larger than @e expire_spend (by a year or more).
- */
- struct GNUNET_TIME_AbsoluteNBO expire_legal;
-
- /**
- * The value of the coins signed with this denomination key.
- */
- struct TALER_AmountNBO value;
-
- /**
- * The fee the mint charges when a coin of this type is withdrawn.
- * (can be zero).
- */
- struct TALER_AmountNBO fee_withdraw;
-
- /**
- * The fee the mint charges when a coin of this type is deposited.
- * (can be zero).
- */
- struct TALER_AmountNBO fee_deposit;
-
- /**
- * The fee the mint charges when a coin of this type is refreshed.
- * (can be zero).
- */
- struct TALER_AmountNBO fee_refresh;
-
- /**
- * Hash code of the denomination public key. (Used to avoid having
- * the variable-size RSA key in this struct.)
- */
- struct GNUNET_HashCode denom_hash;
-
-};
-
-
-/**
- * @brief Information signed by an auditor affirming
- * the master public key and the denomination keys
- * of a mint.
- */
-struct TALER_MintKeyValidityPS
-{
-
- /**
- * Purpose is #TALER_SIGNATURE_AUDITOR_MINT_KEYS.
- */
- struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
-
- /**
- * The long-term offline master key of the mint, affirmed by the
- * auditor.
- */
- struct TALER_MasterPublicKeyP master;
-
- /**
- * Array of hash(es) of the mint's denomination keys.
- * Specifically, this is the hash over the
- * `struct TALER_DenominationKeyValidityPS`, not just
- * the public key (as the auditor needs to check against
- * the correct valuations and fee structure).
- */
- /* struct GNUNET_HashCode h_dks; */
-
-};
-
-
-GNUNET_NETWORK_STRUCT_END
-
-#endif
diff --git a/src/backend/taler_util.h b/src/backend/taler_util.h
deleted file mode 100644
index 00397cc8..00000000
--- a/src/backend/taler_util.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- This file is part of TALER
- Copyright (C) 2014, 2015 Christian Grothoff (and other contributing authors)
-
- TALER is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
-*/
-/**
- * @file include/taler_util.h
- * @brief Interface for common utility functions
- * @author Sree Harsha Totakura <sreeharsha@totakura.in>
- */
-#ifndef TALER_UTIL_H
-#define TALER_UTIL_H
-
-#include <gnunet/gnunet_util_lib.h>
-#include "taler_amount_lib.h"
-#include "taler_crypto_lib.h"
-#include "taler_json_lib.h"
-
-
-
-/* Define logging functions */
-#define TALER_LOG_DEBUG(...) \
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__)
-
-#define TALER_LOG_WARNING(...) \
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, __VA_ARGS__)
-
-#define TALER_LOG_ERROR(...) \
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, __VA_ARGS__)
-
-
-/**
- * Tests a given as assertion and if failed prints it as a warning with the
- * given reason
- *
- * @param EXP the expression to test as assertion
- * @param reason string to print as warning
- */
-#define TALER_assert_as(EXP, reason) \
- do { \
- if (EXP) break; \
- TALER_LOG_ERROR("%s at %s:%d\n", reason, __FILE__, __LINE__); \
- abort(); \
- } while(0)
-
-
-/**
- * Log an error message at log-level 'level' that indicates
- * a failure of the command 'cmd' with the message given
- * by gcry_strerror(rc).
- */
-#define TALER_LOG_GCRY_ERROR(cmd, rc) do { TALER_LOG_ERROR("`%s' failed at %s:%d with error: %s\n", cmd, __FILE__, __LINE__, gcry_strerror(rc)); } while(0)
-
-
-#define TALER_gcry_ok(cmd) \
- do {int rc; rc = cmd; if (!rc) break; TALER_LOG_ERROR("A Gcrypt call failed at %s:%d with error: %s\n", __FILE__, __LINE__, gcry_strerror(rc)); abort(); } while (0)
-
-
-/**
- * Initialize Gcrypt library.
- */
-void
-TALER_gcrypt_init (void);
-
-
-/**
- * Round a time value so that it is suitable for transmission
- * via JSON encodings.
- *
- * @param at time to round
- * @return #GNUNET_OK if time was already rounded, #GNUNET_NO if
- * it was just now rounded
- */
-int
-TALER_round_abs_time (struct GNUNET_TIME_Absolute *at);
-
-
-/**
- * Round a time value so that it is suitable for transmission
- * via JSON encodings.
- *
- * @param rt time to round
- * @return #GNUNET_OK if time was already rounded, #GNUNET_NO if
- * it was just now rounded
- */
-int
-TALER_round_rel_time (struct GNUNET_TIME_Relative *rt);
-
-
-/**
- * Load configuration by parsing all configuration
- * files in the given directory.
- *
- * @param base_dir directory with the configuration files
- * @return NULL on error, otherwise configuration
- */
-struct GNUNET_CONFIGURATION_Handle *
-TALER_config_load (const char *base_dir);
-
-
-/**
- * Obtain denomination amount from configuration file.
- *
- * @param section section of the configuration to access
- * @param option option of the configuration to access
- * @param[out] denom set to the amount found in configuration
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
- */
-int
-TALER_config_get_denom (struct GNUNET_CONFIGURATION_Handle *cfg,
- const char *section,
- const char *option,
- struct TALER_Amount *denom);
-
-
-/**
- * Get the path to a specific Taler installation directory or, with
- * #GNUNET_OS_IPK_SELF_PREFIX, the current running apps installation
- * directory.
- *
- * @param dirkind what kind of directory is desired?
- * @return a pointer to the dir path (to be freed by the caller)
- */
-char *
-TALER_OS_installation_get_path (enum GNUNET_OS_InstallationPathKind dirkind);
-
-
-/**
- * Print out details on command line options (implements --help).
- *
- * @param ctx command line processing context
- * @param scls additional closure (points to about text)
- * @param option name of the option
- * @param value not used (NULL)
- * @return #GNUNET_NO (do not continue, not an error)
- */
-int
-TALER_GETOPT_format_help_ (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
- void *scls,
- const char *option,
- const char *value);
-
-/**
- * Macro defining the option to print the command line
- * help text (-h option).
- *
- * @param about string with brief description of the application
- */
-#define TALER_GETOPT_OPTION_HELP(about) \
- { 'h', "help", (const char *) NULL, gettext_noop("print this help"), 0, &TALER_GETOPT_format_help_, (void *) about }
-
-#endif