summaryrefslogtreecommitdiff
path: root/src/util/crypto.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-08-08 19:52:05 +0200
committerChristian Grothoff <christian@grothoff.org>2015-08-08 19:52:05 +0200
commit00d613728fdddf4f28e3c50cb2f70bfbba65e298 (patch)
tree0c4fb7fcf4befb711aa6cbf64ee4e40404c3a096 /src/util/crypto.c
parentce4f6e2106ffe5b92fecef502c7ca3f7fd211a43 (diff)
downloadexchange-00d613728fdddf4f28e3c50cb2f70bfbba65e298.tar.gz
exchange-00d613728fdddf4f28e3c50cb2f70bfbba65e298.tar.bz2
exchange-00d613728fdddf4f28e3c50cb2f70bfbba65e298.zip
completing TALER_MINT_refresh_melt implementation
Diffstat (limited to 'src/util/crypto.c')
-rw-r--r--src/util/crypto.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/util/crypto.c b/src/util/crypto.c
index b803b960a..edc300878 100644
--- a/src/util/crypto.c
+++ b/src/util/crypto.c
@@ -163,6 +163,34 @@ TALER_transfer_decrypt (const struct TALER_EncryptedLinkSecretP *secret_enc,
/**
+ * Given the coin and the transfer private keys, compute the
+ * transfer secret. (Technically, we only need one of the two
+ * private keys, but the caller currently trivially only has
+ * the two private keys, so we derive one of the public keys
+ * internally to this function.)
+ *
+ * @param coin_priv coin key
+ * @param trans_priv transfer private key
+ * @param[out] computed transfer secret
+ */
+void
+TALER_link_derive_transfer_secret (const struct TALER_CoinSpendPrivateKeyP *coin_priv,
+ const struct TALER_TransferPrivateKeyP *trans_priv,
+ struct TALER_TransferSecretP *ts)
+{
+ struct TALER_CoinSpendPublicKeyP coin_pub;
+
+ GNUNET_CRYPTO_eddsa_key_get_public (&coin_priv->eddsa_priv,
+ &coin_pub.eddsa_pub);
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_CRYPTO_ecdh_eddsa (&trans_priv->ecdhe_priv,
+ &coin_pub.eddsa_pub,
+ &ts->key));
+
+}
+
+
+/**
* Use the @a trans_sec (from ECDHE) to encrypt the @a secret
* to obtain the @a secret_enc.
*