exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit 8cbe16a2203d581ad2bdfcd7240653d1ee416634
parent 133cf76f0d193e8226e53690b62de74e6b0f68d0
Author: Christian Grothoff <christian@grothoff.org>
Date:   Tue,  8 Feb 2022 09:58:22 +0100

fix refresh/link tests

Diffstat:
Msrc/include/taler_crypto_lib.h | 25++-----------------------
Msrc/lib/exchange_api_refreshes_reveal.c | 20+++++++++++---------
Msrc/testing/Makefile.am | 3++-
Asrc/testing/test_auditor_api_expire_reserve_now-cs.conf | 4++++
Asrc/testing/test_auditor_api_expire_reserve_now-rsa.conf | 4++++
Dsrc/testing/test_auditor_api_expire_reserve_now.conf | 4----
Msrc/testing/testing_api_cmd_refresh.c | 16+++++++++++++++-
Msrc/util/wallet_signatures.c | 10+++-------
8 files changed, 41 insertions(+), 45 deletions(-)

diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h @@ -2270,16 +2270,14 @@ TALER_wallet_melt_verify ( * * @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 bch blinded coin hash * @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_BlindedCoinHash *bch, const struct TALER_CoinSpendPrivateKeyP *old_coin_priv, struct TALER_CoinSpendSignatureP *coin_sig); @@ -2304,25 +2302,6 @@ TALER_wallet_link_verify ( /** - * 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. * * @param h_denom_pub hash of the denomiantion public key of the coin diff --git a/src/lib/exchange_api_refreshes_reveal.c b/src/lib/exchange_api_refreshes_reveal.c @@ -418,15 +418,17 @@ TALER_EXCHANGE_refreshes_reveal ( &pd.blinded_planchet)))); { struct TALER_CoinSpendSignatureP link_sig; - - TALER_wallet_link_sign (&denom_hash, - &transfer_pub, - pd.blinded_planchet.details.rsa_blinded_planchet. - blinded_msg, - pd.blinded_planchet.details.rsa_blinded_planchet. - blinded_msg_size, - &md.melted_coin.coin_priv, - &link_sig); + struct TALER_BlindedCoinHash bch; + + TALER_coin_ev_hash (&pd.blinded_planchet, + &denom_hash, + &bch); + TALER_wallet_link_sign ( + &denom_hash, + &transfer_pub, + &bch, + &md.melted_coin.coin_priv, + &link_sig); GNUNET_assert (0 == json_array_append_new ( link_sigs, diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am @@ -484,7 +484,8 @@ test_kyc_api_LDADD = \ EXTRA_DIST = \ 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_twisted.conf \ test_bank_api_pybank.conf \ diff --git a/src/testing/test_auditor_api_expire_reserve_now-cs.conf b/src/testing/test_auditor_api_expire_reserve_now-cs.conf @@ -0,0 +1,4 @@ +@INLINE@ test_auditor_api-cs.conf + +[exchangedb] +IDLE_RESERVE_EXPIRATION_TIME = 0 s diff --git a/src/testing/test_auditor_api_expire_reserve_now-rsa.conf b/src/testing/test_auditor_api_expire_reserve_now-rsa.conf @@ -0,0 +1,4 @@ +@INLINE@ test_auditor_api-rsa.conf + +[exchangedb] +IDLE_RESERVE_EXPIRATION_TIME = 0 s diff --git a/src/testing/test_auditor_api_expire_reserve_now.conf b/src/testing/test_auditor_api_expire_reserve_now.conf @@ -1,4 +0,0 @@ -@INLINE@ test_auditor_api.conf - -[exchangedb] -IDLE_RESERVE_EXPIRATION_TIME = 0 s diff --git a/src/testing/testing_api_cmd_refresh.c b/src/testing/testing_api_cmd_refresh.c @@ -122,6 +122,12 @@ struct RefreshMeltState 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. */ struct TALER_PlanchetSecretsP ps; @@ -970,6 +976,11 @@ melt_cb (void *cls, memcpy (rms->alg_values, alg_values, 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) { @@ -1055,7 +1066,6 @@ melt_run (void *cls, TALER_TESTING_interpreter_fail (rms->is); return; } - if (GNUNET_OK != TALER_TESTING_get_trait_denom_sig (coin_command, 0, @@ -1172,6 +1182,7 @@ melt_cleanup (void *cls, GNUNET_free (rms->fresh_pks); } GNUNET_free (rms->alg_values); + GNUNET_free (rms->bks); GNUNET_free (rms->melt_fresh_amounts); GNUNET_free (rms); } @@ -1205,6 +1216,9 @@ melt_traits (void *cls, &rms->fresh_pks[index]), TALER_TESTING_make_trait_coin_priv (0, rms->melt_priv), + // ???? + TALER_TESTING_make_trait_blinding_key (index, + &rms->bks[index]), TALER_TESTING_trait_end () }; diff --git a/src/util/wallet_signatures.c b/src/util/wallet_signatures.c @@ -107,9 +107,7 @@ TALER_wallet_deposit_verify ( void TALER_wallet_link_sign (const struct TALER_DenominationHash *h_denom_pub, const struct TALER_TransferPublicKeyP *transfer_pub, - // FIXME: consider passing hash! - const void *coin_ev, - size_t coin_ev_size, + const struct TALER_BlindedCoinHash *bch, const struct TALER_CoinSpendPrivateKeyP *old_coin_priv, 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.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_LINK), .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, &ldp, &coin_sig->eddsa_signature);