diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-09-26 15:05:27 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-09-26 15:05:27 +0200 |
commit | a0d410e01b77373fc2ee2d60d082d470c3c75474 (patch) | |
tree | f040313b1d84daf5ed7460779b4544d96fdfa619 /src | |
parent | d36a2008e83ffea35dbbcbe48c221843de875b46 (diff) |
fix mapping of auditor sigs to DKs, avoid one hash operation by caching hash value
Diffstat (limited to 'src')
-rw-r--r-- | src/auditor/taler-auditor-sign.c | 7 | ||||
-rw-r--r-- | src/exchange-lib/exchange_api_handle.c | 1 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_keystate.c | 17 | ||||
-rw-r--r-- | src/include/taler_signatures.h | 2 |
4 files changed, 17 insertions, 10 deletions
diff --git a/src/auditor/taler-auditor-sign.c b/src/auditor/taler-auditor-sign.c index 3fa1d76db..70c40982b 100644 --- a/src/auditor/taler-auditor-sign.c +++ b/src/auditor/taler-auditor-sign.c @@ -341,9 +341,10 @@ main (int argc, kv.denom_hash = dk->denom_hash; /* Finally sign ... */ - GNUNET_CRYPTO_eddsa_sign (eddsa_priv, - &kv.purpose, - &sigs[i].eddsa_sig); + GNUNET_assert (GNUNET_OK == + GNUNET_CRYPTO_eddsa_sign (eddsa_priv, + &kv.purpose, + &sigs[i].eddsa_sig)); } if (NULL == output_file) diff --git a/src/exchange-lib/exchange_api_handle.c b/src/exchange-lib/exchange_api_handle.c index fc48060ce..e89448d6e 100644 --- a/src/exchange-lib/exchange_api_handle.c +++ b/src/exchange-lib/exchange_api_handle.c @@ -472,6 +472,7 @@ parse_json_auditor (struct TALER_EXCHANGE_AuditorInformation *auditor, TALER_amount_hton (&kv.fee_refund, &dk->fee_refund); kv.denom_hash = dk->h_key; + if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS, &kv.purpose, diff --git a/src/exchange/taler-exchange-httpd_keystate.c b/src/exchange/taler-exchange-httpd_keystate.c index facea88e2..fc72a1305 100644 --- a/src/exchange/taler-exchange-httpd_keystate.c +++ b/src/exchange/taler-exchange-httpd_keystate.c @@ -99,6 +99,11 @@ struct DenominationKeyEntry */ struct AuditorSignature *as_tail; + /** + * Hash of the public denomination key. + */ + struct GNUNET_HashCode denom_key_hash; + }; @@ -898,7 +903,7 @@ reload_auditor_iter (void *cls, if (0 != memcmp (dki, - &dke->dki->issue.properties, + &dke->dki[i].issue.properties, sizeof (struct TALER_DenominationKeyValidityPS))) continue; as = GNUNET_malloc (sizeof (struct AuditorSignature) + @@ -937,6 +942,7 @@ initialize_denomkey_array (void *cls, struct ResponseFactoryContext *rfc = cls; struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki = value; + rfc->denomkey_array[rfc->denomkey_array_length].denom_key_hash = *denom_hash; rfc->denomkey_array[rfc->denomkey_array_length++].dki = dki; return GNUNET_OK; } @@ -1175,12 +1181,11 @@ build_keys_response (const struct ResponseFactoryContext *rfc, /* Add denomination key to the response */ const struct DenominationKeyEntry *dke = &rfc->denomkey_array[i]; - struct GNUNET_HashCode denom_key_hash; + const struct GNUNET_HashCode *denom_key_hash + = &dke->denom_key_hash; - GNUNET_CRYPTO_rsa_public_key_hash (dke->dki->denom_pub.rsa_public_key, - &denom_key_hash); GNUNET_CRYPTO_hash_context_read (rbc.hash_context, - &denom_key_hash, + denom_key_hash, sizeof (struct GNUNET_HashCode)); if (0 != json_array_append_new (rbc.denom_keys_array, @@ -1221,7 +1226,7 @@ build_keys_response (const struct ResponseFactoryContext *rfc, json_array_append_new (ae->ar, json_pack ("{s:o, s:o}", "denom_pub_h", - GNUNET_JSON_from_data_auto (&denom_key_hash), + GNUNET_JSON_from_data_auto (denom_key_hash), "auditor_sig", GNUNET_JSON_from_data_auto (&as->asig)))); } diff --git a/src/include/taler_signatures.h b/src/include/taler_signatures.h index 181c50169..db71cca68 100644 --- a/src/include/taler_signatures.h +++ b/src/include/taler_signatures.h @@ -793,7 +793,7 @@ struct TALER_ExchangeKeyValidityPS struct GNUNET_CRYPTO_EccSignaturePurpose purpose; /** - * Hash of the auditor's URL. + * Hash of the auditor's URL (including 0-terminator). */ struct GNUNET_HashCode auditor_url_hash; |