[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-donau] branch master updated: [util] solve charity signature prob
From: |
gnunet |
Subject: |
[taler-donau] branch master updated: [util] solve charity signature problem |
Date: |
Fri, 12 Apr 2024 11:30:08 +0200 |
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 20adecc [util] solve charity signature problem
20adecc is described below
commit 20adecc9bbab9a6e5550e7c05816171720a0f329
Author: Matyja Lukas Adam <lukas.matyja@students.bfh.ch>
AuthorDate: Fri Apr 12 11:29:44 2024 +0200
[util] solve charity signature problem
---
src/donau/donau-httpd_post-batch-issue.c | 27 ++++++++++++------------
src/include/donau_crypto_lib.h | 4 ++--
src/util/charity_signatures.c | 36 +++++++++++++++++++++++++-------
3 files changed, 43 insertions(+), 24 deletions(-)
diff --git a/src/donau/donau-httpd_post-batch-issue.c
b/src/donau/donau-httpd_post-batch-issue.c
index dc383c7..cd94e91 100644
--- a/src/donau/donau-httpd_post-batch-issue.c
+++ b/src/donau/donau-httpd_post-batch-issue.c
@@ -234,19 +234,19 @@ DH_handler_issue_receipts_post (struct DH_RequestContext
*rc,
"got charity from db!\n");
/* verify charity signature */
// FIXME
-// if (GNUNET_OK !=
-// DONAU_charity_budi_key_pair_verify (num_bkp,
-// irc.bkp,
-// &charity_meta.charity_pub,
-// &irc.charity_sig))
-// {
-// GNUNET_break_op (0);
-// return TALER_MHD_reply_with_error (
-// rc->connection,
-// MHD_HTTP_FORBIDDEN,
-// TALER_EC_DONAU_CHARITY_SIGNATURE_INVALID,
-// NULL);
-// }
+ if (GNUNET_OK !=
+ DONAU_charity_budi_key_pair_verify (num_bkp,
+ irc.bkp,
+ &charity_meta.charity_pub,
+ &irc.charity_sig))
+ {
+ GNUNET_break_op (0);
+ return TALER_MHD_reply_with_error (
+ rc->connection,
+ MHD_HTTP_FORBIDDEN,
+ TALER_EC_DONAU_CHARITY_SIGNATURE_INVALID,
+ NULL);
+ }
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"charity signature valid!\n");
@@ -321,7 +321,6 @@ start:
MHD_RESULT mret;
struct DH_DonationUnitKey *dk;
- // FIXME always public key not found
if (NULL == (dk = DH_keys_donation_unit_by_hash (
&irc.bkp[i].h_donation_unit_pub)))
return TALER_MHD_reply_with_error (rc->connection,
diff --git a/src/include/donau_crypto_lib.h b/src/include/donau_crypto_lib.h
index b047c55..c4198f4 100644
--- a/src/include/donau_crypto_lib.h
+++ b/src/include/donau_crypto_lib.h
@@ -304,7 +304,7 @@ struct DONAU_BudiHashP
*/
void
DONAU_charity_budi_key_pair_sign (
- const unsigned int num_bkp,
+ const size_t num_bkp,
const struct DONAU_BlindedUniqueDonationIdentifierKeyPair *bkp,
const struct DONAU_CharityPrivateKeyP *charity_priv,
struct DONAU_CharitySignatureP *charity_sig);
@@ -321,7 +321,7 @@ DONAU_charity_budi_key_pair_sign (
*/
enum GNUNET_GenericReturnValue
DONAU_charity_budi_key_pair_verify (
- const unsigned int num_bkp,
+ const size_t num_bkp,
const struct DONAU_BlindedUniqueDonationIdentifierKeyPair *bkp,
const struct DONAU_CharityPublicKeyP *charity_pub,
const struct DONAU_CharitySignatureP *charity_sig);
diff --git a/src/util/charity_signatures.c b/src/util/charity_signatures.c
index f9f5df8..bbe1711 100644
--- a/src/util/charity_signatures.c
+++ b/src/util/charity_signatures.c
@@ -58,7 +58,7 @@ GNUNET_NETWORK_STRUCT_END
void
DONAU_charity_budi_key_pair_sign (
- const unsigned int num_bkp,
+ const size_t num_bkp,
const struct DONAU_BlindedUniqueDonationIdentifierKeyPair *bkp,
const struct DONAU_CharityPrivateKeyP *charity_priv,
struct DONAU_CharitySignatureP *charity_sig)
@@ -69,9 +69,19 @@ DONAU_charity_budi_key_pair_sign (
.num_bkp = htonl (num_bkp)
};
- GNUNET_CRYPTO_hash (bkp,
- sizeof (struct
DONAU_BlindedUniqueDonationIdentifierKeyPair) * num_bkp,
- &tps.bkps_hash);
+ struct GNUNET_HashContext *hc;
+ hc = GNUNET_CRYPTO_hash_context_start ();
+ for (unsigned int i = 0; i < num_bkp; i++)
+ {
+ GNUNET_CRYPTO_hash_context_read (hc,
+ &bkp[i].h_donation_unit_pub,
+ sizeof (bkp[i].h_donation_unit_pub));
+ GNUNET_CRYPTO_hash_context_read (hc,
+ bkp[i].blinded_udi.blinded_message,
+ sizeof
(bkp[i].blinded_udi.blinded_message));
+ }
+ GNUNET_CRYPTO_hash_context_finish (hc,
+ &tps.bkps_hash);
GNUNET_CRYPTO_eddsa_sign (&charity_priv->eddsa_priv,
&tps,
@@ -81,7 +91,7 @@ DONAU_charity_budi_key_pair_sign (
enum GNUNET_GenericReturnValue
DONAU_charity_budi_key_pair_verify (
- const unsigned int num_bkp,
+ const size_t num_bkp,
const struct DONAU_BlindedUniqueDonationIdentifierKeyPair *bkp,
const struct DONAU_CharityPublicKeyP *charity_pub,
const struct DONAU_CharitySignatureP *charity_sig)
@@ -92,9 +102,19 @@ DONAU_charity_budi_key_pair_verify (
.num_bkp = htonl (num_bkp)
};
- GNUNET_CRYPTO_hash (bkp,
- sizeof (struct
DONAU_BlindedUniqueDonationIdentifierKeyPair) * num_bkp,
- &tps.bkps_hash);
+ struct GNUNET_HashContext *hc;
+ hc = GNUNET_CRYPTO_hash_context_start ();
+ for (unsigned int i = 0; i < num_bkp; i++)
+ {
+ GNUNET_CRYPTO_hash_context_read (hc,
+ &bkp[i].h_donation_unit_pub,
+ sizeof (bkp[i].h_donation_unit_pub));
+ GNUNET_CRYPTO_hash_context_read (hc,
+ bkp[i].blinded_udi.blinded_message,
+ sizeof
(bkp[i].blinded_udi.blinded_message));
+ }
+ GNUNET_CRYPTO_hash_context_finish (hc,
+ &tps.bkps_hash);
return
GNUNET_CRYPTO_eddsa_verify (DONAU_SIGNATURE_CHARITY_DONATION_CONFIRMATION,
--
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: [util] solve charity signature problem,
gnunet <=