remove master_pub from DB

This commit is contained in:
Christian Grothoff 2021-01-15 11:53:54 +01:00
parent 57a0fc8d1f
commit 3b9c381112
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
7 changed files with 24 additions and 25 deletions

View File

@ -18,3 +18,4 @@ generate-auditor-basedb-prod.conf
generate-auditor-basedb-revocation.conf generate-auditor-basedb-revocation.conf
revocation-tmp-* revocation-tmp-*
auditor-basedb.wdb auditor-basedb.wdb
taler-auditor-sync

View File

@ -212,6 +212,7 @@ add_denomination (
i = GNUNET_new (struct TALER_DenominationKeyValidityPS); i = GNUNET_new (struct TALER_DenominationKeyValidityPS);
*i = *issue; *i = *issue;
i->master = TALER_ARL_master_pub;
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
GNUNET_CONTAINER_multihashmap_put (denominations, GNUNET_CONTAINER_multihashmap_put (denominations,
&issue->denom_hash, &issue->denom_hash,

View File

@ -199,7 +199,6 @@ add_keys (void *cls,
&akc->d_sigs[i].h_denom_pub, &akc->d_sigs[i].h_denom_pub,
&denom_pub, &denom_pub,
&meta, &meta,
&TEH_master_public_key,
&akc->d_sigs[i].master_sig); &akc->d_sigs[i].master_sig);
GNUNET_CRYPTO_rsa_public_key_free (denom_pub.rsa_public_key); GNUNET_CRYPTO_rsa_public_key_free (denom_pub.rsa_public_key);
if (qs < 0) if (qs < 0)

View File

@ -44,6 +44,10 @@ COMMENT ON INDEX prepare_get_index
IS 'for wire_prepare_data_get'; IS 'for wire_prepare_data_get';
-- we do not actually need the master public key, it is always the same
ALTER TABLE denominations
DROP COLUMN master_pub;
-- need serial IDs on various tables for exchange-auditor replication -- need serial IDs on various tables for exchange-auditor replication
ALTER TABLE denominations ALTER TABLE denominations
ADD COLUMN denominations_serial BIGSERIAL UNIQUE; ADD COLUMN denominations_serial BIGSERIAL UNIQUE;

View File

@ -38,13 +38,11 @@ irbt_cb_table_denominations (struct PostgresClosure *pg,
const struct TALER_EXCHANGEDB_TableData *td) const struct TALER_EXCHANGEDB_TableData *td)
{ {
struct GNUNET_HashCode denom_hash; struct GNUNET_HashCode denom_hash;
static struct TALER_MasterPublicKeyP master_pub;
struct GNUNET_PQ_QueryParam params[] = { struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial), GNUNET_PQ_query_param_uint64 (&td->serial),
GNUNET_PQ_query_param_auto_from_type (&denom_hash), GNUNET_PQ_query_param_auto_from_type (&denom_hash),
GNUNET_PQ_query_param_rsa_public_key ( GNUNET_PQ_query_param_rsa_public_key (
td->details.denominations.denom_pub.rsa_public_key), td->details.denominations.denom_pub.rsa_public_key),
GNUNET_PQ_query_param_auto_from_type (&master_pub), // FIXME: !?
GNUNET_PQ_query_param_auto_from_type ( GNUNET_PQ_query_param_auto_from_type (
&td->details.denominations.master_sig), &td->details.denominations.master_sig),
TALER_PQ_query_param_absolute_time ( TALER_PQ_query_param_absolute_time (

View File

@ -273,7 +273,6 @@ postgres_get_session (void *cls)
"INSERT INTO denominations " "INSERT INTO denominations "
"(denom_pub_hash" "(denom_pub_hash"
",denom_pub" ",denom_pub"
",master_pub"
",master_sig" ",master_sig"
",valid_from" ",valid_from"
",expire_withdraw" ",expire_withdraw"
@ -291,13 +290,12 @@ postgres_get_session (void *cls)
",fee_refund_frac" ",fee_refund_frac"
") VALUES " ") VALUES "
"($1, $2, $3, $4, $5, $6, $7, $8, $9, $10," "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10,"
" $11, $12, $13, $14, $15, $16, $17, $18);", " $11, $12, $13, $14, $15, $16, $17);",
18), 17),
/* Used in #postgres_iterate_denomination_info() */ /* Used in #postgres_iterate_denomination_info() */
GNUNET_PQ_make_prepare ("denomination_iterate", GNUNET_PQ_make_prepare ("denomination_iterate",
"SELECT" "SELECT"
" master_pub" " master_sig"
",master_sig"
",valid_from" ",valid_from"
",expire_withdraw" ",expire_withdraw"
",expire_deposit" ",expire_deposit"
@ -379,8 +377,7 @@ postgres_get_session (void *cls)
/* Used in #postgres_get_denomination_info() */ /* Used in #postgres_get_denomination_info() */
GNUNET_PQ_make_prepare ("denomination_get", GNUNET_PQ_make_prepare ("denomination_get",
"SELECT" "SELECT"
" master_pub" " master_sig"
",master_sig"
",valid_from" ",valid_from"
",expire_withdraw" ",expire_withdraw"
",expire_deposit" ",expire_deposit"
@ -2187,7 +2184,6 @@ postgres_get_session (void *cls)
"(denominations_serial" "(denominations_serial"
",denom_pub_hash" ",denom_pub_hash"
",denom_pub" ",denom_pub"
",master_pub"
",master_sig" ",master_sig"
",valid_from" ",valid_from"
",expire_withdraw" ",expire_withdraw"
@ -2205,8 +2201,8 @@ postgres_get_session (void *cls)
",fee_refund_frac" ",fee_refund_frac"
") VALUES " ") VALUES "
"($1, $2, $3, $4, $5, $6, $7, $8, $9, $10," "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10,"
" $11, $12, $13, $14, $15, $16, $17, $18, $19);", " $11, $12, $13, $14, $15, $16, $17, $18);",
19), 18),
GNUNET_PQ_make_prepare ("insert_into_table_denomination_revocations", GNUNET_PQ_make_prepare ("insert_into_table_denomination_revocations",
"INSERT INTO denomination_revocations" "INSERT INTO denomination_revocations"
"(denom_revocations_serial_id" "(denom_revocations_serial_id"
@ -2642,7 +2638,6 @@ postgres_insert_denomination_info (
struct GNUNET_PQ_QueryParam params[] = { struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (&issue->properties.denom_hash), GNUNET_PQ_query_param_auto_from_type (&issue->properties.denom_hash),
GNUNET_PQ_query_param_rsa_public_key (denom_pub->rsa_public_key), GNUNET_PQ_query_param_rsa_public_key (denom_pub->rsa_public_key),
GNUNET_PQ_query_param_auto_from_type (&issue->properties.master),
GNUNET_PQ_query_param_auto_from_type (&issue->signature), GNUNET_PQ_query_param_auto_from_type (&issue->signature),
TALER_PQ_query_param_absolute_time_nbo (&issue->properties.start), TALER_PQ_query_param_absolute_time_nbo (&issue->properties.start),
TALER_PQ_query_param_absolute_time_nbo (&issue->properties.expire_withdraw), TALER_PQ_query_param_absolute_time_nbo (&issue->properties.expire_withdraw),
@ -2700,8 +2695,6 @@ postgres_get_denomination_info (
GNUNET_PQ_query_param_end GNUNET_PQ_query_param_end
}; };
struct GNUNET_PQ_ResultSpec rs[] = { struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_auto_from_type ("master_pub",
&issue->properties.master),
GNUNET_PQ_result_spec_auto_from_type ("master_sig", GNUNET_PQ_result_spec_auto_from_type ("master_sig",
&issue->signature), &issue->signature),
TALER_PQ_result_spec_absolute_time_nbo ("valid_from", TALER_PQ_result_spec_absolute_time_nbo ("valid_from",
@ -2725,6 +2718,9 @@ postgres_get_denomination_info (
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
memset (&issue->properties.master,
0,
sizeof (issue->properties.master));
qs = GNUNET_PQ_eval_prepared_singleton_select (session->conn, qs = GNUNET_PQ_eval_prepared_singleton_select (session->conn,
"denomination_get", "denomination_get",
params, params,
@ -2783,8 +2779,6 @@ domination_cb_helper (void *cls,
struct TALER_EXCHANGEDB_DenominationKeyInformationP issue; struct TALER_EXCHANGEDB_DenominationKeyInformationP issue;
struct TALER_DenominationPublicKey denom_pub; struct TALER_DenominationPublicKey denom_pub;
struct GNUNET_PQ_ResultSpec rs[] = { struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_auto_from_type ("master_pub",
&issue.properties.master),
GNUNET_PQ_result_spec_auto_from_type ("master_sig", GNUNET_PQ_result_spec_auto_from_type ("master_sig",
&issue.signature), &issue.signature),
TALER_PQ_result_spec_absolute_time_nbo ("valid_from", TALER_PQ_result_spec_absolute_time_nbo ("valid_from",
@ -2810,6 +2804,9 @@ domination_cb_helper (void *cls,
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
memset (&issue.properties.master,
0,
sizeof (issue.properties.master));
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_PQ_extract_result (result, GNUNET_PQ_extract_result (result,
rs, rs,
@ -9411,7 +9408,6 @@ postgres_lookup_denomination_key (
* @param h_denom_pub hash of the denomination public key * @param h_denom_pub hash of the denomination public key
* @param denom_pub the actual denomination key * @param denom_pub the actual denomination key
* @param meta meta data about the denomination * @param meta meta data about the denomination
* @param master_pub master public key
* @param master_sig master signature to add * @param master_sig master signature to add
* @return transaction status code * @return transaction status code
*/ */
@ -9422,14 +9418,12 @@ postgres_add_denomination_key (
const struct GNUNET_HashCode *h_denom_pub, const struct GNUNET_HashCode *h_denom_pub,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_EXCHANGEDB_DenominationKeyMetaData *meta, const struct TALER_EXCHANGEDB_DenominationKeyMetaData *meta,
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_MasterSignatureP *master_sig) const struct TALER_MasterSignatureP *master_sig)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam iparams[] = { struct GNUNET_PQ_QueryParam iparams[] = {
GNUNET_PQ_query_param_auto_from_type (h_denom_pub), GNUNET_PQ_query_param_auto_from_type (h_denom_pub),
GNUNET_PQ_query_param_rsa_public_key (denom_pub->rsa_public_key), GNUNET_PQ_query_param_rsa_public_key (denom_pub->rsa_public_key),
GNUNET_PQ_query_param_auto_from_type (master_pub),
GNUNET_PQ_query_param_auto_from_type (master_sig), GNUNET_PQ_query_param_auto_from_type (master_sig),
TALER_PQ_query_param_absolute_time (&meta->start), TALER_PQ_query_param_absolute_time (&meta->start),
TALER_PQ_query_param_absolute_time (&meta->expire_withdraw), TALER_PQ_query_param_absolute_time (&meta->expire_withdraw),

View File

@ -2017,10 +2017,12 @@ typedef void
/** /**
* Function called with information about the exchange's denomination keys. * Function called with information about the exchange's denomination keys.
* Note that the 'master' field in @a issue will not yet be initialized when
* this function is called!
* *
* @param cls closure * @param cls closure
* @param denom_pub public key of the denomination * @param denom_pub public key of the denomination
* @param issue detailed information about the denomination (value, expiration times, fees) * @param issue detailed information about the denomination (value, expiration times, fees);
*/ */
typedef void typedef void
(*TALER_EXCHANGEDB_DenominationCallback)( (*TALER_EXCHANGEDB_DenominationCallback)(
@ -2167,7 +2169,9 @@ struct TALER_EXCHANGEDB_Plugin
/** /**
* Function called on every known denomination key. Runs in its * Function called on every known denomination key. Runs in its
* own read-only transaction (hence no session provided). * own read-only transaction (hence no session provided). Note that
* the "master" field in the callback's 'issue' argument will NOT
* be initialized yet.
* *
* @param cls the @e cls of this struct with the plugin-specific state * @param cls the @e cls of this struct with the plugin-specific state
* @param session session to use * @param session session to use
@ -3648,7 +3652,6 @@ struct TALER_EXCHANGEDB_Plugin
* @param h_denom_pub hash of the denomination public key * @param h_denom_pub hash of the denomination public key
* @param denom_pub the denomination public key * @param denom_pub the denomination public key
* @param meta meta data about the denomination * @param meta meta data about the denomination
* @param master_pub master public key (consider removing this in the future!)
* @param master_sig master signature to add * @param master_sig master signature to add
* @return transaction status code * @return transaction status code
*/ */
@ -3659,7 +3662,6 @@ struct TALER_EXCHANGEDB_Plugin
const struct GNUNET_HashCode *h_denom_pub, const struct GNUNET_HashCode *h_denom_pub,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_EXCHANGEDB_DenominationKeyMetaData *meta, const struct TALER_EXCHANGEDB_DenominationKeyMetaData *meta,
const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_MasterSignatureP *master_sig); const struct TALER_MasterSignatureP *master_sig);