gnunet-svn
[Top][All Lists]
Advanced

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

[taler-donau] branch master updated: working on keys


From: gnunet
Subject: [taler-donau] branch master updated: working on keys
Date: Thu, 07 Mar 2024 15:54:11 +0100

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 076a32f  working on keys
076a32f is described below

commit 076a32f8e2a660729b32d072b3b7536f45b73e0c
Author: Casaburi Johannes <johannes.casaburi@students.bfh.ch>
AuthorDate: Thu Mar 7 15:53:45 2024 +0100

    working on keys
---
 src/donau/donau-httpd_keys.c | 95 ++++++++++++++++++++++----------------------
 src/util/donau_crypto.c      | 45 +++++++++++++++++++++
 2 files changed, 93 insertions(+), 47 deletions(-)

diff --git a/src/donau/donau-httpd_keys.c b/src/donau/donau-httpd_keys.c
index d262fc1..3050901 100644
--- a/src/donau/donau-httpd_keys.c
+++ b/src/donau/donau-httpd_keys.c
@@ -657,8 +657,8 @@ create_krd (struct DH_KeyStateHandle *ksh,
   json_t *keys;
 
 
-  GNUNET_assert (! GNUNET_TIME_absolute_is_zero (
-                   last_cherry_pick_date.abs_time));
+  // GNUNET_assert (! GNUNET_TIME_absolute_is_zero (
+  //                  last_cherry_pick_date.abs_time));
   // GNUNET_assert (NULL != signkeys);
   GNUNET_assert (NULL != grouped_donation_units);
   GNUNET_assert (NULL != DH_currency);
@@ -668,8 +668,8 @@ create_krd (struct DH_KeyStateHandle *ksh,
 
   // /* Sign hash over master signatures of all denomination keys until this 
time
   //    (in reverse order). */
-  // {
-  //   enum TALER_ErrorCode ec;
+// {
+//   enum TALER_ErrorCode ec;
 //
 //   if (TALER_EC_NONE !=
 //       (ec =
@@ -708,9 +708,9 @@ create_krd (struct DH_KeyStateHandle *ksh,
     // GNUNET_JSON_pack_array_incref ("signkeys",
     //                                signkeys),
     GNUNET_JSON_pack_array_incref ("donation_units",
-                                   grouped_donation_units),
-    GNUNET_JSON_pack_data_auto ("donau_pub",
-                                &donau_pub)); // ,
+                                   grouped_donation_units)); // ,
+  // GNUNET_JSON_pack_data_auto ("donau_pub",
+  //                            &donau_pub)); // ,
   // GNUNET_JSON_pack_data_auto ("donau_sig",
   //                             &donau_sig));
   GNUNET_assert (NULL != keys);
@@ -1058,7 +1058,8 @@ finish_keys_response (struct DH_KeyStateHandle *ksh)
   }
 
   GNUNET_CONTAINER_heap_destroy (heap);
-  if (! GNUNET_TIME_absolute_is_zero (last_cherry_pick_date.abs_time))
+  // if (! GNUNET_TIME_absolute_is_zero (last_cherry_pick_date.abs_time))
+  if (true)
   {
     struct GNUNET_HashCode hc;
 
@@ -1459,23 +1460,23 @@ helper_rsa_cb (
   GNUNET_assert (GNUNET_CRYPTO_BSA_RSA == bs_pub->cipher);
   hd->donation_unit_pub.bsign_pub_key =
     GNUNET_CRYPTO_bsign_pub_incref (bs_pub);
-//  DONAU_Donation_unit_pub_hash(&hd->donation_unit_pub,
-//                        &hd->h_donation_unit_pub);
-//  hd->section_name = GNUNET_strdup (section_name);
-//  GNUNET_assert (
-//    GNUNET_OK ==
-//    GNUNET_CONTAINER_multihashmap_put (
-//      hs->donation_unit,
-//      &hd->h_donation_unit_pub,
-//      hd,
-//      GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
-//  GNUNET_assert (
-//    GNUNET_OK ==
-//    GNUNET_CONTAINER_multihashmap_put (
-//      hs->rsa_keys,
-//      &hd->h_details.h_rsa.hash,
-//      hd,
-//      GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
+  DONAU_donation_unit_pub_hash (&hd->donation_unit_pub,
+                                &hd->h_donation_unit_pub);
+  hd->section_name = GNUNET_strdup (section_name);
+  GNUNET_assert (
+    GNUNET_OK ==
+    GNUNET_CONTAINER_multihashmap_put (
+      hs->donation_unit,
+      &hd->h_donation_unit_pub,
+      hd,
+      GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
+  GNUNET_assert (
+    GNUNET_OK ==
+    GNUNET_CONTAINER_multihashmap_put (
+      hs->rsa_keys,
+      &hd->h_details.h_rsa.hash,
+      hd,
+      GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
 }
 
 
@@ -1533,23 +1534,23 @@ helper_cs_cb (
   GNUNET_assert (GNUNET_CRYPTO_BSA_CS == bs_pub->cipher);
   hd->donation_unit_pub.bsign_pub_key
     = GNUNET_CRYPTO_bsign_pub_incref (bs_pub);
-//  DONAU_donation_unit_pub_hash (&hd->donation_unit_pub,
-//                        &hd->h_donation_unit_pub);
-//  hd->section_name = GNUNET_strdup (section_name);
-//  GNUNET_assert (
-//    GNUNET_OK ==
-//    GNUNET_CONTAINER_multihashmap_put (
-//      hs->donation_unit,
-//      &hd->h_donation_unit_pub.hash,
-//      hd,
-//      GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
-//  GNUNET_assert (
-//    GNUNET_OK ==
-//    GNUNET_CONTAINER_multihashmap_put (
-//      hs->cs_keys,
-//      &hd->h_details.h_cs.hash,
-//      hd,
-//      GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
+  DONAU_donation_unit_pub_hash (&hd->donation_unit_pub,
+                                &hd->h_donation_unit_pub);
+  hd->section_name = GNUNET_strdup (section_name);
+  GNUNET_assert (
+    GNUNET_OK ==
+    GNUNET_CONTAINER_multihashmap_put (
+      hs->donation_unit,
+      &hd->h_donation_unit_pub.hash,
+      hd,
+      GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
+  GNUNET_assert (
+    GNUNET_OK ==
+    GNUNET_CONTAINER_multihashmap_put (
+      hs->cs_keys,
+      &hd->h_details.h_cs.hash,
+      hd,
+      GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
 }
 
 
@@ -1704,8 +1705,8 @@ donation_unit_info_cb (
 //  return;
 // }
 
-  // GNUNET_assert (GNUNET_CRYPTO_BSA_INVALID !=
-  //               donation_unit_pub->bsign_pub_key->cipher);
+  GNUNET_assert (GNUNET_CRYPTO_BSA_INVALID !=
+                 donation_unit_pub->bsign_pub_key->cipher);
 
   // if (GNUNET_TIME_absolute_is_zero (meta->start.abs_time) ||
   //    GNUNET_TIME_absolute_is_zero (meta->expire_withdraw.abs_time) ||
@@ -1954,9 +1955,9 @@ DH_handler_keys (struct DH_RequestContext *rc,
     GNUNET_assert (NULL != kbc.donation_units);
     GNUNET_assert (NULL != kbc.signkeys);
     GNUNET_assert (NULL != DH_currency);
-    // GNUNET_CONTAINER_multihashmap_iterate (ksh->helpers->donation_unit,
-    //                                       &insert_donation_unit_cb,
-    //                                       &kbc);
+    GNUNET_CONTAINER_multihashmap_iterate (ksh->helpers->donation_unit,
+                                           &insert_donation_unit_cb,
+                                           &kbc);
     GNUNET_CONTAINER_multipeermap_iterate (ksh->helpers->esign_keys,
                                            &add_signkey_cb, &kbc);
     reply = GNUNET_JSON_PACK (
diff --git a/src/util/donau_crypto.c b/src/util/donau_crypto.c
index 383afb8..4f73366 100644
--- a/src/util/donau_crypto.c
+++ b/src/util/donau_crypto.c
@@ -98,3 +98,48 @@ DONAU_donation_unit_pub_free (struct
     donation_unit_pub->bsign_pub_key = NULL;
   }
 }
+
+
+void
+DONAU_donation_unit_pub_hash (const struct
+                              DONAU_DonationUnitPublicKey *donation_unit_pub,
+                              struct DONAU_DonationUnitHashP 
*donation_unit_hash)
+{
+  struct GNUNET_CRYPTO_BlindSignPublicKey *bsp
+    = donation_unit_pub->bsign_pub_key;
+  uint32_t opt[1] = {
+    htonl ((uint32_t) bsp->cipher)
+  };
+  struct GNUNET_HashContext *hc;
+
+  hc = GNUNET_CRYPTO_hash_context_start ();
+  GNUNET_CRYPTO_hash_context_read (hc,
+                                   opt,
+                                   sizeof (opt));
+  switch (bsp->cipher)
+  {
+  case GNUNET_CRYPTO_BSA_RSA:
+    {
+      void *buf;
+      size_t blen;
+
+      blen = GNUNET_CRYPTO_rsa_public_key_encode (
+        bsp->details.rsa_public_key,
+        &buf);
+      GNUNET_CRYPTO_hash_context_read (hc,
+                                       buf,
+                                       blen);
+      GNUNET_free (buf);
+    }
+    break;
+  case GNUNET_CRYPTO_BSA_CS:
+    GNUNET_CRYPTO_hash_context_read (hc,
+                                     &bsp->details.cs_public_key,
+                                     sizeof(bsp->details.cs_public_key));
+    break;
+  default:
+    GNUNET_assert (0);
+  }
+  GNUNET_CRYPTO_hash_context_finish (hc,
+                                     &donation_unit_hash->hash);
+}

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