gnunet-svn
[Top][All Lists]
Advanced

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

[taler-donau] branch master updated: added dr verify


From: gnunet
Subject: [taler-donau] branch master updated: added dr verify
Date: Sun, 28 Apr 2024 14:48:46 +0200

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

johannes-casaburi pushed a commit to branch master
in repository donau.

The following commit(s) were added to refs/heads/master by this push:
     new a1db20b  added dr verify
a1db20b is described below

commit a1db20bd9e9415bb1817cbfd9867b49cb930e3d1
Author: Casaburi Johannes <johannes.casaburi@students.bfh.ch>
AuthorDate: Sun Apr 28 14:47:52 2024 +0200

    added dr verify
---
 src/donau/donau-httpd_batch-submit.c       | 23 +++++------------------
 src/donau/donau-httpd_keys.c               |  4 ----
 src/donaudb/pg_insert_submitted_receipts.c |  4 ++--
 src/donaudb/pg_insert_submitted_receipts.h |  4 ++--
 src/donaudb/test_donaudb.c                 |  6 +++---
 src/include/donau_crypto_lib.h             | 21 ++++++++++++++++-----
 src/include/donau_service.h                |  6 +++---
 src/include/donaudb_plugin.h               |  4 ++--
 src/lib/donau_api_batch_submit_receipts.c  | 12 ++++++------
 src/util/donau_crypto.c                    | 13 +++++++++++++
 10 files changed, 52 insertions(+), 45 deletions(-)

diff --git a/src/donau/donau-httpd_batch-submit.c 
b/src/donau/donau-httpd_batch-submit.c
index 3348ea6..681f25a 100644
--- a/src/donau/donau-httpd_batch-submit.c
+++ b/src/donau/donau-httpd_batch-submit.c
@@ -38,7 +38,7 @@
  */
 struct InsertReceiptContext
 {
-  struct DONAU_HashDonorTaxId *h_tax_number;
+  struct DONAU_HashDonorTaxId *h_donor_tax_id;
   struct DONAU_DonationReceipt *donation_receipts;
   uint64_t donation_year;
 };
@@ -87,8 +87,8 @@ DH_handler_submit_receipts_post (struct DH_RequestContext *rc,
   const json_t *donation_receipts;
 
   struct GNUNET_JSON_Specification spec[] = {
-    GNUNET_JSON_spec_fixed_auto ("h_tax_number",
-                                 &irc.h_tax_number),
+    GNUNET_JSON_spec_fixed_auto ("h_donor_tax_id",
+                                 &irc.h_donor_tax_id),
     GNUNET_JSON_spec_array_const ("donation_receipts",
                                   &donation_receipts),
     GNUNET_JSON_spec_uint64 ("donation_year",
@@ -161,27 +161,14 @@ DH_handler_submit_receipts_post (struct DH_RequestContext 
*rc,
   for (size_t i = 0; i < num_dr; i++)
   {
     // FIXME Check sigs, Donation unit hashes, nonce
-    // /* verify charity signature */
-    // if (GNUNET_OK !=
-    //     DONAU_ (num_bkps,
-    //                               bkps,
-    //                               &charity_meta.charity_pub,
-    //                               &charity_sig))
-    // {
-    //   GNUNET_break_op (0);
-    //   return TALER_MHD_reply_with_error (
-    //     rc->connection,
-    //     MHD_HTTP_FORBIDDEN,
-    //     TALER_EC_DONAU_CHARITY_SIGNATURE_INVALID,
-    //     NULL);
-    // }
+
   }
 
   enum GNUNET_DB_QueryStatus qs;
 
   qs = DH_plugin->insert_submitted_receipts (
     DH_plugin->cls,
-    irc.h_tax_number,
+    irc.h_donor_tax_id,
     num_dr,
     irc.donation_receipts,
     irc.donation_year);
diff --git a/src/donau/donau-httpd_keys.c b/src/donau/donau-httpd_keys.c
index 0416544..ab99441 100644
--- a/src/donau/donau-httpd_keys.c
+++ b/src/donau/donau-httpd_keys.c
@@ -1253,8 +1253,6 @@ DH_keys_donau_sign_ (
     .eddsa_signature = sig->eddsa_sig
   };
 
-  // FIXME NEEDED?
-  // TEH_METRICS_num_signatures[TEH_MT_SIGNATURE_EDDSA]++;
   ec = TALER_CRYPTO_helper_esign_sign_ (esh,
                                         purpose,
                                         &donau_pub,
@@ -1380,7 +1378,6 @@ DH_keys_donation_unit_batch_sign (
       }
       return ec;
     }
-    // TEH_METRICS_num_signatures[TEH_MT_SIGNATURE_CS] += csrs_pos;
   }
   if (0 != rsrs_pos)
   {
@@ -1409,7 +1406,6 @@ DH_keys_donation_unit_batch_sign (
       }
       return ec;
     }
-    // TEH_METRICS_num_signatures[TEH_MT_SIGNATURE_RSA] += rsrs_pos;
   }
 
   rsrs_pos = 0;
diff --git a/src/donaudb/pg_insert_submitted_receipts.c 
b/src/donaudb/pg_insert_submitted_receipts.c
index 0bb21ae..06cb40e 100644
--- a/src/donaudb/pg_insert_submitted_receipts.c
+++ b/src/donaudb/pg_insert_submitted_receipts.c
@@ -29,7 +29,7 @@
 enum GNUNET_DB_QueryStatus
 DH_PG_insert_submitted_receipts (
   void *cls,
-  struct DONAU_HashDonorTaxId *h_tax_number,
+  struct DONAU_HashDonorTaxId *h_donor_tax_id,
   size_t num_dr,
   const struct DONAU_DonationReceipt donation_receipts[static num_dr],
   uint64_t donation_year)
@@ -41,7 +41,7 @@ DH_PG_insert_submitted_receipts (
   const struct DONAU_DonationUnitSignature *donation_unit_sigs[GNUNET_NZL (
                                                                  num_dr)];
   struct GNUNET_PQ_QueryParam params[] = {
-    GNUNET_PQ_query_param_auto_from_type (h_tax_number),
+    GNUNET_PQ_query_param_auto_from_type (h_donor_tax_id),
     GNUNET_PQ_query_param_array_ptrs_auto_from_type (num_dr,
                                                      h_donation_unit_pubs,
                                                      pg->conn),
diff --git a/src/donaudb/pg_insert_submitted_receipts.h 
b/src/donaudb/pg_insert_submitted_receipts.h
index b5ac61e..630a1fe 100644
--- a/src/donaudb/pg_insert_submitted_receipts.h
+++ b/src/donaudb/pg_insert_submitted_receipts.h
@@ -30,7 +30,7 @@
  * Insert submitted donation receipt from the donor.
  *
  * @param cls closure
- * @param h_tax_number salted hash of the donors tax number
+ * @param h_donor_tax_id salted hash of the donors tax number
  * @param donation_receipts array of donation receipts
  * @param donation_year year of the donation
  * @return transaction status code
@@ -38,7 +38,7 @@
 enum GNUNET_DB_QueryStatus
 DH_PG_insert_submitted_receipts (
   void *cls,
-  struct DONAU_HashDonorTaxId *h_tax_number,
+  struct DONAU_HashDonorTaxId *h_donor_tax_id,
   size_t num_dr,
   const struct DONAU_DonationReceipt donation_receipts[static num_dr],
   uint64_t donation_year
diff --git a/src/donaudb/test_donaudb.c b/src/donaudb/test_donaudb.c
index 76b2e7c..e049262 100644
--- a/src/donaudb/test_donaudb.c
+++ b/src/donaudb/test_donaudb.c
@@ -168,7 +168,7 @@ run (void *cls)
   struct DONAUDB_IssuedReceiptsMetaData ir_meta;
 
   // Submitted receipts information
-  struct DONAU_HashDonorTaxId h_tax_number;
+  struct DONAU_HashDonorTaxId h_donor_tax_id;
   size_t num_dr = 1;
   struct DONAU_DonationReceipt donation_receipts[num_dr];
 
@@ -307,13 +307,13 @@ run (void *cls)
   //                                         &ir_meta));
 
   /* test insert submitted receipts */
-  // RND_BLK (&h_tax_number);
+  // RND_BLK (&h_donor_tax_id);
   // RND_BLK (&donation_receipts[0].h_donation_unit_pub);
   // RND_BLK (&donation_receipts[0].nonce);
   // RND_BLK (&donation_receipts[0].donau_sig);
   // FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
   //         plugin->insert_submitted_receipts (plugin->cls,
-  //                                            &h_tax_number,
+  //                                            &h_donor_tax_id,
   //                                            num_dr,
   //                                            donation_receipts,
   //                                            current_year));
diff --git a/src/include/donau_crypto_lib.h b/src/include/donau_crypto_lib.h
index 7ded811..040f9f9 100644
--- a/src/include/donau_crypto_lib.h
+++ b/src/include/donau_crypto_lib.h
@@ -322,7 +322,8 @@ struct DONAU_BkpSignData
    */
   const struct DONAU_BlindedUniqueDonorIdentifier *budi;
 };
-/**
+
+/** USED?
  * Hash of a budikeypair array
  */
 // struct DONAU_BudiKeyPairsHashP
@@ -330,10 +331,18 @@ struct DONAU_BkpSignData
 //   struct GNUNET_HashCode hash;
 // };
 
-/**
+/** USED?
  * Hash of a budikeypair array
  */
-struct DONAU_BudiHashP
+// struct DONAU_BudiHashP
+// {
+//   struct GNUNET_HashCode hash;
+// };
+
+/**
+ * Hash of a Unique Donor Identifier (h_donor_tax_id + nonce)
+ */
+struct DONAU_UniqueDonorIdentifierHashP
 {
   struct GNUNET_HashCode hash;
 };
@@ -419,13 +428,15 @@ DONAU_donation_statement_verify (
 /**
  * Verify donation receipt.
  *
- * @param donation_unit_priv private key of the donation_unit
+ * @param donation_unit_pub public key of the donation_unit
+ * @param h_udi hash of h_donor_tax_id + nonce
  * @param donation_unit_sig signature to verify
  * @return #GNUNET_OK if the signature is valid
  */
 enum GNUNET_GenericReturnValue
 DONAU_donation_receipt_verify (
-  const struct DONAU_DonationReceipt *donation_receipt,
+  const struct DONAU_DonationUnitPublicKey *donation_unit_pub,
+  const struct DONAU_UniqueDonorIdentifierHashP *h_udi,
   const struct DONAU_DonationUnitSignature *donation_unit_sig);
 
 
diff --git a/src/include/donau_service.h b/src/include/donau_service.h
index 7701f30..dfd24ea 100644
--- a/src/include/donau_service.h
+++ b/src/include/donau_service.h
@@ -476,7 +476,7 @@ struct DONAU_BatchIssueResponse
       struct DONAU_BlindedDonationUnitSignature *donau_sigs;
 
       /**
-       * total issued amount over all donation receipts of a donation 
specified 
+       * total issued amount over all donation receipts of a donation specified
        * by the request (confirmation).
        */
       struct TALER_Amount issued_amount;
@@ -642,7 +642,7 @@ typedef void
  * @param num_drs length of the @a drs array
  * @param drs array with details about the donation receipts
  * @param year corresponding year
- * @param h_tax_id salted and hashed tax id
+ * @param h_donor_tax_id salted and hashed tax id
  * @param cb the callback to call when a reply for this request is available
  * @param cls closure for the above callback
  * @param[out] ec if NULL is returned, set to the error code explaining why 
the operation failed
@@ -656,7 +656,7 @@ DONAU_donor_receipts_to_statement (
   const size_t num_drs,
   const struct DONAU_DonationReceipt drs[num_drs],
   const uint64_t year,
-  const struct DONAU_HashDonorTaxId *h_tax_id,
+  const struct DONAU_HashDonorTaxId *h_donor_tax_id,
   DONAU_DonorReceiptsToStatementResultCallback cb,
   void *cls);
 
diff --git a/src/include/donaudb_plugin.h b/src/include/donaudb_plugin.h
index cda587d..e885399 100644
--- a/src/include/donaudb_plugin.h
+++ b/src/include/donaudb_plugin.h
@@ -519,7 +519,7 @@ struct DONAUDB_Plugin
     * Insert submitted donation receipt from the donor.
     *
     * @param cls closure
-    * @param h_tax_number salted hash of the donors tax number
+    * @param h_donor_tax_id salted hash of the donors tax number
     * @param nonce nonce that is part of the unique donation identifier
     * @param donation_unit_pub donation unit public key
     * @param donau_sig donau signature in case the sign keys changed
@@ -529,7 +529,7 @@ struct DONAUDB_Plugin
   enum GNUNET_DB_QueryStatus
     (*insert_submitted_receipts)(
     void *cls,
-    struct DONAU_HashDonorTaxId *h_tax_number,
+    struct DONAU_HashDonorTaxId *h_donor_tax_id,
     size_t num_dr,
     const struct DONAU_DonationReceipt donation_receipts[static num_dr],
     uint64_t donation_year);
diff --git a/src/lib/donau_api_batch_submit_receipts.c 
b/src/lib/donau_api_batch_submit_receipts.c
index 12bbb89..d036798 100644
--- a/src/lib/donau_api_batch_submit_receipts.c
+++ b/src/lib/donau_api_batch_submit_receipts.c
@@ -79,14 +79,14 @@ struct DONAU_DonorReceiptsToStatementHandle
  * @param num_drs number of donation receipts in @drs
  * @param drs donation receipts array
  * @param year corresponding year
- * @param h_tax_id salted and hashed tax id
+ * @param h_donor_tax_id salted and hashed tax id
  */
 json_t *
 submit_request_body_to_json (const size_t num_drs,
                              const struct
                              DONAU_DonationReceipt drs[num_drs],
                              const uint64_t year,
-                             const struct DONAU_HashDonorTaxId *h_tax_id)
+                             const struct DONAU_HashDonorTaxId *h_donor_tax_id)
 {
   json_t *donation_receipts = json_array ();
   GNUNET_assert (NULL != donation_receipts);
@@ -107,8 +107,8 @@ submit_request_body_to_json (const size_t num_drs,
   return GNUNET_JSON_PACK (
     GNUNET_JSON_pack_array_steal ("donation_receipts",
                                   donation_receipts),
-    GNUNET_JSON_pack_data_auto ("h_tax_number",
-                                h_tax_id),
+    GNUNET_JSON_pack_data_auto ("h_donor_tax_id",
+                                h_donor_tax_id),
     GNUNET_JSON_pack_uint64 ("donation_year",
                              year));
 }
@@ -185,7 +185,7 @@ DONAU_donor_receipts_to_statement (
   const size_t num_drs,
   const struct DONAU_DonationReceipt drs[num_drs],
   const uint64_t year,
-  const struct DONAU_HashDonorTaxId *h_tax_id,
+  const struct DONAU_HashDonorTaxId *h_donor_tax_id,
   DONAU_DonorReceiptsToStatementResultCallback cb,
   void *cls)
 {
@@ -213,7 +213,7 @@ DONAU_donor_receipts_to_statement (
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "submit_receipts_with_URL `%s'.\n",
               birh->url);
-  body = submit_request_body_to_json (num_drs, drs, year, h_tax_id);
+  body = submit_request_body_to_json (num_drs, drs, year, h_donor_tax_id);
   eh = DONAU_curl_easy_get_ (birh->url);
   if ( (NULL == eh) ||
        (GNUNET_OK !=
diff --git a/src/util/donau_crypto.c b/src/util/donau_crypto.c
index fd12c41..a57d4fc 100644
--- a/src/util/donau_crypto.c
+++ b/src/util/donau_crypto.c
@@ -136,3 +136,16 @@ DONAU_donation_unit_pub_hash (
     GNUNET_assert (0);
   }
 }
+
+
+enum GNUNET_GenericReturnValue
+DONAU_donation_receipt_verify (
+  const struct DONAU_DonationUnitPublicKey *donation_unit_pub,
+  const struct DONAU_UniqueDonorIdentifierHashP *h_udi,
+  const struct DONAU_DonationUnitSignature *donation_unit_sig)
+{
+  return GNUNET_CRYPTO_blind_sig_verify (donation_unit_pub->bsign_pub_key,
+                                         donation_unit_sig->unblinded_sig,
+                                         h_udi,
+                                         sizeof (*h_udi));
+}
\ No newline at end of file

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