gnunet-svn
[Top][All Lists]
Advanced

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

[taler-donau] branch master updated (02d6199 -> 46c1206)


From: gnunet
Subject: [taler-donau] branch master updated (02d6199 -> 46c1206)
Date: Thu, 18 Apr 2024 00:25:27 +0200

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

lukas-matyja pushed a change to branch master
in repository donau.

    from 02d6199  [doc] some changes on thesis
     new 064e297  [donau] batch  blind signing
     new 46c1206  [donau] some changes

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/donau/donau-httpd_batch-issue.c                |  10 +-
 src/donau/donau-httpd_keys.c                       | 278 ++++++++++-----------
 src/donau/donau-httpd_keys.h                       |  12 +-
 .../donau_do_save_issue_receipts_request.sql       |   2 +-
 4 files changed, 152 insertions(+), 150 deletions(-)

diff --git a/src/donau/donau-httpd_batch-issue.c 
b/src/donau/donau-httpd_batch-issue.c
index bc2f21c..acfb328 100644
--- a/src/donau/donau-httpd_batch-issue.c
+++ b/src/donau/donau-httpd_batch-issue.c
@@ -345,12 +345,14 @@ start:
     bkps_sign_data[i].h_donation_unit_pub = &bkps[i].h_donation_unit_pub;
     bkps_sign_data[i].budi = &bkps[i].blinded_udi;
   }
-  if (TALER_EC_NONE != DH_keys_donation_unit_batch_sign (num_bkps,
-                                                         bkps_sign_data,
-                                                         du_sigs))
+  enum TALER_ErrorCode batch_sign_ec;
+  batch_sign_ec = DH_keys_donation_unit_batch_sign (num_bkps,
+                                                    bkps_sign_data,
+                                                    du_sigs);
+  if (TALER_EC_NONE != batch_sign_ec)
     return TALER_MHD_reply_with_error (rc->connection,
                                        MHD_HTTP_INTERNAL_SERVER_ERROR,
-                                       TALER_EC_GENERIC_DB_FETCH_FAILED,   // 
TODO:other EC
+                                       batch_sign_ec,   // TODO:other EC
                                        NULL);
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "made blind signatures!\n");
diff --git a/src/donau/donau-httpd_keys.c b/src/donau/donau-httpd_keys.c
index 2106f8d..a788516 100644
--- a/src/donau/donau-httpd_keys.c
+++ b/src/donau/donau-httpd_keys.c
@@ -1289,147 +1289,147 @@ DH_keys_donau_sign_ (
 
 enum TALER_ErrorCode
 DH_keys_donation_unit_batch_sign (
-  unsigned int budis_length,
-  const struct DONAU_BkpSignData bkps[budis_length],
-  struct DONAU_BlindedDonationUnitSignature du_sigs[budis_length])
+  unsigned int num_bkps,
+  const struct DONAU_BkpSignData bkps[num_bkps],
+  struct DONAU_BlindedDonationUnitSignature du_sigs[num_bkps])
 {
+  struct DH_KeyStateHandle *ksh;
+  struct DH_DonationUnitKey *du;
+  struct TALER_CRYPTO_RsaSignRequest rsrs[num_bkps];
+  struct TALER_CRYPTO_CsSignRequest csrs[num_bkps];
+  struct TALER_BlindedDenominationSignature rs[num_bkps];
+  struct TALER_BlindedDenominationSignature cs[num_bkps];
+  unsigned int rsrs_pos = 0;
+  unsigned int csrs_pos = 0;
+  enum TALER_ErrorCode ec;
+
+  ksh = DH_keys_get_state ();
+  if (NULL == ksh)
+    // FIXME change error code
+    return TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING;
+  for (unsigned int i = 0; i<num_bkps; i++)
+  {
+    const struct DONAU_DonationUnitHashP *h_du_pub =
+      bkps[i].h_donation_unit_pub;
+    const struct DONAU_BlindedUniqueDonorIdentifier *budi = bkps[i].budi;
+
+    du = GNUNET_CONTAINER_multihashmap_get (du_keys,
+                                            &h_du_pub->hash);
+    if (NULL == du)
+      // FIXME change error code
+      return TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN;
+    if (budi->blinded_message->cipher !=
+        du->donation_unit_pub.bsign_pub_key->cipher)
+      return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
+    switch (du->donation_unit_pub.bsign_pub_key->cipher)
+    {
+    case GNUNET_CRYPTO_BSA_RSA:
+      /* See DONAU_donation_unit_pub_hash: we guarantee that these
+   hashes are equivalent! */
+      rsrs[rsrs_pos].h_rsa
+        = (const struct TALER_RsaPubHashP *) &du->h_donation_unit_pub;
+      rsrs[rsrs_pos].msg
+        = budi->blinded_message->details.rsa_blinded_message.blinded_msg;
+      rsrs[rsrs_pos].msg_size
+        = budi->blinded_message->details.rsa_blinded_message.blinded_msg_size;
+      rsrs_pos++;
+      break;
+    case GNUNET_CRYPTO_BSA_CS:
+      /* See DONAU_donation_unit_pub_hash: we guarantee that these
+   hashes are equivalent! */
+      csrs[csrs_pos].h_cs
+        = (const struct TALER_CsPubHashP *) &du->h_donation_unit_pub;
+      csrs[csrs_pos].blinded_planchet
+        = &budi->blinded_message->details.cs_blinded_message;
+      csrs_pos++;
+      break;
+    default:
+      return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
+    }
+  }
+
+  if ( (0 != csrs_pos) &&
+       (0 != rsrs_pos) )
+  {
+    memset (rs,
+            0,
+            sizeof (rs));
+    memset (cs,
+            0,
+            sizeof (cs));
+  }
+  ec = TALER_EC_NONE;
+  if (0 != csrs_pos)
+  {
+    ec = TALER_CRYPTO_helper_cs_batch_sign (
+      csdh,
+      csrs_pos,
+      csrs,
+      false, // for_melt
+      cs);
+    if (TALER_EC_NONE != ec)
+    {
+      for (unsigned int i = 0; i<csrs_pos; i++)
+      {
+        if (NULL != cs[i].blinded_sig)
+        {
+          GNUNET_CRYPTO_blinded_sig_decref (cs[i].blinded_sig);
+          cs[i].blinded_sig = NULL;
+        }
+      }
+      return ec;
+    }
+    // TEH_METRICS_num_signatures[TEH_MT_SIGNATURE_CS] += csrs_pos;
+  }
+  if (0 != rsrs_pos)
+  {
+    ec = TALER_CRYPTO_helper_rsa_batch_sign (
+      rsadh,
+      rsrs_pos,
+      rsrs,
+      rs);
+    if (TALER_EC_NONE != ec)
+    {
+      for (unsigned int i = 0; i<csrs_pos; i++)
+      {
+        if (NULL != cs[i].blinded_sig)
+        {
+          GNUNET_CRYPTO_blinded_sig_decref (cs[i].blinded_sig);
+          cs[i].blinded_sig = NULL;
+        }
+      }
+      for (unsigned int i = 0; i<rsrs_pos; i++)
+      {
+        if (NULL != rs[i].blinded_sig)
+        {
+          GNUNET_CRYPTO_blinded_sig_decref (rs[i].blinded_sig);
+          rs[i].blinded_sig = NULL;
+        }
+      }
+      return ec;
+    }
+    // TEH_METRICS_num_signatures[TEH_MT_SIGNATURE_RSA] += rsrs_pos;
+  }
+
+  rsrs_pos = 0;
+  csrs_pos = 0;
+  for (unsigned int i = 0; i<num_bkps; i++)
+  {
+    const struct DONAU_BlindedUniqueDonorIdentifier *budi = bkps[i].budi;
+
+    switch (budi->blinded_message->cipher)
+    {
+    case GNUNET_CRYPTO_BSA_RSA:
+      du_sigs[i].blinded_sig = rs[rsrs_pos++].blinded_sig;
+      break;
+    case GNUNET_CRYPTO_BSA_CS:
+      du_sigs[i].blinded_sig = cs[csrs_pos++].blinded_sig;
+      break;
+    default:
+      GNUNET_assert (0);
+    }
+  }
   return TALER_EC_NONE;
-  // struct DH_KeyStateHandle *ksh;
-  // struct DH_DonationUnitKey *du;
-  // struct TALER_CRYPTO_RsaSignRequest rsrs[csds_length];
-  // struct TALER_CRYPTO_CsSignRequest csrs[csds_length];
-  // struct TALER_BlindedDenominationSignature rs[csds_length];
-  // struct TALER_BlindedDenominationSignature cs[csds_length];
-  // unsigned int rsrs_pos = 0;
-  // unsigned int csrs_pos = 0;
-  // enum TALER_ErrorCode ec;
-
-  // ksh = DH_keys_get_state ();
-  // if (NULL == ksh)
-  //   // FIXME change error code
-  //   return TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING;
-  // for (unsigned int i = 0; i<csds_length; i++)
-  // {
-  //   const struct DONAU_DonationUnitHashP *h_du_pub = csds[i].h_du_pub;
-  //   const struct DONAU_BlindedUniqueDonorIdentifier *budi = csds[i].budi;
-
-  //   du = GNUNET_CONTAINER_multihashmap_get (du_keys,
-  //                                           &h_du_pub->hash);
-  //   if (NULL == du)
-  //     // FIXME change error code
-  //     return TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN;
-  //   if (budi->blinded_message->cipher !=
-  //       du->donation_unit_pub.bsign_pub_key->cipher)
-  //     return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
-  //   switch (du->donation_unit_pub.bsign_pub_key->cipher)
-  //   {
-  //   case GNUNET_CRYPTO_BSA_RSA:
-  //     /* See DONAU_donation_unit_pub_hash: we guarantee that these
-  //  hashes are equivalent! */
-  //     rsrs[rsrs_pos].h_rsa
-  //       = (const struct TALER_RsaPubHashP *) &du->h_donation_unit_pub;
-  //     rsrs[rsrs_pos].msg
-  //       = budi->blinded_message->details.rsa_blinded_message.blinded_msg;
-  //     rsrs[rsrs_pos].msg_size
-  //       = 
budi->blinded_message->details.rsa_blinded_message.blinded_msg_size;
-  //     rsrs_pos++;
-  //     break;
-  //   case GNUNET_CRYPTO_BSA_CS:
-  //     /* See DONAU_donation_unit_pub_hash: we guarantee that these
-  //  hashes are equivalent! */
-  //     csrs[csrs_pos].h_cs
-  //       = (const struct TALER_CsPubHashP *) &du->h_donation_unit_pub;
-  //     csrs[csrs_pos].blinded_planchet
-  //       = &budi->blinded_message->details.cs_blinded_message;
-  //     csrs_pos++;
-  //     break;
-  //   default:
-  //     return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
-  //   }
-  // }
-
-  // if ( (0 != csrs_pos) &&
-  //      (0 != rsrs_pos) )
-  // {
-  //   memset (rs,
-  //           0,
-  //           sizeof (rs));
-  //   memset (cs,
-  //           0,
-  //           sizeof (cs));
-  // }
-  // ec = TALER_EC_NONE;
-  // if (0 != csrs_pos)
-  // {
-  //   ec = TALER_CRYPTO_helper_cs_batch_sign (
-  //     csdh,
-  //     csrs_pos,
-  //     csrs,
-  //     false, // for_melt
-  //     cs);
-  //   if (TALER_EC_NONE != ec)
-  //   {
-  //     for (unsigned int i = 0; i<csrs_pos; i++)
-  //     {
-  //       if (NULL != cs[i].blinded_sig)
-  //       {
-  //         GNUNET_CRYPTO_blinded_sig_decref (cs[i].blinded_sig);
-  //         cs[i].blinded_sig = NULL;
-  //       }
-  //     }
-  //     return ec;
-  //   }
-  //   // TEH_METRICS_num_signatures[TEH_MT_SIGNATURE_CS] += csrs_pos;
-  // }
-  // if (0 != rsrs_pos)
-  // {
-  //   ec = TALER_CRYPTO_helper_rsa_batch_sign (
-  //     rsadh,
-  //     rsrs_pos,
-  //     rsrs,
-  //     rs);
-  //   if (TALER_EC_NONE != ec)
-  //   {
-  //     for (unsigned int i = 0; i<csrs_pos; i++)
-  //     {
-  //       if (NULL != cs[i].blinded_sig)
-  //       {
-  //         GNUNET_CRYPTO_blinded_sig_decref (cs[i].blinded_sig);
-  //         cs[i].blinded_sig = NULL;
-  //       }
-  //     }
-  //     for (unsigned int i = 0; i<rsrs_pos; i++)
-  //     {
-  //       if (NULL != rs[i].blinded_sig)
-  //       {
-  //         GNUNET_CRYPTO_blinded_sig_decref (rs[i].blinded_sig);
-  //         rs[i].blinded_sig = NULL;
-  //       }
-  //     }
-  //     return ec;
-  //   }
-  //   // TEH_METRICS_num_signatures[TEH_MT_SIGNATURE_RSA] += rsrs_pos;
-  // }
-
-  // rsrs_pos = 0;
-  // csrs_pos = 0;
-  // for (unsigned int i = 0; i<csds_length; i++)
-  // {
-  //   const struct DONAU_BlindedUniqueDonorIdentifier *budi = csds[i].budi;
-
-  //   switch (budi->blinded_message->cipher)
-  //   {
-  //   case GNUNET_CRYPTO_BSA_RSA:
-  //     bss[i].blinded_sig = rs[rsrs_pos++].blinded_sig;
-  //     break;
-  //   case GNUNET_CRYPTO_BSA_CS:
-  //     bss[i].blinded_sig = cs[csrs_pos++].blinded_sig;
-  //     break;
-  //   default:
-  //     GNUNET_assert (0);
-  //   }
-  // }
-  // return TALER_EC_NONE;
 }
 
 
diff --git a/src/donau/donau-httpd_keys.h b/src/donau/donau-httpd_keys.h
index 6bf59ce..e7dacb9 100644
--- a/src/donau/donau-httpd_keys.h
+++ b/src/donau/donau-httpd_keys.h
@@ -114,7 +114,7 @@ DH_keys_donau_sign_ (
  * @return #TALER_EC_NONE on success
  */
 #define DH_keys_donau_sign(ps,pub,sig) \
-        ({                                                  \
+  ({                                                  \
     /* check size is set correctly */                 \
     GNUNET_assert (htonl ((ps)->purpose.size) ==      \
                    sizeof (*ps));                     \
@@ -179,16 +179,16 @@ DH_keys_finished (void);
 /**
  * Request to sign @a budis.
  *
- * @param budis_length length of @a budis array
+ * @param num_bkps length of @a budis array
  * @param bkps array with data to blindly sign (and keys to sign with)
- * @param[out] du_sigs array set to the blind signature on success; must be of 
length @a budis_length
+ * @param[out] du_sigs array set to the blind signature on success; must be of 
length @a num_bkps
  * @return #TALER_EC_NONE on success
  */
 enum TALER_ErrorCode
 DH_keys_donation_unit_batch_sign (
-  unsigned int budis_length,
-  const struct DONAU_BkpSignData bkps[budis_length],
-  struct DONAU_BlindedDonationUnitSignature du_sigs[budis_length]);
+  unsigned int num_bkps,
+  const struct DONAU_BkpSignData bkps[num_bkps],
+  struct DONAU_BlindedDonationUnitSignature du_sigs[num_bkps]);
 
 
 #endif
diff --git a/src/donaudb/donau_do_save_issue_receipts_request.sql 
b/src/donaudb/donau_do_save_issue_receipts_request.sql
index ea07da3..74fff7c 100644
--- a/src/donaudb/donau_do_save_issue_receipts_request.sql
+++ b/src/donaudb/donau_do_save_issue_receipts_request.sql
@@ -29,7 +29,7 @@ BEGIN
 UPDATE charities SET receipts_to_date = in_new_total_amount;
 -- Insert into the table receipts_issued
 INSERT INTO receipts_issued (/*blinded_sig,*/ charity_id, receipt_hash, 
amount) 
-VALUES (/*in_blinded_sig,*/ in_charity_id, in_receipt_hash, in_amount) 
RETURNING receipt_id INTO out_receipt_id;
+VALUES (/*in_blinded_sig,*/ in_charity_id, in_receipt_hash, in_amount); 
--RETURNING receipt_id INTO out_receipt_id;
 -- Get the receipts id
 -- SELECT receipt_id INTO out_receipt_id SELECT WHERE 
receipt_hash=in_receipts_hash FROM receipts_issued ;
 -- Commit the transaction if everything is successful

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