diff options
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/crypto.c | 31 | ||||
-rw-r--r-- | src/util/denom.c | 22 |
2 files changed, 26 insertions, 27 deletions
diff --git a/src/util/crypto.c b/src/util/crypto.c index fd309c934..bed70f3d3 100644 --- a/src/util/crypto.c +++ b/src/util/crypto.c @@ -502,22 +502,43 @@ TALER_refresh_get_commitment (struct TALER_RefreshCommitmentP *rc, enum GNUNET_GenericReturnValue TALER_coin_ev_hash (const struct TALER_BlindedPlanchet *blinded_planchet, + const struct TALER_DenominationPublicKey *denom_pub, struct TALER_BlindedCoinHash *bch) { switch (blinded_planchet->cipher) { case TALER_DENOMINATION_RSA: + // FIXME: Include denom_pub into hash GNUNET_CRYPTO_hash ( blinded_planchet->details.rsa_blinded_planchet.blinded_msg, blinded_planchet->details.rsa_blinded_planchet.blinded_msg_size, &bch->hash); return GNUNET_OK; case TALER_DENOMINATION_CS: - GNUNET_CRYPTO_hash ( - &blinded_planchet->details.cs_blinded_planchet.nonce, - sizeof (blinded_planchet->details.cs_blinded_planchet.nonce), - &bch->hash); - return GNUNET_OK; + { + char delim = ':'; + size_t buf_len = sizeof(denom_pub->details.cs_public_key) + + sizeof (blinded_planchet->details.cs_blinded_planchet. + nonce) + + sizeof(delim); + void*buf = GNUNET_malloc (buf_len); + memcpy (buf, + &denom_pub->details.cs_public_key, + sizeof(denom_pub->details.cs_public_key)); + memcpy (buf + sizeof(denom_pub->details.cs_public_key), + &delim, + sizeof(delim)); + memcpy (buf + sizeof(denom_pub->details.cs_public_key) + sizeof(delim), + &blinded_planchet->details.cs_blinded_planchet.nonce, + sizeof (blinded_planchet->details.cs_blinded_planchet.nonce)); + GNUNET_CRYPTO_hash ( + buf, + buf_len, + &bch->hash); + GNUNET_free (buf); + return GNUNET_OK; + } + default: GNUNET_break (0); return GNUNET_SYSERR; diff --git a/src/util/denom.c b/src/util/denom.c index fa8909783..88bdd611f 100644 --- a/src/util/denom.c +++ b/src/util/denom.c @@ -198,33 +198,11 @@ TALER_denom_sig_unblind ( case TALER_DENOMINATION_CS: { struct GNUNET_CRYPTO_CsBlindingSecret bs[2]; - // struct TALER_DenominationCsPublicR r_pub_blind; - // struct GNUNET_CRYPTO_CsC c[2]; - // struct TALER_CoinPubHash c_hash; - - // TALER_coin_pub_hash (coin_pub, - // age_commitment_hash, - // c_hash); - GNUNET_CRYPTO_cs_blinding_secrets_derive (&bks->nonce, bs); - // GNUNET_CRYPTO_cs_calc_blinded_c (bs, - // &alg_values->r_pub, - // &denom_pub->details.cs_public_key, - // &c_hash->hash, - // sizeof(struct GNUNET_HashCode), - // c, - // r_pub_blind->r_pub); - GNUNET_CRYPTO_cs_unblind (&bdenom_sig->details.blinded_cs_answer.s_scalar, &bs[bdenom_sig->details.blinded_cs_answer.b], &denom_sig->details.cs_signature.s_scalar); - - // GNUNET_memcpy (&denom_sig->details.cs_signature.r_point, - // &r_pub_blind.r_pub[bdenom_sig->details.blinded_cs_answer.b - // ], - // sizeof(struct GNUNET_CRYPTO_CsRPublic)); - denom_sig->cipher = TALER_DENOMINATION_CS; return GNUNET_OK; } |