refactor h_extensions -> h_policy, and structs accordingly

This commit is contained in:
Özgür Kesim 2022-10-05 19:26:04 +02:00
parent bcbd909892
commit 1f6c8d0c33
Signed by: oec
GPG Key ID: 3D76A56D79EDD9D7
25 changed files with 248 additions and 111 deletions

@ -1 +1 @@
Subproject commit 57d96e8e123df90c804a821874fc6cb88671ab75
Subproject commit 36f9c499683d33cf3d1a267c6f4ca9e48301b535

View File

@ -227,7 +227,7 @@ verify_and_execute_deposit_confirmation (
TALER_exchange_online_deposit_confirmation_verify (
&dc->h_contract_terms,
&dc->h_wire,
NULL /* h_extensions! */,
&dc->h_policy,
dc->exchange_timestamp,
dc->wire_deadline,
dc->refund_deadline,
@ -276,8 +276,8 @@ TAH_DEPOSIT_CONFIRMATION_handler (struct TAH_RequestHandler *rh,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("h_contract_terms",
&dc.h_contract_terms),
GNUNET_JSON_spec_fixed_auto ("h_extensions",
&dc.h_extensions),
GNUNET_JSON_spec_fixed_auto ("h_policy",
&dc.h_policy),
GNUNET_JSON_spec_fixed_auto ("h_wire",
&dc.h_wire),
GNUNET_JSON_spec_timestamp ("exchange_timestamp",

View File

@ -1625,7 +1625,8 @@ deposit_cb (void *cls,
&h_wire,
&deposit->h_contract_terms,
&deposit->coin.h_age_commitment,
NULL /* FIXME-Oec: #7270: h_extensions! */,
deposit->no_policy_details ? NULL :
&deposit->h_policy,
&h_denom_pub,
deposit->timestamp,
&deposit->merchant_pub,

View File

@ -245,7 +245,7 @@ CREATE TABLE IF NOT EXISTS deposit_confirmations
(master_pub BYTEA NOT NULL CONSTRAINT master_pub_ref REFERENCES auditor_exchanges(master_pub) ON DELETE CASCADE
,serial_id BIGSERIAL NOT NULL UNIQUE
,h_contract_terms BYTEA NOT NULL CHECK (LENGTH(h_contract_terms)=64)
,h_extensions BYTEA NOT NULL CHECK (LENGTH(h_contract_terms)=64)
,h_policy BYTEA NOT NULL CHECK (LENGTH(h_policy)=64)
,h_wire BYTEA NOT NULL CHECK (LENGTH(h_wire)=64)
,exchange_timestamp INT8 NOT NULL
,refund_deadline INT8 NOT NULL

View File

@ -195,7 +195,7 @@ setup_connection (struct PostgresClosure *pg)
"INSERT INTO deposit_confirmations "
"(master_pub"
",h_contract_terms"
",h_extensions"
",h_policy"
",h_wire"
",exchange_timestamp"
",wire_deadline"
@ -214,7 +214,7 @@ setup_connection (struct PostgresClosure *pg)
"SELECT"
" serial_id"
",h_contract_terms"
",h_extensions"
",h_policy"
",h_wire"
",exchange_timestamp"
",wire_deadline"
@ -1087,7 +1087,7 @@ postgres_insert_deposit_confirmation (
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (&dc->master_public_key),
GNUNET_PQ_query_param_auto_from_type (&dc->h_contract_terms),
GNUNET_PQ_query_param_auto_from_type (&dc->h_extensions),
GNUNET_PQ_query_param_auto_from_type (&dc->h_policy),
GNUNET_PQ_query_param_auto_from_type (&dc->h_wire),
GNUNET_PQ_query_param_timestamp (&dc->exchange_timestamp),
GNUNET_PQ_query_param_timestamp (&dc->wire_deadline),
@ -1168,8 +1168,8 @@ deposit_confirmation_cb (void *cls,
&serial_id),
GNUNET_PQ_result_spec_auto_from_type ("h_contract_terms",
&dc.h_contract_terms),
GNUNET_PQ_result_spec_auto_from_type ("h_extensions",
&dc.h_extensions),
GNUNET_PQ_result_spec_auto_from_type ("h_policy",
&dc.h_policy),
GNUNET_PQ_result_spec_auto_from_type ("h_wire",
&dc.h_wire),
GNUNET_PQ_result_spec_timestamp ("exchange_timestamp",

View File

@ -87,15 +87,16 @@ struct BatchDepositContext
const char *payto_uri;
/**
* Additional details for extensions relevant for this
* Additional details for policy relevant for this
* deposit operation, possibly NULL!
*/
json_t *extension_details;
json_t *policy_details;
bool no_policy_details;
/**
* Hash over @e extension_details.
* Hash over @e policy_details, might be all zero;
*/
struct TALER_ExtensionContractHashP h_extensions;
struct TALER_ExtensionPolicyHashP h_policy;
/**
* Time when this request was generated. Used, for example, to
@ -173,7 +174,7 @@ again:
&TEH_keys_exchange_sign_,
&bdc->h_contract_terms,
&bdc->h_wire,
&bdc->h_extensions,
bdc->no_policy_details ? NULL : &bdc->h_policy,
bdc->exchange_timestamp,
bdc->wire_deadline,
bdc->refund_deadline,
@ -474,7 +475,7 @@ parse_coin (struct MHD_Connection *connection,
&dc->h_wire,
&dc->h_contract_terms,
&deposit->coin.h_age_commitment,
&dc->h_extensions,
dc->no_policy_details ? NULL : &dc->h_policy,
&deposit->coin.denom_pub_hash,
dc->timestamp,
&dc->merchant_pub,
@ -500,7 +501,7 @@ parse_coin (struct MHD_Connection *connection,
but rather insert them ONCE and then per-coin only use
the resulting extension UUID/serial; so the data structure
here should be changed once we look at extensions in earnest. */
deposit->extension_details = dc->extension_details;
deposit->policy_details = dc->policy_details;
deposit->timestamp = dc->timestamp;
deposit->refund_deadline = dc->refund_deadline;
deposit->wire_deadline = dc->wire_deadline;
@ -517,7 +518,6 @@ TEH_handler_batch_deposit (struct TEH_RequestContext *rc,
struct BatchDepositContext dc;
json_t *coins;
bool no_refund_deadline = true;
bool no_extensions = true;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("merchant_payto_uri",
&dc.payto_uri),
@ -530,9 +530,9 @@ TEH_handler_batch_deposit (struct TEH_RequestContext *rc,
GNUNET_JSON_spec_json ("coins",
&coins),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("extension_details",
&dc.extension_details),
&no_extensions),
GNUNET_JSON_spec_json ("policy",
&dc.policy_details),
&dc.no_policy_details),
GNUNET_JSON_spec_timestamp ("timestamp",
&dc.timestamp),
GNUNET_JSON_spec_mark_optional (
@ -607,11 +607,11 @@ TEH_handler_batch_deposit (struct TEH_RequestContext *rc,
TALER_merchant_wire_signature_hash (dc.payto_uri,
&dc.wire_salt,
&dc.h_wire);
/* FIXME-OEC: #7270 hash actual extension JSON object here */
// if (! no_extensions)
memset (&dc.h_extensions,
0,
sizeof (dc.h_extensions));
if (! dc.no_policy_details)
{
TALER_deposit_policy_hash (dc.policy_details,
&dc.h_policy);
}
dc.num_coins = json_array_size (coins);
if (0 == dc.num_coins)
{

View File

@ -47,7 +47,7 @@
* @param connection connection to the client
* @param coin_pub public key of the coin
* @param h_wire hash of wire details
* @param h_extensions hash of applicable extensions
* @param h_policy hash of applicable extensions
* @param h_contract_terms hash of contract details
* @param exchange_timestamp exchange's timestamp
* @param refund_deadline until when this deposit be refunded
@ -61,7 +61,7 @@ reply_deposit_success (
struct MHD_Connection *connection,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_ExtensionContractHashP *h_extensions,
const struct TALER_ExtensionPolicyHashP *h_policy,
const struct TALER_PrivateContractHashP *h_contract_terms,
struct GNUNET_TIME_Timestamp exchange_timestamp,
struct GNUNET_TIME_Timestamp refund_deadline,
@ -78,7 +78,7 @@ reply_deposit_success (
&TEH_keys_exchange_sign_,
h_contract_terms,
h_wire,
h_extensions,
h_policy,
exchange_timestamp,
wire_deadline,
refund_deadline,
@ -208,6 +208,86 @@ deposit_transaction (void *cls,
}
/**
* @brief check the provided policy
*
* @param[in] policy_details JSON object provided by the client with prolicy
* @param[out] hc On success, will contain the hash of the normalized policy_details object
* @param[out] handler_out On success, the handler might provide an output
* @param[out] error_hint On failure, might contain a hint of the error from the extension
* @return GNUNET_OK on success.
*/
enum GNUNET_GenericReturnValue
check_policy_details (
json_t *policy_details,
struct TALER_ExtensionPolicyHashP *hc,
json_t **handler_out,
char **error_hint)
{
const char *type = NULL;
const struct TALER_Extension *extension;
enum GNUNET_GenericReturnValue ret;
*error_hint = NULL;
if ((NULL == policy_details) ||
(! json_is_object (policy_details)))
{
*error_hint = "invalid policy object";
return GNUNET_SYSERR;
}
// parse and evaluate the object
{
json_t *jtype = json_object_get (
policy_details,
"type");
if (NULL == jtype)
{
*error_hint = "no type in policy object";
return GNUNET_SYSERR;
}
type = json_string_value (jtype);
if (NULL == type)
{
*error_hint = "invalid type in policy object";
return GNUNET_SYSERR;
}
extension = TALER_extensions_get_by_name (type);
if ((NULL == extension) ||
(NULL == extension->deposit_handler))
{
GNUNET_break (0);
*error_hint = "no such policy";
return GNUNET_SYSERR;
}
ret = extension->deposit_handler (policy_details,
handler_out);
if (GNUNET_OK != ret)
{
GNUNET_break (0);
if (NULL != *handler_out)
{
*error_hint = json_dumps (*handler_out, JSON_INDENT (2));
}
else
{
GNUNET_break (1);
*error_hint = "unknown error with the policy";
}
return ret;
}
}
TALER_deposit_policy_hash (policy_details,
hc);
return GNUNET_OK;
}
MHD_RESULT
TEH_handler_deposit (struct MHD_Connection *connection,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
@ -216,6 +296,9 @@ TEH_handler_deposit (struct MHD_Connection *connection,
struct DepositContext dc;
struct TALER_EXCHANGEDB_Deposit deposit;
const char *payto_uri;
struct TALER_ExtensionPolicyHashP h_policy;
struct TALER_ExtensionPolicyHashP *ph_policy = NULL;
bool no_policy;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("merchant_payto_uri",
&payto_uri),
@ -240,10 +323,16 @@ TEH_handler_deposit (struct MHD_Connection *connection,
&deposit.csig),
GNUNET_JSON_spec_timestamp ("timestamp",
&deposit.timestamp),
/* TODO: this will move to an extension for refunds */
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_timestamp ("refund_deadline",
&deposit.refund_deadline),
NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("policy",
&deposit.policy_details),
&no_policy),
GNUNET_JSON_spec_timestamp ("wire_transfer_deadline",
&deposit.wire_deadline),
GNUNET_JSON_spec_end ()
@ -383,6 +472,31 @@ TEH_handler_deposit (struct MHD_Connection *connection,
NULL);
}
/* TODO: check policy_details */
if (! no_policy)
{
char *hint;
json_t *out;
MHD_RESULT res;
if (GNUNET_OK !=
check_policy_details (dc.deposit->policy_details,
&h_policy,
&out,
&hint))
{
res = TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
/* TODO: new error type needed */
TALER_EC_EXCHANGE_GENERIC_OPERATION_UNKNOWN,
hint);
GNUNET_free (hint);
return res;
}
ph_policy = &h_policy;
}
deposit.deposit_fee = dk->meta.fees.deposit;
/* check coin signature */
switch (dk->denom_pub.cipher)
@ -426,7 +540,7 @@ TEH_handler_deposit (struct MHD_Connection *connection,
&h_wire,
&deposit.h_contract_terms,
&deposit.coin.h_age_commitment,
NULL /* FIXME: h_extensions! */,
ph_policy,
&deposit.coin.denom_pub_hash,
deposit.timestamp,
&deposit.merchant_pub,
@ -481,7 +595,7 @@ TEH_handler_deposit (struct MHD_Connection *connection,
res = reply_deposit_success (connection,
&deposit.coin.coin_pub,
&h_wire,
NULL /* FIXME: h_extensions! */,
ph_policy,
&deposit.h_contract_terms,
dc.exchange_timestamp,
deposit.refund_deadline,

View File

@ -76,7 +76,7 @@ TEH_RESPONSE_compile_transaction_history (
&h_wire,
&deposit->h_contract_terms,
&deposit->h_age_commitment,
NULL /* h_extensions! */,
&deposit->h_policy,
&deposit->h_denom_pub,
deposit->timestamp,
&deposit->merchant_pub,

View File

@ -6265,9 +6265,9 @@ postgres_do_deposit (
GNUNET_PQ_query_param_auto_from_type (&deposit->csig),
GNUNET_PQ_query_param_uint64 (&deposit_shard),
GNUNET_PQ_query_param_bool (extension_blocked),
(NULL == deposit->extension_details)
(NULL == deposit->policy_details)
? GNUNET_PQ_query_param_null ()
: TALER_PQ_query_param_json (deposit->extension_details),
: TALER_PQ_query_param_json (deposit->policy_details),
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {

View File

@ -170,7 +170,7 @@ parse_transcript (const json_t *jtr,
GNUNET_JSON_spec_fixed_auto ("pubkey", &tr->seller_pub),
GNUNET_JSON_spec_timestamp ("time_start", &tr->time_start),
GNUNET_JSON_spec_relative_time ("time_round", &tr->time_round),
GNUNET_JSON_spec_string ("payto", &tr->payto),
GNUNET_JSON_spec_string ("payto_uri", &tr->payto),
GNUNET_JSON_spec_end ()
};

View File

@ -233,7 +233,7 @@ typedef void
*
* @param auditor the auditor handle; the auditor must be ready to operate
* @param h_wire hash of merchant wire details
* @param h_extensions hash over the extensions, if any
* @param h_policy hash over the policy, if any
* @param h_contract_terms hash of the contact of the merchant with the customer (further details are never disclosed to the auditor)
* @param exchange_timestamp timestamp when the contract was finalized, must not be too far in the future
* @param wire_deadline date until which the exchange should wire the funds
@ -257,7 +257,7 @@ struct TALER_AUDITOR_DepositConfirmationHandle *
TALER_AUDITOR_deposit_confirmation (
struct TALER_AUDITOR_Handle *auditor,
const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_ExtensionContractHashP *h_extensions,
const struct TALER_ExtensionPolicyHashP *h_policy,
const struct TALER_PrivateContractHashP *h_contract_terms,
struct GNUNET_TIME_Timestamp exchange_timestamp,
struct GNUNET_TIME_Timestamp wire_deadline,

View File

@ -317,9 +317,9 @@ struct TALER_AUDITORDB_DepositConfirmation
struct TALER_PrivateContractHashP h_contract_terms;
/**
* Hash over the extensions for the deposit.
* Hash over the policy for the deposit.
*/
struct TALER_ExtensionContractHashP h_extensions;
struct TALER_ExtensionPolicyHashP h_policy;
/**
* Hash over the wiring information of the merchant.

View File

@ -638,10 +638,10 @@ struct TALER_PrivateContractHashP
/**
* Hash used to represent the "public" extensions to
* a contract that is shared with the exchange.
* Hash used to represent the policy to a contract that is shared with the
* exchange.
*/
struct TALER_ExtensionContractHashP
struct TALER_ExtensionPolicyHashP
{
/**
* Actual hash value.
@ -3239,7 +3239,7 @@ TALER_wallet_reserve_attest_request_verify (
* @param h_wire hash of the merchants account details
* @param h_contract_terms hash of the contact of the merchant with the customer (further details are never disclosed to the exchange)
* @param h_age_commitment hash over the age commitment, if applicable to the denomination (maybe NULL)
* @param h_extensions hash over the extensions
* @param h_policy hash over the policy
* @param h_denom_pub hash of the coin denomination's public key
* @param coin_priv coins private key
* @param wallet_timestamp timestamp when the contract was finalized, must not be too far in the future
@ -3254,7 +3254,7 @@ TALER_wallet_deposit_sign (
const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_AgeCommitmentHash *h_age_commitment,
const struct TALER_ExtensionContractHashP *h_extensions,
const struct TALER_ExtensionPolicyHashP *h_policy,
const struct TALER_DenominationHashP *h_denom_pub,
struct GNUNET_TIME_Timestamp wallet_timestamp,
const struct TALER_MerchantPublicKeyP *merchant_pub,
@ -3271,7 +3271,7 @@ TALER_wallet_deposit_sign (
* @param h_wire hash of the merchants account details
* @param h_contract_terms hash of the contact of the merchant with the customer (further details are never disclosed to the exchange)
* @param h_age_commitment hash over the age commitment (maybe all zeroes, if not applicable to the denomination)
* @param h_extensions hash over the extensions
* @param h_policy hash over the policy
* @param h_denom_pub hash of the coin denomination's public key
* @param wallet_timestamp timestamp when the contract was finalized, must not be too far in the future
* @param merchant_pub the public key of the merchant (used to identify the merchant for refund requests)
@ -3287,7 +3287,7 @@ TALER_wallet_deposit_verify (
const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_AgeCommitmentHash *h_age_commitment,
const struct TALER_ExtensionContractHashP *h_extensions,
const struct TALER_ExtensionPolicyHashP *h_policy,
const struct TALER_DenominationHashP *h_denom_pub,
struct GNUNET_TIME_Timestamp wallet_timestamp,
const struct TALER_MerchantPublicKeyP *merchant_pub,
@ -3692,7 +3692,7 @@ typedef enum TALER_ErrorCode
* @param scb function to call to create the signature
* @param h_contract_terms hash of the contact of the merchant with the customer (further details are never disclosed to the exchange)
* @param h_wire hash of the merchants account details
* @param h_extensions hash over the extensions, can be NULL
* @param h_policy hash over the policy, can be NULL
* @param exchange_timestamp timestamp when the contract was finalized, must not be too far off
* @param wire_deadline date until which the exchange should wire the funds
* @param refund_deadline date until which the merchant can issue a refund to the customer via the exchange (can be zero if refunds are not allowed); must not be after the @a wire_deadline
@ -3708,7 +3708,7 @@ TALER_exchange_online_deposit_confirmation_sign (
TALER_ExchangeSignCallback scb,
const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_ExtensionContractHashP *h_extensions,
const struct TALER_ExtensionPolicyHashP *h_policy,
struct GNUNET_TIME_Timestamp exchange_timestamp,
struct GNUNET_TIME_Timestamp wire_deadline,
struct GNUNET_TIME_Timestamp refund_deadline,
@ -3724,7 +3724,7 @@ TALER_exchange_online_deposit_confirmation_sign (
*
* @param h_contract_terms hash of the contact of the merchant with the customer (further details are never disclosed to the exchange)
* @param h_wire hash of the merchants account details
* @param h_extensions hash over the extensions, can be NULL
* @param h_policy hash over the policy, can be NULL
* @param exchange_timestamp timestamp when the contract was finalized, must not be too far off
* @param wire_deadline date until which the exchange should wire the funds
* @param refund_deadline date until which the merchant can issue a refund to the customer via the exchange (can be zero if refunds are not allowed); must not be after the @a wire_deadline
@ -3739,7 +3739,7 @@ enum GNUNET_GenericReturnValue
TALER_exchange_online_deposit_confirmation_verify (
const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_ExtensionContractHashP *h_extensions,
const struct TALER_ExtensionPolicyHashP *h_policy,
struct GNUNET_TIME_Timestamp exchange_timestamp,
struct GNUNET_TIME_Timestamp wire_deadline,
struct GNUNET_TIME_Timestamp refund_deadline,
@ -5242,7 +5242,7 @@ TALER_merchant_contract_sign (
/* **************** /management/extensions offline signing **************** */
/**
* Create a signature for the hash of the manifests of extensionss
* Create a signature for the hash of the manifests of extensions
*
* @param h_manifests hash of the JSON object representing the manifests
* @param master_priv private key to sign with

View File

@ -1380,10 +1380,16 @@ struct TALER_EXCHANGEDB_Deposit
char *receiver_wire_account;
/**
* Additional details for extensions relevant for this
* Additional details for a policy relevant for this
* deposit operation, possibly NULL!
*/
json_t *extension_details;
json_t *policy_details;
bool no_policy_details;
/**
* Hash over the @e policy_details. Only filled if no_policy_details is false.
*/
struct TALER_ExtensionPolicyHashP h_policy;
/**
* Time when this request was generated. Used, for example, to
@ -1456,6 +1462,12 @@ struct TALER_EXCHANGEDB_DepositListEntry
*/
struct TALER_PrivateContractHashP h_contract_terms;
/**
* Hash over the poliy data for this deposit
* (remains unknown to the Exchange).
*/
struct TALER_ExtensionPolicyHashP h_policy;
/**
* Hash of the public denomination key used to sign the coin.
*/

View File

@ -767,14 +767,14 @@ TALER_JSON_wire_to_payto (const json_t *wire_s);
/**
* Hash @a extensions in deposits.
* Hash @a policy in deposits.
*
* @param extensions contract extensions to hash
* @param[out] ech where to write the extension hash
* @param policy contract policy to hash
* @param[out] ech where to write the policy hash
*/
void
TALER_deposit_extension_hash (const json_t *extensions,
struct TALER_ExtensionContractHashP *ech);
TALER_deposit_policy_hash (const json_t *policy,
struct TALER_ExtensionPolicyHashP *ech);
/**
* Hash the @a config of an extension, given as JSON

View File

@ -1008,12 +1008,12 @@ TALER_JSON_get_error_code2 (const void *data,
void
TALER_deposit_extension_hash (const json_t *extensions,
struct TALER_ExtensionContractHashP *ech)
TALER_deposit_policy_hash (const json_t *policy,
struct TALER_ExtensionPolicyHashP *ech)
{
GNUNET_assert (GNUNET_OK ==
dump_and_hash (extensions,
"taler-contract-extensions",
dump_and_hash (policy,
"taler-extensions-policy",
&ech->hash));
}

View File

@ -153,7 +153,7 @@ handle_deposit_confirmation_finished (void *cls,
* Verify signature information about the deposit-confirmation.
*
* @param h_wire hash of merchant wire details
* @param h_extensions hash over the extensions, if any
* @param h_policy hash over the extensions, if any
* @param h_contract_terms hash of the contact of the merchant with the customer (further details are never disclosed to the auditor)
* @param exchange_timestamp timestamp when the deposit was received by the wallet
* @param wire_deadline by what time must the amount be wired to the merchant
@ -172,7 +172,7 @@ handle_deposit_confirmation_finished (void *cls,
*/
static enum GNUNET_GenericReturnValue
verify_signatures (const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_ExtensionContractHashP *h_extensions,
const struct TALER_ExtensionPolicyHashP *h_policy,
const struct TALER_PrivateContractHashP *h_contract_terms,
struct GNUNET_TIME_Timestamp exchange_timestamp,
struct GNUNET_TIME_Timestamp wire_deadline,
@ -192,7 +192,7 @@ verify_signatures (const struct TALER_MerchantWireHashP *h_wire,
TALER_exchange_online_deposit_confirmation_verify (
h_contract_terms,
h_wire,
h_extensions,
h_policy,
exchange_timestamp,
wire_deadline,
refund_deadline,
@ -239,7 +239,7 @@ struct TALER_AUDITOR_DepositConfirmationHandle *
TALER_AUDITOR_deposit_confirmation (
struct TALER_AUDITOR_Handle *auditor,
const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_ExtensionContractHashP *h_extensions,
const struct TALER_ExtensionPolicyHashP *h_policy,
const struct TALER_PrivateContractHashP *h_contract_terms,
struct GNUNET_TIME_Timestamp exchange_timestamp,
struct GNUNET_TIME_Timestamp wire_deadline,
@ -266,7 +266,7 @@ TALER_AUDITOR_deposit_confirmation (
TALER_AUDITOR_handle_is_ready_ (auditor));
if (GNUNET_OK !=
verify_signatures (h_wire,
h_extensions,
h_policy,
h_contract_terms,
exchange_timestamp,
wire_deadline,
@ -290,8 +290,8 @@ TALER_AUDITOR_deposit_confirmation (
= GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("h_wire",
h_wire),
GNUNET_JSON_pack_data_auto ("h_extensions",
h_extensions),
GNUNET_JSON_pack_data_auto ("h_policy",
h_policy),
GNUNET_JSON_pack_data_auto ("h_contract_terms",
h_contract_terms),
GNUNET_JSON_pack_timestamp ("exchange_timestamp",

View File

@ -97,9 +97,9 @@ struct TALER_EXCHANGE_BatchDepositHandle
struct TALER_MerchantWireHashP h_wire;
/**
* Hash over the extensions, or all zero.
* Hash over the policy, or all zero.
*/
struct TALER_ExtensionContractHashP h_extensions;
struct TALER_ExtensionPolicyHashP h_policy;
/**
* Time when this confirmation was generated / when the exchange received
@ -185,7 +185,7 @@ auditor_cb (void *cls,
aie->dch = TALER_AUDITOR_deposit_confirmation (
ah,
&dh->h_wire,
&dh->h_extensions,
&dh->h_policy,
&dh->dcd.h_contract_terms,
dh->exchange_timestamp,
dh->dcd.wire_deadline,
@ -317,7 +317,7 @@ handle_deposit_finished (void *cls,
TALER_exchange_online_deposit_confirmation_verify (
&dh->dcd.h_contract_terms,
&dh->h_wire,
&dh->h_extensions,
&dh->h_policy,
dh->exchange_timestamp,
dh->dcd.wire_deadline,
dh->dcd.refund_deadline,
@ -493,8 +493,8 @@ TALER_EXCHANGE_batch_deposit (
dh->num_cdds = num_cdds;
dh->dcd = *dcd;
if (NULL != dcd->extension_details)
TALER_deposit_extension_hash (dcd->extension_details,
&dh->h_extensions);
TALER_deposit_policy_hash (dcd->extension_details,
&dh->h_policy);
TALER_merchant_wire_signature_hash (dcd->merchant_payto_uri,
&dcd->wire_salt,
&dh->h_wire);
@ -533,7 +533,7 @@ TALER_EXCHANGE_batch_deposit (
if (GNUNET_OK !=
TALER_EXCHANGE_verify_deposit_signature_ (dcd,
&dh->h_extensions,
&dh->h_policy,
&dh->h_wire,
cdd,
dki))

View File

@ -724,7 +724,8 @@ help_deposit (struct CoinHistoryParseContext *pc,
{
struct TALER_MerchantWireHashP h_wire;
struct TALER_PrivateContractHashP h_contract_terms;
// struct TALER_ExtensionContractHashP h_extensions; // FIXME #7270!
struct TALER_ExtensionPolicyHashP h_policy;
bool no_h_policy;
struct GNUNET_TIME_Timestamp wallet_timestamp;
struct TALER_MerchantPublicKeyP merchant_pub;
struct GNUNET_TIME_Timestamp refund_deadline = {0};
@ -739,6 +740,10 @@ help_deposit (struct CoinHistoryParseContext *pc,
&h_contract_terms),
GNUNET_JSON_spec_fixed_auto ("h_wire",
&h_wire),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto ("h_policy",
&h_policy),
&no_h_policy),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto ("h_age_commitment",
&hac),
@ -771,7 +776,7 @@ help_deposit (struct CoinHistoryParseContext *pc,
&h_wire,
&h_contract_terms,
no_hac ? NULL : &hac,
NULL /* h_extensions! */,
no_h_policy ? NULL : &h_policy,
&pc->dk->h_key,
wallet_timestamp,
&merchant_pub,
@ -1905,7 +1910,7 @@ TALER_EXCHANGE_get_min_denomination_ (
enum GNUNET_GenericReturnValue
TALER_EXCHANGE_verify_deposit_signature_ (
const struct TALER_EXCHANGE_DepositContractDetail *dcd,
const struct TALER_ExtensionContractHashP *ech,
const struct TALER_ExtensionPolicyHashP *ech,
const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_EXCHANGE_CoinDepositDetail *cdd,
const struct TALER_EXCHANGE_DenomPublicKey *dki)

View File

@ -203,7 +203,7 @@ TALER_EXCHANGE_get_min_denomination_ (
* Verify signature information about the deposit.
*
* @param dcd contract details
* @param ech hashed contract (passed to avoid recomputation)
* @param eph hashed policy (passed to avoid recomputation)
* @param h_wire hashed wire details (passed to avoid recomputation)
* @param cdd coin-specific details
* @param dki denomination of the coin
@ -212,7 +212,7 @@ TALER_EXCHANGE_get_min_denomination_ (
enum GNUNET_GenericReturnValue
TALER_EXCHANGE_verify_deposit_signature_ (
const struct TALER_EXCHANGE_DepositContractDetail *dcd,
const struct TALER_ExtensionContractHashP *ech,
const struct TALER_ExtensionPolicyHashP *eph,
const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_EXCHANGE_CoinDepositDetail *cdd,
const struct TALER_EXCHANGE_DenomPublicKey *dki);

View File

@ -97,9 +97,9 @@ struct TALER_EXCHANGE_DepositHandle
struct TALER_MerchantWireHashP h_wire;
/**
* Hash over the extensions, or all zero.
* Hash over the policy, or all zero.
*/
struct TALER_ExtensionContractHashP h_extensions;
struct TALER_ExtensionPolicyHashP h_policy;
/**
* Time when this confirmation was generated / when the exchange received
@ -177,7 +177,7 @@ auditor_cb (void *cls,
aie->dch = TALER_AUDITOR_deposit_confirmation (
ah,
&dh->h_wire,
&dh->h_extensions,
&dh->h_policy,
&dh->dcd.h_contract_terms,
dh->exchange_timestamp,
dh->dcd.wire_deadline,
@ -277,7 +277,7 @@ handle_deposit_finished (void *cls,
TALER_exchange_online_deposit_confirmation_verify (
&dh->dcd.h_contract_terms,
&dh->h_wire,
&dh->h_extensions,
&dh->h_policy,
dh->exchange_timestamp,
dh->dcd.wire_deadline,
dh->dcd.refund_deadline,
@ -447,14 +447,14 @@ TALER_EXCHANGE_deposit (
dh->cdd = *cdd;
dh->dcd = *dcd;
if (NULL != dcd->extension_details)
TALER_deposit_extension_hash (dcd->extension_details,
&dh->h_extensions);
TALER_deposit_policy_hash (dcd->extension_details,
&dh->h_policy);
TALER_merchant_wire_signature_hash (dcd->merchant_payto_uri,
&dcd->wire_salt,
&dh->h_wire);
if (GNUNET_OK !=
TALER_EXCHANGE_verify_deposit_signature_ (dcd,
&dh->h_extensions,
&dh->h_policy,
&dh->h_wire,
cdd,
dki))

View File

@ -236,7 +236,8 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
struct TALER_PrivateContractHashP h_contract_terms;
struct TALER_AgeCommitmentHash h_age_commitment;
bool no_hac;
// struct TALER_ExtensionContractHashP h_extensions; // FIXME #7270!
struct TALER_ExtensionPolicyHashP h_policy;
bool no_h_policy;
struct GNUNET_TIME_Timestamp wallet_timestamp;
struct TALER_MerchantPublicKeyP merchant_pub;
struct GNUNET_TIME_Timestamp refund_deadline;
@ -252,6 +253,10 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
GNUNET_JSON_spec_fixed_auto ("h_age_commitment",
&h_age_commitment),
&no_hac),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto ("h_policy",
&h_policy),
&no_h_policy),
GNUNET_JSON_spec_timestamp ("timestamp",
&wallet_timestamp),
GNUNET_JSON_spec_timestamp ("refund_deadline",
@ -280,7 +285,7 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
no_hac
? NULL
: &h_age_commitment,
NULL /* FIXME #7270-OEC: h_extensions! */,
no_h_policy ? NULL : &h_policy,
&h_denom_pub,
wallet_timestamp,
&merchant_pub,

View File

@ -199,7 +199,7 @@ deposit_confirmation_run (void *cls,
const struct TALER_TESTING_Command *cmd,
struct TALER_TESTING_Interpreter *is)
{
static struct TALER_ExtensionContractHashP no_h_extensions;
static struct TALER_ExtensionPolicyHashP no_h_policy;
struct DepositConfirmationState *dcs = cls;
const struct TALER_TESTING_Command *deposit_cmd;
struct TALER_MerchantWireHashP h_wire;
@ -310,7 +310,7 @@ deposit_confirmation_run (void *cls,
}
dcs->dc = TALER_AUDITOR_deposit_confirmation (dcs->auditor,
&h_wire,
&no_h_extensions,
&no_h_policy,
&h_contract_terms,
*exchange_timestamp,
*wire_deadline,

View File

@ -48,10 +48,10 @@ struct TALER_DepositConfirmationPS
struct TALER_MerchantWireHashP h_wire GNUNET_PACKED;
/**
* Hash over the extension options of the deposit, 0 if there
* were not extension options.
* Hash over the policy extension options of the deposit, 0 if there
* was no policy.
*/
struct TALER_ExtensionContractHashP h_extensions GNUNET_PACKED;
struct TALER_ExtensionPolicyHashP h_policy GNUNET_PACKED;
/**
* Time when this confirmation was generated / when the exchange received
@ -101,7 +101,7 @@ TALER_exchange_online_deposit_confirmation_sign (
TALER_ExchangeSignCallback scb,
const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_ExtensionContractHashP *h_extensions,
const struct TALER_ExtensionPolicyHashP *h_policy,
struct GNUNET_TIME_Timestamp exchange_timestamp,
struct GNUNET_TIME_Timestamp wire_deadline,
struct GNUNET_TIME_Timestamp refund_deadline,
@ -123,8 +123,8 @@ TALER_exchange_online_deposit_confirmation_sign (
.merchant_pub = *merchant_pub
};
if (NULL != h_extensions)
dcs.h_extensions = *h_extensions;
if (NULL != h_policy)
dcs.h_policy = *h_policy;
TALER_amount_hton (&dcs.amount_without_fee,
amount_without_fee);
return scb (&dcs.purpose,
@ -137,7 +137,7 @@ enum GNUNET_GenericReturnValue
TALER_exchange_online_deposit_confirmation_verify (
const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_ExtensionContractHashP *h_extensions,
const struct TALER_ExtensionPolicyHashP *h_policy,
struct GNUNET_TIME_Timestamp exchange_timestamp,
struct GNUNET_TIME_Timestamp wire_deadline,
struct GNUNET_TIME_Timestamp refund_deadline,
@ -159,8 +159,8 @@ TALER_exchange_online_deposit_confirmation_verify (
.merchant_pub = *merchant_pub
};
if (NULL != h_extensions)
dcs.h_extensions = *h_extensions;
if (NULL != h_policy)
dcs.h_policy = *h_policy;
TALER_amount_hton (&dcs.amount_without_fee,
amount_without_fee);
if (GNUNET_OK !=

View File

@ -49,9 +49,9 @@ struct TALER_DepositRequestPS
struct TALER_AgeCommitmentHash h_age_commitment GNUNET_PACKED;
/**
* Hash over extension attributes shared with the exchange.
* Hash over policy attributes shared with the exchange.
*/
struct TALER_ExtensionContractHashP h_extensions GNUNET_PACKED;
struct TALER_ExtensionPolicyHashP h_policy GNUNET_PACKED;
/**
* Hash over the wiring information of the merchant.
@ -120,7 +120,7 @@ TALER_wallet_deposit_sign (
const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_AgeCommitmentHash *h_age_commitment,
const struct TALER_ExtensionContractHashP *h_extensions,
const struct TALER_ExtensionPolicyHashP *h_policy,
const struct TALER_DenominationHashP *h_denom_pub,
const struct GNUNET_TIME_Timestamp wallet_timestamp,
const struct TALER_MerchantPublicKeyP *merchant_pub,
@ -141,8 +141,8 @@ TALER_wallet_deposit_sign (
if (NULL != h_age_commitment)
dr.h_age_commitment = *h_age_commitment;
if (NULL != h_extensions)
dr.h_extensions = *h_extensions;
if (NULL != h_policy)
dr.h_policy = *h_policy;
TALER_amount_hton (&dr.amount_with_fee,
amount);
TALER_amount_hton (&dr.deposit_fee,
@ -160,7 +160,7 @@ TALER_wallet_deposit_verify (
const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_AgeCommitmentHash *h_age_commitment,
const struct TALER_ExtensionContractHashP *h_extensions,
const struct TALER_ExtensionPolicyHashP *h_policy,
const struct TALER_DenominationHashP *h_denom_pub,
struct GNUNET_TIME_Timestamp wallet_timestamp,
const struct TALER_MerchantPublicKeyP *merchant_pub,
@ -178,13 +178,13 @@ TALER_wallet_deposit_verify (
.refund_deadline = GNUNET_TIME_timestamp_hton (refund_deadline),
.merchant = *merchant_pub,
.h_age_commitment = {{{0}}},
.h_extensions = {{{0}}}
.h_policy = {{{0}}}
};
if (NULL != h_age_commitment)
dr.h_age_commitment = *h_age_commitment;
if (NULL != h_extensions)
dr.h_extensions = *h_extensions;
if (NULL != h_policy)
dr.h_policy = *h_policy;
TALER_amount_hton (&dr.amount_with_fee,
amount);
TALER_amount_hton (&dr.deposit_fee,