This commit is contained in:
Christian Grothoff 2015-03-22 22:14:30 +01:00
parent 6c1081f1b5
commit f73071bc62
23 changed files with 794 additions and 467 deletions

View File

@ -27,6 +27,296 @@
/* ****************** Coin crypto primitives ************* */ /* ****************** Coin crypto primitives ************* */
/**
* Type of public keys for Taler reserves.
*/
struct TALER_ReservePublicKey
{
/**
* Taler uses EdDSA for reserves.
*/
struct GNUNET_CRYPTO_EddsaPublicKey eddsa_pub;
};
/**
* Type of private keys for Taler reserves.
*/
struct TALER_ReservePrivateKey
{
/**
* Taler uses EdDSA for reserves.
*/
struct GNUNET_CRYPTO_EddsaPrivateKey eddsa_priv;
};
/**
* Type of signatures used with Taler reserves.
*/
struct TALER_ReserveSignature
{
/**
* Taler uses EdDSA for reserves.
*/
struct GNUNET_CRYPTO_EddsaSignature eddsa_signature;
};
/**
* Type of public keys to for merchant authorizations.
* Merchants can issue refunds using the corresponding
* private key.
*/
struct TALER_MerchantPublicKey
{
/**
* Taler uses EdDSA for merchants.
*/
struct GNUNET_CRYPTO_EddsaPublicKey eddsa_pub;
};
/**
* Type of private keys for merchant authorizations.
* Merchants can issue refunds using the corresponding
* private key.
*/
struct TALER_MerchantPrivateKey
{
/**
* Taler uses EdDSA for merchants.
*/
struct GNUNET_CRYPTO_EddsaPrivateKey eddsa_priv;
};
/**
* Type of public keys used by clients to sign
* messages during a melting session.
*/
struct TALER_SessionPublicKey
{
/**
* Taler uses EdDSA for melting session keys.
*/
struct GNUNET_CRYPTO_EddsaPublicKey eddsa_pub;
};
/**
* Type of public keys used by clients to sign
* messages during a melting session.
*/
struct TALER_SessionPrivateKey
{
/**
* Taler uses EdDSA for melting session keys.
*/
struct GNUNET_CRYPTO_EddsaPrivateKey eddsa_priv;
};
/**
* Type of transfer public keys used during refresh
* operations.
*/
struct TALER_TransferPublicKey
{
/**
* Taler uses ECDSA for transfer keys.
* FIXME: should this not be ECDHE?
*/
struct GNUNET_CRYPTO_EcdsaPublicKey ecdsa_pub;
};
/**
* Type of transfer public keys used during refresh
* operations.
*/
struct TALER_TransferPrivateKey
{
/**
* Taler uses ECDSA for melting session keys.
* FIXME: should this not be ECDHE?
*/
struct GNUNET_CRYPTO_EcdsaPrivateKey ecdsa_priv;
};
/**
* Type of signatures used by clients to sign
* messages during a melting session.
*/
struct TALER_SessionSignature
{
/**
* Taler uses EdDSA for melting session keys.
*/
struct GNUNET_CRYPTO_EddsaSignature eddsa_signature;
};
/**
* Type of online public keys used by the mint to sign
* messages.
*/
struct TALER_MintPublicKey
{
/**
* Taler uses EdDSA for online mint message signing.
*/
struct GNUNET_CRYPTO_EddsaPublicKey eddsa_pub;
};
/**
* Type of online public keys used by the mint to
* sign messages.
*/
struct TALER_MintPrivateKey
{
/**
* Taler uses EdDSA for online signatures sessions.
*/
struct GNUNET_CRYPTO_EddsaPrivateKey eddsa_priv;
};
/**
* Type of signatures used by the mint to sign messages online.
*/
struct TALER_MintSignature
{
/**
* Taler uses EdDSA for online signatures sessions.
*/
struct GNUNET_CRYPTO_EddsaSignature eddsa_signature;
};
/**
* Type of the offline master public key used by the mint.
*/
struct TALER_MasterPublicKey
{
/**
* Taler uses EdDSA for the long-term offline master key.
*/
struct GNUNET_CRYPTO_EddsaPublicKey eddsa_pub;
};
/**
* Type of the offline master public keys used by the mint.
*/
struct TALER_MasterPrivateKey
{
/**
* Taler uses EdDSA for the long-term offline master key.
*/
struct GNUNET_CRYPTO_EddsaPrivateKey eddsa_priv;
};
/**
* Type of signatures by the offline master public key used by the mint.
*/
struct TALER_MasterSignature
{
/**
* Taler uses EdDSA for the long-term offline master key.
*/
struct GNUNET_CRYPTO_EddsaSignature eddsa_signature;
};
/**
* Type of public keys for Taler coins.
*/
struct TALER_CoinSpendPublicKey
{
/**
* Taler uses ECDSA for coins.
*/
struct GNUNET_CRYPTO_EcdsaPublicKey ecdsa_pub;
};
/**
* Type of private keys for Taler coins.
*/
struct TALER_CoinSpendPrivateKey
{
/**
* Taler uses ECDSA for coins.
*/
struct GNUNET_CRYPTO_EcdsaPrivateKey ecdsa_priv;
};
/**
* Type of signatures made with Taler coins.
*/
struct TALER_CoinSpendSignature
{
/**
* Taler uses ECDSA for coins.
*/
struct GNUNET_CRYPTO_EcdsaSignature ecdsa_signature;
};
/**
* Type of blinding keys for Taler.
*/
struct TALER_DenominationBlindingKey
{
/**
* Taler uses RSA for blinding.
*/
struct GNUNET_CRYPTO_rsa_BlindingKey *rsa_blinding_key;
};
/**
* Type of (unblinded) coin signatures for Taler.
*/
struct TALER_DenominationSignature
{
/**
* Taler uses RSA for blinding.
*/
struct GNUNET_CRYPTO_rsa_Signature *rsa_signature;
};
/**
* Type of public signing keys for verifying blindly signed coins.
*/
struct TALER_DenominationPublicKey
{
/**
* Taler uses RSA for signing coins.
*/
struct GNUNET_CRYPTO_rsa_PublicKey *rsa_public_key;
};
/**
* Type of private signing keys for blind signing of coins.
*/
struct TALER_DenominationPrivateKey
{
/**
* Taler uses RSA for signing coins.
*/
struct GNUNET_CRYPTO_rsa_PrivateKey *rsa_private_key;
};
/** /**
* Public information about a coin (including the public key * Public information about a coin (including the public key
* of the coin, the denomination key and the signature with * of the coin, the denomination key and the signature with
@ -37,19 +327,19 @@ struct TALER_CoinPublicInfo
/** /**
* The coin's public key. * The coin's public key.
*/ */
struct GNUNET_CRYPTO_EcdsaPublicKey coin_pub; struct TALER_CoinSpendPublicKey coin_pub;
/** /**
* Public key representing the denomination of the coin * Public key representing the denomination of the coin
* that is being deposited. * that is being deposited.
*/ */
struct GNUNET_CRYPTO_rsa_PublicKey *denom_pub; struct TALER_DenominationPublicKey denom_pub;
/** /**
* (Unblinded) signature over @e coin_pub with @e denom_pub, * (Unblinded) signature over @e coin_pub with @e denom_pub,
* which demonstrates that the coin is valid. * which demonstrates that the coin is valid.
*/ */
struct GNUNET_CRYPTO_rsa_Signature *denom_sig; struct TALER_DenominationSignature denom_sig;
}; };
@ -126,7 +416,7 @@ struct TALER_RefreshLinkEncrypted
/** /**
* Encrypted private key of the coin. * Encrypted private key of the coin.
*/ */
char coin_priv_enc[sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)]; char coin_priv_enc[sizeof (struct TALER_CoinSpendPrivateKey)];
}; };
@ -140,12 +430,12 @@ struct TALER_RefreshLinkDecrypted
/** /**
* Private key of the coin. * Private key of the coin.
*/ */
struct GNUNET_CRYPTO_EcdsaPrivateKey coin_priv; struct TALER_CoinSpendPrivateKey coin_priv;
/** /**
* Blinding key with @e blinding_key_enc_size bytes. * Blinding key.
*/ */
struct GNUNET_CRYPTO_rsa_BlindingKey *blinding_key; struct TALER_DenominationBlindingKey blinding_key;
}; };

View File

@ -1,6 +1,6 @@
/* /*
This file is part of TALER This file is part of TALER
Copyright (C) 2014 Christian Grothoff (and other contributing authors) Copyright (C) 2014, 2015 Christian Grothoff (and other contributing authors)
TALER is free software; you can redistribute it and/or modify it under the 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 terms of the GNU Affero General Public License as published by the Free Software
@ -42,7 +42,7 @@ struct TALER_MINT_SigningPublicKey
/** /**
* The signing public key * The signing public key
*/ */
struct GNUNET_CRYPTO_EddsaPublicKey key; struct TALER_MintPublicKey key;
/** /**
* Validity start time * Validity start time
@ -64,7 +64,7 @@ struct TALER_MINT_DenomPublicKey
/** /**
* The public key * The public key
*/ */
struct GNUNET_CRYPTO_rsa_PublicKey *key; struct TALER_DenominationPublicKey key;
/** /**
* Timestamp indicating when the denomination key becomes valid * Timestamp indicating when the denomination key becomes valid
@ -132,7 +132,7 @@ TALER_MINT_cleanup (struct TALER_MINT_Context *ctx);
* @param hostname the hostname of the mint * @param hostname the hostname of the mint
* @param port the point where the mint's HTTP service is running. If port is * @param port the point where the mint's HTTP service is running. If port is
* given as 0, ports 80 or 443 are chosen depending on @a url. * given as 0, ports 80 or 443 are chosen depending on @a url.
* @param mint_key the public key of the mint. This is used to verify the * @param master_key the public master key of the mint. This is used to verify the
* responses of the mint. * responses of the mint.
* @return the mint handle; NULL upon error * @return the mint handle; NULL upon error
*/ */
@ -140,7 +140,7 @@ struct TALER_MINT_Handle *
TALER_MINT_connect (struct TALER_MINT_Context *ctx, TALER_MINT_connect (struct TALER_MINT_Context *ctx,
const char *hostname, const char *hostname,
uint16_t port, uint16_t port,
struct GNUNET_CRYPTO_EddsaPublicKey *mint_key); const struct TALER_MasterPublicKey *master_key);
/** /**
* Disconnect from the mint * Disconnect from the mint
@ -282,15 +282,15 @@ struct TALER_MINT_DepositHandle *
TALER_MINT_deposit_submit_json_ (struct TALER_MINT_Handle *mint, TALER_MINT_deposit_submit_json_ (struct TALER_MINT_Handle *mint,
TALER_MINT_DepositResultCallback *cb, TALER_MINT_DepositResultCallback *cb,
void *cls, void *cls,
struct GNUNET_CRYPTO_EddsaPublicKey *coin_pub, const struct TALER_CoinPublicKey *coin_pub,
struct TALER_BLIND_SigningPublicKey *denom_pub, const struct TALER_BLIND_SigningPublicKey *denom_pub,
struct TALER_BLIND_Signature *ubsig, struct TALER_BLIND_Signature *ubsig,
uint64_t transaction_id, uint64_t transaction_id,
struct TALER_Amount *amount, struct TALER_Amount *amount,
struct GNUNET_CRYPTO_EddsaPublicKey *merchant_pub, const struct TALER_MerchantPublicKey *merchant_pub,
struct GNUNET_HashCode *h_contract, const struct GNUNET_HashCode *h_contract,
struct GNUNET_HashCode *h_wire, const struct GNUNET_HashCode *h_wire,
struct GNUNET_CRYPTO_EddsaSignature *csig, const struct TALER_CoinSignature *csig,
json_t *wire_obj); json_t *wire_obj);
#endif #endif

View File

@ -1,6 +1,6 @@
/* /*
This file is part of TALER This file is part of TALER
Copyright (C) 2014 Christian Grothoff (and other contributing authors) Copyright (C) 2014, 2015 Christian Grothoff (and other contributing authors)
TALER is free software; you can redistribute it and/or modify it under the 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 terms of the GNU General Public License as published by the Free Software
@ -28,7 +28,6 @@
#ifndef TALER_SIGNATURES_H #ifndef TALER_SIGNATURES_H
#define TALER_SIGNATURES_H #define TALER_SIGNATURES_H
#include <gnunet/gnunet_util_lib.h>
#include "taler_util.h" #include "taler_util.h"
/** /**
@ -129,7 +128,7 @@ struct TALER_WithdrawRequest
* Reserve public key (which reserve to withdraw from). This is * Reserve public key (which reserve to withdraw from). This is
* the public key which must match the signature. * the public key which must match the signature.
*/ */
struct GNUNET_CRYPTO_EddsaPublicKey reserve_pub; struct TALER_ReservePublicKey reserve_pub;
/** /**
* Value of the coin being minted (matching the denomination key) * Value of the coin being minted (matching the denomination key)
@ -189,7 +188,7 @@ struct TALER_DepositRequest
/** /**
* The coin's public key. * The coin's public key.
*/ */
struct GNUNET_CRYPTO_EcdsaPublicKey coin_pub; struct TALER_CoinSpendPublicKey coin_pub;
}; };
@ -232,12 +231,12 @@ struct TALER_DepositConfirmation
/** /**
* The coin's public key. * The coin's public key.
*/ */
struct GNUNET_CRYPTO_EcdsaPublicKey coin_pub; struct TALER_CoinSpendPublicKey coin_pub;
/** /**
* The Merchant's public key. * The Merchant's public key.
*/ */
struct GNUNET_CRYPTO_EddsaPublicKey merchant; struct TALER_MerchantPublicKey merchant;
}; };
@ -274,7 +273,7 @@ struct RefreshMeltCoinSignature
/** /**
* The coin's public key. * The coin's public key.
*/ */
struct GNUNET_CRYPTO_EcdsaPublicKey coin_pub; struct TALER_CoinSpendPublicKey coin_pub;
}; };
@ -298,7 +297,7 @@ struct RefreshMeltSessionSignature
* Public key of the refresh session for which * Public key of the refresh session for which
* @e melt_client_signature must be a valid signature. * @e melt_client_signature must be a valid signature.
*/ */
struct GNUNET_CRYPTO_EddsaPublicKey session_key; struct TALER_SessionPublicKey session_key;
/** /**
* What is the total value of the coins created during the * What is the total value of the coins created during the
@ -348,10 +347,12 @@ struct RefreshMeltConfirmSignRequestBody
*/ */
struct GNUNET_CRYPTO_EccSignaturePurpose purpose; struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
// FIXME: We probably need more info in here...
/** /**
* FIXME. * Public key the client uses for this session.
*/ */
struct GNUNET_CRYPTO_EddsaPublicKey session_pub; struct TALER_SessionPublicKey session_pub;
}; };
@ -365,7 +366,7 @@ struct TALER_MINT_SignKeyIssue
/** /**
* Signature over the signing key (by the master key of the mint). * Signature over the signing key (by the master key of the mint).
*/ */
struct GNUNET_CRYPTO_EddsaSignature signature; struct TALER_MasterSignature signature;
/** /**
* Purpose is #TALER_SIGNATURE_MASTER_SIGNKEY. * Purpose is #TALER_SIGNATURE_MASTER_SIGNKEY.
@ -376,7 +377,7 @@ struct TALER_MINT_SignKeyIssue
* Master public key of the mint corresponding to @e signature. * Master public key of the mint corresponding to @e signature.
* This is the long-term offline master key of the mint. * This is the long-term offline master key of the mint.
*/ */
struct GNUNET_CRYPTO_EddsaPublicKey master_pub; struct TALER_MasterPublicKey master_pub;
/** /**
* When does this signing key begin to be valid? * When does this signing key begin to be valid?
@ -395,7 +396,7 @@ struct TALER_MINT_SignKeyIssue
* The public online signing key that the mint will use * The public online signing key that the mint will use
* between @e start and @e expire. * between @e start and @e expire.
*/ */
struct GNUNET_CRYPTO_EddsaPublicKey signkey_pub; struct TALER_MintPublicKey signkey_pub;
}; };
@ -409,7 +410,7 @@ struct TALER_MINT_DenomKeyIssue
* Signature over this struct to affirm the validity * Signature over this struct to affirm the validity
* of the key. * of the key.
*/ */
struct GNUNET_CRYPTO_EddsaSignature signature; struct TALER_MasterSignature signature;
/** /**
* Purpose ist #TALER_SIGNATURE_MASTER_DENOM. * Purpose ist #TALER_SIGNATURE_MASTER_DENOM.
@ -420,7 +421,7 @@ struct TALER_MINT_DenomKeyIssue
* The long-term offline master key of the mint that was * The long-term offline master key of the mint that was
* used to create @e signature. * used to create @e signature.
*/ */
struct GNUNET_CRYPTO_EddsaPublicKey master; struct TALER_MasterPublicKey master;
/** /**
* Start time of the validity period for this key. * Start time of the validity period for this key.

View File

@ -179,9 +179,11 @@ struct TALER_MINT_KeysGetHandle
char *url; char *url;
TALER_MINT_KeysGetCallback cb; TALER_MINT_KeysGetCallback cb;
void *cls;
void *cb_cls;
TALER_MINT_ContinuationCallback cont_cb; TALER_MINT_ContinuationCallback cont_cb;
void *cont_cls; void *cont_cls;
}; };
@ -202,7 +204,8 @@ struct TALER_MINT_DepositHandle
char *url; char *url;
TALER_MINT_DepositResultCallback cb; TALER_MINT_DepositResultCallback cb;
void *cls;
void *cb_cls;
char *json_enc; char *json_enc;
@ -219,7 +222,8 @@ struct TALER_MINT_DepositHandle
* @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure
*/ */
static int static int
parse_timestamp (struct GNUNET_TIME_Absolute *abs, const char *tstamp_enc) parse_timestamp (struct GNUNET_TIME_Absolute *abs,
const char *tstamp_enc)
{ {
unsigned long tstamp; unsigned long tstamp;
@ -242,7 +246,7 @@ parse_timestamp (struct GNUNET_TIME_Absolute *abs, const char *tstamp_enc)
static int static int
parse_json_signkey (struct TALER_MINT_SigningPublicKey **_sign_key, parse_json_signkey (struct TALER_MINT_SigningPublicKey **_sign_key,
json_t *sign_key_obj, json_t *sign_key_obj,
struct GNUNET_CRYPTO_EddsaPublicKey *master_key) struct TALER_MasterPublicKey *master_key)
{ {
json_t *valid_from_obj; json_t *valid_from_obj;
json_t *valid_until_obj; json_t *valid_until_obj;
@ -281,7 +285,7 @@ parse_json_signkey (struct TALER_MINT_SigningPublicKey **_sign_key,
EXITIF (GNUNET_SYSERR == EXITIF (GNUNET_SYSERR ==
GNUNET_CRYPTO_eddsa_public_key_from_string (key_enc, GNUNET_CRYPTO_eddsa_public_key_from_string (key_enc,
52, 52,
&sign_key_issue.signkey_pub)); &sign_key_issue.signkey_pub.eddsa_pub));
sign_key_issue.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_SIGNKEY); sign_key_issue.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_SIGNKEY);
sign_key_issue.purpose.size = sign_key_issue.purpose.size =
htonl (sizeof (sign_key_issue) htonl (sizeof (sign_key_issue)
@ -293,7 +297,7 @@ parse_json_signkey (struct TALER_MINT_SigningPublicKey **_sign_key,
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_SIGNKEY, GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_SIGNKEY,
&sign_key_issue.purpose, &sign_key_issue.purpose,
&sig, &sig,
master_key)); &master_key->eddsa_pub));
sign_key = GNUNET_new (struct TALER_MINT_SigningPublicKey); sign_key = GNUNET_new (struct TALER_MINT_SigningPublicKey);
sign_key->valid_from = valid_from; sign_key->valid_from = valid_from;
sign_key->valid_until = valid_until; sign_key->valid_until = valid_until;
@ -337,7 +341,7 @@ parse_json_amount (json_t *amount_obj, struct TALER_Amount *amt)
static int static int
parse_json_denomkey (struct TALER_MINT_DenomPublicKey **_denom_key, parse_json_denomkey (struct TALER_MINT_DenomPublicKey **_denom_key,
json_t *denom_key_obj, json_t *denom_key_obj,
struct GNUNET_CRYPTO_EddsaPublicKey *master_key) struct TALER_MasterPublicKey *master_key)
{ {
json_t *obj; json_t *obj;
const char *sig_enc; const char *sig_enc;
@ -424,9 +428,9 @@ parse_json_denomkey (struct TALER_MINT_DenomPublicKey **_denom_key,
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_DENOM, GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_DENOM,
&denom_key_issue.purpose, &denom_key_issue.purpose,
&sig, &sig,
master_key)); &master_key->eddsa_pub));
denom_key = GNUNET_new (struct TALER_MINT_DenomPublicKey); denom_key = GNUNET_new (struct TALER_MINT_DenomPublicKey);
denom_key->key = pk; denom_key->key.rsa_public_key = pk;
denom_key->valid_from = valid_from; denom_key->valid_from = valid_from;
denom_key->withdraw_valid_until = withdraw_valid_until; denom_key->withdraw_valid_until = withdraw_valid_until;
denom_key->deposit_valid_until = deposit_valid_until; denom_key->deposit_valid_until = deposit_valid_until;
@ -451,7 +455,7 @@ parse_response_keys_get (const char *in, size_t size,
{ {
json_t *resp_obj; json_t *resp_obj;
struct TALER_MINT_DenomPublicKey **denom_keys; struct TALER_MINT_DenomPublicKey **denom_keys;
struct GNUNET_CRYPTO_EddsaPublicKey master_key; struct TALER_MasterPublicKey master_key;
struct GNUNET_TIME_Absolute list_issue_date; struct GNUNET_TIME_Absolute list_issue_date;
struct TALER_MINT_SigningPublicKey **sign_keys; struct TALER_MINT_SigningPublicKey **sign_keys;
unsigned int n_denom_keys; unsigned int n_denom_keys;
@ -487,7 +491,7 @@ parse_response_keys_get (const char *in, size_t size,
EXITIF (GNUNET_OK != EXITIF (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_public_key_from_string (master_key_enc, GNUNET_CRYPTO_eddsa_public_key_from_string (master_key_enc,
52, 52,
&master_key)); &master_key.eddsa_pub));
} }
{ {
/* parse the issue date of the response */ /* parse the issue date of the response */
@ -664,7 +668,8 @@ request_failed (struct TALER_MINT_Handle *mint, long resp_code)
{ {
struct TALER_MINT_DepositHandle *dh = mint->req.deposit; struct TALER_MINT_DepositHandle *dh = mint->req.deposit;
TALER_MINT_DepositResultCallback cb = dh->cb; TALER_MINT_DepositResultCallback cb = dh->cb;
void *cls = dh->cls; void *cls = dh->cb_cls;
GNUNET_assert (NULL != dh); GNUNET_assert (NULL != dh);
cleanup_deposit (dh); cleanup_deposit (dh);
mint_disconnect (mint); mint_disconnect (mint);
@ -705,7 +710,7 @@ request_succeeded (struct TALER_MINT_Handle *mint, long resp_code)
parse_response_keys_get (mint->buf, mint->buf_size, parse_response_keys_get (mint->buf, mint->buf_size,
&sign_keys, &n_sign_keys, &sign_keys, &n_sign_keys,
&denom_keys, &n_denom_keys)) &denom_keys, &n_denom_keys))
gh->cb (gh->cls, sign_keys, denom_keys); gh->cb (gh->cb_cls, sign_keys, denom_keys);
else else
emsg = GNUNET_strdup ("Error parsing response"); emsg = GNUNET_strdup ("Error parsing response");
} }
@ -727,7 +732,7 @@ request_succeeded (struct TALER_MINT_Handle *mint, long resp_code)
GNUNET_assert (NULL != dh); GNUNET_assert (NULL != dh);
obj = NULL; obj = NULL;
cb = dh->cb; cb = dh->cb;
cls = dh->cls; cls = dh->cb_cls;
status = 0; status = 0;
if (200 == resp_code) if (200 == resp_code)
{ {
@ -903,15 +908,15 @@ download (char *bufptr, size_t size, size_t nitems, void *cls)
* @param ctx the context * @param ctx the context
* @param hostname the hostname of the mint * @param hostname the hostname of the mint
* @param port the point where the mint's HTTP service is running. * @param port the point where the mint's HTTP service is running.
* @param mint_key the public key of the mint. This is used to verify the * @param mint_key the offline master public key of the mint.
* responses of the mint. * This is used to verify the responses of the mint.
* @return the mint handle; NULL upon error * @return the mint handle; NULL upon error
*/ */
struct TALER_MINT_Handle * struct TALER_MINT_Handle *
TALER_MINT_connect (struct TALER_MINT_Context *ctx, TALER_MINT_connect (struct TALER_MINT_Context *ctx,
const char *hostname, const char *hostname,
uint16_t port, uint16_t port,
struct GNUNET_CRYPTO_EddsaPublicKey *mint_key) const struct TALER_MasterPublicKey *mint_key)
{ {
struct TALER_MINT_Handle *mint; struct TALER_MINT_Handle *mint;
@ -952,15 +957,17 @@ TALER_MINT_disconnect (struct TALER_MINT_Handle *mint)
* *
* @param mint handle to the mint * @param mint handle to the mint
* @param cb the callback to call with each retrieved denomination key * @param cb the callback to call with each retrieved denomination key
* @param cls closure for the above callback * @param cb_cls closure for the above callback
* @param cont_cb the callback to call after completing this asynchronous call * @param cont_cb the callback to call after completing this asynchronous call
* @param cont_cls the closure for the continuation callback * @param cont_cls the closure for the continuation callback
* @return a handle to this asynchronous call; NULL upon eror * @return a handle to this asynchronous call; NULL upon eror
*/ */
struct TALER_MINT_KeysGetHandle * struct TALER_MINT_KeysGetHandle *
TALER_MINT_keys_get (struct TALER_MINT_Handle *mint, TALER_MINT_keys_get (struct TALER_MINT_Handle *mint,
TALER_MINT_KeysGetCallback cb, void *cls, TALER_MINT_KeysGetCallback cb,
TALER_MINT_ContinuationCallback cont_cb, void *cont_cls) void *cb_cls,
TALER_MINT_ContinuationCallback cont_cb,
void *cont_cls)
{ {
struct TALER_MINT_KeysGetHandle *gh; struct TALER_MINT_KeysGetHandle *gh;
@ -970,12 +977,17 @@ TALER_MINT_keys_get (struct TALER_MINT_Handle *mint,
mint->req_type = REQUEST_TYPE_KEYSGET; mint->req_type = REQUEST_TYPE_KEYSGET;
mint->req.keys_get = gh; mint->req.keys_get = gh;
gh->cb = cb; gh->cb = cb;
gh->cls = cls; gh->cb_cls = cb_cls;
gh->cont_cb = cont_cb; gh->cont_cb = cont_cb;
gh->cont_cls = cont_cls; gh->cont_cls = cont_cls;
GNUNET_asprintf (&gh->url, "http://%s:%hu/keys", mint->hostname, mint->port); GNUNET_asprintf (&gh->url,
"http://%s:%hu/keys",
mint->hostname,
mint->port);
GNUNET_assert (CURLE_OK == GNUNET_assert (CURLE_OK ==
curl_easy_setopt (mint->curl, CURLOPT_URL, gh->url)); curl_easy_setopt (mint->curl,
CURLOPT_URL,
gh->url));
if (GNUNET_NO == mint->connected) if (GNUNET_NO == mint->connected)
mint_connect (mint); mint_connect (mint);
perform_now (mint->ctx); perform_now (mint->ctx);
@ -1005,7 +1017,7 @@ TALER_MINT_keys_get_cancel (struct TALER_MINT_KeysGetHandle *get)
* *
* @param mint the mint handle * @param mint the mint handle
* @param cb the callback to call when a reply for this request is available * @param cb the callback to call when a reply for this request is available
* @param cls closure for the above callback * @param cb_cls closure for the above callback
* @param deposit_obj the deposit permission received from the customer along * @param deposit_obj the deposit permission received from the customer along
* with the wireformat JSON object * with the wireformat JSON object
* @return a handle for this request; NULL if the JSON object could not be * @return a handle for this request; NULL if the JSON object could not be
@ -1015,7 +1027,7 @@ TALER_MINT_keys_get_cancel (struct TALER_MINT_KeysGetHandle *get)
struct TALER_MINT_DepositHandle * struct TALER_MINT_DepositHandle *
TALER_MINT_deposit_submit_json (struct TALER_MINT_Handle *mint, TALER_MINT_deposit_submit_json (struct TALER_MINT_Handle *mint,
TALER_MINT_DepositResultCallback cb, TALER_MINT_DepositResultCallback cb,
void *cls, void *cb_cls,
json_t *deposit_obj) json_t *deposit_obj)
{ {
struct TALER_MINT_DepositHandle *dh; struct TALER_MINT_DepositHandle *dh;
@ -1026,7 +1038,7 @@ TALER_MINT_deposit_submit_json (struct TALER_MINT_Handle *mint,
mint->req_type = REQUEST_TYPE_DEPOSIT; mint->req_type = REQUEST_TYPE_DEPOSIT;
mint->req.deposit = dh; mint->req.deposit = dh;
dh->cb = cb; dh->cb = cb;
dh->cls = cls; dh->cb_cls = cb_cls;
GNUNET_asprintf (&dh->url, "http://%s:%hu/deposit", mint->hostname, mint->port); GNUNET_asprintf (&dh->url, "http://%s:%hu/deposit", mint->hostname, mint->port);
GNUNET_assert (NULL != (dh->json_enc = json_dumps (deposit_obj, JSON_COMPACT))); GNUNET_assert (NULL != (dh->json_enc = json_dumps (deposit_obj, JSON_COMPACT)));
GNUNET_assert (CURLE_OK == GNUNET_assert (CURLE_OK ==

View File

@ -164,8 +164,9 @@ TALER_MINT_read_denom_key (const char *filename,
GNUNET_free (data); GNUNET_free (data);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
dki->denom_priv = priv; dki->denom_priv.rsa_private_key = priv;
dki->denom_pub = GNUNET_CRYPTO_rsa_private_key_get_public (priv); dki->denom_pub.rsa_public_key
= GNUNET_CRYPTO_rsa_private_key_get_public (priv);
memcpy (&dki->issue, memcpy (&dki->issue,
data, data,
offset); offset);
@ -193,8 +194,9 @@ TALER_MINT_write_denom_key (const char *filename,
int ret; int ret;
fh = NULL; fh = NULL;
priv_enc_size = GNUNET_CRYPTO_rsa_private_key_encode (dki->denom_priv, priv_enc_size
&priv_enc); = GNUNET_CRYPTO_rsa_private_key_encode (dki->denom_priv.rsa_private_key,
&priv_enc);
ret = GNUNET_SYSERR; ret = GNUNET_SYSERR;
if (NULL == (fh = GNUNET_DISK_file_open if (NULL == (fh = GNUNET_DISK_file_open
(filename, (filename,

View File

@ -52,7 +52,7 @@ struct TALER_MINT_SignKeyIssuePriv
/** /**
* Private key part of the mint's signing key. * Private key part of the mint's signing key.
*/ */
struct GNUNET_CRYPTO_EddsaPrivateKey signkey_priv; struct TALER_MintPrivateKey signkey_priv;
/** /**
* Public information about a mint signing key. * Public information about a mint signing key.
@ -75,13 +75,13 @@ struct TALER_MINT_DenomKeyIssuePriv
* key is not available (this is the case after the key has expired * key is not available (this is the case after the key has expired
* for signing coins, but is still valid for depositing coins). * for signing coins, but is still valid for depositing coins).
*/ */
struct GNUNET_CRYPTO_rsa_PrivateKey *denom_priv; struct TALER_DenominationPrivateKey denom_priv;
/** /**
* Decoded denomination public key (the hash of it is in * Decoded denomination public key (the hash of it is in
* @e issue, but we sometimes need the full public key as well). * @e issue, but we sometimes need the full public key as well).
*/ */
struct GNUNET_CRYPTO_rsa_PublicKey *denom_pub; struct TALER_DenominationPublicKey denom_pub;
/** /**
* Signed public information about a denomination key. * Signed public information about a denomination key.

View File

@ -46,8 +46,8 @@ common_free_reserve_history (void *cls,
break; break;
case TALER_MINT_DB_RO_WITHDRAW_COIN: case TALER_MINT_DB_RO_WITHDRAW_COIN:
cbc = rh->details.withdraw; cbc = rh->details.withdraw;
GNUNET_CRYPTO_rsa_signature_free (cbc->sig); GNUNET_CRYPTO_rsa_signature_free (cbc->sig.rsa_signature);
GNUNET_CRYPTO_rsa_public_key_free (cbc->denom_pub); GNUNET_CRYPTO_rsa_public_key_free (cbc->denom_pub.rsa_public_key);
GNUNET_free (cbc); GNUNET_free (cbc);
break; break;
} }

View File

@ -758,15 +758,10 @@ postgres_reserve_get (void *cls,
PGresult *result; PGresult *result;
uint64_t expiration_date_nbo; uint64_t expiration_date_nbo;
struct TALER_DB_QueryParam params[] = { struct TALER_DB_QueryParam params[] = {
TALER_DB_QUERY_PARAM_PTR(reserve->pub), TALER_DB_QUERY_PARAM_PTR(&reserve->pub),
TALER_DB_QUERY_PARAM_END TALER_DB_QUERY_PARAM_END
}; };
if (NULL == reserve->pub)
{
GNUNET_break (0);
return GNUNET_SYSERR;
}
result = TALER_DB_exec_prepared (session->conn, result = TALER_DB_exec_prepared (session->conn,
"get_reserve", "get_reserve",
params); params);
@ -821,11 +816,11 @@ postgres_reserves_update (void *cls,
struct GNUNET_TIME_AbsoluteNBO expiry_nbo; struct GNUNET_TIME_AbsoluteNBO expiry_nbo;
int ret; int ret;
if ((NULL == reserve) || (NULL == reserve->pub)) if (NULL == reserve)
return GNUNET_SYSERR; return GNUNET_SYSERR;
ret = GNUNET_OK; ret = GNUNET_OK;
struct TALER_DB_QueryParam params[] = { struct TALER_DB_QueryParam params[] = {
TALER_DB_QUERY_PARAM_PTR (reserve->pub), TALER_DB_QUERY_PARAM_PTR (&reserve->pub),
TALER_DB_QUERY_PARAM_PTR (&balance_nbo.value), TALER_DB_QUERY_PARAM_PTR (&balance_nbo.value),
TALER_DB_QUERY_PARAM_PTR (&balance_nbo.fraction), TALER_DB_QUERY_PARAM_PTR (&balance_nbo.fraction),
TALER_DB_QUERY_PARAM_PTR (&expiry_nbo), TALER_DB_QUERY_PARAM_PTR (&expiry_nbo),
@ -901,7 +896,7 @@ postgres_reserves_in_insert (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Reserve does not exist; creating a new one\n"); "Reserve does not exist; creating a new one\n");
struct TALER_DB_QueryParam params[] = { struct TALER_DB_QueryParam params[] = {
TALER_DB_QUERY_PARAM_PTR (reserve->pub), TALER_DB_QUERY_PARAM_PTR (&reserve->pub),
TALER_DB_QUERY_PARAM_PTR (&balance_nbo.value), TALER_DB_QUERY_PARAM_PTR (&balance_nbo.value),
TALER_DB_QUERY_PARAM_PTR (&balance_nbo.fraction), TALER_DB_QUERY_PARAM_PTR (&balance_nbo.fraction),
TALER_DB_QUERY_PARAM_PTR_SIZED (balance_nbo.currency, TALER_DB_QUERY_PARAM_PTR_SIZED (balance_nbo.currency,
@ -923,7 +918,7 @@ postgres_reserves_in_insert (void *cls,
result = NULL; result = NULL;
/* create new incoming transaction */ /* create new incoming transaction */
struct TALER_DB_QueryParam params[] = { struct TALER_DB_QueryParam params[] = {
TALER_DB_QUERY_PARAM_PTR (reserve->pub), TALER_DB_QUERY_PARAM_PTR (&reserve->pub),
TALER_DB_QUERY_PARAM_PTR (&balance_nbo.value), TALER_DB_QUERY_PARAM_PTR (&balance_nbo.value),
TALER_DB_QUERY_PARAM_PTR (&balance_nbo.fraction), TALER_DB_QUERY_PARAM_PTR (&balance_nbo.fraction),
TALER_DB_QUERY_PARAM_PTR_SIZED (&balance_nbo.currency, TALER_DB_QUERY_PARAM_PTR_SIZED (&balance_nbo.currency,
@ -1053,8 +1048,8 @@ postgres_get_collectable_blindcoin (void *cls,
GNUNET_break (0); GNUNET_break (0);
goto cleanup; goto cleanup;
} }
collectable->denom_pub = denom_pub; collectable->denom_pub.rsa_public_key = denom_pub;
collectable->sig = denom_sig; collectable->sig.rsa_signature = denom_sig;
ret = GNUNET_YES; ret = GNUNET_YES;
cleanup: cleanup:
@ -1103,10 +1098,10 @@ postgres_insert_collectable_blindcoin (void *cls,
ret = GNUNET_SYSERR; ret = GNUNET_SYSERR;
denom_pub_enc_size = denom_pub_enc_size =
GNUNET_CRYPTO_rsa_public_key_encode (collectable->denom_pub, GNUNET_CRYPTO_rsa_public_key_encode (collectable->denom_pub.rsa_public_key,
&denom_pub_enc); &denom_pub_enc);
denom_sig_enc_size = denom_sig_enc_size =
GNUNET_CRYPTO_rsa_signature_encode (collectable->sig, GNUNET_CRYPTO_rsa_signature_encode (collectable->sig.rsa_signature,
&denom_sig_enc); &denom_sig_enc);
struct TALER_DB_QueryParam params[] = { struct TALER_DB_QueryParam params[] = {
TALER_DB_QUERY_PARAM_PTR (h_blind), TALER_DB_QUERY_PARAM_PTR (h_blind),
@ -1127,8 +1122,7 @@ postgres_insert_collectable_blindcoin (void *cls,
QUERY_ERR (result); QUERY_ERR (result);
goto rollback; goto rollback;
} }
reserve.pub = (struct GNUNET_CRYPTO_EddsaPublicKey *) reserve.pub = collectable->reserve_pub;
&collectable->reserve_pub;
if (GNUNET_OK != postgres_reserve_get (cls, if (GNUNET_OK != postgres_reserve_get (cls,
session, session,
&reserve)) &reserve))
@ -1172,7 +1166,7 @@ postgres_insert_collectable_blindcoin (void *cls,
static struct ReserveHistory * static struct ReserveHistory *
postgres_get_reserve_history (void *cls, postgres_get_reserve_history (void *cls,
struct TALER_MINTDB_Session *session, struct TALER_MINTDB_Session *session,
const struct GNUNET_CRYPTO_EddsaPublicKey *reserve_pub) const struct TALER_ReservePublicKey *reserve_pub)
{ {
PGresult *result; PGresult *result;
struct ReserveHistory *rh; struct ReserveHistory *rh;
@ -1219,7 +1213,7 @@ postgres_get_reserve_history (void *cls,
GNUNET_break (0); GNUNET_break (0);
goto cleanup; goto cleanup;
} }
(void) memcpy (&bt->reserve_pub, reserve_pub, sizeof (bt->reserve_pub)); bt->reserve_pub = *reserve_pub;
if (NULL != rh_head) if (NULL != rh_head)
{ {
rh_head->next = GNUNET_new (struct ReserveHistory); rh_head->next = GNUNET_new (struct ReserveHistory);
@ -1238,7 +1232,7 @@ postgres_get_reserve_history (void *cls,
result = NULL; result = NULL;
{ {
struct GNUNET_HashCode blind_ev; struct GNUNET_HashCode blind_ev;
struct GNUNET_CRYPTO_EddsaSignature reserve_sig; struct TALER_ReserveSignature reserve_sig;
struct CollectableBlindcoin *cbc; struct CollectableBlindcoin *cbc;
char *denom_pub_enc; char *denom_pub_enc;
char *denom_sig_enc; char *denom_sig_enc;
@ -1280,20 +1274,23 @@ postgres_get_reserve_history (void *cls,
goto cleanup; goto cleanup;
} }
cbc = GNUNET_new (struct CollectableBlindcoin); cbc = GNUNET_new (struct CollectableBlindcoin);
cbc->sig = GNUNET_CRYPTO_rsa_signature_decode (denom_sig_enc, cbc->sig.rsa_signature
denom_sig_enc_size); = GNUNET_CRYPTO_rsa_signature_decode (denom_sig_enc,
denom_sig_enc_size);
GNUNET_free (denom_sig_enc); GNUNET_free (denom_sig_enc);
denom_sig_enc = NULL; denom_sig_enc = NULL;
cbc->denom_pub = GNUNET_CRYPTO_rsa_public_key_decode (denom_pub_enc, cbc->denom_pub.rsa_public_key
denom_pub_enc_size); = GNUNET_CRYPTO_rsa_public_key_decode (denom_pub_enc,
denom_pub_enc_size);
GNUNET_free (denom_pub_enc); GNUNET_free (denom_pub_enc);
denom_pub_enc = NULL; denom_pub_enc = NULL;
if ((NULL == cbc->sig) || (NULL == cbc->denom_pub)) if ( (NULL == cbc->sig.rsa_signature) ||
(NULL == cbc->denom_pub.rsa_public_key) )
{ {
if (NULL != cbc->sig) if (NULL != cbc->sig.rsa_signature)
GNUNET_CRYPTO_rsa_signature_free (cbc->sig); GNUNET_CRYPTO_rsa_signature_free (cbc->sig.rsa_signature);
if (NULL != cbc->denom_pub) if (NULL != cbc->denom_pub.rsa_public_key)
GNUNET_CRYPTO_rsa_public_key_free (cbc->denom_pub); GNUNET_CRYPTO_rsa_public_key_free (cbc->denom_pub.rsa_public_key);
GNUNET_free (cbc); GNUNET_free (cbc);
GNUNET_break (0); GNUNET_break (0);
goto cleanup; goto cleanup;
@ -1394,10 +1391,10 @@ postgres_insert_deposit (void *cls,
ret = GNUNET_SYSERR; ret = GNUNET_SYSERR;
denom_pub_enc_size = denom_pub_enc_size =
GNUNET_CRYPTO_rsa_public_key_encode (deposit->coin.denom_pub, GNUNET_CRYPTO_rsa_public_key_encode (deposit->coin.denom_pub.rsa_public_key,
&denom_pub_enc); &denom_pub_enc);
denom_sig_enc_size = denom_sig_enc_size =
GNUNET_CRYPTO_rsa_signature_encode (deposit->coin.denom_sig, GNUNET_CRYPTO_rsa_signature_encode (deposit->coin.denom_sig.rsa_signature,
&denom_sig_enc); &denom_sig_enc);
json_wire_enc = json_dumps (deposit->wire, JSON_COMPACT); json_wire_enc = json_dumps (deposit->wire, JSON_COMPACT);
TALER_amount_hton (&amount_nbo, TALER_amount_hton (&amount_nbo,
@ -1450,7 +1447,7 @@ postgres_insert_deposit (void *cls,
static int static int
postgres_get_refresh_session (void *cls, postgres_get_refresh_session (void *cls,
struct TALER_MINTDB_Session *session, struct TALER_MINTDB_Session *session,
const struct GNUNET_CRYPTO_EddsaPublicKey *refresh_session_pub, const struct TALER_SessionPublicKey *refresh_session_pub,
struct RefreshSession *refresh_session) struct RefreshSession *refresh_session)
{ {
// FIXME: check logic! // FIXME: check logic!
@ -1526,7 +1523,7 @@ postgres_get_refresh_session (void *cls,
static int static int
postgres_create_refresh_session (void *cls, postgres_create_refresh_session (void *cls,
struct TALER_MINTDB_Session *session, struct TALER_MINTDB_Session *session,
const struct GNUNET_CRYPTO_EddsaPublicKey *session_pub, const struct TALER_SessionPublicKey *session_pub,
const struct RefreshSession *refresh_session) const struct RefreshSession *refresh_session)
{ {
// FIXME: actually store session data! // FIXME: actually store session data!
@ -1570,7 +1567,7 @@ postgres_create_refresh_session (void *cls,
static int static int
postgres_insert_refresh_melt (void *cls, postgres_insert_refresh_melt (void *cls,
struct TALER_MINTDB_Session *session, struct TALER_MINTDB_Session *session,
const struct GNUNET_CRYPTO_EddsaPublicKey *refresh_session, const struct TALER_SessionPublicKey *refresh_session,
uint16_t oldcoin_index, uint16_t oldcoin_index,
const struct RefreshMelt *melt) const struct RefreshMelt *melt)
{ {
@ -1580,7 +1577,7 @@ postgres_insert_refresh_melt (void *cls,
size_t buf_size; size_t buf_size;
PGresult *result; PGresult *result;
buf_size = GNUNET_CRYPTO_rsa_public_key_encode (melt->coin.denom_pub, buf_size = GNUNET_CRYPTO_rsa_public_key_encode (melt->coin.denom_pub.rsa_public_key,
&buf); &buf);
{ {
struct TALER_DB_QueryParam params[] = { struct TALER_DB_QueryParam params[] = {
@ -1620,7 +1617,7 @@ postgres_insert_refresh_melt (void *cls,
static int static int
postgres_get_refresh_melt (void *cls, postgres_get_refresh_melt (void *cls,
struct TALER_MINTDB_Session *session, struct TALER_MINTDB_Session *session,
const struct GNUNET_CRYPTO_EddsaPublicKey *refresh_session, const struct TALER_SessionPublicKey *refresh_session,
uint16_t oldcoin_index, uint16_t oldcoin_index,
struct RefreshMelt *melt) struct RefreshMelt *melt)
{ {
@ -1645,9 +1642,9 @@ postgres_get_refresh_melt (void *cls,
static int static int
postgres_insert_refresh_order (void *cls, postgres_insert_refresh_order (void *cls,
struct TALER_MINTDB_Session *session, struct TALER_MINTDB_Session *session,
const struct GNUNET_CRYPTO_EddsaPublicKey *session_pub, const struct TALER_SessionPublicKey *session_pub,
uint16_t num_newcoins, uint16_t num_newcoins,
struct GNUNET_CRYPTO_rsa_PublicKey *const*denom_pubs) const struct TALER_DenominationPublicKey *denom_pubs)
{ {
// FIXME: check logic: was written for just one COIN! // FIXME: check logic: was written for just one COIN!
uint16_t newcoin_index_nbo = htons (num_newcoins); uint16_t newcoin_index_nbo = htons (num_newcoins);
@ -1655,7 +1652,7 @@ postgres_insert_refresh_order (void *cls,
size_t buf_size; size_t buf_size;
PGresult *result; PGresult *result;
buf_size = GNUNET_CRYPTO_rsa_public_key_encode (*denom_pubs, buf_size = GNUNET_CRYPTO_rsa_public_key_encode (denom_pubs->rsa_public_key,
&buf); &buf);
{ {
@ -1701,9 +1698,9 @@ postgres_insert_refresh_order (void *cls,
static int static int
postgres_get_refresh_order (void *cls, postgres_get_refresh_order (void *cls,
struct TALER_MINTDB_Session *session, struct TALER_MINTDB_Session *session,
const struct GNUNET_CRYPTO_EddsaPublicKey *session_pub, const struct TALER_SessionPublicKey *session_pub,
uint16_t num_newcoins, uint16_t num_newcoins,
struct GNUNET_CRYPTO_rsa_PublicKey **denom_pubs) struct TALER_DenominationPublicKey *denom_pubs)
{ {
// FIXME: check logic -- was written for just one coin! // FIXME: check logic -- was written for just one coin!
char *buf; char *buf;
@ -1744,7 +1741,9 @@ postgres_get_refresh_order (void *cls,
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
PQclear (result); PQclear (result);
denom_pubs[0] = GNUNET_CRYPTO_rsa_public_key_decode (buf, buf_size); denom_pubs->rsa_public_key
= GNUNET_CRYPTO_rsa_public_key_decode (buf,
buf_size);
GNUNET_free (buf); GNUNET_free (buf);
return GNUNET_OK; return GNUNET_OK;
} }
@ -1767,7 +1766,7 @@ postgres_get_refresh_order (void *cls,
static int static int
postgres_insert_refresh_commit_coins (void *cls, postgres_insert_refresh_commit_coins (void *cls,
struct TALER_MINTDB_Session *session, struct TALER_MINTDB_Session *session,
const struct GNUNET_CRYPTO_EddsaPublicKey *refresh_session_pub, const struct TALER_SessionPublicKey *refresh_session_pub,
unsigned int i, unsigned int i,
unsigned int num_newcoins, unsigned int num_newcoins,
const struct RefreshCommitCoin *commit_coins) const struct RefreshCommitCoin *commit_coins)
@ -1780,9 +1779,9 @@ postgres_insert_refresh_commit_coins (void *cls,
TALER_DB_QUERY_PARAM_PTR_SIZED(commit_coins->coin_ev, commit_coins->coin_ev_size), TALER_DB_QUERY_PARAM_PTR_SIZED(commit_coins->coin_ev, commit_coins->coin_ev_size),
TALER_DB_QUERY_PARAM_PTR(&cnc_index_nbo), TALER_DB_QUERY_PARAM_PTR(&cnc_index_nbo),
TALER_DB_QUERY_PARAM_PTR(&newcoin_index_nbo), TALER_DB_QUERY_PARAM_PTR(&newcoin_index_nbo),
TALER_DB_QUERY_PARAM_PTR_SIZED(commit_coins->refresh_link->coin_priv_enc, TALER_DB_QUERY_PARAM_PTR_SIZED (commit_coins->refresh_link->coin_priv_enc,
commit_coins->refresh_link->blinding_key_enc_size + commit_coins->refresh_link->blinding_key_enc_size +
sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)), sizeof (struct TALER_CoinSpendPrivateKey)),
TALER_DB_QUERY_PARAM_END TALER_DB_QUERY_PARAM_END
}; };
@ -1825,7 +1824,7 @@ postgres_insert_refresh_commit_coins (void *cls,
static int static int
postgres_get_refresh_commit_coins (void *cls, postgres_get_refresh_commit_coins (void *cls,
struct TALER_MINTDB_Session *session, struct TALER_MINTDB_Session *session,
const struct GNUNET_CRYPTO_EddsaPublicKey *refresh_session_pub, const struct TALER_SessionPublicKey *refresh_session_pub,
unsigned int cnc_index, unsigned int cnc_index,
unsigned int newcoin_index, unsigned int newcoin_index,
struct RefreshCommitCoin *cc) struct RefreshCommitCoin *cc)
@ -1873,7 +1872,7 @@ postgres_get_refresh_commit_coins (void *cls,
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
PQclear (result); PQclear (result);
if (rl_buf_size < sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)) if (rl_buf_size < sizeof (struct TALER_CoinSpendPrivateKey))
{ {
GNUNET_free (c_buf); GNUNET_free (c_buf);
GNUNET_free (rl_buf); GNUNET_free (rl_buf);
@ -1896,7 +1895,7 @@ postgres_get_refresh_commit_coins (void *cls,
* @param cls the `struct PostgresClosure` with the plugin-specific state * @param cls the `struct PostgresClosure` with the plugin-specific state
* @param session database connection to use * @param session database connection to use
* @param refresh_session_pub public key of the refresh session this * @param refresh_session_pub public key of the refresh session this
* commitment belongs with * commitment belongs with -- FIXME: should not be needed!
* @param i set index (1st dimension) * @param i set index (1st dimension)
* @param j coin index (2nd dimension), corresponds to melted (old) coins * @param j coin index (2nd dimension), corresponds to melted (old) coins
* @param commit_link link information to store * @param commit_link link information to store
@ -1905,7 +1904,7 @@ postgres_get_refresh_commit_coins (void *cls,
static int static int
postgres_insert_refresh_commit_links (void *cls, postgres_insert_refresh_commit_links (void *cls,
struct TALER_MINTDB_Session *session, struct TALER_MINTDB_Session *session,
const struct GNUNET_CRYPTO_EddsaPublicKey *refresh_session_pub, const struct TALER_SessionPublicKey *refresh_session_pub,
unsigned int i, unsigned int i,
unsigned int j, unsigned int j,
const struct RefreshCommitLink *commit_link) const struct RefreshCommitLink *commit_link)
@ -1950,7 +1949,7 @@ postgres_insert_refresh_commit_links (void *cls,
* @param cls the `struct PostgresClosure` with the plugin-specific state * @param cls the `struct PostgresClosure` with the plugin-specific state
* @param session database connection to use * @param session database connection to use
* @param refresh_session_pub public key of the refresh session this * @param refresh_session_pub public key of the refresh session this
* commitment belongs with * commitment belongs with -- FIXME: should not be needed!
* @param i set index (1st dimension) * @param i set index (1st dimension)
* @param num_links size of the @a commit_link array * @param num_links size of the @a commit_link array
* @param links[OUT] array of link information to return * @param links[OUT] array of link information to return
@ -1961,7 +1960,7 @@ postgres_insert_refresh_commit_links (void *cls,
static int static int
postgres_get_refresh_commit_links (void *cls, postgres_get_refresh_commit_links (void *cls,
struct TALER_MINTDB_Session *session, struct TALER_MINTDB_Session *session,
const struct GNUNET_CRYPTO_EddsaPublicKey *refresh_session_pub, const struct TALER_SessionPublicKey *refresh_session_pub,
unsigned int i, unsigned int i,
unsigned int num_links, unsigned int num_links,
struct RefreshCommitLink *links) struct RefreshCommitLink *links)
@ -2026,9 +2025,9 @@ postgres_get_refresh_commit_links (void *cls,
static int static int
postgres_insert_refresh_collectable (void *cls, postgres_insert_refresh_collectable (void *cls,
struct TALER_MINTDB_Session *session, struct TALER_MINTDB_Session *session,
const struct GNUNET_CRYPTO_EddsaPublicKey *session_pub, const struct TALER_SessionPublicKey *session_pub,
uint16_t newcoin_index, uint16_t newcoin_index,
const struct GNUNET_CRYPTO_rsa_Signature *ev_sig) const struct TALER_DenominationSignature *ev_sig)
{ {
// FIXME: check logic! // FIXME: check logic!
uint16_t newcoin_index_nbo = htons (newcoin_index); uint16_t newcoin_index_nbo = htons (newcoin_index);
@ -2036,7 +2035,7 @@ postgres_insert_refresh_collectable (void *cls,
size_t buf_size; size_t buf_size;
PGresult *result; PGresult *result;
buf_size = GNUNET_CRYPTO_rsa_signature_encode (ev_sig, buf_size = GNUNET_CRYPTO_rsa_signature_encode (ev_sig->rsa_signature,
&buf); &buf);
{ {
struct TALER_DB_QueryParam params[] = { struct TALER_DB_QueryParam params[] = {
@ -2073,7 +2072,7 @@ postgres_insert_refresh_collectable (void *cls,
static struct LinkDataList * static struct LinkDataList *
postgres_get_link_data_list (void *cls, postgres_get_link_data_list (void *cls,
struct TALER_MINTDB_Session *session, struct TALER_MINTDB_Session *session,
const struct GNUNET_CRYPTO_EcdsaPublicKey *coin_pub) const struct TALER_CoinSpendPublicKey *coin_pub)
{ {
// FIXME: check logic! // FIXME: check logic!
struct LinkDataList *ldl; struct LinkDataList *ldl;
@ -2146,10 +2145,12 @@ postgres_get_link_data_list (void *cls,
ld_buf, ld_buf,
ld_buf_size); ld_buf_size);
sig = GNUNET_CRYPTO_rsa_signature_decode (sig_buf, sig
sig_buf_size); = GNUNET_CRYPTO_rsa_signature_decode (sig_buf,
denom_pub = GNUNET_CRYPTO_rsa_public_key_decode (pk_buf, sig_buf_size);
pk_buf_size); denom_pub
= GNUNET_CRYPTO_rsa_public_key_decode (pk_buf,
pk_buf_size);
GNUNET_free (pk_buf); GNUNET_free (pk_buf);
GNUNET_free (sig_buf); GNUNET_free (sig_buf);
GNUNET_free (ld_buf); GNUNET_free (ld_buf);
@ -2170,8 +2171,8 @@ postgres_get_link_data_list (void *cls,
pos = GNUNET_new (struct LinkDataList); pos = GNUNET_new (struct LinkDataList);
pos->next = ldl; pos->next = ldl;
pos->link_data_enc = link_enc; pos->link_data_enc = link_enc;
pos->denom_pub = denom_pub; pos->denom_pub.rsa_public_key = denom_pub;
pos->ev_sig = sig; pos->ev_sig.rsa_signature = sig;
ldl = pos; ldl = pos;
} }
return ldl; return ldl;
@ -2196,8 +2197,8 @@ postgres_get_link_data_list (void *cls,
static int static int
postgres_get_transfer (void *cls, postgres_get_transfer (void *cls,
struct TALER_MINTDB_Session *session, struct TALER_MINTDB_Session *session,
const struct GNUNET_CRYPTO_EcdsaPublicKey *coin_pub, const struct TALER_CoinSpendPublicKey *coin_pub,
struct GNUNET_CRYPTO_EcdsaPublicKey *transfer_pub, struct TALER_TransferPublicKey *transfer_pub,
struct TALER_EncryptedLinkSecret *shared_secret_enc) struct TALER_EncryptedLinkSecret *shared_secret_enc)
{ {
// FIXME: check logic! // FIXME: check logic!
@ -2260,7 +2261,7 @@ postgres_get_transfer (void *cls,
static struct TALER_MINT_DB_TransactionList * static struct TALER_MINT_DB_TransactionList *
postgres_get_coin_transactions (void *cls, postgres_get_coin_transactions (void *cls,
struct TALER_MINTDB_Session *session, struct TALER_MINTDB_Session *session,
const struct GNUNET_CRYPTO_EcdsaPublicKey *coin_pub) const struct TALER_CoinSpendPublicKey *coin_pub)
{ {
// FIXME: check logic! // FIXME: check logic!
GNUNET_break (0); // FIXME: implement! GNUNET_break (0); // FIXME: implement!

View File

@ -130,7 +130,7 @@ TALER_MINT_db_execute_deposit (struct MHD_Connection *connection,
} }
mks = TALER_MINT_key_state_acquire (); mks = TALER_MINT_key_state_acquire ();
dki = TALER_MINT_get_denom_key (mks, dki = TALER_MINT_get_denom_key (mks,
deposit->coin.denom_pub); &deposit->coin.denom_pub);
TALER_amount_ntoh (&value, TALER_amount_ntoh (&value,
&dki->issue.value); &dki->issue.value);
TALER_MINT_key_state_release (mks); TALER_MINT_key_state_release (mks);
@ -211,7 +211,7 @@ TALER_MINT_db_execute_deposit (struct MHD_Connection *connection,
*/ */
int int
TALER_MINT_db_execute_withdraw_status (struct MHD_Connection *connection, TALER_MINT_db_execute_withdraw_status (struct MHD_Connection *connection,
const struct GNUNET_CRYPTO_EddsaPublicKey *reserve_pub) const struct TALER_ReservePublicKey *reserve_pub)
{ {
struct TALER_MINTDB_Session *session; struct TALER_MINTDB_Session *session;
struct ReserveHistory *rh; struct ReserveHistory *rh;
@ -255,11 +255,11 @@ TALER_MINT_db_execute_withdraw_status (struct MHD_Connection *connection,
*/ */
int int
TALER_MINT_db_execute_withdraw_sign (struct MHD_Connection *connection, TALER_MINT_db_execute_withdraw_sign (struct MHD_Connection *connection,
const struct GNUNET_CRYPTO_EddsaPublicKey *reserve, const struct TALER_ReservePublicKey *reserve,
const struct GNUNET_CRYPTO_rsa_PublicKey *denomination_pub, const struct TALER_DenominationPublicKey *denomination_pub,
const char *blinded_msg, const char *blinded_msg,
size_t blinded_msg_len, size_t blinded_msg_len,
const struct GNUNET_CRYPTO_EddsaSignature *signature) const struct TALER_ReserveSignature *signature)
{ {
struct TALER_MINTDB_Session *session; struct TALER_MINTDB_Session *session;
struct ReserveHistory *rh; struct ReserveHistory *rh;
@ -303,8 +303,8 @@ TALER_MINT_db_execute_withdraw_sign (struct MHD_Connection *connection,
{ {
res = TALER_MINT_reply_withdraw_sign_success (connection, res = TALER_MINT_reply_withdraw_sign_success (connection,
&collectable); &collectable);
GNUNET_CRYPTO_rsa_signature_free (collectable.sig); GNUNET_CRYPTO_rsa_signature_free (collectable.sig.rsa_signature);
GNUNET_CRYPTO_rsa_public_key_free (collectable.denom_pub); GNUNET_CRYPTO_rsa_public_key_free (collectable.denom_pub.rsa_public_key);
return res; return res;
} }
GNUNET_assert (GNUNET_NO == res); GNUNET_assert (GNUNET_NO == res);
@ -387,7 +387,7 @@ TALER_MINT_db_execute_withdraw_sign (struct MHD_Connection *connection,
break; break;
case TALER_MINT_DB_RO_WITHDRAW_COIN: case TALER_MINT_DB_RO_WITHDRAW_COIN:
tdki = TALER_MINT_get_denom_key (key_state, tdki = TALER_MINT_get_denom_key (key_state,
pos->details.withdraw->denom_pub); &pos->details.withdraw->denom_pub);
TALER_amount_ntoh (&value, TALER_amount_ntoh (&value,
&tdki->issue.value); &tdki->issue.value);
if (0 == (res & 2)) if (0 == (res & 2))
@ -428,7 +428,7 @@ TALER_MINT_db_execute_withdraw_sign (struct MHD_Connection *connection,
rh); rh);
/* Balance is good, sign the coin! */ /* Balance is good, sign the coin! */
sig = GNUNET_CRYPTO_rsa_sign (dki->denom_priv, sig = GNUNET_CRYPTO_rsa_sign (dki->denom_priv.rsa_private_key,
blinded_msg, blinded_msg,
blinded_msg_len); blinded_msg_len);
TALER_MINT_key_state_release (key_state); TALER_MINT_key_state_release (key_state);
@ -440,8 +440,9 @@ TALER_MINT_db_execute_withdraw_sign (struct MHD_Connection *connection,
return TALER_MINT_reply_internal_error (connection, return TALER_MINT_reply_internal_error (connection,
"Internal error"); "Internal error");
} }
collectable.sig = sig; /* FIXME: this signature is still blinded, bad name... */
collectable.denom_pub = (struct GNUNET_CRYPTO_rsa_PublicKey *) denomination_pub; collectable.sig.rsa_signature = sig;
collectable.denom_pub = *denomination_pub;
collectable.reserve_pub = *reserve; collectable.reserve_pub = *reserve;
GNUNET_CRYPTO_hash (blinded_msg, GNUNET_CRYPTO_hash (blinded_msg,
blinded_msg_len, blinded_msg_len,
@ -494,7 +495,7 @@ refresh_accept_melts (struct MHD_Connection *connection,
struct TALER_MINTDB_Session *session, struct TALER_MINTDB_Session *session,
const struct MintKeyState *key_state, const struct MintKeyState *key_state,
const struct GNUNET_HashCode *melt_hash, const struct GNUNET_HashCode *melt_hash,
const struct GNUNET_CRYPTO_EddsaPublicKey *session_pub, const struct TALER_SessionPublicKey *session_pub,
const struct TALER_CoinPublicInfo *coin_public_info, const struct TALER_CoinPublicInfo *coin_public_info,
const struct MeltDetails *coin_details, const struct MeltDetails *coin_details,
uint16_t oldcoin_index) uint16_t oldcoin_index)
@ -508,7 +509,7 @@ refresh_accept_melts (struct MHD_Connection *connection,
int res; int res;
dki = &TALER_MINT_get_denom_key (key_state, dki = &TALER_MINT_get_denom_key (key_state,
coin_public_info->denom_pub)->issue; &coin_public_info->denom_pub)->issue;
if (NULL == dki) if (NULL == dki)
return (MHD_YES == return (MHD_YES ==
@ -607,10 +608,10 @@ refresh_accept_melts (struct MHD_Connection *connection,
int int
TALER_MINT_db_execute_refresh_melt (struct MHD_Connection *connection, TALER_MINT_db_execute_refresh_melt (struct MHD_Connection *connection,
const struct GNUNET_HashCode *melt_hash, const struct GNUNET_HashCode *melt_hash,
const struct GNUNET_CRYPTO_EddsaPublicKey *refresh_session_pub, const struct TALER_SessionPublicKey *refresh_session_pub,
const struct GNUNET_CRYPTO_EddsaSignature *client_signature, const struct TALER_SessionSignature *client_signature,
unsigned int num_new_denoms, unsigned int num_new_denoms,
struct GNUNET_CRYPTO_rsa_PublicKey *const*denom_pubs, const struct TALER_DenominationPublicKey *denom_pubs,
unsigned int coin_count, unsigned int coin_count,
const struct TALER_CoinPublicInfo *coin_public_infos, const struct TALER_CoinPublicInfo *coin_public_infos,
const struct MeltDetails *coin_melt_details, const struct MeltDetails *coin_melt_details,
@ -773,7 +774,7 @@ TALER_MINT_db_execute_refresh_melt (struct MHD_Connection *connection,
* @param transfer_privs private transfer keys * @param transfer_privs private transfer keys
* @param melts array of melted coins * @param melts array of melted coins
* @param num_newcoins number of newcoins being generated * @param num_newcoins number of newcoins being generated
* @param denom_pub array of @a num_newcoins keys for the new coins * @param denom_pubs array of @a num_newcoins keys for the new coins
* @return #GNUNET_OK if the committment was honest, * @return #GNUNET_OK if the committment was honest,
* #GNUNET_NO if there was a problem and we generated an error message * #GNUNET_NO if there was a problem and we generated an error message
* #GNUNET_SYSERR if we could not even generate an error message * #GNUNET_SYSERR if we could not even generate an error message
@ -781,13 +782,13 @@ TALER_MINT_db_execute_refresh_melt (struct MHD_Connection *connection,
static int static int
check_commitment (struct MHD_Connection *connection, check_commitment (struct MHD_Connection *connection,
struct TALER_MINTDB_Session *session, struct TALER_MINTDB_Session *session,
const struct GNUNET_CRYPTO_EddsaPublicKey *refresh_session, const struct TALER_SessionPublicKey *refresh_session,
unsigned int off, unsigned int off,
unsigned int num_oldcoins, unsigned int num_oldcoins,
const struct GNUNET_CRYPTO_EcdsaPrivateKey *transfer_privs, const struct TALER_TransferPrivateKey *transfer_privs,
const struct RefreshMelt *melts, const struct RefreshMelt *melts,
unsigned int num_newcoins, unsigned int num_newcoins,
struct GNUNET_CRYPTO_rsa_PublicKey **denom_pubs) const struct TALER_DenominationPublicKey *denom_pubs)
{ {
unsigned int j; unsigned int j;
struct TALER_LinkSecret last_shared_secret; struct TALER_LinkSecret last_shared_secret;
@ -817,14 +818,14 @@ check_commitment (struct MHD_Connection *connection,
{ {
struct TALER_TransferSecret transfer_secret; struct TALER_TransferSecret transfer_secret;
struct TALER_LinkSecret shared_secret; struct TALER_LinkSecret shared_secret;
struct GNUNET_CRYPTO_EcdsaPublicKey transfer_pub_check; struct TALER_TransferPublicKey transfer_pub_check;
GNUNET_CRYPTO_ecdsa_key_get_public (&transfer_privs[j], GNUNET_CRYPTO_ecdsa_key_get_public (&transfer_privs[j].ecdsa_priv,
&transfer_pub_check); &transfer_pub_check.ecdsa_pub);
if (0 != if (0 !=
memcmp (&transfer_pub_check, memcmp (&transfer_pub_check,
&commit_links[j].transfer_pub, &commit_links[j].transfer_pub,
sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey))) sizeof (struct TALER_TransferPublicKey)))
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"transfer keys do not match\n"); "transfer keys do not match\n");
@ -840,9 +841,9 @@ check_commitment (struct MHD_Connection *connection,
/* We're converting key types here, which is not very nice /* We're converting key types here, which is not very nice
* but necessary and harmless (keys will be thrown away later). */ * but necessary and harmless (keys will be thrown away later). */
GNUNET_CRYPTO_ecdsa_public_to_ecdhe (&melts[j].coin.coin_pub, GNUNET_CRYPTO_ecdsa_public_to_ecdhe (&melts[j].coin.coin_pub.ecdsa_pub,
&coin_ecdhe); &coin_ecdhe);
GNUNET_CRYPTO_ecdsa_private_to_ecdhe (&transfer_privs[j], GNUNET_CRYPTO_ecdsa_private_to_ecdhe (&transfer_privs[j].ecdsa_priv,
&transfer_ecdhe); &transfer_ecdhe);
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_CRYPTO_ecc_ecdh (&transfer_ecdhe, GNUNET_CRYPTO_ecc_ecdh (&transfer_ecdhe,
@ -915,7 +916,7 @@ check_commitment (struct MHD_Connection *connection,
for (j = 0; j < num_newcoins; j++) for (j = 0; j < num_newcoins; j++)
{ {
struct TALER_RefreshLinkDecrypted *link_data; struct TALER_RefreshLinkDecrypted *link_data;
struct GNUNET_CRYPTO_EcdsaPublicKey coin_pub; struct TALER_CoinSpendPublicKey coin_pub;
struct GNUNET_HashCode h_msg; struct GNUNET_HashCode h_msg;
char *buf; char *buf;
size_t buf_len; size_t buf_len;
@ -931,15 +932,15 @@ check_commitment (struct MHD_Connection *connection,
? GNUNET_NO : GNUNET_SYSERR; ? GNUNET_NO : GNUNET_SYSERR;
} }
GNUNET_CRYPTO_ecdsa_key_get_public (&link_data->coin_priv, GNUNET_CRYPTO_ecdsa_key_get_public (&link_data->coin_priv.ecdsa_priv,
&coin_pub); &coin_pub.ecdsa_pub);
GNUNET_CRYPTO_hash (&coin_pub, GNUNET_CRYPTO_hash (&coin_pub,
sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey), sizeof (struct TALER_CoinSpendPublicKey),
&h_msg); &h_msg);
if (0 == (buf_len = if (0 == (buf_len =
GNUNET_CRYPTO_rsa_blind (&h_msg, GNUNET_CRYPTO_rsa_blind (&h_msg,
link_data->blinding_key, link_data->blinding_key.rsa_blinding_key,
denom_pubs[j], denom_pubs[j].rsa_public_key,
&buf))) &buf)))
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@ -989,42 +990,45 @@ check_commitment (struct MHD_Connection *connection,
* @param coin_off number of the coin * @param coin_off number of the coin
* @return NULL on error, otherwise signature over the coin * @return NULL on error, otherwise signature over the coin
*/ */
static struct GNUNET_CRYPTO_rsa_Signature * static struct TALER_DenominationSignature
refresh_mint_coin (struct MHD_Connection *connection, refresh_mint_coin (struct MHD_Connection *connection,
struct TALER_MINTDB_Session *session, struct TALER_MINTDB_Session *session,
const struct GNUNET_CRYPTO_EddsaPublicKey *refresh_session, const struct TALER_SessionPublicKey *refresh_session,
struct MintKeyState *key_state, struct MintKeyState *key_state,
const struct GNUNET_CRYPTO_rsa_PublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
const struct RefreshCommitCoin *commit_coin, const struct RefreshCommitCoin *commit_coin,
unsigned int coin_off) unsigned int coin_off)
{ {
struct TALER_MINT_DenomKeyIssuePriv *dki; struct TALER_MINT_DenomKeyIssuePriv *dki;
struct GNUNET_CRYPTO_rsa_Signature *ev_sig; struct TALER_DenominationSignature ev_sig;
dki = TALER_MINT_get_denom_key (key_state, denom_pub); dki = TALER_MINT_get_denom_key (key_state,
denom_pub);
if (NULL == dki) if (NULL == dki)
{ {
GNUNET_break (0); GNUNET_break (0);
return NULL; ev_sig.rsa_signature = NULL;
return ev_sig;
} }
ev_sig = GNUNET_CRYPTO_rsa_sign (dki->denom_priv, ev_sig.rsa_signature
commit_coin->coin_ev, = GNUNET_CRYPTO_rsa_sign (dki->denom_priv.rsa_private_key,
commit_coin->coin_ev_size); commit_coin->coin_ev,
if (NULL == ev_sig) commit_coin->coin_ev_size);
if (NULL == ev_sig.rsa_signature)
{ {
GNUNET_break (0); GNUNET_break (0);
return NULL; return ev_sig;
} }
if (GNUNET_OK != if (GNUNET_OK !=
plugin->insert_refresh_collectable (plugin->cls, plugin->insert_refresh_collectable (plugin->cls,
session, session,
refresh_session, refresh_session,
coin_off, coin_off,
ev_sig)) &ev_sig))
{ {
GNUNET_break (0); GNUNET_break (0);
GNUNET_CRYPTO_rsa_signature_free (ev_sig); GNUNET_CRYPTO_rsa_signature_free (ev_sig.rsa_signature);
return NULL; ev_sig.rsa_signature = NULL;
} }
return ev_sig; return ev_sig;
} }
@ -1046,18 +1050,18 @@ refresh_mint_coin (struct MHD_Connection *connection,
*/ */
int int
TALER_MINT_db_execute_refresh_reveal (struct MHD_Connection *connection, TALER_MINT_db_execute_refresh_reveal (struct MHD_Connection *connection,
const struct GNUNET_CRYPTO_EddsaPublicKey *refresh_session_pub, const struct TALER_SessionPublicKey *refresh_session_pub,
unsigned int kappa, unsigned int kappa,
unsigned int num_oldcoins, unsigned int num_oldcoins,
struct GNUNET_CRYPTO_EcdsaPrivateKey *const*transfer_privs) struct TALER_TransferPrivateKey **transfer_privs)
{ {
int res; int res;
struct TALER_MINTDB_Session *session; struct TALER_MINTDB_Session *session;
struct RefreshSession refresh_session; struct RefreshSession refresh_session;
struct MintKeyState *key_state; struct MintKeyState *key_state;
struct RefreshMelt *melts; struct RefreshMelt *melts;
struct GNUNET_CRYPTO_rsa_PublicKey **denom_pubs; struct TALER_DenominationPublicKey *denom_pubs;
struct GNUNET_CRYPTO_rsa_Signature **ev_sigs; struct TALER_DenominationSignature *ev_sigs;
struct RefreshCommitCoin *commit_coins; struct RefreshCommitCoin *commit_coins;
unsigned int i; unsigned int i;
unsigned int j; unsigned int j;
@ -1102,7 +1106,7 @@ TALER_MINT_db_execute_refresh_reveal (struct MHD_Connection *connection,
} }
} }
denom_pubs = GNUNET_malloc (refresh_session.num_newcoins * denom_pubs = GNUNET_malloc (refresh_session.num_newcoins *
sizeof (struct GNUNET_CRYPTO_rsa_PublicKey *)); sizeof (struct TALER_DenominationPublicKey));
if (GNUNET_OK != if (GNUNET_OK !=
plugin->get_refresh_order (plugin->cls, plugin->get_refresh_order (plugin->cls,
session, session,
@ -1135,7 +1139,7 @@ TALER_MINT_db_execute_refresh_reveal (struct MHD_Connection *connection,
denom_pubs))) denom_pubs)))
{ {
for (j=0;j<refresh_session.num_newcoins;j++) for (j=0;j<refresh_session.num_newcoins;j++)
GNUNET_CRYPTO_rsa_public_key_free (denom_pubs[j]); GNUNET_CRYPTO_rsa_public_key_free (denom_pubs[j].rsa_public_key);
GNUNET_free (denom_pubs); GNUNET_free (denom_pubs);
GNUNET_free (melts); GNUNET_free (melts);
return (GNUNET_NO == res) ? MHD_YES : MHD_NO; return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
@ -1150,7 +1154,7 @@ TALER_MINT_db_execute_refresh_reveal (struct MHD_Connection *connection,
{ {
GNUNET_break (0); GNUNET_break (0);
for (j=0;j<refresh_session.num_newcoins;j++) for (j=0;j<refresh_session.num_newcoins;j++)
GNUNET_CRYPTO_rsa_public_key_free (denom_pubs[j]); GNUNET_CRYPTO_rsa_public_key_free (denom_pubs[j].rsa_public_key);
GNUNET_free (denom_pubs); GNUNET_free (denom_pubs);
return TALER_MINT_reply_internal_db_error (connection); return TALER_MINT_reply_internal_db_error (connection);
} }
@ -1168,12 +1172,12 @@ TALER_MINT_db_execute_refresh_reveal (struct MHD_Connection *connection,
GNUNET_break (0); GNUNET_break (0);
GNUNET_free (commit_coins); GNUNET_free (commit_coins);
for (j=0;j<refresh_session.num_newcoins;j++) for (j=0;j<refresh_session.num_newcoins;j++)
GNUNET_CRYPTO_rsa_public_key_free (denom_pubs[j]); GNUNET_CRYPTO_rsa_public_key_free (denom_pubs[j].rsa_public_key);
GNUNET_free (denom_pubs); GNUNET_free (denom_pubs);
return TALER_MINT_reply_internal_db_error (connection); return TALER_MINT_reply_internal_db_error (connection);
} }
ev_sigs = GNUNET_malloc (refresh_session.num_newcoins * ev_sigs = GNUNET_malloc (refresh_session.num_newcoins *
sizeof (struct GNUNET_CRYPTO_rsa_Signature *)); sizeof (struct TALER_DenominationSignature));
key_state = TALER_MINT_key_state_acquire (); key_state = TALER_MINT_key_state_acquire ();
for (j=0;j<refresh_session.num_newcoins;j++) for (j=0;j<refresh_session.num_newcoins;j++)
{ {
@ -1181,17 +1185,17 @@ TALER_MINT_db_execute_refresh_reveal (struct MHD_Connection *connection,
session, session,
refresh_session_pub, refresh_session_pub,
key_state, key_state,
denom_pubs[j], &denom_pubs[j],
&commit_coins[j], &commit_coins[j],
j); j);
if (NULL == ev_sigs[j]) if (NULL == ev_sigs[j].rsa_signature)
{ {
TALER_MINT_key_state_release (key_state); TALER_MINT_key_state_release (key_state);
for (i=0;i<j;i++) for (i=0;i<j;i++)
GNUNET_CRYPTO_rsa_signature_free (ev_sigs[i]); GNUNET_CRYPTO_rsa_signature_free (ev_sigs[i].rsa_signature);
GNUNET_free (ev_sigs); GNUNET_free (ev_sigs);
for (j=0;j<refresh_session.num_newcoins;j++) for (j=0;j<refresh_session.num_newcoins;j++)
GNUNET_CRYPTO_rsa_public_key_free (denom_pubs[j]); GNUNET_CRYPTO_rsa_public_key_free (denom_pubs[j].rsa_public_key);
GNUNET_free (denom_pubs); GNUNET_free (denom_pubs);
GNUNET_free (commit_coins); GNUNET_free (commit_coins);
return TALER_MINT_reply_internal_db_error (connection); return TALER_MINT_reply_internal_db_error (connection);
@ -1199,7 +1203,7 @@ TALER_MINT_db_execute_refresh_reveal (struct MHD_Connection *connection,
} }
TALER_MINT_key_state_release (key_state); TALER_MINT_key_state_release (key_state);
for (j=0;j<refresh_session.num_newcoins;j++) for (j=0;j<refresh_session.num_newcoins;j++)
GNUNET_CRYPTO_rsa_public_key_free (denom_pubs[j]); GNUNET_CRYPTO_rsa_public_key_free (denom_pubs[j].rsa_public_key);
GNUNET_free (denom_pubs); GNUNET_free (denom_pubs);
GNUNET_free (commit_coins); GNUNET_free (commit_coins);
@ -1209,7 +1213,7 @@ TALER_MINT_db_execute_refresh_reveal (struct MHD_Connection *connection,
{ {
LOG_WARNING ("/refresh/reveal transaction commit failed\n"); LOG_WARNING ("/refresh/reveal transaction commit failed\n");
for (i=0;i<refresh_session.num_newcoins;i++) for (i=0;i<refresh_session.num_newcoins;i++)
GNUNET_CRYPTO_rsa_signature_free (ev_sigs[i]); GNUNET_CRYPTO_rsa_signature_free (ev_sigs[i].rsa_signature);
GNUNET_free (ev_sigs); GNUNET_free (ev_sigs);
return TALER_MINT_reply_commit_error (connection); return TALER_MINT_reply_commit_error (connection);
} }
@ -1218,7 +1222,7 @@ TALER_MINT_db_execute_refresh_reveal (struct MHD_Connection *connection,
refresh_session.num_newcoins, refresh_session.num_newcoins,
ev_sigs); ev_sigs);
for (i=0;i<refresh_session.num_newcoins;i++) for (i=0;i<refresh_session.num_newcoins;i++)
GNUNET_CRYPTO_rsa_signature_free (ev_sigs[i]); GNUNET_CRYPTO_rsa_signature_free (ev_sigs[i].rsa_signature);
GNUNET_free (ev_sigs); GNUNET_free (ev_sigs);
return res; return res;
} }
@ -1235,11 +1239,11 @@ TALER_MINT_db_execute_refresh_reveal (struct MHD_Connection *connection,
*/ */
int int
TALER_MINT_db_execute_refresh_link (struct MHD_Connection *connection, TALER_MINT_db_execute_refresh_link (struct MHD_Connection *connection,
const struct GNUNET_CRYPTO_EcdsaPublicKey *coin_pub) const struct TALER_CoinSpendPublicKey *coin_pub)
{ {
int res; int res;
struct TALER_MINTDB_Session *session; struct TALER_MINTDB_Session *session;
struct GNUNET_CRYPTO_EcdsaPublicKey transfer_pub; struct TALER_TransferPublicKey transfer_pub;
struct TALER_EncryptedLinkSecret shared_secret_enc; struct TALER_EncryptedLinkSecret shared_secret_enc;
struct LinkDataList *ldl; struct LinkDataList *ldl;

View File

@ -53,7 +53,7 @@ TALER_MINT_db_execute_deposit (struct MHD_Connection *connection,
*/ */
int int
TALER_MINT_db_execute_withdraw_status (struct MHD_Connection *connection, TALER_MINT_db_execute_withdraw_status (struct MHD_Connection *connection,
const struct GNUNET_CRYPTO_EddsaPublicKey *reserve_pub); const struct TALER_ReservePublicKey *reserve_pub);
/** /**
@ -72,11 +72,11 @@ TALER_MINT_db_execute_withdraw_status (struct MHD_Connection *connection,
*/ */
int int
TALER_MINT_db_execute_withdraw_sign (struct MHD_Connection *connection, TALER_MINT_db_execute_withdraw_sign (struct MHD_Connection *connection,
const struct GNUNET_CRYPTO_EddsaPublicKey *reserve, const struct TALER_ReservePublicKey *reserve,
const struct GNUNET_CRYPTO_rsa_PublicKey *denomination_pub, const struct TALER_DenominationPublicKey *denomination_pub,
const char *blinded_msg, const char *blinded_msg,
size_t blinded_msg_len, size_t blinded_msg_len,
const struct GNUNET_CRYPTO_EddsaSignature *signature); const struct TALER_ReserveSignature *signature);
/** /**
@ -88,7 +88,7 @@ struct MeltDetails
* Signature allowing the melt (using * Signature allowing the melt (using
* a `struct RefreshMeltConfirmSignRequestBody`) to sign over. * a `struct RefreshMeltConfirmSignRequestBody`) to sign over.
*/ */
struct GNUNET_CRYPTO_EcdsaSignature melt_sig; struct TALER_CoinSpendSignature melt_sig;
/** /**
* How much of the coin's value did the client allow to be melted? * How much of the coin's value did the client allow to be melted?
@ -129,10 +129,10 @@ struct MeltDetails
int int
TALER_MINT_db_execute_refresh_melt (struct MHD_Connection *connection, TALER_MINT_db_execute_refresh_melt (struct MHD_Connection *connection,
const struct GNUNET_HashCode *melt_hash, const struct GNUNET_HashCode *melt_hash,
const struct GNUNET_CRYPTO_EddsaPublicKey *refresh_session_pub, const struct TALER_SessionPublicKey *refresh_session_pub,
const struct GNUNET_CRYPTO_EddsaSignature *client_signature, const struct TALER_SessionSignature *client_signature,
unsigned int num_new_denoms, unsigned int num_new_denoms,
struct GNUNET_CRYPTO_rsa_PublicKey *const*denom_pubs, const struct TALER_DenominationPublicKey *denom_pubs,
unsigned int coin_count, unsigned int coin_count,
const struct TALER_CoinPublicInfo *coin_public_infos, const struct TALER_CoinPublicInfo *coin_public_infos,
const struct MeltDetails *coin_melt_details, const struct MeltDetails *coin_melt_details,
@ -157,10 +157,10 @@ TALER_MINT_db_execute_refresh_melt (struct MHD_Connection *connection,
*/ */
int int
TALER_MINT_db_execute_refresh_reveal (struct MHD_Connection *connection, TALER_MINT_db_execute_refresh_reveal (struct MHD_Connection *connection,
const struct GNUNET_CRYPTO_EddsaPublicKey *refresh_session_pub, const struct TALER_SessionPublicKey *refresh_session_pub,
unsigned int kappa, unsigned int kappa,
unsigned int num_oldcoins, unsigned int num_oldcoins,
struct GNUNET_CRYPTO_EcdsaPrivateKey *const*transfer_privs); struct TALER_TransferPrivateKey **transfer_privs);
/** /**
@ -174,7 +174,7 @@ TALER_MINT_db_execute_refresh_reveal (struct MHD_Connection *connection,
*/ */
int int
TALER_MINT_db_execute_refresh_link (struct MHD_Connection *connection, TALER_MINT_db_execute_refresh_link (struct MHD_Connection *connection,
const struct GNUNET_CRYPTO_EcdsaPublicKey *coin_pub); const struct TALER_CoinSpendPublicKey *coin_pub);
#endif #endif

View File

@ -72,8 +72,8 @@ verify_and_execute_deposit (struct MHD_Connection *connection,
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_CRYPTO_ecdsa_verify (TALER_SIGNATURE_WALLET_DEPOSIT, GNUNET_CRYPTO_ecdsa_verify (TALER_SIGNATURE_WALLET_DEPOSIT,
&dr.purpose, &dr.purpose,
&deposit->csig, &deposit->csig.ecdsa_signature,
&deposit->coin.coin_pub)) &deposit->coin.coin_pub.ecdsa_pub))
{ {
LOG_WARNING ("Invalid signature on /deposit request\n"); LOG_WARNING ("Invalid signature on /deposit request\n");
return TALER_MINT_reply_arg_invalid (connection, return TALER_MINT_reply_arg_invalid (connection,
@ -82,7 +82,7 @@ verify_and_execute_deposit (struct MHD_Connection *connection,
/* check denomination exists and is valid */ /* check denomination exists and is valid */
key_state = TALER_MINT_key_state_acquire (); key_state = TALER_MINT_key_state_acquire ();
dki = TALER_MINT_get_denom_key (key_state, dki = TALER_MINT_get_denom_key (key_state,
deposit->coin.denom_pub); &deposit->coin.denom_pub);
if (NULL == dki) if (NULL == dki)
{ {
TALER_MINT_key_state_release (key_state); TALER_MINT_key_state_release (key_state);

View File

@ -111,7 +111,7 @@ static int reload_pipe[2];
* @return a JSON object describing the denomination key isue (public part) * @return a JSON object describing the denomination key isue (public part)
*/ */
static json_t * static json_t *
denom_key_issue_to_json (struct GNUNET_CRYPTO_rsa_PublicKey *pk, denom_key_issue_to_json (const struct TALER_DenominationPublicKey *pk,
const struct TALER_MINT_DenomKeyIssue *dki) const struct TALER_MINT_DenomKeyIssue *dki)
{ {
struct TALER_Amount value; struct TALER_Amount value;
@ -139,7 +139,7 @@ denom_key_issue_to_json (struct GNUNET_CRYPTO_rsa_PublicKey *pk,
"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->expire_spend)),
"denom_pub", "denom_pub",
TALER_JSON_from_rsa_public_key (pk), TALER_JSON_from_rsa_public_key (pk->rsa_public_key),
"value", "value",
TALER_JSON_from_amount (&value), TALER_JSON_from_amount (&value),
"fee_withdraw", "fee_withdraw",
@ -217,7 +217,7 @@ reload_keys_denom_iter (void *cls,
return GNUNET_OK; return GNUNET_OK;
} }
GNUNET_CRYPTO_rsa_public_key_hash (dki->denom_pub, GNUNET_CRYPTO_rsa_public_key_hash (dki->denom_pub.rsa_public_key,
&denom_key_hash); &denom_key_hash);
d2 = GNUNET_memdup (dki, d2 = GNUNET_memdup (dki,
sizeof (struct TALER_MINT_DenomKeyIssuePriv)); sizeof (struct TALER_MINT_DenomKeyIssuePriv));
@ -234,7 +234,7 @@ reload_keys_denom_iter (void *cls,
return GNUNET_OK; return GNUNET_OK;
} }
json_array_append_new (ctx->denom_keys_array, json_array_append_new (ctx->denom_keys_array,
denom_key_issue_to_json (dki->denom_pub, denom_key_issue_to_json (&dki->denom_pub,
&dki->issue)); &dki->issue));
return GNUNET_OK; return GNUNET_OK;
} }
@ -435,11 +435,11 @@ TALER_MINT_key_state_acquire (void)
*/ */
struct TALER_MINT_DenomKeyIssuePriv * struct TALER_MINT_DenomKeyIssuePriv *
TALER_MINT_get_denom_key (const struct MintKeyState *key_state, TALER_MINT_get_denom_key (const struct MintKeyState *key_state,
const struct GNUNET_CRYPTO_rsa_PublicKey *denom_pub) const struct TALER_DenominationPublicKey *denom_pub)
{ {
struct GNUNET_HashCode hc; struct GNUNET_HashCode hc;
GNUNET_CRYPTO_rsa_public_key_hash (denom_pub, GNUNET_CRYPTO_rsa_public_key_hash (denom_pub->rsa_public_key,
&hc); &hc);
return GNUNET_CONTAINER_multihashmap_get (key_state->denomkey_map, return GNUNET_CONTAINER_multihashmap_get (key_state->denomkey_map,
&hc); &hc);
@ -564,16 +564,16 @@ read_again:
*/ */
void void
TALER_MINT_keys_sign (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, TALER_MINT_keys_sign (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
struct GNUNET_CRYPTO_EddsaSignature *sig) struct TALER_MintSignature *sig)
{ {
struct MintKeyState *key_state; struct MintKeyState *key_state;
key_state = TALER_MINT_key_state_acquire (); key_state = TALER_MINT_key_state_acquire ();
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
GNUNET_CRYPTO_eddsa_sign (&key_state->current_sign_key_issue.signkey_priv, GNUNET_CRYPTO_eddsa_sign (&key_state->current_sign_key_issue.signkey_priv.eddsa_priv,
purpose, purpose,
sig)); &sig->eddsa_signature));
TALER_MINT_key_state_release (key_state); TALER_MINT_key_state_release (key_state);
} }

View File

@ -67,7 +67,7 @@ TALER_MINT_key_state_release (struct MintKeyState *key_state);
*/ */
struct TALER_MINT_DenomKeyIssuePriv * struct TALER_MINT_DenomKeyIssuePriv *
TALER_MINT_get_denom_key (const struct MintKeyState *key_state, TALER_MINT_get_denom_key (const struct MintKeyState *key_state,
const struct GNUNET_CRYPTO_rsa_PublicKey *denom_pub); const struct TALER_DenominationPublicKey *denom_pub);
/** /**
@ -90,7 +90,7 @@ TALER_MINT_key_reload_loop (void);
*/ */
void void
TALER_MINT_keys_sign (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, TALER_MINT_keys_sign (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
struct GNUNET_CRYPTO_EddsaSignature *sig); struct TALER_MintSignature *sig);
/** /**

View File

@ -58,14 +58,14 @@
*/ */
static int static int
handle_refresh_melt_binary (struct MHD_Connection *connection, handle_refresh_melt_binary (struct MHD_Connection *connection,
const struct GNUNET_CRYPTO_EddsaPublicKey *refresh_session_pub, const struct TALER_SessionPublicKey *refresh_session_pub,
unsigned int num_new_denoms, unsigned int num_new_denoms,
struct GNUNET_CRYPTO_rsa_PublicKey *const*denom_pubs, const struct TALER_DenominationPublicKey *denom_pubs,
unsigned int coin_count, unsigned int coin_count,
struct TALER_CoinPublicInfo *coin_public_infos, struct TALER_CoinPublicInfo *coin_public_infos,
const struct MeltDetails *coin_melt_details, const struct MeltDetails *coin_melt_details,
const struct GNUNET_HashCode *commit_hash, const struct GNUNET_HashCode *commit_hash,
const struct GNUNET_CRYPTO_EddsaSignature *commit_client_sig, const struct TALER_SessionSignature *commit_client_sig,
unsigned int kappa, unsigned int kappa,
struct RefreshCommitCoin *const* commit_coin, struct RefreshCommitCoin *const* commit_coin,
struct RefreshCommitLink *const* commit_link) struct RefreshCommitLink *const* commit_link)
@ -92,7 +92,7 @@ handle_refresh_melt_binary (struct MHD_Connection *connection,
/* FIXME: also hash session public key here!? #3708 */ /* FIXME: also hash session public key here!? #3708 */
for (i = 0; i < num_new_denoms; i++) for (i = 0; i < num_new_denoms; i++)
{ {
buf_size = GNUNET_CRYPTO_rsa_public_key_encode (denom_pubs[i], buf_size = GNUNET_CRYPTO_rsa_public_key_encode (denom_pubs[i].rsa_public_key,
&buf); &buf);
GNUNET_CRYPTO_hash_context_read (hash_context, GNUNET_CRYPTO_hash_context_read (hash_context,
buf, buf,
@ -113,10 +113,11 @@ handle_refresh_melt_binary (struct MHD_Connection *connection,
TALER_amount_hton (&body.amount_with_fee, TALER_amount_hton (&body.amount_with_fee,
&coin_melt_details->melt_amount_with_fee); &coin_melt_details->melt_amount_with_fee);
if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_REFRESH_MELT_SESSION, if (GNUNET_OK !=
&body.purpose, GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_REFRESH_MELT_SESSION,
commit_client_sig, &body.purpose,
refresh_session_pub)) &commit_client_sig->eddsa_signature,
&refresh_session_pub->eddsa_pub))
{ {
GNUNET_log (GNUNET_ERROR_TYPE_WARNING, GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"signature invalid (did not verify)\n"); "signature invalid (did not verify)\n");
@ -133,7 +134,7 @@ handle_refresh_melt_binary (struct MHD_Connection *connection,
for (i=0;i<num_new_denoms;i++) for (i=0;i<num_new_denoms;i++)
{ {
dki = &TALER_MINT_get_denom_key (key_state, dki = &TALER_MINT_get_denom_key (key_state,
denom_pubs[i])->issue; &denom_pubs[i])->issue;
TALER_amount_ntoh (&value, TALER_amount_ntoh (&value,
&dki->value); &dki->value);
TALER_amount_ntoh (&fee_withdraw, TALER_amount_ntoh (&fee_withdraw,
@ -161,7 +162,7 @@ handle_refresh_melt_binary (struct MHD_Connection *connection,
/* calculate contribution of the i-th melt by subtracting /* calculate contribution of the i-th melt by subtracting
the fee; add the rest to the total_melt value */ the fee; add the rest to the total_melt value */
dki = &TALER_MINT_get_denom_key (key_state, dki = &TALER_MINT_get_denom_key (key_state,
coin_public_infos[i].denom_pub)->issue; &coin_public_infos[i].denom_pub)->issue;
TALER_amount_ntoh (&fee_melt, TALER_amount_ntoh (&fee_melt,
&dki->fee_refresh); &dki->fee_refresh);
if (GNUNET_OK != if (GNUNET_OK !=
@ -228,14 +229,14 @@ get_coin_public_info (struct MHD_Connection *connection,
struct MeltDetails *r_melt_detail) struct MeltDetails *r_melt_detail)
{ {
int ret; int ret;
struct GNUNET_CRYPTO_EcdsaSignature melt_sig; struct TALER_CoinSpendSignature melt_sig;
struct GNUNET_CRYPTO_rsa_Signature *sig; struct TALER_DenominationSignature sig;
struct GNUNET_CRYPTO_rsa_PublicKey *pk; struct TALER_DenominationPublicKey pk;
struct TALER_Amount amount; struct TALER_Amount amount;
struct GNUNET_MINT_ParseFieldSpec spec[] = { struct GNUNET_MINT_ParseFieldSpec spec[] = {
TALER_MINT_PARSE_FIXED ("coin_pub", &r_public_info->coin_pub), TALER_MINT_PARSE_FIXED ("coin_pub", &r_public_info->coin_pub),
TALER_MINT_PARSE_RSA_SIGNATURE ("denom_sig", &sig), TALER_MINT_PARSE_RSA_SIGNATURE ("denom_sig", &sig.rsa_signature),
TALER_MINT_PARSE_RSA_PUBLIC_KEY ("denom_pub", &pk), TALER_MINT_PARSE_RSA_PUBLIC_KEY ("denom_pub", &pk.rsa_public_key),
TALER_MINT_PARSE_FIXED ("confirm_sig", &melt_sig), TALER_MINT_PARSE_FIXED ("confirm_sig", &melt_sig),
TALER_MINT_PARSE_AMOUNT ("value_with_fee", &amount), TALER_MINT_PARSE_AMOUNT ("value_with_fee", &amount),
TALER_MINT_PARSE_END TALER_MINT_PARSE_END
@ -253,8 +254,8 @@ get_coin_public_info (struct MHD_Connection *connection,
TALER_test_coin_valid (r_public_info)) TALER_test_coin_valid (r_public_info))
{ {
TALER_MINT_release_parsed_data (spec); TALER_MINT_release_parsed_data (spec);
r_public_info->denom_sig = NULL; r_public_info->denom_sig.rsa_signature = NULL;
r_public_info->denom_pub = NULL; r_public_info->denom_pub.rsa_public_key = NULL;
return (MHD_YES == return (MHD_YES ==
TALER_MINT_reply_json_pack (connection, TALER_MINT_reply_json_pack (connection,
MHD_HTTP_NOT_FOUND, MHD_HTTP_NOT_FOUND,
@ -304,8 +305,8 @@ verify_coin_public_info (struct MHD_Connection *connection,
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_CRYPTO_ecdsa_verify (TALER_SIGNATURE_REFRESH_MELT_COIN, GNUNET_CRYPTO_ecdsa_verify (TALER_SIGNATURE_REFRESH_MELT_COIN,
&body.purpose, &body.purpose,
&r_melt_detail->melt_sig, &r_melt_detail->melt_sig.ecdsa_signature,
&r_public_info->coin_pub)) &r_public_info->coin_pub.ecdsa_pub))
{ {
if (MHD_YES != if (MHD_YES !=
TALER_MINT_reply_json_pack (connection, TALER_MINT_reply_json_pack (connection,
@ -317,7 +318,7 @@ verify_coin_public_info (struct MHD_Connection *connection,
} }
key_state = TALER_MINT_key_state_acquire (); key_state = TALER_MINT_key_state_acquire ();
dki = TALER_MINT_get_denom_key (key_state, dki = TALER_MINT_get_denom_key (key_state,
r_public_info->denom_pub); &r_public_info->denom_pub);
if (NULL == dki) if (NULL == dki)
{ {
TALER_MINT_key_state_release (key_state); TALER_MINT_key_state_release (key_state);
@ -420,7 +421,7 @@ free_commit_links (struct RefreshCommitLink **commit_link,
*/ */
static int static int
handle_refresh_melt_json (struct MHD_Connection *connection, handle_refresh_melt_json (struct MHD_Connection *connection,
const struct GNUNET_CRYPTO_EddsaPublicKey *refresh_session_pub, const struct TALER_SessionPublicKey *refresh_session_pub,
const json_t *new_denoms, const json_t *new_denoms,
const json_t *melt_coins, const json_t *melt_coins,
const json_t *melt_sig_json, const json_t *melt_sig_json,
@ -437,7 +438,7 @@ handle_refresh_melt_json (struct MHD_Connection *connection,
int res; int res;
unsigned int i; unsigned int i;
unsigned int j; unsigned int j;
struct GNUNET_CRYPTO_rsa_PublicKey **denom_pubs; struct TALER_DenominationPublicKey *denom_pubs;
unsigned int num_new_denoms; unsigned int num_new_denoms;
struct TALER_CoinPublicInfo *coin_public_infos; struct TALER_CoinPublicInfo *coin_public_infos;
struct MeltDetails *coin_melt_details; struct MeltDetails *coin_melt_details;
@ -446,20 +447,22 @@ handle_refresh_melt_json (struct MHD_Connection *connection,
struct GNUNET_HashContext *hash_context; struct GNUNET_HashContext *hash_context;
struct RefreshCommitCoin *commit_coin[kappa]; struct RefreshCommitCoin *commit_coin[kappa];
struct RefreshCommitLink *commit_link[kappa]; struct RefreshCommitLink *commit_link[kappa];
const struct GNUNET_CRYPTO_EddsaSignature commit_client_sig; const struct TALER_SessionSignature commit_client_sig;
num_new_denoms = json_array_size (new_denoms); num_new_denoms = json_array_size (new_denoms);
denom_pubs = GNUNET_malloc (num_new_denoms * denom_pubs = GNUNET_malloc (num_new_denoms *
sizeof (struct GNUNET_CRYPTO_rsa_PublicKey *)); sizeof (struct TALER_DenominationPublicKey));
for (i=0;i<num_new_denoms;i++) for (i=0;i<num_new_denoms;i++)
{ {
res = GNUNET_MINT_parse_navigate_json (connection, new_denoms, res = GNUNET_MINT_parse_navigate_json (connection,
new_denoms,
JNAV_INDEX, (int) i, JNAV_INDEX, (int) i,
JNAV_RET_RSA_PUBLIC_KEY, &denom_pubs[i]); JNAV_RET_RSA_PUBLIC_KEY,
&denom_pubs[i].rsa_public_key);
if (GNUNET_OK != res) if (GNUNET_OK != res)
{ {
for (j=0;j<i;j++) for (j=0;j<i;j++)
GNUNET_CRYPTO_rsa_public_key_free (denom_pubs[j]); GNUNET_CRYPTO_rsa_public_key_free (denom_pubs[j].rsa_public_key);
GNUNET_free (denom_pubs); GNUNET_free (denom_pubs);
return res; return res;
} }
@ -483,12 +486,12 @@ handle_refresh_melt_json (struct MHD_Connection *connection,
{ {
for (j=0;j<i;j++) for (j=0;j<i;j++)
{ {
GNUNET_CRYPTO_rsa_public_key_free (coin_public_infos[j].denom_pub); GNUNET_CRYPTO_rsa_public_key_free (coin_public_infos[j].denom_pub.rsa_public_key);
GNUNET_CRYPTO_rsa_signature_free (coin_public_infos[j].denom_sig); GNUNET_CRYPTO_rsa_signature_free (coin_public_infos[j].denom_sig.rsa_signature);
} }
GNUNET_free (coin_public_infos); GNUNET_free (coin_public_infos);
for (j=0;j<num_new_denoms;j++) for (j=0;j<num_new_denoms;j++)
GNUNET_CRYPTO_rsa_public_key_free (denom_pubs[j]); GNUNET_CRYPTO_rsa_public_key_free (denom_pubs[j].rsa_public_key);
GNUNET_free (coin_melt_details); GNUNET_free (coin_melt_details);
GNUNET_free (denom_pubs); GNUNET_free (denom_pubs);
return (GNUNET_NO == res) ? MHD_YES : MHD_NO; return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
@ -499,16 +502,16 @@ handle_refresh_melt_json (struct MHD_Connection *connection,
{ {
if (0 == memcmp (&coin_public_infos[i].coin_pub, if (0 == memcmp (&coin_public_infos[i].coin_pub,
&coin_public_infos[j].coin_pub, &coin_public_infos[j].coin_pub,
sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey))) sizeof (struct TALER_CoinSpendPublicKey)))
{ {
for (j=0;j<i;j++) for (j=0;j<i;j++)
{ {
GNUNET_CRYPTO_rsa_public_key_free (coin_public_infos[j].denom_pub); GNUNET_CRYPTO_rsa_public_key_free (coin_public_infos[j].denom_pub.rsa_public_key);
GNUNET_CRYPTO_rsa_signature_free (coin_public_infos[j].denom_sig); GNUNET_CRYPTO_rsa_signature_free (coin_public_infos[j].denom_sig.rsa_signature);
} }
GNUNET_free (coin_public_infos); GNUNET_free (coin_public_infos);
for (j=0;j<num_new_denoms;j++) for (j=0;j<num_new_denoms;j++)
GNUNET_CRYPTO_rsa_public_key_free (denom_pubs[j]); GNUNET_CRYPTO_rsa_public_key_free (denom_pubs[j].rsa_public_key);
GNUNET_free (coin_melt_details); GNUNET_free (coin_melt_details);
GNUNET_free (denom_pubs); GNUNET_free (denom_pubs);
return TALER_MINT_reply_external_error (connection, return TALER_MINT_reply_external_error (connection,
@ -583,7 +586,7 @@ handle_refresh_melt_json (struct MHD_Connection *connection,
JNAV_INDEX, (int) j, JNAV_INDEX, (int) j,
JNAV_RET_DATA, JNAV_RET_DATA,
&commit_link[i][j].transfer_pub, &commit_link[i][j].transfer_pub,
sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); sizeof (struct TALER_TransferPublicKey));
if (GNUNET_OK != res) if (GNUNET_OK != res)
{ {
@ -596,7 +599,7 @@ handle_refresh_melt_json (struct MHD_Connection *connection,
GNUNET_CRYPTO_hash_context_read (hash_context, GNUNET_CRYPTO_hash_context_read (hash_context,
&commit_link[i][j].transfer_pub, &commit_link[i][j].transfer_pub,
sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); sizeof (struct TALER_TransferPublicKey));
res = GNUNET_MINT_parse_navigate_json (connection, res = GNUNET_MINT_parse_navigate_json (connection,
secret_encs, secret_encs,
@ -629,7 +632,7 @@ handle_refresh_melt_json (struct MHD_Connection *connection,
"sig", "sig",
JNAV_RET_DATA, JNAV_RET_DATA,
&commit_client_sig, &commit_client_sig,
sizeof (struct GNUNET_CRYPTO_EddsaSignature)); sizeof (struct TALER_SessionSignature));
if (GNUNET_OK != res) if (GNUNET_OK != res)
return (GNUNET_NO == res) ? MHD_YES : MHD_NO; return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
@ -667,14 +670,12 @@ handle_refresh_melt_json (struct MHD_Connection *connection,
free_commit_links (commit_link, kappa, num_oldcoins); free_commit_links (commit_link, kappa, num_oldcoins);
for (j=0;j<coin_count;j++) for (j=0;j<coin_count;j++)
{ {
GNUNET_CRYPTO_rsa_public_key_free (coin_public_infos[j].denom_pub); GNUNET_CRYPTO_rsa_public_key_free (coin_public_infos[j].denom_pub.rsa_public_key);
GNUNET_CRYPTO_rsa_signature_free (coin_public_infos[j].denom_sig); GNUNET_CRYPTO_rsa_signature_free (coin_public_infos[j].denom_sig.rsa_signature);
} }
GNUNET_free (coin_public_infos); GNUNET_free (coin_public_infos);
for (j=0;j<num_new_denoms;j++) for (j=0;j<num_new_denoms;j++)
{ GNUNET_CRYPTO_rsa_public_key_free (denom_pubs[j].rsa_public_key);
GNUNET_CRYPTO_rsa_public_key_free (denom_pubs[j]);
}
GNUNET_free (coin_melt_details); GNUNET_free (coin_melt_details);
GNUNET_free (denom_pubs); GNUNET_free (denom_pubs);
return res; return res;
@ -714,7 +715,7 @@ TALER_MINT_handler_refresh_melt (struct RequestHandler *rh,
unsigned int num_oldcoins; unsigned int num_oldcoins;
unsigned int num_newcoins; unsigned int num_newcoins;
json_t *coin_detail; json_t *coin_detail;
struct GNUNET_CRYPTO_EddsaPublicKey refresh_session_pub; struct TALER_SessionPublicKey refresh_session_pub;
int res; int res;
struct GNUNET_MINT_ParseFieldSpec spec[] = { struct GNUNET_MINT_ParseFieldSpec spec[] = {
TALER_MINT_PARSE_FIXED ("session_pub", &refresh_session_pub), TALER_MINT_PARSE_FIXED ("session_pub", &refresh_session_pub),
@ -819,19 +820,19 @@ TALER_MINT_handler_refresh_melt (struct RequestHandler *rh,
*/ */
static int static int
handle_refresh_reveal_json (struct MHD_Connection *connection, handle_refresh_reveal_json (struct MHD_Connection *connection,
const struct GNUNET_CRYPTO_EddsaPublicKey *refresh_session_pub, const struct TALER_SessionPublicKey *refresh_session_pub,
unsigned int kappa, unsigned int kappa,
unsigned int num_oldcoins, unsigned int num_oldcoins,
const json_t *tp_json) const json_t *tp_json)
{ {
struct GNUNET_CRYPTO_EcdsaPrivateKey *transfer_privs[kappa - 1]; struct TALER_TransferPrivateKey *transfer_privs[kappa - 1];
unsigned int i; unsigned int i;
unsigned int j; unsigned int j;
int res; int res;
for (i = 0; i < kappa - 1; i++) for (i = 0; i < kappa - 1; i++)
transfer_privs[i] = GNUNET_malloc (num_oldcoins * transfer_privs[i] = GNUNET_malloc (num_oldcoins *
sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)); sizeof (struct TALER_TransferPrivateKey));
res = GNUNET_OK; res = GNUNET_OK;
for (i = 0; i < kappa - 1; i++) for (i = 0; i < kappa - 1; i++)
{ {
@ -847,7 +848,7 @@ handle_refresh_reveal_json (struct MHD_Connection *connection,
JNAV_INDEX, (int) j, JNAV_INDEX, (int) j,
JNAV_RET_DATA, JNAV_RET_DATA,
&transfer_privs[i][j], &transfer_privs[i][j],
sizeof (struct GNUNET_CRYPTO_EddsaPrivateKey)); sizeof (struct TALER_TransferPrivateKey));
} }
} }
if (GNUNET_OK != res) if (GNUNET_OK != res)
@ -887,7 +888,7 @@ TALER_MINT_handler_refresh_reveal (struct RequestHandler *rh,
const char *upload_data, const char *upload_data,
size_t *upload_data_size) size_t *upload_data_size)
{ {
struct GNUNET_CRYPTO_EddsaPublicKey refresh_session_pub; struct TALER_SessionPublicKey refresh_session_pub;
int res; int res;
unsigned int kappa; unsigned int kappa;
unsigned int num_oldcoins; unsigned int num_oldcoins;
@ -966,13 +967,13 @@ TALER_MINT_handler_refresh_link (struct RequestHandler *rh,
const char *upload_data, const char *upload_data,
size_t *upload_data_size) size_t *upload_data_size)
{ {
struct GNUNET_CRYPTO_EcdsaPublicKey coin_pub; struct TALER_CoinSpendPublicKey coin_pub;
int res; int res;
res = TALER_MINT_mhd_request_arg_data (connection, res = TALER_MINT_mhd_request_arg_data (connection,
"coin_pub", "coin_pub",
&coin_pub, &coin_pub,
sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); sizeof (struct TALER_CoinSpendPublicKey));
if (GNUNET_SYSERR == res) if (GNUNET_SYSERR == res)
return MHD_NO; return MHD_NO;
if (GNUNET_OK != res) if (GNUNET_OK != res)

View File

@ -282,15 +282,15 @@ TALER_MINT_reply_invalid_json (struct MHD_Connection *connection)
*/ */
int int
TALER_MINT_reply_deposit_success (struct MHD_Connection *connection, TALER_MINT_reply_deposit_success (struct MHD_Connection *connection,
const struct GNUNET_CRYPTO_EcdsaPublicKey *coin_pub, const struct TALER_CoinSpendPublicKey *coin_pub,
const struct GNUNET_HashCode *h_wire, const struct GNUNET_HashCode *h_wire,
const struct GNUNET_HashCode *h_contract, const struct GNUNET_HashCode *h_contract,
uint64_t transaction_id, uint64_t transaction_id,
const struct GNUNET_CRYPTO_EddsaPublicKey *merchant, const struct TALER_MerchantPublicKey *merchant,
const struct TALER_Amount *amount) const struct TALER_Amount *amount)
{ {
struct TALER_DepositConfirmation dc; struct TALER_DepositConfirmation dc;
struct GNUNET_CRYPTO_EddsaSignature sig; struct TALER_MintSignature sig;
json_t *sig_json; json_t *sig_json;
int ret; int ret;
@ -305,7 +305,8 @@ TALER_MINT_reply_deposit_success (struct MHD_Connection *connection,
dc.merchant = *merchant; dc.merchant = *merchant;
TALER_MINT_keys_sign (&dc.purpose, TALER_MINT_keys_sign (&dc.purpose,
&sig); &sig);
sig_json = TALER_JSON_from_eddsa_sig (&dc.purpose, &sig); sig_json = TALER_JSON_from_eddsa_sig (&dc.purpose,
&sig.eddsa_signature);
ret = TALER_MINT_reply_json_pack (connection, ret = TALER_MINT_reply_json_pack (connection,
MHD_HTTP_OK, MHD_HTTP_OK,
"{s:s, s:o}", "{s:s, s:o}",
@ -351,7 +352,7 @@ compile_transaction_history (const struct TALER_MINT_DB_TransactionList *tl)
&deposit->amount_with_fee); &deposit->amount_with_fee);
dr.coin_pub = deposit->coin.coin_pub; dr.coin_pub = deposit->coin.coin_pub;
transaction = TALER_JSON_from_ecdsa_sig (&dr.purpose, transaction = TALER_JSON_from_ecdsa_sig (&dr.purpose,
&deposit->csig); &deposit->csig.ecdsa_signature);
break; break;
} }
case TALER_MINT_DB_TT_REFRESH_MELT: case TALER_MINT_DB_TT_REFRESH_MELT:
@ -368,7 +369,7 @@ compile_transaction_history (const struct TALER_MINT_DB_TransactionList *tl)
&melt->amount_with_fee); &melt->amount_with_fee);
ms.coin_pub = melt->coin.coin_pub; ms.coin_pub = melt->coin.coin_pub;
transaction = TALER_JSON_from_ecdsa_sig (&ms.purpose, transaction = TALER_JSON_from_ecdsa_sig (&ms.purpose,
&melt->coin_sig); &melt->coin_sig.ecdsa_signature);
} }
break; break;
case TALER_MINT_DB_TT_LOCK: case TALER_MINT_DB_TT_LOCK:
@ -480,7 +481,7 @@ compile_reserve_history (const struct ReserveHistory *rh,
case TALER_MINT_DB_RO_WITHDRAW_COIN: case TALER_MINT_DB_RO_WITHDRAW_COIN:
dki = TALER_MINT_get_denom_key (key_state, dki = TALER_MINT_get_denom_key (key_state,
pos->details.withdraw->denom_pub); &pos->details.withdraw->denom_pub);
TALER_amount_ntoh (&value, TALER_amount_ntoh (&value,
&dki->issue.value); &dki->issue.value);
if (0 == ret) if (0 == ret)
@ -499,12 +500,12 @@ compile_reserve_history (const struct ReserveHistory *rh,
wr.purpose.purpose = htonl (TALER_SIGNATURE_WITHDRAW); wr.purpose.purpose = htonl (TALER_SIGNATURE_WITHDRAW);
wr.purpose.size = htonl (sizeof (struct TALER_WithdrawRequest)); wr.purpose.size = htonl (sizeof (struct TALER_WithdrawRequest));
wr.reserve_pub = pos->details.withdraw->reserve_pub; wr.reserve_pub = pos->details.withdraw->reserve_pub;
GNUNET_CRYPTO_rsa_public_key_hash (pos->details.withdraw->denom_pub, GNUNET_CRYPTO_rsa_public_key_hash (pos->details.withdraw->denom_pub.rsa_public_key,
&wr.h_denomination_pub); &wr.h_denomination_pub);
wr.h_coin_envelope = pos->details.withdraw->h_coin_envelope; wr.h_coin_envelope = pos->details.withdraw->h_coin_envelope;
transaction = TALER_JSON_from_eddsa_sig (&wr.purpose, transaction = TALER_JSON_from_eddsa_sig (&wr.purpose,
&pos->details.withdraw->reserve_sig); &pos->details.withdraw->reserve_sig.eddsa_signature);
json_array_append_new (json_history, json_array_append_new (json_history,
json_pack ("{s:s, s:o, s:o}", json_pack ("{s:s, s:o, s:o}",
@ -613,7 +614,7 @@ TALER_MINT_reply_withdraw_sign_success (struct MHD_Connection *connection,
json_t *sig_json; json_t *sig_json;
int ret; int ret;
sig_json = TALER_JSON_from_rsa_signature (collectable->sig); sig_json = TALER_JSON_from_rsa_signature (collectable->sig.rsa_signature);
ret = TALER_MINT_reply_json_pack (connection, ret = TALER_MINT_reply_json_pack (connection,
MHD_HTTP_OK, MHD_HTTP_OK,
"{s:o}", "{s:o}",
@ -640,7 +641,7 @@ TALER_MINT_reply_withdraw_sign_success (struct MHD_Connection *connection,
*/ */
int int
TALER_MINT_reply_refresh_melt_insufficient_funds (struct MHD_Connection *connection, TALER_MINT_reply_refresh_melt_insufficient_funds (struct MHD_Connection *connection,
const struct GNUNET_CRYPTO_EcdsaPublicKey *coin_pub, const struct TALER_CoinSpendPublicKey *coin_pub,
struct TALER_Amount coin_value, struct TALER_Amount coin_value,
struct TALER_MINT_DB_TransactionList *tl, struct TALER_MINT_DB_TransactionList *tl,
struct TALER_Amount requested, struct TALER_Amount requested,
@ -654,7 +655,7 @@ TALER_MINT_reply_refresh_melt_insufficient_funds (struct MHD_Connection *connect
"{s:s, s:o, s:o, s:o, s:o, s:o}", "{s:s, s:o, s:o, s:o, s:o, s:o}",
"error", "insufficient funds", "error", "insufficient funds",
"coin-pub", TALER_JSON_from_data (coin_pub, "coin-pub", TALER_JSON_from_data (coin_pub,
sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)), sizeof (struct TALER_CoinSpendPublicKey)),
"original-value", TALER_JSON_from_amount (&coin_value), "original-value", TALER_JSON_from_amount (&coin_value),
"residual-value", TALER_JSON_from_amount (&residual), "residual-value", TALER_JSON_from_amount (&residual),
"requested-value", TALER_JSON_from_amount (&requested), "requested-value", TALER_JSON_from_amount (&requested),
@ -676,7 +677,7 @@ TALER_MINT_reply_refresh_melt_success (struct MHD_Connection *connection,
uint16_t noreveal_index) uint16_t noreveal_index)
{ {
struct RefreshMeltResponseSignatureBody body; struct RefreshMeltResponseSignatureBody body;
struct GNUNET_CRYPTO_EddsaSignature sig; struct TALER_MintSignature sig;
json_t *sig_json; json_t *sig_json;
int ret; int ret;
@ -687,7 +688,7 @@ TALER_MINT_reply_refresh_melt_success (struct MHD_Connection *connection,
TALER_MINT_keys_sign (&body.purpose, TALER_MINT_keys_sign (&body.purpose,
&sig); &sig);
sig_json = TALER_JSON_from_eddsa_sig (&body.purpose, sig_json = TALER_JSON_from_eddsa_sig (&body.purpose,
&sig); &sig.eddsa_signature);
GNUNET_assert (NULL != sig_json); GNUNET_assert (NULL != sig_json);
ret = TALER_MINT_reply_json_pack (connection, ret = TALER_MINT_reply_json_pack (connection,
MHD_HTTP_OK, MHD_HTTP_OK,
@ -710,7 +711,7 @@ TALER_MINT_reply_refresh_melt_success (struct MHD_Connection *connection,
int int
TALER_MINT_reply_refresh_reveal_success (struct MHD_Connection *connection, TALER_MINT_reply_refresh_reveal_success (struct MHD_Connection *connection,
unsigned int num_newcoins, unsigned int num_newcoins,
struct GNUNET_CRYPTO_rsa_Signature **sigs) const struct TALER_DenominationSignature *sigs)
{ {
int newcoin_index; int newcoin_index;
json_t *root; json_t *root;
@ -724,7 +725,7 @@ TALER_MINT_reply_refresh_reveal_success (struct MHD_Connection *connection,
list); list);
for (newcoin_index = 0; newcoin_index < num_newcoins; newcoin_index++) for (newcoin_index = 0; newcoin_index < num_newcoins; newcoin_index++)
json_array_append_new (list, json_array_append_new (list,
TALER_JSON_from_rsa_signature (sigs[newcoin_index])); TALER_JSON_from_rsa_signature (sigs[newcoin_index].rsa_signature));
ret = TALER_MINT_reply_json (connection, ret = TALER_MINT_reply_json (connection,
root, root,
MHD_HTTP_OK); MHD_HTTP_OK);
@ -777,7 +778,7 @@ TALER_MINT_reply_refresh_reveal_missmatch (struct MHD_Connection *connection,
*/ */
int int
TALER_MINT_reply_refresh_link_success (struct MHD_Connection *connection, TALER_MINT_reply_refresh_link_success (struct MHD_Connection *connection,
const struct GNUNET_CRYPTO_EcdsaPublicKey *transfer_pub, const struct TALER_TransferPublicKey *transfer_pub,
const struct TALER_EncryptedLinkSecret *shared_secret_enc, const struct TALER_EncryptedLinkSecret *shared_secret_enc,
const struct LinkDataList *ldl) const struct LinkDataList *ldl)
{ {
@ -794,14 +795,14 @@ TALER_MINT_reply_refresh_link_success (struct MHD_Connection *connection,
obj = json_object (); obj = json_object ();
json_object_set_new (obj, "link_enc", json_object_set_new (obj, "link_enc",
TALER_JSON_from_data (ldl->link_data_enc->coin_priv_enc, TALER_JSON_from_data (ldl->link_data_enc->coin_priv_enc,
sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey) + sizeof (struct TALER_CoinSpendPrivateKey) +
ldl->link_data_enc->blinding_key_enc_size)); ldl->link_data_enc->blinding_key_enc_size));
json_object_set_new (obj, json_object_set_new (obj,
"denom_pub", "denom_pub",
TALER_JSON_from_rsa_public_key (ldl->denom_pub)); TALER_JSON_from_rsa_public_key (ldl->denom_pub.rsa_public_key));
json_object_set_new (obj, json_object_set_new (obj,
"ev_sig", "ev_sig",
TALER_JSON_from_rsa_signature (ldl->ev_sig)); TALER_JSON_from_rsa_signature (ldl->ev_sig.rsa_signature));
json_array_append_new (list, obj); json_array_append_new (list, obj);
} }
@ -812,7 +813,7 @@ TALER_MINT_reply_refresh_link_success (struct MHD_Connection *connection,
json_object_set_new (root, json_object_set_new (root,
"transfer_pub", "transfer_pub",
TALER_JSON_from_data (transfer_pub, TALER_JSON_from_data (transfer_pub,
sizeof (struct GNUNET_CRYPTO_EddsaPublicKey))); sizeof (struct TALER_TransferPublicKey)));
json_object_set_new (root, json_object_set_new (root,
"secret_enc", "secret_enc",
TALER_JSON_from_data (shared_secret_enc, TALER_JSON_from_data (shared_secret_enc,

View File

@ -185,11 +185,11 @@ TALER_MINT_reply_invalid_json (struct MHD_Connection *connection);
*/ */
int int
TALER_MINT_reply_deposit_success (struct MHD_Connection *connection, TALER_MINT_reply_deposit_success (struct MHD_Connection *connection,
const struct GNUNET_CRYPTO_EcdsaPublicKey *coin_pub, const struct TALER_CoinSpendPublicKey *coin_pub,
const struct GNUNET_HashCode *h_wire, const struct GNUNET_HashCode *h_wire,
const struct GNUNET_HashCode *h_contract, const struct GNUNET_HashCode *h_contract,
uint64_t transaction_id, uint64_t transaction_id,
const struct GNUNET_CRYPTO_EddsaPublicKey *merchant, const struct TALER_MerchantPublicKey *merchant,
const struct TALER_Amount *amount); const struct TALER_Amount *amount);
@ -276,7 +276,7 @@ TALER_MINT_reply_refresh_melt_success (struct MHD_Connection *connection,
*/ */
int int
TALER_MINT_reply_refresh_melt_insufficient_funds (struct MHD_Connection *connection, TALER_MINT_reply_refresh_melt_insufficient_funds (struct MHD_Connection *connection,
const struct GNUNET_CRYPTO_EcdsaPublicKey *coin_pub, const struct TALER_CoinSpendPublicKey *coin_pub,
struct TALER_Amount coin_value, struct TALER_Amount coin_value,
struct TALER_MINT_DB_TransactionList *tl, struct TALER_MINT_DB_TransactionList *tl,
struct TALER_Amount requested, struct TALER_Amount requested,
@ -294,7 +294,7 @@ TALER_MINT_reply_refresh_melt_insufficient_funds (struct MHD_Connection *connect
int int
TALER_MINT_reply_refresh_reveal_success (struct MHD_Connection *connection, TALER_MINT_reply_refresh_reveal_success (struct MHD_Connection *connection,
unsigned int num_newcoins, unsigned int num_newcoins,
struct GNUNET_CRYPTO_rsa_Signature **sigs); const struct TALER_DenominationSignature *sigs);
/** /**
@ -332,7 +332,7 @@ TALER_MINT_reply_refresh_reveal_missmatch (struct MHD_Connection *connection,
*/ */
int int
TALER_MINT_reply_refresh_link_success (struct MHD_Connection *connection, TALER_MINT_reply_refresh_link_success (struct MHD_Connection *connection,
const struct GNUNET_CRYPTO_EcdsaPublicKey *transfer_pub, const struct TALER_TransferPublicKey *transfer_pub,
const struct TALER_EncryptedLinkSecret *shared_secret_enc, const struct TALER_EncryptedLinkSecret *shared_secret_enc,
const struct LinkDataList *ldl); const struct LinkDataList *ldl);

View File

@ -49,13 +49,13 @@ TALER_MINT_handler_withdraw_status (struct RequestHandler *rh,
const char *upload_data, const char *upload_data,
size_t *upload_data_size) size_t *upload_data_size)
{ {
struct GNUNET_CRYPTO_EddsaPublicKey reserve_pub; struct TALER_ReservePublicKey reserve_pub;
int res; int res;
res = TALER_MINT_mhd_request_arg_data (connection, res = TALER_MINT_mhd_request_arg_data (connection,
"reserve_pub", "reserve_pub",
&reserve_pub, &reserve_pub,
sizeof (struct GNUNET_CRYPTO_EddsaPublicKey)); sizeof (struct TALER_ReservePublicKey));
if (GNUNET_SYSERR == res) if (GNUNET_SYSERR == res)
return MHD_NO; /* internal error */ return MHD_NO; /* internal error */
if (GNUNET_NO == res) if (GNUNET_NO == res)
@ -90,17 +90,17 @@ TALER_MINT_handler_withdraw_sign (struct RequestHandler *rh,
{ {
struct TALER_WithdrawRequest wsrd; struct TALER_WithdrawRequest wsrd;
int res; int res;
struct GNUNET_CRYPTO_rsa_PublicKey *denomination_pub; struct TALER_DenominationPublicKey denomination_pub;
char *denomination_pub_data; char *denomination_pub_data;
size_t denomination_pub_data_size; size_t denomination_pub_data_size;
char *blinded_msg; char *blinded_msg;
size_t blinded_msg_len; size_t blinded_msg_len;
struct GNUNET_CRYPTO_EddsaSignature signature; struct TALER_ReserveSignature signature;
res = TALER_MINT_mhd_request_arg_data (connection, res = TALER_MINT_mhd_request_arg_data (connection,
"reserve_pub", "reserve_pub",
&wsrd.reserve_pub, &wsrd.reserve_pub,
sizeof (struct GNUNET_CRYPTO_EddsaPublicKey)); sizeof (struct TALER_ReservePublicKey));
if (GNUNET_SYSERR == res) if (GNUNET_SYSERR == res)
return MHD_NO; /* internal error */ return MHD_NO; /* internal error */
if (GNUNET_NO == res) if (GNUNET_NO == res)
@ -108,7 +108,7 @@ TALER_MINT_handler_withdraw_sign (struct RequestHandler *rh,
res = TALER_MINT_mhd_request_arg_data (connection, res = TALER_MINT_mhd_request_arg_data (connection,
"reserve_sig", "reserve_sig",
&signature, &signature,
sizeof (struct GNUNET_CRYPTO_EddsaSignature)); sizeof (struct TALER_ReserveSignature));
if (GNUNET_SYSERR == res) if (GNUNET_SYSERR == res)
return MHD_NO; /* internal error */ return MHD_NO; /* internal error */
if (GNUNET_NO == res) if (GNUNET_NO == res)
@ -148,8 +148,8 @@ TALER_MINT_handler_withdraw_sign (struct RequestHandler *rh,
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WITHDRAW, GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WITHDRAW,
&wsrd.purpose, &wsrd.purpose,
&signature, &signature.eddsa_signature,
&wsrd.reserve_pub)) &wsrd.reserve_pub.eddsa_pub))
{ {
LOG_WARNING ("Client supplied invalid signature for /withdraw/sign request\n"); LOG_WARNING ("Client supplied invalid signature for /withdraw/sign request\n");
GNUNET_free (denomination_pub_data); GNUNET_free (denomination_pub_data);
@ -157,10 +157,11 @@ TALER_MINT_handler_withdraw_sign (struct RequestHandler *rh,
return TALER_MINT_reply_arg_invalid (connection, return TALER_MINT_reply_arg_invalid (connection,
"reserve_sig"); "reserve_sig");
} }
denomination_pub = GNUNET_CRYPTO_rsa_public_key_decode (denomination_pub_data, denomination_pub.rsa_public_key
denomination_pub_data_size); = GNUNET_CRYPTO_rsa_public_key_decode (denomination_pub_data,
denomination_pub_data_size);
GNUNET_free (denomination_pub_data); GNUNET_free (denomination_pub_data);
if (NULL == denomination_pub) if (NULL == denomination_pub.rsa_public_key)
{ {
LOG_WARNING ("Client supplied ill-formed denomination public key for /withdraw/sign request\n"); LOG_WARNING ("Client supplied ill-formed denomination public key for /withdraw/sign request\n");
GNUNET_free (blinded_msg); GNUNET_free (blinded_msg);
@ -169,12 +170,12 @@ TALER_MINT_handler_withdraw_sign (struct RequestHandler *rh,
} }
res = TALER_MINT_db_execute_withdraw_sign (connection, res = TALER_MINT_db_execute_withdraw_sign (connection,
&wsrd.reserve_pub, &wsrd.reserve_pub,
denomination_pub, &denomination_pub,
blinded_msg, blinded_msg,
blinded_msg_len, blinded_msg_len,
&signature); &signature);
GNUNET_free (blinded_msg); GNUNET_free (blinded_msg);
GNUNET_CRYPTO_rsa_public_key_free (denomination_pub); GNUNET_CRYPTO_rsa_public_key_free (denomination_pub.rsa_public_key);
return res; return res;
} }

View File

@ -70,8 +70,8 @@ signkeys_iter (void *cls,
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_SIGNKEY, GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_SIGNKEY,
&ski->issue.purpose, &ski->issue.purpose,
&ski->issue.signature, &ski->issue.signature.eddsa_signature,
&ski->issue.master_pub)) &ski->issue.master_pub.eddsa_pub))
{ {
fprintf (stderr, fprintf (stderr,
"Signing key `%s' has invalid signature\n", "Signing key `%s' has invalid signature\n",
@ -130,15 +130,15 @@ denomkeys_iter (void *cls,
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_DENOM, GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_DENOM,
&dki->issue.purpose, &dki->issue.purpose,
&dki->issue.signature, &dki->issue.signature.eddsa_signature,
&dki->issue.master)) &dki->issue.master.eddsa_pub))
{ {
fprintf (stderr, fprintf (stderr,
"Denomination key for `%s' has invalid signature\n", "Denomination key for `%s' has invalid signature\n",
alias); alias);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
GNUNET_CRYPTO_rsa_public_key_hash (dki->denom_pub, 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.denom_hash,

View File

@ -179,12 +179,12 @@ static struct GNUNET_TIME_Absolute now;
/** /**
* Master private key of the mint. * Master private key of the mint.
*/ */
static struct GNUNET_CRYPTO_EddsaPrivateKey *master_priv; static struct TALER_MasterPrivateKey master_priv;
/** /**
* Master public key of the mint. * Master public key of the mint.
*/ */
static struct GNUNET_CRYPTO_EddsaPublicKey *master_pub; static struct TALER_MasterPublicKey master_pub;
/** /**
* Until what time do we provide keys? * Until what time do we provide keys?
@ -440,23 +440,23 @@ create_signkey_issue_priv (struct GNUNET_TIME_Absolute start,
struct TALER_MINT_SignKeyIssue *issue = &pi->issue; struct TALER_MINT_SignKeyIssue *issue = &pi->issue;
priv = GNUNET_CRYPTO_eddsa_key_create (); priv = GNUNET_CRYPTO_eddsa_key_create ();
pi->signkey_priv = *priv; pi->signkey_priv.eddsa_priv = *priv;
GNUNET_free (priv); GNUNET_free (priv);
issue->master_pub = *master_pub; issue->master_pub = master_pub;
issue->start = GNUNET_TIME_absolute_hton (start); issue->start = GNUNET_TIME_absolute_hton (start);
issue->expire = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_add (start, issue->expire = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_add (start,
duration)); duration));
GNUNET_CRYPTO_eddsa_key_get_public (&pi->signkey_priv, GNUNET_CRYPTO_eddsa_key_get_public (&pi->signkey_priv.eddsa_priv,
&issue->signkey_pub); &issue->signkey_pub.eddsa_pub);
issue->purpose.purpose = htonl (TALER_SIGNATURE_MASTER_SIGNKEY); issue->purpose.purpose = htonl (TALER_SIGNATURE_MASTER_SIGNKEY);
issue->purpose.size = htonl (sizeof (struct TALER_MINT_SignKeyIssue) - issue->purpose.size = htonl (sizeof (struct TALER_MINT_SignKeyIssue) -
offsetof (struct TALER_MINT_SignKeyIssue, offsetof (struct TALER_MINT_SignKeyIssue,
purpose)); purpose));
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
GNUNET_CRYPTO_eddsa_sign (master_priv, GNUNET_CRYPTO_eddsa_sign (&master_priv.eddsa_priv,
&issue->purpose, &issue->purpose,
&issue->signature)); &issue->signature.eddsa_signature));
} }
@ -678,12 +678,14 @@ static void
create_denomkey_issue (const struct CoinTypeParams *params, create_denomkey_issue (const struct CoinTypeParams *params,
struct TALER_MINT_DenomKeyIssuePriv *dki) struct TALER_MINT_DenomKeyIssuePriv *dki)
{ {
GNUNET_assert (NULL != dki->denom_priv.rsa_private_key
(dki->denom_priv = GNUNET_CRYPTO_rsa_private_key_create (params->rsa_keysize))); = GNUNET_CRYPTO_rsa_private_key_create (params->rsa_keysize);
dki->denom_pub = GNUNET_CRYPTO_rsa_private_key_get_public (dki->denom_priv); GNUNET_assert (NULL != dki->denom_priv.rsa_private_key);
GNUNET_CRYPTO_rsa_public_key_hash (dki->denom_pub, dki->denom_pub.rsa_public_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,
&dki->issue.denom_hash); &dki->issue.denom_hash);
dki->issue.master = *master_pub; dki->issue.master = master_pub;
dki->issue.start = GNUNET_TIME_absolute_hton (params->anchor); dki->issue.start = GNUNET_TIME_absolute_hton (params->anchor);
dki->issue.expire_withdraw = dki->issue.expire_withdraw =
GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_add (params->anchor, GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_add (params->anchor,
@ -704,9 +706,9 @@ create_denomkey_issue (const struct CoinTypeParams *params,
offsetof (struct TALER_MINT_DenomKeyIssuePriv, offsetof (struct TALER_MINT_DenomKeyIssuePriv,
issue.purpose)); issue.purpose));
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
GNUNET_CRYPTO_eddsa_sign (master_priv, GNUNET_CRYPTO_eddsa_sign (&master_priv.eddsa_priv,
&dki->issue.purpose, &dki->issue.purpose,
&dki->issue.signature)); &dki->issue.signature.eddsa_signature));
} }
@ -764,10 +766,10 @@ mint_keys_update_cointype (void *cls,
"Failed to write denomination key information to file `%s'.\n", "Failed to write denomination key information to file `%s'.\n",
dkf); dkf);
*ret = GNUNET_SYSERR; *ret = GNUNET_SYSERR;
GNUNET_CRYPTO_rsa_private_key_free (denomkey_issue.denom_priv); GNUNET_CRYPTO_rsa_private_key_free (denomkey_issue.denom_priv.rsa_private_key);
return; return;
} }
GNUNET_CRYPTO_rsa_private_key_free (denomkey_issue.denom_priv); GNUNET_CRYPTO_rsa_private_key_free (denomkey_issue.denom_priv.rsa_private_key);
p.anchor = GNUNET_TIME_absolute_add (p.anchor, p.anchor = GNUNET_TIME_absolute_add (p.anchor,
p.duration_spend); p.duration_spend);
p.anchor = GNUNET_TIME_absolute_subtract (p.anchor, p.anchor = GNUNET_TIME_absolute_subtract (p.anchor,
@ -825,6 +827,7 @@ main (int argc,
GNUNET_GETOPT_OPTION_END GNUNET_GETOPT_OPTION_END
}; };
struct GNUNET_TIME_Relative lookahead_sign; struct GNUNET_TIME_Relative lookahead_sign;
struct GNUNET_CRYPTO_EddsaPrivateKey *eddsa_priv;
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
GNUNET_log_setup ("taler-mint-keyup", GNUNET_log_setup ("taler-mint-keyup",
@ -872,18 +875,18 @@ main (int argc,
"Master key file not given\n"); "Master key file not given\n");
return 1; return 1;
} }
master_priv = GNUNET_CRYPTO_eddsa_key_create_from_file (masterkeyfile); eddsa_priv = GNUNET_CRYPTO_eddsa_key_create_from_file (masterkeyfile);
if (NULL == master_priv) if (NULL == eddsa_priv)
{ {
fprintf (stderr, fprintf (stderr,
"Failed to initialize master key from file `%s'\n", "Failed to initialize master key from file `%s'\n",
masterkeyfile); masterkeyfile);
return 1; return 1;
} }
master_priv.eddsa_priv = *eddsa_priv;
master_pub = GNUNET_new (struct GNUNET_CRYPTO_EddsaPublicKey); GNUNET_free (eddsa_priv);
GNUNET_CRYPTO_eddsa_key_get_public (master_priv, GNUNET_CRYPTO_eddsa_key_get_public (&master_priv.eddsa_priv,
master_pub); &master_pub.eddsa_pub);
/* check if key from file matches the one from the configuration */ /* check if key from file matches the one from the configuration */
{ {
@ -902,7 +905,7 @@ main (int argc,
return 1; return 1;
} }
if (0 != if (0 !=
memcmp (master_pub, memcmp (&master_pub,
&master_pub_from_cfg, &master_pub_from_cfg,
sizeof (struct GNUNET_CRYPTO_EddsaPublicKey))) sizeof (struct GNUNET_CRYPTO_EddsaPublicKey)))
{ {

View File

@ -35,7 +35,7 @@ struct BankTransfer
/** /**
* Public key of the reserve that was filled. * Public key of the reserve that was filled.
*/ */
struct GNUNET_CRYPTO_EddsaPublicKey reserve_pub; struct TALER_ReservePublicKey reserve_pub;
/** /**
* Amount that was transferred to the mint. * Amount that was transferred to the mint.
@ -58,7 +58,7 @@ struct Reserve
/** /**
* The reserve's public key. This uniquely identifies the reserve * The reserve's public key. This uniquely identifies the reserve
*/ */
struct GNUNET_CRYPTO_EddsaPublicKey *pub; struct TALER_ReservePublicKey pub;
/** /**
* The balance amount existing in the reserve * The balance amount existing in the reserve
@ -83,7 +83,7 @@ struct CollectableBlindcoin
/** /**
* Our signature over the (blinded) coin. * Our signature over the (blinded) coin.
*/ */
struct GNUNET_CRYPTO_rsa_Signature *sig; struct TALER_DenominationSignature sig;
/** /**
* Denomination key (which coin was generated). * Denomination key (which coin was generated).
@ -91,12 +91,12 @@ struct CollectableBlindcoin
* AMOUNT *including* fee in what is being signed * AMOUNT *including* fee in what is being signed
* as well! * as well!
*/ */
struct GNUNET_CRYPTO_rsa_PublicKey *denom_pub; struct TALER_DenominationPublicKey denom_pub;
/** /**
* Public key of the reserve that was drained. * Public key of the reserve that was drained.
*/ */
struct GNUNET_CRYPTO_EddsaPublicKey reserve_pub; struct TALER_ReservePublicKey reserve_pub;
/** /**
* Hash over the blinded message, needed to verify * Hash over the blinded message, needed to verify
@ -108,7 +108,7 @@ struct CollectableBlindcoin
* Signature confirming the withdrawl, matching @e reserve_pub, * Signature confirming the withdrawl, matching @e reserve_pub,
* @e denom_pub and @e h_coin_envelope. * @e denom_pub and @e h_coin_envelope.
*/ */
struct GNUNET_CRYPTO_EddsaSignature reserve_sig; struct TALER_ReserveSignature reserve_sig;
}; };
@ -186,13 +186,13 @@ struct Deposit
* by @e h_wire in relation to the contract identified * by @e h_wire in relation to the contract identified
* by @e h_contract. * by @e h_contract.
*/ */
struct GNUNET_CRYPTO_EcdsaSignature csig; struct TALER_CoinSpendSignature csig;
/** /**
* Public key of the merchant. Enables later identification * Public key of the merchant. Enables later identification
* of the merchant in case of a need to rollback transactions. * of the merchant in case of a need to rollback transactions.
*/ */
struct GNUNET_CRYPTO_EddsaPublicKey merchant_pub; struct TALER_MerchantPublicKey merchant_pub;
/** /**
* Hash over the contract between merchant and customer * Hash over the contract between merchant and customer
@ -238,8 +238,10 @@ struct RefreshSession
/** /**
* Signature over the commitments by the client, * Signature over the commitments by the client,
* only valid if @e has_commit_sig is set. * only valid if @e has_commit_sig is set.
*
* FIXME: The above comment is clearly confused.
*/ */
struct GNUNET_CRYPTO_EddsaSignature commit_sig; struct TALER_SessionSignature commit_sig;
/** /**
* Hash over coins to melt and coins to create of the * Hash over coins to melt and coins to create of the
@ -250,7 +252,7 @@ struct RefreshSession
/** /**
* Signature over the melt by the client. * Signature over the melt by the client.
*/ */
struct GNUNET_CRYPTO_EddsaSignature melt_sig; struct TALER_SessionSignature melt_sig;
/** /**
* Number of coins we are melting. * Number of coins we are melting.
@ -291,7 +293,7 @@ struct RefreshMelt
/** /**
* Signature over the melting operation. * Signature over the melting operation.
*/ */
struct GNUNET_CRYPTO_EcdsaSignature coin_sig; struct TALER_CoinSpendSignature coin_sig;
/** /**
* Which melting operation should the coin become a part of. * Which melting operation should the coin become a part of.
@ -350,7 +352,7 @@ struct RefreshCommitLink
/** /**
* Transfer public key (FIXME: explain!) * Transfer public key (FIXME: explain!)
*/ */
struct GNUNET_CRYPTO_EcdsaPublicKey transfer_pub; struct TALER_TransferPublicKey transfer_pub;
/** /**
* Encrypted shared secret to decrypt the link. * Encrypted shared secret to decrypt the link.
@ -378,12 +380,12 @@ struct LinkDataList
/** /**
* Denomination public key, determines the value of the coin. * Denomination public key, determines the value of the coin.
*/ */
struct GNUNET_CRYPTO_rsa_PublicKey *denom_pub; struct TALER_DenominationPublicKey denom_pub;
/** /**
* Signature over the blinded envelope. * Signature over the blinded envelope.
*/ */
struct GNUNET_CRYPTO_rsa_Signature *ev_sig; struct TALER_DenominationSignature ev_sig;
}; };
@ -393,14 +395,14 @@ struct LinkDataList
struct Lock struct Lock
{ {
/** /**
* Information about the coin that is being melted. * Information about the coin that is being locked.
*/ */
struct TALER_CoinPublicInfo coin; struct TALER_CoinPublicInfo coin;
/** /**
* Signature over the melting operation. * Signature over the locking operation.
*/ */
const struct GNUNET_CRYPTO_EcdsaSignature coin_sig; struct TALER_CoinSpendSignature coin_sig;
/** /**
* How much value is being locked? * How much value is being locked?
@ -535,35 +537,35 @@ struct TALER_MINTDB_Plugin
* Start a transaction. * Start a transaction.
* *
* @param cls the @e cls of this struct with the plugin-specific state * @param cls the @e cls of this struct with the plugin-specific state
* @param db_conn connection to use * @param sesssion connection to use
* @return #GNUNET_OK on success * @return #GNUNET_OK on success
*/ */
int int
(*start) (void *cls, (*start) (void *cls,
struct TALER_MINTDB_Session *db_conn); struct TALER_MINTDB_Session *sesssion);
/** /**
* Commit a transaction. * Commit a transaction.
* *
* @param cls the @e cls of this struct with the plugin-specific state * @param cls the @e cls of this struct with the plugin-specific state
* @param db_conn connection to use * @param sesssion connection to use
* @return #GNUNET_OK on success * @return #GNUNET_OK on success
*/ */
int int
(*commit) (void *cls, (*commit) (void *cls,
struct TALER_MINTDB_Session *db_conn); struct TALER_MINTDB_Session *sesssion);
/** /**
* Abort/rollback a transaction. * Abort/rollback a transaction.
* *
* @param cls the @e cls of this struct with the plugin-specific state * @param cls the @e cls of this struct with the plugin-specific state
* @param db_conn connection to use * @param sesssion connection to use
*/ */
void void
(*rollback) (void *cls, (*rollback) (void *cls,
struct TALER_MINTDB_Session *db_conn); struct TALER_MINTDB_Session *sesssion);
/** /**
@ -611,7 +613,7 @@ struct TALER_MINTDB_Plugin
* key of the hash of the blinded message. * key of the hash of the blinded message.
* *
* @param cls the @e cls of this struct with the plugin-specific state * @param cls the @e cls of this struct with the plugin-specific state
* @param db_conn database connection to use * @param sesssion database connection to use
* @param h_blind hash of the blinded message * @param h_blind hash of the blinded message
* @param collectable corresponding collectable coin (blind signature) * @param collectable corresponding collectable coin (blind signature)
* if a coin is found * if a coin is found
@ -621,7 +623,7 @@ struct TALER_MINTDB_Plugin
*/ */
int int
(*get_collectable_blindcoin) (void *cls, (*get_collectable_blindcoin) (void *cls,
struct TALER_MINTDB_Session *db_conn, struct TALER_MINTDB_Session *sesssion,
const struct GNUNET_HashCode *h_blind, const struct GNUNET_HashCode *h_blind,
struct CollectableBlindcoin *collectable); struct CollectableBlindcoin *collectable);
@ -631,7 +633,7 @@ struct TALER_MINTDB_Plugin
* hash of the blinded message. * hash of the blinded message.
* *
* @param cls the @e cls of this struct with the plugin-specific state * @param cls the @e cls of this struct with the plugin-specific state
* @param db_conn database connection to use * @param sesssion database connection to use
* @param h_blind hash of the blinded message * @param h_blind hash of the blinded message
* @param withdraw amount by which the reserve will be withdrawn with this * @param withdraw amount by which the reserve will be withdrawn with this
* transaction * transaction
@ -643,7 +645,7 @@ struct TALER_MINTDB_Plugin
*/ */
int int
(*insert_collectable_blindcoin) (void *cls, (*insert_collectable_blindcoin) (void *cls,
struct TALER_MINTDB_Session *db_conn, struct TALER_MINTDB_Session *sesssion,
const struct GNUNET_HashCode *h_blind, const struct GNUNET_HashCode *h_blind,
struct TALER_Amount withdraw, struct TALER_Amount withdraw,
const struct CollectableBlindcoin *collectable); const struct CollectableBlindcoin *collectable);
@ -654,14 +656,14 @@ struct TALER_MINTDB_Plugin
* reserve. * reserve.
* *
* @param cls the @e cls of this struct with the plugin-specific state * @param cls the @e cls of this struct with the plugin-specific state
* @param db_conn connection to use * @param sesssion connection to use
* @param reserve_pub public key of the reserve * @param reserve_pub public key of the reserve
* @return known transaction history (NULL if reserve is unknown) * @return known transaction history (NULL if reserve is unknown)
*/ */
struct ReserveHistory * struct ReserveHistory *
(*get_reserve_history) (void *cls, (*get_reserve_history) (void *cls,
struct TALER_MINTDB_Session *db_conn, struct TALER_MINTDB_Session *sesssion,
const struct GNUNET_CRYPTO_EddsaPublicKey *reserve_pub); const struct TALER_ReservePublicKey *reserve_pub);
/** /**
@ -679,7 +681,7 @@ struct TALER_MINTDB_Plugin
* Check if we have the specified deposit already in the database. * Check if we have the specified deposit already in the database.
* *
* @param cls the @e cls of this struct with the plugin-specific state * @param cls the @e cls of this struct with the plugin-specific state
* @param db_conn database connection * @param sesssion database connection
* @param deposit deposit to search for * @param deposit deposit to search for
* @return #GNUNET_YES if we know this operation, * @return #GNUNET_YES if we know this operation,
* #GNUNET_NO if this deposit is unknown to us, * #GNUNET_NO if this deposit is unknown to us,
@ -687,7 +689,7 @@ struct TALER_MINTDB_Plugin
*/ */
int int
(*have_deposit) (void *cls, (*have_deposit) (void *cls,
struct TALER_MINTDB_Session *db_conn, struct TALER_MINTDB_Session *sesssion,
const struct Deposit *deposit); const struct Deposit *deposit);
@ -696,13 +698,13 @@ struct TALER_MINTDB_Plugin
* database. * database.
* *
* @param cls the @e cls of this struct with the plugin-specific state * @param cls the @e cls of this struct with the plugin-specific state
* @param db_conn connection to the database * @param sesssion connection to the database
* @param deposit deposit information to store * @param deposit deposit information to store
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/ */
int int
(*insert_deposit) (void *cls, (*insert_deposit) (void *cls,
struct TALER_MINTDB_Session *db_conn, struct TALER_MINTDB_Session *sesssion,
const struct Deposit *deposit); const struct Deposit *deposit);
@ -710,7 +712,7 @@ struct TALER_MINTDB_Plugin
* Lookup refresh session data under the given public key. * Lookup refresh session data under the given public key.
* *
* @param cls the @e cls of this struct with the plugin-specific state * @param cls the @e cls of this struct with the plugin-specific state
* @param db_conn database handle to use * @param sesssion database handle to use
* @param refresh_session_pub public key to use for the lookup * @param refresh_session_pub public key to use for the lookup
* @param refresh_session[OUT] where to store the result * @param refresh_session[OUT] where to store the result
* @return #GNUNET_YES on success, * @return #GNUNET_YES on success,
@ -719,8 +721,8 @@ struct TALER_MINTDB_Plugin
*/ */
int int
(*get_refresh_session) (void *cls, (*get_refresh_session) (void *cls,
struct TALER_MINTDB_Session *db_conn, struct TALER_MINTDB_Session *sesssion,
const struct GNUNET_CRYPTO_EddsaPublicKey *refresh_session_pub, const struct TALER_SessionPublicKey *refresh_session_pub,
struct RefreshSession *refresh_session); struct RefreshSession *refresh_session);
@ -728,7 +730,7 @@ struct TALER_MINTDB_Plugin
* Store new refresh session data under the given public key. * Store new refresh session data under the given public key.
* *
* @param cls the @e cls of this struct with the plugin-specific state * @param cls the @e cls of this struct with the plugin-specific state
* @param db_conn database handle to use * @param sesssion database handle to use
* @param refresh_session_pub public key to use to locate the session * @param refresh_session_pub public key to use to locate the session
* @param refresh_session session data to store * @param refresh_session session data to store
* @return #GNUNET_YES on success, * @return #GNUNET_YES on success,
@ -736,8 +738,8 @@ struct TALER_MINTDB_Plugin
*/ */
int int
(*create_refresh_session) (void *cls, (*create_refresh_session) (void *cls,
struct TALER_MINTDB_Session *db_conn, struct TALER_MINTDB_Session *sesssion,
const struct GNUNET_CRYPTO_EddsaPublicKey *session_pub, const struct TALER_SessionPublicKey *session_pub,
const struct RefreshSession *refresh_session); const struct RefreshSession *refresh_session);
@ -746,7 +748,7 @@ struct TALER_MINTDB_Plugin
* Store the given /refresh/melt request in the database. * Store the given /refresh/melt request in the database.
* *
* @param cls the @e cls of this struct with the plugin-specific state * @param cls the @e cls of this struct with the plugin-specific state
* @param db_conn database connection * @param sesssion database connection
* @param refresh_session session key of the melt operation * @param refresh_session session key of the melt operation
* @param oldcoin_index index of the coin to store * @param oldcoin_index index of the coin to store
* @param melt coin melt operation details to store * @param melt coin melt operation details to store
@ -755,8 +757,8 @@ struct TALER_MINTDB_Plugin
*/ */
int int
(*insert_refresh_melt) (void *cls, (*insert_refresh_melt) (void *cls,
struct TALER_MINTDB_Session *db_conn, struct TALER_MINTDB_Session *sesssion,
const struct GNUNET_CRYPTO_EddsaPublicKey *refresh_session, const struct TALER_SessionPublicKey *refresh_session,
uint16_t oldcoin_index, uint16_t oldcoin_index,
const struct RefreshMelt *melt); const struct RefreshMelt *melt);
@ -765,7 +767,7 @@ struct TALER_MINTDB_Plugin
* Get information about melted coin details from the database. * Get information about melted coin details from the database.
* *
* @param cls the @e cls of this struct with the plugin-specific state * @param cls the @e cls of this struct with the plugin-specific state
* @param db_conn database connection * @param sesssion database connection
* @param refresh_session session key of the melt operation * @param refresh_session session key of the melt operation
* @param oldcoin_index index of the coin to retrieve * @param oldcoin_index index of the coin to retrieve
* @param melt melt data to fill in * @param melt melt data to fill in
@ -774,8 +776,8 @@ struct TALER_MINTDB_Plugin
*/ */
int int
(*get_refresh_melt) (void *cls, (*get_refresh_melt) (void *cls,
struct TALER_MINTDB_Session *db_conn, struct TALER_MINTDB_Session *sesssion,
const struct GNUNET_CRYPTO_EddsaPublicKey *refresh_session, const struct TALER_SessionPublicKey *refresh_session,
uint16_t oldcoin_index, uint16_t oldcoin_index,
struct RefreshMelt *melt); struct RefreshMelt *melt);
@ -785,7 +787,7 @@ struct TALER_MINTDB_Plugin
* in a given refresh operation. * in a given refresh operation.
* *
* @param cls the @e cls of this struct with the plugin-specific state * @param cls the @e cls of this struct with the plugin-specific state
* @param db_conn database connection * @param sesssion database connection
* @param session_pub refresh session key * @param session_pub refresh session key
* @param num_newcoins number of coins to generate, size of the @a denom_pubs array * @param num_newcoins number of coins to generate, size of the @a denom_pubs array
* @param denom_pubs array denominations of the coins to create * @param denom_pubs array denominations of the coins to create
@ -794,10 +796,10 @@ struct TALER_MINTDB_Plugin
*/ */
int int
(*insert_refresh_order) (void *cls, (*insert_refresh_order) (void *cls,
struct TALER_MINTDB_Session *db_conn, struct TALER_MINTDB_Session *sesssion,
const struct GNUNET_CRYPTO_EddsaPublicKey *session_pub, const struct TALER_SessionPublicKey *session_pub,
uint16_t num_newcoins, uint16_t num_newcoins,
struct GNUNET_CRYPTO_rsa_PublicKey *const*denom_pubs); const struct TALER_DenominationPublicKey *denom_pubs);
/** /**
@ -805,7 +807,7 @@ struct TALER_MINTDB_Plugin
* create in the given refresh operation. * create in the given refresh operation.
* *
* @param cls the @e cls of this struct with the plugin-specific state * @param cls the @e cls of this struct with the plugin-specific state
* @param db_conn database connection * @param sesssion database connection
* @param session_pub refresh session key * @param session_pub refresh session key
* @param num_newcoins size of the @a denom_pubs array * @param num_newcoins size of the @a denom_pubs array
* @param denom_pubs[OUT] where to write @a num_newcoins denomination keys * @param denom_pubs[OUT] where to write @a num_newcoins denomination keys
@ -814,10 +816,10 @@ struct TALER_MINTDB_Plugin
*/ */
int int
(*get_refresh_order) (void *cls, (*get_refresh_order) (void *cls,
struct TALER_MINTDB_Session *db_conn, struct TALER_MINTDB_Session *sesssion,
const struct GNUNET_CRYPTO_EddsaPublicKey *session_pub, const struct TALER_SessionPublicKey *session_pub,
uint16_t num_newcoins, uint16_t num_newcoins,
struct GNUNET_CRYPTO_rsa_PublicKey **denom_pubs); struct TALER_DenominationPublicKey *denom_pubs);
/** /**
@ -825,7 +827,7 @@ struct TALER_MINTDB_Plugin
* for the given refresh session in the database. * for the given refresh session in the database.
* *
* @param cls the @e cls of this struct with the plugin-specific state * @param cls the @e cls of this struct with the plugin-specific state
* @param db_conn database connection to use * @param sesssion database connection to use
* @param refresh_session_pub refresh session this commitment belongs to * @param refresh_session_pub refresh session this commitment belongs to
* @param i set index (1st dimension), relating to kappa * @param i set index (1st dimension), relating to kappa
* @param num_newcoins coin index size of the @a commit_coins array * @param num_newcoins coin index size of the @a commit_coins array
@ -835,8 +837,8 @@ struct TALER_MINTDB_Plugin
*/ */
int int
(*insert_refresh_commit_coins) (void *cls, (*insert_refresh_commit_coins) (void *cls,
struct TALER_MINTDB_Session *db_conn, struct TALER_MINTDB_Session *sesssion,
const struct GNUNET_CRYPTO_EddsaPublicKey *refresh_session_pub, const struct TALER_SessionPublicKey *refresh_session_pub,
unsigned int i, unsigned int i,
unsigned int num_newcoins, unsigned int num_newcoins,
const struct RefreshCommitCoin *commit_coins); const struct RefreshCommitCoin *commit_coins);
@ -847,22 +849,22 @@ struct TALER_MINTDB_Plugin
* given coin of the given refresh session from the database. * given coin of the given refresh session from the database.
* *
* @param cls the @e cls of this struct with the plugin-specific state * @param cls the @e cls of this struct with the plugin-specific state
* @param db_conn database connection to use * @param sesssion database connection to use
* @param refresh_session_pub refresh session the commitment belongs to * @param refresh_session_pub refresh session the commitment belongs to
* @param i set index (1st dimension) * @param i set index (1st dimension)
* @param j coin index (2nd dimension), corresponds to refreshed (new) coins * @param num_coins size of the @a commit_coins array
* @param commit_coin[OUT] coin commitment to return * @param commit_coin[OUT] array of coin commitments to return
* @return #GNUNET_OK on success * @return #GNUNET_OK on success
* #GNUNET_NO if not found * #GNUNET_NO if not found
* #GNUNET_SYSERR on error * #GNUNET_SYSERR on error
*/ */
int int
(*get_refresh_commit_coins) (void *cls, (*get_refresh_commit_coins) (void *cls,
struct TALER_MINTDB_Session *db_conn, struct TALER_MINTDB_Session *sesssion,
const struct GNUNET_CRYPTO_EddsaPublicKey *refresh_session_pub, const struct TALER_SessionPublicKey *refresh_session_pub,
unsigned int i, unsigned int i,
unsigned int j, unsigned int num_coins,
struct RefreshCommitCoin *commit_coin); struct RefreshCommitCoin *commit_coins);
/** /**
@ -870,7 +872,7 @@ struct TALER_MINTDB_Plugin
* for the given refresh session. * for the given refresh session.
* *
* @param cls the @e cls of this struct with the plugin-specific state * @param cls the @e cls of this struct with the plugin-specific state
* @param db_conn database connection to use * @param sesssion database connection to use
* @param refresh_session_pub public key of the refresh session this * @param refresh_session_pub public key of the refresh session this
* commitment belongs with * commitment belongs with
* @param i set index (1st dimension), relating to kappa * @param i set index (1st dimension), relating to kappa
@ -880,8 +882,8 @@ struct TALER_MINTDB_Plugin
*/ */
int int
(*insert_refresh_commit_links) (void *cls, (*insert_refresh_commit_links) (void *cls,
struct TALER_MINTDB_Session *db_conn, struct TALER_MINTDB_Session *sesssion,
const struct GNUNET_CRYPTO_EddsaPublicKey *refresh_session_pub, const struct TALER_SessionPublicKey *refresh_session_pub,
unsigned int i, unsigned int i,
unsigned int num_links, unsigned int num_links,
const struct RefreshCommitLink *commit_links); const struct RefreshCommitLink *commit_links);
@ -891,7 +893,7 @@ struct TALER_MINTDB_Plugin
* for the given refresh session. * for the given refresh session.
* *
* @param cls the @e cls of this struct with the plugin-specific state * @param cls the @e cls of this struct with the plugin-specific state
* @param db_conn database connection to use * @param sesssion database connection to use
* @param refresh_session_pub public key of the refresh session this * @param refresh_session_pub public key of the refresh session this
* commitment belongs with * commitment belongs with
* @param i set index (1st dimension) * @param i set index (1st dimension)
@ -903,10 +905,10 @@ struct TALER_MINTDB_Plugin
*/ */
int int
(*get_refresh_commit_links) (void *cls, (*get_refresh_commit_links) (void *cls,
struct TALER_MINTDB_Session *db_conn, struct TALER_MINTDB_Session *sesssion,
const struct GNUNET_CRYPTO_EddsaPublicKey *refresh_session_pub, const struct TALER_SessionPublicKey *refresh_session_pub,
unsigned int i, unsigned int i,
unsigned int j, unsigned int num_links,
struct RefreshCommitLink *links); struct RefreshCommitLink *links);
@ -917,7 +919,7 @@ struct TALER_MINTDB_Plugin
* be used to try to obtain the private keys during "/refresh/link". * be used to try to obtain the private keys during "/refresh/link".
* *
* @param cls the @e cls of this struct with the plugin-specific state * @param cls the @e cls of this struct with the plugin-specific state
* @param db_conn database connection * @param sesssion database connection
* @param session_pub refresh session * @param session_pub refresh session
* @param newcoin_index coin index * @param newcoin_index coin index
* @param ev_sig coin signature * @param ev_sig coin signature
@ -925,10 +927,10 @@ struct TALER_MINTDB_Plugin
*/ */
int int
(*insert_refresh_collectable) (void *cls, (*insert_refresh_collectable) (void *cls,
struct TALER_MINTDB_Session *db_conn, struct TALER_MINTDB_Session *sesssion,
const struct GNUNET_CRYPTO_EddsaPublicKey *session_pub, const struct TALER_SessionPublicKey *session_pub,
uint16_t newcoin_index, uint16_t newcoin_index,
const struct GNUNET_CRYPTO_rsa_Signature *ev_sig); const struct TALER_DenominationSignature *ev_sig);
/** /**
@ -936,14 +938,14 @@ struct TALER_MINTDB_Plugin
* information, the denomination keys and the signatures. * information, the denomination keys and the signatures.
* *
* @param cls the @e cls of this struct with the plugin-specific state * @param cls the @e cls of this struct with the plugin-specific state
* @param db_conn database connection * @param sesssion database connection
* @param coin_pub public key to use to retrieve linkage data * @param coin_pub public key to use to retrieve linkage data
* @return all known link data for the coin * @return all known link data for the coin
*/ */
struct LinkDataList * struct LinkDataList *
(*get_link_data_list) (void *cls, (*get_link_data_list) (void *cls,
struct TALER_MINTDB_Session *db_conn, struct TALER_MINTDB_Session *sesssion,
const struct GNUNET_CRYPTO_EcdsaPublicKey *coin_pub); const struct TALER_CoinSpendPublicKey *coin_pub);
/** /**
@ -965,7 +967,7 @@ struct TALER_MINTDB_Plugin
* *
* *
* @param cls the @e cls of this struct with the plugin-specific state * @param cls the @e cls of this struct with the plugin-specific state
* @param db_conn database connection * @param sesssion database connection
* @param coin_pub public key of the coin * @param coin_pub public key of the coin
* @param transfer_pub[OUT] public transfer key * @param transfer_pub[OUT] public transfer key
* @param shared_secret_enc[OUT] set to shared secret * @param shared_secret_enc[OUT] set to shared secret
@ -975,9 +977,9 @@ struct TALER_MINTDB_Plugin
*/ */
int int
(*get_transfer) (void *cls, (*get_transfer) (void *cls,
struct TALER_MINTDB_Session *db_conn, struct TALER_MINTDB_Session *sesssion,
const struct GNUNET_CRYPTO_EcdsaPublicKey *coin_pub, const struct TALER_CoinSpendPublicKey *coin_pub,
struct GNUNET_CRYPTO_EcdsaPublicKey *transfer_pub, struct TALER_TransferPublicKey *transfer_pub,
struct TALER_EncryptedLinkSecret *shared_secret_enc); struct TALER_EncryptedLinkSecret *shared_secret_enc);
@ -985,7 +987,7 @@ struct TALER_MINTDB_Plugin
* Test if the given /lock request is known to us. * Test if the given /lock request is known to us.
* *
* @param cls the @e cls of this struct with the plugin-specific state * @param cls the @e cls of this struct with the plugin-specific state
* @param db_conn database connection * @param sesssion database connection
* @param lock lock operation * @param lock lock operation
* @return #GNUNET_YES if known, * @return #GNUNET_YES if known,
* #GNUENT_NO if not, * #GNUENT_NO if not,
@ -993,7 +995,7 @@ struct TALER_MINTDB_Plugin
*/ */
int int
(*have_lock) (void *cls, (*have_lock) (void *cls,
struct TALER_MINTDB_Session *db_conn, struct TALER_MINTDB_Session *sesssion,
const struct Lock *lock); const struct Lock *lock);
@ -1001,14 +1003,14 @@ struct TALER_MINTDB_Plugin
* Store the given /lock request in the database. * Store the given /lock request in the database.
* *
* @param cls the @e cls of this struct with the plugin-specific state * @param cls the @e cls of this struct with the plugin-specific state
* @param db_conn database connection * @param sesssion database connection
* @param lock lock operation * @param lock lock operation
* @return #GNUNET_OK on success * @return #GNUNET_OK on success
* #GNUNET_SYSERR on internal error * #GNUNET_SYSERR on internal error
*/ */
int int
(*insert_lock) (void *cls, (*insert_lock) (void *cls,
struct TALER_MINTDB_Session *db_conn, struct TALER_MINTDB_Session *sesssion,
const struct Lock *lock); const struct Lock *lock);
@ -1017,14 +1019,14 @@ struct TALER_MINTDB_Plugin
* with the given coin (/refresh/melt and /deposit operations). * with the given coin (/refresh/melt and /deposit operations).
* *
* @param cls the @e cls of this struct with the plugin-specific state * @param cls the @e cls of this struct with the plugin-specific state
* @param db_conn database connection * @param sesssion database connection
* @param coin_pub coin to investigate * @param coin_pub coin to investigate
* @return list of transactions, NULL if coin is fresh * @return list of transactions, NULL if coin is fresh
*/ */
struct TALER_MINT_DB_TransactionList * struct TALER_MINT_DB_TransactionList *
(*get_coin_transactions) (void *cls, (*get_coin_transactions) (void *cls,
struct TALER_MINTDB_Session *db_conn, struct TALER_MINTDB_Session *sesssion,
const struct GNUNET_CRYPTO_EcdsaPublicKey *coin_pub); const struct TALER_CoinSpendPublicKey *coin_pub);
/** /**

View File

@ -31,8 +31,10 @@
if (cond) { GNUNET_break (0); goto EXITIF_exit; } \ if (cond) { GNUNET_break (0); goto EXITIF_exit; } \
} while (0) } while (0)
int int
main (int argc, const char *const argv[]) main (int argc,
const char *const argv[])
{ {
struct TALER_MINT_DenomKeyIssuePriv dki; struct TALER_MINT_DenomKeyIssuePriv dki;
char *enc; char *enc;
@ -41,25 +43,26 @@ main (int argc, const char *const argv[])
char *enc_read; char *enc_read;
size_t enc_read_size; size_t enc_read_size;
char *tmpfile; char *tmpfile;
int ret; int ret;
ret = 1; ret = 1;
enc = NULL; enc = NULL;
enc_read = NULL; enc_read = NULL;
tmpfile = NULL; tmpfile = NULL;
dki.denom_priv = NULL; dki.denom_priv.rsa_private_key = NULL;
dki_read.denom_priv = 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_MINT_DenomKeyIssue, sizeof (dki) - offsetof (struct TALER_MINT_DenomKeyIssue,
signature)); signature));
dki.denom_priv = GNUNET_CRYPTO_rsa_private_key_create (RSA_KEY_SIZE); dki.denom_priv.rsa_private_key
enc_size = GNUNET_CRYPTO_rsa_private_key_encode (dki.denom_priv, &enc); = GNUNET_CRYPTO_rsa_private_key_create (RSA_KEY_SIZE);
enc_size = GNUNET_CRYPTO_rsa_private_key_encode (dki.denom_priv.rsa_private_key,
&enc);
EXITIF (NULL == (tmpfile = GNUNET_DISK_mktemp ("test_mint_common"))); EXITIF (NULL == (tmpfile = GNUNET_DISK_mktemp ("test_mint_common")));
EXITIF (GNUNET_OK != TALER_MINT_write_denom_key (tmpfile, &dki)); EXITIF (GNUNET_OK != TALER_MINT_write_denom_key (tmpfile, &dki));
EXITIF (GNUNET_OK != TALER_MINT_read_denom_key (tmpfile, &dki_read)); EXITIF (GNUNET_OK != TALER_MINT_read_denom_key (tmpfile, &dki_read));
enc_read_size = GNUNET_CRYPTO_rsa_private_key_encode (dki_read.denom_priv, enc_read_size = GNUNET_CRYPTO_rsa_private_key_encode (dki_read.denom_priv.rsa_private_key,
&enc_read); &enc_read);
EXITIF (enc_size != enc_read_size); EXITIF (enc_size != enc_read_size);
EXITIF (0 != memcmp (enc, EXITIF (0 != memcmp (enc,
@ -75,9 +78,9 @@ main (int argc, const char *const argv[])
GNUNET_free (tmpfile); GNUNET_free (tmpfile);
} }
GNUNET_free_non_null (enc_read); GNUNET_free_non_null (enc_read);
if (NULL != dki.denom_priv) if (NULL != dki.denom_priv.rsa_private_key)
GNUNET_CRYPTO_rsa_private_key_free (dki.denom_priv); GNUNET_CRYPTO_rsa_private_key_free (dki.denom_priv.rsa_private_key);
if (NULL != dki_read.denom_priv) if (NULL != dki_read.denom_priv.rsa_private_key)
GNUNET_CRYPTO_rsa_private_key_free (dki_read.denom_priv); GNUNET_CRYPTO_rsa_private_key_free (dki_read.denom_priv.rsa_private_key);
return ret; return ret;
} }

View File

@ -54,14 +54,15 @@ static int result;
*/ */
static int static int
check_reserve (struct TALER_MINTDB_Session *session, check_reserve (struct TALER_MINTDB_Session *session,
struct GNUNET_CRYPTO_EddsaPublicKey *pub, const struct TALER_ReservePublicKey *pub,
uint32_t value, uint32_t value,
uint32_t fraction, uint32_t fraction,
const char *currency, const char *currency,
uint64_t expiry) uint64_t expiry)
{ {
struct Reserve reserve; struct Reserve reserve;
reserve.pub = pub;
reserve.pub = *pub;
FAILIF (GNUNET_OK != FAILIF (GNUNET_OK !=
plugin->reserve_get (plugin->cls, plugin->reserve_get (plugin->cls,
@ -80,8 +81,8 @@ check_reserve (struct TALER_MINTDB_Session *session,
struct DenomKeyPair struct DenomKeyPair
{ {
struct GNUNET_CRYPTO_rsa_PrivateKey *priv; struct TALER_DenominationPrivateKey priv;
struct GNUNET_CRYPTO_rsa_PublicKey *pub; struct TALER_DenominationPublicKey pub;
}; };
@ -91,9 +92,10 @@ create_denom_key_pair (unsigned int size)
struct DenomKeyPair *dkp; struct DenomKeyPair *dkp;
dkp = GNUNET_new (struct DenomKeyPair); dkp = GNUNET_new (struct DenomKeyPair);
dkp->priv = GNUNET_CRYPTO_rsa_private_key_create (size); dkp->priv.rsa_private_key = GNUNET_CRYPTO_rsa_private_key_create (size);
GNUNET_assert (NULL != dkp->priv); GNUNET_assert (NULL != dkp->priv.rsa_private_key);
dkp->pub = GNUNET_CRYPTO_rsa_private_key_get_public (dkp->priv); dkp->pub.rsa_public_key
= GNUNET_CRYPTO_rsa_private_key_get_public (dkp->priv.rsa_private_key);
return dkp; return dkp;
} }
@ -101,8 +103,8 @@ create_denom_key_pair (unsigned int size)
static void static void
destroy_denon_key_pair (struct DenomKeyPair *dkp) destroy_denon_key_pair (struct DenomKeyPair *dkp)
{ {
GNUNET_CRYPTO_rsa_public_key_free (dkp->pub); GNUNET_CRYPTO_rsa_public_key_free (dkp->pub.rsa_public_key);
GNUNET_CRYPTO_rsa_private_key_free (dkp->priv); GNUNET_CRYPTO_rsa_private_key_free (dkp->priv.rsa_private_key);
GNUNET_free (dkp); GNUNET_free (dkp);
} }
@ -121,7 +123,7 @@ run (void *cls,
const struct GNUNET_CONFIGURATION_Handle *cfg) const struct GNUNET_CONFIGURATION_Handle *cfg)
{ {
struct TALER_MINTDB_Session *session; struct TALER_MINTDB_Session *session;
struct GNUNET_CRYPTO_EddsaPublicKey reserve_pub; struct TALER_ReservePublicKey reserve_pub;
struct Reserve reserve; struct Reserve reserve;
struct GNUNET_TIME_Absolute expiry; struct GNUNET_TIME_Absolute expiry;
struct TALER_Amount amount; struct TALER_Amount amount;
@ -172,7 +174,7 @@ run (void *cls,
goto drop; goto drop;
} }
RND_BLK (&reserve_pub); RND_BLK (&reserve_pub);
reserve.pub = &reserve_pub; reserve.pub = reserve_pub;
amount.value = 1; amount.value = 1;
amount.fraction = 1; amount.fraction = 1;
strcpy (amount.currency, CURRENCY); strcpy (amount.currency, CURRENCY);
@ -209,7 +211,10 @@ run (void *cls,
RND_BLK(&h_blind); RND_BLK(&h_blind);
RND_BLK(&cbc.reserve_sig); RND_BLK(&cbc.reserve_sig);
cbc.denom_pub = dkp->pub; cbc.denom_pub = dkp->pub;
cbc.sig = GNUNET_CRYPTO_rsa_sign (dkp->priv, &h_blind, sizeof (h_blind)); cbc.sig.rsa_signature
= GNUNET_CRYPTO_rsa_sign (dkp->priv.rsa_private_key,
&h_blind,
sizeof (h_blind));
(void) memcpy (&cbc.reserve_pub, (void) memcpy (&cbc.reserve_pub,
&reserve_pub, &reserve_pub,
sizeof (reserve_pub)); sizeof (reserve_pub));
@ -233,7 +238,7 @@ run (void *cls,
session, session,
&h_blind, &h_blind,
&cbc2)); &cbc2));
FAILIF (NULL == cbc2.denom_pub); FAILIF (NULL == cbc2.denom_pub.rsa_public_key);
FAILIF (0 != memcmp (&cbc2.reserve_sig, FAILIF (0 != memcmp (&cbc2.reserve_sig,
&cbc.reserve_sig, &cbc.reserve_sig,
sizeof (cbc2.reserve_sig))); sizeof (cbc2.reserve_sig)));
@ -242,8 +247,8 @@ run (void *cls,
sizeof (cbc2.reserve_pub))); sizeof (cbc2.reserve_pub)));
FAILIF (GNUNET_OK != FAILIF (GNUNET_OK !=
GNUNET_CRYPTO_rsa_verify (&h_blind, GNUNET_CRYPTO_rsa_verify (&h_blind,
cbc2.sig, cbc2.sig.rsa_signature,
dkp->pub)); dkp->pub.rsa_public_key));
rh = plugin->get_reserve_history (plugin->cls, rh = plugin->get_reserve_history (plugin->cls,
session, session,
&reserve_pub); &reserve_pub);
@ -331,12 +336,12 @@ run (void *cls,
session)); session));
if (NULL != dkp) if (NULL != dkp)
destroy_denon_key_pair (dkp); destroy_denon_key_pair (dkp);
if (NULL != cbc.sig) if (NULL != cbc.sig.rsa_signature)
GNUNET_CRYPTO_rsa_signature_free (cbc.sig); GNUNET_CRYPTO_rsa_signature_free (cbc.sig.rsa_signature);
if (NULL != cbc2.denom_pub) if (NULL != cbc2.denom_pub.rsa_public_key)
GNUNET_CRYPTO_rsa_public_key_free (cbc2.denom_pub); GNUNET_CRYPTO_rsa_public_key_free (cbc2.denom_pub.rsa_public_key);
if (NULL != cbc2.sig) if (NULL != cbc2.sig.rsa_signature)
GNUNET_CRYPTO_rsa_signature_free (cbc2.sig); GNUNET_CRYPTO_rsa_signature_free (cbc2.sig.rsa_signature);
dkp = NULL; dkp = NULL;
} }

View File

@ -52,7 +52,8 @@ fatal_error_handler (void *cls,
void void
TALER_gcrypt_init () TALER_gcrypt_init ()
{ {
gcry_set_fatalerror_handler (&fatal_error_handler, NULL); gcry_set_fatalerror_handler (&fatal_error_handler,
NULL);
TALER_assert_as (gcry_check_version (NEED_LIBGCRYPT_VERSION), TALER_assert_as (gcry_check_version (NEED_LIBGCRYPT_VERSION),
"libgcrypt version mismatch"); "libgcrypt version mismatch");
/* Disable secure memory. */ /* Disable secure memory. */
@ -205,11 +206,11 @@ TALER_refresh_decrypt (const struct TALER_RefreshLinkEncrypted *input,
ret = GNUNET_new (struct TALER_RefreshLinkDecrypted); ret = GNUNET_new (struct TALER_RefreshLinkDecrypted);
memcpy (&ret->coin_priv, memcpy (&ret->coin_priv,
buf, buf,
sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)); sizeof (struct TALER_CoinSpendPrivateKey));
ret->blinding_key ret->blinding_key.rsa_blinding_key
= GNUNET_CRYPTO_rsa_blinding_key_decode (&buf[sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)], = GNUNET_CRYPTO_rsa_blinding_key_decode (&buf[sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)],
input->blinding_key_enc_size); input->blinding_key_enc_size);
if (NULL == ret->blinding_key) if (NULL == ret->blinding_key.rsa_blinding_key)
{ {
GNUNET_free (ret); GNUNET_free (ret);
return NULL; return NULL;
@ -236,7 +237,7 @@ TALER_refresh_encrypt (const struct TALER_RefreshLinkDecrypted *input,
struct TALER_RefreshLinkEncrypted *ret; struct TALER_RefreshLinkEncrypted *ret;
derive_refresh_key (secret, &iv, &skey); derive_refresh_key (secret, &iv, &skey);
b_buf_size = GNUNET_CRYPTO_rsa_blinding_key_encode (input->blinding_key, b_buf_size = GNUNET_CRYPTO_rsa_blinding_key_encode (input->blinding_key.rsa_blinding_key,
&b_buf); &b_buf);
ret = GNUNET_malloc (sizeof (struct TALER_RefreshLinkEncrypted) + ret = GNUNET_malloc (sizeof (struct TALER_RefreshLinkEncrypted) +
b_buf_size); b_buf_size);
@ -313,8 +314,8 @@ TALER_test_coin_valid (const struct TALER_CoinPublicInfo *coin_public_info)
&c_hash); &c_hash);
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_CRYPTO_rsa_verify (&c_hash, GNUNET_CRYPTO_rsa_verify (&c_hash,
coin_public_info->denom_sig, coin_public_info->denom_sig.rsa_signature,
coin_public_info->denom_pub)) coin_public_info->denom_pub.rsa_public_key))
{ {
GNUNET_log (GNUNET_ERROR_TYPE_WARNING, GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"coin signature is invalid\n"); "coin signature is invalid\n");