summaryrefslogtreecommitdiff
path: root/src/util/wallet_signatures.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-12-16 20:18:44 +0100
committerChristian Grothoff <christian@grothoff.org>2021-12-16 20:18:44 +0100
commit1acc851deb38c52e4212823100eec8a00d5f385a (patch)
tree67d62b84291996a0def04e9cec16e06025a285ed /src/util/wallet_signatures.c
parent3b6a0dd5994b824ecbf246bb17e5be7611e89386 (diff)
downloadexchange-1acc851deb38c52e4212823100eec8a00d5f385a.tar.gz
exchange-1acc851deb38c52e4212823100eec8a00d5f385a.tar.bz2
exchange-1acc851deb38c52e4212823100eec8a00d5f385a.zip
-fix recoup ugliness
Diffstat (limited to 'src/util/wallet_signatures.c')
-rw-r--r--src/util/wallet_signatures.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/util/wallet_signatures.c b/src/util/wallet_signatures.c
index b895de14b..81ce9cc5f 100644
--- a/src/util/wallet_signatures.c
+++ b/src/util/wallet_signatures.c
@@ -155,4 +155,51 @@ TALER_wallet_link_verify (
}
+enum GNUNET_GenericReturnValue
+TALER_wallet_recoup_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),
+ .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,
+ &pr,
+ &coin_sig->eddsa_signature,
+ &coin_pub->eddsa_pub);
+}
+
+
+void
+TALER_wallet_recoup_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),
+ .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);
+}
+
+
/* end of wallet_signatures.c */