aboutsummaryrefslogtreecommitdiff
path: root/src/exchange
diff options
context:
space:
mode:
Diffstat (limited to 'src/exchange')
-rw-r--r--src/exchange/taler-exchange-httpd_keys.c48
-rw-r--r--src/exchange/taler-exchange-httpd_keys.h9
-rw-r--r--src/exchange/taler-exchange-httpd_refreshes_reveal.c11
-rw-r--r--src/exchange/taler-exchange-httpd_withdraw.c6
4 files changed, 28 insertions, 46 deletions
diff --git a/src/exchange/taler-exchange-httpd_keys.c b/src/exchange/taler-exchange-httpd_keys.c
index e5a54447..4b1a6213 100644
--- a/src/exchange/taler-exchange-httpd_keys.c
+++ b/src/exchange/taler-exchange-httpd_keys.c
@@ -2411,54 +2411,40 @@ TEH_keys_denomination_by_hash2 (
}
-struct TALER_BlindedDenominationSignature
+enum TALER_ErrorCode
TEH_keys_denomination_sign (const struct TALER_DenominationHash *h_denom_pub,
const struct TALER_BlindedPlanchet *bp,
- enum TALER_ErrorCode *ec)
+ struct TALER_BlindedDenominationSignature *bs)
{
struct TEH_KeyStateHandle *ksh;
- struct TALER_BlindedDenominationSignature none;
struct HelperDenomination *hd;
- memset (&none,
- 0,
- sizeof (none));
ksh = TEH_keys_get_state ();
if (NULL == ksh)
- {
- *ec = TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING;
- return none;
- }
+ return TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING;
hd = GNUNET_CONTAINER_multihashmap_get (ksh->helpers->denom_keys,
&h_denom_pub->hash);
if (NULL == hd)
- {
- *ec = TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN;
- return none;
- }
+ return TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN;
if (bp->cipher != hd->denom_pub.cipher)
- {
- *ec = TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
- return none;
- }
+ return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
switch (hd->denom_pub.cipher)
{
case TALER_DENOMINATION_RSA:
- return TALER_CRYPTO_helper_rsa_sign (ksh->helpers->rsadh,
- &hd->h_details.h_rsa,
- bp->details.rsa_blinded_planchet.
- blinded_msg,
- bp->details.rsa_blinded_planchet.
- blinded_msg_size,
- ec);
+ return TALER_CRYPTO_helper_rsa_sign (
+ ksh->helpers->rsadh,
+ &hd->h_details.h_rsa,
+ bp->details.rsa_blinded_planchet.blinded_msg,
+ bp->details.rsa_blinded_planchet.blinded_msg_size,
+ bs);
case TALER_DENOMINATION_CS:
- return TALER_CRYPTO_helper_cs_sign (ksh->helpers->csdh,
- &hd->h_details.h_cs,
- &bp->details.cs_blinded_planchet,
- ec);
+ return TALER_CRYPTO_helper_cs_sign (
+ ksh->helpers->csdh,
+ &hd->h_details.h_cs,
+ &bp->details.cs_blinded_planchet,
+ bs);
default:
- *ec = TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
- return none;
+ return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
}
}
diff --git a/src/exchange/taler-exchange-httpd_keys.h b/src/exchange/taler-exchange-httpd_keys.h
index 07925f7f..a329c4f1 100644
--- a/src/exchange/taler-exchange-httpd_keys.h
+++ b/src/exchange/taler-exchange-httpd_keys.h
@@ -173,14 +173,13 @@ TEH_keys_denomination_by_hash2 (
*
* @param h_denom_pub hash of the public key to use to sign
* @param bp blinded planchet to sign
- * @param[out] ec set to the error code (or #TALER_EC_NONE on success)
- * @return signature, the value inside the structure will be NULL on failure,
- * see @a ec for details about the failure
+ * @param[out] bs set to the blind signature on success
+ * @return #TALER_EC_NONE on success
*/
-struct TALER_BlindedDenominationSignature
+enum TALER_ErrorCode
TEH_keys_denomination_sign (const struct TALER_DenominationHash *h_denom_pub,
const struct TALER_BlindedPlanchet *bp,
- enum TALER_ErrorCode *ec);
+ struct TALER_BlindedDenominationSignature *bs);
/**
diff --git a/src/exchange/taler-exchange-httpd_refreshes_reveal.c b/src/exchange/taler-exchange-httpd_refreshes_reveal.c
index ce56ebb1..0d8f7bf9 100644
--- a/src/exchange/taler-exchange-httpd_refreshes_reveal.c
+++ b/src/exchange/taler-exchange-httpd_refreshes_reveal.c
@@ -607,13 +607,12 @@ resolve_refreshes_reveal_denominations (struct MHD_Connection *connection,
/* create fresh coin signatures */
for (unsigned int i = 0; i<rctx->num_fresh_coins; i++)
{
- enum TALER_ErrorCode ec = TALER_EC_NONE;
+ enum TALER_ErrorCode ec;
- rrcs[i].coin_sig
- = TEH_keys_denomination_sign (
- &rrcs[i].h_denom_pub,
- &rcds[i].blinded_planchet,
- &ec);
+ ec = TEH_keys_denomination_sign (
+ &rrcs[i].h_denom_pub,
+ &rcds[i].blinded_planchet,
+ &rrcs[i].coin_sig);
if (TALER_EC_NONE != ec)
{
GNUNET_break (0);
diff --git a/src/exchange/taler-exchange-httpd_withdraw.c b/src/exchange/taler-exchange-httpd_withdraw.c
index 8598f132..7572f85d 100644
--- a/src/exchange/taler-exchange-httpd_withdraw.c
+++ b/src/exchange/taler-exchange-httpd_withdraw.c
@@ -499,12 +499,10 @@ TEH_handler_withdraw (struct TEH_RequestContext *rc,
// TODO: if CS: check nonce for reuse
/* Sign before transaction! */
- ec = TALER_EC_NONE;
- // FIXME: swap arguments!
- wc.collectable.sig = TEH_keys_denomination_sign (
+ ec = TEH_keys_denomination_sign (
&wc.collectable.denom_pub_hash,
&wc.blinded_planchet,
- &ec);
+ &wc.collectable.sig);
if (TALER_EC_NONE != ec)
{
GNUNET_break (0);