-swap argument/rval for nicer code

This commit is contained in:
Christian Grothoff 2022-02-12 11:42:25 +01:00
parent 8a3e88fbf1
commit ea4be7ba6f
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
9 changed files with 94 additions and 122 deletions

View File

@ -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, TEH_keys_denomination_sign (const struct TALER_DenominationHash *h_denom_pub,
const struct TALER_BlindedPlanchet *bp, const struct TALER_BlindedPlanchet *bp,
enum TALER_ErrorCode *ec) struct TALER_BlindedDenominationSignature *bs)
{ {
struct TEH_KeyStateHandle *ksh; struct TEH_KeyStateHandle *ksh;
struct TALER_BlindedDenominationSignature none;
struct HelperDenomination *hd; struct HelperDenomination *hd;
memset (&none,
0,
sizeof (none));
ksh = TEH_keys_get_state (); ksh = TEH_keys_get_state ();
if (NULL == ksh) if (NULL == ksh)
{ return TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING;
*ec = TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING;
return none;
}
hd = GNUNET_CONTAINER_multihashmap_get (ksh->helpers->denom_keys, hd = GNUNET_CONTAINER_multihashmap_get (ksh->helpers->denom_keys,
&h_denom_pub->hash); &h_denom_pub->hash);
if (NULL == hd) if (NULL == hd)
{ return TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN;
*ec = TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN;
return none;
}
if (bp->cipher != hd->denom_pub.cipher) if (bp->cipher != hd->denom_pub.cipher)
{ return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
*ec = TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
return none;
}
switch (hd->denom_pub.cipher) switch (hd->denom_pub.cipher)
{ {
case TALER_DENOMINATION_RSA: case TALER_DENOMINATION_RSA:
return TALER_CRYPTO_helper_rsa_sign (ksh->helpers->rsadh, return TALER_CRYPTO_helper_rsa_sign (
&hd->h_details.h_rsa, ksh->helpers->rsadh,
bp->details.rsa_blinded_planchet. &hd->h_details.h_rsa,
blinded_msg, bp->details.rsa_blinded_planchet.blinded_msg,
bp->details.rsa_blinded_planchet. bp->details.rsa_blinded_planchet.blinded_msg_size,
blinded_msg_size, bs);
ec);
case TALER_DENOMINATION_CS: case TALER_DENOMINATION_CS:
return TALER_CRYPTO_helper_cs_sign (ksh->helpers->csdh, return TALER_CRYPTO_helper_cs_sign (
&hd->h_details.h_cs, ksh->helpers->csdh,
&bp->details.cs_blinded_planchet, &hd->h_details.h_cs,
ec); &bp->details.cs_blinded_planchet,
bs);
default: default:
*ec = TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE; return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
return none;
} }
} }

View File

@ -173,14 +173,13 @@ TEH_keys_denomination_by_hash2 (
* *
* @param h_denom_pub hash of the public key to use to sign * @param h_denom_pub hash of the public key to use to sign
* @param bp blinded planchet to sign * @param bp blinded planchet to sign
* @param[out] ec set to the error code (or #TALER_EC_NONE on success) * @param[out] bs set to the blind signature on success
* @return signature, the value inside the structure will be NULL on failure, * @return #TALER_EC_NONE on success
* see @a ec for details about the failure
*/ */
struct TALER_BlindedDenominationSignature enum TALER_ErrorCode
TEH_keys_denomination_sign (const struct TALER_DenominationHash *h_denom_pub, TEH_keys_denomination_sign (const struct TALER_DenominationHash *h_denom_pub,
const struct TALER_BlindedPlanchet *bp, const struct TALER_BlindedPlanchet *bp,
enum TALER_ErrorCode *ec); struct TALER_BlindedDenominationSignature *bs);
/** /**

View File

@ -607,13 +607,12 @@ resolve_refreshes_reveal_denominations (struct MHD_Connection *connection,
/* create fresh coin signatures */ /* create fresh coin signatures */
for (unsigned int i = 0; i<rctx->num_fresh_coins; i++) 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 ec = TEH_keys_denomination_sign (
= TEH_keys_denomination_sign ( &rrcs[i].h_denom_pub,
&rrcs[i].h_denom_pub, &rcds[i].blinded_planchet,
&rcds[i].blinded_planchet, &rrcs[i].coin_sig);
&ec);
if (TALER_EC_NONE != ec) if (TALER_EC_NONE != ec)
{ {
GNUNET_break (0); GNUNET_break (0);

View File

@ -499,12 +499,10 @@ TEH_handler_withdraw (struct TEH_RequestContext *rc,
// TODO: if CS: check nonce for reuse // TODO: if CS: check nonce for reuse
/* Sign before transaction! */ /* Sign before transaction! */
ec = TALER_EC_NONE; ec = TEH_keys_denomination_sign (
// FIXME: swap arguments!
wc.collectable.sig = TEH_keys_denomination_sign (
&wc.collectable.denom_pub_hash, &wc.collectable.denom_pub_hash,
&wc.blinded_planchet, &wc.blinded_planchet,
&ec); &wc.collectable.sig);
if (TALER_EC_NONE != ec) if (TALER_EC_NONE != ec)
{ {
GNUNET_break (0); GNUNET_break (0);

View File

@ -1791,17 +1791,16 @@ TALER_CRYPTO_helper_rsa_poll (struct TALER_CRYPTO_RsaDenominationHelper *dh);
* @param h_rsa hash of the RSA public key to use to sign * @param h_rsa hash of the RSA public key to use to sign
* @param msg message to sign * @param msg message to sign
* @param msg_size number of bytes in @a msg * @param msg_size number of bytes in @a msg
* @param[out] ec set to the error code (or #TALER_EC_NONE on success) * @param[out] bs set to the blind signature
* @return signature, the value inside the structure will be NULL on failure, * @return #TALER_EC_NONE on success
* see @a ec for details about the failure
*/ */
struct TALER_BlindedDenominationSignature enum TALER_ErrorCode
TALER_CRYPTO_helper_rsa_sign ( TALER_CRYPTO_helper_rsa_sign (
struct TALER_CRYPTO_RsaDenominationHelper *dh, struct TALER_CRYPTO_RsaDenominationHelper *dh,
const struct TALER_RsaPubHashP *h_rsa, const struct TALER_RsaPubHashP *h_rsa,
const void *msg, const void *msg,
size_t msg_size, size_t msg_size,
enum TALER_ErrorCode *ec); struct TALER_BlindedDenominationSignature *bs);
/** /**
@ -1912,16 +1911,15 @@ TALER_CRYPTO_helper_cs_poll (struct TALER_CRYPTO_CsDenominationHelper *dh);
* @param dh helper process connection * @param dh helper process connection
* @param h_cs hash of the CS public key to use to sign * @param h_cs hash of the CS public key to use to sign
* @param blinded_planchet blinded planchet containing c and nonce * @param blinded_planchet blinded planchet containing c and nonce
* @param[out] ec set to the error code (or #TALER_EC_NONE on success) * @param[out] bs set to the blind signature
* @return signature, the value inside the structure will be NULL on failure, * @return #TALER_EC_NONE on success
* see @a ec for details about the failure
*/ */
struct TALER_BlindedDenominationSignature enum TALER_ErrorCode
TALER_CRYPTO_helper_cs_sign ( TALER_CRYPTO_helper_cs_sign (
struct TALER_CRYPTO_CsDenominationHelper *dh, struct TALER_CRYPTO_CsDenominationHelper *dh,
const struct TALER_CsPubHashP *h_cs, const struct TALER_CsPubHashP *h_cs,
const struct TALER_BlindedCsPlanchet *blinded_planchet, const struct TALER_BlindedCsPlanchet *blinded_planchet,
enum TALER_ErrorCode *ec); struct TALER_BlindedDenominationSignature *bs);
/** /**

View File

@ -378,17 +378,16 @@ more:
} }
struct TALER_BlindedDenominationSignature enum TALER_ErrorCode
TALER_CRYPTO_helper_cs_sign ( TALER_CRYPTO_helper_cs_sign (
struct TALER_CRYPTO_CsDenominationHelper *dh, struct TALER_CRYPTO_CsDenominationHelper *dh,
const struct TALER_CsPubHashP *h_cs, const struct TALER_CsPubHashP *h_cs,
const struct TALER_BlindedCsPlanchet *blinded_planchet, const struct TALER_BlindedCsPlanchet *blinded_planchet,
enum TALER_ErrorCode *ec) struct TALER_BlindedDenominationSignature *bs)
{ {
struct TALER_BlindedDenominationSignature ds = { enum TALER_ErrorCode ec = TALER_EC_INVALID;
.cipher = TALER_DENOMINATION_INVALID
};
bs->cipher = TALER_DENOMINATION_INVALID;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Starting signature process\n"); "Starting signature process\n");
if (GNUNET_OK != if (GNUNET_OK !=
@ -396,8 +395,7 @@ TALER_CRYPTO_helper_cs_sign (
{ {
GNUNET_log (GNUNET_ERROR_TYPE_WARNING, GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Failed to connect to helper\n"); "Failed to connect to helper\n");
*ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_UNAVAILABLE; return TALER_EC_EXCHANGE_DENOMINATION_HELPER_UNAVAILABLE;
return ds;
} }
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@ -420,8 +418,7 @@ TALER_CRYPTO_helper_cs_sign (
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
"send"); "send");
do_disconnect (dh); do_disconnect (dh);
*ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_UNAVAILABLE; return TALER_EC_EXCHANGE_DENOMINATION_HELPER_UNAVAILABLE;
return ds;
} }
} }
@ -434,7 +431,6 @@ TALER_CRYPTO_helper_cs_sign (
= (const struct GNUNET_MessageHeader *) buf; = (const struct GNUNET_MessageHeader *) buf;
bool finished = false; bool finished = false;
*ec = TALER_EC_INVALID;
while (1) while (1)
{ {
uint16_t msize; uint16_t msize;
@ -454,20 +450,20 @@ TALER_CRYPTO_helper_cs_sign (
{ {
GNUNET_assert (finished); GNUNET_assert (finished);
GNUNET_assert (0 == off); GNUNET_assert (0 == off);
return ds; return ec;
} }
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
"recv"); "recv");
do_disconnect (dh); do_disconnect (dh);
*ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_UNAVAILABLE; ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_UNAVAILABLE;
break; break;
} }
if (0 == ret) if (0 == ret)
{ {
GNUNET_break (0 == off); GNUNET_break (0 == off);
if (! finished) if (! finished)
*ec = TALER_EC_EXCHANGE_SIGNKEY_HELPER_BUG; ec = TALER_EC_EXCHANGE_SIGNKEY_HELPER_BUG;
return ds; return ec;
} }
off += ret; off += ret;
more: more:
@ -483,26 +479,26 @@ more:
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
do_disconnect (dh); do_disconnect (dh);
*ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG; ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG;
goto end; goto end;
} }
if (finished) if (finished)
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
do_disconnect (dh); do_disconnect (dh);
*ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG; ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG;
goto end; goto end;
} }
{ {
const struct TALER_CRYPTO_SignResponse *sr = const struct TALER_CRYPTO_SignResponse *sr =
(const struct TALER_CRYPTO_SignResponse *) buf; (const struct TALER_CRYPTO_SignResponse *) buf;
// TODO: add nullcheck
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received signature\n"); "Received signature\n");
*ec = TALER_EC_NONE; ec = TALER_EC_NONE;
finished = true; finished = true;
ds.cipher = TALER_DENOMINATION_CS; bs->cipher = TALER_DENOMINATION_CS;
ds.details.blinded_cs_answer = sr->cs_answer; bs->details.blinded_cs_answer = sr->cs_answer;
break; break;
} }
case TALER_HELPER_CS_MT_RES_SIGN_FAILURE: case TALER_HELPER_CS_MT_RES_SIGN_FAILURE:
@ -510,14 +506,14 @@ more:
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
do_disconnect (dh); do_disconnect (dh);
*ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG; ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG;
goto end; goto end;
} }
{ {
const struct TALER_CRYPTO_SignFailure *sf = const struct TALER_CRYPTO_SignFailure *sf =
(const struct TALER_CRYPTO_SignFailure *) buf; (const struct TALER_CRYPTO_SignFailure *) buf;
*ec = (enum TALER_ErrorCode) ntohl (sf->ec); ec = (enum TALER_ErrorCode) ntohl (sf->ec);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Signing failed!\n"); "Signing failed!\n");
finished = true; finished = true;
@ -532,7 +528,7 @@ more:
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
do_disconnect (dh); do_disconnect (dh);
*ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG; ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG;
goto end; goto end;
} }
break; /* while(1) loop ensures we recvfrom() again */ break; /* while(1) loop ensures we recvfrom() again */
@ -545,7 +541,7 @@ more:
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
do_disconnect (dh); do_disconnect (dh);
*ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG; ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG;
goto end; goto end;
} }
break; /* while(1) loop ensures we recvfrom() again */ break; /* while(1) loop ensures we recvfrom() again */
@ -560,7 +556,7 @@ more:
"Received unexpected message of type %u\n", "Received unexpected message of type %u\n",
ntohs (hdr->type)); ntohs (hdr->type));
do_disconnect (dh); do_disconnect (dh);
*ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG; ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG;
goto end; goto end;
} }
memmove (buf, memmove (buf,
@ -571,8 +567,8 @@ more:
} /* while(1) */ } /* while(1) */
end: end:
if (finished) if (finished)
TALER_blinded_denom_sig_free (&ds); TALER_blinded_denom_sig_free (bs);
return ds; return ec;
} }
} }

View File

@ -387,18 +387,17 @@ more:
} }
struct TALER_BlindedDenominationSignature enum TALER_ErrorCode
TALER_CRYPTO_helper_rsa_sign ( TALER_CRYPTO_helper_rsa_sign (
struct TALER_CRYPTO_RsaDenominationHelper *dh, struct TALER_CRYPTO_RsaDenominationHelper *dh,
const struct TALER_RsaPubHashP *h_rsa, const struct TALER_RsaPubHashP *h_rsa,
const void *msg, const void *msg,
size_t msg_size, size_t msg_size,
enum TALER_ErrorCode *ec) struct TALER_BlindedDenominationSignature *bs)
{ {
struct TALER_BlindedDenominationSignature ds = { enum TALER_ErrorCode ec = TALER_EC_INVALID;
.cipher = TALER_DENOMINATION_INVALID
};
bs->cipher = TALER_DENOMINATION_INVALID;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Starting signature process\n"); "Starting signature process\n");
if (GNUNET_OK != if (GNUNET_OK !=
@ -406,8 +405,7 @@ TALER_CRYPTO_helper_rsa_sign (
{ {
GNUNET_log (GNUNET_ERROR_TYPE_WARNING, GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Failed to connect to helper\n"); "Failed to connect to helper\n");
*ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_UNAVAILABLE; return TALER_EC_EXCHANGE_DENOMINATION_HELPER_UNAVAILABLE;
return ds;
} }
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@ -432,8 +430,7 @@ TALER_CRYPTO_helper_rsa_sign (
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
"send"); "send");
do_disconnect (dh); do_disconnect (dh);
*ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_UNAVAILABLE; return TALER_EC_EXCHANGE_DENOMINATION_HELPER_UNAVAILABLE;
return ds;
} }
} }
@ -446,7 +443,6 @@ TALER_CRYPTO_helper_rsa_sign (
= (const struct GNUNET_MessageHeader *) buf; = (const struct GNUNET_MessageHeader *) buf;
bool finished = false; bool finished = false;
*ec = TALER_EC_INVALID;
while (1) while (1)
{ {
uint16_t msize; uint16_t msize;
@ -466,20 +462,20 @@ TALER_CRYPTO_helper_rsa_sign (
{ {
GNUNET_assert (finished); GNUNET_assert (finished);
GNUNET_assert (0 == off); GNUNET_assert (0 == off);
return ds; return ec;
} }
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
"recv"); "recv");
do_disconnect (dh); do_disconnect (dh);
*ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_UNAVAILABLE; ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_UNAVAILABLE;
break; break;
} }
if (0 == ret) if (0 == ret)
{ {
GNUNET_break (0 == off); GNUNET_break (0 == off);
if (! finished) if (! finished)
*ec = TALER_EC_EXCHANGE_SIGNKEY_HELPER_BUG; ec = TALER_EC_EXCHANGE_SIGNKEY_HELPER_BUG;
return ds; return ec;
} }
off += ret; off += ret;
more: more:
@ -495,14 +491,14 @@ more:
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
do_disconnect (dh); do_disconnect (dh);
*ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG; ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG;
goto end; goto end;
} }
if (finished) if (finished)
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
do_disconnect (dh); do_disconnect (dh);
*ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG; ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG;
goto end; goto end;
} }
{ {
@ -517,15 +513,15 @@ more:
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
do_disconnect (dh); do_disconnect (dh);
*ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG; ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG;
goto end; goto end;
} }
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received signature\n"); "Received signature\n");
*ec = TALER_EC_NONE; ec = TALER_EC_NONE;
finished = true; finished = true;
ds.cipher = TALER_DENOMINATION_RSA; bs->cipher = TALER_DENOMINATION_RSA;
ds.details.blinded_rsa_signature = rsa_signature; bs->details.blinded_rsa_signature = rsa_signature;
break; break;
} }
case TALER_HELPER_RSA_MT_RES_SIGN_FAILURE: case TALER_HELPER_RSA_MT_RES_SIGN_FAILURE:
@ -533,14 +529,14 @@ more:
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
do_disconnect (dh); do_disconnect (dh);
*ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG; ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG;
goto end; goto end;
} }
{ {
const struct TALER_CRYPTO_SignFailure *sf = const struct TALER_CRYPTO_SignFailure *sf =
(const struct TALER_CRYPTO_SignFailure *) buf; (const struct TALER_CRYPTO_SignFailure *) buf;
*ec = (enum TALER_ErrorCode) ntohl (sf->ec); ec = (enum TALER_ErrorCode) ntohl (sf->ec);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Signing failed!\n"); "Signing failed!\n");
finished = true; finished = true;
@ -555,7 +551,7 @@ more:
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
do_disconnect (dh); do_disconnect (dh);
*ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG; ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG;
goto end; goto end;
} }
break; /* while(1) loop ensures we recvfrom() again */ break; /* while(1) loop ensures we recvfrom() again */
@ -568,7 +564,7 @@ more:
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
do_disconnect (dh); do_disconnect (dh);
*ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG; ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG;
goto end; goto end;
} }
break; /* while(1) loop ensures we recvfrom() again */ break; /* while(1) loop ensures we recvfrom() again */
@ -583,7 +579,7 @@ more:
"Received unexpected message of type %u\n", "Received unexpected message of type %u\n",
ntohs (hdr->type)); ntohs (hdr->type));
do_disconnect (dh); do_disconnect (dh);
*ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG; ec = TALER_EC_EXCHANGE_DENOMINATION_HELPER_BUG;
goto end; goto end;
} }
memmove (buf, memmove (buf,
@ -594,8 +590,8 @@ more:
} /* while(1) */ } /* while(1) */
end: end:
if (finished) if (finished)
TALER_blinded_denom_sig_free (&ds); TALER_blinded_denom_sig_free (bs);
return ds; return ec;
} }
} }

View File

@ -456,11 +456,11 @@ test_signing (struct TALER_CRYPTO_CsDenominationHelper *dh)
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Requesting signature with key %s\n", "Requesting signature with key %s\n",
GNUNET_h2s (&keys[i].h_cs.hash)); GNUNET_h2s (&keys[i].h_cs.hash));
ds = TALER_CRYPTO_helper_cs_sign (dh, ec = TALER_CRYPTO_helper_cs_sign (dh,
&keys[i].h_cs, &keys[i].h_cs,
&pd.blinded_planchet.details. &pd.blinded_planchet.details.
cs_blinded_planchet, cs_blinded_planchet,
&ec); &ds);
} }
switch (ec) switch (ec)
{ {
@ -552,11 +552,11 @@ test_signing (struct TALER_CRYPTO_CsDenominationHelper *dh)
&c_hash, &c_hash,
&pd)); &pd));
ds = TALER_CRYPTO_helper_cs_sign (dh, ec = TALER_CRYPTO_helper_cs_sign (dh,
&rnd, &rnd,
&pd.blinded_planchet.details. &pd.blinded_planchet.details.
cs_blinded_planchet, cs_blinded_planchet,
&ec); &ds);
if (TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN != ec) if (TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN != ec)
{ {
if (TALER_EC_NONE == ec) if (TALER_EC_NONE == ec)
@ -645,11 +645,11 @@ perf_signing (struct TALER_CRYPTO_CsDenominationHelper *dh,
struct GNUNET_TIME_Absolute start = GNUNET_TIME_absolute_get (); struct GNUNET_TIME_Absolute start = GNUNET_TIME_absolute_get ();
struct GNUNET_TIME_Relative delay; struct GNUNET_TIME_Relative delay;
ds = TALER_CRYPTO_helper_cs_sign (dh, ec = TALER_CRYPTO_helper_cs_sign (dh,
&keys[i].h_cs, &keys[i].h_cs,
&pd.blinded_planchet.details. &pd.blinded_planchet.details.
cs_blinded_planchet, cs_blinded_planchet,
&ec); &ds);
if (TALER_EC_NONE != ec) if (TALER_EC_NONE != ec)
break; break;
delay = GNUNET_TIME_absolute_get_duration (start); delay = GNUNET_TIME_absolute_get_duration (start);

View File

@ -304,13 +304,13 @@ test_signing (struct TALER_CRYPTO_RsaDenominationHelper *dh)
int) pd.blinded_planchet.details.rsa_blinded_planchet. int) pd.blinded_planchet.details.rsa_blinded_planchet.
blinded_msg_size, blinded_msg_size,
GNUNET_h2s (&keys[i].h_rsa.hash)); GNUNET_h2s (&keys[i].h_rsa.hash));
ds = TALER_CRYPTO_helper_rsa_sign (dh, ec = TALER_CRYPTO_helper_rsa_sign (dh,
&keys[i].h_rsa, &keys[i].h_rsa,
pd.blinded_planchet.details. pd.blinded_planchet.details.
rsa_blinded_planchet.blinded_msg, rsa_blinded_planchet.blinded_msg,
pd.blinded_planchet.details. pd.blinded_planchet.details.
rsa_blinded_planchet.blinded_msg_size, rsa_blinded_planchet.blinded_msg_size,
&ec); &ds);
TALER_blinded_planchet_free (&pd.blinded_planchet); TALER_blinded_planchet_free (&pd.blinded_planchet);
} }
switch (ec) switch (ec)
@ -405,11 +405,11 @@ test_signing (struct TALER_CRYPTO_RsaDenominationHelper *dh)
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
&rnd, &rnd,
sizeof (rnd)); sizeof (rnd));
ds = TALER_CRYPTO_helper_rsa_sign (dh, ec = TALER_CRYPTO_helper_rsa_sign (dh,
&rnd, &rnd,
"Hello", "Hello",
strlen ("Hello"), strlen ("Hello"),
&ec); &ds);
if (TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN != ec) if (TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN != ec)
{ {
if (TALER_EC_NONE == ec) if (TALER_EC_NONE == ec)
@ -485,14 +485,14 @@ perf_signing (struct TALER_CRYPTO_RsaDenominationHelper *dh,
struct GNUNET_TIME_Absolute start = GNUNET_TIME_absolute_get (); struct GNUNET_TIME_Absolute start = GNUNET_TIME_absolute_get ();
struct GNUNET_TIME_Relative delay; struct GNUNET_TIME_Relative delay;
ds = TALER_CRYPTO_helper_rsa_sign (dh, ec = TALER_CRYPTO_helper_rsa_sign (dh,
&keys[i].h_rsa, &keys[i].h_rsa,
pd.blinded_planchet.details. pd.blinded_planchet.details.
rsa_blinded_planchet.blinded_msg, rsa_blinded_planchet.blinded_msg,
pd.blinded_planchet.details. pd.blinded_planchet.details.
rsa_blinded_planchet. rsa_blinded_planchet.
blinded_msg_size, blinded_msg_size,
&ec); &ds);
if (TALER_EC_NONE != ec) if (TALER_EC_NONE != ec)
break; break;
delay = GNUNET_TIME_absolute_get_duration (start); delay = GNUNET_TIME_absolute_get_duration (start);