commit 9b2dab911b874eb8dc4ac500a244863391df492e
parent f854cf4490a07dacaafd39ecb7591f6b11e787ad
Author: Matyja Lukas Adam <lukas.matyja@students.bfh.ch>
Date: Tue, 21 May 2024 20:53:46 +0200
Merge remote-tracking branch 'refs/remotes/origin/master'
Diffstat:
8 files changed, 49 insertions(+), 151 deletions(-)
diff --git a/src/donau/donau-httpd.c b/src/donau/donau-httpd.c
@@ -55,7 +55,7 @@
* Above what request latency do we start to log?
*/
#define WARN_LATENCY GNUNET_TIME_relative_multiply ( \
- GNUNET_TIME_UNIT_MILLISECONDS, 500)
+ GNUNET_TIME_UNIT_MILLISECONDS, 500)
/**
* Are clients allowed to request /keys for times other than the
@@ -341,7 +341,7 @@ proceed_with_handler (struct DH_RequestContext *rc,
json_decref (root);
return TALER_MHD_reply_with_error (rc->connection,
MHD_HTTP_NOT_FOUND,
- TALER_EC_EXCHANGE_GENERIC_WRONG_NUMBER_OF_SEGMENTS,
+ TALER_EC_DONAU_GENERIC_WRONG_NUMBER_OF_SEGMENTS,
emsg);
}
GNUNET_assert (NULL == args[i - 1]);
diff --git a/src/donau/donau-httpd_batch-submit.c b/src/donau/donau-httpd_batch-submit.c
@@ -155,7 +155,7 @@ DH_handler_submit_receipts_post (struct DH_RequestContext *rc,
GNUNET_break_op (0);
return TALER_MHD_reply_with_error (rc->connection,
MHD_HTTP_NOT_FOUND,
- TALER_EC_DONAU_GENERIC_KEYS_MISSING,
+ TALER_EC_DONAU_GENERIC_DONATION_UNIT_UNKNOWN,
NULL);
}
@@ -172,10 +172,9 @@ DH_handler_submit_receipts_post (struct DH_RequestContext *rc,
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Donation receipt signature invalid!\n");
- // FIXME change error message
return TALER_MHD_reply_with_error (rc->connection,
- MHD_HTTP_NOT_FOUND,
- TALER_EC_DONAU_GENERIC_KEYS_MISSING,
+ MHD_HTTP_FORBIDDEN,
+ TALER_EC_DONAU_DONATION_RECEIPT_SIGNATURE_INVALID,
NULL);
}
diff --git a/src/donau/donau-httpd_csr.c b/src/donau/donau-httpd_csr.c
@@ -78,7 +78,7 @@ DH_handler_csr_issue (struct DH_RequestContext *rc,
return TALER_MHD_reply_with_error (
rc->connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING, // FIXME
+ TALER_EC_DONAU_GENERIC_KEYS_MISSING,
NULL);
}
if (GNUNET_CRYPTO_BSA_CS !=
@@ -89,7 +89,7 @@ DH_handler_csr_issue (struct DH_RequestContext *rc,
return TALER_MHD_reply_with_error (
rc->connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING, // FIXME
+ TALER_EC_DONAU_GENERIC_KEYS_MISSING,
NULL);
}
}
diff --git a/src/donau/donau-httpd_keys.c b/src/donau/donau-httpd_keys.c
@@ -1197,14 +1197,14 @@ DH_handler_keys (struct DH_RequestContext *rc,
/* Either IPC failed, or neither helper had any donation_unit configured. */
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_GATEWAY,
- TALER_EC_EXCHANGE_DENOMINATION_HELPER_UNAVAILABLE,
+ TALER_EC_DONAU_DONATION_UNIT_HELPER_UNAVAILABLE,
NULL);
}
if (GNUNET_is_zero (&esign_sm_pub))
{
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_GATEWAY,
- TALER_EC_EXCHANGE_SIGNKEY_HELPER_UNAVAILABLE,
+ TALER_EC_DONAU_SIGNKEY_HELPER_UNAVAILABLE,
NULL);
}
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -1242,7 +1242,7 @@ DH_keys_donau_sign_ (
or had some bad error. */
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Cannot sign request, no valid signing keys available.\n");
- return TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING;
+ return TALER_EC_DONAU_GENERIC_KEYS_MISSING;
}
/* need to "cast" because TALER_CRYPTO works with TALER_Exchange.. */
@@ -1279,7 +1279,7 @@ DH_keys_donau_sign_ (
memset (sig,
0,
sizeof (*sig));
- return TALER_EC_EXCHANGE_SIGNKEY_HELPER_BUG;
+ return TALER_EC_DONAU_SIGNKEY_HELPER_BUG;
}
}
return ec;
@@ -1304,8 +1304,7 @@ DH_keys_donation_unit_batch_sign (
ksh = DH_keys_get_state ();
if (NULL == ksh)
- // FIXME change error code
- return TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING;
+ return TALER_EC_DONAU_GENERIC_KEYS_MISSING;
for (unsigned int i = 0; i<num_bkps; i++)
{
const struct DONAU_DonationUnitHashP *h_du_pub =
@@ -1315,8 +1314,7 @@ DH_keys_donation_unit_batch_sign (
du = GNUNET_CONTAINER_multihashmap_get (du_keys,
&h_du_pub->hash);
if (NULL == du)
- // FIXME change error code
- return TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN;
+ return TALER_EC_DONAU_GENERIC_DONATION_UNIT_UNKNOWN;
if (budi->blinded_message->cipher !=
du->donation_unit_pub.bsign_pub_key->cipher)
return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
@@ -1450,7 +1448,7 @@ DH_keys_donation_unit_cs_r_pub (
dk = DH_keys_donation_unit_by_hash (h_donation_unit_pub);
if (NULL == dk)
{
- return TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN;
+ return TALER_EC_DONAU_GENERIC_DONATION_UNIT_UNKNOWN;
}
if (GNUNET_CRYPTO_BSA_CS !=
dk->donation_unit_pub.bsign_pub_key->cipher)
diff --git a/src/donaudb/pg_insert_donation_unit.c b/src/donaudb/pg_insert_donation_unit.c
@@ -40,7 +40,8 @@ DH_PG_insert_donation_unit (
GNUNET_PQ_query_param_auto_from_type (h_donation_unit_pub),
DONAU_PQ_query_param_donation_unit_pub (donation_unit_pub),
GNUNET_PQ_query_param_uint64 (&validity_year),
- TALER_PQ_query_param_amount (pg->conn, value),
+ TALER_PQ_query_param_amount (pg->conn,
+ value),
GNUNET_PQ_query_param_end
};
diff --git a/src/donaudb/pg_insert_issued_receipt.c b/src/donaudb/pg_insert_issued_receipt.c
@@ -50,7 +50,8 @@ DH_PG_insert_issued_receipt (
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&charity_id),
DONAU_PQ_query_param_array_blinded_donation_unit_sig (num_blinded_sig,
- signatures, pc->conn),
+ signatures,
+ pc->conn),
GNUNET_PQ_query_param_auto_from_type (&h_receipt->hash),
TALER_PQ_query_param_amount (pc->conn,
amount_receipts_request),
@@ -68,7 +69,8 @@ DH_PG_insert_issued_receipt (
qs = GNUNET_PQ_eval_prepared_singleton_select (pc->conn,
"insert_issued_receipts_request",
- params, rs);
+ params,
+ rs);
GNUNET_PQ_cleanup_query_params_closures (params);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Is the new receipts_to_day smaller than the max_per_year (1 = true): %d\n",
diff --git a/src/donaudb/test_donaudb.c b/src/donaudb/test_donaudb.c
@@ -78,8 +78,13 @@ charities_cb (
struct TALER_Amount receipts_to_date,
uint64_t current_year)
{
- fprintf (stderr,
- "called charities_cb\n");
+ (void) cls;
+ (void) charity_pub;
+ (void) charity_name;
+ (void) charity_url;
+ (void) max_per_year;
+ (void) receipts_to_date;
+ (void) current_year;
return GNUNET_OK;
}
@@ -101,8 +106,11 @@ donation_unit_info_cb (
uint64_t validity_year,
struct TALER_Amount *value)
{
- fprintf (stderr,
- "called donation_unit_info_cb\n");
+ (void) cls;
+ (void) h_donation_unit_pub;
+ (void) donation_unit_pub;
+ (void) validity_year;
+ (void) value;
return GNUNET_OK;
}
@@ -120,8 +128,9 @@ iterate_active_signing_keys_cb (
const struct DONAU_DonauPublicKeyP *donau_pub,
struct DONAUDB_SignkeyMetaData *meta)
{
- fprintf (stderr,
- "called iterate_active_signing_keys_cb\n");
+ (void) cls;
+ (void) donau_pub;
+ (void) meta;
}
@@ -237,8 +246,9 @@ run (void *cls)
charity_id));
/* test insert donation unit */
- RND_BLK (&h_donation_unit_pub);
RND_BLK (&donation_unit_pub);
+ RND_BLK (&h_donation_unit_pub);
+
validity_year = 2024;
GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount (CURRENCY ":1.000010",
@@ -257,7 +267,7 @@ run (void *cls)
// &donation_unit_pub,
// validity_year,
// &du_value));
- //
+
// /* test iterate donation units */
// FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
// plugin->iterate_donation_units (plugin->cls,
@@ -283,20 +293,22 @@ run (void *cls)
NULL));
/* test insert issued receipt */
- RND_BLK (&du_sigs[0]);
+ RND_BLK (&du_sigs);
RND_BLK (&h_receipt);
smaller_than_max_per_year = false;
GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount (CURRENCY ":1.000010",
&amount_receipts));
- FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
- plugin->insert_issued_receipt (plugin->cls,
- 1,
- du_sigs,
- charity_id,
- &h_receipt,
- &amount_receipts,
- &smaller_than_max_per_year));
+
+ // FIXME
+ // FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
+ // plugin->insert_issued_receipt (plugin->cls,
+ // num_b_sigs,
+ // du_sigs,
+ // charity_id,
+ // &h_receipt,
+ // &amount_receipts,
+ // &smaller_than_max_per_year));
// FIXME
// FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
diff --git a/src/include/donau_crypto_lib.h b/src/include/donau_crypto_lib.h
@@ -512,120 +512,6 @@ TALER_donation_unit_pub_verify (const struct
const struct DONAU_BudiHashP *budi_hash);
-// FIXME: Copied from taler_crypto_lib.h, is anything of this necessary?
-///**
-// * Compute the hash of the given @a donation_unit_pub.
-// *
-// * @param donation_unit_pub public key to hash
-// * @param[out] h_donation_unit_pub resulting hash value
-// */
-// void
-// TALER_donation_unit_pub_hash (const struct DONAU_DonationUnitPublicKey *donation_unit_pub,
-// struct DONAU_DonationUnitHashP *h_donation_unit_pub);
-//
-//
-///**
-// * Make a (deep) copy of the given @a donation_unit_src to
-// * @a donation_unit_dst.
-// *
-// * @param[out] donation_unit_dst target to copy to
-// * @param donation_unit_src public key to copy
-// */
-// void
-// TALER_donation_unit_pub_deep_copy (struct DONAU_DonationUnitPublicKey *donation_unit_dst,
-// const struct DONAU_DonationUnitPublicKey *donation_unit_src);
-//
-//
-///**
-// * Make a (deep) copy of the given @a donation_unit_src to
-// * @a donation_unit_dst.
-// *
-// * @param[out] donation_unit_dst target to copy to
-// * @param donation_unit_src public key to copy
-// */
-// void
-// TALER_donation_unit_sig_deep_copy (struct DONAU_DonationUnitSignature *donation_unit_dst,
-// const struct DONAU_DonationUnitSignature *donation_unit_src);
-//
-//
-///**
-// * Make a (deep) copy of the given @a donation_unit_src to
-// * @a donation_unit_dst.
-// *
-// * @param[out] donation_unit_dst target to copy to
-// * @param donation_unit_src public key to copy
-// */
-// void
-// TALER_blinded_donation_unit_sig_deep_copy (
-// struct DONAU_BlindedDonationUnitSignature *donation_unit_dst,
-// const struct DONAU_BlindedDonationUnitSignature *donation_unit_src);
-//
-//
-///**
-// * Compare two donation unit public keys.
-// *
-// * @param donation_unit1 first key
-// * @param donation_unit2 second key
-// * @return 0 if the keys are equal, otherwise -1 or 1
-// */
-// int
-// TALER_donation_unit_pub_cmp (const struct DONAU_DonationUnitPublicKey *donation_unit1,
-// const struct DONAU_DonationUnitPublicKey *donation_unit2);
-//
-//
-///**
-// * Compare two donation unit signatures.
-// *
-// * @param sig1 first signature
-// * @param sig2 second signature
-// * @return 0 if the keys are equal, otherwise -1 or 1
-// */
-// int
-// TALER_donation_unit_sig_cmp (const struct DONAU_DonationUnitSignature *sig1,
-// const struct DONAU_DonationUnitSignature *sig2);
-//
-//
-///**
-// * Compare two blinded donation unit signatures.
-// *
-// * @param sig1 first signature
-// * @param sig2 second signature
-// * @return 0 if the keys are equal, otherwise -1 or 1
-// */
-// int
-// TALER_blinded_donation_unit_sig_cmp (
-// const struct DONAU_BlindedDonationUnitSignature *sig1,
-// const struct DONAU_BlindedDonationUnitSignature *sig2);
-//
-//
-///**
-// * Compare two blinded planchets.
-// *
-// * @param bp1 first blinded planchet
-// * @param bp2 second blinded planchet
-// * @return 0 if the keys are equal, otherwise -1 or 1
-// */
-// int
-// TALER_blinded_planchet_cmp (
-// const struct DONAU_BlindedPlanchet *bp1,
-// const struct DONAU_BlindedPlanchet *bp2);
-//
-//
-///**
-// * Verify signature made with a donation unit public key
-// * over a donation receipt.
-// *
-// * @param donation_unit_pub public donation unit key
-// * @param donation_unit_sig signature made with the private key
-// * @param c_hash hash over the coin
-// * @return #GNUNET_OK if the signature is valid
-// */
-// enum GNUNET_GenericReturnValue
-// TALER_donation_unit_pub_verify (const struct DONAU_DonationUnitPublicKey *donation_unit_pub,
-// const struct DONAU_DonationUnitSignature *donation_unit_sig,
-// const struct DONAU_ *c_hash);
-//
-
/* ********************* client blind/unblind ************************** */
/**