From f1ec1e70a02ce1672d4d663d3a23c834817359ac Mon Sep 17 00:00:00 2001 From: Gian Demarmels Date: Wed, 22 Dec 2021 16:55:34 +0100 Subject: implemented planchet_prepare for CS --- src/util/crypto.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 46 insertions(+), 8 deletions(-) (limited to 'src/util/crypto.c') diff --git a/src/util/crypto.c b/src/util/crypto.c index 1ef0388dc..9dd32d320 100644 --- a/src/util/crypto.c +++ b/src/util/crypto.c @@ -280,23 +280,61 @@ enum GNUNET_GenericReturnValue TALER_planchet_prepare (const struct TALER_DenominationPublicKey *dk, const struct TALER_PlanchetSecretsP *ps, struct TALER_CoinPubHash *c_hash, - struct TALER_PlanchetDetail *pd) + struct TALER_PlanchetDetail *pd, + ...) { struct TALER_CoinSpendPublicKeyP coin_pub; GNUNET_CRYPTO_eddsa_key_get_public (&ps->coin_priv.eddsa_priv, &coin_pub.eddsa_pub); - if (GNUNET_OK != - TALER_denom_blind (dk, - &ps->blinding_key, - NULL, /* FIXME-Oec */ - &coin_pub, - c_hash, - &pd->blinded_planchet)) + + switch (dk->cipher) { + case TALER_DENOMINATION_RSA: + if (GNUNET_OK != + TALER_denom_blind (dk, + &ps->blinding_key, + NULL, /* FIXME-Oec */ + &coin_pub, + c_hash, + &pd->blinded_planchet)) + { + GNUNET_break (0); + return GNUNET_SYSERR; + } + break; + case TALER_DENOMINATION_CS: + { + va_list ap; + va_start (ap, pd); + struct TALER_WithdrawNonce *nonce; + struct TALER_DenominationCsPublicR *r_pub; + + nonce = va_arg (ap, struct TALER_WithdrawNonce *); + r_pub = va_arg (ap, struct TALER_DenominationCsPublicR *); + + if (GNUNET_OK != + TALER_denom_blind (dk, + &ps->blinding_key, + NULL, /* FIXME-Oec */ + &coin_pub, + c_hash, + &pd->blinded_planchet, + nonce, + r_pub)) + { + va_end (ap); + GNUNET_break (0); + return GNUNET_SYSERR; + } + va_end (ap); + break; + } + default: GNUNET_break (0); return GNUNET_SYSERR; } + TALER_denom_pub_hash (dk, &pd->denom_pub_hash); return GNUNET_OK; -- cgit v1.2.3