summaryrefslogtreecommitdiff
path: root/src/util/test_helper_cs.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-11-13 19:52:09 +0100
committerChristian Grothoff <christian@grothoff.org>2022-11-13 19:52:09 +0100
commitde2fdc2a9a12acfc15d631f3406c2ff1cffa12ec (patch)
tree1144330d717221f3e157429e023a91a9770bae18 /src/util/test_helper_cs.c
parent18aba0abbb427a2e0e76ae88f95fef493e74032d (diff)
downloadexchange-de2fdc2a9a12acfc15d631f3406c2ff1cffa12ec.tar.gz
exchange-de2fdc2a9a12acfc15d631f3406c2ff1cffa12ec.tar.bz2
exchange-de2fdc2a9a12acfc15d631f3406c2ff1cffa12ec.zip
refactor CS derive API in preparation for batch API
Diffstat (limited to 'src/util/test_helper_cs.c')
-rw-r--r--src/util/test_helper_cs.c39
1 files changed, 26 insertions, 13 deletions
diff --git a/src/util/test_helper_cs.c b/src/util/test_helper_cs.c
index 1a40fa1ef..7c57d50cf 100644
--- a/src/util/test_helper_cs.c
+++ b/src/util/test_helper_cs.c
@@ -289,11 +289,17 @@ test_r_derive (struct TALER_CRYPTO_CsDenominationHelper *dh)
"Requesting R derivation with key %s\n",
GNUNET_h2s (&keys[i].h_cs.hash));
alg_values.cipher = TALER_DENOMINATION_CS;
- ec = TALER_CRYPTO_helper_cs_r_derive_withdraw (
- dh,
- &keys[i].h_cs,
- &pd.blinded_planchet.details.cs_blinded_planchet.nonce,
- &alg_values.details.cs_values);
+ {
+ struct TALER_CRYPTO_CsDeriveRequest cdr = {
+ .h_cs = &keys[i].h_cs,
+ .nonce = &pd.blinded_planchet.details.cs_blinded_planchet.nonce
+ };
+
+ ec = TALER_CRYPTO_helper_cs_r_derive_withdraw (
+ dh,
+ &cdr,
+ &alg_values.details.cs_values);
+ }
switch (ec)
{
case TALER_EC_NONE:
@@ -374,6 +380,10 @@ test_r_derive (struct TALER_CRYPTO_CsDenominationHelper *dh)
struct TALER_CsPubHashP rnd;
struct TALER_CsNonce nonce;
struct TALER_DenominationCSPublicRPairP crp;
+ struct TALER_CRYPTO_CsDeriveRequest cdr = {
+ .h_cs = &rnd,
+ .nonce = &nonce,
+ };
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
&rnd,
@@ -382,8 +392,7 @@ test_r_derive (struct TALER_CRYPTO_CsDenominationHelper *dh)
&nonce,
sizeof (nonce));
ec = TALER_CRYPTO_helper_cs_r_derive_withdraw (dh,
- &rnd,
- &nonce,
+ &cdr,
&crp);
if (TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN != ec)
{
@@ -424,6 +433,10 @@ test_signing (struct TALER_CRYPTO_CsDenominationHelper *dh)
{
struct TALER_PlanchetDetail pd;
struct TALER_CRYPTO_CsSignRequest csr;
+ struct TALER_CRYPTO_CsDeriveRequest cdr = {
+ .h_cs = &keys[i].h_cs,
+ .nonce = &pd.blinded_planchet.details.cs_blinded_planchet.nonce
+ };
pd.blinded_planchet.cipher = TALER_DENOMINATION_CS;
// keys[i].denom_pub.cipher = TALER_DENOMINATION_CS;
@@ -434,10 +447,7 @@ test_signing (struct TALER_CRYPTO_CsDenominationHelper *dh)
alg_values.cipher = TALER_DENOMINATION_CS;
ec = TALER_CRYPTO_helper_cs_r_derive_withdraw (
dh,
- &keys[i].h_cs,
- &pd.blinded_planchet.
- details.
- cs_blinded_planchet.nonce,
+ &cdr,
&alg_values.details.cs_values);
if (TALER_EC_NONE != ec)
continue;
@@ -622,6 +632,10 @@ perf_signing (struct TALER_CRYPTO_CsDenominationHelper *dh,
{
struct TALER_CoinPubHashP c_hash;
struct TALER_PlanchetDetail pd;
+ struct TALER_CRYPTO_CsDeriveRequest cdr = {
+ .h_cs = &keys[i].h_cs,
+ .nonce = &pd.blinded_planchet.details.cs_blinded_planchet.nonce
+ };
pd.blinded_planchet.cipher = TALER_DENOMINATION_CS;
TALER_cs_withdraw_nonce_derive (&ps,
@@ -630,8 +644,7 @@ perf_signing (struct TALER_CRYPTO_CsDenominationHelper *dh,
alg_values.cipher = TALER_DENOMINATION_CS;
ec = TALER_CRYPTO_helper_cs_r_derive_melt (
dh,
- &keys[i].h_cs,
- &pd.blinded_planchet.details.cs_blinded_planchet.nonce,
+ &cdr,
&alg_values.details.cs_values);
if (TALER_EC_NONE != ec)
continue;