donau

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

commit e29f5517cd5b3bb9faeaedd35d4b94d47c2b78b2
parent 8102587826c463df5c699178e573ead8bef931be
Author: Matyja Lukas Adam <lukas.matyja@students.bfh.ch>
Date:   Mon, 20 Nov 2023 12:44:54 +0100

[util] troubleshooting eddsa signatures

Diffstat:
Msrc/util/charity_signatures.c | 25+++++++++++++++----------
Msrc/util/donau_signatures.c | 28++++++++++++++++------------
2 files changed, 31 insertions(+), 22 deletions(-)

diff --git a/src/util/charity_signatures.c b/src/util/charity_signatures.c @@ -46,7 +46,7 @@ struct TALER_BudiKeyPairTrackPS * List of BUDI-Key-Pairs. A BUID-Key-Pair contains the BUDI value which must be * signed (blindly) by the Donau. */ - struct TALER_BlindedUniqueDonationIdentifierKeyPair bkp; + struct GNUNET_HashCode bkps_hash; /** * num of bkps @@ -55,7 +55,7 @@ struct TALER_BudiKeyPairTrackPS }; GNUNET_NETWORK_STRUCT_END -/* + void DONAU_charity_budi_key_pair_sign ( const unsigned int num_bkp, @@ -64,12 +64,15 @@ DONAU_charity_budi_key_pair_sign ( struct TALER_CharitySignatureP *charity_sig) { struct TALER_BudiKeyPairTrackPS tps = { - .purpose.size = htonl (sizeof (bkp[0]) * num_bkp), .purpose.purpose = htonl (DONAU_SIGNATURE_CHARITY_DONATION_CONFIRMATION), - .num_bkp = htonl (num_bkp), - .bkp = *bkp + .purpose.size = htonl (sizeof (tps)), + .num_bkp = htonl (num_bkp) }; + GNUNET_CRYPTO_hash (bkp, + sizeof (bkp[0]) * num_bkp, + &tps.bkps_hash); + GNUNET_CRYPTO_eddsa_sign (&charity_priv->eddsa_priv, &tps, &charity_sig->eddsa_sig); @@ -79,24 +82,26 @@ DONAU_charity_budi_key_pair_sign ( enum GNUNET_GenericReturnValue DONAU_charity_budi_key_pair_verify ( const unsigned int num_bkp, - const struct DONAU_BlindedUniqueDonationIdentifierKeyPair *bkp[static - num_bkp], + const struct TALER_BlindedUniqueDonationIdentifierKeyPair *bkp[num_bkp], const struct TALER_DONAU_CharityPublicKeyP *charity_pub, const struct TALER_CharitySignatureP *charity_sig) { struct TALER_BudiKeyPairTrackPS tps = { .purpose.size = htonl (sizeof (bkp[0]) * num_bkp), .purpose.purpose = htonl (DONAU_SIGNATURE_CHARITY_DONATION_CONFIRMATION), - .num_bkp = num_bkp, - .bkp = *bkp + .num_bkp = htonl (num_bkp) }; + GNUNET_CRYPTO_hash (bkp, + sizeof (bkp[0]) * num_bkp, + &tps.bkps_hash); + return GNUNET_CRYPTO_eddsa_verify (DONAU_SIGNATURE_CHARITY_DONATION_CONFIRMATION, &tps, &charity_sig->eddsa_sig, &charity_pub->eddsa_pub); } -*/ + /* end of charity_signatures.c */ diff --git a/src/util/donau_signatures.c b/src/util/donau_signatures.c @@ -23,6 +23,7 @@ #include "taler/taler_util.h" #include "taler/taler_signatures.h" #include "donau_util.h" +#include "donau_signatures.h" GNUNET_NETWORK_STRUCT_BEGIN @@ -44,20 +45,20 @@ struct TALER_DonationStatementConfirmationPS struct TALER_AmountNBO amount_tot; /** - * The corresponding year. + * The hash of the identifier of the donor. */ - unsigned int year; + struct TALER_DONAU_HashDonorTaxId i; /** - * The hash of the identifier of the donor. + * The corresponding year. */ - struct TALER_DONAU_HashDonorTaxId i; + unsigned int year; }; GNUNET_NETWORK_STRUCT_END -/* + void DONAU_donation_statement_sign ( const struct TALER_Amount *amount_tot, @@ -69,18 +70,19 @@ DONAU_donation_statement_sign ( struct TALER_DonationStatementConfirmationPS tps = { .purpose.size = htonl (sizeof (struct TALER_DonationStatementConfirmationPS)), .purpose.purpose = htonl (DONAU_SIGNATURE_DONAU_DONATION_STATEMENT), - .amount_tot = *amount_tot, - .year = year, + .year = htonl (year), .i = *i }; + TALER_amount_hton (&tps.amount_tot, + amount_tot); + GNUNET_CRYPTO_eddsa_sign (&donau_priv->eddsa_priv, &tps, &statement_sig->eddsa_sig); } -*/ -/* + enum GNUNET_GenericReturnValue DONAU_donation_statement_verify ( const struct TALER_Amount *amount_tot, @@ -92,16 +94,18 @@ DONAU_donation_statement_verify ( struct TALER_DonationStatementConfirmationPS tps = { .purpose.size = htonl (sizeof (struct TALER_DonationStatementConfirmationPS)), .purpose.purpose = htonl (DONAU_SIGNATURE_DONAU_DONATION_STATEMENT), - .amount_tot = *amount_tot, - .year = year, + .year = htonl (year), .i = *i }; + TALER_amount_hton (&tps.amount_tot, + amount_tot); + return GNUNET_CRYPTO_eddsa_verify (DONAU_SIGNATURE_DONAU_DONATION_STATEMENT, &tps, &statement_sig->eddsa_sig, &donau_pub->eddsa_pub); } -*/ + /* end of donau_signatures.c */