From 9b8c350d4dc38256fe746ef31c480bc4f50ac4c8 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 13 Feb 2022 12:44:09 +0100 Subject: -remove redundancies in the refresh-melt computation and fix uninitialized bks return value --- src/lib/exchange_api_refresh_common.h | 77 ++++++++++++++++++++++++++++------- 1 file changed, 62 insertions(+), 15 deletions(-) (limited to 'src/lib/exchange_api_refresh_common.h') diff --git a/src/lib/exchange_api_refresh_common.h b/src/lib/exchange_api_refresh_common.h index 2115b5a1..ab19ad7d 100644 --- a/src/lib/exchange_api_refresh_common.h +++ b/src/lib/exchange_api_refresh_common.h @@ -52,11 +52,6 @@ struct MeltedCoin */ struct TALER_Amount original_value; - /** - * Transfer private keys for each cut-and-choose dimension. - */ - struct TALER_TransferPrivateKeyP transfer_priv[TALER_CNC_KAPPA]; - /** * Timestamp indicating when coins of this denomination become invalid. */ @@ -75,6 +70,37 @@ struct MeltedCoin }; +/** + * Data we keep for each fresh coin created in the + * melt process. + */ +struct FreshCoinData +{ + /** + * Denomination public key of the coin. + */ + struct TALER_DenominationPublicKey fresh_pk; + + /** + * Array of planchet secrets for the coins, depending + * on the cut-and-choose. + */ + struct TALER_PlanchetMasterSecretP ps[TALER_CNC_KAPPA]; + + /** + * Private key of the coin. + */ + struct TALER_CoinSpendPrivateKeyP coin_priv; + + /** + * Blinding key secrets for the coins, depending on the + * cut-and-choose. + */ + union TALER_DenominationBlindingKeyP bks[TALER_CNC_KAPPA]; + +}; + + /** * Melt data in non-serialized format for convenient processing. */ @@ -87,26 +113,47 @@ struct MeltData struct TALER_RefreshCommitmentP rc; /** - * Number of coins we are creating + * Information about the melted coin. */ - uint16_t num_fresh_coins; + struct MeltedCoin melted_coin; /** - * Information about the melted coin. + * Array of length @e num_fresh_coins with information + * about each fresh coin. */ - struct MeltedCoin melted_coin; + struct FreshCoinData *fcds; + + /** + * Transfer secrets, one per cut and choose. + */ + struct TALER_TransferSecretP trans_sec[TALER_CNC_KAPPA]; + + /** + * Transfer private keys for each cut-and-choose dimension. + */ + struct TALER_TransferPrivateKeyP transfer_priv[TALER_CNC_KAPPA]; + + /** + * Transfer public key of this commitment. + */ + struct TALER_TransferPublicKeyP transfer_pub[TALER_CNC_KAPPA]; /** - * Array of @e num_fresh_coins denomination keys for the coins to be - * freshly exchangeed. + * Transfer secrets, one per cut and choose. */ - struct TALER_DenominationPublicKey *fresh_pks; + struct TALER_RefreshCommitmentEntry rce[TALER_CNC_KAPPA]; /** - * Arrays of @e num_fresh_coins with information about the fresh - * coins to be created, for each cut-and-choose dimension. + * Blinded planchets and denominations of the fresh coins, depending on the cut-and-choose. Array of length + * @e num_fresh_coins. */ - struct TALER_PlanchetMasterSecretP *fresh_coins[TALER_CNC_KAPPA]; + struct TALER_RefreshCoinData *rcd[TALER_CNC_KAPPA]; + + /** + * Number of coins we are creating + */ + uint16_t num_fresh_coins; + }; -- cgit v1.2.3