diff --git a/src/mint/taler-mint-httpd_parsing.h b/src/mint/taler-mint-httpd_parsing.h index 5f5f35dfc..c8e946077 100644 --- a/src/mint/taler-mint-httpd_parsing.h +++ b/src/mint/taler-mint-httpd_parsing.h @@ -13,7 +13,6 @@ You should have received a copy of the GNU Affero General Public License along with TALER; see the file COPYING. If not, If not, see */ - /** * @file taler-mint-httpd_parsing.h * @brief functions to parse incoming requests @@ -21,11 +20,9 @@ * @author Benedikt Mueller * @author Christian Grothoff */ - #ifndef TALER_MICROHTTPD_LIB_H_ #define TALER_MICROHTTPD_LIB_H_ - #include #include diff --git a/src/mint/taler-mint-httpd_responses.h b/src/mint/taler-mint-httpd_responses.h index 1f698905a..51abd9fb4 100644 --- a/src/mint/taler-mint-httpd_responses.h +++ b/src/mint/taler-mint-httpd_responses.h @@ -28,11 +28,9 @@ #include #include #include -#include #include #include "taler-mint-httpd.h" #include "taler-mint-httpd_db.h" -#include "taler-mint-httpd_mhd.h" /** diff --git a/src/mint/taler-mint-httpd_withdraw.c b/src/mint/taler-mint-httpd_withdraw.c index c23aa70e2..8c74b72b6 100644 --- a/src/mint/taler-mint-httpd_withdraw.c +++ b/src/mint/taler-mint-httpd_withdraw.c @@ -1,6 +1,6 @@ /* This file is part of TALER - (C) 2014 GNUnet e.V. + (C) 2014,2015 GNUnet e.V. TALER is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software @@ -19,25 +19,12 @@ * @author Florian Dold * @author Benedikt Mueller * @author Christian Grothoff - * - * TODO: - * - support variable-size RSA keys */ #include "platform.h" #include #include -#include -#include -#include -#include "mint.h" -#include "mint_db.h" -#include "taler_signatures.h" -#include "taler_json_lib.h" -#include "taler-mint-httpd_parsing.h" -#include "taler-mint-httpd_keys.h" -#include "taler-mint-httpd_db.h" -#include "taler-mint-httpd_mhd.h" #include "taler-mint-httpd_withdraw.h" +#include "taler-mint-httpd_parsing.h" #include "taler-mint-httpd_responses.h" @@ -108,8 +95,14 @@ TALER_MINT_handler_withdraw_sign (struct RequestHandler *rh, return MHD_NO; /* internal error */ if (GNUNET_NO == res) return MHD_YES; /* invalid request */ - - /* FIXME: handle variable-size signing keys! */ + res = TALER_MINT_mhd_request_arg_data (connection, + "reserve_sig", + &signature, + sizeof (struct GNUNET_CRYPTO_EddsaSignature)); + if (GNUNET_SYSERR == res) + return MHD_NO; /* internal error */ + if (GNUNET_NO == res) + return MHD_YES; /* invalid request */ res = TALER_MINT_mhd_request_var_arg_data (connection, "denom_pub", (void **) &denomination_pub_data, @@ -123,17 +116,15 @@ TALER_MINT_handler_withdraw_sign (struct RequestHandler *rh, (void **) &blinded_msg, &blinded_msg_len); if (GNUNET_SYSERR == res) + { + GNUNET_free (denomination_pub_data); return MHD_NO; /* internal error */ + } if (GNUNET_NO == res) + { + GNUNET_free (denomination_pub_data); return MHD_YES; /* invalid request */ - res = TALER_MINT_mhd_request_arg_data (connection, - "reserve_sig", - &signature, - sizeof (struct GNUNET_CRYPTO_EddsaSignature)); - if (GNUNET_SYSERR == res) - return MHD_NO; /* internal error */ - if (GNUNET_NO == res) - return MHD_YES; /* invalid request */ + } /* verify signature! */ wsrd.purpose.size = htonl (sizeof (struct TALER_WithdrawRequest)); @@ -150,15 +141,21 @@ TALER_MINT_handler_withdraw_sign (struct RequestHandler *rh, &signature, &wsrd.reserve_pub)) { - return 42; // FIXME: generate error reply + LOG_WARNING ("Client supplied invalid signature for /withdraw/sign request\n"); + GNUNET_free (denomination_pub_data); + GNUNET_free (blinded_msg); + return TALER_MINT_reply_arg_invalid (connection, + "reserve_sig"); } denomination_pub = GNUNET_CRYPTO_rsa_public_key_decode (denomination_pub_data, denomination_pub_data_size); + GNUNET_free (denomination_pub_data); if (NULL == denomination_pub) { - GNUNET_free (denomination_pub_data); + LOG_WARNING ("Client supplied ill-formed denomination public key for /withdraw/sign request\n"); GNUNET_free (blinded_msg); - return 42; // FIXME: generate error reply + return TALER_MINT_reply_arg_invalid (connection, + "denom_pub"); } res = TALER_MINT_db_execute_withdraw_sign (connection, &wsrd.reserve_pub, @@ -166,7 +163,6 @@ TALER_MINT_handler_withdraw_sign (struct RequestHandler *rh, blinded_msg, blinded_msg_len, &signature); - GNUNET_free (denomination_pub_data); GNUNET_free (blinded_msg); GNUNET_CRYPTO_rsa_public_key_free (denomination_pub); return res; diff --git a/src/mint/taler-mint-httpd_withdraw.h b/src/mint/taler-mint-httpd_withdraw.h index 1d292ebd9..6587a194f 100644 --- a/src/mint/taler-mint-httpd_withdraw.h +++ b/src/mint/taler-mint-httpd_withdraw.h @@ -23,7 +23,6 @@ #ifndef TALER_MINT_HTTPD_WITHDRAW_H #define TALER_MINT_HTTPD_WITHDRAW_H -#include #include #include "taler-mint-httpd.h"