summaryrefslogtreecommitdiff
path: root/src/util/crypto.c
diff options
context:
space:
mode:
authorGian Demarmels <gian@demarmels.org>2021-12-22 16:55:34 +0100
committerGian Demarmels <gian@demarmels.org>2022-02-04 15:31:49 +0100
commitf1ec1e70a02ce1672d4d663d3a23c834817359ac (patch)
tree6cf31edda09bf2caec818e6e7e10296203dc733d /src/util/crypto.c
parenta02ab8f81b68b59ef5228ce30583d9388f9bab4a (diff)
downloadexchange-f1ec1e70a02ce1672d4d663d3a23c834817359ac.tar.gz
exchange-f1ec1e70a02ce1672d4d663d3a23c834817359ac.tar.bz2
exchange-f1ec1e70a02ce1672d4d663d3a23c834817359ac.zip
implemented planchet_prepare for CS
Diffstat (limited to 'src/util/crypto.c')
-rw-r--r--src/util/crypto.c54
1 files changed, 46 insertions, 8 deletions
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;