summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-12-25 13:56:33 +0100
committerChristian Grothoff <christian@grothoff.org>2021-12-25 13:56:40 +0100
commit87376e02eba3f5c2cf83a493446dee0c300565a4 (patch)
tree18103edb2bdf2b29a773cce2de596b06d8265abb /src/util
parent2c14d338704f4574055c4b5c51d8a79dd2e22345 (diff)
downloadexchange-87376e02eba3f5c2cf83a493446dee0c300565a4.tar.gz
exchange-87376e02eba3f5c2cf83a493446dee0c300565a4.tar.bz2
exchange-87376e02eba3f5c2cf83a493446dee0c300565a4.zip
protocol v12 changes (/recoup split, signature changes) plus database sharding plus O(n^2)=>O(n) worst-case complexity reduction on coin balance checks
Diffstat (limited to 'src/util')
-rw-r--r--src/util/wallet_signatures.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/util/wallet_signatures.c b/src/util/wallet_signatures.c
index f686b765c..9c3723b0a 100644
--- a/src/util/wallet_signatures.c
+++ b/src/util/wallet_signatures.c
@@ -107,6 +107,7 @@ TALER_wallet_deposit_verify (
void
TALER_wallet_link_sign (const struct TALER_DenominationHash *h_denom_pub,
const struct TALER_TransferPublicKeyP *transfer_pub,
+ // FIXME: consider passing hash!
const void *coin_ev,
size_t coin_ev_size,
const struct TALER_CoinSpendPrivateKeyP *old_coin_priv,
@@ -132,6 +133,7 @@ enum GNUNET_GenericReturnValue
TALER_wallet_link_verify (
const struct TALER_DenominationHash *h_denom_pub,
const struct TALER_TransferPublicKeyP *transfer_pub,
+ // FIXME: consider passing hash!
const void *coin_ev,
size_t coin_ev_size,
const struct TALER_CoinSpendPublicKeyP *old_coin_pub,
@@ -202,6 +204,53 @@ TALER_wallet_recoup_sign (
}
+enum GNUNET_GenericReturnValue
+TALER_wallet_recoup_refresh_verify (
+ const struct TALER_DenominationHash *h_denom_pub,
+ const union TALER_DenominationBlindingKeyP *coin_bks,
+ const struct TALER_Amount *requested_amount,
+ const struct TALER_CoinSpendPublicKeyP *coin_pub,
+ const struct TALER_CoinSpendSignatureP *coin_sig)
+{
+ struct TALER_RecoupRequestPS pr = {
+ .purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_RECOUP_REFRESH),
+ .purpose.size = htonl (sizeof (pr)),
+ .h_denom_pub = *h_denom_pub,
+ .coin_blind = *coin_bks
+ };
+
+ TALER_amount_hton (&pr.recoup_amount,
+ requested_amount);
+ return GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_WALLET_COIN_RECOUP_REFRESH,
+ &pr,
+ &coin_sig->eddsa_signature,
+ &coin_pub->eddsa_pub);
+}
+
+
+void
+TALER_wallet_recoup_refresh_sign (
+ const struct TALER_DenominationHash *h_denom_pub,
+ const union TALER_DenominationBlindingKeyP *coin_bks,
+ const struct TALER_Amount *requested_amount,
+ const struct TALER_CoinSpendPrivateKeyP *coin_priv,
+ struct TALER_CoinSpendSignatureP *coin_sig)
+{
+ struct TALER_RecoupRequestPS pr = {
+ .purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_RECOUP_REFRESH),
+ .purpose.size = htonl (sizeof (struct TALER_RecoupRequestPS)),
+ .h_denom_pub = *h_denom_pub,
+ .coin_blind = *coin_bks
+ };
+
+ TALER_amount_hton (&pr.recoup_amount,
+ requested_amount);
+ GNUNET_CRYPTO_eddsa_sign (&coin_priv->eddsa_priv,
+ &pr,
+ &coin_sig->eddsa_signature);
+}
+
+
void
TALER_wallet_melt_sign (
const struct TALER_Amount *amount_with_fee,