aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-04-13 18:42:39 +0200
committerChristian Grothoff <christian@grothoff.org>2015-04-13 18:42:39 +0200
commit2f6a4bb11c04e657a90eb96abb27a90a9f020230 (patch)
tree1d3cd91db6f2d84148220f161a5942f9e994f319 /src/util
parent5827630699a725e24a59d94861b01bad310f6a02 (diff)
rename TALER_RefreshLinkDecryptedP to TALER_RefreshLinkDecrypted as it contains a pointer and is thus not (P)acked
Diffstat (limited to 'src/util')
-rw-r--r--src/util/crypto.c8
-rw-r--r--src/util/test_crypto.c31
2 files changed, 35 insertions, 4 deletions
diff --git a/src/util/crypto.c b/src/util/crypto.c
index e2c298da5..e6d6917bc 100644
--- a/src/util/crypto.c
+++ b/src/util/crypto.c
@@ -183,11 +183,11 @@ TALER_transfer_encrypt (const struct TALER_LinkSecretP *secret,
* @param secret shared secret to use for decryption
* @return NULL on error
*/
-struct TALER_RefreshLinkDecryptedP *
+struct TALER_RefreshLinkDecrypted *
TALER_refresh_decrypt (const struct TALER_RefreshLinkEncrypted *input,
const struct TALER_LinkSecretP *secret)
{
- struct TALER_RefreshLinkDecryptedP *ret;
+ struct TALER_RefreshLinkDecrypted *ret;
struct GNUNET_CRYPTO_SymmetricInitializationVector iv;
struct GNUNET_CRYPTO_SymmetricSessionKey skey;
size_t buf_size = input->blinding_key_enc_size
@@ -203,7 +203,7 @@ TALER_refresh_decrypt (const struct TALER_RefreshLinkEncrypted *input,
&iv,
buf))
return NULL;
- ret = GNUNET_new (struct TALER_RefreshLinkDecryptedP);
+ ret = GNUNET_new (struct TALER_RefreshLinkDecrypted);
memcpy (&ret->coin_priv,
buf,
sizeof (union TALER_CoinSpendPrivateKeyP));
@@ -227,7 +227,7 @@ TALER_refresh_decrypt (const struct TALER_RefreshLinkEncrypted *input,
* @return NULL on error (should never happen)
*/
struct TALER_RefreshLinkEncrypted *
-TALER_refresh_encrypt (const struct TALER_RefreshLinkDecryptedP *input,
+TALER_refresh_encrypt (const struct TALER_RefreshLinkDecrypted *input,
const struct TALER_LinkSecretP *secret)
{
char *b_buf;
diff --git a/src/util/test_crypto.c b/src/util/test_crypto.c
index a375bcfbb..55452c40d 100644
--- a/src/util/test_crypto.c
+++ b/src/util/test_crypto.c
@@ -28,10 +28,41 @@ int
main(int argc,
const char *const argv[])
{
+ struct TALER_EncryptedLinkSecretP secret_enc;
+ struct TALER_TransferSecretP trans_sec;
+ struct TALER_LinkSecretP secret;
+ struct TALER_RefreshLinkEncrypted *rl_enc;
+ struct TALER_RefreshLinkDecrypted rl;
+ struct GNUNET_CRYPTO_EcdhePrivateKey *pk;
+
+
GNUNET_log_setup ("test-crypto",
"WARNING",
NULL);
/* FIXME: implement test... */
+ GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
+ &secret,
+ sizeof (secret));
+ GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
+ &trans_sec,
+ sizeof (trans_sec));
+ GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
+ &rl.coin_priv,
+ sizeof (rl.coin_priv));
+ rl.blinding_key.rsa_blinding_key = GNUNET_CRYPTO_rsa_blinding_key_create ();
+ rl_enc = TALER_refresh_link_encrypt (&rl,
+ &secret);
+ GNUNET_assert (GNUNET_OK ==
+ TALER_transfer_encrypt (&secret,
+ &trans_sec,
+ &secret_enc));
+ pk = GNUNET_CRYPTO_ecdhe_key_create ();
+#if 0
+ .../.ecdhe_private_key = *pk;
+#endif
+
+ GNUNET_CRYPTO_rsa_blinding_key_free (rl.blinding_key);
+ GNUNET_free (pk);
return 0;
}