Merge branch 'master' of taler.net:/var/git/mint

This commit is contained in:
Fournier Nicolas 2015-07-06 11:12:21 +02:00
commit ec479de4b9
16 changed files with 208 additions and 148 deletions

View File

@ -117,28 +117,6 @@ enum TALER_MINT_Option
}; };
/**
* Information we get from the mint about auditors.
*/
struct TALER_MINT_AuditorInformation
{
/**
* Public key of the auditing institution.
*/
struct TALER_AuditorPublicKeyP auditor_pub;
/**
* URL of the auditing institution. The application must check that
* this is an acceptable auditor for its purpose and also verify
* that the @a auditor_pub matches the auditor's public key given at
* that website. We expect that in practice software is going to
* often ship with an initial list of accepted auditors, just like
* browsers ship with a CA root store.
*/
const char *auditor_url;
};
/** /**
* @brief Mint's signature key * @brief Mint's signature key
*/ */
@ -209,6 +187,42 @@ struct TALER_MINT_DenomPublicKey
}; };
/**
* Information we get from the mint about auditors.
*/
struct TALER_MINT_AuditorInformation
{
/**
* Public key of the auditing institution.
*/
struct TALER_AuditorPublicKeyP auditor_pub;
/**
* URL of the auditing institution. The application must check that
* this is an acceptable auditor for its purpose and also verify
* that the @a auditor_pub matches the auditor's public key given at
* that website. We expect that in practice software is going to
* often ship with an initial list of accepted auditors, just like
* browsers ship with a CA root store.
*/
const char *auditor_url;
/**
* Number of denomination keys audited by this auditor.
*/
unsigned int num_denom_keys;
/**
* Array of length @a denom_keys with the denomination
* keys audited by this auditor. Note that the array
* elements point to the same locations as the entries
* in the key's main `denom_keys` array.
*/
struct TALER_MINT_DenomPublicKey *const*denom_keys;
};
/** /**
* Information about keys from the mint. * Information about keys from the mint.
*/ */

View File

@ -60,6 +60,24 @@ struct TALER_MINTDB_PrivateSigningKeyInformationP
}; };
/**
* Information about a denomination key.
*/
struct TALER_MINTDB_DenominationKeyInformationP
{
/**
* Signature over this struct to affirm the validity of the key.
*/
struct TALER_MasterSignatureP signature;
/**
* Signed properties of the denomination key.
*/
struct TALER_DenominationKeyValidityPS properties;
};
GNUNET_NETWORK_STRUCT_END GNUNET_NETWORK_STRUCT_END
@ -85,7 +103,7 @@ struct TALER_MINTDB_DenominationKeyIssueInformation
/** /**
* Signed public information about a denomination key. * Signed public information about a denomination key.
*/ */
struct TALER_DenominationKeyValidityPS issue; struct TALER_MINTDB_DenominationKeyInformationP issue;
}; };

View File

@ -697,7 +697,7 @@ struct TALER_MINTDB_Plugin
(*insert_denomination_info) (void *cls, (*insert_denomination_info) (void *cls,
struct TALER_MINTDB_Session *session, struct TALER_MINTDB_Session *session,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_DenominationKeyValidityPS *issue); const struct TALER_MINTDB_DenominationKeyInformationP *issue);
/** /**
@ -713,7 +713,7 @@ struct TALER_MINTDB_Plugin
(*get_denomination_info) (void *cls, (*get_denomination_info) (void *cls,
struct TALER_MINTDB_Session *session, struct TALER_MINTDB_Session *session,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
struct TALER_DenominationKeyValidityPS *issue); struct TALER_MINTDB_DenominationKeyInformationP *issue);
/** /**

View File

@ -89,6 +89,17 @@
#define TALER_SIGNATURE_MINT_KEY_SET 1035 #define TALER_SIGNATURE_MINT_KEY_SET 1035
/*********************/
/* Wallet signatures */
/*********************/
/**
* Signature where the auditor confirms that he is
* aware of certain denomination keys from the mint.
*/
#define TALER_SIGNATURE_AUDITOR_MINT_KEYS 1064
/***********************/ /***********************/
/* Merchant signatures */ /* Merchant signatures */
/***********************/ /***********************/
@ -123,11 +134,11 @@
*/ */
#define TALER_SIGNATURE_WALLET_COIN_MELT 1202 #define TALER_SIGNATURE_WALLET_COIN_MELT 1202
/*******************/ /*******************/
/* Test signatures */ /* Test signatures */
/*******************/ /*******************/
/** /**
* EdDSA test signature. * EdDSA test signature.
*/ */
@ -512,10 +523,6 @@ struct TALER_MintKeySetPS
*/ */
struct TALER_DenominationKeyValidityPS struct TALER_DenominationKeyValidityPS
{ {
/**
* Signature over this struct to affirm the validity of the key.
*/
struct TALER_MasterSignatureP signature;
/** /**
* Purpose is #TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY. * Purpose is #TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY.
@ -599,6 +606,38 @@ struct TALER_DenominationKeyValidityPS
}; };
/**
* @brief Information signed by an auditor affirming
* the master public key and the denomination keys
* of a mint.
*/
struct TALER_MintKeyValidityPS
{
/**
* Purpose is #TALER_SIGNATURE_AUDITOR_MINT_KEYS.
*/
struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
/**
* The long-term offline master key of the mint, affirmed by the
* auditor.
*/
struct TALER_MasterPublicKeyP master;
/**
* Array of hash(es) of the mint's denomination keys.
* Specifically, this is the hash over the
* `struct TALER_DenominationKeyValidityPS`, not just
* the public key (as the auditor needs to check against
* the correct valuations and fee structure).
*/
/* struct GNUNET_HashCode h_dks; */
};
GNUNET_NETWORK_STRUCT_END GNUNET_NETWORK_STRUCT_END
#endif #endif

View File

@ -280,9 +280,7 @@ parse_json_signkey (struct TALER_MINT_SigningPublicKey *sign_key,
sign_key_issue.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY); sign_key_issue.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY);
sign_key_issue.purpose.size = sign_key_issue.purpose.size =
htonl (sizeof (sign_key_issue) htonl (sizeof (struct TALER_MintSigningKeyValidityPS));
- offsetof (struct TALER_MintSigningKeyValidityPS,
purpose));
sign_key_issue.master_public_key = *master_key; sign_key_issue.master_public_key = *master_key;
sign_key_issue.start = GNUNET_TIME_absolute_hton (valid_from); sign_key_issue.start = GNUNET_TIME_absolute_hton (valid_from);
sign_key_issue.expire = GNUNET_TIME_absolute_hton (valid_until); sign_key_issue.expire = GNUNET_TIME_absolute_hton (valid_until);
@ -369,9 +367,7 @@ parse_json_denomkey (struct TALER_MINT_DenomPublicKey *denom_key,
denom_key_issue.purpose.purpose denom_key_issue.purpose.purpose
= htonl (TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY); = htonl (TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY);
denom_key_issue.purpose.size denom_key_issue.purpose.size
= htonl (sizeof (struct TALER_DenominationKeyValidityPS) - = htonl (sizeof (struct TALER_DenominationKeyValidityPS));
offsetof (struct TALER_DenominationKeyValidityPS,
purpose));
denom_key_issue.master = *master_key; denom_key_issue.master = *master_key;
denom_key_issue.start = GNUNET_TIME_absolute_hton (valid_from); denom_key_issue.start = GNUNET_TIME_absolute_hton (valid_from);
denom_key_issue.expire_withdraw = GNUNET_TIME_absolute_hton (withdraw_valid_until); denom_key_issue.expire_withdraw = GNUNET_TIME_absolute_hton (withdraw_valid_until);

View File

@ -128,10 +128,8 @@ denomkeys_iter (void *cls,
{ {
struct GNUNET_HashCode hc; struct GNUNET_HashCode hc;
if (ntohl (dki->issue.purpose.size) != if (ntohl (dki->issue.properties.purpose.size) !=
sizeof (struct TALER_DenominationKeyValidityPS) - sizeof (struct TALER_DenominationKeyValidityPS))
offsetof (struct TALER_DenominationKeyValidityPS,
purpose))
{ {
fprintf (stderr, fprintf (stderr,
"Denomination key for `%s' has invalid purpose size\n", "Denomination key for `%s' has invalid purpose size\n",
@ -139,10 +137,10 @@ denomkeys_iter (void *cls,
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
if ( (0 != GNUNET_TIME_absolute_ntoh (dki->issue.start).abs_value_us % 1000000) || if ( (0 != GNUNET_TIME_absolute_ntoh (dki->issue.properties.start).abs_value_us % 1000000) ||
(0 != GNUNET_TIME_absolute_ntoh (dki->issue.expire_withdraw).abs_value_us % 1000000) || (0 != GNUNET_TIME_absolute_ntoh (dki->issue.properties.expire_withdraw).abs_value_us % 1000000) ||
(0 != GNUNET_TIME_absolute_ntoh (dki->issue.expire_legal).abs_value_us % 1000000) || (0 != GNUNET_TIME_absolute_ntoh (dki->issue.properties.expire_legal).abs_value_us % 1000000) ||
(0 != GNUNET_TIME_absolute_ntoh (dki->issue.expire_spend).abs_value_us % 1000000) ) (0 != GNUNET_TIME_absolute_ntoh (dki->issue.properties.expire_spend).abs_value_us % 1000000) )
{ {
fprintf (stderr, fprintf (stderr,
"Timestamps are not multiples of a round second\n"); "Timestamps are not multiples of a round second\n");
@ -151,9 +149,9 @@ denomkeys_iter (void *cls,
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY, GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY,
&dki->issue.purpose, &dki->issue.properties.purpose,
&dki->issue.signature.eddsa_signature, &dki->issue.signature.eddsa_signature,
&dki->issue.master.eddsa_pub)) &dki->issue.properties.master.eddsa_pub))
{ {
fprintf (stderr, fprintf (stderr,
"Denomination key for `%s' has invalid signature\n", "Denomination key for `%s' has invalid signature\n",
@ -163,7 +161,7 @@ denomkeys_iter (void *cls,
GNUNET_CRYPTO_rsa_public_key_hash (dki->denom_pub.rsa_public_key, GNUNET_CRYPTO_rsa_public_key_hash (dki->denom_pub.rsa_public_key,
&hc); &hc);
if (0 != memcmp (&hc, if (0 != memcmp (&hc,
&dki->issue.denom_hash, &dki->issue.properties.denom_hash,
sizeof (struct GNUNET_HashCode))) sizeof (struct GNUNET_HashCode)))
{ {
fprintf (stderr, fprintf (stderr,

View File

@ -719,35 +719,33 @@ create_denomkey_issue (const struct CoinTypeParams *params,
dki->denom_pub.rsa_public_key dki->denom_pub.rsa_public_key
= GNUNET_CRYPTO_rsa_private_key_get_public (dki->denom_priv.rsa_private_key); = GNUNET_CRYPTO_rsa_private_key_get_public (dki->denom_priv.rsa_private_key);
GNUNET_CRYPTO_rsa_public_key_hash (dki->denom_pub.rsa_public_key, GNUNET_CRYPTO_rsa_public_key_hash (dki->denom_pub.rsa_public_key,
&dki->issue.denom_hash); &dki->issue.properties.denom_hash);
dki->issue.master = master_public_key; dki->issue.properties.master = master_public_key;
dki->issue.start = GNUNET_TIME_absolute_hton (params->anchor); dki->issue.properties.start = GNUNET_TIME_absolute_hton (params->anchor);
dki->issue.expire_withdraw = dki->issue.properties.expire_withdraw =
GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_add (params->anchor, GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_add (params->anchor,
params->duration_withdraw)); params->duration_withdraw));
dki->issue.expire_spend = dki->issue.properties.expire_spend =
GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_add (params->anchor, GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_add (params->anchor,
params->duration_spend)); params->duration_spend));
dki->issue.expire_legal = dki->issue.properties.expire_legal =
GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_add (params->anchor, GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_add (params->anchor,
params->duration_legal)); params->duration_legal));
TALER_amount_hton (&dki->issue.value, TALER_amount_hton (&dki->issue.properties.value,
&params->value); &params->value);
TALER_amount_hton (&dki->issue.fee_withdraw, TALER_amount_hton (&dki->issue.properties.fee_withdraw,
&params->fee_withdraw); &params->fee_withdraw);
TALER_amount_hton (&dki->issue.fee_deposit, TALER_amount_hton (&dki->issue.properties.fee_deposit,
&params->fee_deposit); &params->fee_deposit);
TALER_amount_hton (&dki->issue.fee_refresh, TALER_amount_hton (&dki->issue.properties.fee_refresh,
&params->fee_refresh); &params->fee_refresh);
dki->issue.purpose.purpose dki->issue.properties.purpose.purpose
= htonl (TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY); = htonl (TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY);
dki->issue.purpose.size dki->issue.properties.purpose.size
= htonl (sizeof (struct TALER_DenominationKeyValidityPS) - = htonl (sizeof (struct TALER_DenominationKeyValidityPS));
offsetof (struct TALER_DenominationKeyValidityPS,
purpose));
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
GNUNET_CRYPTO_eddsa_sign (&master_priv.eddsa_priv, GNUNET_CRYPTO_eddsa_sign (&master_priv.eddsa_priv,
&dki->issue.purpose, &dki->issue.properties.purpose,
&dki->issue.signature.eddsa_signature)); &dki->issue.signature.eddsa_signature));
} }

View File

@ -136,7 +136,7 @@ TMH_DB_execute_deposit (struct MHD_Connection *connection,
&deposit->coin.denom_pub, &deposit->coin.denom_pub,
TMH_KS_DKU_DEPOSIT); TMH_KS_DKU_DEPOSIT);
TALER_amount_ntoh (&value, TALER_amount_ntoh (&value,
&dki->issue.value); &dki->issue.properties.value);
TMH_KS_release (mks); TMH_KS_release (mks);
if (GNUNET_OK != if (GNUNET_OK !=
@ -357,9 +357,9 @@ TMH_DB_execute_withdraw_sign (struct MHD_Connection *connection,
/* calculate amount required including fees */ /* calculate amount required including fees */
TALER_amount_ntoh (&value, TALER_amount_ntoh (&value,
&dki->issue.value); &dki->issue.properties.value);
TALER_amount_ntoh (&fee_withdraw, TALER_amount_ntoh (&fee_withdraw,
&dki->issue.fee_withdraw); &dki->issue.properties.fee_withdraw);
if (GNUNET_OK != if (GNUNET_OK !=
TALER_amount_add (&amount_required, TALER_amount_add (&amount_required,
@ -399,7 +399,7 @@ TMH_DB_execute_withdraw_sign (struct MHD_Connection *connection,
&pos->details.withdraw->denom_pub, &pos->details.withdraw->denom_pub,
TMH_KS_DKU_WITHDRAW); TMH_KS_DKU_WITHDRAW);
TALER_amount_ntoh (&value, TALER_amount_ntoh (&value,
&tdki->issue.value); &tdki->issue.properties.value);
if (0 == (res & 2)) if (0 == (res & 2))
withdraw_total = value; withdraw_total = value;
else else
@ -516,7 +516,7 @@ refresh_accept_melts (struct MHD_Connection *connection,
const struct TMH_DB_MeltDetails *coin_details, const struct TMH_DB_MeltDetails *coin_details,
uint16_t oldcoin_index) uint16_t oldcoin_index)
{ {
struct TALER_DenominationKeyValidityPS *dki; struct TALER_MINTDB_DenominationKeyInformationP *dki;
struct TALER_MINTDB_TransactionList *tl; struct TALER_MINTDB_TransactionList *tl;
struct TALER_Amount coin_value; struct TALER_Amount coin_value;
struct TALER_Amount coin_residual; struct TALER_Amount coin_residual;
@ -535,7 +535,7 @@ refresh_accept_melts (struct MHD_Connection *connection,
? GNUNET_NO : GNUNET_SYSERR; ? GNUNET_NO : GNUNET_SYSERR;
TALER_amount_ntoh (&coin_value, TALER_amount_ntoh (&coin_value,
&dki->value); &dki->properties.value);
/* fee for THIS transaction; the melt amount includes the fee! */ /* fee for THIS transaction; the melt amount includes the fee! */
spent = coin_details->melt_amount_with_fee; spent = coin_details->melt_amount_with_fee;
/* add historic transaction costs of this coin */ /* add historic transaction costs of this coin */

View File

@ -100,7 +100,7 @@ verify_and_execute_deposit (struct MHD_Connection *connection,
"ub_sig"); "ub_sig");
} }
TALER_amount_ntoh (&fee_deposit, TALER_amount_ntoh (&fee_deposit,
&dki->issue.fee_deposit); &dki->issue.properties.fee_deposit);
if (0 < TALER_amount_cmp (&fee_deposit, if (0 < TALER_amount_cmp (&fee_deposit,
&deposit->amount_with_fee)) &deposit->amount_with_fee))
{ {
@ -188,7 +188,7 @@ parse_and_handle_deposit_request (struct MHD_Connection *connection,
"denom_pub"); "denom_pub");
} }
TALER_amount_ntoh (&deposit.deposit_fee, TALER_amount_ntoh (&deposit.deposit_fee,
&dki->issue.fee_deposit); &dki->issue.properties.fee_deposit);
TMH_KS_release (ks); TMH_KS_release (ks);
deposit.wire = wire; deposit.wire = wire;
deposit.amount_with_fee = *amount; deposit.amount_with_fee = *amount;

View File

@ -119,7 +119,7 @@ static int reload_pipe[2];
*/ */
static json_t * static json_t *
denom_key_issue_to_json (const struct TALER_DenominationPublicKey *pk, denom_key_issue_to_json (const struct TALER_DenominationPublicKey *pk,
const struct TALER_DenominationKeyValidityPS *dki) const struct TALER_MINTDB_DenominationKeyInformationP *dki)
{ {
struct TALER_Amount value; struct TALER_Amount value;
struct TALER_Amount fee_withdraw; struct TALER_Amount fee_withdraw;
@ -127,26 +127,26 @@ denom_key_issue_to_json (const struct TALER_DenominationPublicKey *pk,
struct TALER_Amount fee_refresh; struct TALER_Amount fee_refresh;
TALER_amount_ntoh (&value, TALER_amount_ntoh (&value,
&dki->value); &dki->properties.value);
TALER_amount_ntoh (&fee_withdraw, TALER_amount_ntoh (&fee_withdraw,
&dki->fee_withdraw); &dki->properties.fee_withdraw);
TALER_amount_ntoh (&fee_deposit, TALER_amount_ntoh (&fee_deposit,
&dki->fee_deposit); &dki->properties.fee_deposit);
TALER_amount_ntoh (&fee_refresh, TALER_amount_ntoh (&fee_refresh,
&dki->fee_refresh); &dki->properties.fee_refresh);
return return
json_pack ("{s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:o}", json_pack ("{s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:o}",
"master_sig", "master_sig",
TALER_json_from_data (&dki->signature, TALER_json_from_data (&dki->signature,
sizeof (struct GNUNET_CRYPTO_EddsaSignature)), sizeof (struct GNUNET_CRYPTO_EddsaSignature)),
"stamp_start", "stamp_start",
TALER_json_from_abs (GNUNET_TIME_absolute_ntoh (dki->start)), TALER_json_from_abs (GNUNET_TIME_absolute_ntoh (dki->properties.start)),
"stamp_expire_withdraw", "stamp_expire_withdraw",
TALER_json_from_abs (GNUNET_TIME_absolute_ntoh (dki->expire_withdraw)), TALER_json_from_abs (GNUNET_TIME_absolute_ntoh (dki->properties.expire_withdraw)),
"stamp_expire_deposit", "stamp_expire_deposit",
TALER_json_from_abs (GNUNET_TIME_absolute_ntoh (dki->expire_spend)), TALER_json_from_abs (GNUNET_TIME_absolute_ntoh (dki->properties.expire_spend)),
"stamp_expire_legal", "stamp_expire_legal",
TALER_json_from_abs (GNUNET_TIME_absolute_ntoh (dki->expire_legal)), TALER_json_from_abs (GNUNET_TIME_absolute_ntoh (dki->properties.expire_legal)),
"denom_pub", "denom_pub",
TALER_json_from_rsa_public_key (pk->rsa_public_key), TALER_json_from_rsa_public_key (pk->rsa_public_key),
"value", "value",
@ -214,7 +214,7 @@ reload_keys_denom_iter (void *cls,
"Loading denomination key `%s'\n", "Loading denomination key `%s'\n",
alias); alias);
horizon = GNUNET_TIME_relative_to_absolute (TALER_MINT_conf_duration_provide ()); horizon = GNUNET_TIME_relative_to_absolute (TALER_MINT_conf_duration_provide ());
if (GNUNET_TIME_absolute_ntoh (dki->issue.start).abs_value_us > if (GNUNET_TIME_absolute_ntoh (dki->issue.properties.start).abs_value_us >
horizon.abs_value_us) horizon.abs_value_us)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@ -223,7 +223,7 @@ reload_keys_denom_iter (void *cls,
return GNUNET_OK; return GNUNET_OK;
} }
now = GNUNET_TIME_absolute_get (); now = GNUNET_TIME_absolute_get ();
if (GNUNET_TIME_absolute_ntoh (dki->issue.expire_spend).abs_value_us < if (GNUNET_TIME_absolute_ntoh (dki->issue.properties.expire_spend).abs_value_us <
now.abs_value_us) now.abs_value_us)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@ -569,7 +569,7 @@ TMH_KS_denomination_key_lookup (const struct TMH_KS_StateHandle *key_state,
&hc); &hc);
now = GNUNET_TIME_absolute_get (); now = GNUNET_TIME_absolute_get ();
if (now.abs_value_us < if (now.abs_value_us <
GNUNET_TIME_absolute_ntoh (dki->issue.start).abs_value_us) GNUNET_TIME_absolute_ntoh (dki->issue.properties.start).abs_value_us)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Not returning DKI for %s, as start time is in the future\n", "Not returning DKI for %s, as start time is in the future\n",
@ -581,7 +581,7 @@ TMH_KS_denomination_key_lookup (const struct TMH_KS_StateHandle *key_state,
{ {
case TMH_KS_DKU_WITHDRAW: case TMH_KS_DKU_WITHDRAW:
if (now.abs_value_us > if (now.abs_value_us >
GNUNET_TIME_absolute_ntoh (dki->issue.expire_withdraw).abs_value_us) GNUNET_TIME_absolute_ntoh (dki->issue.properties.expire_withdraw).abs_value_us)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Not returning DKI for %s, as time to create coins has passed\n", "Not returning DKI for %s, as time to create coins has passed\n",
@ -591,7 +591,7 @@ TMH_KS_denomination_key_lookup (const struct TMH_KS_StateHandle *key_state,
break; break;
case TMH_KS_DKU_DEPOSIT: case TMH_KS_DKU_DEPOSIT:
if (now.abs_value_us > if (now.abs_value_us >
GNUNET_TIME_absolute_ntoh (dki->issue.expire_spend).abs_value_us) GNUNET_TIME_absolute_ntoh (dki->issue.properties.expire_spend).abs_value_us)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Not returning DKI for %s, as time to spend coin has passed\n", "Not returning DKI for %s, as time to spend coin has passed\n",

View File

@ -61,7 +61,7 @@ handle_refresh_melt_binary (struct MHD_Connection *connection,
{ {
unsigned int i; unsigned int i;
struct TMH_KS_StateHandle *key_state; struct TMH_KS_StateHandle *key_state;
struct TALER_DenominationKeyValidityPS *dki; struct TALER_MINTDB_DenominationKeyInformationP *dki;
struct TALER_Amount cost; struct TALER_Amount cost;
struct TALER_Amount total_cost; struct TALER_Amount total_cost;
struct TALER_Amount melt; struct TALER_Amount melt;
@ -80,9 +80,9 @@ handle_refresh_melt_binary (struct MHD_Connection *connection,
&denom_pubs[i], &denom_pubs[i],
TMH_KS_DKU_WITHDRAW)->issue; TMH_KS_DKU_WITHDRAW)->issue;
TALER_amount_ntoh (&value, TALER_amount_ntoh (&value,
&dki->value); &dki->properties.value);
TALER_amount_ntoh (&fee_withdraw, TALER_amount_ntoh (&fee_withdraw,
&dki->fee_withdraw); &dki->properties.fee_withdraw);
if ( (GNUNET_OK != if ( (GNUNET_OK !=
TALER_amount_add (&cost, TALER_amount_add (&cost,
&value, &value,
@ -109,7 +109,7 @@ handle_refresh_melt_binary (struct MHD_Connection *connection,
&coin_melt_details[i].coin_info.denom_pub, &coin_melt_details[i].coin_info.denom_pub,
TMH_KS_DKU_DEPOSIT)->issue; TMH_KS_DKU_DEPOSIT)->issue;
TALER_amount_ntoh (&fee_melt, TALER_amount_ntoh (&fee_melt,
&dki->fee_refresh); &dki->properties.fee_refresh);
if (GNUNET_OK != if (GNUNET_OK !=
TALER_amount_subtract (&melt, TALER_amount_subtract (&melt,
&coin_melt_details->melt_amount_with_fee, &coin_melt_details->melt_amount_with_fee,
@ -245,7 +245,7 @@ verify_coin_public_info (struct MHD_Connection *connection,
/* FIXME: need to check if denomination key is still /* FIXME: need to check if denomination key is still
valid for issuing! (#3634) */ valid for issuing! (#3634) */
TALER_amount_ntoh (&fee_refresh, TALER_amount_ntoh (&fee_refresh,
&dki->issue.fee_refresh); &dki->issue.properties.fee_refresh);
body.purpose.size = htonl (sizeof (struct TALER_RefreshMeltCoinAffirmationPS)); body.purpose.size = htonl (sizeof (struct TALER_RefreshMeltCoinAffirmationPS));
body.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_MELT); body.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_MELT);
body.session_hash = *session_hash; body.session_hash = *session_hash;

View File

@ -137,9 +137,9 @@ TMH_WITHDRAW_handler_withdraw_sign (struct TMH_RequestHandler *rh,
"denom_pub"); "denom_pub");
} }
TALER_amount_ntoh (&amount, TALER_amount_ntoh (&amount,
&dki->issue.value); &dki->issue.properties.value);
TALER_amount_ntoh (&fee_withdraw, TALER_amount_ntoh (&fee_withdraw,
&dki->issue.fee_withdraw); &dki->issue.properties.fee_withdraw);
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
TALER_amount_add (&amount_with_fee, TALER_amount_add (&amount_with_fee,
&amount, &amount,

View File

@ -50,36 +50,34 @@ PERF_TALER_MINTDB_denomination_init ()
(dki->denom_pub.rsa_public_key = (dki->denom_pub.rsa_public_key =
GNUNET_CRYPTO_rsa_private_key_get_public (dki->denom_priv.rsa_private_key))); GNUNET_CRYPTO_rsa_private_key_get_public (dki->denom_priv.rsa_private_key)));
GNUNET_CRYPTO_rsa_public_key_hash (dki->denom_pub.rsa_public_key, GNUNET_CRYPTO_rsa_public_key_hash (dki->denom_pub.rsa_public_key,
&dki->issue.denom_hash); &dki->issue.properties.denom_hash);
GNUNET_assert (NULL != GNUNET_assert (NULL !=
(master_prvt = GNUNET_CRYPTO_eddsa_key_create ())); (master_prvt = GNUNET_CRYPTO_eddsa_key_create ()));
GNUNET_CRYPTO_eddsa_key_get_public (master_prvt, GNUNET_CRYPTO_eddsa_key_get_public (master_prvt,
&dki->issue.master.eddsa_pub); &dki->issue.properties.master.eddsa_pub);
anchor = GNUNET_TIME_absolute_get (); anchor = GNUNET_TIME_absolute_get ();
dki->issue.start = GNUNET_TIME_absolute_hton (anchor); dki->issue.properties.start = GNUNET_TIME_absolute_hton (anchor);
dki->issue.expire_withdraw = dki->issue.properties.expire_withdraw =
GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_add (anchor, GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_add (anchor,
GNUNET_TIME_relative_get_hour_ ())); GNUNET_TIME_relative_get_hour_ ()));
dki->issue.expire_spend = dki->issue.properties.expire_spend =
GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_add (anchor, GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_add (anchor,
GNUNET_TIME_relative_get_hour_ ())); GNUNET_TIME_relative_get_hour_ ()));
dki->issue.expire_legal = dki->issue.properties.expire_legal =
GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_add (anchor, GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_add (anchor,
GNUNET_TIME_relative_get_hour_ ())); GNUNET_TIME_relative_get_hour_ ()));
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount (CURRENCY ":1.1", &amount)); TALER_string_to_amount (CURRENCY ":1.1", &amount));
TALER_amount_hton (&dki->issue.value, &amount); TALER_amount_hton (&dki->issue.properties.value, &amount);
TALER_amount_hton (&dki->issue.fee_withdraw, &amount); TALER_amount_hton (&dki->issue.properties.fee_withdraw, &amount);
TALER_amount_hton (&dki->issue.fee_deposit, &amount); TALER_amount_hton (&dki->issue.properties.fee_deposit, &amount);
TALER_amount_hton (&dki->issue.fee_refresh, &amount); TALER_amount_hton (&dki->issue.properties.fee_refresh, &amount);
dki->issue.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY); dki->issue.properties.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY);
dki->issue.purpose.size = dki->issue.properties.purpose.size =
htonl (sizeof (struct TALER_MINTDB_DenominationKeyIssueInformation) - htonl (sizeof (struct TALER_MINTDB_DenominationKeyIssueInformation));
offsetof (struct TALER_MINTDB_DenominationKeyIssueInformation,
issue.purpose));
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
GNUNET_CRYPTO_eddsa_sign (master_prvt, GNUNET_CRYPTO_eddsa_sign (master_prvt,
&dki->issue.purpose, &dki->issue.properties.purpose,
&dki->issue.signature.eddsa_signature)); &dki->issue.signature.eddsa_signature));
GNUNET_free (master_prvt); GNUNET_free (master_prvt);

View File

@ -1045,35 +1045,35 @@ static int
postgres_insert_denomination_info (void *cls, postgres_insert_denomination_info (void *cls,
struct TALER_MINTDB_Session *session, struct TALER_MINTDB_Session *session,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_DenominationKeyValidityPS *issue) const struct TALER_MINTDB_DenominationKeyInformationP *issue)
{ {
PGresult *result; PGresult *result;
int ret; int ret;
struct TALER_PQ_QueryParam params[] = { struct TALER_PQ_QueryParam params[] = {
TALER_PQ_query_param_rsa_public_key (denom_pub->rsa_public_key), TALER_PQ_query_param_rsa_public_key (denom_pub->rsa_public_key),
TALER_PQ_query_param_auto_from_type (&issue->master), TALER_PQ_query_param_auto_from_type (&issue->properties.master),
TALER_PQ_query_param_auto_from_type (&issue->signature), TALER_PQ_query_param_auto_from_type (&issue->signature),
TALER_PQ_query_param_absolute_time_nbo (&issue->start), TALER_PQ_query_param_absolute_time_nbo (&issue->properties.start),
TALER_PQ_query_param_absolute_time_nbo (&issue->expire_withdraw), TALER_PQ_query_param_absolute_time_nbo (&issue->properties.expire_withdraw),
TALER_PQ_query_param_absolute_time_nbo (&issue->expire_spend), TALER_PQ_query_param_absolute_time_nbo (&issue->properties.expire_spend),
TALER_PQ_query_param_absolute_time_nbo (&issue->expire_legal), TALER_PQ_query_param_absolute_time_nbo (&issue->properties.expire_legal),
TALER_PQ_query_param_amount_nbo (&issue->value), TALER_PQ_query_param_amount_nbo (&issue->properties.value),
TALER_PQ_query_param_amount_nbo (&issue->fee_withdraw), TALER_PQ_query_param_amount_nbo (&issue->properties.fee_withdraw),
TALER_PQ_query_param_amount_nbo (&issue->fee_deposit), TALER_PQ_query_param_amount_nbo (&issue->properties.fee_deposit),
TALER_PQ_query_param_amount_nbo (&issue->fee_refresh), TALER_PQ_query_param_amount_nbo (&issue->properties.fee_refresh),
TALER_PQ_query_param_end TALER_PQ_query_param_end
}; };
/* check fees match coin currency */ /* check fees match coin currency */
GNUNET_assert (GNUNET_YES == GNUNET_assert (GNUNET_YES ==
TALER_amount_cmp_currency_nbo (&issue->value, TALER_amount_cmp_currency_nbo (&issue->properties.value,
&issue->fee_withdraw)); &issue->properties.fee_withdraw));
GNUNET_assert (GNUNET_YES == GNUNET_assert (GNUNET_YES ==
TALER_amount_cmp_currency_nbo (&issue->value, TALER_amount_cmp_currency_nbo (&issue->properties.value,
&issue->fee_deposit)); &issue->properties.fee_deposit));
GNUNET_assert (GNUNET_YES == GNUNET_assert (GNUNET_YES ==
TALER_amount_cmp_currency_nbo (&issue->value, TALER_amount_cmp_currency_nbo (&issue->properties.value,
&issue->fee_refresh)); &issue->properties.fee_refresh));
result = TALER_PQ_exec_prepared (session->conn, result = TALER_PQ_exec_prepared (session->conn,
"denomination_insert", "denomination_insert",
@ -1105,7 +1105,7 @@ static int
postgres_get_denomination_info (void *cls, postgres_get_denomination_info (void *cls,
struct TALER_MINTDB_Session *session, struct TALER_MINTDB_Session *session,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
struct TALER_DenominationKeyValidityPS *issue) struct TALER_MINTDB_DenominationKeyInformationP *issue)
{ {
PGresult *result; PGresult *result;
struct TALER_PQ_QueryParam params[] = { struct TALER_PQ_QueryParam params[] = {
@ -1141,25 +1141,25 @@ postgres_get_denomination_info (void *cls,
{ {
struct TALER_PQ_ResultSpec rs[] = { struct TALER_PQ_ResultSpec rs[] = {
TALER_PQ_result_spec_auto_from_type ("master_pub", TALER_PQ_result_spec_auto_from_type ("master_pub",
&issue->master), &issue->properties.master),
TALER_PQ_result_spec_auto_from_type ("master_sig", TALER_PQ_result_spec_auto_from_type ("master_sig",
&issue->signature), &issue->signature),
TALER_PQ_result_spec_absolute_time_nbo ("valid_from", TALER_PQ_result_spec_absolute_time_nbo ("valid_from",
&issue->start), &issue->properties.start),
TALER_PQ_result_spec_absolute_time_nbo ("expire_withdraw", TALER_PQ_result_spec_absolute_time_nbo ("expire_withdraw",
&issue->expire_withdraw), &issue->properties.expire_withdraw),
TALER_PQ_result_spec_absolute_time_nbo ("expire_spend", TALER_PQ_result_spec_absolute_time_nbo ("expire_spend",
&issue->expire_spend), &issue->properties.expire_spend),
TALER_PQ_result_spec_absolute_time_nbo ("expire_legal", TALER_PQ_result_spec_absolute_time_nbo ("expire_legal",
&issue->expire_legal), &issue->properties.expire_legal),
TALER_PQ_result_spec_amount_nbo ("coin", TALER_PQ_result_spec_amount_nbo ("coin",
&issue->value), &issue->properties.value),
TALER_PQ_result_spec_amount_nbo ("fee_withdraw", TALER_PQ_result_spec_amount_nbo ("fee_withdraw",
&issue->fee_withdraw), &issue->properties.fee_withdraw),
TALER_PQ_result_spec_amount_nbo ("fee_deposit", TALER_PQ_result_spec_amount_nbo ("fee_deposit",
&issue->fee_deposit), &issue->properties.fee_deposit),
TALER_PQ_result_spec_amount_nbo ("fee_refresh", TALER_PQ_result_spec_amount_nbo ("fee_refresh",
&issue->fee_refresh), &issue->properties.fee_refresh),
TALER_PQ_result_spec_end TALER_PQ_result_spec_end
}; };

View File

@ -105,26 +105,26 @@ register_denomination(struct TALER_DenominationPublicKey denom_pub,
0, 0,
sizeof (struct TALER_MINTDB_DenominationKeyIssueInformation)); sizeof (struct TALER_MINTDB_DenominationKeyIssueInformation));
dki.denom_pub = denom_pub; dki.denom_pub = denom_pub;
dki.issue.start = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ()); dki.issue.properties.start = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ());
dki.issue.expire_withdraw = GNUNET_TIME_absolute_hton dki.issue.properties.expire_withdraw = GNUNET_TIME_absolute_hton
(GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), (GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (),
GNUNET_TIME_UNIT_HOURS)); GNUNET_TIME_UNIT_HOURS));
dki.issue.expire_spend = GNUNET_TIME_absolute_hton dki.issue.properties.expire_spend = GNUNET_TIME_absolute_hton
(GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_add
(GNUNET_TIME_absolute_get (), (GNUNET_TIME_absolute_get (),
GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 2))); GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 2)));
dki.issue.expire_legal = GNUNET_TIME_absolute_hton dki.issue.properties.expire_legal = GNUNET_TIME_absolute_hton
(GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_add
(GNUNET_TIME_absolute_get (), (GNUNET_TIME_absolute_get (),
GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 3))); GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 3)));
dki.issue.value.value = GNUNET_htonll (1); dki.issue.properties.value.value = GNUNET_htonll (1);
dki.issue.value.fraction = htonl (100); dki.issue.properties.value.fraction = htonl (100);
(void) strcpy (dki.issue.value.currency, CURRENCY); (void) strcpy (dki.issue.properties.value.currency, CURRENCY);
dki.issue.fee_withdraw.value = 0; dki.issue.properties.fee_withdraw.value = 0;
dki.issue.fee_withdraw.fraction = htonl (100); dki.issue.properties.fee_withdraw.fraction = htonl (100);
(void) strcpy (dki.issue.fee_withdraw.currency, CURRENCY); (void) strcpy (dki.issue.properties.fee_withdraw.currency, CURRENCY);
dki.issue.fee_deposit = dki.issue.fee_withdraw; dki.issue.properties.fee_deposit = dki.issue.properties.fee_withdraw;
dki.issue.fee_refresh = dki.issue.fee_withdraw; dki.issue.properties.fee_refresh = dki.issue.properties.fee_withdraw;
if (GNUNET_OK != if (GNUNET_OK !=
plugin->insert_denomination_info (plugin->cls, plugin->insert_denomination_info (plugin->cls,
session, session,

View File

@ -53,8 +53,7 @@ main (int argc,
dki_read.denom_priv.rsa_private_key = NULL; dki_read.denom_priv.rsa_private_key = NULL;
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
&dki.issue.signature, &dki.issue.signature,
sizeof (dki) - offsetof (struct TALER_DenominationKeyValidityPS, sizeof (struct TALER_MasterSignatureP));
signature));
dki.denom_priv.rsa_private_key dki.denom_priv.rsa_private_key
= GNUNET_CRYPTO_rsa_private_key_create (RSA_KEY_SIZE); = GNUNET_CRYPTO_rsa_private_key_create (RSA_KEY_SIZE);
enc_size = GNUNET_CRYPTO_rsa_private_key_encode (dki.denom_priv.rsa_private_key, enc_size = GNUNET_CRYPTO_rsa_private_key_encode (dki.denom_priv.rsa_private_key,