gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] 75/130: more RSA abstraction work


From: gnunet
Subject: [taler-exchange] 75/130: more RSA abstraction work
Date: Wed, 17 Nov 2021 12:25:23 +0100

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

grothoff pushed a commit to branch master
in repository exchange.

commit 2549fb6dc7b08c03196ef40d8326d10e661a5379
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Fri Nov 5 17:19:47 2021 +0100

    more RSA abstraction work
---
 src/util/taler-exchange-secmod-rsa.c |  4 ++--
 src/util/test_crypto.c               | 11 +++++------
 src/util/test_helper_rsa.c           | 33 ++++++++++++++-------------------
 3 files changed, 21 insertions(+), 27 deletions(-)

diff --git a/src/util/taler-exchange-secmod-rsa.c 
b/src/util/taler-exchange-secmod-rsa.c
index 028c54ef..1248b126 100644
--- a/src/util/taler-exchange-secmod-rsa.c
+++ b/src/util/taler-exchange-secmod-rsa.c
@@ -875,8 +875,8 @@ setup_key (struct DenominationKey *dk,
                               "write",
                               dk->filename);
     GNUNET_free (buf);
-    GNUNET_CRYPTO_rsa_private_key_free (priv.details.rsa_private_key);
-    GNUNET_CRYPTO_rsa_public_key_free (pub.details.rsa_public_key);
+    TALER_denom_priv_free (&priv);
+    TALER_denom_pub_free (&pub);
     return GNUNET_SYSERR;
   }
   GNUNET_free (buf);
diff --git a/src/util/test_crypto.c b/src/util/test_crypto.c
index 416ca5e2..5ee06487 100644
--- a/src/util/test_crypto.c
+++ b/src/util/test_crypto.c
@@ -103,12 +103,11 @@ test_planchets (void)
                                          &ps,
                                          &c_hash,
                                          &pd));
-  blind_sig.cipher = TALER_DENOMINATION_RSA;
-  blind_sig.details.blinded_rsa_signature
-    = GNUNET_CRYPTO_rsa_sign_blinded (dk_priv.details.rsa_private_key,
-                                      pd.coin_ev,
-                                      pd.coin_ev_size);
-  GNUNET_assert (NULL != blind_sig.details.blinded_rsa_signature);
+  GNUNET_assert (GNUNET_OK ==
+                 TALER_denom_sign_blinded (&blind_sig,
+                                           &dk_priv,
+                                           pd.coin_ev,
+                                           pd.coin_ev_size));
   GNUNET_assert (GNUNET_OK ==
                  TALER_planchet_to_coin (&dk_pub,
                                          &blind_sig,
diff --git a/src/util/test_helper_rsa.c b/src/util/test_helper_rsa.c
index bf79e1e4..5dedf8f7 100644
--- a/src/util/test_helper_rsa.c
+++ b/src/util/test_helper_rsa.c
@@ -309,10 +309,10 @@ test_signing (struct TALER_CRYPTO_DenominationHelper *dh)
         {
           /* signature invalid */
           GNUNET_break (0);
-          GNUNET_CRYPTO_rsa_signature_free (rs.details.rsa_signature);
+          TALER_denom_sig_free (&rs);
           return 7;
         }
-        GNUNET_CRYPTO_rsa_signature_free (rs.details.rsa_signature);
+        TALER_denom_sig_free (&rs);
       }
       GNUNET_log (GNUNET_ERROR_TYPE_INFO,
                   "Received valid signature for key %s\n",
@@ -386,12 +386,10 @@ perf_signing (struct TALER_CRYPTO_DenominationHelper *dh)
   struct TALER_BlindedDenominationSignature ds;
   enum TALER_ErrorCode ec;
   struct TALER_CoinPubHash m_hash;
-  struct GNUNET_CRYPTO_RsaBlindingKeySecret bks;
   struct GNUNET_TIME_Relative duration;
+  struct TALER_PlanchetSecretsP ps;
 
-  GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
-                              &bks,
-                              sizeof (bks));
+  TALER_planchet_setup_random (&ps);
   GNUNET_CRYPTO_hash ("Hello",
                       strlen ("Hello"),
                       &m_hash.hash);
@@ -410,15 +408,14 @@ perf_signing (struct TALER_CRYPTO_DenominationHelper *dh)
           keys[i].validity_duration.rel_value_us)
         continue;
       {
-        void *buf;
-        size_t buf_size;
+        struct TALER_CoinPubHash c_hash;
+        struct TALER_PlanchetDetail pd;
 
         GNUNET_assert (GNUNET_YES ==
-                       TALER_rsa_blind (&m_hash,
-                                        &bks,
-                                        
keys[i].denom_pub.details.rsa_public_key,
-                                        &buf,
-                                        &buf_size));
+                       TALER_planchet_prepare (&keys[i].denom_pub,
+                                               &ps,
+                                               &c_hash,
+                                               &pd));
         /* use this key as long as it works */
         while (1)
         {
@@ -427,8 +424,8 @@ perf_signing (struct TALER_CRYPTO_DenominationHelper *dh)
 
           ds = TALER_CRYPTO_helper_denom_sign (dh,
                                                &keys[i].h_denom_pub,
-                                               buf,
-                                               buf_size,
+                                               pd.coin_ev,
+                                               pd.coin_ev_size,
                                                &ec);
           if (TALER_EC_NONE != ec)
             break;
@@ -440,7 +437,7 @@ perf_signing (struct TALER_CRYPTO_DenominationHelper *dh)
           if (NUM_SIGN_TESTS == j)
             break;
         }
-        GNUNET_free (buf);
+        GNUNET_free (pd.coin_ev);
       }
     } /* for i */
   } /* for j */
@@ -527,9 +524,7 @@ run_test (void)
   for (unsigned int i = 0; i<MAX_KEYS; i++)
     if (keys[i].valid)
     {
-      GNUNET_CRYPTO_rsa_public_key_free (
-        keys[i].denom_pub.details.rsa_public_key);
-      keys[i].denom_pub.details.rsa_public_key = NULL;
+      TALER_denom_pub_free (&keys[i].denom_pub);
       GNUNET_assert (num_keys > 0);
       num_keys--;
     }

-- 
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]