aboutsummaryrefslogtreecommitdiff
path: root/src/util/denom.c
diff options
context:
space:
mode:
authorGian Demarmels <gian@demarmels.org>2021-12-22 12:52:54 +0100
committerGian Demarmels <gian@demarmels.org>2022-02-04 15:31:48 +0100
commita02ab8f81b68b59ef5228ce30583d9388f9bab4a (patch)
treeb292b8bb43e478d045c74b3892b1f40164f92855 /src/util/denom.c
parent385eb51e93e39842c0ccb2a6b12b87c66c7fbe26 (diff)
downloadexchange-a02ab8f81b68b59ef5228ce30583d9388f9bab4a.tar.xz
added CS get R functionality and planchet setup
Diffstat (limited to 'src/util/denom.c')
-rw-r--r--src/util/denom.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/util/denom.c b/src/util/denom.c
index 6ff92e894..6b587026e 100644
--- a/src/util/denom.c
+++ b/src/util/denom.c
@@ -82,6 +82,47 @@ TALER_denom_priv_create (struct TALER_DenominationPrivateKey *denom_priv,
enum GNUNET_GenericReturnValue
+TALER_denom_cs_derive_r_secret (const struct TALER_WithdrawNonce *nonce,
+ const struct
+ TALER_DenominationPrivateKey *denom_priv,
+ struct TALER_DenominationCsPrivateR *r)
+{
+ if (denom_priv->cipher != TALER_DENOMINATION_CS)
+ {
+ GNUNET_break (0);
+ return GNUNET_SYSERR;
+ }
+
+ GNUNET_CRYPTO_cs_r_derive (&nonce->nonce,
+ &denom_priv->details.cs_private_key,
+ r->r);
+ return GNUNET_OK;
+}
+
+
+enum GNUNET_GenericReturnValue
+TALER_denom_cs_derive_r_public (const struct TALER_WithdrawNonce *nonce,
+ const struct
+ TALER_DenominationPrivateKey *denom_priv,
+ struct TALER_DenominationCsPublicR *r_pub)
+{
+ if (denom_priv->cipher != TALER_DENOMINATION_CS)
+ {
+ GNUNET_break (0);
+ return GNUNET_SYSERR;
+ }
+
+ struct GNUNET_CRYPTO_CsRSecret r[2];
+ GNUNET_CRYPTO_cs_r_derive (&nonce->nonce,
+ &denom_priv->details.cs_private_key,
+ r);
+ GNUNET_CRYPTO_cs_r_get_public (&r[0], &r_pub->r_pub[0]);
+ GNUNET_CRYPTO_cs_r_get_public (&r[1], &r_pub->r_pub[1]);
+ return GNUNET_OK;
+}
+
+
+enum GNUNET_GenericReturnValue
TALER_denom_sign_blinded (struct TALER_BlindedDenominationSignature *denom_sig,
const struct TALER_DenominationPrivateKey *denom_priv,
const struct TALER_BlindedPlanchet *blinded_planchet)