fix refresh/link tests

This commit is contained in:
Christian Grothoff 2022-02-08 09:58:22 +01:00
parent 133cf76f0d
commit 8cbe16a220
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
7 changed files with 37 additions and 41 deletions

View File

@ -2270,16 +2270,14 @@ TALER_wallet_melt_verify (
* *
* @param h_denom_pub hash of the denomiantion public key of the new coin * @param h_denom_pub hash of the denomiantion public key of the new coin
* @param transfer_pub transfer public key * @param transfer_pub transfer public key
* @param coin_ev coin envelope * @param bch blinded coin hash
* @param coin_ev_size number of bytes in @a coin_ev
* @param old_coin_priv private key to sign with * @param old_coin_priv private key to sign with
* @param[out] coin_sig resulting signature * @param[out] coin_sig resulting signature
*/ */
void void
TALER_wallet_link_sign (const struct TALER_DenominationHash *h_denom_pub, TALER_wallet_link_sign (const struct TALER_DenominationHash *h_denom_pub,
const struct TALER_TransferPublicKeyP *transfer_pub, const struct TALER_TransferPublicKeyP *transfer_pub,
const void *coin_ev, const struct TALER_BlindedCoinHash *bch,
size_t coin_ev_size,
const struct TALER_CoinSpendPrivateKeyP *old_coin_priv, const struct TALER_CoinSpendPrivateKeyP *old_coin_priv,
struct TALER_CoinSpendSignatureP *coin_sig); struct TALER_CoinSpendSignatureP *coin_sig);
@ -2303,25 +2301,6 @@ TALER_wallet_link_verify (
const struct TALER_CoinSpendSignatureP *coin_sig); const struct TALER_CoinSpendSignatureP *coin_sig);
/**
* Sign link data.
*
* @param h_denom_pub hash of the denomiantion public key of the new coin
* @param transfer_pub transfer public key
* @param coin_ev coin envelope
* @param coin_ev_size number of bytes in @a coin_ev
* @param old_coin_priv private key to sign with
* @param[out] coin_sig resulting signature
*/
void
TALER_wallet_link_sign (const struct TALER_DenominationHash *h_denom_pub,
const struct TALER_TransferPublicKeyP *transfer_pub,
const void *coin_ev,
size_t coin_ev_size,
const struct TALER_CoinSpendPrivateKeyP *old_coin_priv,
struct TALER_CoinSpendSignatureP *coin_sig);
/** /**
* Verify recoup signature. * Verify recoup signature.
* *

View File

@ -418,13 +418,15 @@ TALER_EXCHANGE_refreshes_reveal (
&pd.blinded_planchet)))); &pd.blinded_planchet))));
{ {
struct TALER_CoinSpendSignatureP link_sig; struct TALER_CoinSpendSignatureP link_sig;
struct TALER_BlindedCoinHash bch;
TALER_wallet_link_sign (&denom_hash, TALER_coin_ev_hash (&pd.blinded_planchet,
&denom_hash,
&bch);
TALER_wallet_link_sign (
&denom_hash,
&transfer_pub, &transfer_pub,
pd.blinded_planchet.details.rsa_blinded_planchet. &bch,
blinded_msg,
pd.blinded_planchet.details.rsa_blinded_planchet.
blinded_msg_size,
&md.melted_coin.coin_priv, &md.melted_coin.coin_priv,
&link_sig); &link_sig);
GNUNET_assert (0 == GNUNET_assert (0 ==

View File

@ -484,7 +484,8 @@ test_kyc_api_LDADD = \
EXTRA_DIST = \ EXTRA_DIST = \
test_auditor_api.conf \ test_auditor_api.conf \
test_auditor_api_expire_reserve_now.conf \ test_auditor_api_expire_reserve_now-cs.conf \
test_auditor_api_expire_reserve_now-rsa.conf \
test_bank_api_fakebank.conf \ test_bank_api_fakebank.conf \
test_bank_api_fakebank_twisted.conf \ test_bank_api_fakebank_twisted.conf \
test_bank_api_pybank.conf \ test_bank_api_pybank.conf \

View File

@ -1,4 +1,4 @@
@INLINE@ test_auditor_api.conf @INLINE@ test_auditor_api-cs.conf
[exchangedb] [exchangedb]
IDLE_RESERVE_EXPIRATION_TIME = 0 s IDLE_RESERVE_EXPIRATION_TIME = 0 s

View File

@ -0,0 +1,4 @@
@INLINE@ test_auditor_api-rsa.conf
[exchangedb]
IDLE_RESERVE_EXPIRATION_TIME = 0 s

View File

@ -121,6 +121,12 @@ struct RefreshMeltState
*/ */
struct TALER_ExchangeWithdrawValues *alg_values; struct TALER_ExchangeWithdrawValues *alg_values;
/**
* Array of @a num_fresh_coins of blinding key secrets
* created during the melt operation.
*/
union TALER_DenominationBlindingKeyP *bks;
/** /**
* Entropy seed for the refresh-melt operation. * Entropy seed for the refresh-melt operation.
*/ */
@ -970,6 +976,11 @@ melt_cb (void *cls,
memcpy (rms->alg_values, memcpy (rms->alg_values,
alg_values, alg_values,
num_coins * sizeof (struct TALER_ExchangeWithdrawValues)); num_coins * sizeof (struct TALER_ExchangeWithdrawValues));
rms->bks = GNUNET_new_array (num_coins,
union TALER_DenominationBlindingKeyP);
memcpy (rms->bks,
bks,
num_coins * sizeof (union TALER_DenominationBlindingKeyP));
} }
if (0 != rms->total_backoff.rel_value_us) if (0 != rms->total_backoff.rel_value_us)
{ {
@ -1055,7 +1066,6 @@ melt_run (void *cls,
TALER_TESTING_interpreter_fail (rms->is); TALER_TESTING_interpreter_fail (rms->is);
return; return;
} }
if (GNUNET_OK != if (GNUNET_OK !=
TALER_TESTING_get_trait_denom_sig (coin_command, TALER_TESTING_get_trait_denom_sig (coin_command,
0, 0,
@ -1172,6 +1182,7 @@ melt_cleanup (void *cls,
GNUNET_free (rms->fresh_pks); GNUNET_free (rms->fresh_pks);
} }
GNUNET_free (rms->alg_values); GNUNET_free (rms->alg_values);
GNUNET_free (rms->bks);
GNUNET_free (rms->melt_fresh_amounts); GNUNET_free (rms->melt_fresh_amounts);
GNUNET_free (rms); GNUNET_free (rms);
} }
@ -1205,6 +1216,9 @@ melt_traits (void *cls,
&rms->fresh_pks[index]), &rms->fresh_pks[index]),
TALER_TESTING_make_trait_coin_priv (0, TALER_TESTING_make_trait_coin_priv (0,
rms->melt_priv), rms->melt_priv),
// ????
TALER_TESTING_make_trait_blinding_key (index,
&rms->bks[index]),
TALER_TESTING_trait_end () TALER_TESTING_trait_end ()
}; };

View File

@ -107,9 +107,7 @@ TALER_wallet_deposit_verify (
void void
TALER_wallet_link_sign (const struct TALER_DenominationHash *h_denom_pub, TALER_wallet_link_sign (const struct TALER_DenominationHash *h_denom_pub,
const struct TALER_TransferPublicKeyP *transfer_pub, const struct TALER_TransferPublicKeyP *transfer_pub,
// FIXME: consider passing hash! const struct TALER_BlindedCoinHash *bch,
const void *coin_ev,
size_t coin_ev_size,
const struct TALER_CoinSpendPrivateKeyP *old_coin_priv, const struct TALER_CoinSpendPrivateKeyP *old_coin_priv,
struct TALER_CoinSpendSignatureP *coin_sig) struct TALER_CoinSpendSignatureP *coin_sig)
{ {
@ -117,12 +115,10 @@ TALER_wallet_link_sign (const struct TALER_DenominationHash *h_denom_pub,
.purpose.size = htonl (sizeof (ldp)), .purpose.size = htonl (sizeof (ldp)),
.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_LINK), .purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_LINK),
.h_denom_pub = *h_denom_pub, .h_denom_pub = *h_denom_pub,
.transfer_pub = *transfer_pub .transfer_pub = *transfer_pub,
.coin_envelope_hash = *bch
}; };
GNUNET_CRYPTO_hash (coin_ev,
coin_ev_size,
&ldp.coin_envelope_hash.hash);
GNUNET_CRYPTO_eddsa_sign (&old_coin_priv->eddsa_priv, GNUNET_CRYPTO_eddsa_sign (&old_coin_priv->eddsa_priv,
&ldp, &ldp,
&coin_sig->eddsa_signature); &coin_sig->eddsa_signature);