fixes to crypto.c changes

This commit is contained in:
Gian Demarmels 2022-02-05 20:22:55 +01:00
parent 41d132757b
commit e8740316a7
No known key found for this signature in database
GPG Key ID: 030CEDDCCC92D778
3 changed files with 27 additions and 13 deletions

View File

@ -180,7 +180,8 @@ check_commitment (struct RevealContext *rctx,
for (unsigned int j = 0; j<rctx->num_fresh_coins; j++) for (unsigned int j = 0; j<rctx->num_fresh_coins; j++)
{ {
struct TALER_RefreshCoinData *rcd = &rce->new_coins[j]; struct TALER_RefreshCoinData *rcd = &rce->new_coins[j];
struct TALER_PlanchetSecretsP ps; struct TALER_CoinSpendPrivateKeyP coin_priv;
union TALER_DenominationBlindingKeyP bks;
struct TALER_ExchangeWithdrawValues alg_values; struct TALER_ExchangeWithdrawValues alg_values;
struct TALER_PlanchetDetail pd; struct TALER_PlanchetDetail pd;
struct TALER_CoinPubHash c_hash; struct TALER_CoinPubHash c_hash;
@ -188,13 +189,15 @@ check_commitment (struct RevealContext *rctx,
rcd->dk = &rctx->dks[j]->denom_pub; rcd->dk = &rctx->dks[j]->denom_pub;
TALER_planchet_setup_refresh (&ts, TALER_planchet_setup_refresh (&ts,
j, j,
&ps); &coin_priv,
&bks);
// TODO: implement cipher handling // TODO: implement cipher handling
alg_values.cipher = TALER_DENOMINATION_RSA; alg_values.cipher = TALER_DENOMINATION_RSA;
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
TALER_planchet_prepare (rcd->dk, TALER_planchet_prepare (rcd->dk,
&alg_values, &alg_values,
&ps, &bks,
&coin_priv,
&c_hash, &c_hash,
&pd)); &pd));
rcd->coin_ev = rcd->coin_ev =

View File

@ -94,7 +94,7 @@ csr_ok (struct TALER_EXCHANGE_CsRHandle *csrh,
struct TALER_ExchangeWithdrawValues alg_values[GNUNET_NZL (alen)]; struct TALER_ExchangeWithdrawValues alg_values[GNUNET_NZL (alen)];
struct TALER_EXCHANGE_CsRResponse csrr = { struct TALER_EXCHANGE_CsRResponse csrr = {
.hr = hr, .hr = hr,
.details.success.alg_values_len = alen, .details.success.arg_values_len = alen,
.details.success.alg_values = alg_values .details.success.alg_values = alg_values
}; };
@ -105,11 +105,11 @@ csr_ok (struct TALER_EXCHANGE_CsRHandle *csrh,
struct GNUNET_JSON_Specification spec[] = { struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed ( GNUNET_JSON_spec_fixed (
"r_pub_0", "r_pub_0",
&alg_values[i].r_pub.r_pub[0], &alg_values[i].details.cs_values.r_pub.r_pub[0],
sizeof (struct GNUNET_CRYPTO_CsRPublic)), sizeof (struct GNUNET_CRYPTO_CsRPublic)),
GNUNET_JSON_spec_fixed ( GNUNET_JSON_spec_fixed (
"r_pub_1", "r_pub_1",
&alg_values[i].r_pub.r_pub[1], &alg_values[i].details.cs_values.r_pub.r_pub[1],
sizeof (struct GNUNET_CRYPTO_CsRPublic)), sizeof (struct GNUNET_CRYPTO_CsRPublic)),
GNUNET_JSON_spec_end () GNUNET_JSON_spec_end ()
}; };

View File

@ -64,10 +64,20 @@ struct TALER_EXCHANGE_WithdrawHandle
const struct TALER_ReservePrivateKeyP *reserve_priv; const struct TALER_ReservePrivateKeyP *reserve_priv;
/** /**
* Secrets of the planchet. * Seed of the planchet.
*/ */
struct TALER_PlanchetSecretsP ps; struct TALER_PlanchetSecretsP ps;
/**
* blinding secret
*/
union DenominationBlindingKeyP bks;
/**
*
*/
struct TALER_CoinSpendPrivateKeyP priv;
/** /**
* Details of the planchet. * Details of the planchet.
*/ */
@ -125,8 +135,8 @@ handle_reserve_withdraw_finished (
if (GNUNET_OK != if (GNUNET_OK !=
TALER_planchet_to_coin (&wh->pk.key, TALER_planchet_to_coin (&wh->pk.key,
blind_sig, blind_sig,
&wh->ps, &wh->
&wh->c_hash, & wh->c_hash,
&wh->alg_values, &wh->alg_values,
&fc)) &fc))
{ {
@ -246,15 +256,16 @@ TALER_EXCHANGE_withdraw (
switch (pk->key.cipher) switch (pk->key.cipher)
{ {
case TALER_DENOMINATION_RSA: case TALER_DENOMINATION_RSA:
struct TALER_CoinSpendPrivateKeyP priv; wh->alg_values.cipher = TALER_DENOMINATION_RSA;
alg_values.cipher = TALER_DENOMINATION_RSA;
TALER_planchet_setup_coin_priv (ps, &wh->alg_values, &priv); TALER_planchet_setup_coin_priv (ps, &wh->alg_values, &wh->priv);
TALER_planchet_blinding_secret_create (ps, &wh->alg_values, &wh->bks);
if (GNUNET_OK != if (GNUNET_OK !=
TALER_planchet_prepare (&pk->key, TALER_planchet_prepare (&pk->key,
&wh->alg_values, &wh->alg_values,
ps, &bks,
&priv,
&wh->c_hash, &wh->c_hash,
&wh->pd)) &wh->pd))
{ {