expose blinding key in refresh-reveal API in preparation for #5777
This commit is contained in:
parent
c94309ee6e
commit
ad34305942
@ -435,27 +435,6 @@ struct TALER_PlanchetSecretsP
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Header for serializations of coin-specific information about the fresh
|
|
||||||
* coins we generate from refresh. These are the secrets that arise during
|
|
||||||
* planchet generation, which is the first stage of creating a new coin from
|
|
||||||
* refresh.
|
|
||||||
*/
|
|
||||||
struct TALER_RefreshPlanchetSecretsP
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Private key of the coin.
|
|
||||||
*/
|
|
||||||
struct TALER_CoinSpendPrivateKeyP coin_priv;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* XXX. See #5777~0014690 - need a solution for this first!
|
|
||||||
*/
|
|
||||||
struct TALER_TransferPrivateKeyP transfer_priv;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
GNUNET_NETWORK_STRUCT_END
|
GNUNET_NETWORK_STRUCT_END
|
||||||
|
|
||||||
|
|
||||||
|
@ -1356,9 +1356,7 @@ typedef void
|
|||||||
unsigned int http_status,
|
unsigned int http_status,
|
||||||
enum TALER_ErrorCode ec,
|
enum TALER_ErrorCode ec,
|
||||||
unsigned int num_coins,
|
unsigned int num_coins,
|
||||||
/* TODO (#5777): possibly replace
|
const struct TALER_PlanchetSecretsP *coin_privs,
|
||||||
by a `struct TALER_RefreshPlanchetSecretsP` */
|
|
||||||
const struct TALER_CoinSpendPrivateKeyP *coin_privs,
|
|
||||||
const struct TALER_DenominationSignature *sigs,
|
const struct TALER_DenominationSignature *sigs,
|
||||||
const json_t *full_response);
|
const json_t *full_response);
|
||||||
|
|
||||||
|
@ -1950,8 +1950,6 @@ TALER_TESTING_get_trait_uint
|
|||||||
/**
|
/**
|
||||||
* Information about a fresh coin generated by the refresh
|
* Information about a fresh coin generated by the refresh
|
||||||
* operation. FIXME: should go away from here!
|
* operation. FIXME: should go away from here!
|
||||||
*
|
|
||||||
* FIXME: should be renamed, easily confused with `struct TALER_FreshCoin`!
|
|
||||||
*/
|
*/
|
||||||
struct TALER_TESTING_FreshCoinData
|
struct TALER_TESTING_FreshCoinData
|
||||||
{
|
{
|
||||||
@ -1973,6 +1971,12 @@ struct TALER_TESTING_FreshCoinData
|
|||||||
* Set (by the interpreter) to the coin's private key.
|
* Set (by the interpreter) to the coin's private key.
|
||||||
*/
|
*/
|
||||||
struct TALER_CoinSpendPrivateKeyP coin_priv;
|
struct TALER_CoinSpendPrivateKeyP coin_priv;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The blinding key (needed for payback operations).
|
||||||
|
*/
|
||||||
|
struct TALER_DenominationBlindingKeyP blinding_key;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1318,14 +1318,12 @@ struct TALER_EXCHANGE_RefreshRevealHandle
|
|||||||
*
|
*
|
||||||
* @param rrh operation handle
|
* @param rrh operation handle
|
||||||
* @param json reply from the exchange
|
* @param json reply from the exchange
|
||||||
* @param[out] coin_privs array of length `num_fresh_coins`, initialized to contain private keys
|
|
||||||
* @param[out] sigs array of length `num_fresh_coins`, initialized to cointain RSA signatures
|
* @param[out] sigs array of length `num_fresh_coins`, initialized to cointain RSA signatures
|
||||||
* @return #GNUNET_OK on success, #GNUNET_SYSERR on errors
|
* @return #GNUNET_OK on success, #GNUNET_SYSERR on errors
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
refresh_reveal_ok (struct TALER_EXCHANGE_RefreshRevealHandle *rrh,
|
refresh_reveal_ok (struct TALER_EXCHANGE_RefreshRevealHandle *rrh,
|
||||||
const json_t *json,
|
const json_t *json,
|
||||||
struct TALER_CoinSpendPrivateKeyP *coin_privs,
|
|
||||||
struct TALER_DenominationSignature *sigs)
|
struct TALER_DenominationSignature *sigs)
|
||||||
{
|
{
|
||||||
json_t *jsona;
|
json_t *jsona;
|
||||||
@ -1405,7 +1403,6 @@ refresh_reveal_ok (struct TALER_EXCHANGE_RefreshRevealHandle *rrh,
|
|||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
GNUNET_CRYPTO_rsa_signature_free (blind_sig);
|
GNUNET_CRYPTO_rsa_signature_free (blind_sig);
|
||||||
coin_privs[i] = coin.coin_priv;
|
|
||||||
sigs[i] = coin.sig;
|
sigs[i] = coin.sig;
|
||||||
}
|
}
|
||||||
GNUNET_JSON_parse_free (outer_spec);
|
GNUNET_JSON_parse_free (outer_spec);
|
||||||
@ -1436,14 +1433,12 @@ handle_refresh_reveal_finished (void *cls,
|
|||||||
break;
|
break;
|
||||||
case MHD_HTTP_OK:
|
case MHD_HTTP_OK:
|
||||||
{
|
{
|
||||||
struct TALER_CoinSpendPrivateKeyP coin_privs[rrh->md->num_fresh_coins];
|
|
||||||
struct TALER_DenominationSignature sigs[rrh->md->num_fresh_coins];
|
struct TALER_DenominationSignature sigs[rrh->md->num_fresh_coins];
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
memset (sigs, 0, sizeof (sigs));
|
memset (sigs, 0, sizeof (sigs));
|
||||||
ret = refresh_reveal_ok (rrh,
|
ret = refresh_reveal_ok (rrh,
|
||||||
j,
|
j,
|
||||||
coin_privs,
|
|
||||||
sigs);
|
sigs);
|
||||||
if (GNUNET_OK != ret)
|
if (GNUNET_OK != ret)
|
||||||
{
|
{
|
||||||
@ -1453,9 +1448,9 @@ handle_refresh_reveal_finished (void *cls,
|
|||||||
{
|
{
|
||||||
rrh->reveal_cb (rrh->reveal_cb_cls,
|
rrh->reveal_cb (rrh->reveal_cb_cls,
|
||||||
MHD_HTTP_OK,
|
MHD_HTTP_OK,
|
||||||
TALER_EC_NONE,
|
TALER_EC_NONE,
|
||||||
rrh->md->num_fresh_coins,
|
rrh->md->num_fresh_coins,
|
||||||
coin_privs,
|
rrh->md->fresh_coins[rrh->noreveal_index],
|
||||||
sigs,
|
sigs,
|
||||||
j);
|
j);
|
||||||
rrh->reveal_cb = NULL;
|
rrh->reveal_cb = NULL;
|
||||||
@ -1490,10 +1485,10 @@ handle_refresh_reveal_finished (void *cls,
|
|||||||
if (NULL != rrh->reveal_cb)
|
if (NULL != rrh->reveal_cb)
|
||||||
rrh->reveal_cb (rrh->reveal_cb_cls,
|
rrh->reveal_cb (rrh->reveal_cb_cls,
|
||||||
response_code,
|
response_code,
|
||||||
TALER_JSON_get_error_code (j),
|
TALER_JSON_get_error_code (j),
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
j);
|
j);
|
||||||
TALER_EXCHANGE_refresh_reveal_cancel (rrh);
|
TALER_EXCHANGE_refresh_reveal_cancel (rrh);
|
||||||
}
|
}
|
||||||
|
@ -289,7 +289,7 @@ reveal_cb (void *cls,
|
|||||||
unsigned int http_status,
|
unsigned int http_status,
|
||||||
enum TALER_ErrorCode ec,
|
enum TALER_ErrorCode ec,
|
||||||
unsigned int num_coins,
|
unsigned int num_coins,
|
||||||
const struct TALER_CoinSpendPrivateKeyP *coin_privs,
|
const struct TALER_PlanchetSecretsP *coin_privs,
|
||||||
const struct TALER_DenominationSignature *sigs,
|
const struct TALER_DenominationSignature *sigs,
|
||||||
const json_t *full_response)
|
const json_t *full_response)
|
||||||
{
|
{
|
||||||
@ -358,7 +358,8 @@ reveal_cb (void *cls,
|
|||||||
TALER_TESTING_interpreter_fail (rrs->is);
|
TALER_TESTING_interpreter_fail (rrs->is);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fc->coin_priv = coin_privs[i];
|
fc->coin_priv = coin_privs[i].coin_priv;
|
||||||
|
fc->blinding_key = coin_privs[i].blinding_key;
|
||||||
fc->sig.rsa_signature = GNUNET_CRYPTO_rsa_signature_dup
|
fc->sig.rsa_signature = GNUNET_CRYPTO_rsa_signature_dup
|
||||||
(sigs[i].rsa_signature);
|
(sigs[i].rsa_signature);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user