summaryrefslogtreecommitdiff
path: root/src/exchange
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-05-24 20:13:31 +0200
committerChristian Grothoff <christian@grothoff.org>2016-05-24 20:13:31 +0200
commit32bb3b14bf5cd623714985c8ca7fed0c5a923336 (patch)
tree2438cf9567c4eb755ae6d8882383395fd23e408e /src/exchange
parent8c3ffbf2a356b7c684bb65b8678e819183e52d76 (diff)
downloadexchange-32bb3b14bf5cd623714985c8ca7fed0c5a923336.tar.gz
exchange-32bb3b14bf5cd623714985c8ca7fed0c5a923336.tar.bz2
exchange-32bb3b14bf5cd623714985c8ca7fed0c5a923336.zip
fix #4483
Diffstat (limited to 'src/exchange')
-rw-r--r--src/exchange/taler-exchange-httpd_db.c24
-rw-r--r--src/exchange/taler-exchange-httpd_refresh.c17
-rw-r--r--src/exchange/taler-exchange-httpd_responses.c9
3 files changed, 15 insertions, 35 deletions
diff --git a/src/exchange/taler-exchange-httpd_db.c b/src/exchange/taler-exchange-httpd_db.c
index 981c97289..7e3ce0a44 100644
--- a/src/exchange/taler-exchange-httpd_db.c
+++ b/src/exchange/taler-exchange-httpd_db.c
@@ -1248,31 +1248,23 @@ check_commitment (struct MHD_Connection *connection,
for (j = 0; j < num_newcoins; j++)
{
- struct TALER_RefreshLinkDecrypted *link_data;
+ struct TALER_RefreshLinkDecryptedP link_data;
struct TALER_CoinSpendPublicKeyP coin_pub;
struct GNUNET_HashCode h_msg;
char *buf;
size_t buf_len;
-
- link_data = TALER_refresh_decrypt (commit_coins[j].refresh_link,
- &shared_secret);
- if (NULL == link_data)
- {
- GNUNET_break (0);
- GNUNET_free (commit_coins);
- return (MHD_YES == TMH_RESPONSE_reply_internal_error (connection,
- "Decryption error"))
- ? GNUNET_NO : GNUNET_SYSERR;
- }
-
- GNUNET_CRYPTO_eddsa_key_get_public (&link_data->coin_priv.eddsa_priv,
+
+ TALER_refresh_decrypt (&commit_coins[j].refresh_link,
+ &shared_secret,
+ &link_data);
+ GNUNET_CRYPTO_eddsa_key_get_public (&link_data.coin_priv.eddsa_priv,
&coin_pub.eddsa_pub);
GNUNET_CRYPTO_hash (&coin_pub,
sizeof (struct TALER_CoinSpendPublicKeyP),
&h_msg);
if (0 == (buf_len =
GNUNET_CRYPTO_rsa_blind (&h_msg,
- link_data->blinding_key.rsa_blinding_key,
+ &link_data.blinding_key.bks,
denom_pubs[j].rsa_public_key,
&buf)))
{
@@ -1283,7 +1275,7 @@ check_commitment (struct MHD_Connection *connection,
"Blinding error"))
? GNUNET_NO : GNUNET_SYSERR;
}
-
+
if ( (buf_len != commit_coins[j].coin_ev_size) ||
(0 != memcmp (buf,
commit_coins[j].coin_ev,
diff --git a/src/exchange/taler-exchange-httpd_refresh.c b/src/exchange/taler-exchange-httpd_refresh.c
index 0499c44f2..0f291e99a 100644
--- a/src/exchange/taler-exchange-httpd_refresh.c
+++ b/src/exchange/taler-exchange-httpd_refresh.c
@@ -304,10 +304,7 @@ free_commit_coins (struct TALER_EXCHANGEDB_RefreshCommitCoin **commit_coin,
if (NULL == commit_coin[i])
break;
for (j=0;j<num_new_coins;j++)
- {
GNUNET_free_non_null (commit_coin[i][j].coin_ev);
- GNUNET_free_non_null (commit_coin[i][j].refresh_link);
- }
GNUNET_free (commit_coin[i]);
}
}
@@ -415,8 +412,6 @@ handle_refresh_melt_json (struct MHD_Connection *connection,
struct TALER_EXCHANGEDB_RefreshCommitCoin);
for (j = 0; j < num_newcoins; j++)
{
- char *link_enc;
- size_t link_enc_size;
struct TALER_EXCHANGEDB_RefreshCommitCoin *rcc = &commit_coin[i][j];
struct GNUNET_JSON_Specification coin_spec[] = {
GNUNET_JSON_spec_varsize (NULL,
@@ -425,9 +420,8 @@ handle_refresh_melt_json (struct MHD_Connection *connection,
GNUNET_JSON_spec_end ()
};
struct GNUNET_JSON_Specification link_spec[] = {
- GNUNET_JSON_spec_varsize (NULL,
- (void **) &link_enc,
- &link_enc_size),
+ GNUNET_JSON_spec_fixed_auto (NULL,
+ &rcc->refresh_link),
GNUNET_JSON_spec_end ()
};
@@ -455,12 +449,9 @@ handle_refresh_melt_json (struct MHD_Connection *connection,
res = (GNUNET_SYSERR == res) ? MHD_NO : MHD_YES;
goto cleanup;
}
- rcc->refresh_link
- = TALER_refresh_link_encrypted_decode (link_enc,
- link_enc_size);
GNUNET_CRYPTO_hash_context_read (hash_context,
- link_enc,
- link_enc_size);
+ &rcc->refresh_link,
+ sizeof (rcc->refresh_link));
GNUNET_JSON_parse_free (link_spec);
}
}
diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c
index 6873b2a8c..91b54b0b2 100644
--- a/src/exchange/taler-exchange-httpd_responses.c
+++ b/src/exchange/taler-exchange-httpd_responses.c
@@ -1036,11 +1036,10 @@ TMH_RESPONSE_reply_refresh_reveal_missmatch (struct MHD_Connection *connection,
cc->coin_ev_size));
json_object_set_new (cc_json,
"coin_priv_enc",
- GNUNET_JSON_from_data_auto (cc->refresh_link->coin_priv_enc));
+ GNUNET_JSON_from_data_auto (cc->refresh_link.coin_priv_enc));
json_object_set_new (cc_json,
"blinding_key_enc",
- GNUNET_JSON_from_data (cc->refresh_link->blinding_key_enc,
- cc->refresh_link->blinding_key_enc_size));
+ GNUNET_JSON_from_data_auto (&cc->refresh_link.blinding_key_enc));
json_array_append_new (info_commit_k,
cc_json);
@@ -1105,9 +1104,7 @@ TMH_RESPONSE_reply_refresh_link_success (struct MHD_Connection *connection,
obj = json_object ();
json_object_set_new (obj,
"link_enc",
- GNUNET_JSON_from_data (pos->link_data_enc->coin_priv_enc,
- sizeof (struct TALER_CoinSpendPrivateKeyP) +
- pos->link_data_enc->blinding_key_enc_size));
+ GNUNET_JSON_from_data_auto (&pos->link_data_enc));
json_object_set_new (obj,
"denom_pub",
GNUNET_JSON_from_rsa_public_key (pos->denom_pub.rsa_public_key));