commit 1d4025d708b7ebffaf1bfa6f271b8d75c71e1160 parent 9061a6e9eadb33efe2dfd56a0a5d69e8c2c86c59 Author: Christian Grothoff <christian@grothoff.org> Date: Sat, 21 Jun 2025 19:26:05 +0200 libtalerutil: factor out TALER_merchant_instance_auth_hash_with_salt logic to avoid implementing it 3x, plus add some missing 'P' suffixes to structures Diffstat:
49 files changed, 263 insertions(+), 183 deletions(-)
diff --git a/src/auditor/taler-helper-auditor-coins.c b/src/auditor/taler-helper-auditor-coins.c @@ -1254,7 +1254,7 @@ refresh_session_cb (void *cls, const struct TALER_DenominationPublicKey *old_denom_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendSignatureP *coin_sig, - const struct TALER_AgeCommitmentHash *h_age_commitment, + const struct TALER_AgeCommitmentHashP *h_age_commitment, const struct TALER_Amount *amount_with_fee, size_t num_nds, uint64_t new_denom_serials[static num_nds], diff --git a/src/benchmark/taler-aggregator-benchmark.c b/src/benchmark/taler-aggregator-benchmark.c @@ -281,7 +281,7 @@ add_deposit (const struct Merchant *m) }; uint64_t known_coin_id; struct TALER_DenominationHashP dph; - struct TALER_AgeCommitmentHash agh; + struct TALER_AgeCommitmentHashP agh; RANDOMIZE (&d.coin.coin_pub); d.coin.denom_pub_hash = h_denom_pub; @@ -491,7 +491,7 @@ run (void *cls, struct TALER_BlindedDenominationSignature bds; struct TALER_PlanchetMasterSecretP ps; struct TALER_CoinSpendPublicKeyP coin_pub; - struct TALER_AgeCommitmentHash hac; + struct TALER_AgeCommitmentHashP hac; union GNUNET_CRYPTO_BlindingSecretP bks; const struct TALER_ExchangeBlindingValues *alg_values; diff --git a/src/exchange/taler-exchange-httpd_coins_get.c b/src/exchange/taler-exchange-httpd_coins_get.c @@ -169,7 +169,7 @@ compile_transaction_history ( { const struct TALER_EXCHANGEDB_MeltListEntry *melt = pos->details.melt; - const struct TALER_AgeCommitmentHash *phac; + const struct TALER_AgeCommitmentHashP *phac; const struct TALER_BlindingMasterSeedP *pbs; #if ENABLE_SANITY_CHECKS @@ -458,7 +458,7 @@ compile_transaction_history ( { struct TALER_EXCHANGEDB_PurseDepositListEntry *pd = pos->details.purse_deposit; - const struct TALER_AgeCommitmentHash *phac = NULL; + const struct TALER_AgeCommitmentHashP *phac = NULL; if (! pd->no_age_commitment) phac = &pd->h_age_commitment; diff --git a/src/exchange/taler-exchange-httpd_common_deposit.h b/src/exchange/taler-exchange-httpd_common_deposit.h @@ -62,7 +62,7 @@ struct TEH_PurseDepositedCoin /** * Age attestation provided, set if @e no_attest is false. */ - struct TALER_AgeAttestation attest; + struct TALER_AgeAttestationP attest; /** * Age commitment provided, set if @e cpi.no_age_commitment is false. diff --git a/src/exchange/taler-exchange-httpd_db.c b/src/exchange/taler-exchange-httpd_db.c @@ -40,7 +40,7 @@ TEH_make_coin_known (const struct TALER_CoinPublicInfo *coin, { enum TALER_EXCHANGEDB_CoinKnownStatus cks; struct TALER_DenominationHashP h_denom_pub; - struct TALER_AgeCommitmentHash h_age_commitment = {{{0}}}; + struct TALER_AgeCommitmentHashP h_age_commitment = {{{0}}}; /* make sure coin is 'known' in database */ cks = TEH_plugin->ensure_coin_known (TEH_plugin->cls, diff --git a/src/exchange/taler-exchange-httpd_kyc-start.c b/src/exchange/taler-exchange-httpd_kyc-start.c @@ -48,7 +48,7 @@ struct KycPoller /** * Authorization hash for the selected measure. */ - struct TALER_KycMeasureAuthorizationHash shv; + struct TALER_KycMeasureAuthorizationHashP shv; /** * Hash of the payto:// URI we are starting to the KYC for. @@ -371,7 +371,7 @@ TEH_handler_kyc_start ( "\n"); { - struct TALER_KycMeasureAuthorizationHash shv2; + struct TALER_KycMeasureAuthorizationHashP shv2; TALER_kyc_measure_authorization_hash ( &kyp->access_token, diff --git a/src/exchange/taler-exchange-httpd_purses_create.c b/src/exchange/taler-exchange-httpd_purses_create.c @@ -260,7 +260,7 @@ create_transaction (void *cls, struct TALER_CoinSpendPublicKeyP coin_pub; struct TALER_CoinSpendSignatureP coin_sig; struct TALER_DenominationHashP h_denom_pub; - struct TALER_AgeCommitmentHash phac; + struct TALER_AgeCommitmentHashP phac; char *partner_url = NULL; TEH_plugin->rollback (TEH_plugin->cls); diff --git a/src/exchange/taler-exchange-httpd_purses_deposit.c b/src/exchange/taler-exchange-httpd_purses_deposit.c @@ -222,7 +222,7 @@ deposit_transaction (void *cls, struct TALER_CoinSpendPublicKeyP coin_pub; struct TALER_CoinSpendSignatureP coin_sig; struct TALER_DenominationHashP h_denom_pub; - struct TALER_AgeCommitmentHash phac; + struct TALER_AgeCommitmentHashP phac; char *partner_url = NULL; TEH_plugin->rollback (TEH_plugin->cls); diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c @@ -225,7 +225,7 @@ TEH_RESPONSE_reply_coin_age_commitment_conflict ( enum TALER_EXCHANGEDB_CoinKnownStatus status, const struct TALER_DenominationHashP *h_denom_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub, - const struct TALER_AgeCommitmentHash *h_age_commitment) + const struct TALER_AgeCommitmentHashP *h_age_commitment) { const char *conflict_detail; diff --git a/src/exchange/taler-exchange-httpd_responses.h b/src/exchange/taler-exchange-httpd_responses.h @@ -213,7 +213,7 @@ TEH_RESPONSE_reply_coin_age_commitment_conflict ( enum TALER_EXCHANGEDB_CoinKnownStatus cks, const struct TALER_DenominationHashP *h_denom_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub, - const struct TALER_AgeCommitmentHash *h_age_commitment); + const struct TALER_AgeCommitmentHashP *h_age_commitment); /** * Fundamental details about a purse. diff --git a/src/exchange/taler-exchange-httpd_reveal-melt.c b/src/exchange/taler-exchange-httpd_reveal-melt.c @@ -157,7 +157,7 @@ compare_age_commitment ( } if (! actx->no_age_commitment) { - struct TALER_AgeCommitmentHash ach; + struct TALER_AgeCommitmentHashP ach; actx->age_commitment.mask = TEH_age_restriction_config.mask; TALER_age_commitment_hash ( @@ -205,7 +205,7 @@ calculate_blinded_detail ( MHD_RESULT *result) { enum GNUNET_GenericReturnValue ret; - struct TALER_AgeCommitmentHash ach; + struct TALER_AgeCommitmentHashP ach; bool no_age_commitment = (NULL == old_age_commitment); /* calculate age commitment hash */ diff --git a/src/exchange/taler-exchange-httpd_reveal-withdraw.c b/src/exchange/taler-exchange-httpd_reveal-withdraw.c @@ -215,7 +215,7 @@ calculate_blinded_hash ( MHD_RESULT *result) { enum GNUNET_GenericReturnValue ret; - struct TALER_AgeCommitmentHash ach; + struct TALER_AgeCommitmentHashP ach; /* calculate age commitment hash */ { diff --git a/src/exchangedb/perf_deposits_get_ready.c b/src/exchangedb/perf_deposits_get_ready.c @@ -402,7 +402,7 @@ run (void *cls) /* ENSURE_COIN_KNOWN */ uint64_t known_coin_id; struct TALER_DenominationHashP dph; - struct TALER_AgeCommitmentHash agh; + struct TALER_AgeCommitmentHashP agh; FAILIF (TALER_EXCHANGEDB_CKS_ADDED != plugin->ensure_coin_known (plugin->cls, &depos[i].coin, diff --git a/src/exchangedb/perf_select_refunds_by_coin.c b/src/exchangedb/perf_select_refunds_by_coin.c @@ -389,7 +389,7 @@ run (void *cls) { struct TALER_DenominationHashP dph; - struct TALER_AgeCommitmentHash agh; + struct TALER_AgeCommitmentHashP agh; FAILIF (TALER_EXCHANGEDB_CKS_ADDED != plugin->ensure_coin_known (plugin->cls, diff --git a/src/exchangedb/pg_batch_ensure_coin_known.c b/src/exchangedb/pg_batch_ensure_coin_known.c @@ -105,19 +105,19 @@ insert1 (struct PostgresClosure *pg, result[0].denom_conflict = true; } - result[0].age_conflict = TALER_AgeCommitmentHash_NoConflict; + result[0].age_conflict = TALER_AgeCommitmentHashP_NoConflict; if (is_age_hash_null != coin[0].no_age_commitment) { if (is_age_hash_null) { GNUNET_break_op (0); - result[0].age_conflict = TALER_AgeCommitmentHash_NullExpected; + result[0].age_conflict = TALER_AgeCommitmentHashP_NullExpected; } else { GNUNET_break_op (0); - result[0].age_conflict = TALER_AgeCommitmentHash_ValueExpected; + result[0].age_conflict = TALER_AgeCommitmentHashP_ValueExpected; } } else if ( (! is_age_hash_null) && @@ -125,7 +125,7 @@ insert1 (struct PostgresClosure *pg, &coin[0].h_age_commitment)) ) { GNUNET_break_op (0); - result[0].age_conflict = TALER_AgeCommitmentHash_ValueDiffers; + result[0].age_conflict = TALER_AgeCommitmentHashP_ValueDiffers; } return qs; @@ -222,19 +222,19 @@ insert2 (struct PostgresClosure *pg, result[i].denom_conflict = true; } - result[i].age_conflict = TALER_AgeCommitmentHash_NoConflict; + result[i].age_conflict = TALER_AgeCommitmentHashP_NoConflict; if (is_age_hash_null[i] != coin[i].no_age_commitment) { if (is_age_hash_null[i]) { GNUNET_break_op (0); - result[i].age_conflict = TALER_AgeCommitmentHash_NullExpected; + result[i].age_conflict = TALER_AgeCommitmentHashP_NullExpected; } else { GNUNET_break_op (0); - result[i].age_conflict = TALER_AgeCommitmentHash_ValueExpected; + result[i].age_conflict = TALER_AgeCommitmentHashP_ValueExpected; } } else if ( (! is_age_hash_null[i]) && @@ -242,7 +242,7 @@ insert2 (struct PostgresClosure *pg, &coin[i].h_age_commitment)) ) { GNUNET_break_op (0); - result[i].age_conflict = TALER_AgeCommitmentHash_ValueDiffers; + result[i].age_conflict = TALER_AgeCommitmentHashP_ValueDiffers; } } @@ -382,19 +382,19 @@ insert4 (struct PostgresClosure *pg, result[i].denom_conflict = true; } - result[i].age_conflict = TALER_AgeCommitmentHash_NoConflict; + result[i].age_conflict = TALER_AgeCommitmentHashP_NoConflict; if (is_age_hash_null[i] != coin[i].no_age_commitment) { if (is_age_hash_null[i]) { GNUNET_break_op (0); - result[i].age_conflict = TALER_AgeCommitmentHash_NullExpected; + result[i].age_conflict = TALER_AgeCommitmentHashP_NullExpected; } else { GNUNET_break_op (0); - result[i].age_conflict = TALER_AgeCommitmentHash_ValueExpected; + result[i].age_conflict = TALER_AgeCommitmentHashP_ValueExpected; } } else if ( (! is_age_hash_null[i]) && @@ -402,7 +402,7 @@ insert4 (struct PostgresClosure *pg, &coin[i].h_age_commitment)) ) { GNUNET_break_op (0); - result[i].age_conflict = TALER_AgeCommitmentHash_ValueDiffers; + result[i].age_conflict = TALER_AgeCommitmentHashP_ValueDiffers; } } diff --git a/src/exchangedb/pg_ensure_coin_known.c b/src/exchangedb/pg_ensure_coin_known.c @@ -32,7 +32,7 @@ TEH_PG_ensure_coin_known (void *cls, const struct TALER_CoinPublicInfo *coin, uint64_t *known_coin_id, struct TALER_DenominationHashP *denom_hash, - struct TALER_AgeCommitmentHash *h_age_commitment) + struct TALER_AgeCommitmentHashP *h_age_commitment) { struct PostgresClosure *pg = cls; enum GNUNET_DB_QueryStatus qs; diff --git a/src/exchangedb/pg_ensure_coin_known.h b/src/exchangedb/pg_ensure_coin_known.h @@ -40,6 +40,6 @@ TEH_PG_ensure_coin_known (void *cls, const struct TALER_CoinPublicInfo *coin, uint64_t *known_coin_id, struct TALER_DenominationHashP *denom_hash, - struct TALER_AgeCommitmentHash *h_age_commitment); + struct TALER_AgeCommitmentHashP *h_age_commitment); #endif diff --git a/src/exchangedb/pg_get_purse_deposit.c b/src/exchangedb/pg_get_purse_deposit.c @@ -32,7 +32,7 @@ TEH_PG_get_purse_deposit ( const struct TALER_CoinSpendPublicKeyP *coin_pub, struct TALER_Amount *amount, struct TALER_DenominationHashP *h_denom_pub, - struct TALER_AgeCommitmentHash *phac, + struct TALER_AgeCommitmentHashP *phac, struct TALER_CoinSpendSignatureP *coin_sig, char **partner_url) { diff --git a/src/exchangedb/pg_get_purse_deposit.h b/src/exchangedb/pg_get_purse_deposit.h @@ -46,7 +46,7 @@ TEH_PG_get_purse_deposit ( const struct TALER_CoinSpendPublicKeyP *coin_pub, struct TALER_Amount *amount, struct TALER_DenominationHashP *h_denom_pub, - struct TALER_AgeCommitmentHash *phac, + struct TALER_AgeCommitmentHashP *phac, struct TALER_CoinSpendSignatureP *coin_sig, char **partner_url); diff --git a/src/exchangedb/pg_select_refreshes_above_serial_id.c b/src/exchangedb/pg_select_refreshes_above_serial_id.c @@ -75,7 +75,7 @@ refreshs_serial_helper_cb (void *cls, struct TALER_DenominationPublicKey old_denom_pub; struct TALER_CoinSpendPublicKeyP coin_pub; struct TALER_CoinSpendSignatureP coin_sig; - struct TALER_AgeCommitmentHash h_age_commitment; + struct TALER_AgeCommitmentHashP h_age_commitment; bool ac_isnull; struct TALER_Amount amount_with_fee; uint64_t rowid; diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c @@ -452,7 +452,7 @@ audit_refresh_session_cb ( void *cls, uint64_t rowid, const struct TALER_DenominationPublicKey *denom_pub, - const struct TALER_AgeCommitmentHash *h_age_commitment, + const struct TALER_AgeCommitmentHashP *h_age_commitment, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendSignatureP *coin_sig, const struct TALER_Amount *amount_with_fee, @@ -1589,7 +1589,7 @@ run (void *cls) deadline = GNUNET_TIME_timestamp_get (); { struct TALER_DenominationHashP dph; - struct TALER_AgeCommitmentHash agh; + struct TALER_AgeCommitmentHashP agh; FAILIF (TALER_EXCHANGEDB_CKS_ADDED != plugin->ensure_coin_known (plugin->cls, @@ -1881,7 +1881,7 @@ run (void *cls) uint64_t new_known_coin_id; struct TALER_CoinPublicInfo new_coin; struct TALER_DenominationHashP dph; - struct TALER_AgeCommitmentHash agh; + struct TALER_AgeCommitmentHashP agh; bool recoup_ok; bool internal_failure; @@ -2289,7 +2289,7 @@ run (void *cls) { uint64_t known_coin_id2; struct TALER_DenominationHashP dph; - struct TALER_AgeCommitmentHash agh; + struct TALER_AgeCommitmentHashP agh; FAILIF (TALER_EXCHANGEDB_CKS_ADDED != plugin->ensure_coin_known (plugin->cls, diff --git a/src/include/taler/taler_crypto_lib.h b/src/include/taler/taler_crypto_lib.h @@ -1123,10 +1123,104 @@ struct TALER_GlobalFeeSetNBOP }; +/** + * @brief Age commitment of a coin. + */ +struct TALER_AgeCommitmentHashP +{ + /** + * The commitment is a SHA-256 hash code. + */ + struct GNUNET_ShortHashCode shash; +}; + + +/** + * @brief Signature of an age with the private key for the corresponding age group of an age commitment. + */ +struct TALER_AgeAttestationP +{ +#ifdef AGE_RESTRICTION_WITH_ECDSA + struct GNUNET_CRYPTO_EcdsaSignature signature; +#else + struct GNUNET_CRYPTO_Edx25519Signature signature; +#endif +}; + + +/** + * @brief KYC measure authorization hash. + * Hashes over the AccountAccessToken, the + * row ID and the offset. Used in the + * ID of /kyc-upload/ and /kyc-start/. + */ +struct TALER_KycMeasureAuthorizationHashP +{ + /** + * The hash is a SHA-256 hash code. + */ + struct GNUNET_ShortHashCode shash; +}; + + +/** + * @brief Hash used for client authenticiation. Computed with a + * `struct TALER_MerchantAuthenticationSaltP`. + */ +struct TALER_MerchantAuthenticationHashP +{ + /** + * The authentication hash is a SHA-512 hash code. + * All zeros if authentication is off. + */ + struct GNUNET_HashCode hash; +}; + + +/** + * @brief Salt used for client authenticiation. + */ +struct TALER_MerchantAuthenticationSaltP +{ + /** + * The authentication salt is a 256-bit value. + */ + uint32_t salt[256 / 8 / sizeof(uint32_t)]; /* = 8 */ +}; + + +/** + * @brief Hash over an order request, used for the idempotency check. + */ +struct TALER_MerchantPostDataHashP +{ + /** + * The authentication hash is a SHA-512 hash code. + */ + struct GNUNET_HashCode hash; +}; + + GNUNET_NETWORK_STRUCT_END /** + * Compute the internal @a auth_hash a merchant stores to + * authenticate an instance user from the @a salt and + * a @a passphrase. Merchant-backend internal. + * + * @param[out] auth_hash set to the authentication hash + * @param salt salt to use + * @param passphrase passphrase to hash + */ +void +TALER_merchant_instance_auth_hash_with_salt ( + struct TALER_MerchantAuthenticationHashP *auth_hash, + struct TALER_MerchantAuthenticationSaltP *salt, + const char *passphrase); + + +/** * Compute RFC 3548 base32 decoding of @a val and write * result to @a udata. * @@ -1152,10 +1246,11 @@ TALER_rfc3548_base32decode (const char *val, * @return POS token on success, NULL otherwise */ char * -TALER_build_pos_confirmation (const char *pos_key, - enum TALER_MerchantConfirmationAlgorithm pos_alg, - const struct TALER_Amount *total, - struct GNUNET_TIME_Timestamp ts); +TALER_build_pos_confirmation ( + const char *pos_key, + enum TALER_MerchantConfirmationAlgorithm pos_alg, + const struct TALER_Amount *total, + struct GNUNET_TIME_Timestamp ts); /** @@ -1379,7 +1474,8 @@ struct TALER_BlindedDenominationSignature /* *************** Age Restriction *********************************** */ -/* + +/** * @brief Type of a list of age groups, represented as bit mask. * * The bits set in the mask mark the edges at the beginning of a next age @@ -1402,45 +1498,9 @@ struct TALER_AgeMask uint32_t bits; }; -/** - * @brief Age commitment of a coin. - */ -struct TALER_AgeCommitmentHash -{ - /** - * The commitment is a SHA-256 hash code. - */ - struct GNUNET_ShortHashCode shash; -}; - -/** - * @brief KYC measure authorization hash. - * Hashes over the AccountAccessToken, the - * row ID and the offset. Used in the - * ID of /kyc-upload/ and /kyc-start/. - */ -struct TALER_KycMeasureAuthorizationHash -{ - /** - * The hash is a SHA-256 hash code. - */ - struct GNUNET_ShortHashCode shash; -}; - -/** - * @brief Signature of an age with the private key for the corresponding age group of an age commitment. - */ -struct TALER_AgeAttestation -{ -#ifdef AGE_RESTRICTION_WITH_ECDSA - struct GNUNET_CRYPTO_EcdsaSignature signature; -#else - struct GNUNET_CRYPTO_Edx25519Signature signature; -#endif -}; -#define TALER_AgeCommitmentHash_isNullOrZero(ph) ((NULL == ph) || \ - GNUNET_is_zero (ph)) +#define TALER_AgeCommitmentHashP_isNullOrZero(ph) ((NULL == ph) || \ + GNUNET_is_zero (ph)) /** * @brief Type of public signing keys for verifying blindly signed coins. @@ -1507,7 +1567,7 @@ struct TALER_CoinPublicInfo * Hash of the age commitment. If no age commitment was provided, it must be * set to all zeroes. */ - struct TALER_AgeCommitmentHash h_age_commitment; + struct TALER_AgeCommitmentHashP h_age_commitment; /** * True, if age commitment is not applicable. @@ -1847,7 +1907,7 @@ enum GNUNET_GenericReturnValue TALER_denom_blind (const struct TALER_DenominationPublicKey *dk, const union GNUNET_CRYPTO_BlindingSecretP *coin_bks, const union GNUNET_CRYPTO_BlindSessionNonce *nonce, - const struct TALER_AgeCommitmentHash *age_commitment_hash, + const struct TALER_AgeCommitmentHashP *age_commitment_hash, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_ExchangeBlindingValues *alg_values, struct TALER_CoinPubHashP *c_hash, @@ -2082,7 +2142,7 @@ TALER_coin_ev_hash (const struct TALER_BlindedPlanchet *blinded_planchet, */ void TALER_coin_pub_hash (const struct TALER_CoinSpendPublicKeyP *coin_pub, - const struct TALER_AgeCommitmentHash *age_commitment_hash, + const struct TALER_AgeCommitmentHashP *age_commitment_hash, struct TALER_CoinPubHashP *coin_h); @@ -2101,7 +2161,7 @@ TALER_kyc_measure_authorization_hash ( const struct TALER_AccountAccessTokenP *access_token, uint64_t row, uint32_t offset, - struct TALER_KycMeasureAuthorizationHash *mah); + struct TALER_KycMeasureAuthorizationHashP *mah); /** @@ -2167,7 +2227,7 @@ struct TALER_FreshCoin /** * Optional hash of an age commitment bound to this coin, maybe NULL. */ - const struct TALER_AgeCommitmentHash *h_age_commitment; + const struct TALER_AgeCommitmentHashP *h_age_commitment; }; @@ -2520,7 +2580,7 @@ TALER_planchet_prepare ( const union GNUNET_CRYPTO_BlindingSecretP *bks, const union GNUNET_CRYPTO_BlindSessionNonce *nonce, const struct TALER_CoinSpendPrivateKeyP *coin_priv, - const struct TALER_AgeCommitmentHash *ach, + const struct TALER_AgeCommitmentHashP *ach, struct TALER_CoinPubHashP *c_hash, struct TALER_PlanchetDetail *pd); @@ -2564,7 +2624,7 @@ TALER_planchet_to_coin ( const struct TALER_BlindedDenominationSignature *blind_sig, const union GNUNET_CRYPTO_BlindingSecretP *bks, const struct TALER_CoinSpendPrivateKeyP *coin_priv, - const struct TALER_AgeCommitmentHash *ach, + const struct TALER_AgeCommitmentHashP *ach, const struct TALER_CoinPubHashP *c_hash, const struct TALER_ExchangeBlindingValues *alg_values, struct TALER_FreshCoin *coin); @@ -3922,7 +3982,7 @@ TALER_wallet_purse_deposit_sign ( const struct TALER_PurseContractPublicKeyP *purse_pub, const struct TALER_Amount *amount, const struct TALER_DenominationHashP *h_denom_pub, - const struct TALER_AgeCommitmentHash *h_age_commitment, + const struct TALER_AgeCommitmentHashP *h_age_commitment, const struct TALER_CoinSpendPrivateKeyP *coin_priv, struct TALER_CoinSpendSignatureP *coin_sig); @@ -3945,7 +4005,7 @@ TALER_wallet_purse_deposit_verify ( const struct TALER_PurseContractPublicKeyP *purse_pub, const struct TALER_Amount *amount, const struct TALER_DenominationHashP *h_denom_pub, - const struct TALER_AgeCommitmentHash *h_age_commitment, + const struct TALER_AgeCommitmentHashP *h_age_commitment, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendSignatureP *coin_sig); @@ -4283,7 +4343,7 @@ TALER_wallet_deposit_sign ( const struct TALER_MerchantWireHashP *h_wire, const struct TALER_PrivateContractHashP *h_contract_terms, const struct GNUNET_HashCode *wallet_data_hash, - const struct TALER_AgeCommitmentHash *h_age_commitment, + const struct TALER_AgeCommitmentHashP *h_age_commitment, const struct TALER_ExtensionPolicyHashP *h_policy, const struct TALER_DenominationHashP *h_denom_pub, struct GNUNET_TIME_Timestamp wallet_timestamp, @@ -4318,7 +4378,7 @@ TALER_wallet_deposit_verify ( const struct TALER_MerchantWireHashP *h_wire, const struct TALER_PrivateContractHashP *h_contract_terms, const struct GNUNET_HashCode *wallet_data_hash, - const struct TALER_AgeCommitmentHash *h_age_commitment, + const struct TALER_AgeCommitmentHashP *h_age_commitment, const struct TALER_ExtensionPolicyHashP *h_policy, const struct TALER_DenominationHashP *h_denom_pub, struct GNUNET_TIME_Timestamp wallet_timestamp, @@ -4345,7 +4405,7 @@ TALER_wallet_melt_sign ( const struct TALER_Amount *melt_fee, const struct TALER_RefreshCommitmentP *rc, const struct TALER_DenominationHashP *h_denom_pub, - const struct TALER_AgeCommitmentHash *h_age_commitment, + const struct TALER_AgeCommitmentHashP *h_age_commitment, const struct TALER_CoinSpendPrivateKeyP *coin_priv, struct TALER_CoinSpendSignatureP *coin_sig); @@ -4368,7 +4428,7 @@ TALER_wallet_melt_verify ( const struct TALER_Amount *melt_fee, const struct TALER_RefreshCommitmentP *rc, const struct TALER_DenominationHashP *h_denom_pub, - const struct TALER_AgeCommitmentHash *h_age_commitment, + const struct TALER_AgeCommitmentHashP *h_age_commitment, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendSignatureP *coin_sig); @@ -6743,7 +6803,7 @@ struct TALER_AgeCommitmentProof void TALER_age_commitment_hash ( const struct TALER_AgeCommitment *commitment, - struct TALER_AgeCommitmentHash *hash); + struct TALER_AgeCommitmentHashP *hash); /** @@ -6836,7 +6896,7 @@ enum GNUNET_GenericReturnValue TALER_age_commitment_attest ( const struct TALER_AgeCommitmentProof *comm_proof, uint8_t age, - struct TALER_AgeAttestation *attest); + struct TALER_AgeAttestationP *attest); /** @@ -6851,7 +6911,7 @@ enum GNUNET_GenericReturnValue TALER_age_commitment_verify ( const struct TALER_AgeCommitment *commitment, uint8_t age, - const struct TALER_AgeAttestation *attest); + const struct TALER_AgeAttestationP *attest); /** diff --git a/src/include/taler/taler_exchange_service.h b/src/include/taler/taler_exchange_service.h @@ -1180,7 +1180,7 @@ struct TALER_EXCHANGE_CoinDepositDetail /** * Hash over the age commitment of the coin. */ - struct TALER_AgeCommitmentHash h_age_commitment; + struct TALER_AgeCommitmentHashP h_age_commitment; /** * The coin’s public key. @@ -1674,7 +1674,7 @@ struct TALER_EXCHANGE_CoinHistoryEntry struct TALER_MerchantPublicKeyP merchant_pub; struct GNUNET_TIME_Timestamp refund_deadline; struct TALER_CoinSpendSignatureP sig; - struct TALER_AgeCommitmentHash hac; + struct TALER_AgeCommitmentHashP hac; bool no_hac; struct TALER_Amount deposit_fee; } deposit; @@ -1683,7 +1683,7 @@ struct TALER_EXCHANGE_CoinHistoryEntry { struct TALER_CoinSpendSignatureP sig; struct TALER_RefreshCommitmentP rc; - struct TALER_AgeCommitmentHash h_age_commitment; + struct TALER_AgeCommitmentHashP h_age_commitment; bool no_hac; struct TALER_Amount melt_fee; } melt; @@ -1732,7 +1732,7 @@ struct TALER_EXCHANGE_CoinHistoryEntry struct TALER_CoinSpendSignatureP coin_sig; const char *exchange_base_url; bool refunded; - struct TALER_AgeCommitmentHash phac; + struct TALER_AgeCommitmentHashP phac; } purse_deposit; struct @@ -2243,7 +2243,7 @@ struct TALER_EXCHANGE_WithdrawCoinPrivateDetails * The hash of the age commitment. * Only relevant for denominations with age-restriction support. */ - struct TALER_AgeCommitmentHash h_age_commitment; + struct TALER_AgeCommitmentHashP h_age_commitment; /** * Values contributed from the exchange during the @@ -2834,7 +2834,7 @@ struct TALER_EXCHANGE_RevealedCoinInfo * Age commitment and its hash of the coin, might be NULL. */ struct TALER_AgeCommitmentProof *age_commitment_proof; - struct TALER_AgeCommitmentHash h_age_commitment; + struct TALER_AgeCommitmentHashP h_age_commitment; /** * Blinding keys used to blind the fresh coin. @@ -2947,7 +2947,7 @@ struct TALER_EXCHANGE_MeltInput * Hash of age commitment and proof that went into the original coin, * might be NULL. */ - const struct TALER_AgeCommitmentHash *melt_h_age_commitment; + const struct TALER_AgeCommitmentHashP *melt_h_age_commitment; /** * amount specifying how much the coin will contribute to the melt diff --git a/src/include/taler/taler_exchangedb_plugin.h b/src/include/taler/taler_exchangedb_plugin.h @@ -37,22 +37,22 @@ enum TALER_EXCHANGEDB_AgeCommitmentHash_Conflict /** * Value OK, no conflict */ - TALER_AgeCommitmentHash_NoConflict = 0, + TALER_AgeCommitmentHashP_NoConflict = 0, /** * Given hash had a value, but NULL (or zero) was expected */ - TALER_AgeCommitmentHash_NullExpected = 1, + TALER_AgeCommitmentHashP_NullExpected = 1, /** * Given hash was NULL, but value was expected */ - TALER_AgeCommitmentHash_ValueExpected = 2, + TALER_AgeCommitmentHashP_ValueExpected = 2, /** * Given hash differs from value in the known coin */ - TALER_AgeCommitmentHash_ValueDiffers = 3, + TALER_AgeCommitmentHashP_ValueDiffers = 3, }; /** @@ -73,7 +73,7 @@ struct TALER_EXCHANGEDB_CoinInfo /** * Hash of the age commitment, relevant on @e age_conflict. */ - struct TALER_AgeCommitmentHash h_age_commitment; + struct TALER_AgeCommitmentHashP h_age_commitment; /** * True if the coin was known previously. @@ -544,7 +544,7 @@ struct TALER_EXCHANGEDB_TableData struct { struct TALER_CoinSpendPublicKeyP coin_pub; - struct TALER_AgeCommitmentHash age_hash; + struct TALER_AgeCommitmentHashP age_hash; uint64_t denominations_serial; struct TALER_DenominationSignature denom_sig; } known_coins; @@ -2069,7 +2069,7 @@ struct TALER_EXCHANGEDB_DepositListEntry * Age commitment hash, if applicable to the denomination. Should be all * zeroes if age commitment is not applicable to the denonimation. */ - struct TALER_AgeCommitmentHash h_age_commitment; + struct TALER_AgeCommitmentHashP h_age_commitment; /** * Salt used to compute h_wire from the @e receiver_wire_account. @@ -2285,7 +2285,7 @@ struct TALER_EXCHANGEDB_MeltListEntry * applicable to the denomination. May be all zeroes if no age restriction * applies. */ - struct TALER_AgeCommitmentHash h_age_commitment; + struct TALER_AgeCommitmentHashP h_age_commitment; /** * true, if no @e h_age_commitment is applicable @@ -2368,7 +2368,7 @@ struct TALER_EXCHANGEDB_PurseDepositListEntry * Hash of the age commitment used to sign the coin, if age restriction was * applicable to the denomination. */ - struct TALER_AgeCommitmentHash h_age_commitment; + struct TALER_AgeCommitmentHashP h_age_commitment; /** * Hash of the public denomination key used to sign the coin. @@ -2480,7 +2480,7 @@ struct TALER_EXCHANGEDB_PurseDeposit * applicable to the denomination. May be all zeroes if no age restriction * applies. */ - struct TALER_AgeCommitmentHash h_age_commitment; + struct TALER_AgeCommitmentHashP h_age_commitment; /** * Set to true if @e h_age_commitment is not available. @@ -3071,7 +3071,7 @@ typedef enum GNUNET_GenericReturnValue const struct TALER_DenominationPublicKey *old_denom_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendSignatureP *coin_sig, - const struct TALER_AgeCommitmentHash *h_age_commitment, + const struct TALER_AgeCommitmentHashP *h_age_commitment, const struct TALER_Amount *amount_with_fee, size_t num_nds, uint64_t new_denom_serials[static num_nds], @@ -4724,7 +4724,7 @@ struct TALER_EXCHANGEDB_Plugin const struct TALER_CoinPublicInfo *coin, uint64_t *known_coin_id, struct TALER_DenominationHashP *denom_pub_hash, - struct TALER_AgeCommitmentHash *age_hash); + struct TALER_AgeCommitmentHashP *age_hash); /** @@ -6858,7 +6858,7 @@ struct TALER_EXCHANGEDB_Plugin const struct TALER_CoinSpendPublicKeyP *coin_pub, struct TALER_Amount *amount, struct TALER_DenominationHashP *h_denom_pub, - struct TALER_AgeCommitmentHash *phac, + struct TALER_AgeCommitmentHashP *phac, struct TALER_CoinSpendSignatureP *coin_sig, char **partner_url); diff --git a/src/include/taler/taler_testing_lib.h b/src/include/taler/taler_testing_lib.h @@ -2851,7 +2851,7 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits, op (deposit_fee_amount, const struct TALER_Amount) \ op (age_commitment, const struct TALER_AgeCommitment) \ op (age_commitment_proof, const struct TALER_AgeCommitmentProof) \ - op (h_age_commitment, const struct TALER_AgeCommitmentHash) \ + op (h_age_commitment, const struct TALER_AgeCommitmentHashP) \ op (coin_history, const struct TALER_EXCHANGE_CoinHistoryEntry) \ op (planchet_secrets, const struct TALER_PlanchetMasterSecretP) \ op (kappa_seeds, const struct TALER_KappaWithdrawMasterSeedP) \ diff --git a/src/kyclogic/kyclogic_api.c b/src/kyclogic/kyclogic_api.c @@ -3714,7 +3714,7 @@ TALER_KYCLOGIC_measure_to_requirement ( { struct TALER_KYCLOGIC_KycCheck *kc; json_t *kri; - struct TALER_KycMeasureAuthorizationHash shv; + struct TALER_KycMeasureAuthorizationHashP shv; char *ids; char *xids; diff --git a/src/lib/exchange_api_batch_deposit.c b/src/lib/exchange_api_batch_deposit.c @@ -626,7 +626,7 @@ TALER_EXCHANGE_batch_deposit ( { const struct TALER_EXCHANGE_CoinDepositDetail *cdd = &cdds[i]; const struct TALER_EXCHANGE_DenomPublicKey *dki; - const struct TALER_AgeCommitmentHash *h_age_commitmentp; + const struct TALER_AgeCommitmentHashP *h_age_commitmentp; struct TALER_Amount amount_without_fee; dki = TALER_EXCHANGE_get_denomination_key_by_hash (keys, diff --git a/src/lib/exchange_api_common.c b/src/lib/exchange_api_common.c @@ -175,7 +175,7 @@ TALER_EXCHANGE_check_purse_coin_conflict_ ( const char *exchange_url, const json_t *proof, struct TALER_DenominationHashP *h_denom_pub, - struct TALER_AgeCommitmentHash *phac, + struct TALER_AgeCommitmentHashP *phac, struct TALER_CoinSpendPublicKeyP *coin_pub, struct TALER_CoinSpendSignatureP *coin_sig) { diff --git a/src/lib/exchange_api_common.h b/src/lib/exchange_api_common.h @@ -87,7 +87,7 @@ TALER_EXCHANGE_check_purse_coin_conflict_ ( const char *exchange_url, const json_t *proof, struct TALER_DenominationHashP *h_denom_pub, - struct TALER_AgeCommitmentHash *phac, + struct TALER_AgeCommitmentHashP *phac, struct TALER_CoinSpendPublicKeyP *coin_pub, struct TALER_CoinSpendSignatureP *coin_sig); diff --git a/src/lib/exchange_api_purse_create_with_deposit.c b/src/lib/exchange_api_purse_create_with_deposit.c @@ -57,7 +57,7 @@ struct Deposit /** * Age restriction hash for the coin. */ - struct TALER_AgeCommitmentHash ahac; + struct TALER_AgeCommitmentHashP ahac; /** * How much did we say the coin contributed. @@ -288,7 +288,7 @@ handle_purse_create_deposit_finished (void *cls, struct TALER_CoinSpendPublicKeyP coin_pub; struct TALER_CoinSpendSignatureP coin_sig; struct TALER_DenominationHashP h_denom_pub; - struct TALER_AgeCommitmentHash phac; + struct TALER_AgeCommitmentHashP phac; bool found = false; if (GNUNET_OK != @@ -497,9 +497,9 @@ TALER_EXCHANGE_purse_create_with_deposit ( const struct TALER_AgeCommitmentProof *acp = deposit->age_commitment_proof; struct Deposit *d = &pch->deposits[i]; json_t *jdeposit; - struct TALER_AgeCommitmentHash *aghp = NULL; - struct TALER_AgeAttestation attest; - struct TALER_AgeAttestation *attestp = NULL; + struct TALER_AgeCommitmentHashP *aghp = NULL; + struct TALER_AgeAttestationP attest; + struct TALER_AgeAttestationP *attestp = NULL; if (NULL != acp) { diff --git a/src/lib/exchange_api_purse_deposit.c b/src/lib/exchange_api_purse_deposit.c @@ -57,7 +57,7 @@ struct Coin /** * Age restriction hash for the coin. */ - struct TALER_AgeCommitmentHash ahac; + struct TALER_AgeCommitmentHashP ahac; /** * How much did we say the coin contributed. @@ -239,7 +239,7 @@ handle_purse_deposit_finished (void *cls, struct TALER_CoinSpendPublicKeyP coin_pub; struct TALER_CoinSpendSignatureP coin_sig; struct TALER_DenominationHashP h_denom_pub; - struct TALER_AgeCommitmentHash phac; + struct TALER_AgeCommitmentHashP phac; bool found = false; if (GNUNET_OK != @@ -407,9 +407,9 @@ TALER_EXCHANGE_purse_deposit ( const struct TALER_AgeCommitmentProof *acp = deposit->age_commitment_proof; struct Coin *coin = &pch->coins[i]; json_t *jdeposit; - struct TALER_AgeCommitmentHash *achp = NULL; - struct TALER_AgeAttestation attest; - struct TALER_AgeAttestation *attestp = NULL; + struct TALER_AgeCommitmentHashP *achp = NULL; + struct TALER_AgeAttestationP attest; + struct TALER_AgeAttestationP *attestp = NULL; if (NULL != acp) { diff --git a/src/lib/exchange_api_refresh_common.c b/src/lib/exchange_api_refresh_common.c @@ -226,8 +226,8 @@ TALER_EXCHANGE_get_melt_data_v27 ( struct TALER_CoinSpendPrivateKeyP *coin_priv = &fcd->coin_priv; union GNUNET_CRYPTO_BlindingSecretP *bks = &fcd->bks[k]; struct TALER_CoinPubHashP c_hash; - struct TALER_AgeCommitmentHash ach; - struct TALER_AgeCommitmentHash *pah; + struct TALER_AgeCommitmentHashP ach; + struct TALER_AgeCommitmentHashP *pah; fcd->ps[k] = planchet_secrets[j]; TALER_planchet_setup_coin_priv (&planchet_secrets[j], diff --git a/src/lib/exchange_api_refresh_common.h b/src/lib/exchange_api_refresh_common.h @@ -57,7 +57,7 @@ struct MeltedCoin * age commitment was set. */ const struct TALER_AgeCommitmentProof *age_commitment_proof; - const struct TALER_AgeCommitmentHash *h_age_commitment; + const struct TALER_AgeCommitmentHashP *h_age_commitment; /** * Timestamp indicating when coins of this denomination become invalid. diff --git a/src/lib/exchange_api_reserves_open.c b/src/lib/exchange_api_reserves_open.c @@ -469,8 +469,8 @@ TALER_EXCHANGE_reserves_open ( { const struct TALER_EXCHANGE_PurseDeposit *pd = &coin_payments[i]; const struct TALER_AgeCommitmentProof *acp = pd->age_commitment_proof; - struct TALER_AgeCommitmentHash ahac; - struct TALER_AgeCommitmentHash *achp = NULL; + struct TALER_AgeCommitmentHashP ahac; + struct TALER_AgeCommitmentHashP *achp = NULL; struct CoinData *cd = &roh->coins[i]; json_t *cp; diff --git a/src/lib/exchange_api_reveal_melt.c b/src/lib/exchange_api_reveal_melt.c @@ -127,7 +127,7 @@ reveal_melt_ok ( struct TALER_CoinPubHashP coin_hash; struct TALER_FreshCoin coin; union GNUNET_CRYPTO_BlindingSecretP bks; - const struct TALER_AgeCommitmentHash *pah = NULL; + const struct TALER_AgeCommitmentHashP *pah = NULL; rci->ps = fcd->ps[mrh->reveal_input->noreveal_index]; rci->bks = fcd->bks[mrh->reveal_input->noreveal_index]; diff --git a/src/testing/testing_api_cmd_deposit.c b/src/testing/testing_api_cmd_deposit.c @@ -306,7 +306,7 @@ deposit_run (void *cls, const struct TALER_TESTING_Command *acc_var; const struct TALER_CoinSpendPrivateKeyP *coin_priv; struct TALER_CoinSpendPublicKeyP coin_pub; - const struct TALER_AgeCommitmentHash *phac; + const struct TALER_AgeCommitmentHashP *phac; const struct TALER_DenominationSignature *denom_pub_sig; struct TALER_PrivateContractHashP h_contract_terms; enum TALER_ErrorCode ec; @@ -640,7 +640,7 @@ deposit_traits (void *cls, const struct TALER_CoinSpendPrivateKeyP *coin_spent_priv; struct TALER_CoinSpendPublicKeyP coin_spent_pub; const struct TALER_AgeCommitmentProof *age_commitment_proof=NULL; - const struct TALER_AgeCommitmentHash *h_age_commitment=NULL; + const struct TALER_AgeCommitmentHashP *h_age_commitment=NULL; if (! ds->command_initialized) { diff --git a/src/testing/testing_api_cmd_insert_deposit.c b/src/testing/testing_api_cmd_insert_deposit.c @@ -281,7 +281,7 @@ insert_deposit_run (void *cls, { uint64_t known_coin_id; struct TALER_DenominationHashP dph; - struct TALER_AgeCommitmentHash agh; + struct TALER_AgeCommitmentHashP agh; bool balance_ok; uint32_t bad_index; bool ctr_conflict; diff --git a/src/testing/testing_api_cmd_refresh.c b/src/testing/testing_api_cmd_refresh.c @@ -76,7 +76,7 @@ struct TALER_TESTING_FreshCoinData * applicable. */ struct TALER_AgeCommitmentProof *age_commitment_proof; - struct TALER_AgeCommitmentHash h_age_commitment; + struct TALER_AgeCommitmentHashP h_age_commitment; /** * The blinding key (needed for recoup operations). @@ -798,7 +798,7 @@ melt_run (void *cls, struct TALER_Amount melt_amount; struct TALER_Amount fresh_amount; const struct TALER_AgeCommitmentProof *age_commitment_proof = NULL; - const struct TALER_AgeCommitmentHash *h_age_commitment = NULL; + const struct TALER_AgeCommitmentHashP *h_age_commitment = NULL; const struct TALER_DenominationSignature *melt_sig; const struct TALER_EXCHANGE_DenomPublicKey *melt_denom_pub; const struct TALER_TESTING_Command *coin_command; diff --git a/src/testing/testing_api_cmd_withdraw.c b/src/testing/testing_api_cmd_withdraw.c @@ -159,7 +159,7 @@ struct WithdrawState * its hash, respectively. */ struct TALER_AgeCommitmentProof age_commitment_proof; - struct TALER_AgeCommitmentHash h_age_commitment; + struct TALER_AgeCommitmentHashP h_age_commitment; /** * Reserve history entry that corresponds to this operation. diff --git a/src/util/Makefile.am b/src/util/Makefile.am @@ -126,7 +126,7 @@ libtalerutil_la_LIBADD = \ -lm libtalerutil_la_LDFLAGS = \ - -version-info 7:1:0 \ + -version-info 8:0:0 \ -no-undefined diff --git a/src/util/age_restriction.c b/src/util/age_restriction.c @@ -41,7 +41,7 @@ TALER_age_commitment_base_public_key = { void TALER_age_commitment_hash ( const struct TALER_AgeCommitment *commitment, - struct TALER_AgeCommitmentHash *ahash) + struct TALER_AgeCommitmentHashP *ahash) { struct GNUNET_HashContext *hash_context; struct GNUNET_HashCode hash; @@ -49,7 +49,7 @@ TALER_age_commitment_hash ( GNUNET_assert (NULL != ahash); if (NULL == commitment) { - memset (ahash, 0, sizeof(struct TALER_AgeCommitmentHash)); + memset (ahash, 0, sizeof(struct TALER_AgeCommitmentHashP)); return; } @@ -401,7 +401,7 @@ struct TALER_AgeMaskNBO /** * Used for attestation of a particular age */ -struct TALER_AgeAttestationPS +struct TALER_AgeAttestationPPS { /** * Purpose must be #TALER_SIGNATURE_WALLET_AGE_ATTESTATION. @@ -428,7 +428,7 @@ enum GNUNET_GenericReturnValue TALER_age_commitment_attest ( const struct TALER_AgeCommitmentProof *cp, uint8_t age, - struct TALER_AgeAttestation *attest) + struct TALER_AgeAttestationP *attest) { uint8_t group; @@ -446,7 +446,7 @@ TALER_age_commitment_attest ( * We set the signature to zero and communicate success. */ memset (attest, 0, - sizeof(struct TALER_AgeAttestation)); + sizeof(struct TALER_AgeAttestationP)); return GNUNET_OK; } @@ -454,7 +454,7 @@ TALER_age_commitment_attest ( return GNUNET_NO; { - struct TALER_AgeAttestationPS at = { + struct TALER_AgeAttestationPPS at = { .purpose.size = htonl (sizeof(at)), .purpose.purpose = htonl (TALER_SIGNATURE_WALLET_AGE_ATTESTATION), .mask.bits_nbo = htonl (cp->commitment.mask.bits), @@ -480,7 +480,7 @@ enum GNUNET_GenericReturnValue TALER_age_commitment_verify ( const struct TALER_AgeCommitment *comm, uint8_t age, - const struct TALER_AgeAttestation *attest) + const struct TALER_AgeAttestationP *attest) { uint8_t group; @@ -503,7 +503,7 @@ TALER_age_commitment_verify ( } { - struct TALER_AgeAttestationPS at = { + struct TALER_AgeAttestationPPS at = { .purpose.size = htonl (sizeof(at)), .purpose.purpose = htonl (TALER_SIGNATURE_WALLET_AGE_ATTESTATION), .mask.bits_nbo = htonl (comm->mask.bits), diff --git a/src/util/bench_age_restriction.c b/src/util/bench_age_restriction.c @@ -153,7 +153,7 @@ main (int argc, starttime; uint8_t min_group = get_age_group (&age_mask, 13); - struct TALER_AgeAttestation at = {0}; + struct TALER_AgeAttestationP at = {0}; ret = TALER_age_commitment_attest (&acp, 13, &at); @@ -174,7 +174,7 @@ main (int argc, &acp); uint8_t min_group = get_age_group (&age_mask, 13); - struct TALER_AgeAttestation at = {0}; + struct TALER_AgeAttestationP at = {0}; ret = TALER_age_commitment_attest (&acp, 13, diff --git a/src/util/crypto.c b/src/util/crypto.c @@ -481,7 +481,7 @@ TALER_planchet_prepare ( const union GNUNET_CRYPTO_BlindingSecretP *bks, const union GNUNET_CRYPTO_BlindSessionNonce *nonce, const struct TALER_CoinSpendPrivateKeyP *coin_priv, - const struct TALER_AgeCommitmentHash *ach, + const struct TALER_AgeCommitmentHashP *ach, struct TALER_CoinPubHashP *c_hash, struct TALER_PlanchetDetail *pd) { @@ -523,7 +523,7 @@ TALER_planchet_to_coin ( const struct TALER_BlindedDenominationSignature *blind_sig, const union GNUNET_CRYPTO_BlindingSecretP *bks, const struct TALER_CoinSpendPrivateKeyP *coin_priv, - const struct TALER_AgeCommitmentHash *ach, + const struct TALER_AgeCommitmentHashP *ach, const struct TALER_CoinPubHashP *c_hash, const struct TALER_ExchangeBlindingValues *alg_values, struct TALER_FreshCoin *coin) @@ -752,10 +752,10 @@ TALER_refresh_signature_to_secrets ( void TALER_coin_pub_hash (const struct TALER_CoinSpendPublicKeyP *coin_pub, - const struct TALER_AgeCommitmentHash *ach, + const struct TALER_AgeCommitmentHashP *ach, struct TALER_CoinPubHashP *coin_h) { - if (TALER_AgeCommitmentHash_isNullOrZero (ach)) + if (TALER_AgeCommitmentHashP_isNullOrZero (ach)) { /* No age commitment was set */ GNUNET_CRYPTO_hash (&coin_pub->eddsa_pub, @@ -778,7 +778,7 @@ TALER_coin_pub_hash (const struct TALER_CoinSpendPublicKeyP *coin_pub, GNUNET_CRYPTO_hash_context_read ( hash_context, ach, - sizeof(struct TALER_AgeCommitmentHash)); + sizeof(struct TALER_AgeCommitmentHashP)); GNUNET_CRYPTO_hash_context_finish ( hash_context, @@ -860,7 +860,7 @@ TALER_kyc_measure_authorization_hash ( const struct TALER_AccountAccessTokenP *access_token, uint64_t row, uint32_t offset, - struct TALER_KycMeasureAuthorizationHash *mah) + struct TALER_KycMeasureAuthorizationHashP *mah) { uint64_t be64 = GNUNET_htonll (row); uint32_t be32 = htonl ((uint32_t) offset); @@ -880,4 +880,24 @@ TALER_kyc_measure_authorization_hash ( } +void +TALER_merchant_instance_auth_hash_with_salt ( + struct TALER_MerchantAuthenticationHashP *auth_hash, + struct TALER_MerchantAuthenticationSaltP *salt, + const char *passphrase) +{ + GNUNET_assert (GNUNET_YES == + GNUNET_CRYPTO_kdf (auth_hash, + sizeof (*auth_hash), + salt, + sizeof (*salt), + passphrase, + strlen (passphrase), + "merchant-instance-auth", + strlen ("merchant-instance-auth"), + NULL, + 0)); +} + + /* end of crypto.c */ diff --git a/src/util/denom.c b/src/util/denom.c @@ -153,7 +153,7 @@ TALER_denom_blind ( const struct TALER_DenominationPublicKey *dk, const union GNUNET_CRYPTO_BlindingSecretP *coin_bks, const union GNUNET_CRYPTO_BlindSessionNonce *nonce, - const struct TALER_AgeCommitmentHash *ach, + const struct TALER_AgeCommitmentHashP *ach, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_ExchangeBlindingValues *alg_values, struct TALER_CoinPubHashP *c_hash, diff --git a/src/util/test_age_restriction.c b/src/util/test_age_restriction.c @@ -313,7 +313,7 @@ test_attestation (void) { enum GNUNET_GenericReturnValue ret; struct TALER_AgeCommitmentProof acp[3] = {0}; - struct TALER_AgeAttestation at = {0}; + struct TALER_AgeAttestationP at = {0}; uint8_t age_group = TALER_get_age_group (&age_mask, age); struct GNUNET_HashCode seed; diff --git a/src/util/test_crypto.c b/src/util/test_crypto.c @@ -129,8 +129,8 @@ test_planchets_rsa (uint8_t age) struct TALER_BlindedDenominationSignature blind_sig; struct TALER_FreshCoin coin; struct TALER_CoinPubHashP c_hash; - struct TALER_AgeCommitmentHash *ach = NULL; - struct TALER_AgeCommitmentHash ah = {0}; + struct TALER_AgeCommitmentHashP *ach = NULL; + struct TALER_AgeCommitmentHashP ah = {0}; alg_values = TALER_denom_ewv_rsa_singleton (); if (0 < age) @@ -228,8 +228,8 @@ test_planchets_cs (uint8_t age) struct TALER_BlindedDenominationSignature blind_sig; struct TALER_FreshCoin coin; struct TALER_ExchangeBlindingValues alg_values; - struct TALER_AgeCommitmentHash *ach = NULL; - struct TALER_AgeCommitmentHash ah = {0}; + struct TALER_AgeCommitmentHashP *ach = NULL; + struct TALER_AgeCommitmentHashP ah = {0}; if (0 < age) { diff --git a/src/util/test_helper_rsa.c b/src/util/test_helper_rsa.c @@ -270,7 +270,7 @@ test_signing (struct TALER_CRYPTO_RsaDenominationHelper *dh) struct TALER_PlanchetMasterSecretP ps; const struct TALER_ExchangeBlindingValues *alg_values = TALER_denom_ewv_rsa_singleton (); - struct TALER_AgeCommitmentHash ach; + struct TALER_AgeCommitmentHashP ach; struct TALER_CoinPubHashP c_hash; struct TALER_CoinSpendPrivateKeyP coin_priv; union GNUNET_CRYPTO_BlindingSecretP bks; @@ -463,7 +463,7 @@ test_batch_signing (struct TALER_CRYPTO_RsaDenominationHelper *dh, bool success = false; struct TALER_PlanchetMasterSecretP ps[batch_size]; const struct TALER_ExchangeBlindingValues *alg_values; - struct TALER_AgeCommitmentHash ach[batch_size]; + struct TALER_AgeCommitmentHashP ach[batch_size]; struct TALER_CoinPubHashP c_hash[batch_size]; struct TALER_CoinSpendPrivateKeyP coin_priv[batch_size]; union GNUNET_CRYPTO_BlindingSecretP bks[batch_size]; @@ -681,7 +681,7 @@ perf_signing (struct TALER_CRYPTO_RsaDenominationHelper *dh, struct GNUNET_TIME_Relative duration; struct TALER_PlanchetMasterSecretP ps; struct TALER_CoinSpendPrivateKeyP coin_priv; - struct TALER_AgeCommitmentHash ach; + struct TALER_AgeCommitmentHashP ach; union GNUNET_CRYPTO_BlindingSecretP bks; const struct TALER_ExchangeBlindingValues *alg_values = TALER_denom_ewv_rsa_singleton (); diff --git a/src/util/tv_age_restriction.c b/src/util/tv_age_restriction.c @@ -83,7 +83,7 @@ cp_to_j ( json_t *j_proof; json_t *j_pubs; json_t *j_privs; - struct TALER_AgeCommitmentHash hac = {0}; + struct TALER_AgeCommitmentHashP hac = {0}; char buf[256] = {0}; TALER_age_commitment_hash (&acp->commitment, &hac); @@ -191,7 +191,7 @@ generate ( json_t *j_attest = json_object (); json_t *j_reason; uint8_t min_group = get_age_group (mask, min); - struct TALER_AgeAttestation at = {0}; + struct TALER_AgeAttestationP at = {0}; json_object_set (j_attest, "required_minimum_age", diff --git a/src/util/wallet_signatures.c b/src/util/wallet_signatures.c @@ -49,7 +49,7 @@ struct TALER_DepositRequestPS * Hash over the age commitment that went into the coin. Maybe all zero, if * age commitment isn't applicable to the denomination. */ - struct TALER_AgeCommitmentHash h_age_commitment GNUNET_PACKED; + struct TALER_AgeCommitmentHashP h_age_commitment GNUNET_PACKED; /** * Hash over optional policy extension attributes shared with the exchange. @@ -129,7 +129,7 @@ TALER_wallet_deposit_sign ( const struct TALER_MerchantWireHashP *h_wire, const struct TALER_PrivateContractHashP *h_contract_terms, const struct GNUNET_HashCode *wallet_data_hash, - const struct TALER_AgeCommitmentHash *h_age_commitment, + const struct TALER_AgeCommitmentHashP *h_age_commitment, const struct TALER_ExtensionPolicyHashP *h_policy, const struct TALER_DenominationHashP *h_denom_pub, const struct GNUNET_TIME_Timestamp wallet_timestamp, @@ -172,7 +172,7 @@ TALER_wallet_deposit_verify ( const struct TALER_MerchantWireHashP *h_wire, const struct TALER_PrivateContractHashP *h_contract_terms, const struct GNUNET_HashCode *wallet_data_hash, - const struct TALER_AgeCommitmentHash *h_age_commitment, + const struct TALER_AgeCommitmentHashP *h_age_commitment, const struct TALER_ExtensionPolicyHashP *h_policy, const struct TALER_DenominationHashP *h_denom_pub, struct GNUNET_TIME_Timestamp wallet_timestamp, @@ -243,7 +243,7 @@ struct TALER_LinkDataPS /** * Hash of the age commitment, if applicable. Can be all zero */ - struct TALER_AgeCommitmentHash h_age_commitment; + struct TALER_AgeCommitmentHashP h_age_commitment; /** * Hash of the blinded new coin. @@ -439,7 +439,7 @@ struct TALER_RefreshMeltCoinAffirmationPS * the hash of the age commitment vector. It must be all zeroes if no age * commitment was provided. */ - struct TALER_AgeCommitmentHash h_age_commitment GNUNET_PACKED; + struct TALER_AgeCommitmentHashP h_age_commitment GNUNET_PACKED; /** * How much of the value of the coin should be melted? This amount @@ -471,7 +471,7 @@ TALER_wallet_melt_sign ( const struct TALER_Amount *melt_fee, const struct TALER_RefreshCommitmentP *rc, const struct TALER_DenominationHashP *h_denom_pub, - const struct TALER_AgeCommitmentHash *h_age_commitment, + const struct TALER_AgeCommitmentHashP *h_age_commitment, const struct TALER_CoinSpendPrivateKeyP *coin_priv, struct TALER_CoinSpendSignatureP *coin_sig) { @@ -500,7 +500,7 @@ TALER_wallet_melt_verify ( const struct TALER_Amount *melt_fee, const struct TALER_RefreshCommitmentP *rc, const struct TALER_DenominationHashP *h_denom_pub, - const struct TALER_AgeCommitmentHash *h_age_commitment, + const struct TALER_AgeCommitmentHashP *h_age_commitment, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendSignatureP *coin_sig) { @@ -1338,7 +1338,7 @@ struct TALER_PurseDepositPS * Hash over the age commitment that went into the coin. Maybe all zero, if * age commitment isn't applicable to the denomination. */ - struct TALER_AgeCommitmentHash h_age_commitment GNUNET_PACKED; + struct TALER_AgeCommitmentHashP h_age_commitment GNUNET_PACKED; /** * Purse to deposit funds into. @@ -1360,7 +1360,7 @@ TALER_wallet_purse_deposit_sign ( const struct TALER_PurseContractPublicKeyP *purse_pub, const struct TALER_Amount *amount, const struct TALER_DenominationHashP *h_denom_pub, - const struct TALER_AgeCommitmentHash *h_age_commitment, + const struct TALER_AgeCommitmentHashP *h_age_commitment, const struct TALER_CoinSpendPrivateKeyP *coin_priv, struct TALER_CoinSpendSignatureP *coin_sig) { @@ -1389,7 +1389,7 @@ TALER_wallet_purse_deposit_verify ( const struct TALER_PurseContractPublicKeyP *purse_pub, const struct TALER_Amount *amount, const struct TALER_DenominationHashP *h_denom_pub, - const struct TALER_AgeCommitmentHash *h_age_commitment, + const struct TALER_AgeCommitmentHashP *h_age_commitment, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendSignatureP *coin_sig) {