aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-01-27 15:22:34 +0100
committerChristian Grothoff <christian@grothoff.org>2015-01-27 15:22:34 +0100
commit610b7b62c09cb19410dc283f0629e4b24c343b57 (patch)
tree0a4eb15460fbc5904dd77cc08adeb4d66b8cfdd0
parentbda9e3ad94b4ede04ed3886dd8097b35a868eef5 (diff)
downloadexchange-610b7b62c09cb19410dc283f0629e4b24c343b57.tar.gz
exchange-610b7b62c09cb19410dc283f0629e4b24c343b57.zip
towards making code compile again
-rw-r--r--src/mint/mint.h2
-rw-r--r--src/mint/taler-mint-httpd_db.c118
-rw-r--r--src/mint/taler-mint-httpd_db.h4
-rw-r--r--src/mint/taler-mint-httpd_responses.c2
-rw-r--r--src/mint/taler-mint-httpd_responses.h2
5 files changed, 79 insertions, 49 deletions
diff --git a/src/mint/mint.h b/src/mint/mint.h
index 1dc179340..3f98b368d 100644
--- a/src/mint/mint.h
+++ b/src/mint/mint.h
@@ -100,7 +100,7 @@ struct CollectableBlindcoin
100 /** 100 /**
101 * Denomination key (which coin was generated). 101 * Denomination key (which coin was generated).
102 */ 102 */
103 struct GNUNET_CRYPOT_rsa_PublicKey *denom_pub; 103 struct GNUNET_CRYPTO_rsa_PublicKey *denom_pub;
104 104
105 /** 105 /**
106 * Public key of the reserve that was drained. 106 * Public key of the reserve that was drained.
diff --git a/src/mint/taler-mint-httpd_db.c b/src/mint/taler-mint-httpd_db.c
index 4ddefb4ab..59e573457 100644
--- a/src/mint/taler-mint-httpd_db.c
+++ b/src/mint/taler-mint-httpd_db.c
@@ -332,10 +332,10 @@ TALER_MINT_db_execute_withdraw_sign (struct MHD_Connection *connection,
332 GNUNET_break (0); 332 GNUNET_break (0);
333 return TALER_MINT_reply_internal_db_error (connection); 333 return TALER_MINT_reply_internal_db_error (connection);
334 } 334 }
335 collectable.ev = wsrd.coin_envelope; 335 collectable.denom_pub = (struct GNUNET_CRYPTO_rsa_PublicKey *) denomination_pub;
336 collectable.sig = sig; 336 collectable.sig = sig;
337 collectable.reserve_pub = wsrd.reserve_pub; 337 collectable.reserve_pub = *reserve;
338 collectable.reserve_sig = wsrd.sig; 338 collectable.reserve_sig = *signature;
339 if (GNUNET_OK != 339 if (GNUNET_OK !=
340 TALER_MINT_DB_insert_collectable_blindcoin (db_conn, 340 TALER_MINT_DB_insert_collectable_blindcoin (db_conn,
341 &h_blind, 341 &h_blind,
@@ -372,7 +372,7 @@ refresh_accept_denoms (struct MHD_Connection *connection,
372 const struct MintKeyState *key_state, 372 const struct MintKeyState *key_state,
373 const struct GNUNET_CRYPTO_EddsaPublicKey *session_pub, 373 const struct GNUNET_CRYPTO_EddsaPublicKey *session_pub,
374 unsigned int denom_pubs_count, 374 unsigned int denom_pubs_count,
375 const struct GNUNET_CRYPTO_rsa_PublicKey *denom_pubs, 375 const struct GNUNET_CRYPTO_rsa_PublicKey **denom_pubs,
376 struct TALER_Amount *r_amount) 376 struct TALER_Amount *r_amount)
377{ 377{
378 unsigned int i; 378 unsigned int i;
@@ -383,7 +383,8 @@ refresh_accept_denoms (struct MHD_Connection *connection,
383 memset (r_amount, 0, sizeof (struct TALER_Amount)); 383 memset (r_amount, 0, sizeof (struct TALER_Amount));
384 for (i = 0; i < denom_pubs_count; i++) 384 for (i = 0; i < denom_pubs_count; i++)
385 { 385 {
386 dki = &(TALER_MINT_get_denom_key (key_state, &denom_pubs[i])->issue); 386 dki = &(TALER_MINT_get_denom_key (key_state,
387 denom_pubs[i])->issue);
387 cost = TALER_amount_add (TALER_amount_ntoh (dki->value), 388 cost = TALER_amount_add (TALER_amount_ntoh (dki->value),
388 TALER_amount_ntoh (dki->fee_withdraw)); 389 TALER_amount_ntoh (dki->fee_withdraw));
389 *r_amount = TALER_amount_add (cost, *r_amount); 390 *r_amount = TALER_amount_add (cost, *r_amount);
@@ -396,7 +397,7 @@ refresh_accept_denoms (struct MHD_Connection *connection,
396 (res = TALER_MINT_DB_insert_refresh_order (db_conn, 397 (res = TALER_MINT_DB_insert_refresh_order (db_conn,
397 i, 398 i,
398 session_pub, 399 session_pub,
399 &denom_pubs[i]))) 400 denom_pubs[i])))
400 return res; // ??? 401 return res; // ???
401 } 402 }
402 return GNUNET_OK; 403 return GNUNET_OK;
@@ -457,7 +458,8 @@ refresh_accept_melts (struct MHD_Connection *connection,
457 // money the customer gets by melting the current coin 458 // money the customer gets by melting the current coin
458 struct TALER_Amount coin_gain; 459 struct TALER_Amount coin_gain;
459 460
460 dki = &(TALER_MINT_get_denom_key (key_state, &coin_public_infos[i].denom_pub)->issue); 461 dki = &(TALER_MINT_get_denom_key (key_state,
462 coin_public_infos[i].denom_pub)->issue);
461 463
462 if (NULL == dki) 464 if (NULL == dki)
463 return (MHD_YES == 465 return (MHD_YES ==
@@ -504,9 +506,10 @@ refresh_accept_melts (struct MHD_Connection *connection,
504 return GNUNET_SYSERR; 506 return GNUNET_SYSERR;
505 } 507 }
506 508
507 if (GNUNET_OK != TALER_MINT_DB_insert_refresh_melt (db_conn, session_pub, i, 509 if (GNUNET_OK !=
508 &coin_public_infos[i].coin_pub, 510 TALER_MINT_DB_insert_refresh_melt (db_conn, session_pub, i,
509 &coin_public_infos[i].denom_pub)) 511 &coin_public_infos[i].coin_pub,
512 coin_public_infos[i].denom_pub))
510 { 513 {
511 GNUNET_break (0); 514 GNUNET_break (0);
512 return GNUNET_SYSERR; 515 return GNUNET_SYSERR;
@@ -548,7 +551,7 @@ int
548TALER_MINT_db_execute_refresh_melt (struct MHD_Connection *connection, 551TALER_MINT_db_execute_refresh_melt (struct MHD_Connection *connection,
549 const struct GNUNET_CRYPTO_EddsaPublicKey *refresh_session_pub, 552 const struct GNUNET_CRYPTO_EddsaPublicKey *refresh_session_pub,
550 unsigned int num_new_denoms, 553 unsigned int num_new_denoms,
551 const struct GNUNET_CRYPTO_rsa_PublicKey *denom_pubs, 554 const struct GNUNET_CRYPTO_rsa_PublicKey **denom_pubs,
552 unsigned int coin_count, 555 unsigned int coin_count,
553 const struct TALER_CoinPublicInfo *coin_public_infos) 556 const struct TALER_CoinPublicInfo *coin_public_infos)
554{ 557{
@@ -930,19 +933,24 @@ TALER_MINT_db_execute_refresh_reveal (struct MHD_Connection *connection,
930 933
931 /* We're converting key types here, which is not very nice 934 /* We're converting key types here, which is not very nice
932 * but necessary and harmless (keys will be thrown away later). */ 935 * but necessary and harmless (keys will be thrown away later). */
933 if (GNUNET_OK != GNUNET_CRYPTO_ecc_ecdh ((struct GNUNET_CRYPTO_EcdhePrivateKey *) &transfer_privs[i+off][j], 936 /* FIXME: ECDHE/ECDSA-key type confusion! Can we reduce/avoid this? */
934 (struct GNUNET_CRYPTO_EcdhePublicKey *) &coin_pub, 937 if (GNUNET_OK !=
935 &transfer_secret)) 938 GNUNET_CRYPTO_ecc_ecdh ((const struct GNUNET_CRYPTO_EcdhePrivateKey *) &transfer_privs[i+off][j],
939 (const struct GNUNET_CRYPTO_EcdhePublicKey *) &coin_pub,
940 &transfer_secret))
936 { 941 {
937 GNUNET_break (0); 942 GNUNET_break (0);
938 // FIXME: return 'internal error'? 943 // FIXME: return 'internal error'?
939 return MHD_NO; 944 return MHD_NO;
940 } 945 }
941 946
942 if (0 >= TALER_refresh_decrypt (commit_link.shared_secret_enc, TALER_REFRESH_SHARED_SECRET_LENGTH, 947 if (0 >= TALER_refresh_decrypt (commit_link.shared_secret_enc,
943 &transfer_secret, &shared_secret)) 948 TALER_REFRESH_SHARED_SECRET_LENGTH,
949 &transfer_secret,
950 &shared_secret))
944 { 951 {
945 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "decryption failed\n"); 952 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
953 "decryption failed\n");
946 // FIXME: return 'internal error'? 954 // FIXME: return 'internal error'?
947 return MHD_NO; 955 return MHD_NO;
948 } 956 }
@@ -952,27 +960,35 @@ TALER_MINT_db_execute_refresh_reveal (struct MHD_Connection *connection,
952 secret_initialized = GNUNET_YES; 960 secret_initialized = GNUNET_YES;
953 last_shared_secret = shared_secret; 961 last_shared_secret = shared_secret;
954 } 962 }
955 else if (0 != memcmp (&shared_secret, &last_shared_secret, sizeof (struct GNUNET_HashCode))) 963 else if (0 != memcmp (&shared_secret,
964 &last_shared_secret,
965 sizeof (struct GNUNET_HashCode)))
956 { 966 {
957 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "shared secrets do not match\n"); 967 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
968 "shared secrets do not match\n");
958 // FIXME: return error code! 969 // FIXME: return error code!
959 return MHD_NO; 970 return MHD_NO;
960 } 971 }
961 972
962 { 973 {
963 struct GNUNET_CRYPTO_EcdsaPublicKey transfer_pub_check; 974 struct GNUNET_CRYPTO_EcdsaPublicKey transfer_pub_check;
964 GNUNET_CRYPTO_ecdsa_key_get_public (&transfer_privs[i+off][j], &transfer_pub_check); 975
965 if (0 != memcmp (&transfer_pub_check, &commit_link.transfer_pub, sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey))) 976 GNUNET_CRYPTO_ecdsa_key_get_public (&transfer_privs[i+off][j],
977 &transfer_pub_check);
978 if (0 !=
979 memcmp (&transfer_pub_check,
980 &commit_link.transfer_pub,
981 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)))
966 { 982 {
967 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "transfer keys do not match\n"); 983 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
968 // FIXME: return error code! 984 "transfer keys do not match\n");
985 // FIXME: return error code!
969 return MHD_NO; 986 return MHD_NO;
970 } 987 }
971 } 988 }
972 } 989 }
973 990
974 /* Check that the commitments for all new coins were correct */ 991 /* Check that the commitments for all new coins were correct */
975
976 for (j = 0; j < refresh_session.num_newcoins; j++) 992 for (j = 0; j < refresh_session.num_newcoins; j++)
977 { 993 {
978 struct RefreshCommitCoin commit_coin; 994 struct RefreshCommitCoin commit_coin;
@@ -981,6 +997,7 @@ TALER_MINT_db_execute_refresh_reveal (struct MHD_Connection *connection,
981 struct GNUNET_CRYPTO_EcdsaPublicKey coin_pub; 997 struct GNUNET_CRYPTO_EcdsaPublicKey coin_pub;
982 struct GNUNET_CRYPTO_rsa_BlindingKey *bkey; 998 struct GNUNET_CRYPTO_rsa_BlindingKey *bkey;
983 struct GNUNET_CRYPTO_rsa_PublicKey *denom_pub; 999 struct GNUNET_CRYPTO_rsa_PublicKey *denom_pub;
1000 struct GNUNET_HashCode h_msg;
984 char *buf; 1001 char *buf;
985 size_t buf_len; 1002 size_t buf_len;
986 1003
@@ -992,41 +1009,54 @@ TALER_MINT_db_execute_refresh_reveal (struct MHD_Connection *connection,
992 if (GNUNET_OK != res) 1009 if (GNUNET_OK != res)
993 { 1010 {
994 GNUNET_break (0); 1011 GNUNET_break (0);
995 // FIXME: return error code! 1012 // FIXME: return error code!
996 return MHD_NO; 1013 return MHD_NO;
997 } 1014 }
998 1015
999 1016
1000 if (0 >= TALER_refresh_decrypt (commit_coin.link_enc, sizeof (struct LinkData), 1017 if (0 >= TALER_refresh_decrypt (commit_coin.link_enc,
1001 &last_shared_secret, &link_data)) 1018 sizeof (struct LinkData),
1019 &last_shared_secret,
1020 &link_data))
1002 { 1021 {
1003 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "decryption failed\n"); 1022 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1004 // FIXME: return error code! 1023 "decryption failed\n");
1024 // FIXME: return error code!
1005 return MHD_NO; 1025 return MHD_NO;
1006 } 1026 }
1007 1027
1008 GNUNET_CRYPTO_ecdsa_key_get_public (&link_data.coin_priv, &coin_pub); 1028 GNUNET_CRYPTO_ecdsa_key_get_public (&link_data.coin_priv,
1029 &coin_pub);
1009 if (NULL == (bkey = GNUNET_CRYPTO_rsa_blinding_key_decode (link_data.bkey_enc, 1030 if (NULL == (bkey = GNUNET_CRYPTO_rsa_blinding_key_decode (link_data.bkey_enc,
1010 link_data.bkey_enc_size))) 1031 link_data.bkey_enc_size)))
1011 { 1032 {
1012 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Invalid blinding key\n"); 1033 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1013 // FIXME: return error code! 1034 "Invalid blinding key\n");
1035 // FIXME: return error code!
1014 return MHD_NO; 1036 return MHD_NO;
1015 } 1037 }
1016 denom_pub = TALER_MINT_DB_get_refresh_order (db_conn, j, refresh_session_pub); 1038 denom_pub = TALER_MINT_DB_get_refresh_order (db_conn,
1039 j,
1040 refresh_session_pub);
1017 if (NULL == denom_pub) 1041 if (NULL == denom_pub)
1018 { 1042 {
1019 GNUNET_break (0); 1043 GNUNET_break (0);
1020 // FIXME: return error code! 1044 // FIXME: return error code!
1021 return MHD_NO; 1045 return MHD_NO;
1022 } 1046 }
1023 if (NULL == (buf_len = 1047 /* FIXME: we had envisioned a more complex scheme to derive
1024 GNUNET_CRYPTO_rsa_blind (&h_msg, 1048 the message to sign for a blinded coin... */
1025 bkey, 1049 GNUNET_CRYPTO_hash (&coin_pub,
1026 denom_pub, 1050 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey),
1027 &buf))) 1051 &h_msg);
1052 if (0 == (buf_len =
1053 GNUNET_CRYPTO_rsa_blind (&h_msg,
1054 bkey,
1055 denom_pub,
1056 &buf)))
1028 { 1057 {
1029 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "blind failed\n"); 1058 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1059 "blind failed\n");
1030 // FIXME: return error code! 1060 // FIXME: return error code!
1031 return MHD_NO; 1061 return MHD_NO;
1032 } 1062 }
@@ -1074,8 +1104,8 @@ TALER_MINT_db_execute_refresh_reveal (struct MHD_Connection *connection,
1074 // FIXME: return error code! 1104 // FIXME: return error code!
1075 return MHD_NO; 1105 return MHD_NO;
1076 } 1106 }
1077 res = TALER_MINT_DB_get_refresh_order (db_conn, j, refresh_session_pub, &denom_pub); 1107 denom_pub = TALER_MINT_DB_get_refresh_order (db_conn, j, refresh_session_pub);
1078 if (GNUNET_OK != res) 1108 if (NULL == denom_pub)
1079 { 1109 {
1080 GNUNET_break (0); 1110 GNUNET_break (0);
1081 // FIXME: return error code! 1111 // FIXME: return error code!
@@ -1084,7 +1114,7 @@ TALER_MINT_db_execute_refresh_reveal (struct MHD_Connection *connection,
1084 1114
1085 1115
1086 key_state = TALER_MINT_key_state_acquire (); 1116 key_state = TALER_MINT_key_state_acquire ();
1087 dki = TALER_MINT_get_denom_key (key_state, &denom_pub); 1117 dki = TALER_MINT_get_denom_key (key_state, denom_pub);
1088 TALER_MINT_key_state_release (key_state); 1118 TALER_MINT_key_state_release (key_state);
1089 if (NULL == dki) 1119 if (NULL == dki)
1090 { 1120 {
@@ -1105,7 +1135,7 @@ TALER_MINT_db_execute_refresh_reveal (struct MHD_Connection *connection,
1105 res = TALER_MINT_DB_insert_refresh_collectable (db_conn, 1135 res = TALER_MINT_DB_insert_refresh_collectable (db_conn,
1106 j, 1136 j,
1107 refresh_session_pub, 1137 refresh_session_pub,
1108 &ev_sig); 1138 ev_sig);
1109 if (GNUNET_OK != res) 1139 if (GNUNET_OK != res)
1110 { 1140 {
1111 GNUNET_break (0); 1141 GNUNET_break (0);
@@ -1170,7 +1200,7 @@ link_iter (void *cls,
1170 json_object_set_new (obj, "ev_sig", 1200 json_object_set_new (obj, "ev_sig",
1171 TALER_JSON_from_data (buf, 1201 TALER_JSON_from_data (buf,
1172 buf_len)); 1202 buf_len));
1173 GNUNET_free (buf_len); 1203 GNUNET_free (buf);
1174 1204
1175 return GNUNET_OK; 1205 return GNUNET_OK;
1176} 1206}
diff --git a/src/mint/taler-mint-httpd_db.h b/src/mint/taler-mint-httpd_db.h
index dd82cbcb1..31f64d9f7 100644
--- a/src/mint/taler-mint-httpd_db.h
+++ b/src/mint/taler-mint-httpd_db.h
@@ -84,7 +84,7 @@ TALER_MINT_db_execute_withdraw_sign (struct MHD_Connection *connection,
84 * @param connection the MHD connection to handle 84 * @param connection the MHD connection to handle
85 * @param refresh_session_pub public key of the refresh session 85 * @param refresh_session_pub public key of the refresh session
86 * @param num_new_denoms number of entries in @a denom_pubs 86 * @param num_new_denoms number of entries in @a denom_pubs
87 * @param denum_pubs ??? 87 * @param denum_pubs array of public denomination keys for the refresh (?)
88 * @param coin_count number of entries in @a coin_public_infos 88 * @param coin_count number of entries in @a coin_public_infos
89 * @param coin_public_infos information about the coins to melt 89 * @param coin_public_infos information about the coins to melt
90 * @return MHD result code 90 * @return MHD result code
@@ -93,7 +93,7 @@ int
93TALER_MINT_db_execute_refresh_melt (struct MHD_Connection *connection, 93TALER_MINT_db_execute_refresh_melt (struct MHD_Connection *connection,
94 const struct GNUNET_CRYPTO_EddsaPublicKey *refresh_session_pub, 94 const struct GNUNET_CRYPTO_EddsaPublicKey *refresh_session_pub,
95 unsigned int num_new_denoms, 95 unsigned int num_new_denoms,
96 const struct GNUNET_CRYPTO_rsa_PublicKey *denom_pubs, 96 const struct GNUNET_CRYPTO_rsa_PublicKey **denom_pubs,
97 unsigned int coin_count, 97 unsigned int coin_count,
98 const struct TALER_CoinPublicInfo *coin_public_infos); 98 const struct TALER_CoinPublicInfo *coin_public_infos);
99 99
diff --git a/src/mint/taler-mint-httpd_responses.c b/src/mint/taler-mint-httpd_responses.c
index bad71ac06..12d4bced7 100644
--- a/src/mint/taler-mint-httpd_responses.c
+++ b/src/mint/taler-mint-httpd_responses.c
@@ -394,7 +394,7 @@ TALER_MINT_reply_refresh_commit_success (struct MHD_Connection *connection,
394int 394int
395TALER_MINT_reply_refresh_reveal_success (struct MHD_Connection *connection, 395TALER_MINT_reply_refresh_reveal_success (struct MHD_Connection *connection,
396 unsigned int num_newcoins, 396 unsigned int num_newcoins,
397 const struct GNUNET_CRYPTO_rsa_Signature **sigs) 397 struct GNUNET_CRYPTO_rsa_Signature **sigs)
398{ 398{
399 int newcoin_index; 399 int newcoin_index;
400 json_t *root; 400 json_t *root;
diff --git a/src/mint/taler-mint-httpd_responses.h b/src/mint/taler-mint-httpd_responses.h
index dd2184145..1f698905a 100644
--- a/src/mint/taler-mint-httpd_responses.h
+++ b/src/mint/taler-mint-httpd_responses.h
@@ -209,7 +209,7 @@ TALER_MINT_reply_refresh_melt_success (struct MHD_Connection *connection,
209int 209int
210TALER_MINT_reply_refresh_reveal_success (struct MHD_Connection *connection, 210TALER_MINT_reply_refresh_reveal_success (struct MHD_Connection *connection,
211 unsigned int num_newcoins, 211 unsigned int num_newcoins,
212 const struct GNUNET_CRYPTO_rsa_Signature **sigs); 212 struct GNUNET_CRYPTO_rsa_Signature **sigs);
213 213
214 214
215 215