aboutsummaryrefslogtreecommitdiff
path: root/src/exchange/taler-exchange-httpd_refreshes_reveal.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/exchange/taler-exchange-httpd_refreshes_reveal.c')
-rw-r--r--src/exchange/taler-exchange-httpd_refreshes_reveal.c39
1 files changed, 11 insertions, 28 deletions
diff --git a/src/exchange/taler-exchange-httpd_refreshes_reveal.c b/src/exchange/taler-exchange-httpd_refreshes_reveal.c
index 2a5c3aca7..dc4bdf0e6 100644
--- a/src/exchange/taler-exchange-httpd_refreshes_reveal.c
+++ b/src/exchange/taler-exchange-httpd_refreshes_reveal.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of TALER 2 This file is part of TALER
3 Copyright (C) 2014-2019 Taler Systems SA 3 Copyright (C) 2014-2019, 2021 Taler Systems SA
4 4
5 TALER is free software; you can redistribute it and/or modify it under the 5 TALER is free software; you can redistribute it and/or modify it under the
6 terms of the GNU Affero General Public License as published by the Free Software 6 terms of the GNU Affero General Public License as published by the Free Software
@@ -805,7 +805,7 @@ cleanup:
805 * @param coin_evs envelopes of gamma-selected coins to be signed 805 * @param coin_evs envelopes of gamma-selected coins to be signed
806 * @return MHD result code 806 * @return MHD result code
807 */ 807 */
808static int 808static MHD_RESULT
809handle_refreshes_reveal_json (struct MHD_Connection *connection, 809handle_refreshes_reveal_json (struct MHD_Connection *connection,
810 struct RevealContext *rctx, 810 struct RevealContext *rctx,
811 const json_t *tp_json, 811 const json_t *tp_json,
@@ -853,7 +853,7 @@ handle_refreshes_reveal_json (struct MHD_Connection *connection,
853 GNUNET_JSON_spec_fixed_auto (NULL, &rctx->transfer_privs[i]), 853 GNUNET_JSON_spec_fixed_auto (NULL, &rctx->transfer_privs[i]),
854 GNUNET_JSON_spec_end () 854 GNUNET_JSON_spec_end ()
855 }; 855 };
856 int res; 856 enum GNUNET_GenericReturnValue res;
857 857
858 res = TALER_MHD_parse_json_array (connection, 858 res = TALER_MHD_parse_json_array (connection,
859 tp_json, 859 tp_json,
@@ -872,24 +872,8 @@ handle_refreshes_reveal_json (struct MHD_Connection *connection,
872} 872}
873 873
874 874
875/**
876 * Handle a "/refreshes/$RCH/reveal" request. This time, the client reveals the
877 * private transfer keys except for the cut-and-choose value returned from
878 * "/coins/$COIN_PUB/melt". This function parses the revealed keys and secrets and
879 * ultimately passes everything to resolve_refreshes_reveal_denominations()
880 * which will verify that the revealed information is valid then runs the
881 * transaction in refreshes_reveal_transaction() and finally returns the signed
882 * refreshed coins.
883 *
884 * @param rh context of the handler
885 * @param connection MHD request handle
886 * @param root uploaded JSON data
887 * @param args array of additional options (length: 2, session hash and the string "reveal")
888 * @return MHD result code
889 */
890MHD_RESULT 875MHD_RESULT
891TEH_handler_reveal (const struct TEH_RequestHandler *rh, 876TEH_handler_reveal (struct TEH_RequestContext *rc,
892 struct MHD_Connection *connection,
893 const json_t *root, 877 const json_t *root,
894 const char *const args[2]) 878 const char *const args[2])
895{ 879{
@@ -907,7 +891,6 @@ TEH_handler_reveal (const struct TEH_RequestHandler *rh,
907 GNUNET_JSON_spec_end () 891 GNUNET_JSON_spec_end ()
908 }; 892 };
909 893
910 (void) rh;
911 memset (&rctx, 894 memset (&rctx,
912 0, 895 0,
913 sizeof (rctx)); 896 sizeof (rctx));
@@ -918,7 +901,7 @@ TEH_handler_reveal (const struct TEH_RequestHandler *rh,
918 sizeof (rctx.rc))) 901 sizeof (rctx.rc)))
919 { 902 {
920 GNUNET_break_op (0); 903 GNUNET_break_op (0);
921 return TALER_MHD_reply_with_error (connection, 904 return TALER_MHD_reply_with_error (rc->connection,
922 MHD_HTTP_BAD_REQUEST, 905 MHD_HTTP_BAD_REQUEST,
923 TALER_EC_EXCHANGE_REFRESHES_REVEAL_INVALID_RCH, 906 TALER_EC_EXCHANGE_REFRESHES_REVEAL_INVALID_RCH,
924 args[0]); 907 args[0]);
@@ -927,16 +910,16 @@ TEH_handler_reveal (const struct TEH_RequestHandler *rh,
927 "reveal")) 910 "reveal"))
928 { 911 {
929 GNUNET_break_op (0); 912 GNUNET_break_op (0);
930 return TALER_MHD_reply_with_error (connection, 913 return TALER_MHD_reply_with_error (rc->connection,
931 MHD_HTTP_BAD_REQUEST, 914 MHD_HTTP_BAD_REQUEST,
932 TALER_EC_EXCHANGE_REFRESHES_REVEAL_OPERATION_INVALID, 915 TALER_EC_EXCHANGE_REFRESHES_REVEAL_OPERATION_INVALID,
933 args[1]); 916 args[1]);
934 } 917 }
935 918
936 { 919 {
937 int res; 920 enum GNUNET_GenericReturnValue res;
938 921
939 res = TALER_MHD_parse_json_data (connection, 922 res = TALER_MHD_parse_json_data (rc->connection,
940 root, 923 root,
941 spec); 924 spec);
942 if (GNUNET_OK != res) 925 if (GNUNET_OK != res)
@@ -952,16 +935,16 @@ TEH_handler_reveal (const struct TEH_RequestHandler *rh,
952 { 935 {
953 GNUNET_JSON_parse_free (spec); 936 GNUNET_JSON_parse_free (spec);
954 GNUNET_break_op (0); 937 GNUNET_break_op (0);
955 return TALER_MHD_reply_with_error (connection, 938 return TALER_MHD_reply_with_error (rc->connection,
956 MHD_HTTP_BAD_REQUEST, 939 MHD_HTTP_BAD_REQUEST,
957 TALER_EC_EXCHANGE_REFRESHES_REVEAL_CNC_TRANSFER_ARRAY_SIZE_INVALID, 940 TALER_EC_EXCHANGE_REFRESHES_REVEAL_CNC_TRANSFER_ARRAY_SIZE_INVALID,
958 NULL); 941 NULL);
959 } 942 }
960 943
961 { 944 {
962 int res; 945 MHD_RESULT res;
963 946
964 res = handle_refreshes_reveal_json (connection, 947 res = handle_refreshes_reveal_json (rc->connection,
965 &rctx, 948 &rctx,
966 transfer_privs, 949 transfer_privs,
967 link_sigs, 950 link_sigs,