diff options
Diffstat (limited to 'src/util/wallet_signatures.c')
-rw-r--r-- | src/util/wallet_signatures.c | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/src/util/wallet_signatures.c b/src/util/wallet_signatures.c index 221865e73..823641ed4 100644 --- a/src/util/wallet_signatures.c +++ b/src/util/wallet_signatures.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2021, 2022 Taler Systems SA + Copyright (C) 2021-2023 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -17,10 +17,12 @@ * @file wallet_signatures.c * @brief Utility functions for Taler wallet signatures * @author Christian Grothoff + * @author Özgür Kesim */ #include "platform.h" #include "taler_util.h" #include "taler_signatures.h" +#include <gnunet/gnunet_common.h> GNUNET_NETWORK_STRUCT_BEGIN @@ -620,9 +622,9 @@ struct TALER_AgeWithdrawRequestPS struct GNUNET_CRYPTO_EccSignaturePurpose purpose; /** - * Hash of the commitment of n*kappa coins + * The reserve's public key */ - struct TALER_AgeWithdrawCommitmentHashP h_commitment GNUNET_PACKED; + struct TALER_ReservePublicKeyP reserve_pub; /** * Value of the coin being exchanged (matching the denomination key) @@ -634,9 +636,19 @@ struct TALER_AgeWithdrawRequestPS struct TALER_AmountNBO amount_with_fee; /** + * Running SHA512 hash of the commitment of n*kappa coins + */ + struct TALER_AgeWithdrawCommitmentHashP h_commitment; + + /** + * The mask that defines the age groups. MUST be the same for all denominations. + */ + struct TALER_AgeMask mask; + + /** * Maximum age group that the coins are going to be restricted to. */ - uint32_t max_age_group; + uint8_t max_age_group; }; @@ -646,7 +658,8 @@ void TALER_wallet_age_withdraw_sign ( const struct TALER_AgeWithdrawCommitmentHashP *h_commitment, const struct TALER_Amount *amount_with_fee, - uint32_t max_age_group, + const struct TALER_AgeMask *mask, + uint8_t max_age, const struct TALER_ReservePrivateKeyP *reserve_priv, struct TALER_ReserveSignatureP *reserve_sig) { @@ -654,9 +667,12 @@ TALER_wallet_age_withdraw_sign ( .purpose.size = htonl (sizeof (req)), .purpose.purpose = htonl (TALER_SIGNATURE_WALLET_RESERVE_AGE_WITHDRAW), .h_commitment = *h_commitment, - .max_age_group = max_age_group + .mask = *mask, + .max_age_group = TALER_get_age_group (mask, max_age) }; + GNUNET_CRYPTO_eddsa_key_get_public (&reserve_priv->eddsa_priv, + &req.reserve_pub.eddsa_pub); TALER_amount_hton (&req.amount_with_fee, amount_with_fee); GNUNET_CRYPTO_eddsa_sign (&reserve_priv->eddsa_priv, @@ -669,15 +685,18 @@ enum GNUNET_GenericReturnValue TALER_wallet_age_withdraw_verify ( const struct TALER_AgeWithdrawCommitmentHashP *h_commitment, const struct TALER_Amount *amount_with_fee, - uint32_t max_age_group, + const struct TALER_AgeMask *mask, + uint8_t max_age, const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_ReserveSignatureP *reserve_sig) { struct TALER_AgeWithdrawRequestPS awsrd = { .purpose.size = htonl (sizeof (awsrd)), .purpose.purpose = htonl (TALER_SIGNATURE_WALLET_RESERVE_AGE_WITHDRAW), + .reserve_pub = *reserve_pub, .h_commitment = *h_commitment, - .max_age_group = max_age_group + .mask = *mask, + .max_age_group = TALER_get_age_group (mask, max_age) }; TALER_amount_hton (&awsrd.amount_with_fee, |