From fb9ba5b1d2970e24643d179338b34c8915d2072d Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 7 Feb 2022 12:33:35 +0100 Subject: -rename fest --- src/benchmark/taler-aggregator-benchmark.c | 2 +- src/exchange-tools/taler-crypto-worker.c | 6 +- src/exchange/taler-exchange-httpd_csr.c | 6 +- src/exchange/taler-exchange-httpd_keys.c | 2 +- src/exchange/taler-exchange-httpd_keys.h | 2 +- .../taler-exchange-httpd_refreshes_reveal.c | 6 +- src/exchangedb/plugin_exchangedb_postgres.c | 2 +- src/exchangedb/test_exchangedb.c | 2 +- src/include/taler_crypto_lib.h | 72 +++++++++++----------- src/include/taler_exchange_service.h | 2 +- src/include/taler_exchangedb_plugin.h | 6 +- src/json/json_wire.c | 2 +- src/lib/exchange_api_csr.c | 4 +- src/lib/exchange_api_deposit.c | 2 +- src/lib/exchange_api_link.c | 6 +- src/lib/exchange_api_refresh_common.c | 6 +- src/lib/exchange_api_refreshes_reveal.c | 6 +- src/testing/testing_api_cmd_deposit.c | 2 +- src/testing/testing_api_helpers_bank.c | 2 +- src/util/crypto.c | 49 ++++++++------- src/util/crypto_helper_cs.c | 4 +- src/util/crypto_wire.c | 6 +- src/util/denom.c | 40 ++++++------ src/util/taler-exchange-secmod-cs.c | 4 +- src/util/taler-exchange-secmod-cs.h | 2 +- src/util/test_crypto.c | 14 ++--- 26 files changed, 130 insertions(+), 127 deletions(-) (limited to 'src') diff --git a/src/benchmark/taler-aggregator-benchmark.c b/src/benchmark/taler-aggregator-benchmark.c index bace70027..8d0f76d9a 100644 --- a/src/benchmark/taler-aggregator-benchmark.c +++ b/src/benchmark/taler-aggregator-benchmark.c @@ -228,7 +228,7 @@ struct Merchant /** * Salt used when computing @e h_wire. */ - struct TALER_WireSalt wire_salt; + struct TALER_WireSaltP wire_salt; /** * Account information for the merchant. diff --git a/src/exchange-tools/taler-crypto-worker.c b/src/exchange-tools/taler-crypto-worker.c index 87c40c775..2ee98e574 100644 --- a/src/exchange-tools/taler-crypto-worker.c +++ b/src/exchange-tools/taler-crypto-worker.c @@ -205,9 +205,9 @@ run (void *cls, global_ret = 1; return; } - TALER_planchet_setup_refresh (&transfer_secret, - coin_index, - &ps); + TALER_transfer_secret_to_planchet_secret (&transfer_secret, + coin_index, + &ps); GNUNET_CRYPTO_eddsa_key_get_public (&ps.coin_priv.eddsa_priv, &coin_pub.eddsa_pub); diff --git a/src/exchange/taler-exchange-httpd_csr.c b/src/exchange/taler-exchange-httpd_csr.c index af621682a..31a7614f9 100644 --- a/src/exchange/taler-exchange-httpd_csr.c +++ b/src/exchange/taler-exchange-httpd_csr.c @@ -98,12 +98,12 @@ TEH_handler_csr (struct TEH_RequestContext *rc, return (GNUNET_NO == res) ? MHD_YES : MHD_NO; } - struct TALER_DenominationCsPublicR r_pubs[GNUNET_NZL (csr_requests_num)]; + struct TALER_DenominationCSPublicRPairP r_pubs[GNUNET_NZL (csr_requests_num)]; for (unsigned int i = 0; i < csr_requests_num; i++) { const struct TALER_CsNonce *nonce = &nonces[i]; const struct TALER_DenominationHash *denom_pub_hash = &denom_pub_hashes[i]; - struct TALER_DenominationCsPublicR *r_pub = &r_pubs[i]; + struct TALER_DenominationCSPublicRPairP *r_pub = &r_pubs[i]; // check denomination referenced by denom_pub_hash { @@ -182,7 +182,7 @@ TEH_handler_csr (struct TEH_RequestContext *rc, csr_response = json_array (); for (unsigned int i = 0; i < csr_requests_num; i++) { - const struct TALER_DenominationCsPublicR *r_pub = &r_pubs[i]; + const struct TALER_DenominationCSPublicRPairP *r_pub = &r_pubs[i]; json_t *csr_obj; csr_obj = GNUNET_JSON_PACK ( diff --git a/src/exchange/taler-exchange-httpd_keys.c b/src/exchange/taler-exchange-httpd_keys.c index 2e1d71824..d9c641049 100644 --- a/src/exchange/taler-exchange-httpd_keys.c +++ b/src/exchange/taler-exchange-httpd_keys.c @@ -2461,7 +2461,7 @@ enum TALER_ErrorCode TEH_keys_denomination_cs_r_pub (const struct TALER_DenominationHash *h_denom_pub, const struct TALER_CsNonce *nonce, - struct TALER_DenominationCsPublicR *r_pub) + struct TALER_DenominationCSPublicRPairP *r_pub) { struct TEH_KeyStateHandle *ksh; struct HelperDenomination *hd; diff --git a/src/exchange/taler-exchange-httpd_keys.h b/src/exchange/taler-exchange-httpd_keys.h index 57011ed22..0cab75070 100644 --- a/src/exchange/taler-exchange-httpd_keys.h +++ b/src/exchange/taler-exchange-httpd_keys.h @@ -233,7 +233,7 @@ enum TALER_ErrorCode TEH_keys_denomination_cs_r_pub (const struct TALER_DenominationHash *h_denom_pub, const struct TALER_CsNonce *nonce, - struct TALER_DenominationCsPublicR *r_pub); + struct TALER_DenominationCSPublicRPairP *r_pub); /** diff --git a/src/exchange/taler-exchange-httpd_refreshes_reveal.c b/src/exchange/taler-exchange-httpd_refreshes_reveal.c index 156993ffe..451413b70 100644 --- a/src/exchange/taler-exchange-httpd_refreshes_reveal.c +++ b/src/exchange/taler-exchange-httpd_refreshes_reveal.c @@ -182,9 +182,9 @@ check_commitment (struct RevealContext *rctx, struct TALER_PlanchetSecretsP ps; rcd->dk = &rctx->dks[j]->denom_pub; - TALER_planchet_setup_refresh (&ts, - j, - &ps); + TALER_transfer_secret_to_planchet_secret (&ts, + j, + &ps); // TODO: implement cipher handling alg_values.cipher = TALER_DENOMINATION_RSA; TALER_planchet_setup_coin_priv (&ps, diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index f9f0ce412..713e11e81 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -7212,7 +7212,7 @@ postgres_lookup_transfer_by_deposit ( GNUNET_PQ_query_param_end }; char *payto_uri; - struct TALER_WireSalt wire_salt; + struct TALER_WireSaltP wire_salt; struct GNUNET_PQ_ResultSpec rs[] = { GNUNET_PQ_result_spec_auto_from_type ("wtid_raw", wtid), diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c index d09e38fdd..8c3c7834a 100644 --- a/src/exchangedb/test_exchangedb.c +++ b/src/exchangedb/test_exchangedb.c @@ -1345,7 +1345,7 @@ run (void *cls) unsigned int cnt; enum GNUNET_DB_QueryStatus qs; struct GNUNET_TIME_Timestamp now; - struct TALER_WireSalt salt; + struct TALER_WireSaltP salt; struct TALER_CoinPubHash c_hash; uint64_t known_coin_id; uint64_t rrc_serial; diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h index e3c5caa46..b3e4ba264 100644 --- a/src/include/taler_crypto_lib.h +++ b/src/include/taler_crypto_lib.h @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2014-2021 Taler Systems SA + Copyright (C) 2014-2022 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -27,6 +27,12 @@ #include +/** + * Maximum number of fresh coins we allow per refresh operation. + */ +#define TALER_MAX_FRESH_COINS 256 + + /* ****************** Coin crypto primitives ************* */ GNUNET_NETWORK_STRUCT_BEGIN @@ -419,7 +425,7 @@ struct TALER_ClaimTokenP * Salt used to hash a merchant's payto:// URI to * compute the "h_wire" (say for deposit requests). */ -struct TALER_WireSalt +struct TALER_WireSaltP { /** * Actual 128-bit salt value. @@ -802,13 +808,13 @@ struct TALER_DenominationPrivateKey struct TALER_BlindedRsaPlanchet { /** - * blinded message to be signed + * Blinded message to be signed * Note: is malloc()'ed! */ void *blinded_msg; /** - * size of the blinded message to be signed + * Size of the @e blinded_msg to be signed. */ size_t blinded_msg_size; }; @@ -820,7 +826,7 @@ struct TALER_BlindedRsaPlanchet struct TALER_CsNonce { /** - * 32 bit nonce to include in withdrawals + * 32 bit nonce to include in withdrawals when using CS. */ struct GNUNET_CRYPTO_CsNonce nonce; }; @@ -828,7 +834,6 @@ struct TALER_CsNonce /** * @brief CS Parameters to create blinded signature - * */ struct TALER_BlindedCsPlanchet { @@ -843,9 +848,9 @@ struct TALER_BlindedCsPlanchet struct TALER_CsNonce nonce; }; + /** * @brief Type including Parameters to create blinded signature - * */ struct TALER_BlindedPlanchet { @@ -872,10 +877,11 @@ struct TALER_BlindedPlanchet } details; }; + /** * Withdraw nonce for CS denominations */ -struct TALER_RefreshNonce +struct TALER_RefreshNonceXXXDEADFIXME { /** * 32 bit nonce to include in withdrawals @@ -883,19 +889,20 @@ struct TALER_RefreshNonce struct GNUNET_CRYPTO_CsNonce nonce; }; + /** - * Public R for Cs denominations + * Pair of Public R values for Cs denominations */ -struct TALER_DenominationCsPublicR +struct TALER_DenominationCSPublicRPairP { struct GNUNET_CRYPTO_CsRPublic r_pub[2]; }; + /** * Secret r for Cs denominations */ - -struct TALER_DenominationCsPrivateR +struct TALER_DenominationCSPrivateRPairP { struct GNUNET_CRYPTO_CsRSecret r[2]; }; @@ -969,9 +976,10 @@ struct TALER_ExchangeWithdrawCsValues /** * (non-blinded) r_pub */ - struct TALER_DenominationCsPublicR r_pub; + struct TALER_DenominationCSPublicRPairP r_pub_pair; }; + /** * @brief Type of algorithm specific Values for withdrawal */ @@ -1097,7 +1105,7 @@ enum GNUNET_GenericReturnValue TALER_denom_cs_derive_r_public ( const struct TALER_CsNonce *nonce, const struct TALER_DenominationPrivateKey *denom_priv, - struct TALER_DenominationCsPublicR *r_pub); + struct TALER_DenominationCSPublicRPairP *r_pub); /** @@ -1473,9 +1481,10 @@ GNUNET_NETWORK_STRUCT_END * @param[out] ps value to initialize */ void -TALER_planchet_setup_refresh (const struct TALER_TransferSecretP *secret_seed, - uint32_t coin_num_salt, - struct TALER_PlanchetSecretsP *ps); +TALER_transfer_secret_to_planchet_secret ( + const struct TALER_TransferSecretP *secret_seed, + uint32_t coin_num_salt, + struct TALER_PlanchetSecretsP *ps); /** @@ -1490,11 +1499,12 @@ TALER_planchet_setup_random ( /** - * Create a blinding secret @a bs for @a cipher. + * Create a blinding secret @a bks given the client's @a ps and the alg_values + * from the exchange. * * @param ps secret to derive blindings from * @param alg_values withdraw values containing cipher and additional CS values - * @param bks blinding secrets + * @param[out] bks blinding secrets */ void TALER_planchet_blinding_secret_create ( @@ -1504,7 +1514,7 @@ TALER_planchet_blinding_secret_create ( /** - * Prepare a planchet for tipping. Creates and blinds a coin. + * Prepare a planchet for withdrawal. Creates and blinds a coin. * * @param dk denomination key for the coin to be created * @param alg_values algorithm specific values @@ -1527,7 +1537,7 @@ TALER_planchet_prepare (const struct TALER_DenominationPublicKey *dk, /** - * Frees blinded message inside blinded planchet depending on blinded_planchet->cipher + * Frees blinded message inside blinded planchet depending on `blinded_planchet->cipher`. * Does not free the @a blinded_planchet itself! * * @param[in] blinded_planchet blinded planchet @@ -1537,7 +1547,7 @@ TALER_blinded_planchet_free (struct TALER_BlindedPlanchet *blinded_planchet); /** - * Frees blinded message inside planchet detail. + * Frees blinded message inside planchet detail @a pd. * * @param[in] pd planchet detail to free */ @@ -1554,6 +1564,7 @@ TALER_planchet_detail_free (struct TALER_PlanchetDetail *pd); * @param bks blinding key secret * @param coin_priv private key of the coin * @param c_hash hash of the coin's public key for verification of the signature + * @param alg_values values obtained from the exchange for the withdrawal * @param[out] coin set to the details of the fresh coin * @return #GNUNET_OK on success */ @@ -1568,15 +1579,6 @@ TALER_planchet_to_coin ( struct TALER_FreshCoin *coin); -/* ****************** Refresh crypto primitives ************* */ - - -/** - * Maximum number of fresh coins we allow per refresh operation. - */ -#define TALER_MAX_FRESH_COINS 256 - - /** * Given the coin and the transfer private keys, compute the * transfer secret. (Technically, we only need one of the two @@ -1935,7 +1937,7 @@ TALER_CRYPTO_helper_cs_revoke ( * @return R, the value inside the structure will be NULL on failure, * see @a ec for details about the failure */ -struct TALER_DenominationCsPublicR +struct TALER_DenominationCSPublicRPairP TALER_CRYPTO_helper_cs_r_derive (struct TALER_CRYPTO_CsDenominationHelper *dh, const struct TALER_CsPubHashP *h_cs, const struct TALER_CsNonce *nonce, @@ -2982,7 +2984,7 @@ TALER_exchange_wire_signature_make ( */ void TALER_merchant_wire_signature_hash (const char *payto_uri, - const struct TALER_WireSalt *salt, + const struct TALER_WireSaltP *salt, struct TALER_MerchantWireHash *hc); @@ -2998,7 +3000,7 @@ TALER_merchant_wire_signature_hash (const char *payto_uri, enum GNUNET_GenericReturnValue TALER_merchant_wire_signature_check ( const char *payto_uri, - const struct TALER_WireSalt *salt, + const struct TALER_WireSaltP *salt, const struct TALER_MerchantPublicKeyP *merch_pub, const struct TALER_MerchantSignatureP *merch_sig); @@ -3014,7 +3016,7 @@ TALER_merchant_wire_signature_check ( void TALER_merchant_wire_signature_make ( const char *payto_uri, - const struct TALER_WireSalt *salt, + const struct TALER_WireSaltP *salt, const struct TALER_MerchantPrivateKeyP *merch_priv, struct TALER_MerchantSignatureP *merch_sig); diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h index a6b847bbe..65b8d72b6 100644 --- a/src/include/taler_exchange_service.h +++ b/src/include/taler_exchange_service.h @@ -922,7 +922,7 @@ TALER_EXCHANGE_deposit ( const struct TALER_Amount *amount, struct GNUNET_TIME_Timestamp wire_deadline, const char *merchant_payto_uri, - const struct TALER_WireSalt *wire_salt, + const struct TALER_WireSaltP *wire_salt, const struct TALER_PrivateContractHash *h_contract_terms, const json_t *extension_details, const struct TALER_CoinSpendPublicKeyP *coin_pub, diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h index cd68e1edb..633cf2064 100644 --- a/src/include/taler_exchangedb_plugin.h +++ b/src/include/taler_exchangedb_plugin.h @@ -340,7 +340,7 @@ struct TALER_EXCHANGEDB_TableData struct TALER_MerchantPublicKeyP merchant_pub; struct TALER_PrivateContractHash h_contract_terms; struct TALER_CoinSpendSignatureP coin_sig; - struct TALER_WireSalt wire_salt; + struct TALER_WireSaltP wire_salt; uint64_t wire_target_serial_id; bool tiny; bool done; @@ -1027,7 +1027,7 @@ struct TALER_EXCHANGEDB_Deposit /** * Salt used by the merchant to compute "h_wire". */ - struct TALER_WireSalt wire_salt; + struct TALER_WireSaltP wire_salt; /** * Information about the receiver for executing the transaction. URI in @@ -1126,7 +1126,7 @@ struct TALER_EXCHANGEDB_DepositListEntry /** * Salt used to compute h_wire from the @e receiver_wire_account. */ - struct TALER_WireSalt wire_salt; + struct TALER_WireSaltP wire_salt; /** * Time when this request was generated. Used, for example, to diff --git a/src/json/json_wire.c b/src/json/json_wire.c index 8f7fd6bb6..139f41db1 100644 --- a/src/json/json_wire.c +++ b/src/json/json_wire.c @@ -29,7 +29,7 @@ TALER_JSON_merchant_wire_signature_hash (const json_t *wire_s, struct TALER_MerchantWireHash *hc) { const char *payto_uri; - struct TALER_WireSalt salt; + struct TALER_WireSaltP salt; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_string ("payto_uri", &payto_uri), diff --git a/src/lib/exchange_api_csr.c b/src/lib/exchange_api_csr.c index dc2a18c72..9493ac04b 100644 --- a/src/lib/exchange_api_csr.c +++ b/src/lib/exchange_api_csr.c @@ -105,11 +105,11 @@ csr_ok (struct TALER_EXCHANGE_CsRHandle *csrh, struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_fixed ( "r_pub_0", - &alg_values[i].details.cs_values.r_pub.r_pub[0], + &alg_values[i].details.cs_values.r_pub_pair.r_pub[0], sizeof (struct GNUNET_CRYPTO_CsRPublic)), GNUNET_JSON_spec_fixed ( "r_pub_1", - &alg_values[i].details.cs_values.r_pub.r_pub[1], + &alg_values[i].details.cs_values.r_pub_pair.r_pub[1], sizeof (struct GNUNET_CRYPTO_CsRPublic)), GNUNET_JSON_spec_end () }; diff --git a/src/lib/exchange_api_deposit.c b/src/lib/exchange_api_deposit.c index de67bc5f2..fa3d75f5d 100644 --- a/src/lib/exchange_api_deposit.c +++ b/src/lib/exchange_api_deposit.c @@ -545,7 +545,7 @@ TALER_EXCHANGE_deposit ( const struct TALER_Amount *amount, struct GNUNET_TIME_Timestamp wire_deadline, const char *merchant_payto_uri, - const struct TALER_WireSalt *wire_salt, + const struct TALER_WireSaltP *wire_salt, const struct TALER_PrivateContractHash *h_contract_terms, const json_t *extension_details, const struct TALER_CoinSpendPublicKeyP *coin_pub, diff --git a/src/lib/exchange_api_link.c b/src/lib/exchange_api_link.c index ccc2d2648..a23a16063 100644 --- a/src/lib/exchange_api_link.c +++ b/src/lib/exchange_api_link.c @@ -120,9 +120,9 @@ parse_link_coin (const struct TALER_EXCHANGE_LinkHandle *lh, TALER_link_recover_transfer_secret (trans_pub, &lh->coin_priv, &secret); - TALER_planchet_setup_refresh (&secret, - coin_num, - &ps); + TALER_transfer_secret_to_planchet_secret (&secret, + coin_num, + &ps); // TODO: implement cipher handling alg_values.cipher = TALER_DENOMINATION_RSA; diff --git a/src/lib/exchange_api_refresh_common.c b/src/lib/exchange_api_refresh_common.c index 5580fb0f1..4e5e9c3e8 100644 --- a/src/lib/exchange_api_refresh_common.c +++ b/src/lib/exchange_api_refresh_common.c @@ -136,9 +136,9 @@ TALER_EXCHANGE_get_melt_data_ ( struct TALER_CoinSpendPrivateKeyP coin_priv; union TALER_DenominationBlindingKeyP bks; - TALER_planchet_setup_refresh (&trans_sec[i], - j, - fc); + TALER_transfer_secret_to_planchet_secret (&trans_sec[i], + j, + fc); TALER_planchet_setup_coin_priv (fc, &alg_values[j], &coin_priv); diff --git a/src/lib/exchange_api_refreshes_reveal.c b/src/lib/exchange_api_refreshes_reveal.c index 346a16e44..f936e240b 100644 --- a/src/lib/exchange_api_refreshes_reveal.c +++ b/src/lib/exchange_api_refreshes_reveal.c @@ -384,9 +384,9 @@ TALER_EXCHANGE_refreshes_reveal ( json_array_append_new (new_denoms_h, GNUNET_JSON_from_data_auto ( &denom_hash))); - TALER_planchet_setup_refresh (&ts, - i, - &ps); + TALER_transfer_secret_to_planchet_secret (&ts, + i, + &ps); TALER_planchet_setup_coin_priv (&ps, &alg_values[i], &coin_priv); diff --git a/src/testing/testing_api_cmd_deposit.c b/src/testing/testing_api_cmd_deposit.c index a0eb35f19..b2fd7ddf1 100644 --- a/src/testing/testing_api_cmd_deposit.c +++ b/src/testing/testing_api_cmd_deposit.c @@ -293,7 +293,7 @@ deposit_run (void *cls, struct TALER_MerchantPublicKeyP merchant_pub; struct TALER_PrivateContractHash h_contract_terms; enum TALER_ErrorCode ec; - struct TALER_WireSalt wire_salt; + struct TALER_WireSaltP wire_salt; const char *payto_uri; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_string ("payto_uri", diff --git a/src/testing/testing_api_helpers_bank.c b/src/testing/testing_api_helpers_bank.c index d3c7a2d73..0d8017e65 100644 --- a/src/testing/testing_api_helpers_bank.c +++ b/src/testing/testing_api_helpers_bank.c @@ -670,7 +670,7 @@ TALER_TESTING_prepare_fakebank (const char *config_filename, json_t * TALER_TESTING_make_wire_details (const char *payto) { - struct TALER_WireSalt salt; + struct TALER_WireSaltP salt; /* salt must be constant for aggregation tests! */ memset (&salt, diff --git a/src/util/crypto.c b/src/util/crypto.c index 9a913afeb..c239f7970 100644 --- a/src/util/crypto.c +++ b/src/util/crypto.c @@ -156,10 +156,10 @@ TALER_planchet_setup_random ( void -TALER_planchet_setup_refresh (const struct TALER_TransferSecretP *secret_seed, - uint32_t coin_num_salt, - struct TALER_PlanchetSecretsP *ps) - +TALER_transfer_secret_to_planchet_secret ( + const struct TALER_TransferSecretP *secret_seed, + uint32_t coin_num_salt, + struct TALER_PlanchetSecretsP *ps) { uint32_t be_salt = htonl (coin_num_salt); @@ -381,14 +381,14 @@ TALER_blinded_planchet_free (struct TALER_BlindedPlanchet *blinded_planchet) enum GNUNET_GenericReturnValue -TALER_planchet_to_coin (const struct TALER_DenominationPublicKey *dk, - const struct - TALER_BlindedDenominationSignature *blind_sig, - const union TALER_DenominationBlindingKeyP *bks, - const struct TALER_CoinSpendPrivateKeyP *coin_priv, - const struct TALER_CoinPubHash *c_hash, - const struct TALER_ExchangeWithdrawValues *alg_values, - struct TALER_FreshCoin *coin) +TALER_planchet_to_coin ( + const struct TALER_DenominationPublicKey *dk, + const struct TALER_BlindedDenominationSignature *blind_sig, + const union TALER_DenominationBlindingKeyP *bks, + const struct TALER_CoinSpendPrivateKeyP *coin_priv, + const struct TALER_CoinPubHash *c_hash, + const struct TALER_ExchangeWithdrawValues *alg_values, + struct TALER_FreshCoin *coin) { struct TALER_DenominationSignature sig; @@ -416,21 +416,20 @@ TALER_planchet_to_coin (const struct TALER_DenominationPublicKey *dk, { struct GNUNET_CRYPTO_CsC c[2]; struct GNUNET_CRYPTO_CsBlindingSecret bs[2]; - struct TALER_DenominationCsPublicR r_pub_blind; - - GNUNET_CRYPTO_cs_blinding_secrets_derive (&bks->nonce, bs); - - GNUNET_CRYPTO_cs_calc_blinded_c (bs, - alg_values->details.cs_values.r_pub.r_pub, - &dk->details.cs_public_key, - &c_hash->hash, - sizeof(struct GNUNET_HashCode), - c, - r_pub_blind.r_pub); - + struct TALER_DenominationCSPublicRPairP r_pub_blind; + + GNUNET_CRYPTO_cs_blinding_secrets_derive (&bks->nonce, + bs); + GNUNET_CRYPTO_cs_calc_blinded_c ( + bs, + alg_values->details.cs_values.r_pub_pair.r_pub, + &dk->details.cs_public_key, + &c_hash->hash, + sizeof(struct GNUNET_HashCode), + c, + r_pub_blind.r_pub); sig.details.cs_signature.r_point = r_pub_blind.r_pub[blind_sig->details.blinded_cs_answer.b]; - if (GNUNET_OK != TALER_denom_sig_unblind (&sig, blind_sig, diff --git a/src/util/crypto_helper_cs.c b/src/util/crypto_helper_cs.c index 593aa0c25..6374a5a7d 100644 --- a/src/util/crypto_helper_cs.c +++ b/src/util/crypto_helper_cs.c @@ -607,13 +607,13 @@ TALER_CRYPTO_helper_cs_revoke ( } -struct TALER_DenominationCsPublicR +struct TALER_DenominationCSPublicRPairP TALER_CRYPTO_helper_cs_r_derive (struct TALER_CRYPTO_CsDenominationHelper *dh, const struct TALER_CsPubHashP *h_cs, const struct TALER_CsNonce *nonce, enum TALER_ErrorCode *ec) { - struct TALER_DenominationCsPublicR r_pub; + struct TALER_DenominationCSPublicRPairP r_pub; memset (&r_pub, 0, diff --git a/src/util/crypto_wire.c b/src/util/crypto_wire.c index e1c7d9646..144b8ee9a 100644 --- a/src/util/crypto_wire.c +++ b/src/util/crypto_wire.c @@ -64,7 +64,7 @@ TALER_exchange_wire_signature_make ( void TALER_merchant_wire_signature_hash (const char *payto_uri, - const struct TALER_WireSalt *salt, + const struct TALER_WireSaltP *salt, struct TALER_MerchantWireHash *hc) { GNUNET_assert (GNUNET_YES == @@ -83,7 +83,7 @@ TALER_merchant_wire_signature_hash (const char *payto_uri, enum GNUNET_GenericReturnValue TALER_merchant_wire_signature_check ( const char *payto_uri, - const struct TALER_WireSalt *salt, + const struct TALER_WireSaltP *salt, const struct TALER_MerchantPublicKeyP *merch_pub, const struct TALER_MerchantSignatureP *merch_sig) { @@ -105,7 +105,7 @@ TALER_merchant_wire_signature_check ( void TALER_merchant_wire_signature_make ( const char *payto_uri, - const struct TALER_WireSalt *salt, + const struct TALER_WireSaltP *salt, const struct TALER_MerchantPrivateKeyP *merch_priv, struct TALER_MerchantSignatureP *merch_sig) { diff --git a/src/util/denom.c b/src/util/denom.c index 88bdd611f..00d7ec791 100644 --- a/src/util/denom.c +++ b/src/util/denom.c @@ -86,7 +86,7 @@ enum GNUNET_GenericReturnValue TALER_denom_cs_derive_r_public (const struct TALER_CsNonce *nonce, const struct TALER_DenominationPrivateKey *denom_priv, - struct TALER_DenominationCsPublicR *r_pub) + struct TALER_DenominationCSPublicRPairP *r_pub) { if (denom_priv->cipher != TALER_DENOMINATION_CS) { @@ -316,13 +316,14 @@ TALER_denom_priv_to_pub (const struct TALER_DenominationPrivateKey *denom_priv, enum GNUNET_GenericReturnValue -TALER_denom_blind (const struct TALER_DenominationPublicKey *dk, - const union TALER_DenominationBlindingKeyP *coin_bks, - const struct TALER_AgeHash *age_commitment_hash, - const struct TALER_CoinSpendPublicKeyP *coin_pub, - const struct TALER_ExchangeWithdrawValues *alg_values, - struct TALER_CoinPubHash *c_hash, - struct TALER_BlindedPlanchet *blinded_planchet) +TALER_denom_blind ( + const struct TALER_DenominationPublicKey *dk, + const union TALER_DenominationBlindingKeyP *coin_bks, + const struct TALER_AgeHash *age_commitment_hash, + const struct TALER_CoinSpendPublicKeyP *coin_pub, + const struct TALER_ExchangeWithdrawValues *alg_values, + struct TALER_CoinPubHash *c_hash, + struct TALER_BlindedPlanchet *blinded_planchet) { TALER_coin_pub_hash (coin_pub, age_commitment_hash, @@ -348,19 +349,20 @@ TALER_denom_blind (const struct TALER_DenominationPublicKey *dk, case TALER_DENOMINATION_CS: { blinded_planchet->cipher = dk->cipher; - struct TALER_DenominationCsPublicR blinded_r_pub; + struct TALER_DenominationCSPublicRPairP blinded_r_pub; struct GNUNET_CRYPTO_CsBlindingSecret bs[2]; - GNUNET_CRYPTO_cs_blinding_secrets_derive (&coin_bks->nonce, bs); - - GNUNET_CRYPTO_cs_calc_blinded_c (bs, - alg_values->details.cs_values.r_pub.r_pub, - &dk->details.cs_public_key, - &c_hash->hash, - sizeof(struct GNUNET_HashCode), - blinded_planchet->details. - cs_blinded_planchet.c, - blinded_r_pub.r_pub); + GNUNET_CRYPTO_cs_blinding_secrets_derive (&coin_bks->nonce, + bs); + GNUNET_CRYPTO_cs_calc_blinded_c ( + bs, + alg_values->details.cs_values.r_pub_pair.r_pub, + &dk->details.cs_public_key, + &c_hash->hash, + sizeof(struct GNUNET_HashCode), + blinded_planchet->details. + cs_blinded_planchet.c, + blinded_r_pub.r_pub); return GNUNET_OK; } default: diff --git a/src/util/taler-exchange-secmod-cs.c b/src/util/taler-exchange-secmod-cs.c index a47e9f220..1c4625e79 100644 --- a/src/util/taler-exchange-secmod-cs.c +++ b/src/util/taler-exchange-secmod-cs.c @@ -553,8 +553,8 @@ handle_r_derive_request (struct TES_Client *client, const struct TALER_CRYPTO_CsRDeriveRequest *rdr) { struct DenominationKey *dk; - struct TALER_DenominationCsPrivateR r_priv; - struct TALER_DenominationCsPublicR r_pub; + struct TALER_DenominationCSPrivateRPairP r_priv; + struct TALER_DenominationCSPublicRPairP r_pub; struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); GNUNET_assert (0 == pthread_mutex_lock (&keys_lock)); diff --git a/src/util/taler-exchange-secmod-cs.h b/src/util/taler-exchange-secmod-cs.h index 6c3f9232a..a6cbfcf23 100644 --- a/src/util/taler-exchange-secmod-cs.h +++ b/src/util/taler-exchange-secmod-cs.h @@ -227,7 +227,7 @@ struct TALER_CRYPTO_RDeriveResponse /** * derived R */ - struct TALER_DenominationCsPublicR r_pub; + struct TALER_DenominationCSPublicRPairP r_pub; }; diff --git a/src/util/test_crypto.c b/src/util/test_crypto.c index 8b136e73f..46ed2b92b 100644 --- a/src/util/test_crypto.c +++ b/src/util/test_crypto.c @@ -68,9 +68,9 @@ test_high_level (void) GNUNET_assert (0 == GNUNET_memcmp (&secret, &secret2)); - TALER_planchet_setup_refresh (&secret, - 0, - &ps1); + TALER_transfer_secret_to_planchet_secret (&secret, + 0, + &ps1); alg1.cipher = TALER_DENOMINATION_RSA; TALER_planchet_setup_coin_priv (&ps1, &alg1, @@ -79,9 +79,9 @@ test_high_level (void) &alg1, &bks1); alg2.cipher = TALER_DENOMINATION_RSA; - TALER_planchet_setup_refresh (&secret, - 1, - &ps2); + TALER_transfer_secret_to_planchet_secret (&secret, + 1, + &ps2); TALER_planchet_setup_coin_priv (&ps2, &alg2, &coin_priv2); @@ -307,7 +307,7 @@ static int test_merchant_sigs (void) { const char *pt = "payto://x-taler-bank/localhost/Account"; - struct TALER_WireSalt salt; + struct TALER_WireSaltP salt; struct TALER_MerchantPrivateKeyP priv; struct TALER_MerchantPublicKeyP pub; struct TALER_MerchantSignatureP sig; -- cgit v1.2.3