-simplify structures

This commit is contained in:
Christian Grothoff 2022-02-11 11:55:59 +01:00
parent 3b9d67a6f8
commit 4472cbaf9d
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
10 changed files with 16 additions and 39 deletions

View File

@ -108,7 +108,7 @@ TEH_handler_csr (struct TEH_RequestContext *rc,
const struct TALER_CsNonce *nonce = &nonces[i]; const struct TALER_CsNonce *nonce = &nonces[i];
const struct TALER_DenominationHash *denom_pub_hash = &denom_pub_hashes[i]; const struct TALER_DenominationHash *denom_pub_hash = &denom_pub_hashes[i];
struct TALER_DenominationCSPublicRPairP *r_pub struct TALER_DenominationCSPublicRPairP *r_pub
= &ewvs[i].details.cs_values.r_pub_pair; = &ewvs[i].details.cs_values;
ewvs[i].cipher = TALER_DENOMINATION_CS; ewvs[i].cipher = TALER_DENOMINATION_CS;
// check denomination referenced by denom_pub_hash // check denomination referenced by denom_pub_hash

View File

@ -204,7 +204,7 @@ check_commitment (struct RevealContext *rctx,
ec = TEH_keys_denomination_cs_r_pub ( ec = TEH_keys_denomination_cs_r_pub (
&rctx->rrcs[j].h_denom_pub, &rctx->rrcs[j].h_denom_pub,
&nonces[aoff], &nonces[aoff],
&alg_values->details.cs_values.r_pub_pair); &alg_values->details.cs_values);
if (TALER_EC_NONE != ec) if (TALER_EC_NONE != ec)
{ {
*mhd_ret = TALER_MHD_reply_with_error (connection, *mhd_ret = TALER_MHD_reply_with_error (connection,

View File

@ -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 * 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 * @brief Type of algorithm specific Values for withdrawal
*/ */
@ -1015,7 +991,7 @@ struct TALER_ExchangeWithdrawValues
/** /**
* If we use #TALER_DENOMINATION_CS in @a cipher. * If we use #TALER_DENOMINATION_CS in @a cipher.
*/ */
struct TALER_ExchangeWithdrawCsValues cs_values; struct TALER_DenominationCSPublicRPairP cs_values;
} details; } details;
@ -2010,6 +1986,7 @@ TALER_CRYPTO_helper_cs_revoke (
* @return R, the value inside the structure will be NULL on failure, * @return R, the value inside the structure will be NULL on failure,
* see @a ec for details about the failure * see @a ec for details about the failure
*/ */
// FIXME: swap rval and ec!
struct TALER_DenominationCSPublicRPairP struct TALER_DenominationCSPublicRPairP
TALER_CRYPTO_helper_cs_r_derive (struct TALER_CRYPTO_CsDenominationHelper *dh, TALER_CRYPTO_helper_cs_r_derive (struct TALER_CRYPTO_CsDenominationHelper *dh,
const struct TALER_CsPubHashP *h_cs, const struct TALER_CsPubHashP *h_cs,

View File

@ -733,11 +733,11 @@ parse_exchange_withdraw_values (void *cls,
struct GNUNET_JSON_Specification ispec[] = { struct GNUNET_JSON_Specification ispec[] = {
GNUNET_JSON_spec_fixed ( GNUNET_JSON_spec_fixed (
"r_pub_0", "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)), sizeof (struct GNUNET_CRYPTO_CsRPublic)),
GNUNET_JSON_spec_fixed ( GNUNET_JSON_spec_fixed (
"r_pub_1", "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)), sizeof (struct GNUNET_CRYPTO_CsRPublic)),
GNUNET_JSON_spec_end () GNUNET_JSON_spec_end ()
}; };

View File

@ -142,11 +142,11 @@ TALER_JSON_pack_exchange_withdraw_values (
TALER_DENOMINATION_CS), TALER_DENOMINATION_CS),
GNUNET_JSON_pack_data_varsize ( GNUNET_JSON_pack_data_varsize (
"r_pub_0", "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)), sizeof(struct GNUNET_CRYPTO_CsRPublic)),
GNUNET_JSON_pack_data_varsize ( GNUNET_JSON_pack_data_varsize (
"r_pub_1", "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)) sizeof(struct GNUNET_CRYPTO_CsRPublic))
); );
break; break;

View File

@ -571,7 +571,7 @@ qconv_exchange_withdraw_values (void *cls,
tlen = 0; tlen = 0;
break; break;
case TALER_DENOMINATION_CS: case TALER_DENOMINATION_CS:
tlen = sizeof (struct TALER_ExchangeWithdrawCsValues); tlen = sizeof (struct TALER_DenominationCSPublicRPairP);
break; break;
default: default:
GNUNET_assert (0); GNUNET_assert (0);

View File

@ -930,7 +930,7 @@ extract_exchange_withdraw_values (void *cls,
} }
return GNUNET_OK; return GNUNET_OK;
case TALER_DENOMINATION_CS: case TALER_DENOMINATION_CS:
if (sizeof (struct TALER_ExchangeWithdrawCsValues) != len) if (sizeof (struct TALER_DenominationCSPublicRPairP) != len)
{ {
GNUNET_break (0); GNUNET_break (0);
return GNUNET_SYSERR; return GNUNET_SYSERR;

View File

@ -207,7 +207,7 @@ TALER_denom_sig_unblind (
bs); bs);
GNUNET_CRYPTO_cs_calc_blinded_c ( GNUNET_CRYPTO_cs_calc_blinded_c (
bs, bs,
alg_values->details.cs_values.r_pub_pair.r_pub, alg_values->details.cs_values.r_pub,
&denom_pub->details.cs_public_key, &denom_pub->details.cs_public_key,
&c_hash->hash, &c_hash->hash,
sizeof(struct GNUNET_HashCode), sizeof(struct GNUNET_HashCode),
@ -369,7 +369,7 @@ TALER_denom_blind (
bs); bs);
GNUNET_CRYPTO_cs_calc_blinded_c ( GNUNET_CRYPTO_cs_calc_blinded_c (
bs, bs,
alg_values->details.cs_values.r_pub_pair.r_pub, alg_values->details.cs_values.r_pub,
&dk->details.cs_public_key, &dk->details.cs_public_key,
c_hash, c_hash,
sizeof(*c_hash), sizeof(*c_hash),

View File

@ -210,7 +210,7 @@ test_planchets_cs (void)
TALER_denom_cs_derive_r_public ( TALER_denom_cs_derive_r_public (
&pd.blinded_planchet.details.cs_blinded_planchet.nonce, &pd.blinded_planchet.details.cs_blinded_planchet.nonce,
&dk_priv, &dk_priv,
&alg_values.details.cs_values.r_pub_pair)); &alg_values.details.cs_values));
TALER_planchet_setup_coin_priv (&ps, TALER_planchet_setup_coin_priv (&ps,
&alg_values, &alg_values,
&coin_priv); &coin_priv);

View File

@ -297,7 +297,7 @@ test_r_derive (struct TALER_CRYPTO_CsDenominationHelper *dh)
"Requesting R derivation with key %s\n", "Requesting R derivation with key %s\n",
GNUNET_h2s (&keys[i].h_cs.hash)); 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, = TALER_CRYPTO_helper_cs_r_derive (dh,
&keys[i].h_cs, &keys[i].h_cs,
&pd.blinded_planchet. &pd.blinded_planchet.
@ -440,7 +440,7 @@ test_signing (struct TALER_CRYPTO_CsDenominationHelper *dh)
TALER_cs_withdraw_nonce_derive (&ps, TALER_cs_withdraw_nonce_derive (&ps,
&pd.blinded_planchet.details. &pd.blinded_planchet.details.
cs_blinded_planchet.nonce); cs_blinded_planchet.nonce);
alg_values.details.cs_values.r_pub_pair alg_values.details.cs_values
= TALER_CRYPTO_helper_cs_r_derive (dh, = TALER_CRYPTO_helper_cs_r_derive (dh,
&keys[i].h_cs, &keys[i].h_cs,
&pd.blinded_planchet. &pd.blinded_planchet.
@ -630,7 +630,7 @@ perf_signing (struct TALER_CRYPTO_CsDenominationHelper *dh,
&pd.blinded_planchet.details. &pd.blinded_planchet.details.
cs_blinded_planchet.nonce); cs_blinded_planchet.nonce);
alg_values.details.cs_values.r_pub_pair alg_values.details.cs_values
= TALER_CRYPTO_helper_cs_r_derive (dh, = TALER_CRYPTO_helper_cs_r_derive (dh,
&keys[i].h_cs, &keys[i].h_cs,
&pd.blinded_planchet. &pd.blinded_planchet.