aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/crypto.c42
-rw-r--r--src/util/denom.c19
-rw-r--r--src/util/test_crypto.c27
3 files changed, 31 insertions, 57 deletions
diff --git a/src/util/crypto.c b/src/util/crypto.c
index 1e5033a0c..2d3099a44 100644
--- a/src/util/crypto.c
+++ b/src/util/crypto.c
@@ -262,6 +262,7 @@ TALER_planchet_setup_random (struct TALER_PlanchetSecretsP *ps,
GNUNET_break (0);
return;
case TALER_DENOMINATION_RSA:
+ // TODO: replace with call to TALER_blinding_secret_create
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_STRONG,
&ps->blinding_key.rsa_bks,
sizeof (struct
@@ -278,10 +279,9 @@ TALER_planchet_setup_random (struct TALER_PlanchetSecretsP *ps,
enum GNUNET_GenericReturnValue
TALER_planchet_prepare (const struct TALER_DenominationPublicKey *dk,
- const struct TALER_PlanchetSecretsP *ps,
+ struct TALER_PlanchetSecretsP *ps,
struct TALER_CoinPubHash *c_hash,
- struct TALER_PlanchetDetail *pd,
- ...)
+ struct TALER_PlanchetDetail *pd)
{
struct TALER_CoinSpendPublicKeyP coin_pub;
@@ -305,14 +305,6 @@ TALER_planchet_prepare (const struct TALER_DenominationPublicKey *dk,
break;
case TALER_DENOMINATION_CS:
{
- va_list ap;
- va_start (ap, pd);
- struct TALER_DenominationCsPublicR *r_pub;
- struct TALER_DenominationCsPublicR *blinded_r_pub;
-
- r_pub = va_arg (ap, struct TALER_DenominationCsPublicR *);
- blinded_r_pub = va_arg (ap, struct TALER_DenominationCsPublicR *);
-
if (GNUNET_OK !=
TALER_denom_blind (dk,
&ps->blinding_key,
@@ -320,14 +312,12 @@ TALER_planchet_prepare (const struct TALER_DenominationPublicKey *dk,
&coin_pub,
c_hash,
&pd->blinded_planchet,
- r_pub,
- blinded_r_pub))
+ &ps->cs_r_pub,
+ &ps->cs_r_pub_blinded))
{
- va_end (ap);
GNUNET_break (0);
return GNUNET_SYSERR;
}
- va_end (ap);
break;
}
default:
@@ -342,13 +332,12 @@ TALER_planchet_prepare (const struct TALER_DenominationPublicKey *dk,
enum GNUNET_GenericReturnValue
-TALER_planchet_to_coin (
- const struct TALER_DenominationPublicKey *dk,
- const struct TALER_BlindedDenominationSignature *blind_sig,
- const struct TALER_PlanchetSecretsP *ps,
- const struct TALER_CoinPubHash *c_hash,
- struct TALER_FreshCoin *coin,
- ...)
+TALER_planchet_to_coin (const struct TALER_DenominationPublicKey *dk,
+ const struct
+ TALER_BlindedDenominationSignature *blind_sig,
+ const struct TALER_PlanchetSecretsP *ps,
+ const struct TALER_CoinPubHash *c_hash,
+ struct TALER_FreshCoin *coin)
{
struct TALER_DenominationSignature sig;
@@ -367,23 +356,16 @@ TALER_planchet_to_coin (
break;
case TALER_DENOMINATION_CS:
{
- va_list ap;
- va_start (ap, coin);
-
- struct TALER_DenominationCsPublicR *r_pub_blind;
- r_pub_blind = va_arg (ap, struct TALER_DenominationCsPublicR *);
if (GNUNET_OK !=
TALER_denom_sig_unblind (&sig,
blind_sig,
&ps->blinding_key,
dk,
- r_pub_blind))
+ &ps->cs_r_pub_blinded))
{
GNUNET_break_op (0);
- va_end (ap);
return GNUNET_SYSERR;
}
- va_end (ap);
}
break;
default:
diff --git a/src/util/denom.c b/src/util/denom.c
index 4b62f4cc0..9d8acfcae 100644
--- a/src/util/denom.c
+++ b/src/util/denom.c
@@ -107,8 +107,7 @@ TALER_denom_cs_derive_r_public (const struct TALER_WithdrawNonce *nonce,
enum GNUNET_GenericReturnValue
TALER_denom_sign_blinded (struct TALER_BlindedDenominationSignature *denom_sig,
const struct TALER_DenominationPrivateKey *denom_priv,
- const struct TALER_BlindedPlanchet *blinded_planchet,
- ...)
+ const struct TALER_BlindedPlanchet *blinded_planchet)
{
memset (denom_sig,
0,
@@ -133,27 +132,23 @@ TALER_denom_sign_blinded (struct TALER_BlindedDenominationSignature *denom_sig,
return GNUNET_OK;
case TALER_DENOMINATION_CS:
{
- va_list ap;
- va_start (ap, blinded_planchet);
- struct TALER_WithdrawNonce *nonce;
- nonce = va_arg (ap, struct TALER_WithdrawNonce *);
-
struct GNUNET_CRYPTO_CsRSecret r[2];
- GNUNET_CRYPTO_cs_r_derive (&nonce->nonce,
- &denom_priv->details.cs_private_key,
- r);
+ GNUNET_CRYPTO_cs_r_derive (
+ &blinded_planchet->details.cs_blinded_planchet.nonce.nonce,
+ &denom_priv->details.cs_private_key,
+ r);
denom_sig->details.blinded_cs_answer.b =
GNUNET_CRYPTO_cs_sign_derive (&denom_priv->details.cs_private_key,
r,
blinded_planchet->details.
cs_blinded_planchet.c,
- &nonce->nonce,
+ &blinded_planchet->details.
+ cs_blinded_planchet.nonce.nonce,
&denom_sig->details.blinded_cs_answer.
s_scalar);
denom_sig->cipher = TALER_DENOMINATION_CS;
- va_end (ap);
}
return GNUNET_OK;
default:
diff --git a/src/util/test_crypto.c b/src/util/test_crypto.c
index 760ec0fa3..513fbbad8 100644
--- a/src/util/test_crypto.c
+++ b/src/util/test_crypto.c
@@ -146,9 +146,6 @@ test_planchets_cs (void)
struct TALER_DenominationPublicKey dk_pub;
struct TALER_PlanchetDetail pd;
struct TALER_CoinPubHash c_hash;
- struct TALER_WithdrawNonce nonce;
- struct TALER_DenominationCsPublicR r_pub;
- struct TALER_DenominationCsPublicR r_pub_blind;
struct TALER_BlindedDenominationSignature blind_sig;
struct TALER_FreshCoin coin;
@@ -158,37 +155,37 @@ test_planchets_cs (void)
TALER_DENOMINATION_CS));
TALER_planchet_setup_random (&ps, TALER_DENOMINATION_CS);
- TALER_cs_withdraw_nonce_derive (&ps.coin_priv, &nonce);
+ TALER_cs_withdraw_nonce_derive (&ps.coin_priv,
+ &pd.blinded_planchet.details.
+ cs_blinded_planchet.nonce);
GNUNET_assert (GNUNET_OK ==
- TALER_denom_cs_derive_r_public (&nonce,
- &dk_priv,
- &r_pub));
+ TALER_denom_cs_derive_r_public (
+ &pd.blinded_planchet.details.cs_blinded_planchet.nonce,
+ &dk_priv,
+ &ps.cs_r_pub));
+ // TODO: eliminate r_pubs parameter
TALER_blinding_secret_create (&ps.blinding_key,
TALER_DENOMINATION_CS,
&ps.coin_priv,
- &r_pub);
+ &ps.cs_r_pub);
GNUNET_assert (GNUNET_OK ==
TALER_planchet_prepare (&dk_pub,
&ps,
&c_hash,
- &pd,
- &r_pub,
- &r_pub_blind));
+ &pd));
GNUNET_assert (GNUNET_OK ==
TALER_denom_sign_blinded (&blind_sig,
&dk_priv,
- &pd.blinded_planchet,
- &nonce));
+ &pd.blinded_planchet));
GNUNET_assert (GNUNET_OK ==
TALER_planchet_to_coin (&dk_pub,
&blind_sig,
&ps,
&c_hash,
- &coin,
- &r_pub_blind));
+ &coin));
TALER_blinded_denom_sig_free (&blind_sig);
TALER_denom_sig_free (&coin.sig);