aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/taler_crypto_lib.h82
-rw-r--r--src/include/taler_error_codes.h142
-rw-r--r--src/include/taler_exchange_service.h8
-rw-r--r--src/include/taler_exchangedb_plugin.h372
-rw-r--r--src/include/taler_signatures.h14
5 files changed, 260 insertions, 358 deletions
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
index d5024e6c8..d45e7bb28 100644
--- a/src/include/taler_crypto_lib.h
+++ b/src/include/taler_crypto_lib.h
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2014, 2015 GNUnet e.V.
+ Copyright (C) 2014, 2015, 2016, 2017 Taler Systems SA
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
@@ -289,6 +289,19 @@ struct TALER_DenominationBlindingKeyP
};
+/**
+ * Commitment value for the refresh protocol.
+ * See #TALER_refresh_get_commitment().
+ */
+struct TALER_RefreshCommitmentP
+{
+ /**
+ * The commitment is a hash code.
+ */
+ struct GNUNET_HashCode session_hash;
+};
+
+
GNUNET_NETWORK_STRUCT_END
@@ -557,12 +570,12 @@ GNUNET_NETWORK_STRUCT_END
*
* @param secret_seed seed to use for KDF to derive coin keys
* @param coin_num_salt number of the coin to include in KDF
- * @param[out] fc value to initialize
+ * @param[out] ps value to initialize
*/
void
TALER_planchet_setup_refresh (const struct TALER_TransferSecretP *secret_seed,
- unsigned int coin_num_salt,
- struct TALER_PlanchetSecretsP *fc);
+ uint32_t coin_num_salt,
+ struct TALER_PlanchetSecretsP *ps);
/**
@@ -656,4 +669,65 @@ TALER_link_recover_transfer_secret (const struct TALER_TransferPublicKeyP *trans
struct TALER_TransferSecretP *transfer_secret);
+/**
+ * Information about a coin to be created during a refresh operation.
+ */
+struct TALER_RefreshCoinData
+{
+
+ /**
+ * The denomination's public key.
+ */
+ const struct TALER_DenominationPublicKey *dk;
+
+ /**
+ * The envelope with the blinded coin.
+ */
+ char *coin_ev;
+
+ /**
+ * Number of bytes in @a coin_ev
+ */
+ size_t coin_ev_size;
+
+};
+
+
+/**
+ * One of the #TALER_CNC_KAPPA commitments.
+ */
+struct TALER_RefreshCommitmentEntry
+{
+ /**
+ * Transfer public key of this commitment.
+ */
+ struct TALER_TransferPublicKeyP transfer_pub;
+
+ /**
+ * Array of @e num_new_coins new coins to be created.
+ */
+ struct TALER_RefreshCoinData *new_coins;
+};
+
+
+/**
+ * Compute the commitment for a /refresh/melt operation from
+ * the respective public inputs.
+ *
+ * @param[out] rc set to the value the wallet must commit to
+ * @param kappa number of transfer public keys involved (must be #TALER_CNC_KAPPA)
+ * @param num_new_coins number of new coins to be created
+ * @param commitments array of @a kappa commitments
+ * @param coin_pub public key of the coin to be melted
+ * @param amount_with_fee amount to be melted, including fee
+ */
+void
+TALER_refresh_get_commitment (struct TALER_RefreshCommitmentP *rc,
+ uint32_t kappa,
+ uint32_t num_new_coins,
+ const struct TALER_RefreshCommitmentEntry *rcs,
+ const struct TALER_CoinSpendPublicKeyP *coin_pub,
+ const struct TALER_Amount *amount_with_fee);
+
+
#endif
diff --git a/src/include/taler_error_codes.h b/src/include/taler_error_codes.h
index acc7228b1..6047e1643 100644
--- a/src/include/taler_error_codes.h
+++ b/src/include/taler_error_codes.h
@@ -68,6 +68,11 @@ enum TALER_ErrorCode
*/
TALER_EC_TIMEOUT = 6,
+ /**
+ * Exchange failed to allocate memory for building JSON reply.
+ */
+ TALER_EC_JSON_ALLOCATION_FAILURE = 7,
+
/* ********** generic error codes ************* */
/**
@@ -428,6 +433,7 @@ enum TALER_ErrorCode
*/
TALER_EC_DEPOSIT_INVALID_TIMESTAMP = 1218,
+
/**
* The respective coin did not have sufficient residual value
* for the /refresh/melt operation. The "history" in this
@@ -469,85 +475,25 @@ enum TALER_ErrorCode
TALER_EC_REFRESH_MELT_DB_STORE_SESSION_ERROR = 1304,
/**
- * The exchange failed to store commit data in the
- * database.
- * This response is provided with HTTP status code
- * MHD_HTTP_INTERNAL_ERROR.
- */
- TALER_EC_REFRESH_MELT_DB_STORE_COMMIT_ERROR = 1306,
-
- /**
- * The exchange is unaware of the denomination key that was
- * requested for one of the fresh coins. This response is provided
- * with HTTP status code MHD_HTTP_BAD_REQUEST.
- */
- TALER_EC_REFRESH_MELT_FRESH_DENOMINATION_KEY_NOT_FOUND = 1308,
-
- /**
- * The exchange encountered a numeric overflow totaling up
- * the cost for the refresh operation. This response is provided
- * with HTTP status code MHD_HTTP_INTERNAL_SERVER_ERROR.
- */
- TALER_EC_REFRESH_MELT_COST_CALCULATION_OVERFLOW = 1309,
-
- /**
- * During the transaction phase, the exchange could suddenly
- * no longer find the denomination key that was
- * used to sign the melted coin. This response is provided
- * with HTTP status code MHD_HTTP_INTERNAL_SERVER_ERROR.
- */
- TALER_EC_REFRESH_MELT_DB_DENOMINATION_KEY_NOT_FOUND = 1310,
-
- /**
* The exchange encountered melt fees exceeding the melted
* coin's contribution. This response is provided
* with HTTP status code MHD_HTTP_BAD_REQUEST.
*/
- TALER_EC_REFRESH_MELT_FEES_EXCEED_CONTRIBUTION = 1311,
-
- /**
- * The exchange's cost calculation does not add up to the
- * melt fees specified in the request. This response is provided
- * with HTTP status code MHD_HTTP_BAD_REQUEST.
- */
- TALER_EC_REFRESH_MELT_FEES_MISSMATCH = 1312,
+ TALER_EC_REFRESH_MELT_FEES_EXCEED_CONTRIBUTION = 1305,
/**
* The denomination key signature on the melted coin is invalid.
* This response is provided with HTTP status code
* MHD_HTTP_BAD_REQUEST.
*/
- TALER_EC_REFRESH_MELT_DENOMINATION_SIGNATURE_INVALID = 1313,
-
- /**
- * The exchange's cost calculation shows that the melt amount
- * is below the costs of the transaction. This response is provided
- * with HTTP status code MHD_HTTP_BAD_REQUEST.
- */
- TALER_EC_REFRESH_MELT_AMOUNT_INSUFFICIENT = 1314,
+ TALER_EC_REFRESH_MELT_DENOMINATION_SIGNATURE_INVALID = 1306,
/**
* The signature made with the coin to be melted is invalid.
* This response is provided with HTTP status code
* MHD_HTTP_BAD_REQUEST.
*/
- TALER_EC_REFRESH_MELT_COIN_SIGNATURE_INVALID = 1315,
-
- /**
- * The size of the cut-and-choose dimension of the
- * blinded coins request does not match #TALER_CNC_KAPPA.
- * This response is provided with HTTP status code
- * MHD_HTTP_BAD_REQUEST.
- */
- TALER_EC_REFRESH_MELT_CNC_COIN_ARRAY_SIZE_INVALID = 1316,
-
- /**
- * The size of the cut-and-choose dimension of the
- * transfer keys request does not match #TALER_CNC_KAPPA.
- * This response is provided with HTTP status code
- * MHD_HTTP_BAD_REQUEST.
- */
- TALER_EC_REFRESH_MELT_CNC_TRANSFER_ARRAY_SIZE_INVALID = 1317,
+ TALER_EC_REFRESH_MELT_COIN_SIGNATURE_INVALID = 1307,
/**
* The exchange failed to obtain the transaction history of the
@@ -556,7 +502,8 @@ enum TALER_ErrorCode
* This response is provided with HTTP status code
* MHD_HTTP_INTERNAL_SERVER_ERROR.
*/
- TALER_EC_REFRESH_MELT_HISTORY_DB_ERROR_INSUFFICIENT_FUNDS = 1318,
+ TALER_EC_REFRESH_MELT_HISTORY_DB_ERROR_INSUFFICIENT_FUNDS = 1308,
+
/**
* The provided transfer keys do not match up with the
@@ -567,20 +514,12 @@ enum TALER_ErrorCode
TALER_EC_REFRESH_REVEAL_COMMITMENT_VIOLATION = 1350,
/**
- * Failed to blind the envelope to reconstruct the blinded
- * coins for revealation checks.
- * This response is provided with HTTP status code
- * MHD_HTTP_INTERNAL_ERROR.
- */
- TALER_EC_REFRESH_REVEAL_BLINDING_ERROR = 1351,
-
- /**
* Failed to produce the blinded signatures over the coins
* to be returned.
* This response is provided with HTTP status code
* MHD_HTTP_INTERNAL_ERROR.
*/
- TALER_EC_REFRESH_REVEAL_SIGNING_ERROR = 1352,
+ TALER_EC_REFRESH_REVEAL_SIGNING_ERROR = 1351,
/**
* The exchange is unaware of the refresh sessino specified in
@@ -588,7 +527,7 @@ enum TALER_ErrorCode
* This response is provided with HTTP status code
* MHD_HTTP_BAD_REQUEST.
*/
- TALER_EC_REFRESH_REVEAL_SESSION_UNKNOWN = 1353,
+ TALER_EC_REFRESH_REVEAL_SESSION_UNKNOWN = 1352,
/**
* The exchange failed to retrieve valid session data from the
@@ -596,39 +535,68 @@ enum TALER_ErrorCode
* This response is provided with HTTP status code
* MHD_HTTP_INTERNAL_ERROR.
*/
- TALER_EC_REFRESH_REVEAL_DB_FETCH_SESSION_ERROR = 1354,
+ TALER_EC_REFRESH_REVEAL_DB_FETCH_SESSION_ERROR = 1353,
/**
- * The exchange failed to retrieve order data from the
- * database.
- * This response is provided with HTTP status code
+ * The exchange failed to retrieve previously revealed data from the
+ * database. This response is provided with HTTP status code
* MHD_HTTP_INTERNAL_ERROR.
*/
- TALER_EC_REFRESH_REVEAL_DB_FETCH_ORDER_ERROR = 1355,
+ TALER_EC_REFRESH_REVEAL_DB_FETCH_REVEAL_ERROR = 1354,
/**
- * The exchange failed to retrieve transfer keys from the
+ * The exchange failed to retrieve commitment data from the
* database.
* This response is provided with HTTP status code
* MHD_HTTP_INTERNAL_ERROR.
*/
- TALER_EC_REFRESH_REVEAL_DB_FETCH_TRANSFER_ERROR = 1356,
+ TALER_EC_REFRESH_REVEAL_DB_COMMIT_ERROR = 1355,
/**
- * The exchange failed to retrieve commitment data from the
- * database.
+ * The size of the cut-and-choose dimension of the
+ * private transfer keys request does not match #TALER_CNC_KAPPA - 1.
* This response is provided with HTTP status code
- * MHD_HTTP_INTERNAL_ERROR.
+ * MHD_HTTP_BAD_REQUEST.
*/
- TALER_EC_REFRESH_REVEAL_DB_FETCH_COMMIT_ERROR = 1357,
+ TALER_EC_REFRESH_REVEAL_CNC_TRANSFER_ARRAY_SIZE_INVALID = 1356,
/**
- * The size of the cut-and-choose dimension of the
+ * The number of coins to be created in refresh exceeds the limits
+ * of the exchange.
* private transfer keys request does not match #TALER_CNC_KAPPA - 1.
* This response is provided with HTTP status code
* MHD_HTTP_BAD_REQUEST.
*/
- TALER_EC_REFRESH_REVEAL_CNC_TRANSFER_ARRAY_SIZE_INVALID = 1358,
+ TALER_EC_REFRESH_REVEAL_NEW_DENOMS_ARRAY_SIZE_EXCESSIVE = 1357,
+
+ /**
+ * The number of envelopes given does not match the number
+ * of denomination keys given.
+ * This response is provided with HTTP status code
+ * MHD_HTTP_BAD_REQUEST.
+ */
+ TALER_EC_REFRESH_REVEAL_NEW_DENOMS_ARRAY_SIZE_MISSMATCH = 1358,
+
+ /**
+ * The exchange encountered a numeric overflow totaling up
+ * the cost for the refresh operation. This response is provided
+ * with HTTP status code MHD_HTTP_INTERNAL_SERVER_ERROR.
+ */
+ TALER_EC_REFRESH_REVEAL_COST_CALCULATION_OVERFLOW = 1359,
+
+ /**
+ * The exchange's cost calculation shows that the melt amount
+ * is below the costs of the transaction. This response is provided
+ * with HTTP status code MHD_HTTP_BAD_REQUEST.
+ */
+ TALER_EC_REFRESH_REVEAL_AMOUNT_INSUFFICIENT = 1360,
+
+ /**
+ * The exchange is unaware of the denomination key that was
+ * requested for one of the fresh coins. This response is provided
+ * with HTTP status code MHD_HTTP_BAD_REQUEST.
+ */
+ TALER_EC_REFRESH_REVEAL_FRESH_DENOMINATION_KEY_NOT_FOUND = 1361,
/**
diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h
index fadcbf8b2..7e9ad914d 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2014-2017 GNUnet e.V.
+ Copyright (C) 2014-2017 Taler Systems SA
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
@@ -1110,7 +1110,7 @@ struct TALER_EXCHANGE_RefreshMeltHandle;
* 0 if the exchange's reply is bogus (fails to follow the protocol)
* @param ec taler-specific error code, #TALER_EC_NONE on success
* @param noreveal_index choice by the exchange in the cut-and-choose protocol,
- * UINT16_MAX on error
+ * UINT32_MAX on error
* @param sign_key exchange key used to sign @a full_response, or NULL
* @param full_response full response from the exchange (for logging, in case of errors)
*/
@@ -1118,7 +1118,7 @@ typedef void
(*TALER_EXCHANGE_RefreshMeltCallback) (void *cls,
unsigned int http_status,
enum TALER_ErrorCode ec,
- uint16_t noreveal_index,
+ uint32_t noreveal_index,
const struct TALER_ExchangePublicKeyP *sign_key,
const json_t *full_response);
@@ -1223,7 +1223,7 @@ struct TALER_EXCHANGE_RefreshRevealHandle *
TALER_EXCHANGE_refresh_reveal (struct TALER_EXCHANGE_Handle *exchange,
size_t refresh_data_length,
const char *refresh_data,
- uint16_t noreveal_index,
+ uint32_t noreveal_index,
TALER_EXCHANGE_RefreshRevealCallback reveal_cb,
void *reveal_cb_cls);
diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h
index 006ea3981..e64b0ad4c 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2014-2017 GNUnet e.V.
+ Copyright (C) 2014-2017 Taler Systems SA
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
@@ -465,7 +465,7 @@ struct TALER_EXCHANGEDB_Refund
/**
* @brief Specification for coin in a /refresh/melt operation.
*/
-struct TALER_EXCHANGEDB_RefreshMelt
+struct TALER_EXCHANGEDB_RefreshSession
{
/**
* Information about the coin that is being melted.
@@ -478,9 +478,9 @@ struct TALER_EXCHANGEDB_RefreshMelt
struct TALER_CoinSpendSignatureP coin_sig;
/**
- * Hash of the refresh session this coin is melted into.
+ * Refresh commitment this coin is melted into.
*/
- struct GNUNET_HashCode session_hash;
+ struct TALER_RefreshCommitmentP rc;
/**
* How much value is being melted? This amount includes the fees,
@@ -493,64 +493,29 @@ struct TALER_EXCHANGEDB_RefreshMelt
struct TALER_Amount amount_with_fee;
/**
- * Melting fee charged by the exchange. This must match the Exchange'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 Exchange's
- * denomination key, the melting operation is invalid and will be
- * rejected by the exchange. 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 Global information for a refreshing session. Includes
- * dimensions of the operation, security parameters and
- * client signatures from "/refresh/melt" and "/refresh/commit".
- */
-struct TALER_EXCHANGEDB_RefreshSession
-{
-
- /**
- * Melt operation details.
- */
- struct TALER_EXCHANGEDB_RefreshMelt melt;
-
- /**
- * Number of new coins we are creating.
- */
- uint16_t num_newcoins;
-
- /**
* Index (smaller #TALER_CNC_KAPPA) which the exchange has chosen to not
* have revealed during cut and choose.
*/
- uint16_t noreveal_index;
+ uint32_t noreveal_index;
};
/**
- * @brief We have as many `struct TALER_EXCHANGEDB_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 exchange to sign if the
- * respective set is selected.
+ * Information about a /refresh/melt operation in the transaction history.
*/
-struct TALER_EXCHANGEDB_RefreshCommitCoin
+struct TALER_EXCHANGEDB_RefreshMelt
{
/**
- * Blinded message to be signed (in envelope), with @e coin_env_size bytes.
+ * Overall session data.
*/
- char *coin_ev;
+ struct TALER_EXCHANGEDB_RefreshSession session;
/**
- * Number of bytes in @e coin_ev.
+ * Melt fee the exchange charged.
*/
- size_t coin_ev_size;
+ struct TALER_Amount melt_fee;
};
@@ -752,9 +717,8 @@ typedef int
* @param coin_pub public key of the coin
* @param coin_sig signature from the coin
* @param amount_with_fee amount that was deposited including fee
- * @param num_newcoins how many coins were issued
* @param noreveal_index which index was picked by the exchange in cut-and-choose
- * @param session_hash what is the session hash
+ * @param rc what is the commitment
* @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
*/
typedef int
@@ -764,9 +728,56 @@ typedef int
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_CoinSpendSignatureP *coin_sig,
const struct TALER_Amount *amount_with_fee,
- uint16_t num_newcoins,
- uint16_t noreveal_index,
- const struct GNUNET_HashCode *session_hash);
+ uint32_t noreveal_index,
+ const struct TALER_RefreshCommitmentP *rc);
+
+
+/**
+ * Information about a coin that was revealed to the exchange
+ * during /refresh/reveal.
+ */
+struct TALER_EXCHANGEDB_RefreshRevealedCoin
+{
+ /**
+ * Public denomination key of the coin.
+ */
+ struct TALER_DenominationPublicKey denom_pub;
+
+ /**
+ * 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;
+
+ /**
+ * Signature generated by the exchange over the coin (in blinded format).
+ */
+ struct TALER_DenominationSignature coin_sig;
+};
+
+
+/**
+ * Function called with information about a refresh order.
+ *
+ * @param cls closure
+ * @param rowid unique serial ID for the row in our database
+ * @param num_newcoins size of the @a rrcs array
+ * @param rrcs array of @a num_newcoins information about coins to be created
+ * @param num_tprivs number of entries in @a tprivs, should be #TALER_CNC_KAPPA - 1
+ * @param tprivs array of @e num_tprivs transfer private keys
+ * @param tp transfer public key information
+ */
+typedef void
+(*TALER_EXCHANGEDB_RefreshCallback)(void *cls,
+ uint32_t num_newcoins,
+ const struct TALER_EXCHANGEDB_RefreshRevealedCoin *rrcs,
+ unsigned int num_tprivs,
+ const struct TALER_TransferPrivateKeyP *tprivs,
+ const struct TALER_TransferPublicKeyP *tp);
/**
@@ -851,14 +862,13 @@ typedef int
* 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
+ * @param ldl link data for @a transfer_pub
*/
typedef void
-(*TALER_EXCHANGEDB_TransferDataCallback)(void *cls,
- const struct GNUNET_HashCode *session_hash,
- const struct TALER_TransferPublicKeyP *transfer_pub);
+(*TALER_EXCHANGEDB_LinkDataCallback)(void *cls,
+ const struct TALER_TransferPublicKeyP *transfer_pub,
+ const struct TALER_EXCHANGEDB_LinkDataList *ldl);
/**
@@ -1235,7 +1245,7 @@ struct TALER_EXCHANGEDB_Plugin
* @param[out] wire_reference_size set to number of bytes in @a wire_reference
* @return transaction status code
*/
- enum GNUNET_DB_QueryStatus
+ enum GNUNET_DB_QueryStatus
(*get_latest_reserve_in_reference)(void *cls,
struct TALER_EXCHANGEDB_Session *db,
void **wire_reference,
@@ -1254,7 +1264,7 @@ struct TALER_EXCHANGEDB_Plugin
* if a coin is found
* @return statement execution status
*/
- enum GNUNET_DB_QueryStatus
+ enum GNUNET_DB_QueryStatus
(*get_withdraw_info) (void *cls,
struct TALER_EXCHANGEDB_Session *session,
const struct GNUNET_HashCode *h_blind,
@@ -1454,225 +1464,79 @@ struct TALER_EXCHANGEDB_Plugin
/**
- * Lookup refresh session data under the given @a session_hash.
+ * Store new refresh melt commitment data.
*
* @param cls the @e cls of this struct with the plugin-specific state
* @param session 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 transaction status
- */
- enum GNUNET_DB_QueryStatus
- (*get_refresh_session) (void *cls,
- struct TALER_EXCHANGEDB_Session *session,
- const struct GNUNET_HashCode *session_hash,
- struct TALER_EXCHANGEDB_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 session 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 query status for the transaction
- */
- enum GNUNET_DB_QueryStatus
- (*create_refresh_session) (void *cls,
- struct TALER_EXCHANGEDB_Session *session,
- const struct GNUNET_HashCode *session_hash,
- const struct TALER_EXCHANGEDB_RefreshSession *refresh_session);
-
-
- /**
- * 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 session 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 query status for the transaction
- */
- enum GNUNET_DB_QueryStatus
- (*insert_refresh_order) (void *cls,
- struct TALER_EXCHANGEDB_Session *session,
- 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 session 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 transaction status
- */
- enum GNUNET_DB_QueryStatus
- (*get_refresh_order) (void *cls,
- struct TALER_EXCHANGEDB_Session *session,
- 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 session database connection to use
- * @param session_hash hash to identify refresh session
- * @param num_newcoins coin index size of the @a commit_coins array
- * @param commit_coin array of coin commitments to store
+ * @param refresh_session operational data to store
* @return query status for the transaction
*/
enum GNUNET_DB_QueryStatus
- (*insert_refresh_commit_coins) (void *cls,
- struct TALER_EXCHANGEDB_Session *session,
- const struct GNUNET_HashCode *session_hash,
- uint16_t num_newcoins,
- const struct TALER_EXCHANGEDB_RefreshCommitCoin *commit_coins);
+ (*insert_melt) (void *cls,
+ struct TALER_EXCHANGEDB_Session *session,
+ const struct TALER_EXCHANGEDB_RefreshSession *refresh_session);
/**
- * Obtain information about the commitment of the
- * given coin of the given refresh session from the database.
+ * Lookup refresh metl commitment data under the given @a rc.
*
* @param cls the @e cls of this struct with the plugin-specific state
- * @param session database connection to use
- * @param session_hash hash to identify refresh session
- * @param num_coins size of the @a commit_coins array
- * @param[out] commit_coins array of coin commitments to return
+ * @param session database handle to use
+ * @param rc commitment to use for the lookup
+ * @param[out] refresh_melt where to store the result
* @return transaction status
*/
enum GNUNET_DB_QueryStatus
- (*get_refresh_commit_coins) (void *cls,
- struct TALER_EXCHANGEDB_Session *session,
- const struct GNUNET_HashCode *session_hash,
- uint16_t num_coins,
- struct TALER_EXCHANGEDB_RefreshCommitCoin *commit_coins);
-
- /**
- * Free refresh @a commit_coins data obtained via @e get_refresh_commit_coins.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param num_coins size of the @a commit_coins array
- * @param commit_coins array of coin commitments to free
- */
- void
- (*free_refresh_commit_coins) (void *cls,
- unsigned int num_coins,
- struct TALER_EXCHANGEDB_RefreshCommitCoin *commit_coins);
+ (*get_melt) (void *cls,
+ struct TALER_EXCHANGEDB_Session *session,
+ const struct TALER_RefreshCommitmentP *rc,
+ struct TALER_EXCHANGEDB_RefreshMelt *refresh_melt);
/**
- * Store the commitment to the given (encrypted) refresh link data
- * for the given refresh session.
+ * Store in the database which coin(s) the wallet wanted to create
+ * in a given refresh operation and all of the other information
+ * we learned or created in the /refresh/reveal step.
*
* @param cls the @e cls of this struct with the plugin-specific state
- * @param session database connection to use
- * @param session_hash hash to identify refresh session
+ * @param session database connection
+ * @param rc identify commitment and thus refresh operation
+ * @param num_rrcs_newcoins number of coins to generate, size of the
+ * @a rrcs array
+ * @param rrcs information about the new coins
+ * @param num_tprivs number of entries in @a tprivs, should be #TALER_CNC_KAPPA - 1
+ * @param tprivs transfer private keys to store
* @param tp public key to store
* @return query status for the transaction
*/
enum GNUNET_DB_QueryStatus
- (*insert_refresh_transfer_public_key) (void *cls,
- struct TALER_EXCHANGEDB_Session *session,
- const struct GNUNET_HashCode *session_hash,
- const struct TALER_TransferPublicKeyP *tp);
-
- /**
- * 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 session database connection to use
- * @param session_hash hash to identify refresh session
- * @param[out] tp information to return
- * @return transaction status
- */
- enum GNUNET_DB_QueryStatus
- (*get_refresh_transfer_public_key) (void *cls,
- struct TALER_EXCHANGEDB_Session *session,
- const struct GNUNET_HashCode *session_hash,
- struct TALER_TransferPublicKeyP *tp);
-
-
- /**
- * Get signature of a new coin generated during refresh into
- * the database indexed by the refresh session and the index
- * of the coin.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param session database connection
- * @param session_hash hash to identify refresh session
- * @param newcoin_index coin index
- * @param[out] ev_sig coin signature
- * @return transaction result status
- */
- enum GNUNET_DB_QueryStatus
- (*get_refresh_out) (void *cls,
- struct TALER_EXCHANGEDB_Session *session,
- const struct GNUNET_HashCode *session_hash,
- uint16_t newcoin_index,
- struct TALER_DenominationSignature *ev_sig);
-
-
- /**
- * 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 session database connection
- * @param session_hash hash to identify refresh session
- * @param newcoin_index coin index
- * @param ev_sig coin signature
- * @return transaction result status
- */
- enum GNUNET_DB_QueryStatus
- (*insert_refresh_out) (void *cls,
- struct TALER_EXCHANGEDB_Session *session,
- const struct GNUNET_HashCode *session_hash,
- uint16_t newcoin_index,
- const struct TALER_DenominationSignature *ev_sig);
+ (*insert_refresh_reveal) (void *cls,
+ struct TALER_EXCHANGEDB_Session *session,
+ const struct TALER_RefreshCommitmentP *rc,
+ uint32_t num_rrcs,
+ const struct TALER_EXCHANGEDB_RefreshRevealedCoin *rrcs,
+ unsigned int num_tprivs,
+ const struct TALER_TransferPrivateKeyP *tprivs,
+ const struct TALER_TransferPublicKeyP *tp);
/**
- * Obtain the link data of a coin, that is the encrypted link
- * information, the denomination keys and the signatures.
+ * Lookup in the database for the @a num_newcoins coins that we
+ * created in the given refresh operation.
*
* @param cls the @e cls of this struct with the plugin-specific state
* @param session database connection
- * @param session_hash session to get linkage data for
- * @param[out] ldldp set to all known link data for the session
- * @return status of the transaction
+ * @param rc identify commitment and thus refresh operation
+ * @param cb function to call with the results
+ * @param cb_cls closure for @a cb
+ * @return transaction status
*/
enum GNUNET_DB_QueryStatus
- (*get_link_data_list) (void *cls,
+ (*get_refresh_reveal) (void *cls,
struct TALER_EXCHANGEDB_Session *session,
- const struct GNUNET_HashCode *session_hash,
- struct TALER_EXCHANGEDB_LinkDataList **ldlp);
-
-
- /**
- * 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_EXCHANGEDB_LinkDataList *ldl);
+ const struct TALER_RefreshCommitmentP *rc,
+ TALER_EXCHANGEDB_RefreshCallback cb,
+ void *cb_cls);
/**
@@ -1684,16 +1548,16 @@ struct TALER_EXCHANGEDB_Plugin
* @param cls the @e cls of this struct with the plugin-specific state
* @param session 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
+ * @param ldc function to call for each session the coin was melted into
+ * @param ldc_cls closure for @a tdc
* @return statement execution status
*/
enum GNUNET_DB_QueryStatus
- (*get_transfer) (void *cls,
- struct TALER_EXCHANGEDB_Session *session,
- const struct TALER_CoinSpendPublicKeyP *coin_pub,
- TALER_EXCHANGEDB_TransferDataCallback tdc,
- void *tdc_cls);
+ (*get_link_data) (void *cls,
+ struct TALER_EXCHANGEDB_Session *session,
+ const struct TALER_CoinSpendPublicKeyP *coin_pub,
+ TALER_EXCHANGEDB_LinkDataCallback ldc,
+ void *tdc_cls);
/**
@@ -1806,7 +1670,7 @@ struct TALER_EXCHANGEDB_Plugin
const struct TALER_Amount *wire_fee,
const struct TALER_MasterSignatureP *master_sig);
-
+
/**
* Obtain wire fee from database.
*
@@ -2233,7 +2097,7 @@ struct TALER_EXCHANGEDB_Plugin
struct GNUNET_TIME_Absolute end_date,
TALER_EXCHANGEDB_WireMissingCallback cb,
void *cb_cls);
-
+
};
diff --git a/src/include/taler_signatures.h b/src/include/taler_signatures.h
index db71cca68..3bc0505f9 100644
--- a/src/include/taler_signatures.h
+++ b/src/include/taler_signatures.h
@@ -532,9 +532,9 @@ struct TALER_RefreshMeltCoinAffirmationPS
struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
/**
- * Which melting session should the coin become a part of.
+ * Which melt commitment is made by the wallet.
*/
- struct GNUNET_HashCode session_hash GNUNET_PACKED;
+ struct TALER_RefreshCommitmentP rc GNUNET_PACKED;
/**
* How much of the value of the coin should be melted? This amount
@@ -581,20 +581,16 @@ struct TALER_RefreshMeltConfirmationPS
struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
/**
- * Hash of the refresh session.
+ * Commitment made in the /refresh/melt.
*/
- struct GNUNET_HashCode session_hash GNUNET_PACKED;
+ struct TALER_RefreshCommitmentP rc GNUNET_PACKED;
/**
* Index that the client will not have to reveal, in NBO.
* Must be smaller than #TALER_CNC_KAPPA.
*/
- uint16_t noreveal_index GNUNET_PACKED;
+ uint32_t noreveal_index GNUNET_PACKED;
- /**
- * Zero.
- */
- uint16_t reserved GNUNET_PACKED;
};