Refactor exchange_api_handle for GNUNET_memcmp

This commit is contained in:
ng0 2019-04-10 20:48:39 +00:00
parent 7bebb3c780
commit b7b53da061
No known key found for this signature in database
GPG Key ID: E22F9BBFEE348588

View File

@ -988,9 +988,8 @@ decode_keys_json (const json_t *resp_obj,
{ {
struct TALER_EXCHANGE_AuditorInformation *aix = &key_data->auditors[j]; struct TALER_EXCHANGE_AuditorInformation *aix = &key_data->auditors[j];
if (0 == memcmp (&ai.auditor_pub, if (0 == GNUNET_memcmp (&ai.auditor_pub,
&aix->auditor_pub, &aix->auditor_pub))
sizeof (struct TALER_AuditorPublicKeyP)))
{ {
found = GNUNET_YES; found = GNUNET_YES;
/* Merge denomination key signatures of downloaded /keys into existing /* Merge denomination key signatures of downloaded /keys into existing
@ -1953,9 +1952,8 @@ TALER_EXCHANGE_get_signing_key_details (const struct TALER_EXCHANGE_Keys *keys,
{ {
struct TALER_EXCHANGE_SigningPublicKey *spk = &keys->sign_keys[i]; struct TALER_EXCHANGE_SigningPublicKey *spk = &keys->sign_keys[i];
if (0 == memcmp (pub, if (0 == GNUNET_memcmp (pub,
&spk->key, &spk->key))
sizeof (struct TALER_ExchangePublicKeyP)))
return spk; return spk;
} }
return NULL; return NULL;
@ -1981,9 +1979,8 @@ TALER_EXCHANGE_test_signing_key (const struct TALER_EXCHANGE_Keys *keys,
for (unsigned int i=0;i<keys->num_sign_keys;i++) for (unsigned int i=0;i<keys->num_sign_keys;i++)
if ( (keys->sign_keys[i].valid_from.abs_value_us <= now.abs_value_us + 60 * 60 * 1000LL * 1000LL) && if ( (keys->sign_keys[i].valid_from.abs_value_us <= now.abs_value_us + 60 * 60 * 1000LL * 1000LL) &&
(keys->sign_keys[i].valid_until.abs_value_us > now.abs_value_us - 60 * 60 * 1000LL * 1000LL) && (keys->sign_keys[i].valid_until.abs_value_us > now.abs_value_us - 60 * 60 * 1000LL * 1000LL) &&
(0 == memcmp (pub, (0 == GNUNET_memcmp (pub,
&keys->sign_keys[i].key, &keys->sign_keys[i].key)) )
sizeof (struct TALER_ExchangePublicKeyP))) )
return GNUNET_OK; return GNUNET_OK;
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
@ -2034,9 +2031,8 @@ TALER_EXCHANGE_get_denomination_key_by_hash (const struct TALER_EXCHANGE_Keys *k
const struct GNUNET_HashCode *hc) const struct GNUNET_HashCode *hc)
{ {
for (unsigned int i=0;i<keys->num_denom_keys;i++) for (unsigned int i=0;i<keys->num_denom_keys;i++)
if (0 == memcmp (hc, if (0 == GNUNET_memcmp (hc,
&keys->denom_keys[i].h_key, &keys->denom_keys[i].h_key))
sizeof (struct GNUNET_HashCode)))
return &keys->denom_keys[i]; return &keys->denom_keys[i];
return NULL; return NULL;
} }