gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-exchange] branch master updated: -fix test_crypto


From: gnunet
Subject: [taler-exchange] branch master updated: -fix test_crypto
Date: Mon, 07 Feb 2022 11:23:55 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new d850ed9c -fix test_crypto
d850ed9c is described below

commit d850ed9ca16b13a27dc285ca63f837ba00faaa2a
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Mon Feb 7 11:23:53 2022 +0100

    -fix test_crypto
---
 src/include/taler_crypto_lib.h | 11 ++++++++++-
 src/util/crypto.c              |  7 +++++++
 src/util/test_crypto.c         | 28 ++++++++++++++++++----------
 3 files changed, 35 insertions(+), 11 deletions(-)

diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
index e74d49f6..e3c5caa4 100644
--- a/src/include/taler_crypto_lib.h
+++ b/src/include/taler_crypto_lib.h
@@ -1530,12 +1530,21 @@ TALER_planchet_prepare (const struct 
TALER_DenominationPublicKey *dk,
  * Frees blinded message inside blinded planchet depending on 
blinded_planchet->cipher
  * Does not free the @a blinded_planchet itself!
  *
- * @param blinded_planchet blnded planchet
+ * @param[in] blinded_planchet blinded planchet
  */
 void
 TALER_blinded_planchet_free (struct TALER_BlindedPlanchet *blinded_planchet);
 
 
+/**
+ * Frees blinded message inside planchet detail.
+ *
+ * @param[in] pd planchet detail to free
+ */
+void
+TALER_planchet_detail_free (struct TALER_PlanchetDetail *pd);
+
+
 /**
  * Obtain a coin from the planchet's secrets and the blind signature
  * of the exchange.
diff --git a/src/util/crypto.c b/src/util/crypto.c
index b4e610ab..8d70b791 100644
--- a/src/util/crypto.c
+++ b/src/util/crypto.c
@@ -384,6 +384,13 @@ TALER_planchet_prepare (const struct 
TALER_DenominationPublicKey *dk,
 }
 
 
+void
+TALER_planchet_detail_free (struct TALER_PlanchetDetail *pd)
+{
+  TALER_blinded_planchet_free (&pd->blinded_planchet);
+}
+
+
 void
 TALER_blinded_planchet_free (struct TALER_BlindedPlanchet *blinded_planchet)
 {
diff --git a/src/util/test_crypto.c b/src/util/test_crypto.c
index d930b773..8b136e73 100644
--- a/src/util/test_crypto.c
+++ b/src/util/test_crypto.c
@@ -82,12 +82,15 @@ test_high_level (void)
   TALER_planchet_setup_refresh (&secret,
                                 1,
                                 &ps2);
-  TALER_planchet_setup_coin_priv (&ps1,
+  TALER_planchet_setup_coin_priv (&ps2,
                                   &alg2,
                                   &coin_priv2);
   TALER_planchet_blinding_secret_create (&ps2,
                                          &alg2,
                                          &bks2);
+  GNUNET_assert (0 !=
+                 GNUNET_memcmp (&ps1,
+                                &ps2));
   GNUNET_assert (0 !=
                  GNUNET_memcmp (&coin_priv1,
                                 &coin_priv2));
@@ -138,10 +141,12 @@ test_planchets_rsa (void)
                                           TALER_DENOMINATION_RSA,
                                           1024));
   alg_values.cipher = TALER_DENOMINATION_RSA;
-
-  TALER_planchet_setup_coin_priv (&ps, &alg_values, &coin_priv);
-  TALER_planchet_blinding_secret_create (&ps, &alg_values, &bks);
-
+  TALER_planchet_setup_coin_priv (&ps,
+                                  &alg_values,
+                                  &coin_priv);
+  TALER_planchet_blinding_secret_create (&ps,
+                                         &alg_values,
+                                         &bks);
   GNUNET_assert (GNUNET_OK ==
                  TALER_planchet_prepare (&dk_pub,
                                          &alg_values,
@@ -153,6 +158,7 @@ test_planchets_rsa (void)
                  TALER_denom_sign_blinded (&blind_sig,
                                            &dk_priv,
                                            &pd.blinded_planchet));
+  TALER_planchet_detail_free (&pd);
   GNUNET_assert (GNUNET_OK ==
                  TALER_planchet_to_coin (&dk_pub,
                                          &blind_sig,
@@ -200,16 +206,18 @@ test_planchets_cs (void)
 
   alg_values.cipher = TALER_DENOMINATION_CS;
 
-  TALER_cs_withdraw_nonce_derive (&ps,
-                                  &pd.blinded_planchet.details.
-                                  cs_blinded_planchet.nonce);
+  TALER_cs_withdraw_nonce_derive (
+    &ps,
+    &pd.blinded_planchet.details.cs_blinded_planchet.nonce);
   GNUNET_assert (GNUNET_OK ==
                  TALER_denom_cs_derive_r_public (
                    &pd.blinded_planchet.details.cs_blinded_planchet.nonce,
                    &dk_priv,
                    &alg_values.details.cs_values.r_pub));
 
-  TALER_planchet_setup_coin_priv (&ps, &alg_values, &coin_priv);
+  TALER_planchet_setup_coin_priv (&ps,
+                                  &alg_values,
+                                  &coin_priv);
   TALER_planchet_blinding_secret_create (&ps,
                                          &alg_values,
                                          &bks);
@@ -226,7 +234,7 @@ test_planchets_cs (void)
                  TALER_denom_sign_blinded (&blind_sig,
                                            &dk_priv,
                                            &pd.blinded_planchet));
-
+  TALER_planchet_detail_free (&pd);
   GNUNET_assert (GNUNET_OK ==
                  TALER_planchet_to_coin (&dk_pub,
                                          &blind_sig,

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]