adapations related to GNUnet fixing #6149
This commit is contained in:
parent
44272bf1ce
commit
4b60d2540f
@ -479,7 +479,7 @@ auditor_serve_process_config (void)
|
|||||||
{
|
{
|
||||||
/* Fall back to trying to read private key */
|
/* Fall back to trying to read private key */
|
||||||
char *auditor_key_file;
|
char *auditor_key_file;
|
||||||
struct GNUNET_CRYPTO_EddsaPrivateKey *eddsa_priv;
|
struct GNUNET_CRYPTO_EddsaPrivateKey eddsa_priv;
|
||||||
|
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
GNUNET_CONFIGURATION_get_value_filename (cfg,
|
GNUNET_CONFIGURATION_get_value_filename (cfg,
|
||||||
@ -495,8 +495,10 @@ auditor_serve_process_config (void)
|
|||||||
"AUDITOR_PRIV_FILE");
|
"AUDITOR_PRIV_FILE");
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
eddsa_priv = GNUNET_CRYPTO_eddsa_key_create_from_file (auditor_key_file);
|
if (GNUNET_OK !=
|
||||||
if (NULL == eddsa_priv)
|
GNUNET_CRYPTO_eddsa_key_from_file (auditor_key_file,
|
||||||
|
GNUNET_NO,
|
||||||
|
&eddsa_priv))
|
||||||
{
|
{
|
||||||
/* Both failed, complain! */
|
/* Both failed, complain! */
|
||||||
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
|
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
|
||||||
@ -509,9 +511,8 @@ auditor_serve_process_config (void)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
GNUNET_free (auditor_key_file);
|
GNUNET_free (auditor_key_file);
|
||||||
GNUNET_CRYPTO_eddsa_key_get_public (eddsa_priv,
|
GNUNET_CRYPTO_eddsa_key_get_public (&eddsa_priv,
|
||||||
&auditor_pub.eddsa_pub);
|
&auditor_pub.eddsa_pub);
|
||||||
GNUNET_free (eddsa_priv);
|
|
||||||
}
|
}
|
||||||
return GNUNET_OK;
|
return GNUNET_OK;
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ main (int argc,
|
|||||||
GNUNET_GETOPT_option_verbose (&verbose),
|
GNUNET_GETOPT_option_verbose (&verbose),
|
||||||
GNUNET_GETOPT_OPTION_END
|
GNUNET_GETOPT_OPTION_END
|
||||||
};
|
};
|
||||||
struct GNUNET_CRYPTO_EddsaPrivateKey *eddsa_priv;
|
struct GNUNET_CRYPTO_EddsaPrivateKey eddsa_priv;
|
||||||
struct TALER_AuditorSignatureP *sigs;
|
struct TALER_AuditorSignatureP *sigs;
|
||||||
struct TALER_AuditorPublicKeyP apub;
|
struct TALER_AuditorPublicKeyP apub;
|
||||||
struct GNUNET_DISK_FileHandle *fh;
|
struct GNUNET_DISK_FileHandle *fh;
|
||||||
@ -239,20 +239,17 @@ main (int argc,
|
|||||||
"Auditor URL not given in neither configuration nor command-line\n");
|
"Auditor URL not given in neither configuration nor command-line\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (GNUNET_YES !=
|
if (GNUNET_SYSERR ==
|
||||||
GNUNET_DISK_file_test (auditor_key_file))
|
GNUNET_CRYPTO_eddsa_key_from_file (auditor_key_file,
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
GNUNET_YES,
|
||||||
"Auditor private key `%s' does not exist yet, creating it!\n",
|
&eddsa_priv))
|
||||||
auditor_key_file);
|
|
||||||
eddsa_priv = GNUNET_CRYPTO_eddsa_key_create_from_file (auditor_key_file);
|
|
||||||
if (NULL == eddsa_priv)
|
|
||||||
{
|
{
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
"Failed to initialize auditor key from file `%s'\n",
|
"Failed to initialize auditor private key from file `%s'\n",
|
||||||
auditor_key_file);
|
auditor_key_file);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
GNUNET_CRYPTO_eddsa_key_get_public (eddsa_priv,
|
GNUNET_CRYPTO_eddsa_key_get_public (&eddsa_priv,
|
||||||
&apub.eddsa_pub);
|
&apub.eddsa_pub);
|
||||||
fh = GNUNET_DISK_file_open (exchange_request_file,
|
fh = GNUNET_DISK_file_open (exchange_request_file,
|
||||||
GNUNET_DISK_OPEN_READ,
|
GNUNET_DISK_OPEN_READ,
|
||||||
@ -263,7 +260,6 @@ main (int argc,
|
|||||||
"Failed to open file `%s': %s\n",
|
"Failed to open file `%s': %s\n",
|
||||||
exchange_request_file,
|
exchange_request_file,
|
||||||
strerror (errno));
|
strerror (errno));
|
||||||
GNUNET_free (eddsa_priv);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
@ -275,7 +271,6 @@ main (int argc,
|
|||||||
exchange_request_file,
|
exchange_request_file,
|
||||||
strerror (errno));
|
strerror (errno));
|
||||||
GNUNET_DISK_file_close (fh);
|
GNUNET_DISK_file_close (fh);
|
||||||
GNUNET_free (eddsa_priv);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (0 != (in_size % sizeof (struct TALER_DenominationKeyValidityPS)))
|
if (0 != (in_size % sizeof (struct TALER_DenominationKeyValidityPS)))
|
||||||
@ -284,7 +279,6 @@ main (int argc,
|
|||||||
"Input file size of file `%s' is invalid\n",
|
"Input file size of file `%s' is invalid\n",
|
||||||
exchange_request_file);
|
exchange_request_file);
|
||||||
GNUNET_DISK_file_close (fh);
|
GNUNET_DISK_file_close (fh);
|
||||||
GNUNET_free (eddsa_priv);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
dki_len = in_size / sizeof (struct TALER_DenominationKeyValidityPS);
|
dki_len = in_size / sizeof (struct TALER_DenominationKeyValidityPS);
|
||||||
@ -293,7 +287,6 @@ main (int argc,
|
|||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
"Failed to produce auditor signature, denomination list is empty.\n");
|
"Failed to produce auditor signature, denomination list is empty.\n");
|
||||||
GNUNET_DISK_file_close (fh);
|
GNUNET_DISK_file_close (fh);
|
||||||
GNUNET_free (eddsa_priv);
|
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
if (NULL ==
|
if (NULL ==
|
||||||
@ -302,7 +295,6 @@ main (int argc,
|
|||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
"Failed to initialize auditor database plugin.\n");
|
"Failed to initialize auditor database plugin.\n");
|
||||||
GNUNET_DISK_file_close (fh);
|
GNUNET_DISK_file_close (fh);
|
||||||
GNUNET_free (eddsa_priv);
|
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -326,7 +318,6 @@ main (int argc,
|
|||||||
TALER_AUDITORDB_plugin_unload (adb);
|
TALER_AUDITORDB_plugin_unload (adb);
|
||||||
GNUNET_DISK_file_close (fh);
|
GNUNET_DISK_file_close (fh);
|
||||||
GNUNET_free (dki);
|
GNUNET_free (dki);
|
||||||
GNUNET_free (eddsa_priv);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
GNUNET_DISK_file_close (fh);
|
GNUNET_DISK_file_close (fh);
|
||||||
@ -350,7 +341,7 @@ main (int argc,
|
|||||||
kv.denom_hash = dk->denom_hash;
|
kv.denom_hash = dk->denom_hash;
|
||||||
|
|
||||||
/* Finally sign ... */
|
/* Finally sign ... */
|
||||||
GNUNET_CRYPTO_eddsa_sign (eddsa_priv,
|
GNUNET_CRYPTO_eddsa_sign (&eddsa_priv,
|
||||||
&kv,
|
&kv,
|
||||||
&sigs[i].eddsa_sig);
|
&sigs[i].eddsa_sig);
|
||||||
}
|
}
|
||||||
@ -362,7 +353,6 @@ main (int argc,
|
|||||||
TALER_AUDITORDB_plugin_unload (adb);
|
TALER_AUDITORDB_plugin_unload (adb);
|
||||||
GNUNET_free (dki);
|
GNUNET_free (dki);
|
||||||
GNUNET_free (sigs);
|
GNUNET_free (sigs);
|
||||||
GNUNET_free (eddsa_priv);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -375,7 +365,6 @@ main (int argc,
|
|||||||
TALER_AUDITORDB_plugin_unload (adb);
|
TALER_AUDITORDB_plugin_unload (adb);
|
||||||
GNUNET_free (dki);
|
GNUNET_free (dki);
|
||||||
GNUNET_free (sigs);
|
GNUNET_free (sigs);
|
||||||
GNUNET_free (eddsa_priv);
|
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -396,7 +385,6 @@ main (int argc,
|
|||||||
TALER_AUDITORDB_plugin_unload (adb);
|
TALER_AUDITORDB_plugin_unload (adb);
|
||||||
GNUNET_free (dki);
|
GNUNET_free (dki);
|
||||||
GNUNET_free (sigs);
|
GNUNET_free (sigs);
|
||||||
GNUNET_free (eddsa_priv);
|
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
for (unsigned int i = 0; i<dki_len; i++)
|
for (unsigned int i = 0; i<dki_len; i++)
|
||||||
@ -416,7 +404,6 @@ main (int argc,
|
|||||||
TALER_AUDITORDB_plugin_unload (adb);
|
TALER_AUDITORDB_plugin_unload (adb);
|
||||||
GNUNET_free (dki);
|
GNUNET_free (dki);
|
||||||
GNUNET_free (sigs);
|
GNUNET_free (sigs);
|
||||||
GNUNET_free (eddsa_priv);
|
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -443,7 +430,6 @@ main (int argc,
|
|||||||
}
|
}
|
||||||
GNUNET_free (sigs);
|
GNUNET_free (sigs);
|
||||||
GNUNET_free (dki);
|
GNUNET_free (dki);
|
||||||
GNUNET_free (eddsa_priv);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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",
|
"Exchange master private key `%s' does not exist yet, creating it!\n",
|
||||||
fn);
|
fn);
|
||||||
{
|
{
|
||||||
struct GNUNET_CRYPTO_EddsaPrivateKey *eddsa_priv;
|
int ret;
|
||||||
|
|
||||||
eddsa_priv = GNUNET_CRYPTO_eddsa_key_create_from_file (fn);
|
ret = GNUNET_CRYPTO_eddsa_key_from_file (fn,
|
||||||
if (NULL == eddsa_priv)
|
GNUNET_YES,
|
||||||
|
&master_priv->eddsa_priv);
|
||||||
|
if (GNUNET_OK != ret)
|
||||||
{
|
{
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
"Failed to initialize master key from file `%s'\n",
|
"Failed to initialize master key from file `%s': %s\n",
|
||||||
fn);
|
fn,
|
||||||
|
(GNUNET_NO == ret)
|
||||||
|
? "file exists"
|
||||||
|
: "could not create file");
|
||||||
GNUNET_free (fn);
|
GNUNET_free (fn);
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
master_priv->eddsa_priv = *eddsa_priv;
|
GNUNET_CRYPTO_eddsa_key_get_public (&master_priv->eddsa_priv,
|
||||||
GNUNET_CRYPTO_eddsa_key_get_public (eddsa_priv,
|
|
||||||
&mpub);
|
&mpub);
|
||||||
GNUNET_free (eddsa_priv);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check our key matches that in the configuration */
|
/* Check our key matches that in the configuration */
|
||||||
|
@ -304,7 +304,6 @@ admin_add_incoming_run (void *cls,
|
|||||||
{
|
{
|
||||||
char *section;
|
char *section;
|
||||||
char *keys;
|
char *keys;
|
||||||
struct GNUNET_CRYPTO_EddsaPrivateKey *priv;
|
|
||||||
struct GNUNET_CONFIGURATION_Handle *cfg;
|
struct GNUNET_CONFIGURATION_Handle *cfg;
|
||||||
|
|
||||||
GNUNET_assert (NULL != fts->config_filename);
|
GNUNET_assert (NULL != fts->config_filename);
|
||||||
@ -336,21 +335,22 @@ admin_add_incoming_run (void *cls,
|
|||||||
TALER_TESTING_interpreter_fail (is);
|
TALER_TESTING_interpreter_fail (is);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
priv = GNUNET_CRYPTO_eddsa_key_create_from_file (keys);
|
if (GNUNET_OK !=
|
||||||
GNUNET_free (keys);
|
GNUNET_CRYPTO_eddsa_key_from_file (keys,
|
||||||
if (NULL == priv)
|
GNUNET_NO,
|
||||||
|
&fts->reserve_priv.eddsa_priv))
|
||||||
{
|
{
|
||||||
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
|
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
|
||||||
section,
|
section,
|
||||||
"TIP_RESERVE_PRIV_FILENAME",
|
"TIP_RESERVE_PRIV_FILENAME",
|
||||||
"Failed to read private key");
|
"Failed to read private key");
|
||||||
GNUNET_free (section);
|
GNUNET_free (section);
|
||||||
|
GNUNET_free (keys);
|
||||||
TALER_TESTING_interpreter_fail (is);
|
TALER_TESTING_interpreter_fail (is);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fts->reserve_priv.eddsa_priv = *priv;
|
GNUNET_free (keys);
|
||||||
GNUNET_free (section);
|
GNUNET_free (section);
|
||||||
GNUNET_free (priv);
|
|
||||||
GNUNET_CONFIGURATION_destroy (cfg);
|
GNUNET_CONFIGURATION_destroy (cfg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user