summaryrefslogtreecommitdiff
path: root/src/exchange-tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/exchange-tools')
-rw-r--r--src/exchange-tools/key-helper.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/exchange-tools/key-helper.c b/src/exchange-tools/key-helper.c
index 281202bd7..0e3c0a2bb 100644
--- a/src/exchange-tools/key-helper.c
+++ b/src/exchange-tools/key-helper.c
@@ -60,21 +60,24 @@ get_and_check_master_key (const struct GNUNET_CONFIGURATION_Handle *cfg,
"Exchange master private key `%s' does not exist yet, creating it!\n",
fn);
{
- struct GNUNET_CRYPTO_EddsaPrivateKey *eddsa_priv;
+ int ret;
- eddsa_priv = GNUNET_CRYPTO_eddsa_key_create_from_file (fn);
- if (NULL == eddsa_priv)
+ ret = GNUNET_CRYPTO_eddsa_key_from_file (fn,
+ GNUNET_YES,
+ &master_priv->eddsa_priv);
+ if (GNUNET_OK != ret)
{
fprintf (stderr,
- "Failed to initialize master key from file `%s'\n",
- fn);
+ "Failed to initialize master key from file `%s': %s\n",
+ fn,
+ (GNUNET_NO == ret)
+ ? "file exists"
+ : "could not create file");
GNUNET_free (fn);
return GNUNET_SYSERR;
}
- master_priv->eddsa_priv = *eddsa_priv;
- GNUNET_CRYPTO_eddsa_key_get_public (eddsa_priv,
+ GNUNET_CRYPTO_eddsa_key_get_public (&master_priv->eddsa_priv,
&mpub);
- GNUNET_free (eddsa_priv);
}
/* Check our key matches that in the configuration */