diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-07-11 21:45:34 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-07-11 21:45:34 +0200 |
commit | a74f55754aaeb3e28cb6943b1dd50e4a4117070b (patch) | |
tree | ef529d63d37ad3bd41923d5afb003052b9f7974f | |
parent | ee7e690bff1e85b7ac1af66f984fa84588c4c6cc (diff) |
fixing #3876 (no semantic change, just stylistic changes)
-rw-r--r-- | src/mint/taler-mint-httpd_admin.c | 2 | ||||
-rw-r--r-- | src/mint/taler-mint-httpd_deposit.c | 10 | ||||
-rw-r--r-- | src/mint/taler-mint-httpd_parsing.c | 88 | ||||
-rw-r--r-- | src/mint/taler-mint-httpd_parsing.h | 15 | ||||
-rw-r--r-- | src/mint/taler-mint-httpd_refresh.c | 8 | ||||
-rw-r--r-- | src/mint/taler-mint-httpd_test.c | 54 | ||||
-rw-r--r-- | src/mint/taler-mint-httpd_withdraw.c | 10 |
7 files changed, 105 insertions, 82 deletions
diff --git a/src/mint/taler-mint-httpd_admin.c b/src/mint/taler-mint-httpd_admin.c index 6928dac8b..c757fd183 100644 --- a/src/mint/taler-mint-httpd_admin.c +++ b/src/mint/taler-mint-httpd_admin.c @@ -113,7 +113,7 @@ TMH_ADMIN_handler_admin_add_incoming (struct TMH_RequestHandler *rh, json_t *wire; json_t *root; struct TMH_PARSE_FieldSpecification spec[] = { - TMH_PARSE_MEMBER_FIXED ("reserve_pub", &reserve_pub), + TMH_PARSE_member_fixed ("reserve_pub", &reserve_pub), TMH_PARSE_member_amount ("amount", &amount), TMH_PARSE_member_time_abs ("execution_date", &at), TMH_PARSE_member_object ("wire", &wire), diff --git a/src/mint/taler-mint-httpd_deposit.c b/src/mint/taler-mint-httpd_deposit.c index 7d9ace00d..5725cd1c6 100644 --- a/src/mint/taler-mint-httpd_deposit.c +++ b/src/mint/taler-mint-httpd_deposit.c @@ -139,11 +139,11 @@ parse_and_handle_deposit_request (struct MHD_Connection *connection, struct TMH_PARSE_FieldSpecification spec[] = { TMH_PARSE_member_denomination_public_key ("denom_pub", &deposit.coin.denom_pub), TMH_PARSE_member_denomination_signature ("ub_sig", &deposit.coin.denom_sig), - TMH_PARSE_MEMBER_FIXED ("coin_pub", &deposit.coin.coin_pub), - TMH_PARSE_MEMBER_FIXED ("merchant_pub", &deposit.merchant_pub), - TMH_PARSE_MEMBER_FIXED ("H_contract", &deposit.h_contract), - TMH_PARSE_MEMBER_FIXED ("H_wire", &deposit.h_wire), - TMH_PARSE_MEMBER_FIXED ("coin_sig", &deposit.csig), + TMH_PARSE_member_fixed ("coin_pub", &deposit.coin.coin_pub), + TMH_PARSE_member_fixed ("merchant_pub", &deposit.merchant_pub), + TMH_PARSE_member_fixed ("H_contract", &deposit.h_contract), + TMH_PARSE_member_fixed ("H_wire", &deposit.h_wire), + TMH_PARSE_member_fixed ("coin_sig", &deposit.csig), TMH_PARSE_member_uint64 ("transaction_id", &deposit.transaction_id), TMH_PARSE_member_time_abs ("timestamp", &deposit.timestamp), TMH_PARSE_member_time_abs ("refund_deadline", &deposit.refund_deadline), diff --git a/src/mint/taler-mint-httpd_parsing.c b/src/mint/taler-mint-httpd_parsing.c index 9e7287f2b..8d7903eb5 100644 --- a/src/mint/taler-mint-httpd_parsing.c +++ b/src/mint/taler-mint-httpd_parsing.c @@ -167,11 +167,11 @@ release_data (struct TMH_PARSE_FieldSpecification *spec, case TMH_PARSE_JNC_RET_DATA: break; case TMH_PARSE_JNC_RET_DATA_VAR: - if (0 != spec[i].destination_size_out) + if (NULL != spec[i].destination) { - GNUNET_free (spec[i].destination); - spec[i].destination = NULL; - spec[i].destination_size_out = 0; + GNUNET_free (* (void**) spec[i].destination); + *(void**) spec[i].destination = NULL; + *spec[i].destination_size_out = 0; } break; case TMH_PARSE_JNC_RET_TYPED_JSON: @@ -490,7 +490,7 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection, ret = (MHD_YES == TMH_RESPONSE_reply_json_pack (connection, MHD_HTTP_BAD_REQUEST, - "{s:s, s:s, s:o}", + "{s:s, s:s, s:O}", "error", "missing field in JSON", "field", fname, "path", path)) @@ -513,7 +513,7 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection, ret = (MHD_YES == TMH_RESPONSE_reply_json_pack (connection, MHD_HTTP_BAD_REQUEST, - "{s:s, s:o}", + "{s:s, s:O}", "error", "missing index in JSON", "path", path)) ? GNUNET_NO : GNUNET_SYSERR; @@ -529,14 +529,13 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection, const char *str; int res; - // FIXME: avoidable code duplication here... str = json_string_value (root); if (NULL == str) { ret = (MHD_YES == TMH_RESPONSE_reply_json_pack (connection, MHD_HTTP_BAD_REQUEST, - "{s:s, s:o}", + "{s:s, s:O}", "error", "string expected", "path", path)) ? GNUNET_NO : GNUNET_SYSERR; @@ -549,7 +548,7 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection, ret = (MHD_YES == TMH_RESPONSE_reply_json_pack (connection, MHD_HTTP_BAD_REQUEST, - "{s:s, s:o}", + "{s:s, s:O}", "error", "malformed binary data in JSON", "path", path)) ? GNUNET_NO : GNUNET_SYSERR; @@ -564,8 +563,8 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection, void **where = va_arg (argp, void **); size_t *len = va_arg (argp, size_t *); const char *str; + int res; - // FIXME: avoidable code duplication here... str = json_string_value (root); if (NULL == str) { @@ -578,8 +577,6 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection, *len = (strlen (str) * 5) / 8; if (NULL != where) { - int res; - *where = GNUNET_malloc (*len); res = GNUNET_STRINGS_string_to_data (str, strlen (str), @@ -593,7 +590,7 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection, ret = (MHD_YES == TMH_RESPONSE_reply_json_pack (connection, MHD_HTTP_BAD_REQUEST, - "{s:s, s:o}", + "{s:s, s:O}", "error", "malformed binary data in JSON", "path", path)) ? GNUNET_NO : GNUNET_SYSERR; @@ -615,7 +612,7 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection, ret = (MHD_YES == TMH_RESPONSE_reply_json_pack (connection, MHD_HTTP_BAD_REQUEST, - "{s:s, s:i, s:i, s:o}", + "{s:s, s:i, s:i, s:O}", "error", "wrong JSON field type", "type_expected", typ, "type_actual", json_typeof (root), @@ -638,7 +635,7 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection, ret = (MHD_YES == TMH_RESPONSE_reply_json_pack (connection, MHD_HTTP_BAD_REQUEST, - "{s:s, s:s, s:i, s:o}", + "{s:s, s:s, s:i, s:O}", "error", "wrong JSON field type", "type_expected", "integer", "type_actual", json_typeof (root), @@ -667,7 +664,7 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection, ret = (MHD_YES == TMH_RESPONSE_reply_json_pack (connection, MHD_HTTP_BAD_REQUEST, - "{s:s, s:o}", + "{s:s, s:O}", "error", "string expected", "path", path)) ? GNUNET_NO : GNUNET_SYSERR; @@ -685,7 +682,7 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection, ret = (MHD_YES == TMH_RESPONSE_reply_json_pack (connection, MHD_HTTP_BAD_REQUEST, - "{s:s, s:o}", + "{s:s, s:O}", "error", "malformed binary data in JSON", "path", path)) ? GNUNET_NO : GNUNET_SYSERR; @@ -699,7 +696,7 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection, ret = (MHD_YES == TMH_RESPONSE_reply_json_pack (connection, MHD_HTTP_BAD_REQUEST, - "{s:s, s:o}", + "{s:s, s:O}", "error", "malformed RSA public key in JSON", "path", path)) ? GNUNET_NO : GNUNET_SYSERR; @@ -725,7 +722,7 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection, ret = (MHD_YES == TMH_RESPONSE_reply_json_pack (connection, MHD_HTTP_BAD_REQUEST, - "{s:s, s:o}", + "{s:s, s:O}", "error", "string expected", "path", path)) ? GNUNET_NO : GNUNET_SYSERR; @@ -743,7 +740,7 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection, ret = (MHD_YES == TMH_RESPONSE_reply_json_pack (connection, MHD_HTTP_BAD_REQUEST, - "{s:s, s:o}", + "{s:s, s:O}", "error", "malformed binary data in JSON", "path", path)) ? GNUNET_NO : GNUNET_SYSERR; @@ -757,7 +754,7 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection, ret = (MHD_YES == TMH_RESPONSE_reply_json_pack (connection, MHD_HTTP_BAD_REQUEST, - "{s:s, s:o}", + "{s:s, s:O}", "error", "malformed RSA signature in JSON", "path", path)) ? GNUNET_NO : GNUNET_SYSERR; @@ -778,7 +775,7 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection, if (MHD_YES != TMH_RESPONSE_reply_json_pack (connection, MHD_HTTP_BAD_REQUEST, - "{s:s, s:o}", + "{s:s, s:O}", "error", "Bad format", "path", path)) return GNUNET_SYSERR; @@ -790,7 +787,7 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection, if (MHD_YES != TMH_RESPONSE_reply_json_pack (connection, MHD_HTTP_BAD_REQUEST, - "{s:s, s:o, s:s}", + "{s:s, s:O, s:s}", "error", "Currency not supported", "path", path, "currency", where->currency)) @@ -816,7 +813,7 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection, if (MHD_YES != TMH_RESPONSE_reply_json_pack (connection, MHD_HTTP_BAD_REQUEST, - "{s:s, s:s, s:o}", + "{s:s, s:s, s:O}", "error", "Bad format", "hint", "expected absolute time", "path", path)) @@ -863,7 +860,6 @@ TMH_PARSE_json_data (struct MHD_Connection *connection, { unsigned int i; int ret; - void *ptr; ret = GNUNET_YES; for (i=0; NULL != spec[i].field_name; i++) @@ -888,26 +884,22 @@ TMH_PARSE_json_data (struct MHD_Connection *connection, spec[i].destination_size_in); break; case TMH_PARSE_JNC_RET_DATA_VAR: - ptr = NULL; ret = TMH_PARSE_navigate_json (connection, root, TMH_PARSE_JNC_FIELD, spec[i].field_name, TMH_PARSE_JNC_RET_DATA_VAR, - &ptr, - &spec[i].destination_size_out); - spec[i].destination = ptr; + (void **) spec[i].destination, + spec[i].destination_size_out); break; case TMH_PARSE_JNC_RET_TYPED_JSON: - ptr = NULL; ret = TMH_PARSE_navigate_json (connection, root, TMH_PARSE_JNC_FIELD, spec[i].field_name, TMH_PARSE_JNC_RET_TYPED_JSON, spec[i].type, - &ptr); - *((void**)spec[i].destination) = ptr; + &spec[i].destination); break; case TMH_PARSE_JNC_RET_RSA_PUBLIC_KEY: ret = TMH_PARSE_navigate_json (connection, @@ -993,7 +985,7 @@ TMH_PARSE_member_uint64 (const char *field, uint64_t *u64) { struct TMH_PARSE_FieldSpecification ret = - { field, (void *) u64, sizeof (uint64_t), 0, TMH_PARSE_JNC_RET_UINT64, 0 }; + { field, (void *) u64, sizeof (uint64_t), NULL, TMH_PARSE_JNC_RET_UINT64, 0 }; return ret; } @@ -1010,7 +1002,7 @@ TMH_PARSE_member_object (const char *field, json_t **jsonp) { struct TMH_PARSE_FieldSpecification ret = - { field, (void **) jsonp, 0, 0, TMH_PARSE_JNC_RET_TYPED_JSON, JSON_OBJECT }; + { field, (void **) jsonp, 0, NULL, TMH_PARSE_JNC_RET_TYPED_JSON, JSON_OBJECT }; return ret; } @@ -1027,7 +1019,7 @@ TMH_PARSE_member_array (const char *field, json_t **jsonp) { struct TMH_PARSE_FieldSpecification ret = - { field, jsonp, 0, 0, TMH_PARSE_JNC_RET_TYPED_JSON, JSON_ARRAY }; + { field, jsonp, 0, NULL, TMH_PARSE_JNC_RET_TYPED_JSON, JSON_ARRAY }; return ret; } @@ -1043,7 +1035,7 @@ TMH_PARSE_member_time_abs (const char *field, struct GNUNET_TIME_Absolute *atime) { struct TMH_PARSE_FieldSpecification ret = - { field, atime, sizeof(struct GNUNET_TIME_Absolute), 0, TMH_PARSE_JNC_RET_TIME_ABSOLUTE, 0 }; + { field, atime, sizeof(struct GNUNET_TIME_Absolute), NULL, TMH_PARSE_JNC_RET_TIME_ABSOLUTE, 0 }; return ret; } @@ -1060,7 +1052,7 @@ TMH_PARSE_member_denomination_public_key (const char *field, struct TALER_DenominationPublicKey *pk) { struct TMH_PARSE_FieldSpecification ret = - { field, pk, 0, 0, TMH_PARSE_JNC_RET_RSA_PUBLIC_KEY, 0 }; + { field, pk, 0, NULL, TMH_PARSE_JNC_RET_RSA_PUBLIC_KEY, 0 }; return ret; } @@ -1077,7 +1069,7 @@ TMH_PARSE_member_denomination_signature (const char *field, struct TALER_DenominationSignature *sig) { struct TMH_PARSE_FieldSpecification ret = - { field, sig, 0, 0, TMH_PARSE_JNC_RET_RSA_SIGNATURE, 0 }; + { field, sig, 0, NULL, TMH_PARSE_JNC_RET_RSA_SIGNATURE, 0 }; return ret; } @@ -1094,9 +1086,27 @@ TMH_PARSE_member_amount (const char *field, struct TALER_Amount *amount) { struct TMH_PARSE_FieldSpecification ret = - { field, amount, sizeof(struct TALER_Amount), 0, TMH_PARSE_JNC_RET_AMOUNT, 0 }; + { field, amount, sizeof(struct TALER_Amount), NULL, TMH_PARSE_JNC_RET_AMOUNT, 0 }; return ret; } +/** + * Generate line in parser specification for variable-size value. + * + * @param field name of the field + * @param[out] ptr pointer to initialize + * @param[out] ptr_size size to initialize + * @return corresponding field spec + */ +struct TMH_PARSE_FieldSpecification +TMH_PARSE_member_variable (const char *field, + void **ptr, + size_t *ptr_size) +{ + struct TMH_PARSE_FieldSpecification ret = + { field, ptr, 0, ptr_size, TMH_PARSE_JNC_RET_DATA_VAR, 0 }; + return ret; +} + /* end of taler-mint-httpd_parsing.c */ diff --git a/src/mint/taler-mint-httpd_parsing.h b/src/mint/taler-mint-httpd_parsing.h index 2e036f322..a2cf4c469 100644 --- a/src/mint/taler-mint-httpd_parsing.h +++ b/src/mint/taler-mint-httpd_parsing.h @@ -194,7 +194,7 @@ struct TMH_PARSE_FieldSpecification * value that was stored in @e destination (useful for * variable-size allocations). */ - size_t destination_size_out; + size_t *destination_size_out; /** * Navigation command to use to extract the value. Note that @@ -250,14 +250,21 @@ TMH_PARSE_release_data (struct TMH_PARSE_FieldSpecification *spec); * @param field name of the field * @param value where to store the value */ -#define TMH_PARSE_MEMBER_FIXED(field,value) { field, value, sizeof (*value), 0, TMH_PARSE_JNC_RET_DATA, 0 } +#define TMH_PARSE_member_fixed(field,value) { field, value, sizeof (*value), NULL, TMH_PARSE_JNC_RET_DATA, 0 } + /** * Generate line in parser specification for variable-size value. * * @param field name of the field + * @param[out] ptr pointer to initialize + * @param[out] ptr_size size to initialize + * @return corresponding field spec */ -#define TMH_PARSE_MEMBER_VARIABLE(field) { field, NULL, 0, 0, TMH_PARSE_JNC_RET_DATA_VAR, 0 } +struct TMH_PARSE_FieldSpecification +TMH_PARSE_member_variable (const char *field, + void **ptr, + size_t *ptr_size); /** @@ -349,7 +356,7 @@ TMH_PARSE_member_time_abs (const char *field, /** * Generate line in parser specification indicating the end of the spec. */ -#define TMH_PARSE_MEMBER_END { NULL, NULL, 0, 0, TMH_PARSE_JNC_FIELD, 0 } +#define TMH_PARSE_MEMBER_END { NULL, NULL, 0, NULL, TMH_PARSE_JNC_FIELD, 0 } /** diff --git a/src/mint/taler-mint-httpd_refresh.c b/src/mint/taler-mint-httpd_refresh.c index b1482272c..687fb998d 100644 --- a/src/mint/taler-mint-httpd_refresh.c +++ b/src/mint/taler-mint-httpd_refresh.c @@ -173,10 +173,10 @@ get_coin_public_info (struct MHD_Connection *connection, struct TALER_DenominationPublicKey pk; struct TALER_Amount amount; struct TMH_PARSE_FieldSpecification spec[] = { - TMH_PARSE_MEMBER_FIXED ("coin_pub", &r_melt_detail->coin_info.coin_pub), + TMH_PARSE_member_fixed ("coin_pub", &r_melt_detail->coin_info.coin_pub), TMH_PARSE_member_denomination_signature ("denom_sig", &sig), TMH_PARSE_member_denomination_public_key ("denom_pub", &pk), - TMH_PARSE_MEMBER_FIXED ("confirm_sig", &melt_sig), + TMH_PARSE_member_fixed ("confirm_sig", &melt_sig), TMH_PARSE_member_amount ("value_with_fee", &amount), TMH_PARSE_MEMBER_END }; @@ -819,7 +819,7 @@ TMH_REFRESH_handler_refresh_reveal (struct TMH_RequestHandler *rh, json_t *root; json_t *transfer_privs; struct TMH_PARSE_FieldSpecification spec[] = { - TMH_PARSE_MEMBER_FIXED ("session_hash", &session_hash), + TMH_PARSE_member_fixed ("session_hash", &session_hash), TMH_PARSE_member_array ("transfer_privs", &transfer_privs), TMH_PARSE_MEMBER_END }; @@ -842,13 +842,13 @@ TMH_REFRESH_handler_refresh_reveal (struct TMH_RequestHandler *rh, return (GNUNET_SYSERR == res) ? MHD_NO : MHD_YES; /* Determine dimensionality of the request (kappa and #old coins) */ + /* Note we do +1 as 1 row (cut-and-choose!) is missing! */ if (TALER_CNC_KAPPA != json_array_size (transfer_privs) + 1) { TMH_PARSE_release_data (spec); return TMH_RESPONSE_reply_arg_invalid (connection, "transfer_privs"); } - /* Note we do +1 as 1 row (cut-and-choose!) is missing! */ res = TMH_PARSE_navigate_json (connection, transfer_privs, TMH_PARSE_JNC_INDEX, 0, diff --git a/src/mint/taler-mint-httpd_test.c b/src/mint/taler-mint-httpd_test.c index 0c6838ee5..b894854f3 100644 --- a/src/mint/taler-mint-httpd_test.c +++ b/src/mint/taler-mint-httpd_test.c @@ -59,9 +59,11 @@ TMH_TEST_handler_test_base32 (struct TMH_RequestHandler *rh, { json_t *json; int res; + void *in_ptr; + size_t in_ptr_size; struct GNUNET_HashCode hc; struct TMH_PARSE_FieldSpecification spec[] = { - TMH_PARSE_MEMBER_VARIABLE ("input"), + TMH_PARSE_member_variable ("input", &in_ptr, &in_ptr_size), TMH_PARSE_MEMBER_END }; @@ -79,8 +81,8 @@ TMH_TEST_handler_test_base32 (struct TMH_RequestHandler *rh, spec); if (GNUNET_YES != res) return (GNUNET_NO == res) ? MHD_YES : MHD_NO; - GNUNET_CRYPTO_hash (spec[0].destination, - spec[0].destination_size_out, + GNUNET_CRYPTO_hash (in_ptr, + in_ptr_size, &hc); TMH_PARSE_release_data (spec); json_decref (json); @@ -121,9 +123,11 @@ TMH_TEST_handler_test_encrypt (struct TMH_RequestHandler *rh, struct GNUNET_HashCode key; struct GNUNET_CRYPTO_SymmetricInitializationVector iv; struct GNUNET_CRYPTO_SymmetricSessionKey skey; + void *in_ptr; + size_t in_ptr_size; struct TMH_PARSE_FieldSpecification spec[] = { - TMH_PARSE_MEMBER_VARIABLE ("input"), - TMH_PARSE_MEMBER_FIXED ("key_hash", &key), + TMH_PARSE_member_variable ("input", &in_ptr, &in_ptr_size), + TMH_PARSE_member_fixed ("key_hash", &key), TMH_PARSE_MEMBER_END }; char *out; @@ -153,15 +157,15 @@ TMH_TEST_handler_test_encrypt (struct TMH_RequestHandler *rh, "iv", strlen ("iv"), &key, sizeof (key), NULL, 0)); - out = GNUNET_malloc (spec[0].destination_size_out); - GNUNET_break (spec[0].destination_size_out == - GNUNET_CRYPTO_symmetric_encrypt (spec[0].destination, - spec[0].destination_size_out, + out = GNUNET_malloc (in_ptr_size); + GNUNET_break (in_ptr_size == + GNUNET_CRYPTO_symmetric_encrypt (in_ptr, + in_ptr_size, &skey, &iv, out)); json = TALER_json_from_data (out, - spec[0].destination_size_out); + in_ptr_size); GNUNET_free (out); TMH_PARSE_release_data (spec); return TMH_RESPONSE_reply_json_pack (connection, @@ -199,8 +203,10 @@ TMH_TEST_handler_test_hkdf (struct TMH_RequestHandler *rh, json_t *json; int res; struct GNUNET_HashCode hc; + void *in_ptr; + size_t in_ptr_size; struct TMH_PARSE_FieldSpecification spec[] = { - TMH_PARSE_MEMBER_VARIABLE ("input"), + TMH_PARSE_member_variable ("input", &in_ptr, &in_ptr_size), TMH_PARSE_MEMBER_END }; @@ -221,8 +227,8 @@ TMH_TEST_handler_test_hkdf (struct TMH_RequestHandler *rh, return (GNUNET_NO == res) ? MHD_YES : MHD_NO; GNUNET_CRYPTO_kdf (&hc, sizeof (hc), "salty", strlen ("salty"), - spec[0].destination, - spec[0].destination_size_out, + in_ptr, + in_ptr_size, NULL, 0); TMH_PARSE_release_data (spec); json = TALER_json_from_data (&hc, @@ -262,8 +268,8 @@ TMH_TEST_handler_test_ecdhe (struct TMH_RequestHandler *rh, struct GNUNET_CRYPTO_EcdhePrivateKey priv; struct GNUNET_HashCode hc; struct TMH_PARSE_FieldSpecification spec[] = { - TMH_PARSE_MEMBER_FIXED ("ecdhe_pub", &pub), - TMH_PARSE_MEMBER_FIXED ("ecdhe_priv", &priv), + TMH_PARSE_member_fixed ("ecdhe_pub", &pub), + TMH_PARSE_member_fixed ("ecdhe_priv", &priv), TMH_PARSE_MEMBER_END }; @@ -329,8 +335,8 @@ TMH_TEST_handler_test_eddsa (struct TMH_RequestHandler *rh, struct GNUNET_CRYPTO_EddsaSignature sig; struct GNUNET_CRYPTO_EccSignaturePurpose purpose; struct TMH_PARSE_FieldSpecification spec[] = { - TMH_PARSE_MEMBER_FIXED ("eddsa_pub", &pub), - TMH_PARSE_MEMBER_FIXED ("eddsa_sig", &sig), + TMH_PARSE_member_fixed ("eddsa_pub", &pub), + TMH_PARSE_member_fixed ("eddsa_sig", &sig), TMH_PARSE_MEMBER_END }; struct GNUNET_CRYPTO_EddsaPrivateKey *pk; @@ -457,8 +463,10 @@ TMH_TEST_handler_test_rsa_sign (struct TMH_RequestHandler *rh, json_t *json; int res; struct GNUNET_CRYPTO_rsa_Signature *sig; + void *in_ptr; + size_t in_ptr_size; struct TMH_PARSE_FieldSpecification spec[] = { - TMH_PARSE_MEMBER_VARIABLE ("blind_ev"), + TMH_PARSE_member_variable ("blind_ev", &in_ptr, &in_ptr_size), TMH_PARSE_MEMBER_END }; @@ -487,8 +495,8 @@ TMH_TEST_handler_test_rsa_sign (struct TMH_RequestHandler *rh, "Failed to create RSA key"); } sig = GNUNET_CRYPTO_rsa_sign (rsa_pk, - spec[0].destination, - spec[0].destination_size_out); + in_ptr, + in_ptr_size); if (NULL == sig) { GNUNET_break (0); @@ -534,9 +542,9 @@ TMH_TEST_handler_test_transfer (struct TMH_RequestHandler *rh, struct TALER_TransferPrivateKeyP trans_priv; struct TALER_CoinSpendPublicKeyP coin_pub; struct TMH_PARSE_FieldSpecification spec[] = { - TMH_PARSE_MEMBER_FIXED ("secret_enc", &secret_enc), - TMH_PARSE_MEMBER_FIXED ("trans_priv", &trans_priv), - TMH_PARSE_MEMBER_FIXED ("coin_pub", &coin_pub), + TMH_PARSE_member_fixed ("secret_enc", &secret_enc), + TMH_PARSE_member_fixed ("trans_priv", &trans_priv), + TMH_PARSE_member_fixed ("coin_pub", &coin_pub), TMH_PARSE_MEMBER_END }; struct TALER_LinkSecretP secret; diff --git a/src/mint/taler-mint-httpd_withdraw.c b/src/mint/taler-mint-httpd_withdraw.c index 589cf0a8f..4f5581643 100644 --- a/src/mint/taler-mint-httpd_withdraw.c +++ b/src/mint/taler-mint-httpd_withdraw.c @@ -92,7 +92,7 @@ TMH_WITHDRAW_handler_withdraw_sign (struct TMH_RequestHandler *rh, struct TALER_WithdrawRequestPS wsrd; int res; struct TALER_DenominationPublicKey denomination_pub; - const char *blinded_msg; + char *blinded_msg; size_t blinded_msg_len; struct TALER_Amount amount; struct TALER_Amount amount_with_fee; @@ -102,9 +102,9 @@ TMH_WITHDRAW_handler_withdraw_sign (struct TMH_RequestHandler *rh, struct TMH_KS_StateHandle *ks; struct TMH_PARSE_FieldSpecification spec[] = { - TMH_PARSE_MEMBER_VARIABLE ("coin_ev"), - TMH_PARSE_MEMBER_FIXED ("reserve_pub", &wsrd.reserve_pub), - TMH_PARSE_MEMBER_FIXED ("reserve_sig", &signature), + TMH_PARSE_member_variable ("coin_ev", (void **) &blinded_msg, &blinded_msg_len), + TMH_PARSE_member_fixed ("reserve_pub", &wsrd.reserve_pub), + TMH_PARSE_member_fixed ("reserve_sig", &signature), TMH_PARSE_member_denomination_public_key ("denom_pub", &denomination_pub), TMH_PARSE_MEMBER_END }; @@ -124,8 +124,6 @@ TMH_WITHDRAW_handler_withdraw_sign (struct TMH_RequestHandler *rh, json_decref (root); if (GNUNET_OK != res) return (GNUNET_SYSERR == res) ? MHD_NO : MHD_YES; - blinded_msg = spec[0].destination; - blinded_msg_len = spec[0].destination_size_out; ks = TMH_KS_acquire (); dki = TMH_KS_denomination_key_lookup (ks, &denomination_pub, |