-rename fest

This commit is contained in:
Christian Grothoff 2022-02-07 12:33:35 +01:00
parent 0d03f55282
commit fb9ba5b1d2
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
26 changed files with 129 additions and 126 deletions

View File

@ -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.

View File

@ -205,7 +205,7 @@ run (void *cls,
global_ret = 1;
return;
}
TALER_planchet_setup_refresh (&transfer_secret,
TALER_transfer_secret_to_planchet_secret (&transfer_secret,
coin_index,
&ps);
GNUNET_CRYPTO_eddsa_key_get_public (&ps.coin_priv.eddsa_priv,

View File

@ -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 (

View File

@ -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;

View File

@ -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);
/**

View File

@ -182,7 +182,7 @@ check_commitment (struct RevealContext *rctx,
struct TALER_PlanchetSecretsP ps;
rcd->dk = &rctx->dks[j]->denom_pub;
TALER_planchet_setup_refresh (&ts,
TALER_transfer_secret_to_planchet_secret (&ts,
j,
&ps);
// TODO: implement cipher handling

View File

@ -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),

View File

@ -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;

View File

@ -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 <gcrypt.h>
/**
* 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,7 +1481,8 @@ GNUNET_NETWORK_STRUCT_END
* @param[out] ps value to initialize
*/
void
TALER_planchet_setup_refresh (const struct TALER_TransferSecretP *secret_seed,
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);

View File

@ -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,

View File

@ -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

View File

@ -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),

View File

@ -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 ()
};

View File

@ -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,

View File

@ -120,7 +120,7 @@ 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,
TALER_transfer_secret_to_planchet_secret (&secret,
coin_num,
&ps);

View File

@ -136,7 +136,7 @@ TALER_EXCHANGE_get_melt_data_ (
struct TALER_CoinSpendPrivateKeyP coin_priv;
union TALER_DenominationBlindingKeyP bks;
TALER_planchet_setup_refresh (&trans_sec[i],
TALER_transfer_secret_to_planchet_secret (&trans_sec[i],
j,
fc);
TALER_planchet_setup_coin_priv (fc,

View File

@ -384,7 +384,7 @@ TALER_EXCHANGE_refreshes_reveal (
json_array_append_new (new_denoms_h,
GNUNET_JSON_from_data_auto (
&denom_hash)));
TALER_planchet_setup_refresh (&ts,
TALER_transfer_secret_to_planchet_secret (&ts,
i,
&ps);
TALER_planchet_setup_coin_priv (&ps,

View File

@ -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",

View File

@ -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,

View File

@ -156,10 +156,10 @@ TALER_planchet_setup_random (
void
TALER_planchet_setup_refresh (const struct TALER_TransferSecretP *secret_seed,
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,9 +381,9 @@ 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,
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,
@ -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;
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.r_pub,
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,

View File

@ -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,

View File

@ -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)
{

View File

@ -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,7 +316,8 @@ TALER_denom_priv_to_pub (const struct TALER_DenominationPrivateKey *denom_priv,
enum GNUNET_GenericReturnValue
TALER_denom_blind (const struct TALER_DenominationPublicKey *dk,
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,
@ -348,13 +349,14 @@ 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,
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),

View File

@ -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));

View File

@ -227,7 +227,7 @@ struct TALER_CRYPTO_RDeriveResponse
/**
* derived R
*/
struct TALER_DenominationCsPublicR r_pub;
struct TALER_DenominationCSPublicRPairP r_pub;
};

View File

@ -68,7 +68,7 @@ test_high_level (void)
GNUNET_assert (0 ==
GNUNET_memcmp (&secret,
&secret2));
TALER_planchet_setup_refresh (&secret,
TALER_transfer_secret_to_planchet_secret (&secret,
0,
&ps1);
alg1.cipher = TALER_DENOMINATION_RSA;
@ -79,7 +79,7 @@ test_high_level (void)
&alg1,
&bks1);
alg2.cipher = TALER_DENOMINATION_RSA;
TALER_planchet_setup_refresh (&secret,
TALER_transfer_secret_to_planchet_secret (&secret,
1,
&ps2);
TALER_planchet_setup_coin_priv (&ps2,
@ -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;