[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-donau] branch master updated: [donau][header] uncomment header an
From: |
gnunet |
Subject: |
[taler-donau] branch master updated: [donau][header] uncomment header and work on httpd keys |
Date: |
Tue, 12 Dec 2023 01:22:10 +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 31c1e5f [donau][header] uncomment header and work on httpd keys
31c1e5f is described below
commit 31c1e5f2189bd8cdbe90adfe7df6fbea58fabceb
Author: Matyja Lukas Adam <lukas.matyja@students.bfh.ch>
AuthorDate: Tue Dec 12 01:22:21 2023 +0100
[donau][header] uncomment header and work on httpd keys
---
src/donau/donau-httpd.c | 16 +-
src/donau/donau-httpd.h | 10 +-
src/donau/donau-httpd_batch-issue_receipts.c | 12 +-
src/donau/donau-httpd_batch-issue_receipts.h | 2 +-
src/donau/donau-httpd_batch-submit_receipts.c | 2 +-
src/donau/donau-httpd_batch-submit_receipts.h | 2 +-
src/donau/donau-httpd_charities_close.c | 2 +-
src/donau/donau-httpd_charities_close.h | 2 +-
src/donau/donau-httpd_charities_get.c | 8 +-
src/donau/donau-httpd_charities_get.h | 2 +-
src/donau/donau-httpd_charities_history.c | 2 +-
src/donau/donau-httpd_charities_history.h | 2 +-
src/donau/donau-httpd_charities_open.c | 2 +-
src/donau/donau-httpd_charities_open.h | 2 +-
src/donau/donau-httpd_charities_status.c | 2 +-
src/donau/donau-httpd_charities_status.h | 2 +-
src/donau/donau-httpd_config.c | 2 +-
src/donau/donau-httpd_config.h | 2 +-
src/donau/donau-httpd_csr.c | 4 +-
src/donau/donau-httpd_csr.h | 4 +-
src/donau/donau-httpd_issue_receipts.c | 4 +-
src/donau/donau-httpd_issue_receipts.h | 2 +-
src/donau/donau-httpd_keys.c | 633 +-------------------------
src/donau/donau-httpd_keys.h | 303 ++++++------
src/donau/donau-httpd_metrics.c | 2 +-
src/donau/donau-httpd_metrics.h | 2 +-
src/donau/donau-httpd_mhd.c | 4 +-
src/donau/donau-httpd_mhd.h | 4 +-
src/donau/donau-httpd_submit_receipts_get.c | 6 +-
src/donau/donau-httpd_submit_receipts_get.h | 2 +-
src/donau/donau-httpd_terms.c | 4 +-
src/donau/donau-httpd_terms.h | 4 +-
src/include/donau_crypto_lib.h | 17 +-
src/include/donau_service.h | 208 ++++-----
src/include/donaudb_plugin.h | 2 +-
35 files changed, 307 insertions(+), 972 deletions(-)
diff --git a/src/donau/donau-httpd.c b/src/donau/donau-httpd.c
index 3e5e7cc..c52af24 100644
--- a/src/donau/donau-httpd.c
+++ b/src/donau/donau-httpd.c
@@ -276,7 +276,7 @@ handle_mhd_completion_callback (void *cls,
void **con_cls,
enum MHD_RequestTerminationCode toe)
{
- struct TEH_RequestContext *rc = *con_cls;
+ struct TDH_RequestContext *rc = *con_cls;
struct GNUNET_AsyncScopeSave old_scope;
(void) cls;
@@ -346,7 +346,7 @@ handle_mhd_completion_callback (void *cls,
* @return MHD result code
*/
static MHD_RESULT
-proceed_with_handler (struct TEH_RequestContext *rc,
+proceed_with_handler (struct TDH_RequestContext *rc,
const char *url,
const char *upload_data,
size_t *upload_data_size)
@@ -466,7 +466,7 @@ proceed_with_handler (struct TEH_RequestContext *rc,
* @return MHD result code
*/
static MHD_RESULT
-handler_seed (struct TEH_RequestContext *rc,
+handler_seed (struct TDH_RequestContext *rc,
const char *const args[])
{
#define SEED_SIZE 32
@@ -505,7 +505,7 @@ handler_seed (struct TEH_RequestContext *rc,
* @param version HTTP version (ignored)
* @param upload_data request data
* @param upload_data_size size of @a upload_data in bytes
- * @param con_cls closure for request (a `struct TEH_RequestContext *`)
+ * @param con_cls closure for request (a `struct TDH_RequestContext *`)
* @return MHD result code
*/
static MHD_RESULT
@@ -596,7 +596,7 @@ handle_mhd_request (void *cls,
.url = NULL
}
};
- struct TEH_RequestContext *rc = *con_cls;
+ struct TDH_RequestContext *rc = *con_cls;
struct GNUNET_AsyncScopeSave old_scope;
const char *correlation_id = NULL;
@@ -608,7 +608,7 @@ handle_mhd_request (void *cls,
"Handling new request\n");
/* We're in a new async scope! */
- rc = *con_cls = GNUNET_new (struct TEH_RequestContext);
+ rc = *con_cls = GNUNET_new (struct TDH_RequestContext);
rc->start_time = GNUNET_TIME_absolute_get ();
GNUNET_async_scope_fresh (&rc->async_scope_id);
//TEH_check_invariants ();
@@ -1480,11 +1480,9 @@ main (int argc,
GNUNET_GETOPT_OPTION_END
};
enum GNUNET_GenericReturnValue ret;
- (void)options[0]; // delete me
- ret = 1; // delete me
DONAU_OS_init ();
ret = GNUNET_PROGRAM_run (argc, argv,
- "taler-donau-httpd",
+ "donau-httpd",
"Taler donau HTTP service",
options,
&run, NULL);
diff --git a/src/donau/donau-httpd.h b/src/donau/donau-httpd.h
index 5a6dd6d..972453f 100644
--- a/src/donau/donau-httpd.h
+++ b/src/donau/donau-httpd.h
@@ -165,7 +165,7 @@ struct TEH_RequestHandler;
* @brief Context in which the donau is processing
* all requests
*/
-struct TEH_RequestContext
+struct TDH_RequestContext
{
/**
@@ -204,7 +204,7 @@ struct TEH_RequestContext
* clean up @a rh_ctx. Can be NULL.
*/
void
- (*rh_cleaner)(struct TEH_RequestContext *rc);
+ (*rh_cleaner)(struct TDH_RequestContext *rc);
/**
* @e rh-specific context. Place where the request
@@ -246,7 +246,7 @@ struct TEH_RequestHandler
* @return MHD result code
*/
MHD_RESULT
- (*get)(struct TEH_RequestContext *rc,
+ (*get)(struct TDH_RequestContext *rc,
const char *const args[]);
@@ -259,7 +259,7 @@ struct TEH_RequestHandler
* @return MHD result code
*/
MHD_RESULT
- (*post)(struct TEH_RequestContext *rc,
+ (*post)(struct TDH_RequestContext *rc,
const json_t *root,
const char *const args[]);
@@ -271,7 +271,7 @@ struct TEH_RequestHandler
* @return MHD result code
*/
MHD_RESULT
- (*delete)(struct TEH_RequestContext *rc,
+ (*delete)(struct TDH_RequestContext *rc,
const char *const args[]);
} handler;
diff --git a/src/donau/donau-httpd_batch-issue_receipts.c
b/src/donau/donau-httpd_batch-issue_receipts.c
index f8173dc..284ad54 100644
--- a/src/donau/donau-httpd_batch-issue_receipts.c
+++ b/src/donau/donau-httpd_batch-issue_receipts.c
@@ -82,7 +82,7 @@ struct BatchWithdrawContext
/**
* request context
*/
- const struct TEH_RequestContext *rc;
+ const struct TDH_RequestContext *rc;
/**
* KYC status of the reserve used for the operation.
@@ -198,7 +198,7 @@ aml_amount_cb (
* @return MHD queue status
*/
static MHD_RESULT
-generate_reply_success (const struct TEH_RequestContext *rc,
+generate_reply_success (const struct TDH_RequestContext *rc,
const struct BatchWithdrawContext *wc)
{
json_t *sigs;
@@ -252,7 +252,7 @@ static bool
check_request_idempotent (const struct BatchWithdrawContext *wc,
MHD_RESULT *mret)
{
- const struct TEH_RequestContext *rc = wc->rc;
+ const struct TDH_RequestContext *rc = wc->rc;
for (unsigned int i = 0; i<wc->planchets_length; i++)
{
@@ -606,7 +606,7 @@ batch_withdraw_transaction (void *cls,
* @return MHD result for the @a rc
*/
static MHD_RESULT
-prepare_transaction (const struct TEH_RequestContext *rc,
+prepare_transaction (const struct TDH_RequestContext *rc,
struct BatchWithdrawContext *wc)
{
struct TEH_CoinSignData csds[wc->planchets_length];
@@ -673,7 +673,7 @@ prepare_transaction (const struct TEH_RequestContext *rc,
* @return MHD result for the @a rc
*/
static MHD_RESULT
-parse_planchets (const struct TEH_RequestContext *rc,
+parse_planchets (const struct TDH_RequestContext *rc,
struct BatchWithdrawContext *wc,
const json_t *planchets)
{
@@ -859,7 +859,7 @@ parse_planchets (const struct TEH_RequestContext *rc,
MHD_RESULT
-TEH_handler_batch_withdraw (struct TEH_RequestContext *rc,
+TEH_handler_batch_withdraw (struct TDH_RequestContext *rc,
const struct TALER_ReservePublicKeyP *reserve_pub,
const json_t *root)
{
diff --git a/src/donau/donau-httpd_batch-issue_receipts.h
b/src/donau/donau-httpd_batch-issue_receipts.h
index 4821804..0cd5425 100644
--- a/src/donau/donau-httpd_batch-issue_receipts.h
+++ b/src/donau/donau-httpd_batch-issue_receipts.h
@@ -41,7 +41,7 @@
* @return MHD result code
*/
MHD_RESULT
-TEH_handler_batch_withdraw (struct TEH_RequestContext *rc,
+TEH_handler_batch_withdraw (struct TDH_RequestContext *rc,
const struct TALER_ReservePublicKeyP *reserve_pub,
const json_t *root);
diff --git a/src/donau/donau-httpd_batch-submit_receipts.c
b/src/donau/donau-httpd_batch-submit_receipts.c
index e062833..bdbd5d3 100644
--- a/src/donau/donau-httpd_batch-submit_receipts.c
+++ b/src/donau/donau-httpd_batch-submit_receipts.c
@@ -495,7 +495,7 @@ parse_coin (struct MHD_Connection *connection,
MHD_RESULT
-TEH_handler_batch_deposit (struct TEH_RequestContext *rc,
+TEH_handler_batch_deposit (struct TDH_RequestContext *rc,
const json_t *root,
const char *const args[])
{
diff --git a/src/donau/donau-httpd_batch-submit_receipts.h
b/src/donau/donau-httpd_batch-submit_receipts.h
index 8ad517f..c9ddbb4 100644
--- a/src/donau/donau-httpd_batch-submit_receipts.h
+++ b/src/donau/donau-httpd_batch-submit_receipts.h
@@ -41,7 +41,7 @@
* @return MHD result code
*/
MHD_RESULT
-TEH_handler_batch_deposit (struct TEH_RequestContext *rc,
+TEH_handler_batch_deposit (struct TDH_RequestContext *rc,
const json_t *root,
const char *const args[]);
diff --git a/src/donau/donau-httpd_charities_close.c
b/src/donau/donau-httpd_charities_close.c
index 8c78298..279a329 100644
--- a/src/donau/donau-httpd_charities_close.c
+++ b/src/donau/donau-httpd_charities_close.c
@@ -354,7 +354,7 @@ reserve_close_transaction (void *cls,
MHD_RESULT
-TEH_handler_reserves_close (struct TEH_RequestContext *rc,
+TEH_handler_reserves_close (struct TDH_RequestContext *rc,
const struct TALER_ReservePublicKeyP *reserve_pub,
const json_t *root)
{
diff --git a/src/donau/donau-httpd_charities_close.h
b/src/donau/donau-httpd_charities_close.h
index 704f3c4..f45eed9 100644
--- a/src/donau/donau-httpd_charities_close.h
+++ b/src/donau/donau-httpd_charities_close.h
@@ -34,7 +34,7 @@
* @return MHD result code
*/
MHD_RESULT
-TEH_handler_reserves_close (struct TEH_RequestContext *rc,
+TEH_handler_reserves_close (struct TDH_RequestContext *rc,
const struct TALER_ReservePublicKeyP *reserve_pub,
const json_t *root);
diff --git a/src/donau/donau-httpd_charities_get.c
b/src/donau/donau-httpd_charities_get.c
index bcb15be..3b838b2 100644
--- a/src/donau/donau-httpd_charities_get.c
+++ b/src/donau/donau-httpd_charities_get.c
@@ -54,7 +54,7 @@ struct ReservePoller
/**
* Our request context.
*/
- struct TEH_RequestContext *rc;
+ struct TDH_RequestContext *rc;
/**
* Subscription for the database event we are waiting for.
@@ -118,7 +118,7 @@ TEH_reserves_get_cleanup ()
* @param rc context to clean up for
*/
static void
-rp_cleanup (struct TEH_RequestContext *rc)
+rp_cleanup (struct TDH_RequestContext *rc)
{
struct ReservePoller *rp = rc->rh_ctx;
@@ -142,7 +142,7 @@ rp_cleanup (struct TEH_RequestContext *rc)
* Function called on events received from Postgres.
* Wakes up long pollers.
*
- * @param cls the `struct TEH_RequestContext *`
+ * @param cls the `struct TDH_RequestContext *`
* @param extra additional event data provided
* @param extra_size number of bytes in @a extra
*/
@@ -170,7 +170,7 @@ db_event_cb (void *cls,
MHD_RESULT
-TEH_handler_reserves_get (struct TEH_RequestContext *rc,
+TEH_handler_reserves_get (struct TDH_RequestContext *rc,
const char *const args[1])
{
struct ReservePoller *rp = rc->rh_ctx;
diff --git a/src/donau/donau-httpd_charities_get.h
b/src/donau/donau-httpd_charities_get.h
index 4b5f273..4d961c7 100644
--- a/src/donau/donau-httpd_charities_get.h
+++ b/src/donau/donau-httpd_charities_get.h
@@ -47,7 +47,7 @@ TEH_reserves_get_cleanup (void);
* @return MHD result code
*/
MHD_RESULT
-TEH_handler_reserves_get (struct TEH_RequestContext *rc,
+TEH_handler_reserves_get (struct TDH_RequestContext *rc,
const char *const args[1]);
#endif
diff --git a/src/donau/donau-httpd_charities_history.c
b/src/donau/donau-httpd_charities_history.c
index 64d4f4b..60b2ebf 100644
--- a/src/donau/donau-httpd_charities_history.c
+++ b/src/donau/donau-httpd_charities_history.c
@@ -186,7 +186,7 @@ reserve_history_transaction (void *cls,
MHD_RESULT
-TEH_handler_reserves_history (struct TEH_RequestContext *rc,
+TEH_handler_reserves_history (struct TDH_RequestContext *rc,
const struct TALER_ReservePublicKeyP
*reserve_pub,
const json_t *root)
{
diff --git a/src/donau/donau-httpd_charities_history.h
b/src/donau/donau-httpd_charities_history.h
index 0b75937..d099e79 100644
--- a/src/donau/donau-httpd_charities_history.h
+++ b/src/donau/donau-httpd_charities_history.h
@@ -35,7 +35,7 @@
* @return MHD result code
*/
MHD_RESULT
-TEH_handler_reserves_history (struct TEH_RequestContext *rc,
+TEH_handler_reserves_history (struct TDH_RequestContext *rc,
const struct TALER_ReservePublicKeyP
*reserve_pub,
const json_t *root);
diff --git a/src/donau/donau-httpd_charities_open.c
b/src/donau/donau-httpd_charities_open.c
index c4e7d02..55d5672 100644
--- a/src/donau/donau-httpd_charities_open.c
+++ b/src/donau/donau-httpd_charities_open.c
@@ -298,7 +298,7 @@ reserve_open_transaction (void *cls,
MHD_RESULT
-TEH_handler_reserves_open (struct TEH_RequestContext *rc,
+TEH_handler_reserves_open (struct TDH_RequestContext *rc,
const struct TALER_ReservePublicKeyP *reserve_pub,
const json_t *root)
{
diff --git a/src/donau/donau-httpd_charities_open.h
b/src/donau/donau-httpd_charities_open.h
index b6dcb95..91a13c3 100644
--- a/src/donau/donau-httpd_charities_open.h
+++ b/src/donau/donau-httpd_charities_open.h
@@ -34,7 +34,7 @@
* @return MHD result code
*/
MHD_RESULT
-TEH_handler_reserves_open (struct TEH_RequestContext *rc,
+TEH_handler_reserves_open (struct TDH_RequestContext *rc,
const struct TALER_ReservePublicKeyP *reserve_pub,
const json_t *root);
diff --git a/src/donau/donau-httpd_charities_status.c
b/src/donau/donau-httpd_charities_status.c
index 650cac7..81c9b05 100644
--- a/src/donau/donau-httpd_charities_status.c
+++ b/src/donau/donau-httpd_charities_status.c
@@ -157,7 +157,7 @@ reserve_status_transaction (void *cls,
MHD_RESULT
-TEH_handler_reserves_status (struct TEH_RequestContext *rc,
+TEH_handler_reserves_status (struct TDH_RequestContext *rc,
const struct TALER_ReservePublicKeyP *reserve_pub,
const json_t *root)
{
diff --git a/src/donau/donau-httpd_charities_status.h
b/src/donau/donau-httpd_charities_status.h
index e1c5f61..9a8ab80 100644
--- a/src/donau/donau-httpd_charities_status.h
+++ b/src/donau/donau-httpd_charities_status.h
@@ -36,7 +36,7 @@
* @return MHD result code
*/
MHD_RESULT
-TEH_handler_reserves_status (struct TEH_RequestContext *rc,
+TEH_handler_reserves_status (struct TDH_RequestContext *rc,
const struct TALER_ReservePublicKeyP *reserve_pub,
const json_t *root);
diff --git a/src/donau/donau-httpd_config.c b/src/donau/donau-httpd_config.c
index 1b89768..4e7cb2c 100644
--- a/src/donau/donau-httpd_config.c
+++ b/src/donau/donau-httpd_config.c
@@ -29,7 +29,7 @@
MHD_RESULT
-TEH_handler_config (struct TEH_RequestContext *rc,
+TEH_handler_config (struct TDH_RequestContext *rc,
const char *const args[])
{
static struct MHD_Response *resp;
diff --git a/src/donau/donau-httpd_config.h b/src/donau/donau-httpd_config.h
index e9480bf..6f65d83 100644
--- a/src/donau/donau-httpd_config.h
+++ b/src/donau/donau-httpd_config.h
@@ -52,7 +52,7 @@
* @return MHD result code
*/
MHD_RESULT
-TEH_handler_config (struct TEH_RequestContext *rc,
+TEH_handler_config (struct TDH_RequestContext *rc,
const char *const args[]);
#endif
diff --git a/src/donau/donau-httpd_csr.c b/src/donau/donau-httpd_csr.c
index 915a972..1e47b2a 100644
--- a/src/donau/donau-httpd_csr.c
+++ b/src/donau/donau-httpd_csr.c
@@ -33,7 +33,7 @@
MHD_RESULT
-TEH_handler_csr_melt (struct TEH_RequestContext *rc,
+TEH_handler_csr_melt (struct TDH_RequestContext *rc,
const json_t *root,
const char *const args[])
{
@@ -222,7 +222,7 @@ TEH_handler_csr_melt (struct TEH_RequestContext *rc,
MHD_RESULT
-TEH_handler_csr_withdraw (struct TEH_RequestContext *rc,
+TEH_handler_csr_withdraw (struct TDH_RequestContext *rc,
const json_t *root,
const char *const args[])
{
diff --git a/src/donau/donau-httpd_csr.h b/src/donau/donau-httpd_csr.h
index 1a977d2..69d71d1 100644
--- a/src/donau/donau-httpd_csr.h
+++ b/src/donau/donau-httpd_csr.h
@@ -35,7 +35,7 @@
* @return MHD result code
*/
MHD_RESULT
-TEH_handler_csr_melt (struct TEH_RequestContext *rc,
+TEH_handler_csr_melt (struct TDH_RequestContext *rc,
const json_t *root,
const char *const args[]);
@@ -49,7 +49,7 @@ TEH_handler_csr_melt (struct TEH_RequestContext *rc,
* @return MHD result code
*/
MHD_RESULT
-TEH_handler_csr_withdraw (struct TEH_RequestContext *rc,
+TEH_handler_csr_withdraw (struct TDH_RequestContext *rc,
const json_t *root,
const char *const args[]);
diff --git a/src/donau/donau-httpd_issue_receipts.c
b/src/donau/donau-httpd_issue_receipts.c
index ef10bfc..6e3454f 100644
--- a/src/donau/donau-httpd_issue_receipts.c
+++ b/src/donau/donau-httpd_issue_receipts.c
@@ -425,7 +425,7 @@ withdraw_transaction (void *cls,
* false if we did not find the request in the DB and did not set @a mret
*/
static bool
-check_request_idempotent (struct TEH_RequestContext *rc,
+check_request_idempotent (struct TDH_RequestContext *rc,
struct WithdrawContext *wc,
MHD_RESULT *mret)
{
@@ -459,7 +459,7 @@ check_request_idempotent (struct TEH_RequestContext *rc,
MHD_RESULT
-TEH_handler_withdraw (struct TEH_RequestContext *rc,
+TEH_handler_withdraw (struct TDH_RequestContext *rc,
const struct TALER_ReservePublicKeyP *reserve_pub,
const json_t *root)
{
diff --git a/src/donau/donau-httpd_issue_receipts.h
b/src/donau/donau-httpd_issue_receipts.h
index 993b0ad..0895084 100644
--- a/src/donau/donau-httpd_issue_receipts.h
+++ b/src/donau/donau-httpd_issue_receipts.h
@@ -40,7 +40,7 @@
* @return MHD result code
*/
MHD_RESULT
-TEH_handler_withdraw (struct TEH_RequestContext *rc,
+TEH_handler_withdraw (struct TDH_RequestContext *rc,
const struct TALER_ReservePublicKeyP *reserve_pub,
const json_t *root);
diff --git a/src/donau/donau-httpd_keys.c b/src/donau/donau-httpd_keys.c
index 8050278..12473de 100644
--- a/src/donau/donau-httpd_keys.c
+++ b/src/donau/donau-httpd_keys.c
@@ -14,7 +14,7 @@
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
/**
- * @file taler-donau-httpd_keys.c
+ * @file donau-httpd_keys.c
* @brief management of our various keys
* @author Christian Grothoff
* @author Özgür Kesim
@@ -389,116 +389,6 @@ struct SuspendedKeysRequests
};
-/**
- * Information we track about wire fees.
- */
-struct WireFeeSet
-{
-
- /**
- * Kept in a DLL.
- */
- struct WireFeeSet *next;
-
- /**
- * Kept in a DLL.
- */
- struct WireFeeSet *prev;
-
- /**
- * Actual fees.
- */
- struct TALER_WireFeeSet fees;
-
- /**
- * Start date of fee validity (inclusive).
- */
- struct GNUNET_TIME_Timestamp start_date;
-
- /**
- * End date of fee validity (exclusive).
- */
- struct GNUNET_TIME_Timestamp end_date;
-
- /**
- * Wire method the fees apply to.
- */
- char *method;
-};
-
-
-/**
- * State we keep per thread to cache the /wire response.
- */
-struct WireStateHandle
-{
- /**
- * Cached reply for /wire response.
- */
- struct MHD_Response *wire_reply;
-
- /**
- * JSON reply for /wire response.
- */
- json_t *json_reply;
-
- /**
- * ETag for this response (if any).
- */
- char *etag;
-
- /**
- * head of DLL of wire fees.
- */
- struct WireFeeSet *wfs_head;
-
- /**
- * Tail of DLL of wire fees.
- */
- struct WireFeeSet *wfs_tail;
-
- /**
- * Earliest timestamp of all the wire methods when we have no more fees.
- */
- struct GNUNET_TIME_Absolute cache_expiration;
-
- /**
- * @e cache_expiration time, formatted.
- */
- char dat[128];
-
- /**
- * For which (global) wire_generation was this data structure created?
- * Used to check when we are outdated and need to be re-generated.
- */
- uint64_t wire_generation;
-
- /**
- * HTTP status to return with this response.
- */
- unsigned int http_status;
-
-};
-
-
-/**
- * Stores the latest generation of our wire response.
- */
-static struct WireStateHandle *wire_state;
-
-/**
- * Handler listening for wire updates by other donau
- * services.
- */
-static struct GNUNET_DB_EventHandler *wire_eh;
-
-/**
- * Counter incremented whenever we have a reason to re-build the #wire_state
- * because something external changed.
- */
-static uint64_t wire_generation;
-
-
/**
* Stores the latest generation of our key state.
*/
@@ -511,12 +401,6 @@ static struct TEH_KeyStateHandle *key_state;
*/
static uint64_t key_generation;
-/**
- * Handler listening for wire updates by other donau
- * services.
- */
-static struct GNUNET_DB_EventHandler *keys_eh;
-
/**
* Head of DLL of suspended /keys requests.
*/
@@ -576,515 +460,6 @@ static struct TALER_SecurityModulePublicKeyP esign_sm_pub;
static bool terminating;
-/**
- * Free memory associated with @a wsh
- *
- * @param[in] wsh wire state to destroy
- */
-static void
-destroy_wire_state (struct WireStateHandle *wsh)
-{
- struct WireFeeSet *wfs;
-
- while (NULL != (wfs = wsh->wfs_head))
- {
- GNUNET_CONTAINER_DLL_remove (wsh->wfs_head,
- wsh->wfs_tail,
- wfs);
- GNUNET_free (wfs->method);
- GNUNET_free (wfs);
- }
- MHD_destroy_response (wsh->wire_reply);
- json_decref (wsh->json_reply);
- GNUNET_free (wsh->etag);
- GNUNET_free (wsh);
-}
-
-
-/**
- * Function called whenever another donau process has updated
- * the wire data in the database.
- *
- * @param cls NULL
- * @param extra unused
- * @param extra_size number of bytes in @a extra unused
- */
-static void
-wire_update_event_cb (void *cls,
- const void *extra,
- size_t extra_size)
-{
- (void) cls;
- (void) extra;
- (void) extra_size;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Received /wire update event\n");
- TEH_check_invariants ();
- wire_generation++;
- key_generation++;
- TEH_resume_keys_requests (false);
-}
-
-
-enum GNUNET_GenericReturnValue
-TEH_wire_init ()
-{
- struct GNUNET_DB_EventHeaderP es = {
- .size = htons (sizeof (es)),
- .type = htons (TALER_DBEVENT_DONAU_KEYS_UPDATED),
- };
-
- wire_eh = TEH_plugin->event_listen (TEH_plugin->cls,
- GNUNET_TIME_UNIT_FOREVER_REL,
- &es,
- &wire_update_event_cb,
- NULL);
- if (NULL == wire_eh)
- {
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
- return GNUNET_OK;
-}
-
-
-void
-TEH_wire_done ()
-{
- if (NULL != wire_state)
- {
- destroy_wire_state (wire_state);
- wire_state = NULL;
- }
- if (NULL != wire_eh)
- {
- TEH_plugin->event_listen_cancel (TEH_plugin->cls,
- wire_eh);
- wire_eh = NULL;
- }
-}
-
-
-/**
- * Add information about a wire account to @a cls.
- *
- * @param cls a `json_t *` object to expand with wire account details
- * @param payto_uri the donau bank account URI to add
- * @param conversion_url URL of a conversion service, NULL if there is no
conversion
- * @param debit_restrictions JSON array with debit restrictions on the account
- * @param credit_restrictions JSON array with credit restrictions on the
account
- * @param master_sig master key signature affirming that this is a bank
- * account of the donau (of purpose
#TALER_SIGNATURE_MASTER_WIRE_DETAILS)
- */
-static void
-add_wire_account (void *cls,
- const char *payto_uri,
- const char *conversion_url,
- const json_t *debit_restrictions,
- const json_t *credit_restrictions,
- const struct TALER_MasterSignatureP *master_sig)
-{
- json_t *a = cls;
-
- if (GNUNET_OK !=
- TALER_donau_wire_signature_check (
- payto_uri,
- conversion_url,
- debit_restrictions,
- credit_restrictions,
- &TEH_master_public_key,
- master_sig))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Database has wire account with invalid signature. Skipping
entry. Did the donau offline public key change?\n");
- return;
- }
- if (0 !=
- json_array_append_new (
- a,
- GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("payto_uri",
- payto_uri),
- GNUNET_JSON_pack_allow_null (
- GNUNET_JSON_pack_string ("conversion_url",
- conversion_url)),
- GNUNET_JSON_pack_array_incref ("debit_restrictions",
- (json_t *) debit_restrictions),
- GNUNET_JSON_pack_array_incref ("credit_restrictions",
- (json_t *) credit_restrictions),
- GNUNET_JSON_pack_data_auto ("master_sig",
- master_sig))))
- {
- GNUNET_break (0); /* out of memory!? */
- return;
- }
-}
-
-
-/**
- * Closure for #add_wire_fee().
- */
-struct AddContext
-{
- /**
- * Wire method the fees are for.
- */
- char *wire_method;
-
- /**
- * Wire state we are building.
- */
- struct WireStateHandle *wsh;
-
- /**
- * Array to append the fee to.
- */
- json_t *a;
-
- /**
- * Context we hash "everything" we add into. This is used
- * to compute the etag. Technically, we only hash the
- * master_sigs, as they imply the rest.
- */
- struct GNUNET_HashContext *hc;
-
- /**
- * Set to the maximum end-date seen.
- */
- struct GNUNET_TIME_Absolute max_seen;
-};
-
-
-/**
- * Add information about a wire account to @a cls.
- *
- * @param cls a `struct AddContext`
- * @param fees the wire fees we charge
- * @param start_date from when are these fees valid (start date)
- * @param end_date until when are these fees valid (end date, exclusive)
- * @param master_sig master key signature affirming that this is the correct
- * fee (of purpose #TALER_SIGNATURE_MASTER_WIRE_FEES)
- */
-static void
-add_wire_fee (void *cls,
- const struct TALER_WireFeeSet *fees,
- struct GNUNET_TIME_Timestamp start_date,
- struct GNUNET_TIME_Timestamp end_date,
- const struct TALER_MasterSignatureP *master_sig)
-{
- struct AddContext *ac = cls;
- struct WireFeeSet *wfs;
-
- if (GNUNET_OK !=
- TALER_donau_offline_wire_fee_verify (
- ac->wire_method,
- start_date,
- end_date,
- fees,
- &TEH_master_public_key,
- master_sig))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Database has wire fee with invalid signature. Skipping entry.
Did the donau offline public key change?\n");
- return;
- }
- GNUNET_CRYPTO_hash_context_read (ac->hc,
- master_sig,
- sizeof (*master_sig));
- ac->max_seen = GNUNET_TIME_absolute_max (ac->max_seen,
- end_date.abs_time);
- wfs = GNUNET_new (struct WireFeeSet);
- wfs->start_date = start_date;
- wfs->end_date = end_date;
- wfs->fees = *fees;
- wfs->method = GNUNET_strdup (ac->wire_method);
- GNUNET_CONTAINER_DLL_insert (ac->wsh->wfs_head,
- ac->wsh->wfs_tail,
- wfs);
- if (0 !=
- json_array_append_new (
- ac->a,
- GNUNET_JSON_PACK (
- TALER_JSON_pack_amount ("wire_fee",
- &fees->wire),
- TALER_JSON_pack_amount ("closing_fee",
- &fees->closing),
- GNUNET_JSON_pack_timestamp ("start_date",
- start_date),
- GNUNET_JSON_pack_timestamp ("end_date",
- end_date),
- GNUNET_JSON_pack_data_auto ("sig",
- master_sig))))
- {
- GNUNET_break (0); /* out of memory!? */
- return;
- }
-}
-
-
-/**
- * Create the /wire response from our database state.
- *
- * @return NULL on error
- */
-static struct WireStateHandle *
-build_wire_state (void)
-{
- json_t *wire_accounts_array;
- json_t *wire_fee_object;
- uint64_t wg = wire_generation; /* must be obtained FIRST */
- enum GNUNET_DB_QueryStatus qs;
- struct WireStateHandle *wsh;
- struct GNUNET_HashContext *hc;
- json_t *wads;
-
- wsh = GNUNET_new (struct WireStateHandle);
- wsh->wire_generation = wg;
- wire_accounts_array = json_array ();
- GNUNET_assert (NULL != wire_accounts_array);
- qs = TEH_plugin->get_wire_accounts (TEH_plugin->cls,
- &add_wire_account,
- wire_accounts_array);
- if (0 > qs)
- {
- GNUNET_break (0);
- json_decref (wire_accounts_array);
- wsh->http_status = MHD_HTTP_INTERNAL_SERVER_ERROR;
- wsh->wire_reply
- = TALER_MHD_make_error (TALER_EC_GENERIC_DB_FETCH_FAILED,
- "get_wire_accounts");
- return wsh;
- }
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Build /wire data with %u accounts\n",
- (unsigned int) json_array_size (wire_accounts_array));
- wire_fee_object = json_object ();
- GNUNET_assert (NULL != wire_fee_object);
- wsh->cache_expiration = GNUNET_TIME_UNIT_FOREVER_ABS;
- hc = GNUNET_CRYPTO_hash_context_start ();
- {
- json_t *account;
- size_t index;
-
- json_array_foreach (wire_accounts_array, index, account) {
- char *wire_method;
- const char *payto_uri = json_string_value (json_object_get (account,
-
"payto_uri"));
-
- GNUNET_assert (NULL != payto_uri);
- wire_method = TALER_payto_get_method (payto_uri);
- if (NULL == wire_method)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "No wire method in `%s'\n",
- payto_uri);
- wsh->http_status = MHD_HTTP_INTERNAL_SERVER_ERROR;
- wsh->wire_reply
- = TALER_MHD_make_error (
- TALER_EC_DONAU_WIRE_INVALID_PAYTO_CONFIGURED,
- payto_uri);
- json_decref (wire_accounts_array);
- json_decref (wire_fee_object);
- GNUNET_CRYPTO_hash_context_abort (hc);
- return wsh;
- }
- if (NULL == json_object_get (wire_fee_object,
- wire_method))
- {
- struct AddContext ac = {
- .wire_method = wire_method,
- .wsh = wsh,
- .a = json_array (),
- .hc = hc
- };
-
- GNUNET_assert (NULL != ac.a);
- qs = TEH_plugin->get_wire_fees (TEH_plugin->cls,
- wire_method,
- &add_wire_fee,
- &ac);
- if (0 > qs)
- {
- GNUNET_break (0);
- json_decref (ac.a);
- json_decref (wire_fee_object);
- json_decref (wire_accounts_array);
- GNUNET_free (wire_method);
- wsh->http_status = MHD_HTTP_INTERNAL_SERVER_ERROR;
- wsh->wire_reply
- = TALER_MHD_make_error (TALER_EC_GENERIC_DB_FETCH_FAILED,
- "get_wire_fees");
- GNUNET_CRYPTO_hash_context_abort (hc);
- return wsh;
- }
- if (0 != json_array_size (ac.a))
- {
- wsh->cache_expiration
- = GNUNET_TIME_absolute_min (ac.max_seen,
- wsh->cache_expiration);
- GNUNET_assert (0 ==
- json_object_set_new (wire_fee_object,
- wire_method,
- ac.a));
- }
- else
- {
- json_decref (ac.a);
- }
- }
- GNUNET_free (wire_method);
- }
- }
-
- wads = json_array (); /* #7271 */
- GNUNET_assert (NULL != wads);
- wsh->json_reply = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_array_incref ("accounts",
- wire_accounts_array),
- GNUNET_JSON_pack_array_incref ("wads",
- wads),
- GNUNET_JSON_pack_object_incref ("fees",
- wire_fee_object));
- wsh->wire_reply = TALER_MHD_MAKE_JSON_PACK (
- GNUNET_JSON_pack_array_steal ("accounts",
- wire_accounts_array),
- GNUNET_JSON_pack_array_steal ("wads",
- wads),
- GNUNET_JSON_pack_object_steal ("fees",
- wire_fee_object),
- GNUNET_JSON_pack_data_auto ("master_public_key",
- &TEH_master_public_key));
- {
- struct GNUNET_TIME_Timestamp m;
-
- m = GNUNET_TIME_absolute_to_timestamp (wsh->cache_expiration);
- TALER_MHD_get_date_string (m.abs_time,
- wsh->dat);
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Setting 'Expires' header for '/wire' to '%s'\n",
- wsh->dat);
- GNUNET_break (MHD_YES ==
- MHD_add_response_header (wsh->wire_reply,
- MHD_HTTP_HEADER_EXPIRES,
- wsh->dat));
- }
- /* Set cache control headers: our response varies depending on these headers
*/
- GNUNET_break (MHD_YES ==
- MHD_add_response_header (wsh->wire_reply,
- MHD_HTTP_HEADER_VARY,
- MHD_HTTP_HEADER_ACCEPT_ENCODING));
- /* Information is always public, revalidate after 1 day */
- GNUNET_break (MHD_YES ==
- MHD_add_response_header (wsh->wire_reply,
- MHD_HTTP_HEADER_CACHE_CONTROL,
- "public,max-age=86400"));
-
- {
- struct GNUNET_HashCode h;
- char etag[sizeof (h) * 2];
- char *end;
-
- GNUNET_CRYPTO_hash_context_finish (hc,
- &h);
- end = GNUNET_STRINGS_data_to_string (&h,
- sizeof (h),
- etag,
- sizeof (etag));
- *end = '\0';
- wsh->etag = GNUNET_strdup (etag);
- GNUNET_break (MHD_YES ==
- MHD_add_response_header (wsh->wire_reply,
- MHD_HTTP_HEADER_ETAG,
- etag));
- }
- wsh->http_status = MHD_HTTP_OK;
- return wsh;
-}
-
-
-void
-TEH_wire_update_state (void)
-{
- struct GNUNET_DB_EventHeaderP es = {
- .size = htons (sizeof (es)),
- .type = htons (TALER_DBEVENT_DONAU_WIRE_UPDATED),
- };
-
- TEH_plugin->event_notify (TEH_plugin->cls,
- &es,
- NULL,
- 0);
- wire_generation++;
- key_generation++;
-}
-
-
-/**
- * Return the current key state for this thread. Possibly
- * re-builds the key state if we have reason to believe
- * that something changed.
- *
- * @return NULL on error
- */
-struct WireStateHandle *
-get_wire_state (void)
-{
- struct WireStateHandle *old_wsh;
-
- old_wsh = wire_state;
- if ( (NULL == old_wsh) ||
- (old_wsh->wire_generation < wire_generation) )
- {
- struct WireStateHandle *wsh;
-
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Rebuilding /wire, generation upgrade from %llu to %llu\n",
- (unsigned long long) (NULL == old_wsh) ? 0LL :
- old_wsh->wire_generation,
- (unsigned long long) wire_generation);
- TEH_check_invariants ();
- wsh = build_wire_state ();
- wire_state = wsh;
- if (NULL != old_wsh)
- destroy_wire_state (old_wsh);
- TEH_check_invariants ();
- return wsh;
- }
- return old_wsh;
-}
-
-
-const struct TALER_WireFeeSet *
-TEH_wire_fees_by_time (
- struct GNUNET_TIME_Timestamp ts,
- const char *method)
-{
- struct WireStateHandle *wsh = get_wire_state ();
-
- for (struct WireFeeSet *wfs = wsh->wfs_head;
- NULL != wfs;
- wfs = wfs->next)
- {
- if (0 != strcmp (method,
- wfs->method))
- continue;
- if ( (GNUNET_TIME_timestamp_cmp (wfs->start_date,
- >,
- ts)) ||
- (GNUNET_TIME_timestamp_cmp (ts,
- >=,
- wfs->end_date)) )
- continue;
- return &wfs->fees;
- }
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "No wire fees for method `%s' at %s configured\n",
- method,
- GNUNET_TIME_timestamp2s (ts));
- return NULL;
-}
-
-
/**
* Function called to forcefully resume suspended keys requests.
*
@@ -3517,7 +2892,7 @@ TEH_keys_denomination_sign (
enum TALER_ErrorCode
-TEH_keys_denomination_batch_sign (
+TEH_keys_donation_unit_batch_sign (
const struct TEH_CoinSignData *csds,
unsigned int csds_length,
bool for_melt,
@@ -3872,7 +3247,7 @@ krd_search_comparator (const void *key,
MHD_RESULT
-TEH_keys_get_handler (struct TEH_RequestContext *rc,
+TEH_keys_get_handler (struct TDH_RequestContext *rc,
const char *const args[])
{
struct GNUNET_TIME_Timestamp last_issue_date;
@@ -4374,4 +3749,4 @@ TEH_keys_management_get_keys_handler (const struct
TEH_RequestHandler *rh,
}
-/* end of taler-donau-httpd_keys.c */
+/* end of donau-httpd_keys.c */
diff --git a/src/donau/donau-httpd_keys.h b/src/donau/donau-httpd_keys.h
index 5940eba..b42e7a3 100644
--- a/src/donau/donau-httpd_keys.h
+++ b/src/donau/donau-httpd_keys.h
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2020-2022 Taler Systems SA
+ Copyright (C) 2020-2023 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free
Software
@@ -14,7 +14,7 @@
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
/**
- * @file taler-donau-httpd_keys.h
+ * @file donau-httpd_keys.h
* @brief management of our various keys
* @author Christian Grothoff
*/
@@ -22,172 +22,145 @@
#include "taler/taler_json_lib.h"
#include "taler/taler_mhd_lib.h"
#include "donau-httpd_responses.h"
+#include "donau_util.h"
#ifndef DONAU_HTTPD_KEYS_H
#define DONAU_HTTPD_KEYS_H
+
+/**
+ * @brief All information about a donation unit key (which is used to
+ * sign donation receipts into existence).
+ */
+struct TDH_DonationUnitKey
+{
+
+ /**
+ * Decoded donation unit public key (the hash of it is in
+ * @e issue, but we sometimes need the full public key as well).
+ */
+ struct DONAU_DonationUnitPublicKey du_pub;
+
+ /**
+ * Hash code of the donation unit public key.
+ */
+ struct DONAU_DonationUnitHashP h_du_pub;
+
+ /**
+ * Meta data about the type of the donation unit, containing the validity
+ * year and the value of the donation unit.
+ */
+ struct DONAUDB_DonationUnitKeyMetaData meta;
+
+ };
+
+
+/**
+ * Information needed to create a blind signature.
+ */
+struct TDH_CoinSignData
+{
+ /**
+ * Hash of key to sign with.
+ */
+ const struct DONAU_DonationUnitHashP *h_du_pub;
+
+ /**
+ * Blinded planchet to sign over.
+ */
+ const struct DONAU_BlindedPlanchet *bp;
+};
+
+
+/**
+ * Information needed to derive the CS r_pub.
+ */
+struct TDH_CsDeriveData
+{
+ /**
+ * Hash of key to sign with.
+ */
+ const struct DONAU_DonationUnitHashP *h_du_pub;
+
+ /**
+ * Nonce to use.
+ */
+ const struct DONAU_CsNonce *nonce;
+};
+
+
/**
- * Signatures of an auditor over a denomination key of this donau.
+ * Request to derive CS @a r_pub using the donation unit and nonce from @a cdd.
+ *
+ * @param cdd data to compute @a r_pub from
+ * @param for_melt true if this is for a melt operation
+ * @param[out] r_pub where to write the result
+ * @return #TALER_EC_NONE on success
*/
-struct TEH_AuditorSignature;
-
-
-// /**
-// * @brief All information about a denomination key (which is used to
-// * sign coins into existence).
-// */
-// struct TEH_DenominationKey
-// {
-
-// /**
-// * Decoded denomination public key (the hash of it is in
-// * @e issue, but we sometimes need the full public key as well).
-// */
-// struct TALER_DenominationPublicKey denom_pub;
-
-// /**
-// * Hash code of the denomination public key.
-// */
-// struct TALER_DenominationHashP h_denom_pub;
-
-// /**
-// * Meta data about the type of the denomination, such as fees and validity
-// * periods.
-// */
-// struct DONAUDB_DenominationKeyMetaData meta;
-
-// /**
-// * The long-term offline master key's signature for this denomination.
-// * Signs over @e h_denom_pub and @e meta.
-// */
-// struct TALER_MasterSignatureP master_sig;
-
-// /**
-// * We store the auditor signatures for this denomination in a DLL.
-// */
-// struct TEH_AuditorSignature *as_head;
-
-// /**
-// * We store the auditor signatures for this denomination in a DLL.
-// */
-// struct TEH_AuditorSignature *as_tail;
-
-// /**
-// * Set to 'true' if this denomination has been revoked and recoup is
-// * thus supported right now.
-// */
-// bool recoup_possible;
-
-// };
+enum TALER_ErrorCode
+TDH_keys_donation_unit_cs_r_pub (
+ const struct TDH_CsDeriveData *cdd,
+ struct GNUNET_CRYPTO_CSPublicRPairP *r_pub);
/**
-// * Information needed to create a blind signature.
-// */
-// struct TEH_CoinSignData
-// {
-// /**
-// * Hash of key to sign with.
-// */
-// const struct TALER_DenominationHashP *h_denom_pub;
-
-// /**
-// * Blinded planchet to sign over.
-// */
-// const struct TALER_BlindedPlanchet *bp;
-// };
-
-
-// /**
-// * Information needed to derive the CS r_pub.
-// */
-// struct TEH_CsDeriveData
-// {
-// /**
-// * Hash of key to sign with.
-// */
-// const struct TALER_DenominationHashP *h_denom_pub;
-
-// /**
-// * Nonce to use.
-// */
-// const struct TALER_CsNonce *nonce;
-// };
-
-
-// /**
-// * Request to derive CS @a r_pub using the denomination and nonce from @a
cdd.
-// *
-// * @param cdd data to compute @a r_pub from
-// * @param for_melt true if this is for a melt operation
-// * @param[out] r_pub where to write the result
-// * @return #TALER_EC_NONE on success
-// */
-// enum TALER_ErrorCode
-// TEH_keys_denomination_cs_r_pub (
-// const struct TEH_CsDeriveData *cdd,
-// bool for_melt,
-// struct TALER_DenominationCSPublicRPairP *r_pub);
-
-
-// /**
-// * Request to derive a bunch of CS @a r_pubs using the
-// * denominations and nonces from @a cdds.
-// *
-// * @param cdds array to compute @a r_pubs from
-// * @param cdds_length length of the @a cdds array
-// * @param for_melt true if this is for a melt operation
-// * @param[out] r_pubs array where to write the result; must be of length @a
cdds_length
-// * @return #TALER_EC_NONE on success
-// */
-// enum TALER_ErrorCode
-// TEH_keys_denomination_cs_batch_r_pub (
-// const struct TEH_CsDeriveData *cdds,
-// unsigned int cdds_length,
-// bool for_melt,
-// struct TALER_DenominationCSPublicRPairP *r_pubs);
+ * Request to derive a bunch of CS @a r_pubs using the
+ * donation units and nonces from @a cdds.
+ *
+ * @param cdds array to compute @a r_pubs from
+ * @param cdds_length length of the @a cdds array
+ * @param for_melt true if this is for a melt operation
+ * @param[out] r_pubs array where to write the result; must be of length @a
cdds_length
+ * @return #DONAU_EC_NONE on success
+ */
+enum TALER_ErrorCode
+TDH_keys_donation_unit_cs_batch_r_pub (
+ const struct TDH_CsDeriveData *cdds,
+ unsigned int cdds_length,
+ bool for_melt,
+ struct GNUNET_CRYPTO_CSPublicRPairP *r_pubs);
/**
-// * Sign the message in @a purpose with the donau's signing key.
-// *
-// * The @a purpose data is the beginning of the data of which the signature
is
-// * to be created. The `size` field in @a purpose must correctly indicate the
-// * number of bytes of the data structure, including its header. Use
-// * #TEH_keys_donau_sign() instead of calling this function directly!
-// *
-// * @param purpose the message to sign
-// * @param[out] pub set to the current public signing key of the donau
-// * @param[out] sig signature over purpose using current signing key
-// * @return #TALER_EC_NONE on success
-// */
-// enum TALER_ErrorCode
-// TEH_keys_donau_sign_ (
-// const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
-// struct DONAU_DonauPublicKeyP *pub,
-// struct TALER_DonauSignatureP *sig);
-
-
-// /**
-// * Sign the message in @a purpose with the donau's signing key.
-// *
-// * The @a purpose data is the beginning of the data of which the signature
is
-// * to be created. The `size` field in @a purpose must correctly indicate the
-// * number of bytes of the data structure, including its header. Use
-// * #TEH_keys_donau_sign() instead of calling this function directly!
-// *
-// * @param cls key state state to look in
-// * @param purpose the message to sign
-// * @param[out] pub set to the current public signing key of the donau
-// * @param[out] sig signature over purpose using current signing key
-// * @return #TALER_EC_NONE on success
-// */
-// enum TALER_ErrorCode
-// TEH_keys_donau_sign2_ (
-// void *cls,
-// const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
-// struct DONAU_DonauPublicKeyP *pub,
-// struct TALER_DonauSignatureP *sig);
+ * Sign the message in @a purpose with the donau's signing key.
+ *
+ * The @a purpose data is the beginning of the data of which the signature is
+ * to be created. The `size` field in @a purpose must correctly indicate the
+ * number of bytes of the data structure, including its header. Use
+ * #TDH_keys_donau_sign() instead of calling this function directly!
+ *
+ * @param purpose the message to sign
+ * @param[out] pub set to the current public signing key of the donau
+ * @param[out] sig signature over purpose using current signing key
+ * @return #TALER_EC_NONE on success
+ */
+enum TALER_ErrorCode
+TDH_keys_donau_sign_ (
+ const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
+ struct DONAU_EddsaPublicKeyP *pub,
+ struct DONAU_DonauSignatureP *sig);
+
+
+/**
+ * Sign the message in @a purpose with the donau's signing key.
+ *
+ * The @a purpose data is the beginning of the data of which the signature is
+ * to be created. The `size` field in @a purpose must correctly indicate the
+ * number of bytes of the data structure, including its header. Use
+ * #TDH_keys_donau_sign() instead of calling this function directly!
+ *
+ * @param cls key state state to look in
+ * @param purpose the message to sign
+ * @param[out] pub set to the current public signing key of the donau
+ * @param[out] sig signature over purpose using current signing key
+ * @return #TALER_EC_NONE on success
+ */
+enum TALER_ErrorCode
+TDH_keys_donau_sign2_ (
+ void *cls,
+ const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
+ struct DONAU_EddsaPublicKeyP *pub,
+ struct DONAU_DonauSignatureP *sig);
/**
@@ -203,7 +176,7 @@ struct TEH_AuditorSignature;
* @param[out] sig where to write the signature
* @return #TALER_EC_NONE on success
*/
-#define TEH_keys_donau_sign(ps,pub,sig) \
+#define TDH_keys_donau_sign(ps,pub,sig) \
({ \
/* check size is set correctly */ \
GNUNET_assert (htonl ((ps)->purpose.size) == \
@@ -211,7 +184,7 @@ struct TEH_AuditorSignature;
/* check 'ps' begins with the purpose */ \
GNUNET_static_assert (((void*) (ps)) == \
((void*) &(ps)->purpose)); \
- TEH_keys_donau_sign_ (&(ps)->purpose, \
+ TDH_keys_donau_sign_ (&(ps)->purpose, \
pub, \
sig); \
})
@@ -225,10 +198,10 @@ struct TEH_AuditorSignature;
* created. The `size` field in @a ps->purpose must correctly indicate the
* number of bytes of the data structure, including its header.
*
- * This allows requesting multiple denominations with the same @a ksh which
+ * This allows requesting multiple donation units with the same @a ksh which
* thus will remain valid until the next call to
- * #TEH_keys_denomination_by_hash() or #TEH_keys_get_state() or
- * #TEH_keys_donau_sign().
+ * #TDH_keys_donation_unit_by_hash() or #TDH_keys_get_state() or
+ * #TDH_keys_donau_sign().
*
* @param ksh key state to use
* @param ps packed struct with what to sign, MUST begin with a purpose
@@ -236,7 +209,7 @@ struct TEH_AuditorSignature;
* @param[out] sig where to write the signature
* @return #TALER_EC_NONE on success
*/
-#define TEH_keys_donau_sign2(ksh,ps,pub,sig) \
+#define TDH_keys_donau_sign2(ksh,ps,pub,sig) \
({ \
/* check size is set correctly */ \
GNUNET_assert (htonl ((ps)->purpose.size) == \
@@ -244,7 +217,7 @@ struct TEH_AuditorSignature;
/* check 'ps' begins with the purpose */ \
GNUNET_static_assert (((void*) (ps)) == \
((void*) &(ps)->purpose)); \
- TEH_keys_donau_sign2_ (ksh, \
+ TDH_keys_donau_sign2_ (ksh, \
&(ps)->purpose, \
pub, \
sig); \
@@ -260,7 +233,7 @@ struct TEH_AuditorSignature;
* @return MHD result code
*/
MHD_RESULT
-TEH_keys_get_handler (struct TEH_RequestContext *rc,
+TDH_keys_get_handler (struct TDH_RequestContext *rc,
const char *const args[]);
@@ -270,7 +243,7 @@ TEH_keys_get_handler (struct TEH_RequestContext *rc,
* @return #GNUNET_OK on success
*/
enum GNUNET_GenericReturnValue
-TEH_keys_init (void);
+TDH_keys_init (void);
#endif
diff --git a/src/donau/donau-httpd_metrics.c b/src/donau/donau-httpd_metrics.c
index 73fdbd4..f98b8b7 100644
--- a/src/donau/donau-httpd_metrics.c
+++ b/src/donau/donau-httpd_metrics.c
@@ -45,7 +45,7 @@ unsigned long long
TEH_METRICS_num_success[TEH_MT_SUCCESS_COUNT];
MHD_RESULT
-TEH_handler_metrics (struct TEH_RequestContext *rc,
+TEH_handler_metrics (struct TDH_RequestContext *rc,
const char *const args[])
{
char *reply;
diff --git a/src/donau/donau-httpd_metrics.h b/src/donau/donau-httpd_metrics.h
index 57d49b2..7474591 100644
--- a/src/donau/donau-httpd_metrics.h
+++ b/src/donau/donau-httpd_metrics.h
@@ -128,7 +128,7 @@ extern unsigned long long
TEH_METRICS_num_keydonaus[TEH_MT_KEYX_COUNT];
* @return MHD result code
*/
MHD_RESULT
-TEH_handler_metrics (struct TEH_RequestContext *rc,
+TEH_handler_metrics (struct TDH_RequestContext *rc,
const char *const args[]);
diff --git a/src/donau/donau-httpd_mhd.c b/src/donau/donau-httpd_mhd.c
index 4912ec7..61e39e5 100644
--- a/src/donau/donau-httpd_mhd.c
+++ b/src/donau/donau-httpd_mhd.c
@@ -35,7 +35,7 @@
MHD_RESULT
-TEH_handler_static_response (struct TEH_RequestContext *rc,
+TEH_handler_static_response (struct TDH_RequestContext *rc,
const char *const args[])
{
const struct TEH_RequestHandler *rh = rc->rh;
@@ -54,7 +54,7 @@ TEH_handler_static_response (struct TEH_RequestContext *rc,
MHD_RESULT
-TEH_handler_agpl_redirect (struct TEH_RequestContext *rc,
+TEH_handler_agpl_redirect (struct TDH_RequestContext *rc,
const char *const args[])
{
(void) args;
diff --git a/src/donau/donau-httpd_mhd.h b/src/donau/donau-httpd_mhd.h
index 1c6c18d..9d77087 100644
--- a/src/donau/donau-httpd_mhd.h
+++ b/src/donau/donau-httpd_mhd.h
@@ -37,7 +37,7 @@
* @return MHD result code
*/
MHD_RESULT
-TEH_handler_static_response (struct TEH_RequestContext *rc,
+TEH_handler_static_response (struct TDH_RequestContext *rc,
const char *const args[]);
@@ -50,7 +50,7 @@ TEH_handler_static_response (struct TEH_RequestContext *rc,
* @return MHD result code
*/
MHD_RESULT
-TEH_handler_agpl_redirect (struct TEH_RequestContext *rc,
+TEH_handler_agpl_redirect (struct TDH_RequestContext *rc,
const char *const args[]);
diff --git a/src/donau/donau-httpd_submit_receipts_get.c
b/src/donau/donau-httpd_submit_receipts_get.c
index 442b3f1..d224c42 100644
--- a/src/donau/donau-httpd_submit_receipts_get.c
+++ b/src/donau/donau-httpd_submit_receipts_get.c
@@ -51,7 +51,7 @@ struct DepositWtidContext
/**
* Context for the request we are processing.
*/
- struct TEH_RequestContext *rc;
+ struct TDH_RequestContext *rc;
/**
* Subscription for the database event we are waiting for.
@@ -413,7 +413,7 @@ handle_track_transaction_request (
* @param rc request context with data to clean up
*/
static void
-dwc_cleaner (struct TEH_RequestContext *rc)
+dwc_cleaner (struct TDH_RequestContext *rc)
{
struct DepositWtidContext *ctx = rc->rh_ctx;
@@ -429,7 +429,7 @@ dwc_cleaner (struct TEH_RequestContext *rc)
MHD_RESULT
-TEH_handler_deposits_get (struct TEH_RequestContext *rc,
+TEH_handler_deposits_get (struct TDH_RequestContext *rc,
const char *const args[4])
{
struct DepositWtidContext *ctx = rc->rh_ctx;
diff --git a/src/donau/donau-httpd_submit_receipts_get.h
b/src/donau/donau-httpd_submit_receipts_get.h
index 8ed7e77..c2b6aea 100644
--- a/src/donau/donau-httpd_submit_receipts_get.h
+++ b/src/donau/donau-httpd_submit_receipts_get.h
@@ -43,7 +43,7 @@ TEH_deposits_get_cleanup (void);
* @return MHD result code
*/
MHD_RESULT
-TEH_handler_deposits_get (struct TEH_RequestContext *rc,
+TEH_handler_deposits_get (struct TDH_RequestContext *rc,
const char *const args[4]);
diff --git a/src/donau/donau-httpd_terms.c b/src/donau/donau-httpd_terms.c
index 9ee48f9..05ba547 100644
--- a/src/donau/donau-httpd_terms.c
+++ b/src/donau/donau-httpd_terms.c
@@ -39,7 +39,7 @@
// MHD_RESULT
-// TEH_handler_terms (struct TEH_RequestContext *rc,
+// TEH_handler_terms (struct TDH_RequestContext *rc,
// const char *const args[])
// {
// (void) args;
@@ -49,7 +49,7 @@
// MHD_RESULT
-// TEH_handler_privacy (struct TEH_RequestContext *rc,
+// TEH_handler_privacy (struct TDH_RequestContext *rc,
// const char *const args[])
// {
// (void) args;
diff --git a/src/donau/donau-httpd_terms.h b/src/donau/donau-httpd_terms.h
index 0537016..bdedbf5 100644
--- a/src/donau/donau-httpd_terms.h
+++ b/src/donau/donau-httpd_terms.h
@@ -37,7 +37,7 @@
* @return MHD result code
*/
MHD_RESULT
-TEH_handler_terms (struct TEH_RequestContext *rc,
+TEH_handler_terms (struct TDH_RequestContext *rc,
const char *const args[]);
@@ -49,7 +49,7 @@ TEH_handler_terms (struct TEH_RequestContext *rc,
* @return MHD result code
*/
MHD_RESULT
-TEH_handler_privacy (struct TEH_RequestContext *rc,
+TEH_handler_privacy (struct TDH_RequestContext *rc,
const char *const args[]);
diff --git a/src/include/donau_crypto_lib.h b/src/include/donau_crypto_lib.h
index 6c0ae15..9970b91 100644
--- a/src/include/donau_crypto_lib.h
+++ b/src/include/donau_crypto_lib.h
@@ -194,10 +194,10 @@ struct DONAU_BlindedUniqueDonationIdentifierKeyPair
struct DONAU_DonationUnitHashP h_donation_unit_pub;
/**
- * Donor's blinded donation receipt to be blindly
- * signed.
+ * Donor's blinded donation identifier. It must be blindly signed
+ * to become donation receipt.
*/
- struct DONAU_BlindedUniqueDonationIdentifier blinded_udi;
+ struct GNUNET_CRYPTO_BlindedMessage blinded_udi;
};
@@ -307,6 +307,17 @@ struct DONAU_DonationUnitGroup
};
+/**
+ * @brief Inputs needed from the donau for blind signing.
+ */
+struct TALER_DonauBatchIssueValues
+{
+ /**
+ * Input values.
+ */
+ struct GNUNET_CRYPTO_BlindingInputValues *blinding_inputs;
+};
+
/**
* Compute a unique key for the meta data of a donation unit group.
*
diff --git a/src/include/donau_service.h b/src/include/donau_service.h
index b9e2312..7f9c5dc 100644
--- a/src/include/donau_service.h
+++ b/src/include/donau_service.h
@@ -54,7 +54,7 @@ struct DONAU_SigningPublicKeyAndValidity
/**
* @brief Public information about a donau's donation unit signing key
*/
-struct TALER_DonationUnitInformation
+struct DONAU_DonationUnitInformation
{
/**
* The public key
@@ -85,9 +85,9 @@ struct DONAU_Keys
struct DONAU_SigningPublicKeyAndValidity *sign_keys;
/**
- * Array of the donau'sdonation unit keys.
+ * Array of the donau's donation unit keys.
*/
- struct TALER_DonationUnitInformation *donation_unit_keys;
+ struct DONAU_DonationUnitInformation *donation_unit_keys;
/**
* Supported protocol version by the donau.
@@ -390,7 +390,7 @@ DONAU_test_signing_key (
* @return details about the given donation unit key, NULL if the key is not
* found
*/
-const struct TALER_DonationUnitInformation *
+const struct DONAU_DonationUnitInformation *
DONAU_get_donation_unit_key (
const struct DONAU_Keys *keys,
const struct DONAU_DonationUnitPublicKey *pk);
@@ -427,34 +427,6 @@ DONAU_get_signing_key_info (
/* ********************* POST / issue receipt *********************** */
-// /**
-// * @brief Type including Parameters to create blinded signature
-// */
-// struct TALER_BlindedUniqueDonationIdentifier
-// {
-// /**
-// * Type of the sign blinded message
-// */
-// enum TALER_DenominationCipher cipher;
-
-// /**
-// * Details, depending on @e cipher.
-// */
-// union
-// {
-// /**
-// * If we use #TALER_DENOMINATION_CS in @a cipher.
-// */
-// struct TALER_BlindedCsPlanchet cs_blinded_donor;
-
-// /**
-// * If we use #TALER_DENOMINATION_RSA in @a cipher.
-// */
-// struct TALER_BlindedRsaPlanchet rsa_blinded_donor;
-
-// } details;
-// };
-
/**
* @brief A Batch Submit Handle
*/
@@ -542,15 +514,15 @@ typedef void
* @return a handle for this request; NULL if the inputs are invalid (i.e.
* signatures fail to verify). In this case, the callback is not
called.
*/
-// struct DONAU_BatchIssueReceiptHandle *
-// DONAU_charity_issue_receipt (
-// struct GNUNET_CURL_Context *ctx,
-// const char *url,
-// const struct DONAU_CharityPrivateKeyP *charity_priv,
-// unsigned int num_bkp,
-// const struct TALER_BlindedUniqueDonationIdentifierKeyPair bkp[static
num_bkp],
-// DONAU_BatchIssueReceiptsCallback cb,
-// void *cb_cls);
+struct DONAU_BatchIssueReceiptHandle *
+DONAU_charity_issue_receipt (
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
+ const struct DONAU_CharityPrivateKeyP *charity_priv,
+ unsigned int num_bkp,
+ const struct DONAU_BlindedUniqueDonationIdentifierKeyPair bkp[static
num_bkp],
+ DONAU_BatchIssueReceiptsCallback cb,
+ void *cb_cls);
/**
* Cancel a batch issue receipt request. This function cannot be used
@@ -710,43 +682,49 @@ DONAU_donor_receipts_to_statement_cancel (
struct DONAU_CsRBatchIssueHandle;
-// /**
-// * Details about a response for a CS R request.
-// */
-// struct DONAU_CsRBatchIssueResponse
-// {
-// /**
-// * HTTP response data.
-// */
-// struct DONAU_HttpResponse hr;
-
-// /**
-// * Details about the response.
-// */
-// union
-// {
-// /**
-// * Details if the status is #MHD_HTTP_OK.
-// */
-// struct
-// {
-// /**
-// * Values contributed by the donau for the
-// * respective coin's batch-issue operation.
-// */
-// struct TALER_DonauBatchIssueValues alg_values;
-// } ok;
-
-// /**
-// * Details if the status is #MHD_HTTP_GONE.
-// */
-// struct
-// {
-// /* TODO: returning full details is not implemented */
-// } gone;
-
-// } details;
-// };
+/**
+ * Details about a response for a CS R request.
+ */
+struct DONAU_CsRBatchIssueResponse
+{
+ /**
+ * HTTP response data.
+ */
+ struct DONAU_HttpResponse hr;
+
+ /**
+ * Details about the response.
+ */
+ union
+ {
+ /**
+ * Details if the status is #MHD_HTTP_OK.
+ */
+ struct
+ {
+ /**
+ * Values contributed by the donau for the
+ * respective donation receipts's batch-issue operation.
+ */
+ //struct TALER_DonauBatchIssueValues alg_values;
+
+ /**
+ * num of CsR signatures
+ */
+ unsigned int num_sig;
+
+ } ok;
+
+ /**
+ * Details if the status is #MHD_HTTP_GONE.
+ */
+ struct
+ {
+ /* TODO: returning full details is not implemented */
+ } gone;
+
+ } details;
+};
/**
@@ -756,10 +734,10 @@ struct DONAU_CsRBatchIssueHandle;
* @param cls closure
* @param csrr response details
*/
-// typedef void
-// (*DONAU_CsRBatchIssueCallback) (
-// void *cls,
-// const struct DONAU_CsRBatchIssueResponse *csrr);
+typedef void
+(*DONAU_CsRBatchIssueCallback) (
+ void *cls,
+ const struct DONAU_CsRBatchIssueResponse *csrr);
/**
@@ -775,14 +753,14 @@ struct DONAU_CsRBatchIssueHandle;
* if the inputs are invalid (i.e.donation unit key not with this
donau).
* In this case, the callback is not called.
*/
-// struct DONAU_CsRBatchIssueHandle *
-// DONAU_csr_batch_issue (
-// struct GNUNET_CURL_Context *curl_ctx,
-// const char *donau_url,
-// const struct DONAU_DonationUnitPublicKey *pk,
-// const struct TALER_CsNonce *nonce,
-// DONAU_CsRBatchIssueCallback res_cb,
-// void *res_cb_cls);
+struct DONAU_CsRBatchIssueHandle *
+DONAU_csr_batch_issue (
+ struct GNUNET_CURL_Context *curl_ctx,
+ const char *donau_url,
+ const struct DONAU_DonationUnitPublicKey *pk,
+ const struct GNUNET_CRYPTO_CsBlindingNonce nonce,
+ DONAU_CsRBatchIssueCallback res_cb,
+ void *res_cb_cls);
/**
@@ -792,9 +770,9 @@ struct DONAU_CsRBatchIssueHandle;
*
* @param csrh the batch-issue handle
*/
-// void
-// DONAU_csr_batch_issue_cancel (
-// struct DONAU_CsRBatchIssueHandle *csrh);
+void
+DONAU_csr_batch_issue_cancel (
+ struct DONAU_CsRBatchIssueHandle *csrh);
/* ********************* GET /charities/ *********************** */
@@ -817,12 +795,12 @@ struct CharitySummary
/**
* Max donation amout for this charitiy and year.
*/
- // struct TALER_Amount amount;
+ struct TALER_Amount max;
/**
* Current donation amount for this charity and year.
*/
- // struct TALER_Amount amount;
+ struct TALER_Amount current;
};
@@ -919,9 +897,9 @@ DONAU_charities_get (
*
* @param rgh the charity request handle
*/
-// void
-// DONAU_charities_get_cancel (
-// struct DONAU_charitiesGetHandle *rgh);
+void
+DONAU_charities_get_cancel (
+ struct DONAU_CharitiesGetHandle *rgh);
/* ********************* GET /charities/$CHARITY_ID *********************** */
@@ -1058,9 +1036,9 @@ DONAU_charity_get (
*
* @param rgh the charity request handle
*/
-// void
-// DONAU_charity_get_cancel (
-// struct DONAU_charityGetHandle *rgh);
+void
+DONAU_charity_get_cancel (
+ struct DONAU_CharityGetHandle *rgh);
/* ********************* POST /charities/ *********************** */
@@ -1159,14 +1137,14 @@ typedef void
* @return a handle for this request; NULL if the inputs are invalid (i.e.
* signatures fail to verify). In this case, the callback is not
called.
*/
-// struct DONAU_CharityPostHandle *
-// DONAU_charity_post (
-// struct GNUNET_CURL_Context *ctx,
-// const char *url,
-// const charityRequest charity_req,
-// const struct DONAU_BearerToken bearer,
-// DONAU_PostCharityResponseCallback cb,
-// void *cb_cls);
+struct DONAU_CharityPostHandle *
+DONAU_charity_post (
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
+ const struct charityRequest charity_req,
+ const struct DONAU_BearerToken bearer,
+ DONAU_PostCharityResponseCallback cb,
+ void *cb_cls);
/**
* Cancel a charity Post request. This function cannot be used
@@ -1174,9 +1152,9 @@ typedef void
*
* @param rgh the charity post handle
*/
-// void
-// DONAU_charity_post_cancel (
-// struct DONAU_charityPostHandle *rgh);
+void
+DONAU_charity_post_cancel (
+ struct DONAU_CharityPostHandle *rgh);
/* ********************* PATCH /charities/$CHARITY_ID ***********************
*/
@@ -1244,9 +1222,9 @@ DONAU_charity_patch (
*
* @param rgh the charity patch handle
*/
-// void
-// DONAU_charity_patch_cancel (
-// struct DONAU_charityPatchHandle *rgh);
+void
+DONAU_charity_patch_cancel (
+ struct DONAU_CharityPatchHandle *rgh);
/* ********************* DELETE /charities/$CHARITY_ID ***********************
*/
diff --git a/src/include/donaudb_plugin.h b/src/include/donaudb_plugin.h
index de6a3f7..d15133c 100644
--- a/src/include/donaudb_plugin.h
+++ b/src/include/donaudb_plugin.h
@@ -45,7 +45,7 @@ struct DONAUDB_DonationUnitKeyMetaData
/**
* Hash code of the donation unit public key.
*/
- struct DONAU_DonationUnitHashP donation_unit_hash;
+ struct DONAU_DonationUnitHashP donation_unit_hash; //already in
GNUNET_CRYPTO_BlindSignPublicKey -> part of every public donation unit
};
--
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: [donau][header] uncomment header and work on httpd keys,
gnunet <=