fix mapping of auditor sigs to DKs, avoid one hash operation by caching hash value
This commit is contained in:
parent
d36a2008e8
commit
a0d410e01b
@ -341,9 +341,10 @@ main (int argc,
|
|||||||
kv.denom_hash = dk->denom_hash;
|
kv.denom_hash = dk->denom_hash;
|
||||||
|
|
||||||
/* Finally sign ... */
|
/* Finally sign ... */
|
||||||
GNUNET_CRYPTO_eddsa_sign (eddsa_priv,
|
GNUNET_assert (GNUNET_OK ==
|
||||||
&kv.purpose,
|
GNUNET_CRYPTO_eddsa_sign (eddsa_priv,
|
||||||
&sigs[i].eddsa_sig);
|
&kv.purpose,
|
||||||
|
&sigs[i].eddsa_sig));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL == output_file)
|
if (NULL == output_file)
|
||||||
|
@ -472,6 +472,7 @@ parse_json_auditor (struct TALER_EXCHANGE_AuditorInformation *auditor,
|
|||||||
TALER_amount_hton (&kv.fee_refund,
|
TALER_amount_hton (&kv.fee_refund,
|
||||||
&dk->fee_refund);
|
&dk->fee_refund);
|
||||||
kv.denom_hash = dk->h_key;
|
kv.denom_hash = dk->h_key;
|
||||||
|
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS,
|
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS,
|
||||||
&kv.purpose,
|
&kv.purpose,
|
||||||
|
@ -99,6 +99,11 @@ struct DenominationKeyEntry
|
|||||||
*/
|
*/
|
||||||
struct AuditorSignature *as_tail;
|
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 !=
|
if (0 !=
|
||||||
memcmp (dki,
|
memcmp (dki,
|
||||||
&dke->dki->issue.properties,
|
&dke->dki[i].issue.properties,
|
||||||
sizeof (struct TALER_DenominationKeyValidityPS)))
|
sizeof (struct TALER_DenominationKeyValidityPS)))
|
||||||
continue;
|
continue;
|
||||||
as = GNUNET_malloc (sizeof (struct AuditorSignature) +
|
as = GNUNET_malloc (sizeof (struct AuditorSignature) +
|
||||||
@ -937,6 +942,7 @@ initialize_denomkey_array (void *cls,
|
|||||||
struct ResponseFactoryContext *rfc = cls;
|
struct ResponseFactoryContext *rfc = cls;
|
||||||
struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki = value;
|
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;
|
rfc->denomkey_array[rfc->denomkey_array_length++].dki = dki;
|
||||||
return GNUNET_OK;
|
return GNUNET_OK;
|
||||||
}
|
}
|
||||||
@ -1175,12 +1181,11 @@ build_keys_response (const struct ResponseFactoryContext *rfc,
|
|||||||
/* Add denomination key to the response */
|
/* Add denomination key to the response */
|
||||||
const struct DenominationKeyEntry *dke
|
const struct DenominationKeyEntry *dke
|
||||||
= &rfc->denomkey_array[i];
|
= &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,
|
GNUNET_CRYPTO_hash_context_read (rbc.hash_context,
|
||||||
&denom_key_hash,
|
denom_key_hash,
|
||||||
sizeof (struct GNUNET_HashCode));
|
sizeof (struct GNUNET_HashCode));
|
||||||
if (0 !=
|
if (0 !=
|
||||||
json_array_append_new (rbc.denom_keys_array,
|
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_array_append_new (ae->ar,
|
||||||
json_pack ("{s:o, s:o}",
|
json_pack ("{s:o, s:o}",
|
||||||
"denom_pub_h",
|
"denom_pub_h",
|
||||||
GNUNET_JSON_from_data_auto (&denom_key_hash),
|
GNUNET_JSON_from_data_auto (denom_key_hash),
|
||||||
"auditor_sig",
|
"auditor_sig",
|
||||||
GNUNET_JSON_from_data_auto (&as->asig))));
|
GNUNET_JSON_from_data_auto (&as->asig))));
|
||||||
}
|
}
|
||||||
|
@ -793,7 +793,7 @@ struct TALER_ExchangeKeyValidityPS
|
|||||||
struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
|
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;
|
struct GNUNET_HashCode auditor_url_hash;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user