From 4472cbaf9d1b17733caee421593a5229215df1a2 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 11 Feb 2022 11:55:59 +0100 Subject: -simplify structures --- src/exchange/taler-exchange-httpd_csr.c | 2 +- .../taler-exchange-httpd_refreshes_reveal.c | 2 +- src/include/taler_crypto_lib.h | 27 ++-------------------- src/json/json_helper.c | 4 ++-- src/json/json_pack.c | 4 ++-- src/pq/pq_query_helper.c | 2 +- src/pq/pq_result_helper.c | 2 +- src/util/denom.c | 4 ++-- src/util/test_crypto.c | 2 +- src/util/test_helper_cs.c | 6 ++--- 10 files changed, 16 insertions(+), 39 deletions(-) diff --git a/src/exchange/taler-exchange-httpd_csr.c b/src/exchange/taler-exchange-httpd_csr.c index 02bdb7dd6..1701b7a47 100644 --- a/src/exchange/taler-exchange-httpd_csr.c +++ b/src/exchange/taler-exchange-httpd_csr.c @@ -108,7 +108,7 @@ TEH_handler_csr (struct TEH_RequestContext *rc, const struct TALER_CsNonce *nonce = &nonces[i]; const struct TALER_DenominationHash *denom_pub_hash = &denom_pub_hashes[i]; struct TALER_DenominationCSPublicRPairP *r_pub - = &ewvs[i].details.cs_values.r_pub_pair; + = &ewvs[i].details.cs_values; ewvs[i].cipher = TALER_DENOMINATION_CS; // check denomination referenced by denom_pub_hash diff --git a/src/exchange/taler-exchange-httpd_refreshes_reveal.c b/src/exchange/taler-exchange-httpd_refreshes_reveal.c index d6e9f95e8..c8af86340 100644 --- a/src/exchange/taler-exchange-httpd_refreshes_reveal.c +++ b/src/exchange/taler-exchange-httpd_refreshes_reveal.c @@ -204,7 +204,7 @@ check_commitment (struct RevealContext *rctx, ec = TEH_keys_denomination_cs_r_pub ( &rctx->rrcs[j].h_denom_pub, &nonces[aoff], - &alg_values->details.cs_values.r_pub_pair); + &alg_values->details.cs_values); if (TALER_EC_NONE != ec) { *mhd_ret = TALER_MHD_reply_with_error (connection, diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h index b6dccda46..df6dd732c 100644 --- a/src/include/taler_crypto_lib.h +++ b/src/include/taler_crypto_lib.h @@ -894,18 +894,6 @@ struct TALER_BlindedPlanchet }; -/** - * Withdraw nonce for CS denominations - */ -struct TALER_RefreshNonceXXXDEADFIXME -{ - /** - * 32 bit nonce to include in withdrawals - */ - struct GNUNET_CRYPTO_CsNonce nonce; -}; - - /** * Pair of Public R values for Cs denominations */ @@ -984,18 +972,6 @@ struct TALER_TrackTransferDetails }; -/** - * @brief Type of CS Values for withdrawal - */ -struct TALER_ExchangeWithdrawCsValues -{ - /** - * (non-blinded) r_pub - */ - struct TALER_DenominationCSPublicRPairP r_pub_pair; -}; - - /** * @brief Type of algorithm specific Values for withdrawal */ @@ -1015,7 +991,7 @@ struct TALER_ExchangeWithdrawValues /** * If we use #TALER_DENOMINATION_CS in @a cipher. */ - struct TALER_ExchangeWithdrawCsValues cs_values; + struct TALER_DenominationCSPublicRPairP cs_values; } details; @@ -2010,6 +1986,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 */ +// FIXME: swap rval and ec! struct TALER_DenominationCSPublicRPairP TALER_CRYPTO_helper_cs_r_derive (struct TALER_CRYPTO_CsDenominationHelper *dh, const struct TALER_CsPubHashP *h_cs, diff --git a/src/json/json_helper.c b/src/json/json_helper.c index c304bf22f..7c5f7dde2 100644 --- a/src/json/json_helper.c +++ b/src/json/json_helper.c @@ -733,11 +733,11 @@ parse_exchange_withdraw_values (void *cls, struct GNUNET_JSON_Specification ispec[] = { GNUNET_JSON_spec_fixed ( "r_pub_0", - &ewv->details.cs_values.r_pub_pair.r_pub[0], + &ewv->details.cs_values.r_pub[0], sizeof (struct GNUNET_CRYPTO_CsRPublic)), GNUNET_JSON_spec_fixed ( "r_pub_1", - &ewv->details.cs_values.r_pub_pair.r_pub[1], + &ewv->details.cs_values.r_pub[1], sizeof (struct GNUNET_CRYPTO_CsRPublic)), GNUNET_JSON_spec_end () }; diff --git a/src/json/json_pack.c b/src/json/json_pack.c index 043fa8463..535e8fa1c 100644 --- a/src/json/json_pack.c +++ b/src/json/json_pack.c @@ -142,11 +142,11 @@ TALER_JSON_pack_exchange_withdraw_values ( TALER_DENOMINATION_CS), GNUNET_JSON_pack_data_varsize ( "r_pub_0", - &ewv->details.cs_values.r_pub_pair.r_pub[0], + &ewv->details.cs_values.r_pub[0], sizeof(struct GNUNET_CRYPTO_CsRPublic)), GNUNET_JSON_pack_data_varsize ( "r_pub_1", - &ewv->details.cs_values.r_pub_pair.r_pub[1], + &ewv->details.cs_values.r_pub[1], sizeof(struct GNUNET_CRYPTO_CsRPublic)) ); break; diff --git a/src/pq/pq_query_helper.c b/src/pq/pq_query_helper.c index 9bffdd320..efa250125 100644 --- a/src/pq/pq_query_helper.c +++ b/src/pq/pq_query_helper.c @@ -571,7 +571,7 @@ qconv_exchange_withdraw_values (void *cls, tlen = 0; break; case TALER_DENOMINATION_CS: - tlen = sizeof (struct TALER_ExchangeWithdrawCsValues); + tlen = sizeof (struct TALER_DenominationCSPublicRPairP); break; default: GNUNET_assert (0); diff --git a/src/pq/pq_result_helper.c b/src/pq/pq_result_helper.c index 33edc889b..92022d61e 100644 --- a/src/pq/pq_result_helper.c +++ b/src/pq/pq_result_helper.c @@ -930,7 +930,7 @@ extract_exchange_withdraw_values (void *cls, } return GNUNET_OK; case TALER_DENOMINATION_CS: - if (sizeof (struct TALER_ExchangeWithdrawCsValues) != len) + if (sizeof (struct TALER_DenominationCSPublicRPairP) != len) { GNUNET_break (0); return GNUNET_SYSERR; diff --git a/src/util/denom.c b/src/util/denom.c index df5035d1e..68ad04f39 100644 --- a/src/util/denom.c +++ b/src/util/denom.c @@ -207,7 +207,7 @@ TALER_denom_sig_unblind ( bs); GNUNET_CRYPTO_cs_calc_blinded_c ( bs, - alg_values->details.cs_values.r_pub_pair.r_pub, + alg_values->details.cs_values.r_pub, &denom_pub->details.cs_public_key, &c_hash->hash, sizeof(struct GNUNET_HashCode), @@ -369,7 +369,7 @@ TALER_denom_blind ( bs); GNUNET_CRYPTO_cs_calc_blinded_c ( bs, - alg_values->details.cs_values.r_pub_pair.r_pub, + alg_values->details.cs_values.r_pub, &dk->details.cs_public_key, c_hash, sizeof(*c_hash), diff --git a/src/util/test_crypto.c b/src/util/test_crypto.c index 0c83555d7..94d3167e3 100644 --- a/src/util/test_crypto.c +++ b/src/util/test_crypto.c @@ -210,7 +210,7 @@ test_planchets_cs (void) TALER_denom_cs_derive_r_public ( &pd.blinded_planchet.details.cs_blinded_planchet.nonce, &dk_priv, - &alg_values.details.cs_values.r_pub_pair)); + &alg_values.details.cs_values)); TALER_planchet_setup_coin_priv (&ps, &alg_values, &coin_priv); diff --git a/src/util/test_helper_cs.c b/src/util/test_helper_cs.c index 3298834a6..562cd16bf 100644 --- a/src/util/test_helper_cs.c +++ b/src/util/test_helper_cs.c @@ -297,7 +297,7 @@ test_r_derive (struct TALER_CRYPTO_CsDenominationHelper *dh) "Requesting R derivation with key %s\n", GNUNET_h2s (&keys[i].h_cs.hash)); - alg_values.details.cs_values.r_pub_pair + alg_values.details.cs_values = TALER_CRYPTO_helper_cs_r_derive (dh, &keys[i].h_cs, &pd.blinded_planchet. @@ -440,7 +440,7 @@ test_signing (struct TALER_CRYPTO_CsDenominationHelper *dh) TALER_cs_withdraw_nonce_derive (&ps, &pd.blinded_planchet.details. cs_blinded_planchet.nonce); - alg_values.details.cs_values.r_pub_pair + alg_values.details.cs_values = TALER_CRYPTO_helper_cs_r_derive (dh, &keys[i].h_cs, &pd.blinded_planchet. @@ -630,7 +630,7 @@ perf_signing (struct TALER_CRYPTO_CsDenominationHelper *dh, &pd.blinded_planchet.details. cs_blinded_planchet.nonce); - alg_values.details.cs_values.r_pub_pair + alg_values.details.cs_values = TALER_CRYPTO_helper_cs_r_derive (dh, &keys[i].h_cs, &pd.blinded_planchet. -- cgit v1.2.3