Compare commits

...

10 Commits

63 changed files with 2021 additions and 514 deletions

@ -1 +1 @@
Subproject commit 7884adf99ec4d5ccf52b1a5a251b99fb6ab9c2f6
Subproject commit b309c93f859f68124f76cef03b35b0143b8331cb

View File

@ -1218,7 +1218,7 @@ static enum GNUNET_GenericReturnValue
refresh_session_cb (void *cls,
uint64_t rowid,
const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_AgeCommitmentHash *h_age_commitment,
const struct TALER_AgeCommitmentHashP *h_age_commitment,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_CoinSpendSignatureP *coin_sig,
const struct TALER_Amount *amount_with_fee,

View File

@ -277,7 +277,7 @@ add_deposit (const struct Merchant *m)
struct TALER_EXCHANGEDB_Deposit deposit;
uint64_t known_coin_id;
struct TALER_DenominationHashP dph;
struct TALER_AgeCommitmentHash agh;
struct TALER_AgeCommitmentHashP agh;
RANDOMIZE (&d.coin.coin_pub);
d.coin.denom_pub_hash = h_denom_pub;
@ -468,7 +468,7 @@ run (void *cls,
struct TALER_PlanchetMasterSecretP ps;
struct TALER_ExchangeWithdrawValues alg_values;
struct TALER_CoinSpendPublicKeyP coin_pub;
struct TALER_AgeCommitmentHash hac;
struct TALER_AgeCommitmentHashP hac;
union TALER_DenominationBlindingKeyP bks;
RANDOMIZE (&coin_pub);

View File

@ -1,6 +1,6 @@
/*
This file is part of TALER
Copyright (C) 2020, 2021, 2022 Taler Systems SA
Copyright (C) 2020-2023 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
@ -112,6 +112,16 @@
*/
#define OP_DRAIN_PROFITS "exchange-drain-profits-0"
/**
* Setup AML staff.
*/
#define OP_UPDATE_AML_STAFF "exchange-add-aml-staff-0"
/**
* Setup partner exchange for wad transfers.
*/
#define OP_ADD_PARTNER "exchange-add-partner-0"
/**
* Our private key, initialized in #load_offline_key().
*/
@ -498,6 +508,62 @@ struct UploadExtensionsRequest
};
/**
* Data structure for AML staff requests.
*/
struct AmlStaffRequest
{
/**
* Kept in a DLL.
*/
struct AmlStaffRequest *next;
/**
* Kept in a DLL.
*/
struct AmlStaffRequest *prev;
/**
* Operation handle.
*/
struct TALER_EXCHANGE_ManagementUpdateAmlOfficer *h;
/**
* Array index of the associated command.
*/
size_t idx;
};
/**
* Data structure for partner add requests.
*/
struct PartnerAddRequest
{
/**
* Kept in a DLL.
*/
struct PartnerAddRequest *next;
/**
* Kept in a DLL.
*/
struct PartnerAddRequest *prev;
/**
* Operation handle.
*/
struct TALER_EXCHANGE_ManagementAddPartner *h;
/**
* Array index of the associated command.
*/
size_t idx;
};
/**
* Next work item to perform.
*/
@ -508,6 +574,27 @@ static struct GNUNET_SCHEDULER_Task *nxt;
*/
static struct TALER_EXCHANGE_ManagementGetKeysHandle *mgkh;
/**
* Active AML staff change requests.
*/
static struct AmlStaffRequest *asr_head;
/**
* Active AML staff change requests.
*/
static struct AmlStaffRequest *asr_tail;
/**
* Active partner add requests.
*/
static struct PartnerAddRequest *par_head;
/**
* Active partner add requests.
*/
static struct PartnerAddRequest *par_tail;
/**
* Active denomiantion revocation requests.
*/
@ -629,6 +716,36 @@ do_shutdown (void *cls)
{
(void) cls;
{
struct AmlStaffRequest *asr;
while (NULL != (asr = asr_head))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Aborting incomplete AML staff update #%u\n",
(unsigned int) asr->idx);
TALER_EXCHANGE_management_update_aml_officer_cancel (asr->h);
GNUNET_CONTAINER_DLL_remove (asr_head,
asr_tail,
asr);
GNUNET_free (asr);
}
}
{
struct PartnerAddRequest *par;
while (NULL != (par = par_head))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Aborting incomplete partner add request #%u\n",
(unsigned int) par->idx);
TALER_EXCHANGE_management_add_partner_cancel (par->h);
GNUNET_CONTAINER_DLL_remove (par_head,
par_tail,
par);
GNUNET_free (par);
}
}
{
struct DenomRevocationRequest *drr;
@ -842,6 +959,8 @@ static void
test_shutdown (void)
{
if ( (NULL == drr_head) &&
(NULL == par_head) &&
(NULL == asr_head) &&
(NULL == srr_head) &&
(NULL == aar_head) &&
(NULL == adr_head) &&
@ -2214,6 +2333,221 @@ upload_extensions (const char *exchange_url,
}
/**
* Function called with information about the add partner operation.
*
* @param cls closure with a `struct PartnerAddRequest`
* @param hr HTTP response data
*/
static void
add_partner_cb (
void *cls,
const struct TALER_EXCHANGE_HttpResponse *hr)
{
struct PartnerAddRequest *par = cls;
if (MHD_HTTP_NO_CONTENT != hr->http_status)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Upload failed for command %u with status %u: %s (%s)\n",
(unsigned int) par->idx,
hr->http_status,
TALER_ErrorCode_get_hint (hr->ec),
hr->hint);
global_ret = EXIT_FAILURE;
}
GNUNET_CONTAINER_DLL_remove (par_head,
par_tail,
par);
GNUNET_free (par);
test_shutdown ();
}
/**
* Add partner action.
*
* @param exchange_url base URL of the exchange
* @param idx index of the operation we are performing (for logging)
* @param value arguments for add partner
*/
static void
add_partner (const char *exchange_url,
size_t idx,
const json_t *value)
{
struct TALER_MasterPublicKeyP partner_pub;
struct GNUNET_TIME_Timestamp start_date;
struct GNUNET_TIME_Timestamp end_date;
struct GNUNET_TIME_Relative wad_frequency;
struct TALER_Amount wad_fee;
const char *partner_base_url;
struct TALER_MasterSignatureP master_sig;
struct PartnerAddRequest *par;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("partner_pub",
&partner_pub),
TALER_JSON_spec_amount ("wad_fee",
currency,
&wad_fee),
GNUNET_JSON_spec_relative_time ("wad_frequency",
&wad_frequency),
GNUNET_JSON_spec_timestamp ("start_date",
&start_date),
GNUNET_JSON_spec_timestamp ("end_date",
&end_date),
GNUNET_JSON_spec_string ("partner_base_url",
&partner_base_url),
GNUNET_JSON_spec_fixed_auto ("master_sig",
&master_sig),
GNUNET_JSON_spec_end ()
};
const char *err_name;
unsigned int err_line;
if (GNUNET_OK !=
GNUNET_JSON_parse (value,
spec,
&err_name,
&err_line))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid input to add partner: %s#%u at %u (skipping)\n",
err_name,
err_line,
(unsigned int) idx);
json_dumpf (value,
stderr,
JSON_INDENT (2));
global_ret = EXIT_FAILURE;
test_shutdown ();
return;
}
par = GNUNET_new (struct PartnerAddRequest);
par->idx = idx;
par->h =
TALER_EXCHANGE_management_add_partner (ctx,
exchange_url,
&partner_pub,
start_date,
end_date,
wad_frequency,
&wad_fee,
partner_base_url,
&master_sig,
&add_partner_cb,
par);
GNUNET_CONTAINER_DLL_insert (par_head,
par_tail,
par);
}
/**
* Function called with information about the AML officer update operation.
*
* @param cls closure with a `struct AmlStaffRequest`
* @param hr HTTP response data
*/
static void
update_aml_officer_cb (
void *cls,
const struct TALER_EXCHANGE_HttpResponse *hr)
{
struct AmlStaffRequest *asr = cls;
if (MHD_HTTP_NO_CONTENT != hr->http_status)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Upload failed for command %u with status %u: %s (%s)\n",
(unsigned int) asr->idx,
hr->http_status,
TALER_ErrorCode_get_hint (hr->ec),
hr->hint);
global_ret = EXIT_FAILURE;
}
GNUNET_CONTAINER_DLL_remove (asr_head,
asr_tail,
asr);
GNUNET_free (asr);
test_shutdown ();
}
/**
* Upload AML staff action.
*
* @param exchange_url base URL of the exchange
* @param idx index of the operation we are performing (for logging)
* @param value arguments for AML staff change
*/
static void
update_aml_staff (const char *exchange_url,
size_t idx,
const json_t *value)
{
struct TALER_AmlOfficerPublicKeyP officer_pub;
const char *officer_name;
struct GNUNET_TIME_Timestamp change_date;
bool is_active;
bool read_only;
struct TALER_MasterSignatureP master_sig;
struct AmlStaffRequest *asr;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("officer_pub",
&officer_pub),
GNUNET_JSON_spec_timestamp ("change_date",
&change_date),
GNUNET_JSON_spec_bool ("is_active",
&is_active),
GNUNET_JSON_spec_bool ("read_only",
&read_only),
GNUNET_JSON_spec_string ("officer_name",
&officer_name),
GNUNET_JSON_spec_fixed_auto ("master_sig",
&master_sig),
GNUNET_JSON_spec_end ()
};
const char *err_name;
unsigned int err_line;
if (GNUNET_OK !=
GNUNET_JSON_parse (value,
spec,
&err_name,
&err_line))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid input to AML staff update: %s#%u at %u (skipping)\n",
err_name,
err_line,
(unsigned int) idx);
json_dumpf (value,
stderr,
JSON_INDENT (2));
global_ret = EXIT_FAILURE;
test_shutdown ();
return;
}
asr = GNUNET_new (struct AmlStaffRequest);
asr->idx = idx;
asr->h =
TALER_EXCHANGE_management_update_aml_officer (ctx,
exchange_url,
&officer_pub,
officer_name,
change_date,
is_active,
read_only,
&master_sig,
&update_aml_officer_cb,
asr);
GNUNET_CONTAINER_DLL_insert (asr_head,
asr_tail,
asr);
}
/**
* Perform uploads based on the JSON in #out.
*
@ -2267,6 +2601,14 @@ trigger_upload (const char *exchange_url)
.key = OP_EXTENSIONS,
.cb = &upload_extensions
},
{
.key = OP_UPDATE_AML_STAFF,
.cb = &update_aml_staff
},
{
.key = OP_ADD_PARTNER,
.cb = &add_partner
},
/* array termination */
{
.key = NULL
@ -3040,6 +3382,261 @@ do_drain (char *const *args)
}
/**
* Add partner.
*
* @param args the array of command-line arguments to process next;
* args[0] must be the partner's master public key, args[1] the partner's
* API base URL, args[2] the wad fee, args[3] the wad frequency, and
* args[4] the year (including possibly 'now')
*/
static void
do_add_partner (char *const *args)
{
struct TALER_MasterPublicKeyP partner_pub;
struct GNUNET_TIME_Timestamp start_date;
struct GNUNET_TIME_Timestamp end_date;
struct GNUNET_TIME_Relative wad_frequency;
struct TALER_Amount wad_fee;
const char *partner_base_url;
struct TALER_MasterSignatureP master_sig;
char dummy;
unsigned int year;
if (NULL != in)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Downloaded data was not consumed, not adding partner\n");
test_shutdown ();
global_ret = EXIT_FAILURE;
return;
}
if ( (NULL == args[0]) ||
(GNUNET_OK !=
GNUNET_STRINGS_string_to_data (args[0],
strlen (args[0]),
&partner_pub,
sizeof (partner_pub))) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"You must specify the partner master public key as first argument for this subcommand\n");
test_shutdown ();
global_ret = EXIT_INVALIDARGUMENT;
return;
}
if ( (NULL == args[1]) ||
(0 != strncmp ("http",
args[1],
strlen ("http"))) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"You must specify the partner's base URL as the 2nd argument to this subcommand\n");
test_shutdown ();
global_ret = EXIT_INVALIDARGUMENT;
return;
}
partner_base_url = args[1];
if ( (NULL == args[2]) ||
(GNUNET_OK !=
TALER_string_to_amount (args[2],
&wad_fee)) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid amount `%s' specified for wad fee of partner\n",
args[2]);
test_shutdown ();
global_ret = EXIT_INVALIDARGUMENT;
return;
}
if ( (NULL == args[3]) ||
(GNUNET_OK !=
GNUNET_STRINGS_fancy_time_to_relative (args[3],
&wad_frequency)) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid wad frequency `%s' specified for add partner\n",
args[3]);
test_shutdown ();
global_ret = EXIT_INVALIDARGUMENT;
return;
}
if ( (NULL == args[4]) ||
( (1 != sscanf (args[4],
"%u%c",
&year,
&dummy)) &&
(0 != strcasecmp ("now",
args[4])) ) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid year `%s' specified for add partner\n",
args[4]);
test_shutdown ();
global_ret = EXIT_INVALIDARGUMENT;
return;
}
if (0 == strcasecmp ("now",
args[4]))
year = GNUNET_TIME_get_current_year ();
start_date = GNUNET_TIME_absolute_to_timestamp (
GNUNET_TIME_year_to_time (year));
end_date = GNUNET_TIME_absolute_to_timestamp (
GNUNET_TIME_year_to_time (year + 1));
if (GNUNET_OK !=
load_offline_key (GNUNET_NO))
return;
TALER_exchange_offline_partner_details_sign (&partner_pub,
start_date,
end_date,
wad_frequency,
&wad_fee,
partner_base_url,
&master_priv,
&master_sig);
output_operation (OP_ADD_PARTNER,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_string ("partner_base_url",
partner_base_url),
GNUNET_JSON_pack_time_rel ("wad_frequency",
wad_frequency),
GNUNET_JSON_pack_timestamp ("start_date",
start_date),
GNUNET_JSON_pack_timestamp ("end_date",
end_date),
GNUNET_JSON_pack_data_auto ("partner_pub",
&partner_pub),
GNUNET_JSON_pack_data_auto ("master_sig",
&master_sig)));
next (args + 5);
}
/**
* Enable or disable AML staff.
*
* @param is_active true to enable, false to disable
* @param args the array of command-line arguments to process next; args[0] must be the AML staff's public key, args[1] the AML staff's legal name, and if @a is_active then args[2] rw (read write) or ro (read only)
*/
static void
do_set_aml_staff (bool is_active,
char *const *args)
{
struct TALER_AmlOfficerPublicKeyP officer_pub;
const char *officer_name;
bool read_only;
struct TALER_MasterSignatureP master_sig;
struct GNUNET_TIME_Timestamp now
= GNUNET_TIME_timestamp_get ();
if (NULL != in)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Downloaded data was not consumed, not updating AML staff status\n");
test_shutdown ();
global_ret = EXIT_FAILURE;
return;
}
if ( (NULL == args[0]) ||
(GNUNET_OK !=
GNUNET_STRINGS_string_to_data (args[0],
strlen (args[0]),
&officer_pub,
sizeof (officer_pub))) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"You must specify the AML officer's public key as first argument for this subcommand\n");
test_shutdown ();
global_ret = EXIT_INVALIDARGUMENT;
return;
}
if (NULL == args[1])
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"You must specify the officer's legal name as the 2nd argument to this subcommand\n");
test_shutdown ();
global_ret = EXIT_INVALIDARGUMENT;
return;
}
officer_name = args[1];
if (is_active)
{
if ( (NULL == args[2]) ||
( (0 != strcmp (args[2],
"ro")) &&
(0 != strcmp (args[2],
"rw")) ) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"You must specify 'ro' or 'rw' (and not `%s') for the access level\n",
args[2]);
test_shutdown ();
global_ret = EXIT_INVALIDARGUMENT;
return;
}
read_only = (0 == strcmp (args[2],
"ro"));
}
else
{
read_only = true;
}
if (GNUNET_OK !=
load_offline_key (GNUNET_NO))
return;
TALER_exchange_offline_aml_officer_status_sign (&officer_pub,
officer_name,
now,
is_active,
read_only,
&master_priv,
&master_sig);
output_operation (OP_UPDATE_AML_STAFF,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_string ("officer_name",
officer_name),
GNUNET_JSON_pack_timestamp ("change_date",
now),
GNUNET_JSON_pack_bool ("is_active",
is_active),
GNUNET_JSON_pack_bool ("read_only",
read_only),
GNUNET_JSON_pack_data_auto ("officer_pub",
&officer_pub),
GNUNET_JSON_pack_data_auto ("master_sig",
&master_sig)));
next (args + (is_active ? 3 : 2));
}
/**
* Disable AML staff.
*
* @param args the array of command-line arguments to process next;
* args[0] must be the AML staff's public key, args[1] the AML staff's legal name, args[2] rw (read write) or ro (read only)
*/
static void
disable_aml_staff (char *const *args)
{
do_set_aml_staff (false,
args);
}
/**
* Enable AML staff.
*
* @param args the array of command-line arguments to process next;
* args[0] must be the AML staff's public key, args[1] the AML staff's legal name, args[2] rw (read write) or ro (read only)
*/
static void
enable_aml_staff (char *const *args)
{
do_set_aml_staff (true,
args);
}
/**
* Function called with information about future keys. Dumps the JSON output
* (on success), either into an internal buffer or to stdout (depending on
@ -4475,6 +5072,24 @@ work (void *cls)
"drain profits from exchange escrow account to regular exchange operator account (amount, debit account configuration section and credit account payto://-URI must be given as arguments)",
.cb = &do_drain
},
{
.name = "add-partner",
.help =
"add partner exchange for P2P wad transfers (partner master public key, partner base URL, wad fee, wad frequency and validity year must be given as arguments)",
.cb = &do_add_partner
},
{
.name = "aml-enable",
.help =
"enable AML staff member (staff member public key, legal name and rw (read write) or ro (read only) must be given as arguments)",
.cb = &enable_aml_staff
},
{
.name = "aml-disable",
.help =
"disable AML staff member (staff member public key and legal name must be given as arguments)",
.cb = &disable_aml_staff
},
{
.name = "upload",
.help =

View File

@ -122,6 +122,8 @@ taler_exchange_wirewatch_LDADD = \
taler_exchange_httpd_SOURCES = \
taler-exchange-httpd.c taler-exchange-httpd.h \
taler-exchange-httpd_age-withdraw.c taler-exchange-httpd_age-withdraw.h \
taler-exchange-httpd_age-withdraw_reveal.c taler-exchange-httpd_age-withdraw_reveal.h \
taler-exchange-httpd_auditors.c taler-exchange-httpd_auditors.h \
taler-exchange-httpd_aml-decision.c taler-exchange-httpd_aml-decision.h \
taler-exchange-httpd_batch-deposit.c taler-exchange-httpd_batch-deposit.h \

View File

@ -0,0 +1,382 @@
/*
This file is part of TALER
Copyright (C) 2023 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 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,
see <http://www.gnu.org/licenses/>
*/
/**
* @file taler-exchange-httpd_age-withdraw.c
* @brief Handle /reserves/$RESERVE_PUB/age-withdraw requests
* @author Özgür Kesim
*/
#include "platform.h"
#include <gnunet/gnunet_util_lib.h>
#include <jansson.h>
#include "taler_json_lib.h"
#include "taler_kyclogic_lib.h"
#include "taler_mhd_lib.h"
#include "taler-exchange-httpd_age-withdraw.h"
#include "taler-exchange-httpd_responses.h"
#include "taler-exchange-httpd_keys.h"
/**
* Send a response to a "age-withdraw" request.
*
* @param connection the connection to send the response to
* @param ach value the client committed to
* @param noreveal_index which index will the client not have to reveal
* @return a MHD status code
*/
static MHD_RESULT
reply_age_withdraw_success (struct MHD_Connection *connection,
const struct TALER_AgeWithdrawCommitmentHashP *ach,
uint32_t noreveal_index)
{
struct TALER_ExchangePublicKeyP pub;
struct TALER_ExchangeSignatureP sig;
enum TALER_ErrorCode ec =
TALER_exchange_online_age_withdraw_confirmation_sign (
&TEH_keys_exchange_sign_,
ach,
noreveal_index,
&pub,
&sig);
if (TALER_EC_NONE != ec)
return TALER_MHD_reply_with_ec (connection,
ec,
NULL);
return TALER_MHD_REPLY_JSON_PACK (connection,
MHD_HTTP_OK,
GNUNET_JSON_pack_uint64 ("noreveal_index",
noreveal_index),
GNUNET_JSON_pack_data_auto ("exchange_sig",
&sig),
GNUNET_JSON_pack_data_auto ("exchange_pub",
&pub));
}
/**
* Context for #age_withdraw_transaction.
*/
struct AgeWithdrawContext
{
/**
* KYC status for the operation.
*/
struct TALER_EXCHANGEDB_KycStatus kyc;
/**
* Hash of the wire source URL, needed when kyc is needed.
*/
struct TALER_PaytoHashP h_payto;
/**
* The data from the age-withdraw request
*/
struct TALER_EXCHANGEDB_AgeWithdrawCommitment commitment;
/**
* Current time for the DB transaction.
*/
struct GNUNET_TIME_Timestamp now;
};
/**
* Function called to iterate over KYC-relevant
* transaction amounts for a particular time range.
* Called within a database transaction, so must
* not start a new one.
*
* @param cls closure, identifies the event type and
* account to iterate over events for
* @param limit maximum time-range for which events
* should be fetched (timestamp in the past)
* @param cb function to call on each event found,
* events must be returned in reverse chronological
* order
* @param cb_cls closure for @a cb
*/
static void
age_withdraw_amount_cb (void *cls,
struct GNUNET_TIME_Absolute limit,
TALER_EXCHANGEDB_KycAmountCallback cb,
void *cb_cls)
{
struct AgeWithdrawContext *awc = cls;
enum GNUNET_DB_QueryStatus qs;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Signaling amount %s for KYC check during age-withdrawal\n",
TALER_amount2s (&awc->commitment.amount_with_fee));
if (GNUNET_OK !=
cb (cb_cls,
&awc->commitment.amount_with_fee,
awc->now.abs_time))
return;
qs = TEH_plugin->select_withdraw_amounts_for_kyc_check (TEH_plugin->cls,
&awc->h_payto,
limit,
cb,
cb_cls);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Got %d additional transactions for this age-withdrawal and limit %llu\n",
qs,
(unsigned long long) limit.abs_value_us);
GNUNET_break (qs >= 0);
}
/**
* Function implementing age withdraw transaction. Runs the
* transaction logic; IF it returns a non-error code, the transaction
* logic MUST NOT queue a MHD response. IF it returns an hard error,
* the transaction logic MUST queue a MHD response and set @a mhd_ret.
* IF it returns the soft error code, the function MAY be called again
* to retry and MUST not queue a MHD response.
*
* Note that "awc->commitment.sig" is set before entering this function as we
* signed before entering the transaction.
*
* @param cls a `struct AgeWithdrawContext *`
* @param connection MHD request which triggered the transaction
* @param[out] mhd_ret set to MHD response status for @a connection,
* if transaction failed (!)
* @return transaction status
*/
static enum GNUNET_DB_QueryStatus
age_withdraw_transaction (void *cls,
struct MHD_Connection *connection,
MHD_RESULT *mhd_ret)
{
struct AgeWithdrawContext *awc = cls;
enum GNUNET_DB_QueryStatus qs;
bool found = false;
bool balance_ok = false;
uint64_t ruuid;
awc->now = GNUNET_TIME_timestamp_get ();
qs = TEH_plugin->reserves_get_origin (TEH_plugin->cls,
&awc->commitment.reserve_pub,
&awc->h_payto);
if (qs < 0)
return qs;
/* If no results, reserve was created by merge,
in which case no KYC check is required as the
merge already did that. */
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
{
const char *kyc_required;
kyc_required = TALER_KYCLOGIC_kyc_test_required (
TALER_KYCLOGIC_KYC_TRIGGER_AGE_WITHDRAW,
&awc->h_payto,
TEH_plugin->select_satisfied_kyc_processes,
TEH_plugin->cls,
&age_withdraw_amount_cb,
awc);
if (NULL != kyc_required)
{
/* insert KYC requirement into DB! */
awc->kyc.ok = false;
return TEH_plugin->insert_kyc_requirement_for_account (
TEH_plugin->cls,
kyc_required,
&awc->h_payto,
&awc->kyc.requirement_row);
}
}
awc->kyc.ok = true;
qs = TEH_plugin->do_age_withdraw (TEH_plugin->cls,
&awc->commitment,
awc->now,
&found,
&balance_ok,
&ruuid);
if (0 > qs)
{
if (GNUNET_DB_STATUS_HARD_ERROR == qs)
*mhd_ret = TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
TALER_EC_GENERIC_DB_FETCH_FAILED,
"do_age_withdraw");
return qs;
}
else if (! found)
{
*mhd_ret = TALER_MHD_reply_with_error (connection,
MHD_HTTP_NOT_FOUND,
TALER_EC_EXCHANGE_GENERIC_RESERVE_UNKNOWN,
NULL);
return GNUNET_DB_STATUS_HARD_ERROR;
}
else if (! balance_ok)
{
TEH_plugin->rollback (TEH_plugin->cls);
*mhd_ret = TEH_RESPONSE_reply_reserve_insufficient_balance (
connection,
TALER_EC_EXCHANGE_AGE_WITHDRAW_INSUFFICIENT_FUNDS,
&awc->commitment.amount_with_fee,
&awc->commitment.reserve_pub);
return GNUNET_DB_STATUS_HARD_ERROR;
}
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
TEH_METRICS_num_success[TEH_MT_SUCCESS_AGE_WITHDRAW]++;
return qs;
}
/**
* Check if the @a rc is replayed and we already have an
* answer. If so, replay the existing answer and return the
* HTTP response.
*
* @param rc request context
* @param[in,out] awc parsed request data
* @param[out] mret HTTP status, set if we return true
* @return true if the request is idempotent with an existing request
* false if we did not find the request in the DB and did not set @a mret
*/
static bool
request_is_idempotent (struct TEH_RequestContext *rc,
struct AgeWithdrawContext *awc,
MHD_RESULT *mret)
{
enum GNUNET_DB_QueryStatus qs;
struct TALER_EXCHANGEDB_AgeWithdrawCommitment commitment;
qs = TEH_plugin->get_age_withdraw_info (TEH_plugin->cls,
&awc->commitment.reserve_pub,
&awc->commitment.h_commitment,
&commitment);
if (0 > qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
if (GNUNET_DB_STATUS_HARD_ERROR == qs)
*mret = TALER_MHD_reply_with_error (rc->connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
TALER_EC_GENERIC_DB_FETCH_FAILED,
"get_age_withdraw_info");
return true; /* well, kind-of */
}
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
return false;
/* generate idempotent reply */
TEH_METRICS_num_requests[TEH_MT_REQUEST_IDEMPOTENT_AGE_WITHDRAW]++;
*mret = reply_age_withdraw_success (rc->connection,
&commitment.h_commitment,
commitment.noreveal_index);
return true;
}
MHD_RESULT
TEH_handler_age_withdraw (struct TEH_RequestContext *rc,
const struct TALER_ReservePublicKeyP *reserve_pub,
const json_t *root)
{
MHD_RESULT mhd_ret;
struct AgeWithdrawContext awc;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("reserve_sig",
&awc.commitment.reserve_sig),
GNUNET_JSON_spec_fixed_auto ("h_commitment",
&awc.commitment.h_commitment),
TALER_JSON_spec_amount ("amount",
TEH_currency,
&awc.commitment.amount_with_fee),
GNUNET_JSON_spec_uint8 ("max_age_group",
&awc.commitment.max_age_group),
GNUNET_JSON_spec_end ()
};
memset (&awc, 0, sizeof (awc));
awc.commitment.reserve_pub = *reserve_pub;
/* Parse the JSON body */
{
enum GNUNET_GenericReturnValue res;
res = TALER_MHD_parse_json_data (rc->connection,
root,
spec);
if (GNUNET_OK != res)
return (GNUNET_SYSERR == res) ? MHD_NO : MHD_YES;
}
do {
/* If request was made before successfully, return the previous answer */
if (request_is_idempotent (rc,
&awc,
&mhd_ret))
break;
/* Verify the signature of the request body with the reserve key */
TEH_METRICS_num_verifications[TEH_MT_SIGNATURE_EDDSA]++;
if (GNUNET_OK !=
TALER_wallet_age_withdraw_verify (&awc.commitment.h_commitment,
&awc.commitment.amount_with_fee,
awc.commitment.max_age_group,
&awc.commitment.reserve_pub,
&awc.commitment.reserve_sig))
{
GNUNET_break_op (0);
mhd_ret = TALER_MHD_reply_with_error (rc->connection,
MHD_HTTP_FORBIDDEN,
TALER_EC_EXCHANGE_WITHDRAW_RESERVE_SIGNATURE_INVALID,
NULL);
break;
}
/* Run the transaction */
if (GNUNET_OK !=
TEH_DB_run_transaction (rc->connection,
"run age withdraw",
TEH_MT_REQUEST_AGE_WITHDRAW,
&mhd_ret,
&age_withdraw_transaction,
&awc))
break;
/* Clean up and send back final response */
GNUNET_JSON_parse_free (spec);
if (! awc.kyc.ok)
return TEH_RESPONSE_reply_kyc_required (rc->connection,
&awc.h_payto,
&awc.kyc);
return reply_age_withdraw_success (rc->connection,
&awc.commitment.h_commitment,
awc.commitment.noreveal_index);
} while(0);
GNUNET_JSON_parse_free (spec);
return mhd_ret;
}
/* end of taler-exchange-httpd_age-withdraw.c */

View File

@ -0,0 +1,47 @@
/*
This file is part of TALER
Copyright (C) 2023 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
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, see <http://www.gnu.org/licenses/>
*/
/**
* @file taler-exchange-httpd_age-withdraw.h
* @brief Handle /reserve/$RESERVE_PUB/age-withdraw requests
* @author Özgür Kesim
*/
#ifndef TALER_EXCHANGE_HTTPD_AGE_WITHDRAW_H
#define TALER_EXCHANGE_HTTPD_AGE_WITHDRAW_H
#include <microhttpd.h>
#include "taler-exchange-httpd.h"
/**
* Handle a "/reserves/$RESERVE_PUB/age-withdraw" request.
*
* Parses the batch of commitments to withdraw age restricted coins, and checks
* that the signature "reserve_sig" makes this a valid withdrawal request from
* the specified reserve. If the request is valid, the response contains a
* noreveal_index which the client has to use for the subsequent call to
* /age-withdraw/$ACH/reveal.
*
* @param rc request context
* @param root uploaded JSON data
* @param reserve_pub public key of the reserve
* @return MHD result code
*/
MHD_RESULT
TEH_handler_age_withdraw (struct TEH_RequestContext *rc,
const struct TALER_ReservePublicKeyP *reserve_pub,
const json_t *root);
#endif

View File

@ -0,0 +1,56 @@
/*
This file is part of TALER
Copyright (C) 2023 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
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, see <http://www.gnu.org/licenses/>
*/
/**
* @file taler-exchange-httpd_age-withdraw_reveal.h
* @brief Handle /age-withdraw/$ACH/reveal requests
* @author Özgür Kesim
*/
#ifndef TALER_EXCHANGE_HTTPD_AGE_WITHDRAW_H
#define TALER_EXCHANGE_HTTPD_AGE_WITHDRAW_H
#include <microhttpd.h>
#include "taler-exchange-httpd.h"
/**
* Handle a "/age-withdraw/$ACH/reveal" request.
*
* The client got a noreveal_index in response to a previous request
* /reserve/$RESERVE_PUB/age-withdraw. It now has to reveal all n*(kappa-1)
* coin's private keys (except for the noreveal_index), from which all other
* coin-relevant data (blinding, age restriction, nonce) is derived from.
*
* The exchange computes those values, ensures that the maximum age is
* correctly applied, calculates the hash of the blinded envelopes, and -
* together with the non-disclosed blinded envelopes - compares the hash of
* those against the original commitment $ACH.
*
* If all those checks and the used denominations turn out to be correct, the
* exchange signs all blinded envelopes with their appropriate denomination
* keys.
*
* @param rc request context
* @param root uploaded JSON data
* @param ach commitment to the age restricted coints from the age-withdraw request
* @return MHD result code
*/
MHD_RESULT
TEH_handler_age_withdraw_reveal (
struct TEH_RequestContext *rc,
const struct TALER_AgeRestrictedCoinsCommitmentP *ach,
const json_t *root);
#endif

View File

@ -37,7 +37,7 @@ TEH_make_coin_known (const struct TALER_CoinPublicInfo *coin,
{
enum TALER_EXCHANGEDB_CoinKnownStatus cks;
struct TALER_DenominationHashP h_denom_pub;
struct TALER_AgeCommitmentHash age_hash;
struct TALER_AgeCommitmentHashP age_hash;
/* make sure coin is 'known' in database */
cks = TEH_plugin->ensure_coin_known (TEH_plugin->cls,

View File

@ -169,6 +169,7 @@ TEH_kyc_proof_cleanup (void)
* @param provider_user_id set to user ID at the provider, or NULL if not supported or unknown
* @param provider_legitimization_id set to legitimization process ID at the provider, or NULL if not supported or unknown
* @param expiration until when is the KYC check valid
* @param attributes user attributes returned by the provider
* @param http_status HTTP status code of @a response
* @param[in] response to return to the HTTP client
*/
@ -179,6 +180,7 @@ proof_cb (
const char *provider_user_id,
const char *provider_legitimization_id,
struct GNUNET_TIME_Absolute expiration,
const json_t *attributes,
unsigned int http_status,
struct MHD_Response *response)
{
@ -194,6 +196,7 @@ proof_cb (
{
enum GNUNET_DB_QueryStatus qs;
// FIXME: also store 'attributes' in DB!
qs = TEH_plugin->update_kyc_process_by_row (TEH_plugin->cls,
kpc->process_row,
kpc->provider_section,

View File

@ -34,18 +34,20 @@ enum TEH_MetricTypeRequest
TEH_MT_REQUEST_OTHER = 0,
TEH_MT_REQUEST_DEPOSIT = 1,
TEH_MT_REQUEST_WITHDRAW = 2,
TEH_MT_REQUEST_MELT = 3,
TEH_MT_REQUEST_PURSE_CREATE = 4,
TEH_MT_REQUEST_PURSE_MERGE = 5,
TEH_MT_REQUEST_RESERVE_PURSE = 6,
TEH_MT_REQUEST_PURSE_DEPOSIT = 7,
TEH_MT_REQUEST_IDEMPOTENT_DEPOSIT = 8,
TEH_MT_REQUEST_IDEMPOTENT_WITHDRAW = 9,
TEH_MT_REQUEST_IDEMPOTENT_MELT = 10,
TEH_MT_REQUEST_IDEMPOTENT_BATCH_WITHDRAW = 11,
TEH_MT_REQUEST_BATCH_DEPOSIT = 12,
TEH_MT_REQUEST_POLICY_FULFILLMENT = 13,
TEH_MT_REQUEST_COUNT = 14 /* MUST BE LAST! */
TEH_MT_REQUEST_AGE_WITHDRAW = 3,
TEH_MT_REQUEST_MELT = 4,
TEH_MT_REQUEST_PURSE_CREATE = 5,
TEH_MT_REQUEST_PURSE_MERGE = 6,
TEH_MT_REQUEST_RESERVE_PURSE = 7,
TEH_MT_REQUEST_PURSE_DEPOSIT = 8,
TEH_MT_REQUEST_IDEMPOTENT_DEPOSIT = 9,
TEH_MT_REQUEST_IDEMPOTENT_WITHDRAW = 10,
TEH_MT_REQUEST_IDEMPOTENT_AGE_WITHDRAW = 11,
TEH_MT_REQUEST_IDEMPOTENT_MELT = 12,
TEH_MT_REQUEST_IDEMPOTENT_BATCH_WITHDRAW = 13,
TEH_MT_REQUEST_BATCH_DEPOSIT = 14,
TEH_MT_REQUEST_POLICY_FULFILLMENT = 15,
TEH_MT_REQUEST_COUNT = 16 /* MUST BE LAST! */
};
/**
@ -55,10 +57,11 @@ enum TEH_MetricTypeSuccess
{
TEH_MT_SUCCESS_DEPOSIT = 0,
TEH_MT_SUCCESS_WITHDRAW = 1,
TEH_MT_SUCCESS_BATCH_WITHDRAW = 2,
TEH_MT_SUCCESS_MELT = 3,
TEH_MT_SUCCESS_REFRESH_REVEAL = 4,
TEH_MT_SUCCESS_COUNT = 5 /* MUST BE LAST! */
TEH_MT_SUCCESS_AGE_WITHDRAW = 2,
TEH_MT_SUCCESS_BATCH_WITHDRAW = 3,
TEH_MT_SUCCESS_MELT = 4,
TEH_MT_SUCCESS_REFRESH_REVEAL = 5,
TEH_MT_SUCCESS_COUNT = 6 /* MUST BE LAST! */
};
/**

View File

@ -260,7 +260,7 @@ create_transaction (void *cls,
struct TALER_CoinSpendPublicKeyP coin_pub;
struct TALER_CoinSpendSignatureP coin_sig;
struct TALER_DenominationHashP h_denom_pub;
struct TALER_AgeCommitmentHash phac;
struct TALER_AgeCommitmentHashP phac;
char *partner_url = NULL;
TEH_plugin->rollback (TEH_plugin->cls);

View File

@ -222,7 +222,7 @@ deposit_transaction (void *cls,
struct TALER_CoinSpendPublicKeyP coin_pub;
struct TALER_CoinSpendSignatureP coin_sig;
struct TALER_DenominationHashP h_denom_pub;
struct TALER_AgeCommitmentHash phac;
struct TALER_AgeCommitmentHashP phac;
char *partner_url = NULL;
TEH_plugin->rollback (TEH_plugin->cls);

View File

@ -263,8 +263,8 @@ check_commitment (struct RevealContext *rctx,
const struct TALER_TransferPrivateKeyP *tpriv
= &rctx->transfer_privs[i - off];
struct TALER_TransferSecretP ts;
struct TALER_AgeCommitmentHash h = {0};
struct TALER_AgeCommitmentHash *hac = NULL;
struct TALER_AgeCommitmentHashP h = {0};
struct TALER_AgeCommitmentHashP *hac = NULL;
GNUNET_CRYPTO_ecdhe_key_get_public (&tpriv->ecdhe_priv,
&rce->transfer_pub.ecdhe_pub);
@ -657,11 +657,11 @@ resolve_refreshes_reveal_denominations (
/* Sanity check: Compare hash from melting with hash of this age commitment */
{
struct TALER_AgeCommitmentHash hac = {0};
struct TALER_AgeCommitmentHashP hac = {0};
TALER_age_commitment_hash (oac, &hac);
if (0 != memcmp (&hac,
&rctx->melt.session.coin.h_age_commitment,
sizeof(struct TALER_AgeCommitmentHash)))
sizeof(struct TALER_AgeCommitmentHashP)))
goto clean_age;
}

View File

@ -129,7 +129,7 @@ TEH_RESPONSE_compile_transaction_history (
{
const struct TALER_EXCHANGEDB_MeltListEntry *melt =
pos->details.melt;
const struct TALER_AgeCommitmentHash *phac = NULL;
const struct TALER_AgeCommitmentHashP *phac = NULL;
#if ENABLE_SANITY_CHECKS
TEH_METRICS_num_verifications[TEH_MT_SIGNATURE_EDDSA]++;
@ -391,7 +391,7 @@ TEH_RESPONSE_compile_transaction_history (
{
struct TALER_EXCHANGEDB_PurseDepositListEntry *pd
= pos->details.purse_deposit;
const struct TALER_AgeCommitmentHash *phac = NULL;
const struct TALER_AgeCommitmentHashP *phac = NULL;
if (! pd->no_age_commitment)
phac = &pd->h_age_commitment;

View File

@ -28,10 +28,10 @@
enum TALER_EXCHANGEDB_CoinKnownStatus
TEH_PG_ensure_coin_known (void *cls,
const struct TALER_CoinPublicInfo *coin,
uint64_t *known_coin_id,
struct TALER_DenominationHashP *denom_hash,
struct TALER_AgeCommitmentHash *h_age_commitment)
const struct TALER_CoinPublicInfo *coin,
uint64_t *known_coin_id,
struct TALER_DenominationHashP *denom_hash,
struct TALER_AgeCommitmentHashP *h_age_commitment)
{
struct PostgresClosure *pg = cls;
enum GNUNET_DB_QueryStatus qs;
@ -60,12 +60,12 @@ TEH_PG_ensure_coin_known (void *cls,
&is_age_hash_null),
GNUNET_PQ_result_spec_end
};
/* Used in #postgres_insert_known_coin() to store the denomination public
key and signature for a coin known to the exchange.
/* Used in #postgres_insert_known_coin() to store the denomination public
key and signature for a coin known to the exchange.
See also:
https://stackoverflow.com/questions/34708509/how-to-use-returning-with-on-conflict-in-postgresql/37543015#37543015
*/
See also:
https://stackoverflow.com/questions/34708509/how-to-use-returning-with-on-conflict-in-postgresql/37543015#37543015
*/
PREPARE (pg,
"insert_known_coin",
"WITH dd"

View File

@ -37,9 +37,9 @@
*/
enum TALER_EXCHANGEDB_CoinKnownStatus
TEH_PG_ensure_coin_known (void *cls,
const struct TALER_CoinPublicInfo *coin,
uint64_t *known_coin_id,
struct TALER_DenominationHashP *denom_hash,
struct TALER_AgeCommitmentHash *h_age_commitment);
const struct TALER_CoinPublicInfo *coin,
uint64_t *known_coin_id,
struct TALER_DenominationHashP *denom_hash,
struct TALER_AgeCommitmentHashP *h_age_commitment);
#endif

View File

@ -32,7 +32,7 @@ TEH_PG_get_purse_deposit (
const struct TALER_CoinSpendPublicKeyP *coin_pub,
struct TALER_Amount *amount,
struct TALER_DenominationHashP *h_denom_pub,
struct TALER_AgeCommitmentHash *phac,
struct TALER_AgeCommitmentHashP *phac,
struct TALER_CoinSpendSignatureP *coin_sig,
char **partner_url)
{
@ -61,7 +61,7 @@ TEH_PG_get_purse_deposit (
*partner_url = NULL;
/* Used in #postgres_get_purse_deposit */
/* Used in #postgres_get_purse_deposit */
PREPARE (pg,
"select_purse_deposit_by_coin_pub",
"SELECT "

View File

@ -46,7 +46,7 @@ TEH_PG_get_purse_deposit (
const struct TALER_CoinSpendPublicKeyP *coin_pub,
struct TALER_Amount *amount,
struct TALER_DenominationHashP *h_denom_pub,
struct TALER_AgeCommitmentHash *phac,
struct TALER_AgeCommitmentHashP *phac,
struct TALER_CoinSpendSignatureP *coin_sig,
char **partner_url);

View File

@ -75,7 +75,7 @@ refreshs_serial_helper_cb (void *cls,
struct TALER_DenominationPublicKey denom_pub;
struct TALER_CoinSpendPublicKeyP coin_pub;
struct TALER_CoinSpendSignatureP coin_sig;
struct TALER_AgeCommitmentHash h_age_commitment;
struct TALER_AgeCommitmentHashP h_age_commitment;
bool ac_isnull;
struct TALER_Amount amount_with_fee;
uint32_t noreveal_index;
@ -130,10 +130,6 @@ refreshs_serial_helper_cb (void *cls,
}
enum GNUNET_DB_QueryStatus
TEH_PG_select_refreshes_above_serial_id (
void *cls,
@ -153,8 +149,8 @@ TEH_PG_select_refreshes_above_serial_id (
.status = GNUNET_OK
};
enum GNUNET_DB_QueryStatus qs;
/* Used in #postgres_select_refreshes_above_serial_id() to fetch
refresh session with id '\geq' the given parameter */
/* Used in #postgres_select_refreshes_above_serial_id() to fetch
refresh session with id '\geq' the given parameter */
PREPARE (pg,
"audit_get_refresh_commitments_incr",
"SELECT"

View File

@ -449,7 +449,7 @@ audit_refresh_session_cb (
void *cls,
uint64_t rowid,
const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_AgeCommitmentHash *h_age_commitment,
const struct TALER_AgeCommitmentHashP *h_age_commitment,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_CoinSpendSignatureP *coin_sig,
const struct TALER_Amount *amount_with_fee,
@ -1340,8 +1340,8 @@ run (void *cls)
{
struct TALER_PlanchetDetail pd;
struct TALER_CoinSpendPublicKeyP coin_pub;
struct TALER_AgeCommitmentHash age_hash;
struct TALER_AgeCommitmentHash *p_ah[2] = {
struct TALER_AgeCommitmentHashP age_hash;
struct TALER_AgeCommitmentHashP *p_ah[2] = {
NULL,
&age_hash
};
@ -1465,7 +1465,7 @@ run (void *cls)
deadline = GNUNET_TIME_timestamp_get ();
{
struct TALER_DenominationHashP dph;
struct TALER_AgeCommitmentHash agh;
struct TALER_AgeCommitmentHashP agh;
FAILIF (TALER_EXCHANGEDB_CKS_ADDED !=
plugin->ensure_coin_known (plugin->cls,
@ -1713,7 +1713,7 @@ run (void *cls)
uint64_t new_known_coin_id;
struct TALER_CoinPublicInfo new_coin;
struct TALER_DenominationHashP dph;
struct TALER_AgeCommitmentHash agh;
struct TALER_AgeCommitmentHashP agh;
bool recoup_ok;
bool internal_failure;
@ -2086,7 +2086,7 @@ run (void *cls)
{
uint64_t known_coin_id;
struct TALER_DenominationHashP dph;
struct TALER_AgeCommitmentHash agh;
struct TALER_AgeCommitmentHashP agh;
FAILIF (TALER_EXCHANGEDB_CKS_ADDED !=
plugin->ensure_coin_known (plugin->cls,

View File

@ -37,7 +37,7 @@ static int result;
*/
#define FAILIF(cond) \
do { \
if (! (cond)) {break;} \
if (! (cond)) {break;} \
GNUNET_break (0); \
goto drop; \
} while (0)
@ -183,6 +183,7 @@ create_denom_key_pair (unsigned int size,
return dkp;
}
/**
* Function called with the session hashes and transfer secret
* information for a given coin.
@ -223,7 +224,6 @@ handle_link_data_cb (void *cls,
}
/**
* Main function that will be run by the scheduler.
*
@ -238,25 +238,25 @@ run (void *cls)
struct GNUNET_CONFIGURATION_Handle *cfg = cls;
const uint32_t num_partitions = 10;
struct DenomKeyPair *dkp = NULL;
struct TALER_EXCHANGEDB_Deposit *depos=NULL;
struct TALER_EXCHANGEDB_Deposit *depos = NULL;
struct TALER_Amount value;
struct TALER_DenominationPublicKey *new_denom_pubs = NULL;
struct GNUNET_TIME_Relative times = GNUNET_TIME_UNIT_ZERO;
unsigned long long sqrs=0;
struct TALER_EXCHANGEDB_Refund *ref=NULL;
unsigned long long sqrs = 0;
struct TALER_EXCHANGEDB_Refund *ref = NULL;
unsigned int *perm;
unsigned long long duration_sq;
struct TALER_EXCHANGEDB_RefreshRevealedCoin *ccoin;
struct TALER_ExchangeWithdrawValues alg_values = {
.cipher = TALER_DENOMINATION_RSA
};
};
ref = GNUNET_new_array (ROUNDS +1,
ref = GNUNET_new_array (ROUNDS + 1,
struct TALER_EXCHANGEDB_Refund);
depos = GNUNET_new_array (ROUNDS +1,
depos = GNUNET_new_array (ROUNDS + 1,
struct TALER_EXCHANGEDB_Deposit);
refresh = GNUNET_new_array (ROUNDS +1,
struct TALER_EXCHANGEDB_Refresh);
refresh = GNUNET_new_array (ROUNDS + 1,
struct TALER_EXCHANGEDB_Refresh);
if (NULL ==
(plugin = TALER_EXCHANGEDB_plugin_load (cfg)))
@ -297,140 +297,140 @@ run (void *cls)
GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount (CURRENCY ":0.000010",
&fees.refund));
//DENOMINATION
// DENOMINATION
{
//PAIR KEY LIST
// PAIR KEY LIST
new_dkp = GNUNET_new_array (MELT_NEW_COINS,
struct DenomKeyPair *);
//PUBLIC KEY LIST
struct DenomKeyPair *);
// PUBLIC KEY LIST
new_denom_pubs = GNUNET_new_array (MELT_NEW_COINS,
struct TALER_DenominationPublicKey);
//REFRESH REVEAL COIN LIST
// REFRESH REVEAL COIN LIST
revealed_coins
= GNUNET_new_array (MELT_NEW_COINS,
struct TALER_EXCHANGEDB_RefreshRevealedCoin);
for (unsigned int cnt = 0; cnt < MELT_NEW_COINS; cnt++)
{
struct GNUNET_TIME_Timestamp now;
struct TALER_BlindedRsaPlanchet *rp;
struct TALER_BlindedPlanchet *bp;
{
struct GNUNET_TIME_Timestamp now;
struct TALER_BlindedRsaPlanchet *rp;
struct TALER_BlindedPlanchet *bp;
now = GNUNET_TIME_timestamp_get ();
//5 KEY PAIR
new_dkp[cnt] = create_denom_key_pair (RSA_KEY_SIZE,
now,
&value,
&fees);
GNUNET_assert (NULL != new_dkp[cnt]);
new_denom_pubs[cnt] = new_dkp[cnt]->pub;
ccoin = &revealed_coins[cnt];
bp = &ccoin->blinded_planchet;
bp->cipher = TALER_DENOMINATION_RSA;
rp = &bp->details.rsa_blinded_planchet;
rp->blinded_msg_size = 1 + (size_t) GNUNET_CRYPTO_random_u64 (
GNUNET_CRYPTO_QUALITY_WEAK,
(RSA_KEY_SIZE / 8) - 1);
rp->blinded_msg = GNUNET_malloc (rp->blinded_msg_size);
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
rp->blinded_msg,
rp->blinded_msg_size);
TALER_denom_pub_hash (&new_dkp[cnt]->pub,
&ccoin->h_denom_pub);
ccoin->exchange_vals = alg_values;
TALER_coin_ev_hash (bp,
&ccoin->h_denom_pub,
&ccoin->coin_envelope_hash);
GNUNET_assert (GNUNET_OK ==
now = GNUNET_TIME_timestamp_get ();
// 5 KEY PAIR
new_dkp[cnt] = create_denom_key_pair (RSA_KEY_SIZE,
now,
&value,
&fees);
GNUNET_assert (NULL != new_dkp[cnt]);
new_denom_pubs[cnt] = new_dkp[cnt]->pub;
ccoin = &revealed_coins[cnt];
bp = &ccoin->blinded_planchet;
bp->cipher = TALER_DENOMINATION_RSA;
rp = &bp->details.rsa_blinded_planchet;
rp->blinded_msg_size = 1 + (size_t) GNUNET_CRYPTO_random_u64 (
GNUNET_CRYPTO_QUALITY_WEAK,
(RSA_KEY_SIZE / 8) - 1);
rp->blinded_msg = GNUNET_malloc (rp->blinded_msg_size);
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
rp->blinded_msg,
rp->blinded_msg_size);
TALER_denom_pub_hash (&new_dkp[cnt]->pub,
&ccoin->h_denom_pub);
ccoin->exchange_vals = alg_values;
TALER_coin_ev_hash (bp,
&ccoin->h_denom_pub,
&ccoin->coin_envelope_hash);
GNUNET_assert (GNUNET_OK ==
TALER_denom_sign_blinded (&ccoin->coin_sig,
&new_dkp[cnt]->priv,
true,
bp));
}
}
}
perm = GNUNET_CRYPTO_random_permute (GNUNET_CRYPTO_QUALITY_NONCE,
NUM_ROWS);
//BEGIN
// BEGIN
FAILIF (GNUNET_OK !=
plugin->start (plugin->cls,
"Transaction"));
for (unsigned int j = 0; j < NUM_ROWS; j++)
{
union TALER_DenominationBlindingKeyP bks;
struct TALER_CoinSpendPublicKeyP coin_pub;
struct TALER_CoinPubHashP c_hash;
unsigned int k = (unsigned int)rand()%5;
unsigned int i = perm[j];
if (i >= ROUNDS)
i = ROUNDS; /* throw-away slot, do not keep around */
RND_BLK (&coin_pub);
RND_BLK (&c_hash);
{
union TALER_DenominationBlindingKeyP bks;
struct TALER_CoinSpendPublicKeyP coin_pub;
struct TALER_CoinPubHashP c_hash;
unsigned int k = (unsigned int) rand () % 5;
unsigned int i = perm[j];
if (i >= ROUNDS)
i = ROUNDS; /* throw-away slot, do not keep around */
RND_BLK (&coin_pub);
RND_BLK (&c_hash);
RND_BLK (&depos[i].coin.coin_pub);
TALER_denom_pub_hash (&new_dkp[k]->pub,
&depos[i].coin.denom_pub_hash);
GNUNET_assert (GNUNET_OK ==
TALER_denom_sig_unblind (&depos[i].coin.denom_sig,
&ccoin->coin_sig,
&bks,
&c_hash,
&alg_values,
&new_dkp[k]->pub));
{
/* ENSURE_COIN_KNOWN */
uint64_t known_coin_id;
struct TALER_DenominationHashP dph;
struct TALER_AgeCommitmentHash agh;
bool zombie_required = false;
bool balance_ok;
FAILIF (TALER_EXCHANGEDB_CKS_ADDED !=
plugin->ensure_coin_known (plugin->cls,
&depos[i].coin,
&known_coin_id,
&dph,
&agh));
/**** INSERT REFRESH COMMITMENTS ****/
refresh[i].coin = depos[i].coin;
RND_BLK (&refresh[i].coin_sig);
RND_BLK (&refresh[i].rc);
refresh[i].amount_with_fee = value;
refresh[i].noreveal_index = MELT_NOREVEAL_INDEX;
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->do_melt (plugin->cls,
NULL,
&refresh[i],
known_coin_id,
&zombie_required,
&balance_ok));
FAILIF (! balance_ok);
FAILIF (zombie_required);
}
/**** INSERT REFRESH_REVEAL + TRANSFER_KEYS *****/
RND_BLK (&tprivs);
RND_BLK (&tpub);
RND_BLK(&melt_serial_id);
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->insert_refresh_reveal (plugin->cls,
melt_serial_id,
MELT_NEW_COINS,
revealed_coins,
TALER_CNC_KAPPA - 1,
tprivs,
&tpub));
if (ROUNDS == i)
TALER_denom_sig_free (&depos[i].coin.denom_sig);
RND_BLK (&depos[i].coin.coin_pub);
TALER_denom_pub_hash (&new_dkp[k]->pub,
&depos[i].coin.denom_pub_hash);
GNUNET_assert (GNUNET_OK ==
TALER_denom_sig_unblind (&depos[i].coin.denom_sig,
&ccoin->coin_sig,
&bks,
&c_hash,
&alg_values,
&new_dkp[k]->pub));
{
/* ENSURE_COIN_KNOWN */
uint64_t known_coin_id;
struct TALER_DenominationHashP dph;
struct TALER_AgeCommitmentHashP agh;
bool zombie_required = false;
bool balance_ok;
FAILIF (TALER_EXCHANGEDB_CKS_ADDED !=
plugin->ensure_coin_known (plugin->cls,
&depos[i].coin,
&known_coin_id,
&dph,
&agh));
/**** INSERT REFRESH COMMITMENTS ****/
refresh[i].coin = depos[i].coin;
RND_BLK (&refresh[i].coin_sig);
RND_BLK (&refresh[i].rc);
refresh[i].amount_with_fee = value;
refresh[i].noreveal_index = MELT_NOREVEAL_INDEX;
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->do_melt (plugin->cls,
NULL,
&refresh[i],
known_coin_id,
&zombie_required,
&balance_ok));
FAILIF (! balance_ok);
FAILIF (zombie_required);
}
/**** INSERT REFRESH_REVEAL + TRANSFER_KEYS *****/
RND_BLK (&tprivs);
RND_BLK (&tpub);
RND_BLK (&melt_serial_id);
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->insert_refresh_reveal (plugin->cls,
melt_serial_id,
MELT_NEW_COINS,
revealed_coins,
TALER_CNC_KAPPA - 1,
tprivs,
&tpub));
if (ROUNDS == i)
TALER_denom_sig_free (&depos[i].coin.denom_sig);
}
/* End of benchmark setup */
GNUNET_free(perm);
GNUNET_free (perm);
// commit
FAILIF (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS !=
plugin->commit (plugin->cls));
/**** CALL GET LINK DATA ****/
for (unsigned int r=0; r< ROUNDS; r++)
for (unsigned int r = 0; r< ROUNDS; r++)
{
struct GNUNET_TIME_Absolute time;
struct GNUNET_TIME_Relative duration;
enum GNUNET_DB_QueryStatus qs;
time = GNUNET_TIME_absolute_get();
time = GNUNET_TIME_absolute_get ();
qs = plugin->get_link_data (plugin->cls,
&refresh[r].coin.coin_pub,
&handle_link_data_cb,
@ -441,7 +441,8 @@ run (void *cls)
times = GNUNET_TIME_relative_add (times,
duration);
duration_sq = duration.rel_value_us * duration.rel_value_us;
GNUNET_assert (duration_sq / duration.rel_value_us == duration.rel_value_us);
GNUNET_assert (duration_sq / duration.rel_value_us ==
duration.rel_value_us);
GNUNET_assert (sqrs + duration_sq >= sqrs);
sqrs += duration_sq;
}
@ -456,15 +457,15 @@ run (void *cls)
ROUNDS);
avg_dbl = avg.rel_value_us;
variance = sqrs - (avg_dbl * avg_dbl * ROUNDS);
fprintf(stdout,
"%8llu ± %6.0f\n",
(unsigned long long) avg.rel_value_us,
sqrt (variance / (ROUNDS-1)));
fprintf (stdout,
"%8llu ± %6.0f\n",
(unsigned long long) avg.rel_value_us,
sqrt (variance / (ROUNDS - 1)));
}
result = 0;
drop:
GNUNET_break (GNUNET_OK ==
plugin->drop_tables (plugin->cls));
plugin->drop_tables (plugin->cls));
cleanup:
if (NULL != dkp)
destroy_denom_key_pair (dkp);
@ -484,13 +485,13 @@ cleanup:
cnt++)
destroy_denom_key_pair (new_dkp[cnt]);
GNUNET_free (new_dkp);
for (unsigned int i=0; i< ROUNDS; i++)
{
TALER_denom_sig_free (&depos[i].coin.denom_sig);
}
GNUNET_free(depos);
GNUNET_free(ref);
GNUNET_free(refresh);
for (unsigned int i = 0; i< ROUNDS; i++)
{
TALER_denom_sig_free (&depos[i].coin.denom_sig);
}
GNUNET_free (depos);
GNUNET_free (ref);
GNUNET_free (refresh);
dkp = NULL;
TALER_EXCHANGEDB_plugin_unload (plugin);
plugin = NULL;

View File

@ -37,7 +37,7 @@ static int result;
*/
#define FAILIF(cond) \
do { \
if (! (cond)) {break;} \
if (! (cond)) {break;} \
GNUNET_break (0); \
goto drop; \
} while (0)
@ -183,8 +183,6 @@ create_denom_key_pair (unsigned int size,
}
/**
* Main function that will be run by the scheduler.
*
@ -201,19 +199,19 @@ run (void *cls)
struct TALER_EXCHANGEDB_CollectableBlindcoin cbc;
struct TALER_DenominationPublicKey *new_denom_pubs = NULL;
struct GNUNET_TIME_Relative times = GNUNET_TIME_UNIT_ZERO;
unsigned long long sqrs=0;
struct TALER_EXCHANGEDB_Deposit *depos=NULL;
struct TALER_EXCHANGEDB_Refund *ref=NULL;
unsigned long long sqrs = 0;
struct TALER_EXCHANGEDB_Deposit *depos = NULL;
struct TALER_EXCHANGEDB_Refund *ref = NULL;
unsigned int *perm;
unsigned long long duration_sq;
struct TALER_EXCHANGEDB_RefreshRevealedCoin *ccoin;
struct TALER_ExchangeWithdrawValues alg_values = {
.cipher = TALER_DENOMINATION_RSA
};
};
ref = GNUNET_new_array (ROUNDS +1,
ref = GNUNET_new_array (ROUNDS + 1,
struct TALER_EXCHANGEDB_Refund);
depos = GNUNET_new_array (ROUNDS +1,
depos = GNUNET_new_array (ROUNDS + 1,
struct TALER_EXCHANGEDB_Deposit);
if (NULL ==
@ -255,183 +253,183 @@ run (void *cls)
GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount (CURRENCY ":0.000010",
&fees.refund));
//DENOMINATION
// DENOMINATION
{
ZR_BLK (&cbc);
//PAIR KEY LIST
// PAIR KEY LIST
new_dkp = GNUNET_new_array (MELT_NEW_COINS,
struct DenomKeyPair *);
//PUBLIC KEY LIST
struct DenomKeyPair *);
// PUBLIC KEY LIST
new_denom_pubs = GNUNET_new_array (MELT_NEW_COINS,
struct TALER_DenominationPublicKey);
//REFRESH REVEAL COIN LIST
// REFRESH REVEAL COIN LIST
revealed_coins
= GNUNET_new_array (MELT_NEW_COINS,
struct TALER_EXCHANGEDB_RefreshRevealedCoin);
for (unsigned int cnt = 0; cnt < MELT_NEW_COINS; cnt++)
{
struct GNUNET_TIME_Timestamp now;
struct TALER_BlindedRsaPlanchet *rp;
struct TALER_BlindedPlanchet *bp;
{
struct GNUNET_TIME_Timestamp now;
struct TALER_BlindedRsaPlanchet *rp;
struct TALER_BlindedPlanchet *bp;
now = GNUNET_TIME_timestamp_get ();
//5 KEY PAIR
new_dkp[cnt] = create_denom_key_pair (RSA_KEY_SIZE,
now,
&value,
&fees);
GNUNET_assert (NULL != new_dkp[cnt]);
new_denom_pubs[cnt] = new_dkp[cnt]->pub;
ccoin = &revealed_coins[cnt];
bp = &ccoin->blinded_planchet;
bp->cipher = TALER_DENOMINATION_RSA;
rp = &bp->details.rsa_blinded_planchet;
rp->blinded_msg_size = 1 + (size_t) GNUNET_CRYPTO_random_u64 (
GNUNET_CRYPTO_QUALITY_WEAK,
(RSA_KEY_SIZE / 8) - 1);
rp->blinded_msg = GNUNET_malloc (rp->blinded_msg_size);
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
rp->blinded_msg,
rp->blinded_msg_size);
TALER_denom_pub_hash (&new_dkp[cnt]->pub,
&ccoin->h_denom_pub);
ccoin->exchange_vals = alg_values;
TALER_coin_ev_hash (bp,
&ccoin->h_denom_pub,
&ccoin->coin_envelope_hash);
GNUNET_assert (GNUNET_OK ==
now = GNUNET_TIME_timestamp_get ();
// 5 KEY PAIR
new_dkp[cnt] = create_denom_key_pair (RSA_KEY_SIZE,
now,
&value,
&fees);
GNUNET_assert (NULL != new_dkp[cnt]);
new_denom_pubs[cnt] = new_dkp[cnt]->pub;
ccoin = &revealed_coins[cnt];
bp = &ccoin->blinded_planchet;
bp->cipher = TALER_DENOMINATION_RSA;
rp = &bp->details.rsa_blinded_planchet;
rp->blinded_msg_size = 1 + (size_t) GNUNET_CRYPTO_random_u64 (
GNUNET_CRYPTO_QUALITY_WEAK,
(RSA_KEY_SIZE / 8) - 1);
rp->blinded_msg = GNUNET_malloc (rp->blinded_msg_size);
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
rp->blinded_msg,
rp->blinded_msg_size);
TALER_denom_pub_hash (&new_dkp[cnt]->pub,
&ccoin->h_denom_pub);
ccoin->exchange_vals = alg_values;
TALER_coin_ev_hash (bp,
&ccoin->h_denom_pub,
&ccoin->coin_envelope_hash);
GNUNET_assert (GNUNET_OK ==
TALER_denom_sign_blinded (&ccoin->coin_sig,
&new_dkp[cnt]->priv,
true,
bp));
GNUNET_assert (GNUNET_OK ==
TALER_coin_ev_hash (bp,
&cbc.denom_pub_hash,
&cbc.h_coin_envelope));
GNUNET_assert (
GNUNET_OK ==
TALER_denom_sign_blinded (
&cbc.sig,
&new_dkp[cnt]->priv,
false,
bp));
}
GNUNET_assert (GNUNET_OK ==
TALER_coin_ev_hash (bp,
&cbc.denom_pub_hash,
&cbc.h_coin_envelope));
GNUNET_assert (
GNUNET_OK ==
TALER_denom_sign_blinded (
&cbc.sig,
&new_dkp[cnt]->priv,
false,
bp));
}
}
perm = GNUNET_CRYPTO_random_permute (GNUNET_CRYPTO_QUALITY_NONCE,
NUM_ROWS);
//BEGIN
// BEGIN
FAILIF (GNUNET_OK !=
plugin->start (plugin->cls,
"Transaction"));
for (unsigned int j = 0; j < NUM_ROWS; j++)
{
/*** NEED TO INSERT REFRESH COMMITMENTS + ENSURECOIN ***/
union TALER_DenominationBlindingKeyP bks;
struct GNUNET_TIME_Timestamp deadline;
struct TALER_CoinSpendPublicKeyP coin_pub;
struct TALER_ReservePublicKeyP reserve_pub;
struct TALER_CoinPubHashP c_hash;
unsigned int k = (unsigned int) rand () % 5;
unsigned int i = perm[j];
if (i >= ROUNDS)
i = ROUNDS; /* throw-away slot, do not keep around */
depos[i].deposit_fee = fees.deposit;
RND_BLK (&coin_pub);
RND_BLK (&c_hash);
RND_BLK (&reserve_pub);
RND_BLK (&cbc.reserve_sig);
TALER_denom_pub_hash (&new_dkp[k]->pub,
&cbc.denom_pub_hash);
deadline = GNUNET_TIME_timestamp_get ();
RND_BLK (&depos[i].coin.coin_pub);
TALER_denom_pub_hash (&new_dkp[k]->pub,
&depos[i].coin.denom_pub_hash);
GNUNET_assert (GNUNET_OK ==
TALER_denom_sig_unblind (&depos[i].coin.denom_sig,
&ccoin->coin_sig,
&bks,
&c_hash,
&alg_values,
&new_dkp[k]->pub));
RND_BLK (&depos[i].merchant_pub);
RND_BLK (&depos[i].csig);
RND_BLK (&depos[i].h_contract_terms);
RND_BLK (&depos[i].wire_salt);
depos[i].amount_with_fee = value;
depos[i].refund_deadline = deadline;
depos[i].wire_deadline = deadline;
depos[i].receiver_wire_account =
"payto://iban/DE67830654080004822650?receiver-name=Test";
TALER_merchant_wire_signature_hash (
"payto://iban/DE67830654080004822650?receiver-name=Test",
&depos[i].wire_salt,
&h_wire_wt);
cbc.reserve_pub = reserve_pub;
cbc.amount_with_fee = value;
GNUNET_assert (GNUNET_OK ==
TALER_amount_set_zero (CURRENCY,
&cbc.withdraw_fee));
{
/*** NEED TO INSERT REFRESH COMMITMENTS + ENSURECOIN ***/
union TALER_DenominationBlindingKeyP bks;
struct GNUNET_TIME_Timestamp deadline;
struct TALER_CoinSpendPublicKeyP coin_pub;
struct TALER_ReservePublicKeyP reserve_pub;
struct TALER_CoinPubHashP c_hash;
unsigned int k = (unsigned int)rand()%5;
unsigned int i = perm[j];
if (i >= ROUNDS)
i = ROUNDS; /* throw-away slot, do not keep around */
depos[i].deposit_fee = fees.deposit;
RND_BLK (&coin_pub);
RND_BLK (&c_hash);
RND_BLK (&reserve_pub);
RND_BLK (&cbc.reserve_sig);
TALER_denom_pub_hash (&new_dkp[k]->pub,
&cbc.denom_pub_hash);
deadline = GNUNET_TIME_timestamp_get ();
RND_BLK (&depos[i].coin.coin_pub);
TALER_denom_pub_hash (&new_dkp[k]->pub,
&depos[i].coin.denom_pub_hash);
GNUNET_assert (GNUNET_OK ==
TALER_denom_sig_unblind (&depos[i].coin.denom_sig,
&ccoin->coin_sig,
&bks,
&c_hash,
&alg_values,
&new_dkp[k]->pub));
RND_BLK (&depos[i].merchant_pub);
RND_BLK (&depos[i].csig);
RND_BLK (&depos[i].h_contract_terms);
RND_BLK (&depos[i].wire_salt);
depos[i].amount_with_fee = value;
depos[i].refund_deadline = deadline;
depos[i].wire_deadline = deadline;
depos[i].receiver_wire_account =
"payto://iban/DE67830654080004822650?receiver-name=Test";
TALER_merchant_wire_signature_hash (
"payto://iban/DE67830654080004822650?receiver-name=Test",
&depos[i].wire_salt,
&h_wire_wt);
cbc.reserve_pub = reserve_pub;
cbc.amount_with_fee = value;
GNUNET_assert (GNUNET_OK ==
TALER_amount_set_zero (CURRENCY,
&cbc.withdraw_fee));
{
/* INSERT WIRE TARGETS */
bool found;
bool nonce_ok;
bool balance_ok;
uint64_t ruuid;
struct GNUNET_TIME_Timestamp now;
now = GNUNET_TIME_timestamp_get ();
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->do_withdraw (plugin->cls,
NULL,
&cbc,
now,
&found,
&balance_ok,
&nonce_ok,
&ruuid));
}
{
/* ENSURE_COIN_KNOWN */
uint64_t known_coin_id;
struct TALER_DenominationHashP dph;
struct TALER_AgeCommitmentHash agh;
FAILIF (TALER_EXCHANGEDB_CKS_ADDED !=
plugin->ensure_coin_known (plugin->cls,
&depos[i].coin,
&known_coin_id,
&dph,
&agh));
refresh.coin = depos[i].coin;
RND_BLK (&refresh.coin_sig);
RND_BLK (&refresh.rc);
refresh.amount_with_fee = value;
refresh.noreveal_index = MELT_NOREVEAL_INDEX;
}
/*STORE INTO DEPOSIT*/
{
struct GNUNET_TIME_Timestamp now;
now = GNUNET_TIME_timestamp_get ();
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->insert_deposit (plugin->cls,
now,
&depos[i]));
}
if (ROUNDS == i)
TALER_denom_sig_free (&depos[i].coin.denom_sig);
/* INSERT WIRE TARGETS */
bool found;
bool nonce_ok;
bool balance_ok;
uint64_t ruuid;
struct GNUNET_TIME_Timestamp now;
now = GNUNET_TIME_timestamp_get ();
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->do_withdraw (plugin->cls,
NULL,
&cbc,
now,
&found,
&balance_ok,
&nonce_ok,
&ruuid));
}
{
/* ENSURE_COIN_KNOWN */
uint64_t known_coin_id;
struct TALER_DenominationHashP dph;
struct TALER_AgeCommitmentHashP agh;
FAILIF (TALER_EXCHANGEDB_CKS_ADDED !=
plugin->ensure_coin_known (plugin->cls,
&depos[i].coin,
&known_coin_id,
&dph,
&agh));
refresh.coin = depos[i].coin;
RND_BLK (&refresh.coin_sig);
RND_BLK (&refresh.rc);
refresh.amount_with_fee = value;
refresh.noreveal_index = MELT_NOREVEAL_INDEX;
}
/*STORE INTO DEPOSIT*/
{
struct GNUNET_TIME_Timestamp now;
now = GNUNET_TIME_timestamp_get ();
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->insert_deposit (plugin->cls,
now,
&depos[i]));
}
if (ROUNDS == i)
TALER_denom_sig_free (&depos[i].coin.denom_sig);
}
/* End of benchmark setup */
GNUNET_free(perm);
GNUNET_free (perm);
// commit
FAILIF (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS !=
plugin->commit (plugin->cls));
/**** CALL GET LINK DATA ****/
for (unsigned int r=0; r< ROUNDS; r++)
for (unsigned int r = 0; r< ROUNDS; r++)
{
struct GNUNET_TIME_Absolute time;
struct GNUNET_TIME_Relative duration;
struct TALER_MerchantPublicKeyP merchant_pub;
char *payto_uri;
time = GNUNET_TIME_absolute_get();
time = GNUNET_TIME_absolute_get ();
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->get_ready_deposit (plugin->cls,
0,
@ -443,7 +441,8 @@ run (void *cls)
times = GNUNET_TIME_relative_add (times,
duration);
duration_sq = duration.rel_value_us * duration.rel_value_us;
GNUNET_assert (duration_sq / duration.rel_value_us == duration.rel_value_us);
GNUNET_assert (duration_sq / duration.rel_value_us ==
duration.rel_value_us);
GNUNET_assert (sqrs + duration_sq >= sqrs);
sqrs += duration_sq;
}
@ -458,15 +457,15 @@ run (void *cls)
ROUNDS);
avg_dbl = avg.rel_value_us;
variance = sqrs - (avg_dbl * avg_dbl * ROUNDS);
fprintf(stdout,
"%8llu ± %6.0f\n",
(unsigned long long) avg.rel_value_us,
sqrt (variance / (ROUNDS-1)));
fprintf (stdout,
"%8llu ± %6.0f\n",
(unsigned long long) avg.rel_value_us,
sqrt (variance / (ROUNDS - 1)));
}
result = 0;
drop:
GNUNET_break (GNUNET_OK ==
plugin->drop_tables (plugin->cls));
plugin->drop_tables (plugin->cls));
cleanup:
if (NULL != revealed_coins)
{
@ -484,12 +483,12 @@ cleanup:
cnt++)
destroy_denom_key_pair (new_dkp[cnt]);
GNUNET_free (new_dkp);
for (unsigned int i=0; i< ROUNDS ; i++)
{
TALER_denom_sig_free (&depos[i].coin.denom_sig);
}
GNUNET_free(depos);
GNUNET_free(ref);
for (unsigned int i = 0; i< ROUNDS; i++)
{
TALER_denom_sig_free (&depos[i].coin.denom_sig);
}
GNUNET_free (depos);
GNUNET_free (ref);
TALER_EXCHANGEDB_plugin_unload (plugin);
plugin = NULL;
}

View File

@ -36,7 +36,7 @@ static int result;
*/
#define FAILIF(cond) \
do { \
if (! (cond)) {break;} \
if (! (cond)) {break;} \
GNUNET_break (0); \
goto drop; \
} while (0)
@ -172,6 +172,8 @@ create_denom_key_pair (unsigned int size,
}
return dkp;
}
/**
* Callback invoked with information about refunds applicable
* to a particular coin.
@ -209,7 +211,7 @@ run (void *cls)
const uint32_t num_partitions = 10;
struct DenomKeyPair *dkp = NULL;
struct GNUNET_TIME_Timestamp ts;
struct TALER_EXCHANGEDB_Deposit *depos=NULL;
struct TALER_EXCHANGEDB_Deposit *depos = NULL;
struct GNUNET_TIME_Timestamp deadline;
struct TALER_Amount value;
union TALER_DenominationBlindingKeyP bks;
@ -217,18 +219,18 @@ run (void *cls)
struct TALER_EXCHANGEDB_CollectableBlindcoin cbc;
struct TALER_ExchangeWithdrawValues alg_values = {
.cipher = TALER_DENOMINATION_RSA
};
};
struct GNUNET_TIME_Relative times = GNUNET_TIME_UNIT_ZERO;
unsigned long long sqrs = 0;
struct TALER_EXCHANGEDB_Refund *ref=NULL;
struct TALER_EXCHANGEDB_Refund *ref = NULL;
unsigned int *perm;
unsigned long long duration_sq;
struct TALER_CoinSpendPublicKeyP coin_pub;
struct TALER_EXCHANGEDB_RefreshRevealedCoin *ccoin;
struct TALER_DenominationPublicKey *new_denom_pubs = NULL;
ref = GNUNET_new_array (ROUNDS +1,
ref = GNUNET_new_array (ROUNDS + 1,
struct TALER_EXCHANGEDB_Refund);
depos = GNUNET_new_array (ROUNDS +1,
depos = GNUNET_new_array (ROUNDS + 1,
struct TALER_EXCHANGEDB_Deposit);
ZR_BLK (&cbc);
@ -276,66 +278,66 @@ run (void *cls)
ts = GNUNET_TIME_timestamp_get ();
deadline = GNUNET_TIME_timestamp_get ();
//DENOMINATION
// DENOMINATION
{
//PAIR KEY LIST
// PAIR KEY LIST
new_dkp = GNUNET_new_array (MELT_NEW_COINS,
struct DenomKeyPair *);
//PUBLIC KEY LIST
struct DenomKeyPair *);
// PUBLIC KEY LIST
new_denom_pubs = GNUNET_new_array (MELT_NEW_COINS,
struct TALER_DenominationPublicKey);
//REFRESH REVEAL COIN LIST
// REFRESH REVEAL COIN LIST
revealed_coins
= GNUNET_new_array (MELT_NEW_COINS,
struct TALER_EXCHANGEDB_RefreshRevealedCoin);
for (unsigned int cnt = 0; cnt < MELT_NEW_COINS; cnt++)
{
struct GNUNET_TIME_Timestamp now;
struct TALER_BlindedRsaPlanchet *rp;
struct TALER_BlindedPlanchet *bp;
{
struct GNUNET_TIME_Timestamp now;
struct TALER_BlindedRsaPlanchet *rp;
struct TALER_BlindedPlanchet *bp;
now = GNUNET_TIME_timestamp_get ();
//5 KEY PAIR
new_dkp[cnt] = create_denom_key_pair (RSA_KEY_SIZE,
now,
&value,
&fees);
GNUNET_assert (NULL != new_dkp[cnt]);
new_denom_pubs[cnt] = new_dkp[cnt]->pub;
ccoin = &revealed_coins[cnt];
bp = &ccoin->blinded_planchet;
bp->cipher = TALER_DENOMINATION_RSA;
rp = &bp->details.rsa_blinded_planchet;
rp->blinded_msg_size = 1 + (size_t) GNUNET_CRYPTO_random_u64 (
GNUNET_CRYPTO_QUALITY_WEAK,
(RSA_KEY_SIZE / 8) - 1);
rp->blinded_msg = GNUNET_malloc (rp->blinded_msg_size);
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
rp->blinded_msg,
rp->blinded_msg_size);
TALER_denom_pub_hash (&new_dkp[cnt]->pub,
&ccoin->h_denom_pub);
ccoin->exchange_vals = alg_values;
TALER_coin_ev_hash (bp,
&ccoin->h_denom_pub,
&ccoin->coin_envelope_hash);
GNUNET_assert (GNUNET_OK ==
now = GNUNET_TIME_timestamp_get ();
// 5 KEY PAIR
new_dkp[cnt] = create_denom_key_pair (RSA_KEY_SIZE,
now,
&value,
&fees);
GNUNET_assert (NULL != new_dkp[cnt]);
new_denom_pubs[cnt] = new_dkp[cnt]->pub;
ccoin = &revealed_coins[cnt];
bp = &ccoin->blinded_planchet;
bp->cipher = TALER_DENOMINATION_RSA;
rp = &bp->details.rsa_blinded_planchet;
rp->blinded_msg_size = 1 + (size_t) GNUNET_CRYPTO_random_u64 (
GNUNET_CRYPTO_QUALITY_WEAK,
(RSA_KEY_SIZE / 8) - 1);
rp->blinded_msg = GNUNET_malloc (rp->blinded_msg_size);
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
rp->blinded_msg,
rp->blinded_msg_size);
TALER_denom_pub_hash (&new_dkp[cnt]->pub,
&ccoin->h_denom_pub);
ccoin->exchange_vals = alg_values;
TALER_coin_ev_hash (bp,
&ccoin->h_denom_pub,
&ccoin->coin_envelope_hash);
GNUNET_assert (GNUNET_OK ==
TALER_denom_sign_blinded (&ccoin->coin_sig,
&new_dkp[cnt]->priv,
true,
bp));
GNUNET_assert (GNUNET_OK ==
TALER_coin_ev_hash (bp,
&cbc.denom_pub_hash,
&cbc.h_coin_envelope));
GNUNET_assert (
GNUNET_OK ==
TALER_denom_sign_blinded (
&cbc.sig,
&new_dkp[cnt]->priv,
false,
bp));
}
GNUNET_assert (GNUNET_OK ==
TALER_coin_ev_hash (bp,
&cbc.denom_pub_hash,
&cbc.h_coin_envelope));
GNUNET_assert (
GNUNET_OK ==
TALER_denom_sign_blinded (
&cbc.sig,
&new_dkp[cnt]->priv,
false,
bp));
}
}
perm = GNUNET_CRYPTO_random_permute (GNUNET_CRYPTO_QUALITY_NONCE,
@ -344,10 +346,10 @@ run (void *cls)
FAILIF (GNUNET_OK !=
plugin->start (plugin->cls,
"Transaction"));
for (unsigned int j=0; j< NUM_ROWS; j++)
for (unsigned int j = 0; j< NUM_ROWS; j++)
{
unsigned int i = perm[j];
unsigned int k = (unsigned int)rand()%5;
unsigned int k = (unsigned int) rand () % 5;
if (i >= ROUNDS)
i = ROUNDS; /* throw-away slot, do not keep around */
RND_BLK (&coin_pub);
@ -375,15 +377,15 @@ run (void *cls)
depos[i].receiver_wire_account =
"payto://iban/DE67830654080004822650?receiver-name=Test";
TALER_merchant_wire_signature_hash (
"payto://iban/DE67830654080004822650?receiver-name=Test",
&depos[i].wire_salt,
&h_wire_wt);
"payto://iban/DE67830654080004822650?receiver-name=Test",
&depos[i].wire_salt,
&h_wire_wt);
depos[i].timestamp = ts;
uint64_t known_coin_id;
{//ENSURE_COIN_KNOWN
uint64_t known_coin_id;
{// ENSURE_COIN_KNOWN
struct TALER_DenominationHashP dph;
struct TALER_AgeCommitmentHash agh;
struct TALER_AgeCommitmentHashP agh;
FAILIF (TALER_EXCHANGEDB_CKS_ADDED !=
plugin->ensure_coin_known (plugin->cls,
&depos[i].coin,
@ -409,7 +411,7 @@ run (void *cls)
bool conflict;
ref[i].coin = depos[i].coin;
ref[i].details.merchant_pub = depos[i].merchant_pub;
RND_BLK(&ref[i].details.merchant_sig);
RND_BLK (&ref[i].details.merchant_sig);
ref[i].details.h_contract_terms = depos[i].h_contract_terms;
ref[i].coin.coin_pub = depos[i].coin.coin_pub;
ref[i].details.rtransaction_id = i;
@ -454,7 +456,8 @@ run (void *cls)
times = GNUNET_TIME_relative_add (times,
duration);
duration_sq = duration.rel_value_us * duration.rel_value_us;
GNUNET_assert (duration_sq / duration.rel_value_us == duration.rel_value_us);
GNUNET_assert (duration_sq / duration.rel_value_us ==
duration.rel_value_us);
GNUNET_assert (sqrs + duration_sq >= sqrs);
sqrs += duration_sq;
}
@ -468,15 +471,15 @@ run (void *cls)
ROUNDS);
avg_dbl = avg.rel_value_us;
variance = sqrs - (avg_dbl * avg_dbl * ROUNDS);
fprintf(stdout,
"%8llu ± %6.0f\n",
(unsigned long long) avg.rel_value_us,
sqrt (variance / (ROUNDS-1)));
fprintf (stdout,
"%8llu ± %6.0f\n",
(unsigned long long) avg.rel_value_us,
sqrt (variance / (ROUNDS - 1)));
}
result = 0;
drop:
GNUNET_break (GNUNET_OK ==
plugin->drop_tables (plugin->cls));
plugin->drop_tables (plugin->cls));
cleanup:
if (NULL != dkp)
destroy_denom_key_pair (dkp);
@ -496,12 +499,12 @@ cleanup:
cnt++)
destroy_denom_key_pair (new_dkp[cnt]);
GNUNET_free (new_dkp);
for (unsigned int i=0; i< ROUNDS +1 ; i++)
{
TALER_denom_sig_free (&depos[i].coin.denom_sig);
}
GNUNET_free(depos);
GNUNET_free(ref);
for (unsigned int i = 0; i< ROUNDS + 1; i++)
{
TALER_denom_sig_free (&depos[i].coin.denom_sig);
}
GNUNET_free (depos);
GNUNET_free (ref);
dkp = NULL;
TALER_EXCHANGEDB_plugin_unload (plugin);
plugin = NULL;

View File

@ -435,6 +435,13 @@ struct TALER_AgeCommitmentPublicKeyP
#endif
};
/*
* @brief Hash to represent the commitment to n*kappa blinded keys during a age-withdrawal.
*/
struct TALER_AgeWithdrawCommitmentHashP
{
struct GNUNET_HashCode hash;
};
/**
* @brief Type of online public keys used by the wallet to establish a purse and the associated contract meta data.
@ -1239,7 +1246,7 @@ struct TALER_AgeMask
/**
* @brief Age commitment of a coin.
*/
struct TALER_AgeCommitmentHash
struct TALER_AgeCommitmentHashP
{
/**
* The commitment is a SHA-256 hash code.
@ -1259,13 +1266,13 @@ struct TALER_AgeAttestation
#endif
};
extern const struct TALER_AgeCommitmentHash TALER_ZeroAgeCommitmentHash;
extern const struct TALER_AgeCommitmentHashP TALER_ZeroAgeCommitmentHash;
#define TALER_AgeCommitmentHash_isNullOrZero(ph) ((NULL == ph) || \
(0 == memcmp (ph, \
& \
TALER_ZeroAgeCommitmentHash, \
sizeof(struct \
TALER_AgeCommitmentHash))))
TALER_AgeCommitmentHashP))))
/**
* @brief Type of public signing keys for verifying blindly signed coins.
@ -1448,7 +1455,7 @@ struct TALER_CoinPublicInfo
* Hash of the age commitment. If no age commitment was provided, it must be
* set to all zeroes.
*/
struct TALER_AgeCommitmentHash h_age_commitment;
struct TALER_AgeCommitmentHashP h_age_commitment;
/**
* True, if age commitment is not applicable.
@ -1624,7 +1631,7 @@ TALER_denom_sig_free (struct TALER_DenominationSignature *denom_sig);
enum GNUNET_GenericReturnValue
TALER_denom_blind (const struct TALER_DenominationPublicKey *dk,
const union TALER_DenominationBlindingKeyP *coin_bks,
const struct TALER_AgeCommitmentHash *age_commitment_hash,
const struct TALER_AgeCommitmentHashP *age_commitment_hash,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_ExchangeWithdrawValues *alg_values,
struct TALER_CoinPubHashP *c_hash,
@ -1873,7 +1880,7 @@ TALER_coin_ev_hash (const struct TALER_BlindedPlanchet *blinded_planchet,
*/
void
TALER_coin_pub_hash (const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_AgeCommitmentHash *age_commitment_hash,
const struct TALER_AgeCommitmentHashP *age_commitment_hash,
struct TALER_CoinPubHashP *coin_h);
@ -1928,7 +1935,7 @@ struct TALER_FreshCoin
/**
* Optional hash of an age commitment bound to this coin, maybe NULL.
*/
const struct TALER_AgeCommitmentHash *h_age_commitment;
const struct TALER_AgeCommitmentHashP *h_age_commitment;
};
@ -2111,7 +2118,7 @@ TALER_planchet_prepare (const struct TALER_DenominationPublicKey *dk,
const struct TALER_ExchangeWithdrawValues *alg_values,
const union TALER_DenominationBlindingKeyP *bks,
const struct TALER_CoinSpendPrivateKeyP *coin_priv,
const struct TALER_AgeCommitmentHash *ach,
const struct TALER_AgeCommitmentHashP *ach,
struct TALER_CoinPubHashP *c_hash,
struct TALER_PlanchetDetail *pd);
@ -2155,7 +2162,7 @@ TALER_planchet_to_coin (
const struct TALER_BlindedDenominationSignature *blind_sig,
const union TALER_DenominationBlindingKeyP *bks,
const struct TALER_CoinSpendPrivateKeyP *coin_priv,
const struct TALER_AgeCommitmentHash *ach,
const struct TALER_AgeCommitmentHashP *ach,
const struct TALER_CoinPubHashP *c_hash,
const struct TALER_ExchangeWithdrawValues *alg_values,
struct TALER_FreshCoin *coin);
@ -3110,7 +3117,7 @@ TALER_wallet_purse_deposit_sign (
const struct TALER_PurseContractPublicKeyP *purse_pub,
const struct TALER_Amount *amount,
const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_AgeCommitmentHash *h_age_commitment,
const struct TALER_AgeCommitmentHashP *h_age_commitment,
const struct TALER_CoinSpendPrivateKeyP *coin_priv,
struct TALER_CoinSpendSignatureP *coin_sig);
@ -3133,7 +3140,7 @@ TALER_wallet_purse_deposit_verify (
const struct TALER_PurseContractPublicKeyP *purse_pub,
const struct TALER_Amount *amount,
const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_AgeCommitmentHash *h_age_commitment,
const struct TALER_AgeCommitmentHashP *h_age_commitment,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_CoinSpendSignatureP *coin_sig);
@ -3469,7 +3476,7 @@ TALER_wallet_deposit_sign (
const struct TALER_Amount *deposit_fee,
const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_AgeCommitmentHash *h_age_commitment,
const struct TALER_AgeCommitmentHashP *h_age_commitment,
const struct TALER_ExtensionPolicyHashP *h_policy,
const struct TALER_DenominationHashP *h_denom_pub,
struct GNUNET_TIME_Timestamp wallet_timestamp,
@ -3502,7 +3509,7 @@ TALER_wallet_deposit_verify (
const struct TALER_Amount *deposit_fee,
const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_AgeCommitmentHash *h_age_commitment,
const struct TALER_AgeCommitmentHashP *h_age_commitment,
const struct TALER_ExtensionPolicyHashP *h_policy,
const struct TALER_DenominationHashP *h_denom_pub,
struct GNUNET_TIME_Timestamp wallet_timestamp,
@ -3529,7 +3536,7 @@ TALER_wallet_melt_sign (
const struct TALER_Amount *melt_fee,
const struct TALER_RefreshCommitmentP *rc,
const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_AgeCommitmentHash *h_age_commitment,
const struct TALER_AgeCommitmentHashP *h_age_commitment,
const struct TALER_CoinSpendPrivateKeyP *coin_priv,
struct TALER_CoinSpendSignatureP *coin_sig);
@ -3552,7 +3559,7 @@ TALER_wallet_melt_verify (
const struct TALER_Amount *melt_fee,
const struct TALER_RefreshCommitmentP *rc,
const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_AgeCommitmentHash *h_age_commitment,
const struct TALER_AgeCommitmentHashP *h_age_commitment,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_CoinSpendSignatureP *coin_sig);
@ -3630,6 +3637,40 @@ TALER_wallet_withdraw_verify (
const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_ReserveSignatureP *reserve_sig);
/**
* Sign age-withdraw request.
*
* @param h_commitment hash all n*kappa blinded coins in the commitment for the age-withdraw
* @param amount_with_fee amount to debit the reserve for
* @param max_age_group maximum age group that the withdrawn coins must be restricted to
* @param reserve_priv private key to sign with
* @param[out] reserve_sig resulting signature
*/
void
TALER_wallet_age_withdraw_sign (
const struct TALER_AgeWithdrawCommitmentHashP *h_commitment,
const struct TALER_Amount *amount_with_fee,
uint32_t max_age_group,
const struct TALER_ReservePrivateKeyP *reserve_priv,
struct TALER_ReserveSignatureP *reserve_sig);
/**
* Verify an age-withdraw request.
*
* @param h_commitment hash all n*kappa blinded coins in the commitment for the age-withdraw
* @param amount_with_fee amount to debit the reserve for
* @param max_age_group maximum age group that the withdrawn coins must be restricted to
* @param reserve_pub public key of the reserve
* @param reserve_sig resulting signature
* @return #GNUNET_OK if the signature is valid
*/
enum GNUNET_GenericReturnValue
TALER_wallet_age_withdraw_verify (
const struct TALER_AgeWithdrawCommitmentHashP *h_commitment,
const struct TALER_Amount *amount_with_fee,
uint32_t max_age_group,
const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_ReserveSignatureP *reserve_sig);
/**
* Verify exchange melt confirmation.
@ -5687,7 +5728,7 @@ struct TALER_AgeCommitmentProof
void
TALER_age_commitment_hash (
const struct TALER_AgeCommitment *commitment,
struct TALER_AgeCommitmentHash *hash);
struct TALER_AgeCommitmentHashP *hash);
/**
@ -5738,7 +5779,7 @@ TALER_age_commitment_attest (
/**
* @brief Verify the attestation for an given age and age commitment
* @brief Verify the attestation for a given age and age commitment
*
* @param commitment The age commitment that went into the attestation. Only the public keys are needed.
* @param age Age (not age group) for which the an attestation should be done
@ -5752,6 +5793,24 @@ TALER_age_commitment_verify (
const struct TALER_AgeAttestation *attest);
/**
* Create age-withdraw confirmation signature.
*
* @param scb function to call to create the signature
* @param awch age-withdraw commitment that identifies the n*kappa blinded coins
* @param noreveal_index gamma cut-and-choose value chosen by the exchange
* @param[out] pub where to write the exchange public key
* @param[out] sig where to write the exchange signature
* @return #TALER_EC_NONE on success
*/
enum TALER_ErrorCode
TALER_exchange_online_age_withdraw_confirmation_sign (
TALER_ExchangeSignCallback scb,
const struct TALER_AgeWithdrawCommitmentHashP *h_commitment,
uint32_t noreveal_index,
struct TALER_ExchangePublicKeyP *pub,
struct TALER_ExchangeSignatureP *sig);
/**
* @brief helper function to free memory of a struct TALER_AgeCommitment
*

View File

@ -844,7 +844,7 @@ struct TALER_EXCHANGE_CoinDepositDetail
/**
* Hash over the age commitment of the coin.
*/
struct TALER_AgeCommitmentHash h_age_commitment;
struct TALER_AgeCommitmentHashP h_age_commitment;
/**
* The coins public key.
@ -2155,7 +2155,7 @@ struct TALER_EXCHANGE_WithdrawCoinInput
/**
* Age commitment for the coin.
*/
const struct TALER_AgeCommitmentHash *ach;
const struct TALER_AgeCommitmentHashP *ach;
};
@ -2579,7 +2579,7 @@ struct TALER_EXCHANGE_RefreshData
* might be NULL.
*/
const struct TALER_AgeCommitmentProof *melt_age_commitment_proof;
const struct TALER_AgeCommitmentHash *melt_h_age_commitment;
const struct TALER_AgeCommitmentHashP *melt_h_age_commitment;
/**
* amount specifying how much the coin will contribute to the melt
@ -2752,7 +2752,7 @@ struct TALER_EXCHANGE_RevealedCoinInfo
* Age commitment and its hash of the coin, might be NULL.
*/
struct TALER_AgeCommitmentProof *age_commitment_proof;
struct TALER_AgeCommitmentHash *h_age_commitment;
struct TALER_AgeCommitmentHashP *h_age_commitment;
/**
* Blinding keys used to blind the fresh coin.
@ -2896,7 +2896,7 @@ struct TALER_EXCHANGE_LinkedCoinInfo
* Age commitment and its hash, if applicable. Might be NULL.
*/
struct TALER_AgeCommitmentProof *age_commitment_proof;
struct TALER_AgeCommitmentHash *h_age_commitment;
struct TALER_AgeCommitmentHashP *h_age_commitment;
/**
* Master secret of this coin.
@ -4410,7 +4410,7 @@ TALER_EXCHANGE_management_add_partner (
/**
* Cancel #TALER_EXCHANGE_management_update_aml_officer() operation.
* Cancel #TALER_EXCHANGE_management_add_partner() operation.
*
* @param rh handle of the operation to cancel
*/

View File

@ -391,7 +391,7 @@ struct TALER_EXCHANGEDB_TableData
struct
{
struct TALER_CoinSpendPublicKeyP coin_pub;
struct TALER_AgeCommitmentHash age_hash;
struct TALER_AgeCommitmentHashP age_hash;
uint64_t denominations_serial;
struct TALER_DenominationSignature denom_sig;
} known_coins;
@ -1050,6 +1050,52 @@ struct TALER_EXCHANGEDB_CollectableBlindcoin
struct TALER_ReserveSignatureP reserve_sig;
};
/**
* @brief Information we keep for an age-withdraw commitment
* to reproduce the /age-withdraw operation if neede, and to have proof
* that a reserve was drained by this amount.
*/
struct TALER_EXCHANGEDB_AgeWithdrawCommitment
{
/**
* Total amount (with fee) committed to withdraw
*/
struct TALER_Amount amount_with_fee;
/**
* Public key of the reserve that was drained.
*/
struct TALER_ReservePublicKeyP reserve_pub;
/**
* Maximum age group that the coins are restricted to.
*/
uint8_t max_age_group;
/**
* The hash of the commitment of all n*kappa coins
*/
struct TALER_AgeWithdrawCommitmentHashP h_commitment;
/**
* Index (smaller #TALER_CNC_KAPPA) which the exchange has chosen to not have
* revealed during cut and choose. This value applies to all n coins in the
* commitment.
*/
uint32_t noreveal_index;
/**
* Signature confirming the age withdrawal, matching @e reserve_pub, @e
* maximum_age_group and @e h_commitment and @e total_amount_with_fee.
*/
struct TALER_ReserveSignatureP reserve_sig;
/**
* The exchange's signature of the response.
*/
struct TALER_ExchangeSignatureP sig;
};
/**
* Information the exchange records about a recoup request
@ -1622,7 +1668,7 @@ struct TALER_EXCHANGEDB_DepositListEntry
* Age commitment hash, if applicable to the denomination. Should be all
* zeroes if age commitment is not applicable to the denonimation.
*/
struct TALER_AgeCommitmentHash h_age_commitment;
struct TALER_AgeCommitmentHashP h_age_commitment;
/**
* true, if age commitment is not applicable
@ -1833,7 +1879,7 @@ struct TALER_EXCHANGEDB_MeltListEntry
* applicable to the denomination. May be all zeroes if no age restriction
* applies.
*/
struct TALER_AgeCommitmentHash h_age_commitment;
struct TALER_AgeCommitmentHashP h_age_commitment;
/**
* true, if no h_age_commitment is applicable
@ -1900,7 +1946,7 @@ struct TALER_EXCHANGEDB_PurseDepositListEntry
* Hash of the age commitment used to sign the coin, if age restriction was
* applicable to the denomination.
*/
struct TALER_AgeCommitmentHash h_age_commitment;
struct TALER_AgeCommitmentHashP h_age_commitment;
/**
* Set to true if the coin was refunded.
@ -2007,7 +2053,7 @@ struct TALER_EXCHANGEDB_PurseDeposit
* applicable to the denomination. May be all zeroes if no age restriction
* applies.
*/
struct TALER_AgeCommitmentHash h_age_commitment;
struct TALER_AgeCommitmentHashP h_age_commitment;
/**
* Set to true if @e h_age_commitment is not available.
@ -2487,7 +2533,7 @@ typedef enum GNUNET_GenericReturnValue
void *cls,
uint64_t rowid,
const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_AgeCommitmentHash *h_age_commitment,
const struct TALER_AgeCommitmentHashP *h_age_commitment,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_CoinSpendSignatureP *coin_sig,
const struct TALER_Amount *amount_with_fee,
@ -3647,6 +3693,45 @@ struct TALER_EXCHANGEDB_Plugin
bool *conflict,
bool *nonce_reuse);
/**
* Locate the response for a age-withdraw request under a hash that uniquely
* identifies the age-withdraw operation. Used to ensure idempotency of the
* request.
*
* @param cls the @e cls of this struct with the plugin-specific state
* @param reserve_pub public key of the reserve for which the age-withdraw request is made
* @param ach hash that uniquely identifies the age-withdraw operation
* @param[out] awc corresponding details of the previous age-withdraw request if an entry was found
* @return statement execution status
*/
enum GNUNET_DB_QueryStatus
(*get_age_withdraw_info)(void *cls,
const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_AgeWithdrawCommitmentHashP *ach,
struct TALER_EXCHANGEDB_AgeWithdrawCommitment *awc);
/**
* Perform an age-withdraw operation, checking for sufficient balance
* and possibly persisting the withdrawal details.
*
* @param cls the `struct PostgresClosure` with the plugin-specific state
* @param commitment corresponding commitment for the age-withdraw
* @param now current time (rounded)
* @param[out] found set to true if the reserve was found
* @param[out] balance_ok set to true if the balance was sufficient
* @param[out] ruuid set to the reserve's UUID (reserves table row)
* @return query execution status
*/
enum GNUNET_DB_QueryStatus
(*do_age_withdraw)(
void *cls,
const struct TALER_EXCHANGEDB_AgeWithdrawCommitment *commitment,
struct GNUNET_TIME_Timestamp now,
bool *found,
bool *balance_ok,
uint64_t *ruuid);
/**
* Retrieve the details to a policy given by its hash_code
*
@ -3973,7 +4058,7 @@ struct TALER_EXCHANGEDB_Plugin
const struct TALER_CoinPublicInfo *coin,
uint64_t *known_coin_id,
struct TALER_DenominationHashP *denom_pub_hash,
struct TALER_AgeCommitmentHash *age_hash);
struct TALER_AgeCommitmentHashP *age_hash);
/**
@ -6059,7 +6144,7 @@ struct TALER_EXCHANGEDB_Plugin
const struct TALER_CoinSpendPublicKeyP *coin_pub,
struct TALER_Amount *amount,
struct TALER_DenominationHashP *h_denom_pub,
struct TALER_AgeCommitmentHash *phac,
struct TALER_AgeCommitmentHashP *phac,
struct TALER_CoinSpendSignatureP *coin_sig,
char **partner_url);

View File

@ -73,8 +73,12 @@ enum TALER_KYCLOGIC_KycTriggerEvent
/**
* Reserve is being closed by force.
*/
TALER_KYCLOGIC_KYC_TRIGGER_RESERVE_CLOSE = 4
TALER_KYCLOGIC_KYC_TRIGGER_RESERVE_CLOSE = 4,
/**
* Customer withdraws coins via age-withdraw.
*/
TALER_KYCLOGIC_KYC_TRIGGER_AGE_WITHDRAW = 5,
};

View File

@ -158,6 +158,7 @@ typedef void
* @param status KYC status
* @param provider_user_id set to user ID at the provider, or NULL if not supported or unknown
* @param provider_legitimization_id set to legitimization process ID at the provider, or NULL if not supported or unknown
* @param attributes user attributes returned by the provider
* @param expiration until when is the KYC check valid
* @param http_status HTTP status code of @a response
* @param[in] response to return to the HTTP client
@ -169,6 +170,7 @@ typedef void
const char *provider_user_id,
const char *provider_legitimization_id,
struct GNUNET_TIME_Absolute expiration,
const json_t *attributes,
unsigned int http_status,
struct MHD_Response *response);

View File

@ -2958,7 +2958,7 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits,
op (deposit_fee_amount, const struct TALER_Amount) \
op (age_commitment, const struct TALER_AgeCommitment) \
op (age_commitment_proof, const struct TALER_AgeCommitmentProof) \
op (h_age_commitment, const struct TALER_AgeCommitmentHash) \
op (h_age_commitment, const struct TALER_AgeCommitmentHashP) \
op (reserve_history, const struct TALER_EXCHANGE_ReserveHistoryEntry) \
op (planchet_secrets, const struct TALER_PlanchetMasterSecretP) \
op (exchange_wd_value, const struct TALER_ExchangeWithdrawValues) \

View File

@ -79,6 +79,7 @@ libtaler_plugin_kyclogic_oauth2_la_LIBADD = \
$(LTLIBINTL)
libtaler_plugin_kyclogic_oauth2_la_LDFLAGS = \
$(TALER_PLUGIN_LDFLAGS) \
$(top_builddir)/src/templating/libtalertemplating.la \
$(top_builddir)/src/mhd/libtalermhd.la \
$(top_builddir)/src/json/libtalerjson.la \
$(top_builddir)/src/util/libtalerutil.la \

View File

@ -25,3 +25,11 @@ KYC_OAUTH2_POST_URL = http://example.com/thank-you
# For authentication to the OAuth2.0 service
KYC_OAUTH2_CLIENT_ID = testcase
KYC_OAUTH2_CLIENT_SECRET = password
# Mustach template that converts OAuth2.0 data about the user
# into GNU Taler standardized attribute data.
#
# This is just an example, details will depend on the
# provider!
#
KYC_ATTRIBUTE_TEMPLATE = "{"fullname":"{{first_name}} {{last_name}}","phone":"{{phone}}"}"

View File

@ -180,6 +180,7 @@ TALER_KYCLOGIC_kyc_trigger_from_string (const char *trigger_s,
enum TALER_KYCLOGIC_KycTriggerEvent out;
} map [] = {
{ "withdraw", TALER_KYCLOGIC_KYC_TRIGGER_WITHDRAW },
{ "age-withdraw", TALER_KYCLOGIC_KYC_TRIGGER_AGE_WITHDRAW },
{ "deposit", TALER_KYCLOGIC_KYC_TRIGGER_DEPOSIT },
{ "merge", TALER_KYCLOGIC_KYC_TRIGGER_P2P_RECEIVE },
{ "balance", TALER_KYCLOGIC_KYC_TRIGGER_WALLET_BALANCE },
@ -208,6 +209,8 @@ TALER_KYCLOGIC_kyc_trigger2s (enum TALER_KYCLOGIC_KycTriggerEvent trigger)
{
case TALER_KYCLOGIC_KYC_TRIGGER_WITHDRAW:
return "withdraw";
case TALER_KYCLOGIC_KYC_TRIGGER_AGE_WITHDRAW:
return "age-withdraw";
case TALER_KYCLOGIC_KYC_TRIGGER_DEPOSIT:
return "deposit";
case TALER_KYCLOGIC_KYC_TRIGGER_P2P_RECEIVE:

View File

@ -632,6 +632,7 @@ proof_reply (void *cls)
NULL, /* user id */
NULL, /* provider legi ID */
GNUNET_TIME_UNIT_ZERO_ABS, /* expiration */
NULL, /* attributes */
MHD_HTTP_BAD_REQUEST,
resp);
}

View File

@ -21,6 +21,7 @@
#include "platform.h"
#include "taler_kyclogic_plugin.h"
#include "taler_mhd_lib.h"
#include "taler_templating_lib.h"
#include "taler_json_lib.h"
#include <regex.h>
#include "taler_util.h"
@ -105,6 +106,12 @@ struct TALER_KYCLOGIC_ProviderDetails
*/
char *post_kyc_redirect_url;
/**
* Template for converting user-data returned by
* the provider into our KYC attribute data.
*/
char *attribute_template;
/**
* Validity time for a successful KYC process.
*/
@ -194,6 +201,11 @@ struct TALER_KYCLOGIC_ProofHandle
*/
char *post_body;
/**
* KYC attributes returned about the user by the OAuth 2.0 server.
*/
json_t *attributes;
/**
* Response to return.
*/
@ -277,6 +289,7 @@ oauth2_unload_configuration (struct TALER_KYCLOGIC_ProviderDetails *pd)
GNUNET_free (pd->client_id);
GNUNET_free (pd->client_secret);
GNUNET_free (pd->post_kyc_redirect_url);
GNUNET_free (pd->attribute_template);
GNUNET_free (pd);
}
@ -443,6 +456,21 @@ oauth2_load_configuration (void *cls,
}
pd->post_kyc_redirect_url = s;
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (ps->cfg,
provider_section_name,
"KYC_OAUTH2_ATTRIBUTE_TEMPLATE",
&s))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING,
provider_section_name,
"KYC_OAUTH2_ATTRIBUTE_TEMPLATE");
}
else
{
pd->attribute_template = s;
}
return pd;
}
@ -566,9 +594,12 @@ return_proof_response (void *cls)
ph->provider_user_id,
ph->provider_legitimization_id,
GNUNET_TIME_relative_to_absolute (ph->pd->validity),
ph->attributes,
ph->http_status,
ph->response);
GNUNET_free (ph->provider_user_id);
if (NULL != ph->attributes)
json_decref (ph->attributes);
GNUNET_free (ph);
}
@ -640,6 +671,57 @@ handle_proof_error (struct TALER_KYCLOGIC_ProofHandle *ph,
}
/**
* Convert user data returned by the provider into
* standardized attribute data.
*
* @param pd our provider configuration
* @param data user-data given by the provider
* @return converted KYC attribute data object
*/
static json_t *
data2attributes (const struct TALER_KYCLOGIC_ProviderDetails *pd,
const json_t *data)
{
json_t *ret;
void *attr_data;
size_t attr_size;
int rv;
json_error_t err;
if (NULL == pd->attribute_template)
return json_object ();
if (0 !=
(rv = TALER_TEMPLATING_fill (pd->attribute_template,
data,
&attr_data,
&attr_size)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to convert KYC provider data to attributes: %d\n",
rv);
json_dumpf (data,
stderr,
JSON_INDENT (2));
return NULL;
}
ret = json_loadb (attr_data,
attr_size,
JSON_REJECT_DUPLICATES,
&err);
GNUNET_free (attr_data);
if (NULL == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to parse converted KYC attributes as JSON: %s (at offset %d)\n",
err.text,
err.position);
return NULL;
}
return ret;
}
/**
* The request for @a ph succeeded (presumably).
* Call continuation with the result.
@ -689,6 +771,7 @@ parse_proof_success_reply (struct TALER_KYCLOGIC_ProofHandle *ph,
GNUNET_break_op (0);
handle_proof_error (ph,
j);
GNUNET_JSON_parse_free (spec);
return;
}
{
@ -716,6 +799,7 @@ parse_proof_success_reply (struct TALER_KYCLOGIC_ProofHandle *ph,
"Unexpected response from KYC gateway: data must contain id");
ph->http_status
= MHD_HTTP_BAD_GATEWAY;
GNUNET_JSON_parse_free (spec);
return;
}
ph->status = TALER_KYCLOGIC_STATUS_SUCCESS;
@ -731,6 +815,9 @@ parse_proof_success_reply (struct TALER_KYCLOGIC_ProofHandle *ph,
ph->http_status = MHD_HTTP_SEE_OTHER;
ph->provider_user_id = GNUNET_strdup (id);
}
ph->attributes = data2attributes (ph->pd,
data);
GNUNET_JSON_parse_free (spec);
}

View File

@ -890,6 +890,7 @@ proof_generic_reply (struct TALER_KYCLOGIC_ProofHandle *ph,
account_id,
inquiry_id,
expiration,
NULL, /* FIXME: return attributes! */
http_status,
resp);
}
@ -1173,6 +1174,7 @@ handle_proof_finished (void *cls,
account_id,
inquiry_id,
expiration,
NULL, /* FIXME: return attributes! */
MHD_HTTP_SEE_OTHER,
resp);
}

View File

@ -688,6 +688,7 @@ handler_kyc_webhook_post (
* @param provider_user_id set to user ID at the provider, or NULL if not supported or unknown
* @param provider_legitimization_id set to legitimization process ID at the provider, or NULL if not supported or unknown
* @param expiration until when is the KYC check valid
* @param attributes attributes about the user
* @param http_status HTTP status code of @a response
* @param[in] response to return to the HTTP client
*/
@ -698,6 +699,7 @@ proof_cb (
const char *provider_user_id,
const char *provider_legitimization_id,
struct GNUNET_TIME_Absolute expiration,
const json_t *attributes,
unsigned int http_status,
struct MHD_Response *response)
{
@ -710,6 +712,10 @@ proof_cb (
status,
http_status,
provider_user_id);
if (NULL != attributes)
json_dumpf (attributes,
stderr,
JSON_INDENT (2));
MHD_resume_connection (rs->rc->connection);
TALER_MHD_daemon_trigger ();
rs->rc->response = response;

View File

@ -51,7 +51,7 @@ struct CoinData
/**
* Age commitment for the coin.
*/
const struct TALER_AgeCommitmentHash *ach;
const struct TALER_AgeCommitmentHashP *ach;
/**
* blinding secret

View File

@ -850,7 +850,7 @@ help_deposit (struct CoinHistoryParseContext *pc,
struct TALER_MerchantPublicKeyP merchant_pub;
struct GNUNET_TIME_Timestamp refund_deadline = {0};
struct TALER_CoinSpendSignatureP sig;
struct TALER_AgeCommitmentHash hac;
struct TALER_AgeCommitmentHashP hac;
bool no_hac;
struct TALER_Amount deposit_fee;
struct GNUNET_JSON_Specification spec[] = {
@ -938,7 +938,7 @@ help_melt (struct CoinHistoryParseContext *pc,
{
struct TALER_CoinSpendSignatureP sig;
struct TALER_RefreshCommitmentP rc;
struct TALER_AgeCommitmentHash h_age_commitment;
struct TALER_AgeCommitmentHashP h_age_commitment;
bool no_hac;
struct TALER_Amount melt_fee;
struct GNUNET_JSON_Specification spec[] = {
@ -1292,7 +1292,7 @@ help_purse_deposit (struct CoinHistoryParseContext *pc,
struct TALER_CoinSpendSignatureP coin_sig;
const char *exchange_base_url;
bool refunded;
struct TALER_AgeCommitmentHash phac = { 0 };
struct TALER_AgeCommitmentHashP phac = { 0 };
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("purse_pub",
&purse_pub),
@ -1758,7 +1758,7 @@ TALER_EXCHANGE_check_purse_coin_conflict_ (
const char *exchange_url,
const json_t *proof,
struct TALER_DenominationHashP *h_denom_pub,
struct TALER_AgeCommitmentHash *phac,
struct TALER_AgeCommitmentHashP *phac,
struct TALER_CoinSpendPublicKeyP *coin_pub,
struct TALER_CoinSpendSignatureP *coin_sig)
{

View File

@ -87,7 +87,7 @@ TALER_EXCHANGE_check_purse_coin_conflict_ (
const char *exchange_url,
const json_t *proof,
struct TALER_DenominationHashP *h_denom_pub,
struct TALER_AgeCommitmentHash *phac,
struct TALER_AgeCommitmentHashP *phac,
struct TALER_CoinSpendPublicKeyP *coin_pub,
struct TALER_CoinSpendSignatureP *coin_sig);

View File

@ -149,7 +149,7 @@ parse_link_coin (const struct TALER_EXCHANGE_LinkHandle *lh,
if (NULL != lh->age_commitment_proof)
{
lci->age_commitment_proof = GNUNET_new (struct TALER_AgeCommitmentProof);
lci->h_age_commitment = GNUNET_new (struct TALER_AgeCommitmentHash);
lci->h_age_commitment = GNUNET_new (struct TALER_AgeCommitmentHashP);
GNUNET_assert (GNUNET_OK ==
TALER_age_commitment_derive (

View File

@ -57,7 +57,7 @@ struct Deposit
/**
* Age restriction hash for the coin.
*/
struct TALER_AgeCommitmentHash ahac;
struct TALER_AgeCommitmentHashP ahac;
/**
* How much did we say the coin contributed.
@ -381,7 +381,7 @@ handle_purse_create_deposit_finished (void *cls,
struct TALER_CoinSpendPublicKeyP coin_pub;
struct TALER_CoinSpendSignatureP coin_sig;
struct TALER_DenominationHashP h_denom_pub;
struct TALER_AgeCommitmentHash phac;
struct TALER_AgeCommitmentHashP phac;
bool found = false;
if (GNUNET_OK !=
@ -594,7 +594,7 @@ TALER_EXCHANGE_purse_create_with_deposit (
const struct TALER_AgeCommitmentProof *acp = deposit->age_commitment_proof;
struct Deposit *d = &pch->deposits[i];
json_t *jdeposit;
struct TALER_AgeCommitmentHash *aghp = NULL;
struct TALER_AgeCommitmentHashP *aghp = NULL;
struct TALER_AgeAttestation attest;
struct TALER_AgeAttestation *attestp = NULL;

View File

@ -57,7 +57,7 @@ struct Coin
/**
* Age restriction hash for the coin.
*/
struct TALER_AgeCommitmentHash ahac;
struct TALER_AgeCommitmentHashP ahac;
/**
* How much did we say the coin contributed.
@ -240,7 +240,7 @@ handle_purse_deposit_finished (void *cls,
struct TALER_CoinSpendPublicKeyP coin_pub;
struct TALER_CoinSpendSignatureP coin_sig;
struct TALER_DenominationHashP h_denom_pub;
struct TALER_AgeCommitmentHash phac;
struct TALER_AgeCommitmentHashP phac;
bool found = false;
if (GNUNET_OK !=
@ -513,7 +513,7 @@ TALER_EXCHANGE_purse_deposit (
const struct TALER_AgeCommitmentProof *acp = deposit->age_commitment_proof;
struct Coin *coin = &pch->coins[i];
json_t *jdeposit;
struct TALER_AgeCommitmentHash *achp = NULL;
struct TALER_AgeCommitmentHashP *achp = NULL;
struct TALER_AgeAttestation attest;
struct TALER_AgeAttestation *attestp = NULL;

View File

@ -168,7 +168,7 @@ TALER_EXCHANGE_get_melt_data_ (
union TALER_DenominationBlindingKeyP *bks = &fcd->bks[i];
struct TALER_PlanchetDetail pd;
struct TALER_CoinPubHashP c_hash;
struct TALER_AgeCommitmentHash *ach = NULL;
struct TALER_AgeCommitmentHashP *ach = NULL;
TALER_transfer_secret_to_planchet_secret (&trans_sec,
j,
@ -187,7 +187,7 @@ TALER_EXCHANGE_get_melt_data_ (
{
fcd->age_commitment_proof[i] = GNUNET_new (struct
TALER_AgeCommitmentProof);
ach = GNUNET_new (struct TALER_AgeCommitmentHash);
ach = GNUNET_new (struct TALER_AgeCommitmentHashP);
GNUNET_assert (GNUNET_OK ==
TALER_age_commitment_derive (

View File

@ -57,7 +57,7 @@ struct MeltedCoin
* age commitment was set.
*/
const struct TALER_AgeCommitmentProof *age_commitment_proof;
const struct TALER_AgeCommitmentHash *h_age_commitment;
const struct TALER_AgeCommitmentHashP *h_age_commitment;
/**
* Timestamp indicating when coins of this denomination become invalid.

View File

@ -168,7 +168,7 @@ refresh_reveal_ok (struct TALER_EXCHANGE_RefreshesRevealHandle *rrh,
if (NULL != rci->age_commitment_proof)
{
rci->h_age_commitment = GNUNET_new (struct TALER_AgeCommitmentHash);
rci->h_age_commitment = GNUNET_new (struct TALER_AgeCommitmentHashP);
TALER_age_commitment_hash (
&rci->age_commitment_proof->commitment,
rci->h_age_commitment);

View File

@ -234,7 +234,7 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
struct TALER_Amount deposit_fee;
struct TALER_MerchantWireHashP h_wire;
struct TALER_PrivateContractHashP h_contract_terms;
struct TALER_AgeCommitmentHash h_age_commitment;
struct TALER_AgeCommitmentHashP h_age_commitment;
bool no_hac;
struct TALER_ExtensionPolicyHashP h_policy;
bool no_h_policy;

View File

@ -510,8 +510,8 @@ TALER_EXCHANGE_reserves_open (
{
const struct TALER_EXCHANGE_PurseDeposit *pd = &coin_payments[i];
const struct TALER_AgeCommitmentProof *acp = pd->age_commitment_proof;
struct TALER_AgeCommitmentHash ahac;
struct TALER_AgeCommitmentHash *achp = NULL;
struct TALER_AgeCommitmentHashP ahac;
struct TALER_AgeCommitmentHashP *achp = NULL;
struct CoinData *cd = &roh->coins[i];
json_t *cp;

View File

@ -91,7 +91,7 @@ struct TALER_EXCHANGE_WithdrawHandle
/**
* Hash of the age commitment for this coin, if applicable. Maybe NULL
*/
const struct TALER_AgeCommitmentHash *ach;
const struct TALER_AgeCommitmentHashP *ach;
/**
* Denomination key we are withdrawing.

View File

@ -82,7 +82,7 @@ struct CoinState
* its hash, respectivelly, NULL otherwise.
*/
struct TALER_AgeCommitmentProof *age_commitment_proof;
struct TALER_AgeCommitmentHash *h_age_commitment;
struct TALER_AgeCommitmentHashP *h_age_commitment;
/**
* Reserve history entry that corresponds to this coin.
@ -484,12 +484,12 @@ TALER_TESTING_cmd_batch_withdraw (const char *label,
if (0 < age)
{
struct TALER_AgeCommitmentProof *acp;
struct TALER_AgeCommitmentHash *hac;
struct TALER_AgeCommitmentHashP *hac;
struct GNUNET_HashCode seed;
struct TALER_AgeMask mask;
acp = GNUNET_new (struct TALER_AgeCommitmentProof);
hac = GNUNET_new (struct TALER_AgeCommitmentHash);
hac = GNUNET_new (struct TALER_AgeCommitmentHashP);
mask = TALER_extensions_get_age_restriction_mask ();
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
&seed,

View File

@ -289,7 +289,7 @@ deposit_run (void *cls,
const struct TALER_CoinSpendPrivateKeyP *coin_priv;
struct TALER_CoinSpendPublicKeyP coin_pub;
const struct TALER_AgeCommitmentProof *age_commitment_proof = NULL;
struct TALER_AgeCommitmentHash h_age_commitment = {0};
struct TALER_AgeCommitmentHashP h_age_commitment = {0};
const struct TALER_EXCHANGE_DenomPublicKey *denom_pub;
const struct TALER_DenominationSignature *denom_pub_sig;
struct TALER_CoinSpendSignatureP coin_sig;

View File

@ -245,7 +245,7 @@ insert_deposit_run (void *cls,
{
uint64_t known_coin_id;
struct TALER_DenominationHashP dph;
struct TALER_AgeCommitmentHash agh;
struct TALER_AgeCommitmentHashP agh;
if ( (GNUNET_OK !=
ids->dbc->plugin->start (ids->dbc->plugin->cls,

View File

@ -75,7 +75,7 @@ struct TALER_TESTING_FreshCoinData
* applicable.
*/
struct TALER_AgeCommitmentProof *age_commitment_proof;
struct TALER_AgeCommitmentHash *h_age_commitment;
struct TALER_AgeCommitmentHashP *h_age_commitment;
/**
* The blinding key (needed for recoup operations).
@ -1027,7 +1027,7 @@ melt_run (void *cls,
struct TALER_Amount melt_amount;
struct TALER_Amount fresh_amount;
const struct TALER_AgeCommitmentProof *age_commitment_proof;
const struct TALER_AgeCommitmentHash *h_age_commitment;
const struct TALER_AgeCommitmentHashP *h_age_commitment;
const struct TALER_DenominationSignature *melt_sig;
const struct TALER_EXCHANGE_DenomPublicKey *melt_denom_pub;
const struct TALER_TESTING_Command *coin_command;

View File

@ -142,7 +142,7 @@ struct WithdrawState
* its hash, respectivelly, NULL otherwise.
*/
struct TALER_AgeCommitmentProof *age_commitment_proof;
struct TALER_AgeCommitmentHash *h_age_commitment;
struct TALER_AgeCommitmentHashP *h_age_commitment;
/**
* Reserve history entry that corresponds to this operation.
@ -581,12 +581,12 @@ TALER_TESTING_cmd_withdraw_amount (const char *label,
if (0 < age)
{
struct TALER_AgeCommitmentProof *acp;
struct TALER_AgeCommitmentHash *hac;
struct TALER_AgeCommitmentHashP *hac;
struct GNUNET_HashCode seed;
struct TALER_AgeMask mask;
acp = GNUNET_new (struct TALER_AgeCommitmentProof);
hac = GNUNET_new (struct TALER_AgeCommitmentHash);
hac = GNUNET_new (struct TALER_AgeCommitmentHashP);
mask = TALER_extensions_get_age_restriction_mask ();
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
&seed,

View File

@ -27,7 +27,7 @@
void
TALER_age_commitment_hash (
const struct TALER_AgeCommitment *commitment,
struct TALER_AgeCommitmentHash *ahash)
struct TALER_AgeCommitmentHashP *ahash)
{
struct GNUNET_HashContext *hash_context;
struct GNUNET_HashCode hash;
@ -35,7 +35,7 @@ TALER_age_commitment_hash (
GNUNET_assert (NULL != ahash);
if (NULL == commitment)
{
memset (ahash, 0, sizeof(struct TALER_AgeCommitmentHash));
memset (ahash, 0, sizeof(struct TALER_AgeCommitmentHashP));
return;
}

View File

@ -29,7 +29,7 @@
/**
* Used in TALER_AgeCommitmentHash_isNullOrZero for comparison
*/
const struct TALER_AgeCommitmentHash TALER_ZeroAgeCommitmentHash = {0};
const struct TALER_AgeCommitmentHashP TALER_ZeroAgeCommitmentHash = {0};
/**
* Function called by libgcrypt on serious errors.
@ -258,7 +258,7 @@ TALER_planchet_prepare (const struct TALER_DenominationPublicKey *dk,
const struct TALER_ExchangeWithdrawValues *alg_values,
const union TALER_DenominationBlindingKeyP *bks,
const struct TALER_CoinSpendPrivateKeyP *coin_priv,
const struct TALER_AgeCommitmentHash *ach,
const struct TALER_AgeCommitmentHashP *ach,
struct TALER_CoinPubHashP *c_hash,
struct TALER_PlanchetDetail *pd
)
@ -299,7 +299,7 @@ TALER_planchet_to_coin (
const struct TALER_BlindedDenominationSignature *blind_sig,
const union TALER_DenominationBlindingKeyP *bks,
const struct TALER_CoinSpendPrivateKeyP *coin_priv,
const struct TALER_AgeCommitmentHash *ach,
const struct TALER_AgeCommitmentHashP *ach,
const struct TALER_CoinPubHashP *c_hash,
const struct TALER_ExchangeWithdrawValues *alg_values,
struct TALER_FreshCoin *coin)
@ -412,7 +412,7 @@ TALER_refresh_get_commitment (struct TALER_RefreshCommitmentP *rc,
void
TALER_coin_pub_hash (const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_AgeCommitmentHash *ach,
const struct TALER_AgeCommitmentHashP *ach,
struct TALER_CoinPubHashP *coin_h)
{
if (TALER_AgeCommitmentHash_isNullOrZero (ach))
@ -427,7 +427,7 @@ TALER_coin_pub_hash (const struct TALER_CoinSpendPublicKeyP *coin_pub,
/* Coin comes with age commitment. Take the hash of the age commitment
* into account */
const size_t key_s = sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey);
const size_t age_s = sizeof(struct TALER_AgeCommitmentHash);
const size_t age_s = sizeof(struct TALER_AgeCommitmentHashP);
char data[key_s + age_s];
GNUNET_memcpy (&data[0],

View File

@ -299,7 +299,7 @@ enum GNUNET_GenericReturnValue
TALER_denom_blind (
const struct TALER_DenominationPublicKey *dk,
const union TALER_DenominationBlindingKeyP *coin_bks,
const struct TALER_AgeCommitmentHash *ach,
const struct TALER_AgeCommitmentHashP *ach,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_ExchangeWithdrawValues *alg_values,
struct TALER_CoinPubHashP *c_hash,

View File

@ -359,6 +359,62 @@ TALER_exchange_online_melt_confirmation_verify (
}
GNUNET_NETWORK_STRUCT_BEGIN
/**
* @brief Format of the block signed by the Exchange in response to a
* successful "/reserves/$RESERVE_PUB/age-withdraw" request. Hereby the
* exchange affirms that the commitment along with the maximum age group and
* the amount were accepted. This also commits the exchange to a particular
* index to not be revealed during the reveal.
*/
struct TALER_AgeWithdrawConfirmationPS
{
/**
* Purpose is #TALER_SIGNATURE_EXCHANGE_CONFIRM_AGE_WITHDRAW. Signed by a
* `struct TALER_ExchangePublicKeyP` using EdDSA.
*/
struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
/**
* Commitment made in the /reserves/$RESERVE_PUB/age-withdraw.
*/
struct TALER_AgeWithdrawCommitmentHashP h_commitment GNUNET_PACKED;
/**
* Index that the client will not have to reveal, in NBO.
* Must be smaller than #TALER_CNC_KAPPA.
*/
uint32_t noreveal_index GNUNET_PACKED;
};
GNUNET_NETWORK_STRUCT_END
enum TALER_ErrorCode
TALER_exchange_online_age_withdraw_confirmation_sign (
TALER_ExchangeSignCallback scb,
const struct TALER_AgeWithdrawCommitmentHashP *h_commitment,
uint32_t noreveal_index,
struct TALER_ExchangePublicKeyP *pub,
struct TALER_ExchangeSignatureP *sig)
{
struct TALER_AgeWithdrawConfirmationPS confirm = {
.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_AGE_WITHDRAW),
.purpose.size = htonl (sizeof (confirm)),
.h_commitment = *h_commitment,
.noreveal_index = htonl (noreveal_index)
};
return scb (&confirm.purpose,
pub,
sig);
}
/* TODO:oec: add signature for age-withdraw, age-reveal */
GNUNET_NETWORK_STRUCT_BEGIN
/**

View File

@ -124,12 +124,12 @@ test_planchets_rsa (uint8_t age)
struct TALER_BlindedDenominationSignature blind_sig;
struct TALER_FreshCoin coin;
struct TALER_CoinPubHashP c_hash;
struct TALER_AgeCommitmentHash *ach = NULL;
struct TALER_AgeCommitmentHashP *ach = NULL;
if (0 < age)
{
struct TALER_AgeCommitmentProof acp;
struct TALER_AgeCommitmentHash ah = {0};
struct TALER_AgeCommitmentHashP ah = {0};
struct GNUNET_HashCode seed;
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
@ -256,11 +256,11 @@ test_planchets_cs (uint8_t age)
struct TALER_BlindedDenominationSignature blind_sig;
struct TALER_FreshCoin coin;
struct TALER_ExchangeWithdrawValues alg_values;
struct TALER_AgeCommitmentHash *ach = NULL;
struct TALER_AgeCommitmentHashP *ach = NULL;
if (0 < age)
{
struct TALER_AgeCommitmentHash ah = {0};
struct TALER_AgeCommitmentHashP ah = {0};
struct TALER_AgeCommitmentProof acp;
struct GNUNET_HashCode seed;

View File

@ -269,7 +269,7 @@ test_signing (struct TALER_CRYPTO_RsaDenominationHelper *dh)
bool success = false;
struct TALER_PlanchetMasterSecretP ps;
struct TALER_ExchangeWithdrawValues alg_values;
struct TALER_AgeCommitmentHash ach;
struct TALER_AgeCommitmentHashP ach;
struct TALER_CoinPubHashP c_hash;
struct TALER_CoinSpendPrivateKeyP coin_priv;
union TALER_DenominationBlindingKeyP bks;
@ -458,7 +458,7 @@ test_batch_signing (struct TALER_CRYPTO_RsaDenominationHelper *dh,
bool success = false;
struct TALER_PlanchetMasterSecretP ps[batch_size];
struct TALER_ExchangeWithdrawValues alg_values[batch_size];
struct TALER_AgeCommitmentHash ach[batch_size];
struct TALER_AgeCommitmentHashP ach[batch_size];
struct TALER_CoinPubHashP c_hash[batch_size];
struct TALER_CoinSpendPrivateKeyP coin_priv[batch_size];
union TALER_DenominationBlindingKeyP bks[batch_size];
@ -672,7 +672,7 @@ perf_signing (struct TALER_CRYPTO_RsaDenominationHelper *dh,
struct GNUNET_TIME_Relative duration;
struct TALER_PlanchetMasterSecretP ps;
struct TALER_CoinSpendPrivateKeyP coin_priv;
struct TALER_AgeCommitmentHash ach;
struct TALER_AgeCommitmentHashP ach;
union TALER_DenominationBlindingKeyP bks;
struct TALER_ExchangeWithdrawValues alg_values;

View File

@ -83,7 +83,7 @@ cp_to_j (
json_t *j_proof;
json_t *j_pubs;
json_t *j_privs;
struct TALER_AgeCommitmentHash hac = {0};
struct TALER_AgeCommitmentHashP hac = {0};
char buf[256] = {0};
TALER_age_commitment_hash (&acp->commitment, &hac);

View File

@ -46,7 +46,7 @@ struct TALER_DepositRequestPS
* Hash over the age commitment that went into the coin. Maybe all zero, if
* age commitment isn't applicable to the denomination.
*/
struct TALER_AgeCommitmentHash h_age_commitment GNUNET_PACKED;
struct TALER_AgeCommitmentHashP h_age_commitment GNUNET_PACKED;
/**
* Hash over optional policy extension attributes shared with the exchange.
@ -119,7 +119,7 @@ TALER_wallet_deposit_sign (
const struct TALER_Amount *deposit_fee,
const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_AgeCommitmentHash *h_age_commitment,
const struct TALER_AgeCommitmentHashP *h_age_commitment,
const struct TALER_ExtensionPolicyHashP *h_policy,
const struct TALER_DenominationHashP *h_denom_pub,
const struct GNUNET_TIME_Timestamp wallet_timestamp,
@ -159,7 +159,7 @@ TALER_wallet_deposit_verify (
const struct TALER_Amount *deposit_fee,
const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_AgeCommitmentHash *h_age_commitment,
const struct TALER_AgeCommitmentHashP *h_age_commitment,
const struct TALER_ExtensionPolicyHashP *h_policy,
const struct TALER_DenominationHashP *h_denom_pub,
struct GNUNET_TIME_Timestamp wallet_timestamp,
@ -230,7 +230,7 @@ struct TALER_LinkDataPS
/**
* Hash of the age commitment, if applicable. Can be all zero
*/
struct TALER_AgeCommitmentHash h_age_commitment;
struct TALER_AgeCommitmentHashP h_age_commitment;
/**
* Hash of the blinded new coin.
@ -426,7 +426,7 @@ struct TALER_RefreshMeltCoinAffirmationPS
* the hash of the age commitment vector. It must be all zeroes if no age
* commitment was provided.
*/
struct TALER_AgeCommitmentHash h_age_commitment GNUNET_PACKED;
struct TALER_AgeCommitmentHashP h_age_commitment GNUNET_PACKED;
/**
* How much of the value of the coin should be melted? This amount
@ -458,7 +458,7 @@ TALER_wallet_melt_sign (
const struct TALER_Amount *melt_fee,
const struct TALER_RefreshCommitmentP *rc,
const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_AgeCommitmentHash *h_age_commitment,
const struct TALER_AgeCommitmentHashP *h_age_commitment,
const struct TALER_CoinSpendPrivateKeyP *coin_priv,
struct TALER_CoinSpendSignatureP *coin_sig)
{
@ -490,7 +490,7 @@ TALER_wallet_melt_verify (
const struct TALER_Amount *melt_fee,
const struct TALER_RefreshCommitmentP *rc,
const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_AgeCommitmentHash *h_age_commitment,
const struct TALER_AgeCommitmentHashP *h_age_commitment,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_CoinSpendSignatureP *coin_sig)
{
@ -604,6 +604,92 @@ TALER_wallet_withdraw_verify (
}
GNUNET_NETWORK_STRUCT_BEGIN
/**
* @brief Format used for to generate the signature on a request to
* age-withdraw from a reserve.
*/
struct TALER_AgeWithdrawRequestPS
{
/**
* Purpose must be #TALER_SIGNATURE_WALLET_RESERVE_WITHDRAW.
* Used with an EdDSA signature of a `struct TALER_ReservePublicKeyP`.
*/
struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
/**
* Hash of the commitment of n*kappa coins
*/
struct TALER_AgeWithdrawCommitmentHashP h_commitment GNUNET_PACKED;
/**
* Value of the coin being exchanged (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;
/**
* Maximum age group that the coins are going to be restricted to.
*/
uint32_t max_age_group;
};
GNUNET_NETWORK_STRUCT_END
void
TALER_wallet_age_withdraw_sign (
const struct TALER_AgeWithdrawCommitmentHashP *h_commitment,
const struct TALER_Amount *amount_with_fee,
uint32_t max_age_group,
const struct TALER_ReservePrivateKeyP *reserve_priv,
struct TALER_ReserveSignatureP *reserve_sig)
{
struct TALER_AgeWithdrawRequestPS req = {
.purpose.size = htonl (sizeof (req)),
.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_RESERVE_AGE_WITHDRAW),
.h_commitment = *h_commitment,
.max_age_group = max_age_group
};
TALER_amount_hton (&req.amount_with_fee,
amount_with_fee);
GNUNET_CRYPTO_eddsa_sign (&reserve_priv->eddsa_priv,
&req,
&reserve_sig->eddsa_signature);
}
enum GNUNET_GenericReturnValue
TALER_wallet_age_withdraw_verify (
const struct TALER_AgeWithdrawCommitmentHashP *h_commitment,
const struct TALER_Amount *amount_with_fee,
uint32_t max_age_group,
const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_ReserveSignatureP *reserve_sig)
{
struct TALER_AgeWithdrawRequestPS awsrd = {
.purpose.size = htonl (sizeof (awsrd)),
.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_RESERVE_AGE_WITHDRAW),
.h_commitment = *h_commitment,
.max_age_group = max_age_group
};
TALER_amount_hton (&awsrd.amount_with_fee,
amount_with_fee);
return GNUNET_CRYPTO_eddsa_verify (
TALER_SIGNATURE_WALLET_RESERVE_AGE_WITHDRAW,
&awsrd,
&reserve_sig->eddsa_signature,
&reserve_pub->eddsa_pub);
}
GNUNET_NETWORK_STRUCT_BEGIN
@ -1021,7 +1107,7 @@ struct TALER_PurseDepositPS
* Hash over the age commitment that went into the coin. Maybe all zero, if
* age commitment isn't applicable to the denomination.
*/
struct TALER_AgeCommitmentHash h_age_commitment GNUNET_PACKED;
struct TALER_AgeCommitmentHashP h_age_commitment GNUNET_PACKED;
/**
* Purse to deposit funds into.
@ -1043,7 +1129,7 @@ TALER_wallet_purse_deposit_sign (
const struct TALER_PurseContractPublicKeyP *purse_pub,
const struct TALER_Amount *amount,
const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_AgeCommitmentHash *h_age_commitment,
const struct TALER_AgeCommitmentHashP *h_age_commitment,
const struct TALER_CoinSpendPrivateKeyP *coin_priv,
struct TALER_CoinSpendSignatureP *coin_sig)
{
@ -1072,7 +1158,7 @@ TALER_wallet_purse_deposit_verify (
const struct TALER_PurseContractPublicKeyP *purse_pub,
const struct TALER_Amount *amount,
const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_AgeCommitmentHash *h_age_commitment,
const struct TALER_AgeCommitmentHashP *h_age_commitment,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_CoinSpendSignatureP *coin_sig)
{