donau

Donation authority for GNU Taler (experimental)
Log | Files | Refs | Submodules | README | LICENSE

commit a43c752cdd68cb33e673f99cb393f958739d55d4
parent 76ef2a0a3710519faa56cba3971313bcbb06105a
Author: Pius Loosli <loosp2@bfh.ch>
Date:   Wed, 17 Jan 2024 15:44:37 +0100

[donau/secmod] Work on /keys, secmod now syncing when used with test_donau_api.conf file

Diffstat:
Msrc/donau/donau-httpd_keys.c | 46++++++++++++++++++++++------------------------
Msrc/testing/test_donau_api.conf | 21++++++++++++++++++---
2 files changed, 40 insertions(+), 27 deletions(-)

diff --git a/src/donau/donau-httpd_keys.c b/src/donau/donau-httpd_keys.c @@ -427,17 +427,17 @@ struct HelperState /** * Handle for the esign/EdDSA helper. */ - struct DONAU_CRYPTO_DonauSignHelper *esh; + struct TALER_CRYPTO_ExchangeSignHelper *esh; /** * Handle for the donation_unit/RSA helper. */ - struct DONAU_CRYPTO_RsaDonationUnitHelper *rsadh; + struct TALER_CRYPTO_RsaDenominationHelper*rsadh; /** * Handle for the donation_unit/CS helper. */ - struct DONAU_CRYPTO_CsDonationUnitHelper *csdh; + struct TALER_CRYPTO_CsDenominationHelper*csdh; /** * Map from H(donation_unit_pub) to `struct HelperDonationUnit` entries. @@ -732,9 +732,9 @@ clear_response_cache (struct DH_KeyStateHandle *ksh) static void sync_key_helpers (struct HelperState *hs) { - DONAU_CRYPTO_helper_rsa_poll (hs->rsadh); - DONAU_CRYPTO_helper_cs_poll (hs->csdh); -// DONAU_CRYPTO_helper_esign_poll (hs->esh); + TALER_CRYPTO_helper_rsa_poll (hs->rsadh); + TALER_CRYPTO_helper_cs_poll (hs->csdh); + TALER_CRYPTO_helper_esign_poll (hs->esh); } @@ -905,17 +905,17 @@ destroy_key_helpers (struct HelperState *hs) hs->esign_keys = NULL; if (NULL != hs->rsadh) { - DONAU_CRYPTO_helper_rsa_disconnect (hs->rsadh); + TALER_CRYPTO_helper_rsa_disconnect (hs->rsadh); hs->rsadh = NULL; } if (NULL != hs->csdh) { - DONAU_CRYPTO_helper_cs_disconnect (hs->csdh); + TALER_CRYPTO_helper_cs_disconnect (hs->csdh); hs->csdh = NULL; } if (NULL != hs->esh) { - DONAU_CRYPTO_helper_esign_disconnect (hs->esh); + TALER_CRYPTO_helper_esign_disconnect (hs->esh); hs->esh = NULL; } } @@ -1138,7 +1138,7 @@ helper_esign_cb ( void *cls, struct GNUNET_TIME_Timestamp start_time, struct GNUNET_TIME_Relative validity_duration, - const struct DONAU_DonauPublicKeyP *donau_pub, + const struct TALER_ExchangePublicKeyP *donau_pub, const struct TALER_SecurityModulePublicKeyP *sm_pub, const struct TALER_SecurityModuleSignatureP *sm_sig) { @@ -1167,7 +1167,11 @@ helper_esign_cb ( hsk = GNUNET_new (struct HelperSignkey); // hsk->start_time = start_time; // hsk->validity_duration = validity_duration; - hsk->donau_pub = *donau_pub; + + // need to cast because secmod works with TALER_ExchangePublicKeyP + struct DONAU_DonauPublicKeyP donau_pubkey = {.eddsa_pub = + donau_pub->eddsa_pub}; + hsk->donau_pub = donau_pubkey; GNUNET_assert ( GNUNET_OK == GNUNET_CONTAINER_multipeermap_put ( @@ -1217,7 +1221,7 @@ setup_key_helpers (struct HelperState *hs) destroy_key_helpers (hs); return GNUNET_SYSERR; } - hs->esh = DONAU_CRYPTO_helper_esign_connect (DH_cfg, + hs->esh = TALER_CRYPTO_helper_esign_connect (DH_cfg, "donau", &helper_esign_cb, hs); @@ -1270,14 +1274,7 @@ build_key_state (struct HelperState *hs) /* NOTE: fetches master-signed signkeys, but ALSO those that were revoked! */ GNUNET_break (GNUNET_OK == DH_plugin->preflight (DH_plugin->cls)); - if (qs < 0) - { - GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR != qs); - GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR != qs); - destroy_key_state (ksh, - true); - return NULL; - } + // qs = DH_plugin->iterate_donation_units (DH_plugin->cls, // &donation_unit_info_cb, // ksh); @@ -1331,15 +1328,15 @@ DH_keys_update_states () static struct DH_KeyStateHandle* -DH_keys_get_state (/*bool management_only*/) +DH_keys_get_state () { struct DH_KeyStateHandle *old_ksh; struct DH_KeyStateHandle *ksh; + old_ksh = key_state; if (NULL == old_ksh) { - ksh = build_key_state (NULL /*, management_only*/); - ksh = NULL; + ksh = build_key_state (NULL); if (NULL == ksh) return NULL; key_state = ksh; @@ -1492,11 +1489,12 @@ DH_handler_keys (struct DH_RequestContext *rc, // connection is always initialised struct MHD_Connection *connection = rc->connection; - ksh = DH_keys_get_state (true); + ksh = DH_keys_get_state (); if (NULL == ksh) { return TALER_MHD_reply_with_error (connection, MHD_HTTP_SERVICE_UNAVAILABLE, +// TALER_EC_DONAU_GENERIC_KEYS_MISSING, TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING, "no key state"); } diff --git a/src/testing/test_donau_api.conf b/src/testing/test_donau_api.conf @@ -4,6 +4,8 @@ [PATHS] TALER_TEST_HOME = test_donau_api_home/ +DONAU_RUNTIME_DIR = ${TMPDIR:-${TMP:-/tmp}}/donau-system-runtime/ + [taler] CURRENCY = EUR @@ -25,15 +27,28 @@ CONFIG = "postgres:///donaucheck" [donaudb] # IDLE_RESERVE_EXPIRATION_TIME = 0 s -[donau-exchange-secmod-cs] +# see src/util/donau-secmod-cs.conf for details +[donau-secmod-cs] LOOKAHEAD_SIGN = "24 days" KEY_DIR = ${PWD}/test_donau_api_home/exchange-secmod-cs/keys +OVERLAP_DURATION = 0 +SM_PRIV_KEY = ${DONAU_RUNTIME_DIR}donau-secmod-cs/secmod-private-key +UNIXPATH = ${DONAU_RUNTIME_DIR}donau-secmod-cs/server.sock -[donau-exchange-secmod-rsa] +# see src/util/donau-secmod-rsa.conf for details +[donau-secmod-rsa] LOOKAHEAD_SIGN = "24 days" KEY_DIR = ${PWD}/test_donau_api_home/exchange-secmod-rsa/keys +OVERLAP_DURATION = 0 +SM_PRIV_KEY = ${DONAU_RUNTIME_DIR}donau-secmod-rsa/secmod-private-key +UNIXPATH = ${DONAU_RUNTIME_DIR}donau-secmod-rsa/server.sock -[donau-exchange-secmod-eddsa] +# see src/util/donau-secmod-eddsa.conf for details +[donau-secmod-eddsa] LOOKAHEAD_SIGN = "24 days" DURATION = "14 days" KEY_DIR = ${PWD}/test_donau_api_home/exchange-secmod-eddsa/keys +OVERLAP_DURATION = 0 +SM_PRIV_KEY = ${DONAU_RUNTIME_DIR}donau-secmod-eddsa/secmod-private-key +UNIXPATH = ${DONAU_RUNTIME_DIR}donau-secmod-eddsa/server.sock +