[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-donau] branch master updated: [lib] some deletions
From: |
gnunet |
Subject: |
[taler-donau] branch master updated: [lib] some deletions |
Date: |
Tue, 31 Oct 2023 00:25:58 +0100 |
This is an automated email from the git hooks/post-receive script.
lukas-matyja pushed a commit to branch master
in repository donau.
The following commit(s) were added to refs/heads/master by this push:
new 4e29b2f [lib] some deletions
4e29b2f is described below
commit 4e29b2f7cb88d3601d22c2c2fee0bf26a8bc6fe4
Author: Matyja Lukas Adam <lukas.matyja@students.bfh.ch>
AuthorDate: Tue Oct 31 00:26:14 2023 +0100
[lib] some deletions
---
src/include/taler_donau_crypto_lib.h | 13 ++
src/include/taler_donau_service.h | 12 --
src/lib/donau_api_handle.c | 335 +----------------------------------
3 files changed, 16 insertions(+), 344 deletions(-)
diff --git a/src/include/taler_donau_crypto_lib.h
b/src/include/taler_donau_crypto_lib.h
index b0ae27f..b6900b0 100644
--- a/src/include/taler_donau_crypto_lib.h
+++ b/src/include/taler_donau_crypto_lib.h
@@ -15,6 +15,7 @@
*/
/**
* @file include/taler_crypto_lib.h
+ * @file include/gnunet_crypto_lib.h
* @brief taler-specific crypto functions
* @author Sree Harsha Totakura <sreeharsha@totakura.in>
* @author Christian Grothoff <christian@grothoff.org>
@@ -37,6 +38,18 @@
/* ****************** donau crypto primitives ************* */
+/**
+ * Regular online message signing key used by Donau.
+ */
+struct TALER_DONAU_EddsaPublicKeyP
+{
+ /**
+ * Donau uses EdDSA for online signing.
+ */
+ struct GNUNET_CRYPTO_EddsaPublicKey eddsa_pub;
+
+};
+
/**
* Hash of a donation unit public key
*/
diff --git a/src/include/taler_donau_service.h
b/src/include/taler_donau_service.h
index 549823e..0039aad 100644
--- a/src/include/taler_donau_service.h
+++ b/src/include/taler_donau_service.h
@@ -34,18 +34,6 @@
/* ********************* /keys *********************** */
-/**
- * Regular online message signing key used by Donau.
- */
-struct TALER_DONAU_EddsaPublicKeyP
-{
- /**
- * Donau uses EdDSA for online signing.
- */
- struct GNUNET_CRYPTO_EddsaPublicKey eddsa_pub;
-
-};
-
/**
* @brief Donau's statement signing public key
diff --git a/src/lib/donau_api_handle.c b/src/lib/donau_api_handle.c
index 8767309..c8bd623 100644
--- a/src/lib/donau_api_handle.c
+++ b/src/lib/donau_api_handle.c
@@ -28,9 +28,7 @@
#include <gnunet/gnunet_curl_lib.h>
#include "taler_json_lib.h"
#include "taler_donau_service.h"
-#include "taler_auditor_service.h"
#include "taler_signatures.h"
-#include "taler_extensions.h"
#include "donau_api_handle.h"
#include "donau_api_curl_defaults.h"
#include "backoff.h"
@@ -40,7 +38,7 @@
* Which version of the Taler protocol is implemented
* by this library? Used to determine compatibility.
*/
-#define DONAU_PROTOCOL_CURRENT 17
+#define DONAU_PROTOCOL_CURRENT 0
/**
* How many versions are we backwards compatible with?
@@ -123,143 +121,6 @@ struct TALER_DONAU_GetKeysHandle
};
-/**
- * Frees @a wfm array.
- *
- * @param wfm fee array to release
- * @param wfm_len length of the @a wfm array
- */
-static void
-free_fees (struct TALER_DONAU_WireFeesByMethod *wfm,
- unsigned int wfm_len)
-{
- for (unsigned int i = 0; i<wfm_len; i++)
- {
- struct TALER_DONAU_WireFeesByMethod *wfmi = &wfm[i];
-
- while (NULL != wfmi->fees_head)
- {
- struct TALER_DONAU_WireAggregateFees *fe
- = wfmi->fees_head;
-
- wfmi->fees_head = fe->next;
- GNUNET_free (fe);
- }
- GNUNET_free (wfmi->method);
- }
- GNUNET_free (wfm);
-}
-
-
-/**
- * Parse wire @a fees and return array.
- *
- * @param master_pub master public key to use to check signatures
- * @param currency currency amounts are expected in
- * @param fees json AggregateTransferFee to parse
- * @param[out] fees_len set to length of returned array
- * @return NULL on error
- */
-static struct TALER_DONAU_WireFeesByMethod *
-parse_fees (const struct TALER_MasterPublicKeyP *master_pub,
- const char *currency,
- const json_t *fees,
- unsigned int *fees_len)
-{
- struct TALER_DONAU_WireFeesByMethod *fbm;
- unsigned int fbml = json_object_size (fees);
- unsigned int i = 0;
- const char *key;
- const json_t *fee_array;
-
- fbm = GNUNET_new_array (fbml,
- struct TALER_DONAU_WireFeesByMethod);
- *fees_len = fbml;
- json_object_foreach ((json_t *) fees, key, fee_array) {
- struct TALER_DONAU_WireFeesByMethod *fe = &fbm[i++];
- unsigned int idx;
- json_t *fee;
-
- fe->method = GNUNET_strdup (key);
- fe->fees_head = NULL;
- json_array_foreach (fee_array, idx, fee)
- {
- struct TALER_DONAU_WireAggregateFees *wa
- = GNUNET_new (struct TALER_DONAU_WireAggregateFees);
- struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_fixed_auto ("sig",
- &wa->master_sig),
- TALER_JSON_spec_amount ("wire_fee",
- currency,
- &wa->fees.wire),
- TALER_JSON_spec_amount ("closing_fee",
- currency,
- &wa->fees.closing),
- GNUNET_JSON_spec_timestamp ("start_date",
- &wa->start_date),
- GNUNET_JSON_spec_timestamp ("end_date",
- &wa->end_date),
- GNUNET_JSON_spec_end ()
- };
-
- wa->next = fe->fees_head;
- fe->fees_head = wa;
- if (GNUNET_OK !=
- GNUNET_JSON_parse (fee,
- spec,
- NULL,
- NULL))
- {
- GNUNET_break_op (0);
- free_fees (fbm,
- i);
- return NULL;
- }
- if (GNUNET_OK !=
- TALER_donau_offline_wire_fee_verify (
- key,
- wa->start_date,
- wa->end_date,
- &wa->fees,
- master_pub,
- &wa->master_sig))
- {
- GNUNET_break_op (0);
- free_fees (fbm,
- i);
- return NULL;
- }
- } /* for all fees over time */
- } /* for all methods */
- GNUNET_assert (i == fbml);
- return fbm;
-}
-
-
-void
-TEAH_get_auditors_for_dc (
- struct TALER_DONAU_Keys *keys,
- TEAH_AuditorCallback ac,
- void *ac_cls)
-{
- if (0 == keys->num_auditors)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "No auditor available. Not submitting deposit
confirmations.\n");
- return;
- }
- for (unsigned int i = 0; i<keys->num_auditors; i++)
- {
- const struct TALER_DONAU_AuditorInformation *auditor
- = &keys->auditors[i];
-
- ac (ac_cls,
- auditor->auditor_url,
- &auditor->auditor_pub);
- }
-}
-
-
#define EXITIF(cond) \
do { \
if (cond) { GNUNET_break (0); goto EXITIF_exit; } \
@@ -270,17 +131,13 @@ TEAH_get_auditors_for_dc (
* Parse a donau's signing key encoded in JSON.
*
* @param[out] sign_key where to return the result
- * @param check_sigs should we check signatures?
* @param sign_key_obj json to parse
- * @param master_key master key to use to verify signature
* @return #GNUNET_OK if all is fine, #GNUNET_SYSERR if the signature is
* invalid or the @a sign_key_obj is malformed.
*/
static enum GNUNET_GenericReturnValue
-parse_json_signkey (struct TALER_DONAU_SigningPublicKey *sign_key,
- bool check_sigs,
- const json_t *sign_key_obj,
- const struct TALER_MasterPublicKeyP *master_key)
+parse_json_signkey (struct TALER_DONAU_SigningPublicKeyAndValidity *sign_key,
+ const json_t *sign_key_obj)
{
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("master_sig",
@@ -407,192 +264,6 @@ EXITIF_exit:
}
-/**
- * Parse a donau's auditor information encoded in JSON.
- *
- * @param[out] auditor where to return the result
- * @param check_sigs should we check signatures
- * @param auditor_obj json to parse
- * @param key_data information about denomination keys
- * @return #GNUNET_OK if all is fine, #GNUNET_SYSERR if the signature is
- * invalid or the json malformed.
- */
-static enum GNUNET_GenericReturnValue
-parse_json_auditor (struct TALER_DONAU_AuditorInformation *auditor,
- bool check_sigs,
- const json_t *auditor_obj,
- const struct TALER_DONAU_Keys *key_data)
-{
- const json_t *keys;
- json_t *key;
- unsigned int off;
- unsigned int pos;
- const char *auditor_url;
- struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_fixed_auto ("auditor_pub",
- &auditor->auditor_pub),
- GNUNET_JSON_spec_string ("auditor_url",
- &auditor_url),
- GNUNET_JSON_spec_array_const ("denomination_keys",
- &keys),
- GNUNET_JSON_spec_end ()
- };
-
- if (GNUNET_OK !=
- GNUNET_JSON_parse (auditor_obj,
- spec,
- NULL, NULL))
- {
- GNUNET_break_op (0);
-#if DEBUG
- json_dumpf (auditor_obj,
- stderr,
- JSON_INDENT (2));
-#endif
- return GNUNET_SYSERR;
- }
- auditor->auditor_url = GNUNET_strdup (auditor_url);
- auditor->denom_keys
- = GNUNET_new_array (json_array_size (keys),
- struct TALER_DONAU_AuditorDenominationInfo);
- pos = 0;
- json_array_foreach (keys, off, key) {
- struct TALER_AuditorSignatureP auditor_sig;
- struct TALER_DenominationHashP denom_h;
- const struct TALER_DONAU_DenomPublicKey *dk = NULL;
- unsigned int dk_off = UINT_MAX;
- struct GNUNET_JSON_Specification kspec[] = {
- GNUNET_JSON_spec_fixed_auto ("auditor_sig",
- &auditor_sig),
- GNUNET_JSON_spec_fixed_auto ("denom_pub_h",
- &denom_h),
- GNUNET_JSON_spec_end ()
- };
-
- if (GNUNET_OK !=
- GNUNET_JSON_parse (key,
- kspec,
- NULL, NULL))
- {
- GNUNET_break_op (0);
- continue;
- }
- for (unsigned int j = 0; j<key_data->num_denom_keys; j++)
- {
- if (0 == GNUNET_memcmp (&denom_h,
- &key_data->denom_keys[j].h_key))
- {
- dk = &key_data->denom_keys[j];
- dk_off = j;
- break;
- }
- }
- if (NULL == dk)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Auditor signed denomination %s, which we do not know.
Ignoring signature.\n",
- GNUNET_h2s (&denom_h.hash));
- continue;
- }
- if (check_sigs)
- {
- if (GNUNET_OK !=
- TALER_auditor_denom_validity_verify (
- auditor_url,
- &dk->h_key,
- &key_data->master_pub,
- dk->valid_from,
- dk->withdraw_valid_until,
- dk->expire_deposit,
- dk->expire_legal,
- &dk->value,
- &dk->fees,
- &auditor->auditor_pub,
- &auditor_sig))
- {
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
- }
- auditor->denom_keys[pos].denom_key_offset = dk_off;
- auditor->denom_keys[pos].auditor_sig = auditor_sig;
- pos++;
- }
- auditor->num_denom_keys = pos;
- return GNUNET_OK;
-}
-
-
-/**
- * Parse a donau's global fee information encoded in JSON.
- *
- * @param[out] gf where to return the result
- * @param check_sigs should we check signatures
- * @param fee_obj json to parse
- * @param key_data already parsed information about the donau
- * @return #GNUNET_OK if all is fine, #GNUNET_SYSERR if the signature is
- * invalid or the json malformed.
- */
-static enum GNUNET_GenericReturnValue
-parse_global_fee (struct TALER_DONAU_GlobalFee *gf,
- bool check_sigs,
- const json_t *fee_obj,
- const struct TALER_DONAU_Keys *key_data)
-{
- struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_timestamp ("start_date",
- &gf->start_date),
- GNUNET_JSON_spec_timestamp ("end_date",
- &gf->end_date),
- GNUNET_JSON_spec_relative_time ("purse_timeout",
- &gf->purse_timeout),
- GNUNET_JSON_spec_relative_time ("history_expiration",
- &gf->history_expiration),
- GNUNET_JSON_spec_uint32 ("purse_account_limit",
- &gf->purse_account_limit),
- TALER_JSON_SPEC_GLOBAL_FEES (key_data->currency,
- &gf->fees),
- GNUNET_JSON_spec_fixed_auto ("master_sig",
- &gf->master_sig),
- GNUNET_JSON_spec_end ()
- };
-
- if (GNUNET_OK !=
- GNUNET_JSON_parse (fee_obj,
- spec,
- NULL, NULL))
- {
- GNUNET_break_op (0);
-#if DEBUG
- json_dumpf (fee_obj,
- stderr,
- JSON_INDENT (2));
-#endif
- return GNUNET_SYSERR;
- }
- if (check_sigs)
- {
- if (GNUNET_OK !=
- TALER_donau_offline_global_fee_verify (
- gf->start_date,
- gf->end_date,
- &gf->fees,
- gf->purse_timeout,
- gf->history_expiration,
- gf->purse_account_limit,
- &key_data->master_pub,
- &gf->master_sig))
- {
- GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
- return GNUNET_SYSERR;
- }
- }
- GNUNET_JSON_parse_free (spec);
- return GNUNET_OK;
-}
-
-
/**
* Compare two denomination keys. Ignores revocation data.
*
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-donau] branch master updated: [lib] some deletions,
gnunet <=