rename: TALER_FreshCoinP -> TALER_PlanchetSecretsP, and TALER_setup_fresh_coin -> TALER_setup_planchet
This commit is contained in:
parent
a946dc30bb
commit
a491a4709a
@ -117,7 +117,7 @@ struct MeltDataP
|
|||||||
1) struct MeltedCoinP melted_coins[num_melted_coins];
|
1) struct MeltedCoinP melted_coins[num_melted_coins];
|
||||||
2) struct TALER_EXCHANGE_DenomPublicKey fresh_pks[num_fresh_coins];
|
2) struct TALER_EXCHANGE_DenomPublicKey fresh_pks[num_fresh_coins];
|
||||||
3) TALER_CNC_KAPPA times:
|
3) TALER_CNC_KAPPA times:
|
||||||
3a) struct TALER_FreshCoinP fresh_coins[num_fresh_coins];
|
3a) struct TALER_PlanchetSecretsP fresh_coins[num_fresh_coins];
|
||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -204,7 +204,7 @@ struct MeltData
|
|||||||
* Arrays of @e num_fresh_coins with information about the fresh
|
* Arrays of @e num_fresh_coins with information about the fresh
|
||||||
* coins to be created, for each cut-and-choose dimension.
|
* coins to be created, for each cut-and-choose dimension.
|
||||||
*/
|
*/
|
||||||
struct TALER_FreshCoinP *fresh_coins[TALER_CNC_KAPPA];
|
struct TALER_PlanchetSecretsP *fresh_coins[TALER_CNC_KAPPA];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -490,15 +490,15 @@ deserialize_denomination_key (struct TALER_DenominationPublicKey *dk,
|
|||||||
* @a buf is NULL, number of bytes required
|
* @a buf is NULL, number of bytes required
|
||||||
*/
|
*/
|
||||||
static size_t
|
static size_t
|
||||||
serialize_fresh_coin (const struct TALER_FreshCoinP *fc,
|
serialize_fresh_coin (const struct TALER_PlanchetSecretsP *fc,
|
||||||
char *buf,
|
char *buf,
|
||||||
size_t off)
|
size_t off)
|
||||||
{
|
{
|
||||||
if (NULL != buf)
|
if (NULL != buf)
|
||||||
memcpy (&buf[off],
|
memcpy (&buf[off],
|
||||||
fc,
|
fc,
|
||||||
sizeof (struct TALER_FreshCoinP));
|
sizeof (struct TALER_PlanchetSecretsP));
|
||||||
return sizeof (struct TALER_FreshCoinP);
|
return sizeof (struct TALER_PlanchetSecretsP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -512,12 +512,12 @@ serialize_fresh_coin (const struct TALER_FreshCoinP *fc,
|
|||||||
* @return number of bytes read from @a buf, 0 on error
|
* @return number of bytes read from @a buf, 0 on error
|
||||||
*/
|
*/
|
||||||
static size_t
|
static size_t
|
||||||
deserialize_fresh_coin (struct TALER_FreshCoinP *fc,
|
deserialize_fresh_coin (struct TALER_PlanchetSecretsP *fc,
|
||||||
const char *buf,
|
const char *buf,
|
||||||
size_t size,
|
size_t size,
|
||||||
int *ok)
|
int *ok)
|
||||||
{
|
{
|
||||||
if (size < sizeof (struct TALER_FreshCoinP))
|
if (size < sizeof (struct TALER_PlanchetSecretsP))
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
*ok = GNUNET_NO;
|
*ok = GNUNET_NO;
|
||||||
@ -525,8 +525,8 @@ deserialize_fresh_coin (struct TALER_FreshCoinP *fc,
|
|||||||
}
|
}
|
||||||
memcpy (fc,
|
memcpy (fc,
|
||||||
buf,
|
buf,
|
||||||
sizeof (struct TALER_FreshCoinP));
|
sizeof (struct TALER_PlanchetSecretsP));
|
||||||
return sizeof (struct TALER_FreshCoinP);
|
return sizeof (struct TALER_PlanchetSecretsP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -617,7 +617,7 @@ deserialize_melt_data (const char *buf,
|
|||||||
struct TALER_DenominationPublicKey);
|
struct TALER_DenominationPublicKey);
|
||||||
for (i=0;i<TALER_CNC_KAPPA;i++)
|
for (i=0;i<TALER_CNC_KAPPA;i++)
|
||||||
md->fresh_coins[i] = GNUNET_new_array (md->num_fresh_coins,
|
md->fresh_coins[i] = GNUNET_new_array (md->num_fresh_coins,
|
||||||
struct TALER_FreshCoinP);
|
struct TALER_PlanchetSecretsP);
|
||||||
off = sizeof (struct MeltDataP);
|
off = sizeof (struct MeltDataP);
|
||||||
ok = GNUNET_YES;
|
ok = GNUNET_YES;
|
||||||
off += deserialize_melted_coin (&md->melted_coin,
|
off += deserialize_melted_coin (&md->melted_coin,
|
||||||
@ -753,10 +753,10 @@ TALER_EXCHANGE_refresh_prepare (const struct TALER_CoinSpendPrivateKeyP *melt_pr
|
|||||||
for (i=0;i<TALER_CNC_KAPPA;i++)
|
for (i=0;i<TALER_CNC_KAPPA;i++)
|
||||||
{
|
{
|
||||||
md.fresh_coins[i] = GNUNET_new_array (fresh_pks_len,
|
md.fresh_coins[i] = GNUNET_new_array (fresh_pks_len,
|
||||||
struct TALER_FreshCoinP);
|
struct TALER_PlanchetSecretsP);
|
||||||
for (j=0;j<fresh_pks_len;j++)
|
for (j=0;j<fresh_pks_len;j++)
|
||||||
{
|
{
|
||||||
TALER_setup_fresh_coin (&trans_sec[i],
|
TALER_setup_planchet (&trans_sec[i],
|
||||||
j,
|
j,
|
||||||
&md.fresh_coins[i][j]);
|
&md.fresh_coins[i][j]);
|
||||||
}
|
}
|
||||||
@ -824,7 +824,7 @@ TALER_EXCHANGE_refresh_prepare (const struct TALER_CoinSpendPrivateKeyP *melt_pr
|
|||||||
{
|
{
|
||||||
for (j = 0; j < fresh_pks_len; j++)
|
for (j = 0; j < fresh_pks_len; j++)
|
||||||
{
|
{
|
||||||
const struct TALER_FreshCoinP *fc; /* coin this is about */
|
const struct TALER_PlanchetSecretsP *fc; /* coin this is about */
|
||||||
struct TALER_CoinSpendPublicKeyP coin_pub;
|
struct TALER_CoinSpendPublicKeyP coin_pub;
|
||||||
struct GNUNET_HashCode coin_hash;
|
struct GNUNET_HashCode coin_hash;
|
||||||
char *coin_ev; /* blinded message to be signed (in envelope) for each coin */
|
char *coin_ev; /* blinded message to be signed (in envelope) for each coin */
|
||||||
@ -1293,7 +1293,7 @@ TALER_EXCHANGE_refresh_melt (struct TALER_EXCHANGE_Handle *exchange,
|
|||||||
tmp = json_array ();
|
tmp = json_array ();
|
||||||
for (i=0;i<md->num_fresh_coins;i++)
|
for (i=0;i<md->num_fresh_coins;i++)
|
||||||
{
|
{
|
||||||
const struct TALER_FreshCoinP *fc = &md->fresh_coins[j][i];
|
const struct TALER_PlanchetSecretsP *fc = &md->fresh_coins[j][i];
|
||||||
struct TALER_CoinSpendPublicKeyP coin_pub;
|
struct TALER_CoinSpendPublicKeyP coin_pub;
|
||||||
struct GNUNET_HashCode coin_hash;
|
struct GNUNET_HashCode coin_hash;
|
||||||
char *coin_ev; /* blinded message to be signed (in envelope) for each coin */
|
char *coin_ev; /* blinded message to be signed (in envelope) for each coin */
|
||||||
@ -1506,7 +1506,7 @@ refresh_reveal_ok (struct TALER_EXCHANGE_RefreshRevealHandle *rrh,
|
|||||||
}
|
}
|
||||||
for (i=0;i<rrh->md->num_fresh_coins;i++)
|
for (i=0;i<rrh->md->num_fresh_coins;i++)
|
||||||
{
|
{
|
||||||
const struct TALER_FreshCoinP *fc;
|
const struct TALER_PlanchetSecretsP *fc;
|
||||||
struct TALER_DenominationPublicKey *pk;
|
struct TALER_DenominationPublicKey *pk;
|
||||||
json_t *jsonai;
|
json_t *jsonai;
|
||||||
struct GNUNET_CRYPTO_RsaSignature *blind_sig;
|
struct GNUNET_CRYPTO_RsaSignature *blind_sig;
|
||||||
|
@ -99,7 +99,7 @@ parse_refresh_link_coin (const struct TALER_EXCHANGE_RefreshLinkHandle *rlh,
|
|||||||
GNUNET_JSON_spec_end()
|
GNUNET_JSON_spec_end()
|
||||||
};
|
};
|
||||||
struct TALER_TransferSecretP secret;
|
struct TALER_TransferSecretP secret;
|
||||||
struct TALER_FreshCoinP fc;
|
struct TALER_PlanchetSecretsP fc;
|
||||||
|
|
||||||
/* parse reply */
|
/* parse reply */
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
@ -114,7 +114,7 @@ parse_refresh_link_coin (const struct TALER_EXCHANGE_RefreshLinkHandle *rlh,
|
|||||||
TALER_link_recover_transfer_secret (trans_pub,
|
TALER_link_recover_transfer_secret (trans_pub,
|
||||||
&rlh->coin_priv,
|
&rlh->coin_priv,
|
||||||
&secret);
|
&secret);
|
||||||
TALER_setup_fresh_coin (&secret,
|
TALER_setup_planchet (&secret,
|
||||||
coin_num,
|
coin_num,
|
||||||
&fc);
|
&fc);
|
||||||
|
|
||||||
|
@ -171,13 +171,13 @@ check_commitment (struct MHD_Connection *connection,
|
|||||||
/* Check that the commitments for all new coins were correct */
|
/* Check that the commitments for all new coins were correct */
|
||||||
for (unsigned int j = 0; j < num_newcoins; j++)
|
for (unsigned int j = 0; j < num_newcoins; j++)
|
||||||
{
|
{
|
||||||
struct TALER_FreshCoinP fc;
|
struct TALER_PlanchetSecretsP fc;
|
||||||
struct TALER_CoinSpendPublicKeyP coin_pub;
|
struct TALER_CoinSpendPublicKeyP coin_pub;
|
||||||
struct GNUNET_HashCode h_msg;
|
struct GNUNET_HashCode h_msg;
|
||||||
char *buf;
|
char *buf;
|
||||||
size_t buf_len;
|
size_t buf_len;
|
||||||
|
|
||||||
TALER_setup_fresh_coin (&transfer_secret,
|
TALER_setup_planchet (&transfer_secret,
|
||||||
j,
|
j,
|
||||||
&fc);
|
&fc);
|
||||||
GNUNET_CRYPTO_eddsa_key_get_public (&fc.coin_priv.eddsa_priv,
|
GNUNET_CRYPTO_eddsa_key_get_public (&fc.coin_priv.eddsa_priv,
|
||||||
|
@ -522,7 +522,7 @@ TALER_link_recover_transfer_secret (const struct TALER_TransferPublicKeyP *trans
|
|||||||
* Header for serializations of coin-specific information about the
|
* Header for serializations of coin-specific information about the
|
||||||
* fresh coins we generate during a melt.
|
* fresh coins we generate during a melt.
|
||||||
*/
|
*/
|
||||||
struct TALER_FreshCoinP
|
struct TALER_PlanchetSecretsP
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -548,9 +548,9 @@ struct TALER_FreshCoinP
|
|||||||
* @param[out] fc value to initialize
|
* @param[out] fc value to initialize
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
TALER_setup_fresh_coin (const struct TALER_TransferSecretP *secret_seed,
|
TALER_setup_planchet (const struct TALER_TransferSecretP *secret_seed,
|
||||||
unsigned int coin_num_salt,
|
unsigned int coin_num_salt,
|
||||||
struct TALER_FreshCoinP *fc);
|
struct TALER_PlanchetSecretsP *fc);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -178,9 +178,9 @@ TALER_link_recover_transfer_secret (const struct TALER_TransferPublicKeyP *trans
|
|||||||
* @param[out] fc value to initialize
|
* @param[out] fc value to initialize
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
TALER_setup_fresh_coin (const struct TALER_TransferSecretP *secret_seed,
|
TALER_setup_planchet (const struct TALER_TransferSecretP *secret_seed,
|
||||||
unsigned int coin_num_salt,
|
unsigned int coin_num_salt,
|
||||||
struct TALER_FreshCoinP *fc)
|
struct TALER_PlanchetSecretsP *fc)
|
||||||
{
|
{
|
||||||
uint32_t be_salt = htonl (coin_num_salt);
|
uint32_t be_salt = htonl (coin_num_salt);
|
||||||
uint8_t *p;
|
uint8_t *p;
|
||||||
|
@ -40,8 +40,8 @@ test_high_level ()
|
|||||||
struct TALER_TransferPublicKeyP trans_pub;
|
struct TALER_TransferPublicKeyP trans_pub;
|
||||||
struct TALER_TransferSecretP secret;
|
struct TALER_TransferSecretP secret;
|
||||||
struct TALER_TransferSecretP secret2;
|
struct TALER_TransferSecretP secret2;
|
||||||
struct TALER_FreshCoinP fc1;
|
struct TALER_PlanchetSecretsP fc1;
|
||||||
struct TALER_FreshCoinP fc2;
|
struct TALER_PlanchetSecretsP fc2;
|
||||||
|
|
||||||
pk = GNUNET_CRYPTO_eddsa_key_create ();
|
pk = GNUNET_CRYPTO_eddsa_key_create ();
|
||||||
coin_priv.eddsa_priv = *pk;
|
coin_priv.eddsa_priv = *pk;
|
||||||
@ -70,16 +70,16 @@ test_high_level ()
|
|||||||
memcmp (&secret,
|
memcmp (&secret,
|
||||||
&secret2,
|
&secret2,
|
||||||
sizeof (secret)));
|
sizeof (secret)));
|
||||||
TALER_setup_fresh_coin (&secret,
|
TALER_setup_planchet (&secret,
|
||||||
0,
|
0,
|
||||||
&fc1);
|
&fc1);
|
||||||
TALER_setup_fresh_coin (&secret,
|
TALER_setup_planchet (&secret,
|
||||||
1,
|
1,
|
||||||
&fc2);
|
&fc2);
|
||||||
GNUNET_assert (0 !=
|
GNUNET_assert (0 !=
|
||||||
memcmp (&fc1,
|
memcmp (&fc1,
|
||||||
&fc2,
|
&fc2,
|
||||||
sizeof (struct TALER_FreshCoinP)));
|
sizeof (struct TALER_PlanchetSecretsP)));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user