commit 5efb46bd255dd71b30d55b460987620837af1218
parent c2c2c116755c2cc6ebcac07ad1dc6012ba660ff1
Author: Christian Grothoff <christian@grothoff.org>
Date: Mon, 16 Mar 2026 01:40:16 +0100
convert exchange to new libgnunetutil API
Diffstat:
35 files changed, 848 insertions(+), 724 deletions(-)
diff --git a/src/auditor/taler-auditor-httpd.c b/src/auditor/taler-auditor-httpd.c
@@ -286,14 +286,13 @@ check_auth (const char *token)
return GNUNET_SYSERR;
token += strlen (RFC_8959_PREFIX);
GNUNET_assert (GNUNET_YES ==
- GNUNET_CRYPTO_kdf (&val,
- sizeof (val),
- KDF_SALT,
- strlen (KDF_SALT),
- token,
- strlen (token),
- NULL,
- 0));
+ GNUNET_CRYPTO_hkdf_gnunet (
+ &val,
+ sizeof (val),
+ KDF_SALT,
+ strlen (KDF_SALT),
+ token,
+ strlen (token)));
/* We compare hashes instead of directly comparing
tokens to minimize side-channel attacks on token length */
return (0 ==
@@ -1363,14 +1362,13 @@ run (void *cls,
else
{
GNUNET_assert (GNUNET_YES ==
- GNUNET_CRYPTO_kdf (&TAH_auth,
- sizeof (TAH_auth),
- KDF_SALT,
- strlen (KDF_SALT),
- tok,
- strlen (tok),
- NULL,
- 0));
+ GNUNET_CRYPTO_hkdf_gnunet (
+ &TAH_auth,
+ sizeof (TAH_auth),
+ KDF_SALT,
+ strlen (KDF_SALT),
+ tok,
+ strlen (tok)));
}
}
diff --git a/src/exchangedb/pg_compute_shard.c b/src/exchangedb/pg_compute_shard.c
@@ -32,13 +32,13 @@ TEH_PG_compute_shard (const struct TALER_MerchantPublicKeyP *merchant_pub)
uint32_t res;
GNUNET_assert (GNUNET_YES ==
- GNUNET_CRYPTO_kdf (&res,
- sizeof (res),
- merchant_pub,
- sizeof (*merchant_pub),
- "VOID",
- 4,
- NULL, 0));
+ GNUNET_CRYPTO_hkdf_gnunet (
+ &res,
+ sizeof (res),
+ merchant_pub,
+ sizeof (*merchant_pub),
+ "VOID",
+ 4));
/* interpret hash result as NBO for platform independence,
convert to HBO and map to [0..2^31-1] range */
res = ntohl (res);
diff --git a/src/include/taler/taler_testing_lib.h b/src/include/taler/taler_testing_lib.h
@@ -1850,7 +1850,7 @@ TALER_TESTING_cmd_revoke (const char *label,
*/
struct TALER_TESTING_Command
TALER_TESTING_cmd_signal (const char *label,
- struct GNUNET_OS_Process *process,
+ struct GNUNET_Process *process,
int signal);
@@ -2835,7 +2835,7 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits,
op (relative_time, const struct GNUNET_TIME_Relative) \
op (fakebank, struct TALER_FAKEBANK_Handle) \
op (keys, struct TALER_EXCHANGE_Keys) \
- op (process, struct GNUNET_OS_Process *)
+ op (process, struct GNUNET_Process *)
/**
diff --git a/src/json/conversion.c b/src/json/conversion.c
@@ -39,7 +39,7 @@ struct TALER_JSON_ExternalConversion
/**
* Handle to the helper process.
*/
- struct GNUNET_OS_Process *helper;
+ struct GNUNET_Process *helper;
/**
* Pipe for the stdin of the @e helper.
@@ -268,7 +268,7 @@ child_done_cb (void *cls,
(int) type,
(unsigned long long) exit_code,
(unsigned long long) ec->read_pos);
- GNUNET_OS_process_destroy (ec->helper);
+ GNUNET_process_destroy (ec->helper);
ec->helper = NULL;
if (0 != ec->read_pos)
{
@@ -315,13 +315,20 @@ TALER_JSON_external_conversion_start (const json_t *input,
GNUNET_assert (NULL != pipe_stdin);
pipe_stdout = GNUNET_DISK_pipe (GNUNET_DISK_PF_BLOCKING_WRITE);
GNUNET_assert (NULL != pipe_stdout);
- ec->helper = GNUNET_OS_start_process_vap (GNUNET_OS_INHERIT_STD_ERR,
- pipe_stdin,
- pipe_stdout,
- NULL,
- binary,
- (char *const *) argv);
- if (NULL == ec->helper)
+ ec->helper = GNUNET_process_create ();
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_process_set_options (
+ ec->helper,
+ GNUNET_process_option_inherit_rpipe (pipe_stdin,
+ STDIN_FILENO),
+ GNUNET_process_option_inherit_wpipe (pipe_stdout,
+ STDOUT_FILENO)));
+ if ( (GNUNET_OK !=
+ GNUNET_process_set_command_argv (ec->helper,
+ binary,
+ argv)) ||
+ (GNUNET_OK !=
+ GNUNET_process_start (ec->helper)) )
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Failed to run conversion helper `%s'\n",
@@ -330,6 +337,7 @@ TALER_JSON_external_conversion_start (const json_t *input,
GNUNET_DISK_pipe_close (pipe_stdin));
GNUNET_break (GNUNET_OK ==
GNUNET_DISK_pipe_close (pipe_stdout));
+ GNUNET_process_destroy (ec->helper);
GNUNET_free (ec);
return NULL;
}
@@ -343,7 +351,8 @@ TALER_JSON_external_conversion_start (const json_t *input,
GNUNET_DISK_pipe_close (pipe_stdin));
GNUNET_break (GNUNET_OK ==
GNUNET_DISK_pipe_close (pipe_stdout));
- ec->write_buf = json_dumps (input, JSON_COMPACT);
+ ec->write_buf = json_dumps (input,
+ JSON_COMPACT);
ec->write_size = strlen (ec->write_buf);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Passing %llu bytes to JSON conversion tool\n",
@@ -376,10 +385,11 @@ TALER_JSON_external_conversion_stop (
}
if (NULL != ec->helper)
{
- GNUNET_break (0 ==
- GNUNET_OS_process_kill (ec->helper,
- SIGKILL));
- GNUNET_OS_process_destroy (ec->helper);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_process_kill (ec->helper,
+ SIGKILL));
+ GNUNET_process_destroy (ec->helper);
+ ec->helper = NULL;
}
if (NULL != ec->read_task)
{
diff --git a/src/json/json.c b/src/json/json.c
@@ -108,14 +108,13 @@ dump_and_hash (const json_t *json,
else
{
if (GNUNET_YES !=
- GNUNET_CRYPTO_kdf (hc,
- sizeof (*hc),
- salt,
- strlen (salt) + 1,
- wire_enc,
- len,
- NULL,
- 0))
+ GNUNET_CRYPTO_hkdf_gnunet (
+ hc,
+ sizeof (*hc),
+ salt,
+ strlen (salt) + 1,
+ wire_enc,
+ len))
{
GNUNET_break (0);
free (wire_enc);
diff --git a/src/kyclogic/kyclogic_sanctions.c b/src/kyclogic/kyclogic_sanctions.c
@@ -85,7 +85,7 @@ struct TALER_KYCLOGIC_SanctionRater
/**
* Handle to the helper process.
*/
- struct GNUNET_OS_Process *helper;
+ struct GNUNET_Process *helper;
/**
* Pipe for the stdin of the @e helper.
@@ -154,7 +154,7 @@ fail_hard (struct TALER_KYCLOGIC_SanctionRater *sr)
}
if (NULL != sr->helper)
{
- GNUNET_OS_process_destroy (sr->helper);
+ GNUNET_process_destroy (sr->helper);
sr->helper = NULL;
}
while (NULL != (ee = sr->ee_tail))
@@ -464,17 +464,25 @@ TALER_KYCLOGIC_sanction_rater_start (const char *binary,
GNUNET_assert (NULL != pipe_stdin);
pipe_stdout = GNUNET_DISK_pipe (GNUNET_DISK_PF_BLOCKING_WRITE);
GNUNET_assert (NULL != pipe_stdout);
- sr->helper = GNUNET_OS_start_process_vap (GNUNET_OS_INHERIT_STD_ERR,
- pipe_stdin,
- pipe_stdout,
- NULL,
- binary,
- (char *const *) argv);
- if (NULL == sr->helper)
+ sr->helper = GNUNET_process_create ();
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_process_set_options (
+ sr->helper,
+ GNUNET_process_option_inherit_rpipe (pipe_stdin,
+ STDIN_FILENO),
+ GNUNET_process_option_inherit_wpipe (pipe_stdout,
+ STDOUT_FILENO)));
+ if ( (GNUNET_OK !=
+ GNUNET_process_set_command_argv (sr->helper,
+ binary,
+ (const char **) argv)) ||
+ (GNUNET_OK !=
+ GNUNET_process_start (sr->helper)) )
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Failed to run conversion helper `%s'\n",
binary);
+ GNUNET_process_destroy (sr->helper);
GNUNET_break (GNUNET_OK ==
GNUNET_DISK_pipe_close (pipe_stdin));
GNUNET_break (GNUNET_OK ==
diff --git a/src/mhd/mhd_typst.c b/src/mhd/mhd_typst.c
@@ -44,7 +44,7 @@ struct TypstStage
/**
* Handle to the typst process.
*/
- struct GNUNET_OS_Process *proc;
+ struct GNUNET_Process *proc;
/**
* Handle to be notified about stage completion.
@@ -70,7 +70,7 @@ struct TALER_MHD_TypstContext
/**
* Handle for pdftk combining the various PDFs.
*/
- struct GNUNET_OS_Process *proc;
+ struct GNUNET_Process *proc;
/**
* Handle to wait for @e proc to complete.
@@ -145,10 +145,10 @@ TALER_MHD_typst_cancel (struct TALER_MHD_TypstContext *tc)
}
if (NULL != stage->proc)
{
- GNUNET_break (0 ==
- GNUNET_OS_process_kill (stage->proc,
- SIGKILL));
- GNUNET_OS_process_destroy (stage->proc);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_process_kill (stage->proc,
+ SIGKILL));
+ GNUNET_process_destroy (stage->proc);
stage->proc = NULL;
}
GNUNET_free (stage->filename);
@@ -161,10 +161,10 @@ TALER_MHD_typst_cancel (struct TALER_MHD_TypstContext *tc)
}
if (NULL != tc->proc)
{
- GNUNET_break (0 ==
- GNUNET_OS_process_kill (tc->proc,
- SIGKILL));
- GNUNET_OS_process_destroy (tc->proc);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_process_kill (tc->proc,
+ SIGKILL));
+ GNUNET_process_destroy (tc->proc);
}
GNUNET_free (tc->output_file);
if (NULL != tc->tmpdir)
@@ -342,7 +342,7 @@ pdftk_done_cb (void *cls,
struct TALER_MHD_TypstContext *tc = cls;
tc->cwh = NULL;
- GNUNET_OS_process_destroy (tc->proc);
+ GNUNET_process_destroy (tc->proc);
tc->proc = NULL;
switch (type)
{
@@ -413,17 +413,18 @@ complete_response (void *cls)
argv[tc->num_stages + 2] = "output";
argv[tc->num_stages + 3] = tc->output_file;
argv[tc->num_stages + 4] = NULL;
- tc->proc = GNUNET_OS_start_process_vap (
- GNUNET_OS_INHERIT_STD_ERR,
- NULL,
- NULL,
- NULL,
- argv[0],
- (char **) argv);
- if (NULL == tc->proc)
+ tc->proc = GNUNET_process_create ();
+ if ( (GNUNET_OK !=
+ GNUNET_process_set_command_argv (tc->proc,
+ argv[0],
+ argv)) ||
+ (GNUNET_OK !=
+ GNUNET_process_start (tc->proc)) )
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
"fork");
+ GNUNET_process_destroy (tc->proc);
+ tc->proc = NULL;
TALER_MHD_typst_cancel (tc);
return;
}
@@ -465,7 +466,7 @@ typst_done_cb (void *cls,
struct TALER_MHD_TypstContext *tc = stage->tc;
stage->cwh = NULL;
- GNUNET_OS_process_destroy (stage->proc);
+ GNUNET_process_destroy (stage->proc);
stage->proc = NULL;
switch (type)
{
@@ -525,7 +526,7 @@ typst_done_cb (void *cls,
tc->active_stages--;
if (NULL != stage->proc)
{
- GNUNET_OS_process_destroy (stage->proc);
+ GNUNET_process_destroy (stage->proc);
stage->proc = NULL;
}
if (0 != tc->active_stages)
@@ -686,18 +687,19 @@ setup_stage (struct TypstStage *stage,
argv[2] = input;
argv[3] = NULL;
}
- stage->proc = GNUNET_OS_start_process_vap (
- GNUNET_OS_INHERIT_STD_ERR,
- NULL,
- NULL,
- NULL,
- "typst",
- (char **) argv);
- if (NULL == stage->proc)
+ stage->proc = GNUNET_process_create ();
+ if ( (GNUNET_OK !=
+ GNUNET_process_set_command_argv (stage->proc,
+ "typst",
+ argv)) ||
+ (GNUNET_OK !=
+ GNUNET_process_start (stage->proc)) )
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
"fork");
GNUNET_free (input);
+ GNUNET_process_destroy (stage->proc);
+ stage->proc = NULL;
return false;
}
GNUNET_free (input);
diff --git a/src/testing/testing_api_cmd_auditor_exec_auditor.c b/src/testing/testing_api_cmd_auditor_exec_auditor.c
@@ -38,7 +38,7 @@ struct AuditorState
/**
* Process for the "auditor" command.
*/
- struct GNUNET_OS_Process *auditor_proc;
+ struct GNUNET_Process *auditor_proc;
/**
* Configuration file used by the command.
@@ -65,17 +65,20 @@ auditor_run (void *cls,
// FIXME: taler-auditor is no more, run the individual
// helpers here instead, or re-introduce the taler-auditor
// command to run all helpers!
- ks->auditor_proc
- = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL,
- NULL, NULL, NULL,
- "taler-auditor",
- "taler-auditor",
- "-c", ks->config_filename,
- "-I",
- NULL);
- if (NULL == ks->auditor_proc)
+ ks->auditor_proc = GNUNET_process_create ();
+ if ( (GNUNET_OK !=
+ GNUNET_process_set_command_va (ks->auditor_proc,
+ "taler-auditor",
+ "taler-auditor",
+ "-c", ks->config_filename,
+ "-I",
+ NULL)) ||
+ (GNUNET_OK !=
+ GNUNET_process_start (ks->auditor_proc)) )
{
GNUNET_break (0);
+ GNUNET_process_destroy (ks->auditor_proc);
+ ks->auditor_proc = NULL;
TALER_TESTING_interpreter_fail (is);
return;
}
@@ -99,11 +102,14 @@ auditor_cleanup (void *cls,
(void) cmd;
if (NULL != ks->auditor_proc)
{
- GNUNET_break (0 ==
- GNUNET_OS_process_kill (ks->auditor_proc,
- SIGKILL));
- GNUNET_OS_process_wait (ks->auditor_proc);
- GNUNET_OS_process_destroy (ks->auditor_proc);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_process_kill (ks->auditor_proc,
+ SIGKILL));
+ GNUNET_process_wait (ks->auditor_proc,
+ true,
+ NULL,
+ NULL);
+ GNUNET_process_destroy (ks->auditor_proc);
ks->auditor_proc = NULL;
}
GNUNET_free (ks);
diff --git a/src/testing/testing_api_cmd_auditor_exec_auditor_dbinit.c b/src/testing/testing_api_cmd_auditor_exec_auditor_dbinit.c
@@ -38,7 +38,7 @@ struct AuditorDbinitState
/**
* Process for the "auditor-dbinit" command.
*/
- struct GNUNET_OS_Process *auditor_dbinit_proc;
+ struct GNUNET_Process *auditor_dbinit_proc;
/**
* Configuration file used by the command.
@@ -62,17 +62,20 @@ auditor_dbinit_run (void *cls,
struct AuditorDbinitState *ks = cls;
(void) cmd;
- ks->auditor_dbinit_proc
- = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL,
- NULL, NULL, NULL,
- "taler-auditor-dbinit",
- "taler-auditor-dbinit",
- "-c", ks->config_filename,
- "-R",
- NULL);
- if (NULL == ks->auditor_dbinit_proc)
+ ks->auditor_dbinit_proc = GNUNET_process_create ();
+ if ( (GNUNET_OK !=
+ GNUNET_process_set_command_va (ks->auditor_dbinit_proc,
+ "taler-auditor-dbinit",
+ "taler-auditor-dbinit",
+ "-c", ks->config_filename,
+ "-R",
+ NULL)) ||
+ (GNUNET_OK !=
+ GNUNET_process_start (ks->auditor_dbinit_proc)) )
{
GNUNET_break (0);
+ GNUNET_process_destroy (ks->auditor_dbinit_proc);
+ ks->auditor_dbinit_proc = NULL;
TALER_TESTING_interpreter_fail (is);
return;
}
@@ -96,11 +99,14 @@ auditor_dbinit_cleanup (void *cls,
(void) cmd;
if (NULL != ks->auditor_dbinit_proc)
{
- GNUNET_break (0 ==
- GNUNET_OS_process_kill (ks->auditor_dbinit_proc,
- SIGKILL));
- GNUNET_OS_process_wait (ks->auditor_dbinit_proc);
- GNUNET_OS_process_destroy (ks->auditor_dbinit_proc);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_process_kill (ks->auditor_dbinit_proc,
+ SIGKILL));
+ GNUNET_process_wait (ks->auditor_dbinit_proc,
+ true,
+ NULL,
+ NULL);
+ GNUNET_process_destroy (ks->auditor_dbinit_proc);
ks->auditor_dbinit_proc = NULL;
}
GNUNET_free (ks);
diff --git a/src/testing/testing_api_cmd_exec_aggregator.c b/src/testing/testing_api_cmd_exec_aggregator.c
@@ -37,7 +37,7 @@ struct AggregatorState
/**
* Aggregator process.
*/
- struct GNUNET_OS_Process *aggregator_proc;
+ struct GNUNET_Process *aggregator_proc;
/**
* Configuration file used by the aggregator.
@@ -66,21 +66,24 @@ aggregator_run (void *cls,
struct AggregatorState *as = cls;
(void) cmd;
- as->aggregator_proc
- = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL,
- NULL, NULL, NULL,
- "taler-exchange-aggregator",
- "taler-exchange-aggregator",
- "-c", as->config_filename,
- "-L", "INFO",
- "-t", /* exit when done */
- (as->kyc_on)
- ? NULL
- : "-y", /* skip KYC */
- NULL);
- if (NULL == as->aggregator_proc)
+ as->aggregator_proc = GNUNET_process_create ();
+ if ( (GNUNET_OK !=
+ GNUNET_process_set_command_va (as->aggregator_proc,
+ "taler-exchange-aggregator",
+ "taler-exchange-aggregator",
+ "-c", as->config_filename,
+ "-L", "INFO",
+ "-t", /* exit when done */
+ (as->kyc_on)
+ ? NULL
+ : "-y", /* skip KYC */
+ NULL)) ||
+ (GNUNET_OK !=
+ GNUNET_process_start (as->aggregator_proc)) )
{
GNUNET_break (0);
+ GNUNET_process_destroy (as->aggregator_proc);
+ as->aggregator_proc = NULL;
TALER_TESTING_interpreter_fail (is);
return;
}
@@ -104,11 +107,14 @@ aggregator_cleanup (void *cls,
(void) cmd;
if (NULL != as->aggregator_proc)
{
- GNUNET_break (0 ==
- GNUNET_OS_process_kill (as->aggregator_proc,
- SIGKILL));
- GNUNET_OS_process_wait (as->aggregator_proc);
- GNUNET_OS_process_destroy (as->aggregator_proc);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_process_kill (as->aggregator_proc,
+ SIGKILL));
+ GNUNET_process_wait (as->aggregator_proc,
+ true,
+ NULL,
+ NULL);
+ GNUNET_process_destroy (as->aggregator_proc);
as->aggregator_proc = NULL;
}
GNUNET_free (as);
diff --git a/src/testing/testing_api_cmd_exec_auditor-offline.c b/src/testing/testing_api_cmd_exec_auditor-offline.c
@@ -37,7 +37,7 @@ struct AuditorOfflineState
/**
* AuditorOffline process.
*/
- struct GNUNET_OS_Process *auditor_offline_proc;
+ struct GNUNET_Process *auditor_offline_proc;
/**
* Configuration file used by the auditor-offline.
@@ -62,20 +62,23 @@ auditor_offline_run (void *cls,
struct AuditorOfflineState *as = cls;
(void) cmd;
- as->auditor_offline_proc
- = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL,
- NULL, NULL, NULL,
- "taler-auditor-offline",
- "taler-auditor-offline",
- "-c", as->config_filename,
- "-L", "INFO",
- "download",
- "sign",
- "upload",
- NULL);
- if (NULL == as->auditor_offline_proc)
+ as->auditor_offline_proc = GNUNET_process_create ();
+ if ( (GNUNET_OK !=
+ GNUNET_process_set_command_va (as->auditor_offline_proc,
+ "taler-auditor-offline",
+ "taler-auditor-offline",
+ "-c", as->config_filename,
+ "-L", "INFO",
+ "download",
+ "sign",
+ "upload",
+ NULL)) ||
+ (GNUNET_OK !=
+ GNUNET_process_start (as->auditor_offline_proc)) )
{
GNUNET_break (0);
+ GNUNET_process_destroy (as->auditor_offline_proc);
+ as->auditor_offline_proc = NULL;
TALER_TESTING_interpreter_fail (is);
return;
}
@@ -99,11 +102,14 @@ auditor_offline_cleanup (void *cls,
(void) cmd;
if (NULL != as->auditor_offline_proc)
{
- GNUNET_break (0 ==
- GNUNET_OS_process_kill (as->auditor_offline_proc,
- SIGKILL));
- GNUNET_OS_process_wait (as->auditor_offline_proc);
- GNUNET_OS_process_destroy (as->auditor_offline_proc);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_process_kill (as->auditor_offline_proc,
+ SIGKILL));
+ GNUNET_process_wait (as->auditor_offline_proc,
+ true,
+ NULL,
+ NULL);
+ GNUNET_process_destroy (as->auditor_offline_proc);
as->auditor_offline_proc = NULL;
}
GNUNET_free (as);
diff --git a/src/testing/testing_api_cmd_exec_closer.c b/src/testing/testing_api_cmd_exec_closer.c
@@ -37,7 +37,7 @@ struct CloserState
/**
* Closer process.
*/
- struct GNUNET_OS_Process *closer_proc;
+ struct GNUNET_Process *closer_proc;
/**
* Configuration file used by the closer.
@@ -102,17 +102,20 @@ closer_run (void *cls,
}
as->reserve_pub = *reserve_pubp;
}
- as->closer_proc
- = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL,
- NULL, NULL, NULL,
- "taler-exchange-closer",
- "taler-exchange-closer",
- "-c", as->config_filename,
- "-t", /* exit when done */
- NULL);
- if (NULL == as->closer_proc)
+ as->closer_proc = GNUNET_process_create ();
+ if ( (GNUNET_OK !=
+ GNUNET_process_set_command_va (as->closer_proc,
+ "taler-exchange-closer",
+ "taler-exchange-closer",
+ "-c", as->config_filename,
+ "-t", /* exit when done */
+ NULL)) ||
+ (GNUNET_OK !=
+ GNUNET_process_start (as->closer_proc)) )
{
GNUNET_break (0);
+ GNUNET_process_destroy (as->closer_proc);
+ as->closer_proc = NULL;
TALER_TESTING_interpreter_fail (is);
return;
}
@@ -136,11 +139,14 @@ closer_cleanup (void *cls,
(void) cmd;
if (NULL != as->closer_proc)
{
- GNUNET_break (0 ==
- GNUNET_OS_process_kill (as->closer_proc,
- SIGKILL));
- GNUNET_OS_process_wait (as->closer_proc);
- GNUNET_OS_process_destroy (as->closer_proc);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_process_kill (as->closer_proc,
+ SIGKILL));
+ GNUNET_process_wait (as->closer_proc,
+ true,
+ NULL,
+ NULL);
+ GNUNET_process_destroy (as->closer_proc);
as->closer_proc = NULL;
}
GNUNET_free (as);
diff --git a/src/testing/testing_api_cmd_exec_expire.c b/src/testing/testing_api_cmd_exec_expire.c
@@ -38,7 +38,7 @@ struct ExpireState
/**
* Process for the expireer.
*/
- struct GNUNET_OS_Process *expire_proc;
+ struct GNUNET_Process *expire_proc;
/**
* Configuration file used by the expireer.
@@ -62,18 +62,20 @@ expire_run (void *cls,
struct ExpireState *ws = cls;
(void) cmd;
- ws->expire_proc
- = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL,
- NULL, NULL, NULL,
- "taler-exchange-expire",
- "taler-exchange-expire",
- "-L", "INFO",
- "-c", ws->config_filename,
- "-t", /* exit when done */
- NULL);
- if (NULL == ws->expire_proc)
+ ws->expire_proc = GNUNET_process_create ();
+ if ( (GNUNET_OK !=
+ GNUNET_process_set_command_va (ws->expire_proc,
+ "taler-exchange-expire",
+ "taler-exchange-expire",
+ "-c", ws->config_filename,
+ "-t", /* exit when done */
+ NULL)) ||
+ (GNUNET_OK !=
+ GNUNET_process_start (ws->expire_proc)) )
{
GNUNET_break (0);
+ GNUNET_process_destroy (ws->expire_proc);
+ ws->expire_proc = NULL;
TALER_TESTING_interpreter_fail (is);
return;
}
@@ -97,11 +99,14 @@ expire_cleanup (void *cls,
(void) cmd;
if (NULL != ws->expire_proc)
{
- GNUNET_break (0 ==
- GNUNET_OS_process_kill (ws->expire_proc,
- SIGKILL));
- GNUNET_OS_process_wait (ws->expire_proc);
- GNUNET_OS_process_destroy (ws->expire_proc);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_process_kill (ws->expire_proc,
+ SIGKILL));
+ GNUNET_process_wait (ws->expire_proc,
+ true,
+ NULL,
+ NULL);
+ GNUNET_process_destroy (ws->expire_proc);
ws->expire_proc = NULL;
}
GNUNET_free (ws);
diff --git a/src/testing/testing_api_cmd_exec_router.c b/src/testing/testing_api_cmd_exec_router.c
@@ -38,7 +38,7 @@ struct RouterState
/**
* Process for the routerer.
*/
- struct GNUNET_OS_Process *router_proc;
+ struct GNUNET_Process *router_proc;
/**
* Configuration file used by the routerer.
@@ -62,17 +62,20 @@ router_run (void *cls,
struct RouterState *ws = cls;
(void) cmd;
- ws->router_proc
- = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL,
- NULL, NULL, NULL,
- "taler-exchange-router",
- "taler-exchange-router",
- "-c", ws->config_filename,
- "-t", /* exit when done */
- NULL);
- if (NULL == ws->router_proc)
+ ws->router_proc = GNUNET_process_create ();
+ if ( (GNUNET_OK !=
+ GNUNET_process_set_command_va (ws->router_proc,
+ "taler-exchange-router",
+ "taler-exchange-router",
+ "-c", ws->config_filename,
+ "-t", /* exit when done */
+ NULL)) ||
+ (GNUNET_OK !=
+ GNUNET_process_start (ws->router_proc)) )
{
GNUNET_break (0);
+ GNUNET_process_destroy (ws->router_proc);
+ ws->router_proc = NULL;
TALER_TESTING_interpreter_fail (is);
return;
}
@@ -96,11 +99,14 @@ router_cleanup (void *cls,
(void) cmd;
if (NULL != ws->router_proc)
{
- GNUNET_break (0 ==
- GNUNET_OS_process_kill (ws->router_proc,
- SIGKILL));
- GNUNET_OS_process_wait (ws->router_proc);
- GNUNET_OS_process_destroy (ws->router_proc);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_process_kill (ws->router_proc,
+ SIGKILL));
+ GNUNET_process_wait (ws->router_proc,
+ true,
+ NULL,
+ NULL);
+ GNUNET_process_destroy (ws->router_proc);
ws->router_proc = NULL;
}
GNUNET_free (ws);
diff --git a/src/testing/testing_api_cmd_exec_transfer.c b/src/testing/testing_api_cmd_exec_transfer.c
@@ -37,7 +37,7 @@ struct TransferState
/**
* Transfer process.
*/
- struct GNUNET_OS_Process *transfer_proc;
+ struct GNUNET_Process *transfer_proc;
/**
* Configuration file used by the transfer.
@@ -61,19 +61,22 @@ transfer_run (void *cls,
struct TransferState *as = cls;
(void) cmd;
- as->transfer_proc
- = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL,
- NULL, NULL, NULL,
- "taler-exchange-transfer",
- "taler-exchange-transfer",
- "-c", as->config_filename,
- "-S", "1",
- "-w", "0",
- "-t", /* exit when done */
- NULL);
- if (NULL == as->transfer_proc)
+ as->transfer_proc = GNUNET_process_create ();
+ if ( (GNUNET_OK !=
+ GNUNET_process_set_command_va (as->transfer_proc,
+ "taler-exchange-transfer",
+ "taler-exchange-transfer",
+ "-c", as->config_filename,
+ "-S", "1",
+ "-w", "0",
+ "-t", /* exit when done */
+ NULL)) ||
+ (GNUNET_OK !=
+ GNUNET_process_start (as->transfer_proc)) )
{
GNUNET_break (0);
+ GNUNET_process_destroy (as->transfer_proc);
+ as->transfer_proc = NULL;
TALER_TESTING_interpreter_fail (is);
return;
}
@@ -97,11 +100,14 @@ transfer_cleanup (void *cls,
(void) cmd;
if (NULL != as->transfer_proc)
{
- GNUNET_break (0 ==
- GNUNET_OS_process_kill (as->transfer_proc,
- SIGKILL));
- GNUNET_OS_process_wait (as->transfer_proc);
- GNUNET_OS_process_destroy (as->transfer_proc);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_process_kill (as->transfer_proc,
+ SIGKILL));
+ GNUNET_process_wait (as->transfer_proc,
+ true,
+ NULL,
+ NULL);
+ GNUNET_process_destroy (as->transfer_proc);
as->transfer_proc = NULL;
}
GNUNET_free (as);
diff --git a/src/testing/testing_api_cmd_exec_wget.c b/src/testing/testing_api_cmd_exec_wget.c
@@ -36,7 +36,7 @@ struct WgetState
/**
* Process for the wgeter.
*/
- struct GNUNET_OS_Process *wget_proc;
+ struct GNUNET_Process *wget_proc;
/**
* URL to used by the wget.
@@ -60,16 +60,19 @@ wget_run (void *cls,
struct WgetState *ws = cls;
(void) cmd;
- ws->wget_proc
- = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL,
- NULL, NULL, NULL,
- "wget",
- "wget",
- ws->url,
- NULL);
- if (NULL == ws->wget_proc)
+ ws->wget_proc = GNUNET_process_create ();
+ if ( (GNUNET_OK !=
+ GNUNET_process_set_command_va (ws->wget_proc,
+ "wget",
+ "wget",
+ ws->url,
+ NULL)) ||
+ (GNUNET_OK !=
+ GNUNET_process_start (ws->wget_proc)) )
{
GNUNET_break (0);
+ GNUNET_process_destroy (ws->wget_proc);
+ ws->wget_proc = NULL;
TALER_TESTING_interpreter_fail (is);
return;
}
@@ -93,11 +96,14 @@ wget_cleanup (void *cls,
(void) cmd;
if (NULL != ws->wget_proc)
{
- GNUNET_break (0 ==
- GNUNET_OS_process_kill (ws->wget_proc,
- SIGKILL));
- GNUNET_OS_process_wait (ws->wget_proc);
- GNUNET_OS_process_destroy (ws->wget_proc);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_process_kill (ws->wget_proc,
+ SIGKILL));
+ GNUNET_process_wait (ws->wget_proc,
+ true,
+ NULL,
+ NULL);
+ GNUNET_process_destroy (ws->wget_proc);
ws->wget_proc = NULL;
}
GNUNET_free (ws);
diff --git a/src/testing/testing_api_cmd_exec_wirewatch.c b/src/testing/testing_api_cmd_exec_wirewatch.c
@@ -37,7 +37,7 @@ struct WirewatchState
/**
* Process for the wirewatcher.
*/
- struct GNUNET_OS_Process *wirewatch_proc;
+ struct GNUNET_Process *wirewatch_proc;
/**
* Configuration file used by the wirewatcher.
@@ -66,24 +66,28 @@ wirewatch_run (void *cls,
struct WirewatchState *ws = cls;
(void) cmd;
- ws->wirewatch_proc
- = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL,
- NULL, NULL, NULL,
- "taler-exchange-wirewatch",
- "taler-exchange-wirewatch",
- "-c", ws->config_filename,
- "-L", "INFO",
- "-S", "1",
- "-w", "0",
- "-t", /* exit when done */
- (NULL == ws->account_section)
- ? NULL
- : "-a",
- ws->account_section,
- NULL);
- if (NULL == ws->wirewatch_proc)
+ ws->wirewatch_proc = GNUNET_process_create ();
+ if ( (GNUNET_OK !=
+ GNUNET_process_set_command_va (
+ ws->wirewatch_proc,
+ "taler-exchange-wirewatch",
+ "taler-exchange-wirewatch",
+ "-c", ws->config_filename,
+ "-L", "INFO",
+ "-S", "1",
+ "-w", "0",
+ "-t", /* exit when done */
+ (NULL == ws->account_section)
+ ? NULL
+ : "-a",
+ ws->account_section,
+ NULL)) ||
+ (GNUNET_OK !=
+ GNUNET_process_start (ws->wirewatch_proc)) )
{
GNUNET_break (0);
+ GNUNET_process_destroy (ws->wirewatch_proc);
+ ws->wirewatch_proc = NULL;
TALER_TESTING_interpreter_fail (is);
return;
}
@@ -107,11 +111,14 @@ wirewatch_cleanup (void *cls,
(void) cmd;
if (NULL != ws->wirewatch_proc)
{
- GNUNET_break (0 ==
- GNUNET_OS_process_kill (ws->wirewatch_proc,
- SIGKILL));
- GNUNET_OS_process_wait (ws->wirewatch_proc);
- GNUNET_OS_process_destroy (ws->wirewatch_proc);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_process_kill (ws->wirewatch_proc,
+ SIGKILL));
+ GNUNET_process_wait (ws->wirewatch_proc,
+ true,
+ NULL,
+ NULL);
+ GNUNET_process_destroy (ws->wirewatch_proc);
ws->wirewatch_proc = NULL;
}
GNUNET_free (ws);
diff --git a/src/testing/testing_api_cmd_insert_deposit.c b/src/testing/testing_api_cmd_insert_deposit.c
@@ -191,24 +191,22 @@ insert_deposit_run (void *cls,
GNUNET_assert (
GNUNET_YES ==
- GNUNET_CRYPTO_kdf (&merchant_priv,
- sizeof (struct TALER_MerchantPrivateKeyP),
- "merchant-priv",
- strlen ("merchant-priv"),
- ids->merchant_name,
- strlen (ids->merchant_name),
- NULL,
- 0));
+ GNUNET_CRYPTO_hkdf_gnunet (
+ &merchant_priv,
+ sizeof (struct TALER_MerchantPrivateKeyP),
+ "merchant-priv",
+ strlen ("merchant-priv"),
+ ids->merchant_name,
+ strlen (ids->merchant_name)));
GNUNET_assert (
GNUNET_YES ==
- GNUNET_CRYPTO_kdf (&bd.merchant_sig,
- sizeof (struct TALER_MerchantSignatureP),
- "merchant-sig",
- strlen ("merchant-sig"),
- ids->merchant_name,
- strlen (ids->merchant_name),
- NULL,
- 0));
+ GNUNET_CRYPTO_hkdf_gnunet (
+ &bd.merchant_sig,
+ sizeof (struct TALER_MerchantSignatureP),
+ "merchant-sig",
+ strlen ("merchant-sig"),
+ ids->merchant_name,
+ strlen (ids->merchant_name)));
GNUNET_CRYPTO_eddsa_key_get_public (&merchant_priv.eddsa_priv,
&bd.merchant_pub.eddsa_pub);
GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK,
diff --git a/src/testing/testing_api_cmd_offline_sign_extensions.c b/src/testing/testing_api_cmd_offline_sign_extensions.c
@@ -38,7 +38,7 @@ struct ExtensionsSignState
/**
* Process for the "extensionssign" command.
*/
- struct GNUNET_OS_Process *extensionssign_proc;
+ struct GNUNET_Process *extensionssign_proc;
/**
* Configuration file used by the command.
@@ -62,21 +62,24 @@ extensionssign_run (void *cls,
{
struct ExtensionsSignState *ks = cls;
- ks->extensionssign_proc
- = GNUNET_OS_start_process (
- GNUNET_OS_INHERIT_STD_ALL,
- NULL, NULL, NULL,
- "taler-exchange-offline",
- "taler-exchange-offline",
- "-c", ks->config_filename,
- "-L", "INFO",
- "extensions",
- "sign",
- "upload",
- NULL);
- if (NULL == ks->extensionssign_proc)
+ ks->extensionssign_proc = GNUNET_process_create ();
+ if ( (GNUNET_OK !=
+ GNUNET_process_set_command_va (
+ ks->extensionssign_proc,
+ "taler-exchange-offline",
+ "taler-exchange-offline",
+ "-c", ks->config_filename,
+ "-L", "INFO",
+ "extensions",
+ "sign",
+ "upload",
+ NULL)) ||
+ (GNUNET_OK !=
+ GNUNET_process_start (ks->extensionssign_proc)) )
{
GNUNET_break (0);
+ GNUNET_process_destroy (ks->extensionssign_proc);
+ ks->extensionssign_proc = NULL;
TALER_TESTING_interpreter_fail (is);
return;
}
@@ -100,11 +103,14 @@ extensionssign_cleanup (void *cls,
(void) cmd;
if (NULL != ks->extensionssign_proc)
{
- GNUNET_break (0 ==
- GNUNET_OS_process_kill (ks->extensionssign_proc,
- SIGKILL));
- GNUNET_OS_process_wait (ks->extensionssign_proc);
- GNUNET_OS_process_destroy (ks->extensionssign_proc);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_process_kill (ks->extensionssign_proc,
+ SIGKILL));
+ GNUNET_process_wait (ks->extensionssign_proc,
+ true,
+ NULL,
+ NULL);
+ GNUNET_process_destroy (ks->extensionssign_proc);
ks->extensionssign_proc = NULL;
}
GNUNET_free (ks);
diff --git a/src/testing/testing_api_cmd_offline_sign_global_fees.c b/src/testing/testing_api_cmd_offline_sign_global_fees.c
@@ -39,7 +39,7 @@ struct OfflineSignState
/**
* Process for the "offlinesign" command.
*/
- struct GNUNET_OS_Process *offlinesign_proc;
+ struct GNUNET_Process *offlinesign_proc;
/**
* Configuration file used by the command.
@@ -109,27 +109,30 @@ offlinesign_run (void *cls,
"%s",
GNUNET_TIME_relative2s (ks->purse_timeout,
false));
- ks->offlinesign_proc
- = GNUNET_OS_start_process (
- GNUNET_OS_INHERIT_STD_ALL,
- NULL, NULL, NULL,
- "taler-exchange-offline",
- "taler-exchange-offline",
- "-c", ks->config_filename,
- "-L", "INFO",
- "global-fee",
- "now",
- ks->history_fee_s,
- ks->account_fee_s,
- ks->purse_fee_s,
- purse_timeout,
- history_expiration,
- num_purses,
- "upload",
- NULL);
- if (NULL == ks->offlinesign_proc)
+ ks->offlinesign_proc = GNUNET_process_create ();
+ if ( (GNUNET_OK !=
+ GNUNET_process_set_command_va (
+ ks->offlinesign_proc,
+ "taler-exchange-offline",
+ "taler-exchange-offline",
+ "-c", ks->config_filename,
+ "-L", "INFO",
+ "global-fee",
+ "now",
+ ks->history_fee_s,
+ ks->account_fee_s,
+ ks->purse_fee_s,
+ purse_timeout,
+ history_expiration,
+ num_purses,
+ "upload",
+ NULL)) ||
+ (GNUNET_OK !=
+ GNUNET_process_start (ks->offlinesign_proc)) )
{
GNUNET_break (0);
+ GNUNET_process_destroy (ks->offlinesign_proc);
+ ks->offlinesign_proc = NULL;
TALER_TESTING_interpreter_fail (is);
return;
}
@@ -153,11 +156,14 @@ offlinesign_cleanup (void *cls,
(void) cmd;
if (NULL != ks->offlinesign_proc)
{
- GNUNET_break (0 ==
- GNUNET_OS_process_kill (ks->offlinesign_proc,
- SIGKILL));
- GNUNET_OS_process_wait (ks->offlinesign_proc);
- GNUNET_OS_process_destroy (ks->offlinesign_proc);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_process_kill (ks->offlinesign_proc,
+ SIGKILL));
+ GNUNET_process_wait (ks->offlinesign_proc,
+ true,
+ NULL,
+ NULL);
+ GNUNET_process_destroy (ks->offlinesign_proc);
ks->offlinesign_proc = NULL;
}
GNUNET_free (ks);
diff --git a/src/testing/testing_api_cmd_offline_sign_keys.c b/src/testing/testing_api_cmd_offline_sign_keys.c
@@ -39,7 +39,7 @@ struct OfflineSignState
/**
* Process for the "offlinesign" command.
*/
- struct GNUNET_OS_Process *offlinesign_proc;
+ struct GNUNET_Process *offlinesign_proc;
/**
* Configuration file used by the command.
@@ -63,21 +63,24 @@ offlinesign_run (void *cls,
{
struct OfflineSignState *ks = cls;
- ks->offlinesign_proc
- = GNUNET_OS_start_process (
- GNUNET_OS_INHERIT_STD_ALL,
- NULL, NULL, NULL,
- "taler-exchange-offline",
- "taler-exchange-offline",
- "-c", ks->config_filename,
- "-L", "INFO",
- "download",
- "sign",
- "upload",
- NULL);
- if (NULL == ks->offlinesign_proc)
+ ks->offlinesign_proc = GNUNET_process_create ();
+ if ( (GNUNET_OK !=
+ GNUNET_process_set_command_va (
+ ks->offlinesign_proc,
+ "taler-exchange-offline",
+ "taler-exchange-offline",
+ "-c", ks->config_filename,
+ "-L", "INFO",
+ "download",
+ "sign",
+ "upload",
+ NULL)) ||
+ (GNUNET_OK !=
+ GNUNET_process_start (ks->offlinesign_proc)) )
{
GNUNET_break (0);
+ GNUNET_process_destroy (ks->offlinesign_proc);
+ ks->offlinesign_proc = NULL;
TALER_TESTING_interpreter_fail (is);
return;
}
@@ -101,11 +104,14 @@ offlinesign_cleanup (void *cls,
(void) cmd;
if (NULL != ks->offlinesign_proc)
{
- GNUNET_break (0 ==
- GNUNET_OS_process_kill (ks->offlinesign_proc,
- SIGKILL));
- GNUNET_OS_process_wait (ks->offlinesign_proc);
- GNUNET_OS_process_destroy (ks->offlinesign_proc);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_process_kill (ks->offlinesign_proc,
+ SIGKILL));
+ GNUNET_process_wait (ks->offlinesign_proc,
+ true,
+ NULL,
+ NULL);
+ GNUNET_process_destroy (ks->offlinesign_proc);
ks->offlinesign_proc = NULL;
}
GNUNET_free (ks);
diff --git a/src/testing/testing_api_cmd_offline_sign_wire_fees.c b/src/testing/testing_api_cmd_offline_sign_wire_fees.c
@@ -39,7 +39,7 @@ struct OfflineSignState
/**
* Process for the "offlinesign" command.
*/
- struct GNUNET_OS_Process *offlinesign_proc;
+ struct GNUNET_Process *offlinesign_proc;
/**
* Configuration file used by the command.
@@ -73,24 +73,27 @@ offlinesign_run (void *cls,
{
struct OfflineSignState *ks = cls;
- ks->offlinesign_proc
- = GNUNET_OS_start_process (
- GNUNET_OS_INHERIT_STD_ALL,
- NULL, NULL, NULL,
- "taler-exchange-offline",
- "taler-exchange-offline",
- "-c", ks->config_filename,
- "-L", "INFO",
- "wire-fee",
- "now",
- "x-taler-bank",
- ks->wire_fee_s,
- ks->closing_fee_s,
- "upload",
- NULL);
- if (NULL == ks->offlinesign_proc)
+ ks->offlinesign_proc = GNUNET_process_create ();
+ if ( (GNUNET_OK !=
+ GNUNET_process_set_command_va (
+ ks->offlinesign_proc,
+ "taler-exchange-offline",
+ "taler-exchange-offline",
+ "-c", ks->config_filename,
+ "-L", "INFO",
+ "wire-fee",
+ "now",
+ "x-taler-bank",
+ ks->wire_fee_s,
+ ks->closing_fee_s,
+ "upload",
+ NULL)) ||
+ (GNUNET_OK !=
+ GNUNET_process_start (ks->offlinesign_proc)) )
{
GNUNET_break (0);
+ GNUNET_process_destroy (ks->offlinesign_proc);
+ ks->offlinesign_proc = NULL;
TALER_TESTING_interpreter_fail (is);
return;
}
@@ -114,11 +117,14 @@ offlinesign_cleanup (void *cls,
(void) cmd;
if (NULL != ks->offlinesign_proc)
{
- GNUNET_break (0 ==
- GNUNET_OS_process_kill (ks->offlinesign_proc,
- SIGKILL));
- GNUNET_OS_process_wait (ks->offlinesign_proc);
- GNUNET_OS_process_destroy (ks->offlinesign_proc);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_process_kill (ks->offlinesign_proc,
+ SIGKILL));
+ GNUNET_process_wait (ks->offlinesign_proc,
+ true,
+ NULL,
+ NULL);
+ GNUNET_process_destroy (ks->offlinesign_proc);
ks->offlinesign_proc = NULL;
}
GNUNET_free (ks);
diff --git a/src/testing/testing_api_cmd_revoke.c b/src/testing/testing_api_cmd_revoke.c
@@ -50,7 +50,7 @@ struct RevokeState
/**
* The revoke process handle.
*/
- struct GNUNET_OS_Process *revoke_proc;
+ struct GNUNET_Process *revoke_proc;
/**
* Configuration file name.
@@ -79,11 +79,14 @@ revoke_cleanup (void *cls,
if (NULL != rs->revoke_proc)
{
- GNUNET_break (0 ==
- GNUNET_OS_process_kill (rs->revoke_proc,
- SIGKILL));
- GNUNET_OS_process_wait (rs->revoke_proc);
- GNUNET_OS_process_destroy (rs->revoke_proc);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_process_kill (rs->revoke_proc,
+ SIGKILL));
+ GNUNET_process_wait (rs->revoke_proc,
+ true,
+ NULL,
+ NULL);
+ GNUNET_process_destroy (rs->revoke_proc);
rs->revoke_proc = NULL;
}
GNUNET_free (rs->dhks);
@@ -159,18 +162,22 @@ revoke_run (void *cls,
rs->dhks = GNUNET_STRINGS_data_to_string_alloc (
&denom_pub->h_key,
sizeof (struct GNUNET_HashCode));
- rs->revoke_proc = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL,
- NULL, NULL, NULL,
- "taler-exchange-offline",
- "taler-exchange-offline",
- "-c", rs->config_filename,
- "revoke-denomination", rs->dhks,
- "upload",
- NULL);
-
- if (NULL == rs->revoke_proc)
+ rs->revoke_proc = GNUNET_process_create ();
+ if ( (GNUNET_OK !=
+ GNUNET_process_set_command_va (
+ rs->revoke_proc,
+ "taler-exchange-offline",
+ "taler-exchange-offline",
+ "-c", rs->config_filename,
+ "revoke-denomination", rs->dhks,
+ "upload",
+ NULL)) ||
+ (GNUNET_OK !=
+ GNUNET_process_start (rs->revoke_proc)) )
{
GNUNET_break (0);
+ GNUNET_process_destroy (rs->revoke_proc);
+ rs->revoke_proc = NULL;
TALER_TESTING_interpreter_fail (is);
return;
}
diff --git a/src/testing/testing_api_cmd_signal.c b/src/testing/testing_api_cmd_signal.c
@@ -35,7 +35,7 @@ struct SignalState
/**
* The process to send the signal to.
*/
- struct GNUNET_OS_Process *process;
+ struct GNUNET_Process *process;
/**
* The signal to send to the process.
@@ -57,8 +57,9 @@ signal_run (void *cls,
{
struct SignalState *ss = cls;
- GNUNET_break (0 == GNUNET_OS_process_kill
- (ss->process, ss->signal));
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_process_kill (ss->process,
+ ss->signal));
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Signaling '%d'..\n",
ss->signal);
@@ -93,7 +94,7 @@ signal_cleanup (void *cls,
*/
struct TALER_TESTING_Command
TALER_TESTING_cmd_signal (const char *label,
- struct GNUNET_OS_Process *process,
+ struct GNUNET_Process *process,
int signal)
{
struct SignalState *ss;
diff --git a/src/testing/testing_api_cmd_system_start.c b/src/testing/testing_api_cmd_system_start.c
@@ -37,7 +37,7 @@ struct SystemState
/**
* System process.
*/
- struct GNUNET_OS_Process *system_proc;
+ struct GNUNET_Process *system_proc;
/**
* Input pipe to @e system_proc, used to keep the
@@ -238,15 +238,24 @@ system_run (void *cls,
GNUNET_assert (NULL != as->pipe_in);
as->pipe_out = GNUNET_DISK_pipe (GNUNET_DISK_PF_NONE);
GNUNET_assert (NULL != as->pipe_out);
- as->system_proc
- = GNUNET_OS_start_process_vap (
- GNUNET_OS_INHERIT_STD_ERR,
- as->pipe_in, as->pipe_out, NULL,
- "taler-unified-setup.sh",
- as->args);
- if (NULL == as->system_proc)
+ as->system_proc = GNUNET_process_create ();
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_process_set_options (
+ as->system_proc,
+ GNUNET_process_option_inherit_rpipe (as->pipe_in,
+ STDIN_FILENO),
+ GNUNET_process_option_inherit_wpipe (as->pipe_out,
+ STDOUT_FILENO)));
+ if ( (GNUNET_OK !=
+ GNUNET_process_set_command_argv (as->system_proc,
+ "taler-unified-setup.sh",
+ (const char **) as->args)) ||
+ (GNUNET_OK !=
+ GNUNET_process_start (as->system_proc)) )
{
GNUNET_break (0);
+ GNUNET_process_destroy (as->system_proc);
+ as->system_proc = NULL;
TALER_TESTING_interpreter_fail (is);
return;
}
@@ -287,11 +296,14 @@ system_cleanup (void *cls,
if (as->active)
{
GNUNET_break (0 ==
- GNUNET_OS_process_kill (as->system_proc,
- SIGTERM));
- GNUNET_OS_process_wait (as->system_proc);
+ GNUNET_process_kill (as->system_proc,
+ SIGTERM));
+ GNUNET_process_wait (as->system_proc,
+ true,
+ NULL,
+ NULL);
}
- GNUNET_OS_process_destroy (as->system_proc);
+ GNUNET_process_destroy (as->system_proc);
as->system_proc = NULL;
}
if (NULL != as->pipe_in)
diff --git a/src/testing/testing_api_cmd_twister_exec_client.c b/src/testing/testing_api_cmd_twister_exec_client.c
@@ -38,14 +38,13 @@ struct ModifyObjectState
/**
* Process handle for the twister CLI client.
*/
- struct GNUNET_OS_Process *proc;
+ struct GNUNET_Process *proc;
/**
* Object-like notation to the object to delete.
*/
const char *path;
-
/**
* Value to substitute to the original one.
*/
@@ -66,7 +65,7 @@ struct FlipObjectState
/**
* Process handle for the twister CLI client.
*/
- struct GNUNET_OS_Process *proc;
+ struct GNUNET_Process *proc;
/**
* Object-like notation to the string-object to flip.
@@ -88,7 +87,7 @@ struct DeleteObjectState
/**
* Process handle for the twister CLI client.
*/
- struct GNUNET_OS_Process *proc;
+ struct GNUNET_Process *proc;
/**
* Object-like notation to the object to delete.
@@ -110,7 +109,7 @@ struct MalformRequestState
/**
* Process handle for the twister CLI client.
*/
- struct GNUNET_OS_Process *proc;
+ struct GNUNET_Process *proc;
/**
* Config file name to pass to the CLI client.
@@ -127,7 +126,7 @@ struct MalformResponseState
/**
* Process handle for the twister CLI client.
*/
- struct GNUNET_OS_Process *proc;
+ struct GNUNET_Process *proc;
/**
* Config file name to pass to the CLI client.
@@ -144,7 +143,7 @@ struct HackResponseCodeState
/**
* Process handle for the twister CLI client.
*/
- struct GNUNET_OS_Process *proc;
+ struct GNUNET_Process *proc;
/**
* HTTP status code to substitute to the original one.
@@ -159,6 +158,40 @@ struct HackResponseCodeState
/**
+ * Helper function to create a process running the @a filename binary.
+ *
+ * @param filename binary to run
+ * @param ... argv to pass
+ * @return NULL on error
+ */
+static struct GNUNET_Process *
+start_process (const char *filename,
+ ...)
+{
+ struct GNUNET_Process *proc;
+ va_list ap;
+
+ proc = GNUNET_process_create ();
+ va_start (ap,
+ filename);
+ if ( (GNUNET_OK !=
+ GNUNET_process_set_command_ap (
+ proc,
+ filename,
+ ap)) ||
+ (GNUNET_OK !=
+ GNUNET_process_start (proc)) )
+ {
+ GNUNET_break (0);
+ GNUNET_process_destroy (proc);
+ proc = NULL;
+ }
+ va_end (ap);
+ return proc;
+}
+
+
+/**
* Free the state from a "hack response code" CMD, and
* possibly kill its process if it did not terminate yet.
*
@@ -166,18 +199,22 @@ struct HackResponseCodeState
* @param cmd the command being cleaned up.
*/
static void
-hack_response_code_cleanup
- (void *cls,
+hack_response_code_cleanup (
+ void *cls,
const struct TALER_TESTING_Command *cmd)
{
struct HackResponseCodeState *hrcs = cls;
if (NULL != hrcs->proc)
{
- GNUNET_break (0 == GNUNET_OS_process_kill (hrcs->proc,
- SIGKILL));
- GNUNET_OS_process_wait (hrcs->proc);
- GNUNET_OS_process_destroy (hrcs->proc);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_process_kill (hrcs->proc,
+ SIGKILL));
+ GNUNET_process_wait (hrcs->proc,
+ true,
+ NULL,
+ NULL);
+ GNUNET_process_destroy (hrcs->proc);
hrcs->proc = NULL;
}
GNUNET_free (hrcs);
@@ -232,9 +269,7 @@ hack_response_code_run (void *cls,
GNUNET_asprintf (&http_status, "%u",
hrcs->http_status);
- hrcs->proc = GNUNET_OS_start_process (
- GNUNET_OS_INHERIT_STD_ALL,
- NULL, NULL, NULL,
+ hrcs->proc = start_process (
"taler-twister",
"taler-twister",
"-c", hrcs->config_filename,
@@ -291,10 +326,14 @@ delete_object_cleanup
if (NULL != dos->proc)
{
- GNUNET_break (0 == GNUNET_OS_process_kill (dos->proc,
- SIGKILL));
- GNUNET_OS_process_wait (dos->proc);
- GNUNET_OS_process_destroy (dos->proc);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_process_kill (dos->proc,
+ SIGKILL));
+ GNUNET_process_wait (dos->proc,
+ true,
+ NULL,
+ NULL);
+ GNUNET_process_destroy (dos->proc);
dos->proc = NULL;
}
GNUNET_free (dos);
@@ -345,13 +384,11 @@ delete_object_run (void *cls,
{
struct DeleteObjectState *dos = cls;
- dos->proc = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL,
- NULL, NULL, NULL,
- "taler-twister",
- "taler-twister",
- "-c", dos->config_filename,
- "--deleteobject", dos->path,
- NULL);
+ dos->proc = start_process ("taler-twister",
+ "taler-twister",
+ "-c", dos->config_filename,
+ "--deleteobject", dos->path,
+ NULL);
if (NULL == dos->proc)
{
GNUNET_break (0);
@@ -377,10 +414,14 @@ modify_object_cleanup (void *cls,
if (NULL != mos->proc)
{
- GNUNET_break (0 == GNUNET_OS_process_kill (mos->proc,
- SIGKILL));
- GNUNET_OS_process_wait (mos->proc);
- GNUNET_OS_process_destroy (mos->proc);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_process_kill (mos->proc,
+ SIGKILL));
+ GNUNET_process_wait (mos->proc,
+ true,
+ NULL,
+ NULL);
+ GNUNET_process_destroy (mos->proc);
mos->proc = NULL;
}
GNUNET_free (mos);
@@ -431,14 +472,12 @@ modify_object_dl_run (void *cls,
{
struct ModifyObjectState *mos = cls;
- mos->proc = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL,
- NULL, NULL, NULL,
- "taler-twister",
- "taler-twister",
- "-c", mos->config_filename,
- "-m", mos->path,
- "--value", mos->value,
- NULL);
+ mos->proc = start_process ("taler-twister",
+ "taler-twister",
+ "-c", mos->config_filename,
+ "-m", mos->path,
+ "--value", mos->value,
+ NULL);
if (NULL == mos->proc)
{
GNUNET_break (0);
@@ -463,14 +502,12 @@ modify_object_ul_run (void *cls,
{
struct ModifyObjectState *mos = cls;
- mos->proc = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL,
- NULL, NULL, NULL,
- "taler-twister",
- "taler-twister",
- "-c", mos->config_filename,
- "-X", mos->path,
- "--value", mos->value,
- NULL);
+ mos->proc = start_process ("taler-twister",
+ "taler-twister",
+ "-c", mos->config_filename,
+ "-X", mos->path,
+ "--value", mos->value,
+ NULL);
if (NULL == mos->proc)
{
GNUNET_break (0);
@@ -495,14 +532,12 @@ modify_header_dl_run (void *cls,
{
struct ModifyObjectState *mos = cls;
- mos->proc = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL,
- NULL, NULL, NULL,
- "taler-twister",
- "taler-twister",
- "-H", mos->path,
- "--value", mos->value,
- "-c", mos->config_filename,
- NULL);
+ mos->proc = start_process ("taler-twister",
+ "taler-twister",
+ "-H", mos->path,
+ "--value", mos->value,
+ "-c", mos->config_filename,
+ NULL);
if (NULL == mos->proc)
{
GNUNET_break (0);
@@ -553,10 +588,14 @@ flip_object_cleanup
if (NULL != fos->proc)
{
- GNUNET_break (0 == GNUNET_OS_process_kill (fos->proc,
- SIGKILL));
- GNUNET_OS_process_wait (fos->proc);
- GNUNET_OS_process_destroy (fos->proc);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_process_kill (fos->proc,
+ SIGKILL));
+ GNUNET_process_wait (fos->proc,
+ true,
+ NULL,
+ NULL);
+ GNUNET_process_destroy (fos->proc);
fos->proc = NULL;
}
GNUNET_free (fos);
@@ -606,13 +645,11 @@ flip_upload_run (void *cls,
{
struct FlipObjectState *fos = cls;
- fos->proc = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL,
- NULL, NULL, NULL,
- "taler-twister",
- "taler-twister",
- "-c", fos->config_filename,
- "--flip-ul", fos->path,
- NULL);
+ fos->proc = start_process ("taler-twister",
+ "taler-twister",
+ "-c", fos->config_filename,
+ "--flip-ul", fos->path,
+ NULL);
if (NULL == fos->proc)
{
GNUNET_break (0);
@@ -637,13 +674,11 @@ flip_download_run (void *cls,
{
struct FlipObjectState *fos = cls;
- fos->proc = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL,
- NULL, NULL, NULL,
- "taler-twister",
- "taler-twister",
- "-c", fos->config_filename,
- "--flip-dl", fos->path,
- NULL);
+ fos->proc = start_process ("taler-twister",
+ "taler-twister",
+ "-c", fos->config_filename,
+ "--flip-dl", fos->path,
+ NULL);
if (NULL == fos->proc)
{
GNUNET_break (0);
@@ -717,10 +752,14 @@ malform_request_cleanup (void *cls,
if (NULL != mrs->proc)
{
- GNUNET_break (0 == GNUNET_OS_process_kill (mrs->proc,
- SIGKILL));
- GNUNET_OS_process_wait (mrs->proc);
- GNUNET_OS_process_destroy (mrs->proc);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_process_kill (mrs->proc,
+ SIGKILL));
+ GNUNET_process_wait (mrs->proc,
+ true,
+ NULL,
+ NULL);
+ GNUNET_process_destroy (mrs->proc);
mrs->proc = NULL;
}
GNUNET_free (mrs);
@@ -770,13 +809,11 @@ malform_request_run (void *cls,
{
struct MalformRequestState *mrs = cls;
- mrs->proc = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL,
- NULL, NULL, NULL,
- "taler-twister",
- "taler-twister",
- "-c", mrs->config_filename,
- "--malformupload",
- NULL);
+ mrs->proc = start_process ("taler-twister",
+ "taler-twister",
+ "-c", mrs->config_filename,
+ "--malformupload",
+ NULL);
if (NULL == mrs->proc)
{
GNUNET_break (0);
@@ -802,10 +839,14 @@ malform_response_cleanup (void *cls,
if (NULL != mrs->proc)
{
- GNUNET_break (0 == GNUNET_OS_process_kill (mrs->proc,
- SIGKILL));
- GNUNET_OS_process_wait (mrs->proc);
- GNUNET_OS_process_destroy (mrs->proc);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_process_kill (mrs->proc,
+ SIGKILL));
+ GNUNET_process_wait (mrs->proc,
+ true,
+ NULL,
+ NULL);
+ GNUNET_process_destroy (mrs->proc);
mrs->proc = NULL;
}
GNUNET_free (mrs);
@@ -855,13 +896,11 @@ malform_response_run (void *cls,
{
struct MalformResponseState *mrs = cls;
- mrs->proc = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL,
- NULL, NULL, NULL,
- "taler-twister",
- "taler-twister",
- "-c", mrs->config_filename,
- "--malform",
- NULL);
+ mrs->proc = start_process ("taler-twister",
+ "taler-twister",
+ "-c", mrs->config_filename,
+ "--malform",
+ NULL);
if (NULL == mrs->proc)
{
GNUNET_break (0);
diff --git a/src/testing/testing_api_loop.c b/src/testing/testing_api_loop.c
@@ -412,7 +412,7 @@ maint_child_death (void *cls,
{
struct TALER_TESTING_Interpreter *is = cls;
struct TALER_TESTING_Command *cmd = &is->commands[is->ip];
- struct GNUNET_OS_Process **processp;
+ struct GNUNET_Process **processp;
is->cwh = NULL;
while (TALER_TESTING_cmd_is_batch (cmd))
@@ -430,7 +430,7 @@ maint_child_death (void *cls,
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Got the dead child process handle, waiting for termination ...\n");
- GNUNET_OS_process_destroy (*processp);
+ GNUNET_process_destroy (*processp);
*processp = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"... definitively terminated\n");
@@ -472,7 +472,7 @@ maint_child_death (void *cls,
void
TALER_TESTING_wait_for_sigchld (struct TALER_TESTING_Interpreter *is)
{
- struct GNUNET_OS_Process **processp;
+ struct GNUNET_Process **processp;
struct TALER_TESTING_Command *cmd = &is->commands[is->ip];
while (TALER_TESTING_cmd_is_batch (cmd))
diff --git a/src/util/age_restriction.c b/src/util/age_restriction.c
@@ -135,13 +135,12 @@ ecdsa_create_from_seed (
GNUNET_assert (
GNUNET_OK ==
- GNUNET_CRYPTO_kdf (key,
- sizeof (*key),
- &seed,
- seed_size,
- "age commitment",
- sizeof ("age commitment") - 1,
- NULL, 0));
+ GNUNET_CRYPTO_hkdf_gnunet (key,
+ sizeof (*key),
+ &seed,
+ seed_size,
+ "age commitment",
+ sizeof ("age commitment") - 1));
/* See GNUNET_CRYPTO_ecdsa_key_create */
key->d[0] &= 248;
key->d[31] &= 127;
@@ -277,13 +276,12 @@ TALER_age_commitment_derive_from_secret (
struct GNUNET_HashCode salt;
enum GNUNET_GenericReturnValue ret;
- ret = GNUNET_CRYPTO_kdf (&salt,
- sizeof (salt),
- "age commitment",
- strlen ("age commitment"),
- secret,
- sizeof(*secret),
- NULL, 0);
+ ret = GNUNET_CRYPTO_hkdf_gnunet (&salt,
+ sizeof (salt),
+ "age commitment",
+ strlen ("age commitment"),
+ secret,
+ sizeof(*secret));
if (GNUNET_OK != ret)
{
GNUNET_break (0);
@@ -368,13 +366,12 @@ TALER_age_commitment_proof_derive_from_secret (
struct GNUNET_HashCode salt;
enum GNUNET_GenericReturnValue ret;
- ret = GNUNET_CRYPTO_kdf (&salt,
- sizeof (salt),
- "age commitment",
- strlen ("age commitment"),
- secret,
- sizeof(*secret),
- NULL, 0);
+ ret = GNUNET_CRYPTO_hkdf_gnunet (&salt,
+ sizeof (salt),
+ "age commitment",
+ strlen ("age commitment"),
+ secret,
+ sizeof(*secret));
if (GNUNET_OK != ret)
{
GNUNET_break (0);
@@ -810,11 +807,10 @@ TALER_age_restriction_from_secret (
enum GNUNET_GenericReturnValue ret;
const char *label = i < num_priv ? "age-commitment" : "age-factor";
- ret = GNUNET_CRYPTO_kdf (&seed_i, sizeof(seed_i),
- secret, sizeof(*secret),
- label, strlen (label),
- &i, sizeof(i),
- NULL, 0);
+ ret = GNUNET_CRYPTO_hkdf_gnunet (&seed_i, sizeof(seed_i),
+ secret, sizeof(*secret),
+ label, strlen (label),
+ GNUNET_CRYPTO_kdf_arg_auto (&i));
GNUNET_assert (GNUNET_OK == ret);
/* Only generate and save the private keys and public keys for age groups
diff --git a/src/util/amount.c b/src/util/amount.c
@@ -897,7 +897,9 @@ TALER_amount_set_add (struct TALER_AmountSet *as,
TALER_amount_min (ai,
ai,
cap));
- return;
+ return (TALER_amount_is_zero (ai))
+ ? TALER_AAR_RESULT_ZERO
+ : TALER_AAR_RESULT_POSITIVE;
}
GNUNET_array_append (as->taa,
as->taa_size,
diff --git a/src/util/crypto.c b/src/util/crypto.c
@@ -166,15 +166,14 @@ TALER_withdraw_expand_secrets (
uint32_t be_salt = htonl (num_coins);
GNUNET_assert (GNUNET_OK ==
- GNUNET_CRYPTO_kdf (secrets,
- sizeof (*secrets) * num_coins,
- &be_salt,
- sizeof (be_salt),
- seed,
- sizeof (*seed),
- "taler-withdraw-secrets",
- strlen ("taler-withdraw-secrets"),
- NULL, 0));
+ GNUNET_CRYPTO_hkdf_gnunet (
+ secrets,
+ sizeof (*secrets) * num_coins,
+ &be_salt,
+ sizeof (be_salt),
+ seed,
+ sizeof (*seed),
+ GNUNET_CRYPTO_kdf_arg_string ("taler-withdraw-secrets")));
}
}
@@ -187,15 +186,14 @@ TALER_withdraw_expand_kappa_seed (
uint32_t be_salt = htonl (TALER_CNC_KAPPA);
GNUNET_assert (GNUNET_OK ==
- GNUNET_CRYPTO_kdf (seeds,
- sizeof (*seeds),
- &be_salt,
- sizeof (be_salt),
- seed,
- sizeof (*seed),
- "taler-kappa-seeds",
- strlen ("taler-kappa-seeds"),
- NULL, 0));
+ GNUNET_CRYPTO_hkdf_gnunet (
+ seeds,
+ sizeof (*seeds),
+ &be_salt,
+ sizeof (be_salt),
+ seed,
+ sizeof (*seed),
+ GNUNET_CRYPTO_kdf_arg_string ("taler-kappa-seeds")));
}
@@ -238,15 +236,14 @@ TALER_transfer_secret_to_planchet_secret (
uint32_t be_salt = htonl (coin_num_salt);
GNUNET_assert (GNUNET_OK ==
- GNUNET_CRYPTO_kdf (ps,
- sizeof (*ps),
- &be_salt,
- sizeof (be_salt),
- secret_seed,
- sizeof (*secret_seed),
- "taler-coin-derivation",
- strlen ("taler-coin-derivation"),
- NULL, 0));
+ GNUNET_CRYPTO_hkdf_gnunet (
+ ps,
+ sizeof (*ps),
+ &be_salt,
+ sizeof (be_salt),
+ secret_seed,
+ sizeof (*secret_seed),
+ GNUNET_CRYPTO_kdf_arg_string ("taler-coin-derivation")));
}
@@ -256,14 +253,13 @@ TALER_cs_withdraw_nonce_derive (
struct GNUNET_CRYPTO_CsSessionNonce *nonce)
{
GNUNET_assert (GNUNET_YES ==
- GNUNET_CRYPTO_kdf (nonce,
- sizeof (*nonce),
- "n",
- strlen ("n"),
- ps,
- sizeof(*ps),
- NULL,
- 0));
+ GNUNET_CRYPTO_hkdf_gnunet (
+ nonce,
+ sizeof (*nonce),
+ "n",
+ strlen ("n"),
+ ps,
+ sizeof(*ps)));
}
@@ -273,14 +269,13 @@ TALER_cs_withdraw_seed_to_blinding_seed (
struct TALER_BlindingMasterSeedP *blinding_seed)
{
GNUNET_assert (GNUNET_YES ==
- GNUNET_CRYPTO_kdf (blinding_seed,
- sizeof (*blinding_seed),
- "withdraw-blinding",
- strlen ("withdraw-blinding"),
- seed,
- sizeof(*seed),
- NULL,
- 0));
+ GNUNET_CRYPTO_hkdf_gnunet (
+ blinding_seed,
+ sizeof (*blinding_seed),
+ "withdraw-blinding",
+ strlen ("withdraw-blinding"),
+ seed,
+ sizeof(*seed)));
}
@@ -291,16 +286,14 @@ TALER_cs_refresh_seed_to_blinding_seed (
struct TALER_BlindingMasterSeedP *blinding_seed)
{
GNUNET_assert (GNUNET_YES ==
- GNUNET_CRYPTO_kdf (blinding_seed,
- sizeof (*blinding_seed),
- "refresh-blinding",
- strlen ("refresh-blinding"),
- coin_priv,
- sizeof(*coin_priv),
- seed,
- sizeof(*seed),
- NULL,
- 0));
+ GNUNET_CRYPTO_hkdf_gnunet (
+ blinding_seed,
+ sizeof (*blinding_seed),
+ "refresh-blinding",
+ strlen ("refresh-blinding"),
+ coin_priv,
+ sizeof (*coin_priv),
+ GNUNET_CRYPTO_kdf_arg_auto (seed)));
}
@@ -315,16 +308,14 @@ TALER_cs_nonce_derive_indexed (
const char *operation = for_melt ? "refresh-n" : "withdraw-n";
GNUNET_assert (GNUNET_YES ==
- GNUNET_CRYPTO_kdf (nonce,
- sizeof (*nonce),
- &be_salt,
- sizeof (be_salt),
- operation,
- strlen (operation),
- seed,
- sizeof(*seed),
- NULL,
- 0));
+ GNUNET_CRYPTO_hkdf_gnunet (
+ nonce,
+ sizeof (*nonce),
+ &be_salt,
+ sizeof (be_salt),
+ operation,
+ strlen (operation),
+ GNUNET_CRYPTO_kdf_arg_auto (seed)));
}
@@ -567,15 +558,14 @@ TALER_refresh_expand_seed_to_kappa_batch_seeds (
struct TALER_KappaPrivateRefreshBatchSeedsP *kappa_batch_seeds)
{
GNUNET_assert (GNUNET_OK ==
- GNUNET_CRYPTO_kdf (kappa_batch_seeds,
- sizeof (*kappa_batch_seeds),
- "refresh-batch-seeds",
- strlen ("refresh-batch-seeds"),
- refresh_master_seed,
- sizeof (*refresh_master_seed),
- coin_priv,
- sizeof(*coin_priv),
- NULL, 0));
+ GNUNET_CRYPTO_hkdf_gnunet (
+ kappa_batch_seeds,
+ sizeof (*kappa_batch_seeds),
+ "refresh-batch-seeds",
+ strlen ("refresh-batch-seeds"),
+ refresh_master_seed,
+ sizeof (*refresh_master_seed),
+ GNUNET_CRYPTO_kdf_arg_auto (coin_priv)));
}
@@ -586,14 +576,13 @@ TALER_refresh_expand_batch_seed_to_transfer_private_keys (
struct TALER_TransferPrivateKeyP transfer_pks[num_transfer_pks])
{
GNUNET_assert (GNUNET_OK ==
- GNUNET_CRYPTO_kdf (
+ GNUNET_CRYPTO_hkdf_gnunet (
transfer_pks,
sizeof (*transfer_pks) * num_transfer_pks,
"refresh-transfer-private-keys",
strlen ("refresh-transfer-private-keys"),
batch_seed,
- sizeof (*batch_seed),
- NULL, 0));
+ sizeof (*batch_seed)));
}
@@ -692,13 +681,13 @@ TALER_refresh_expand_kappa_nonces_v27 (
struct TALER_KappaPublicRefreshNoncesP *kappa_nonces)
{
GNUNET_assert (GNUNET_OK ==
- GNUNET_CRYPTO_kdf (kappa_nonces,
- sizeof (*kappa_nonces),
- "refresh-kappa-nonces",
- strlen ("refresh-kappa-nonces"),
- refresh_seed,
- sizeof (*refresh_seed),
- NULL, 0));
+ GNUNET_CRYPTO_hkdf_gnunet (
+ kappa_nonces,
+ sizeof (*kappa_nonces),
+ "refresh-kappa-nonces",
+ strlen ("refresh-kappa-nonces"),
+ refresh_seed,
+ sizeof (*refresh_seed)));
}
@@ -709,14 +698,13 @@ TALER_refresh_signature_to_secrets_v27 (
struct TALER_PlanchetMasterSecretP secrets[static num_secrets])
{
GNUNET_assert (GNUNET_YES ==
- GNUNET_CRYPTO_kdf (secrets,
- sizeof (*secrets) * num_secrets,
- "refresh-planchet-secret",
- strlen ("refresh-planchet-secret"),
- sig,
- sizeof(*sig),
- NULL,
- 0));
+ GNUNET_CRYPTO_hkdf_gnunet (
+ secrets,
+ sizeof (*secrets) * num_secrets,
+ "refresh-planchet-secret",
+ strlen ("refresh-planchet-secret"),
+ sig,
+ sizeof(*sig)));
}
@@ -837,16 +825,14 @@ TALER_kyc_measure_authorization_hash (
GNUNET_assert (
GNUNET_YES ==
- GNUNET_CRYPTO_kdf (mah,
- sizeof (*mah),
- &be64,
- sizeof (be64),
- access_token,
- sizeof (*access_token),
- &be32,
- sizeof (be32),
- NULL,
- 0));
+ GNUNET_CRYPTO_hkdf_gnunet (
+ mah,
+ sizeof (*mah),
+ &be64,
+ sizeof (be64),
+ access_token,
+ sizeof (*access_token),
+ GNUNET_CRYPTO_kdf_arg_auto (&be32)));
}
@@ -857,16 +843,14 @@ TALER_merchant_instance_auth_hash_with_salt (
const char *passphrase)
{
GNUNET_assert (GNUNET_YES ==
- GNUNET_CRYPTO_kdf (auth_hash,
- sizeof (*auth_hash),
- salt,
- sizeof (*salt),
- passphrase,
- strlen (passphrase),
- "merchant-instance-auth",
- strlen ("merchant-instance-auth"),
- NULL,
- 0));
+ GNUNET_CRYPTO_hkdf_gnunet (
+ auth_hash,
+ sizeof (*auth_hash),
+ salt,
+ sizeof (*salt),
+ passphrase,
+ strlen (passphrase),
+ GNUNET_CRYPTO_kdf_arg_string ("merchant-instance-auth")));
}
diff --git a/src/util/crypto_confirmation.c b/src/util/crypto_confirmation.c
@@ -272,14 +272,13 @@ TALER_build_pos_confirmation (const char *pos_key,
TALER_amount_hton (&ntotal,
total);
GNUNET_assert (GNUNET_YES ==
- GNUNET_CRYPTO_kdf (&hkey,
- sizeof (hkey),
- &ntotal,
- sizeof (ntotal),
- key,
- key_len,
- NULL,
- 0));
+ GNUNET_CRYPTO_hkdf_gnunet (
+ &hkey,
+ sizeof (hkey),
+ &ntotal,
+ sizeof (ntotal),
+ key,
+ key_len));
GNUNET_free (key);
ret = executive_totp (&hkey,
sizeof(hkey),
diff --git a/src/util/crypto_contract.c b/src/util/crypto_contract.c
@@ -77,22 +77,20 @@ derive_key (const void *key_material,
struct SymKeyP *key)
{
GNUNET_assert (GNUNET_YES ==
- GNUNET_CRYPTO_kdf (key,
- sizeof (*key),
- /* salt / XTS */
- nonce,
- sizeof (*nonce),
- /* ikm */
- key_material,
- key_m_len,
- /* info chunks */
- /* The "salt" passed here is actually not something random,
- but a protocol-specific identifier string. Thus
- we pass it as a context info to the HKDF */
- salt,
- strlen (salt),
- NULL,
- 0));
+ GNUNET_CRYPTO_hkdf_gnunet (
+ key,
+ sizeof (*key),
+ /* salt / XTS */
+ nonce,
+ sizeof (*nonce),
+ /* ikm */
+ key_material,
+ key_m_len,
+ /* info chunks */
+ /* The "salt" passed here is actually not something random,
+ but a protocol-specific identifier string. Thus
+ we pass it as a context info to the HKDF */
+ GNUNET_CRYPTO_kdf_arg_string (salt)));
}
diff --git a/src/util/crypto_wire.c b/src/util/crypto_wire.c
@@ -29,15 +29,14 @@ TALER_merchant_wire_signature_hash (const struct TALER_FullPayto payto_uri,
struct TALER_MerchantWireHashP *hc)
{
GNUNET_assert (GNUNET_YES ==
- GNUNET_CRYPTO_kdf (hc,
- sizeof (*hc),
- salt,
- sizeof (*salt),
- payto_uri.full_payto,
- strlen (payto_uri.full_payto) + 1,
- "merchant-wire-signature",
- strlen ("merchant-wire-signature"),
- NULL, 0));
+ GNUNET_CRYPTO_hkdf_gnunet (
+ hc,
+ sizeof (*hc),
+ salt,
+ sizeof (*salt),
+ payto_uri.full_payto,
+ strlen (payto_uri.full_payto) + 1,
+ GNUNET_CRYPTO_kdf_arg_string ("merchant-wire-signature")));
}
diff --git a/src/util/denom.c b/src/util/denom.c
@@ -386,27 +386,24 @@ TALER_planchet_blinding_secret_create (
return;
case GNUNET_CRYPTO_BSA_RSA:
GNUNET_assert (GNUNET_YES ==
- GNUNET_CRYPTO_kdf (&bks->rsa_bks,
- sizeof (bks->rsa_bks),
- "bks",
- strlen ("bks"),
- ps,
- sizeof(*ps),
- NULL,
- 0));
+ GNUNET_CRYPTO_hkdf_gnunet (
+ &bks->rsa_bks,
+ sizeof (bks->rsa_bks),
+ "bks",
+ strlen ("bks"),
+ ps,
+ sizeof(*ps)));
return;
case GNUNET_CRYPTO_BSA_CS:
GNUNET_assert (GNUNET_YES ==
- GNUNET_CRYPTO_kdf (&bks->nonce,
- sizeof (bks->nonce),
- "bseed",
- strlen ("bseed"),
- ps,
- sizeof(*ps),
- &bi->details.cs_values,
- sizeof(bi->details.cs_values),
- NULL,
- 0));
+ GNUNET_CRYPTO_hkdf_gnunet (
+ &bks->nonce,
+ sizeof (bks->nonce),
+ "bseed",
+ strlen ("bseed"),
+ ps,
+ sizeof(*ps),
+ GNUNET_CRYPTO_kdf_arg_auto (&bi->details.cs_values)));
return;
}
GNUNET_assert (0);
@@ -432,27 +429,24 @@ TALER_planchet_setup_coin_priv (
return;
case GNUNET_CRYPTO_BSA_RSA:
GNUNET_assert (GNUNET_YES ==
- GNUNET_CRYPTO_kdf (coin_priv,
- sizeof (*coin_priv),
- "coin",
- strlen ("coin"),
- ps,
- sizeof(*ps),
- NULL,
- 0));
+ GNUNET_CRYPTO_hkdf_gnunet (
+ coin_priv,
+ sizeof (*coin_priv),
+ "coin",
+ strlen ("coin"),
+ ps,
+ sizeof(*ps)));
return;
case GNUNET_CRYPTO_BSA_CS:
GNUNET_assert (GNUNET_YES ==
- GNUNET_CRYPTO_kdf (coin_priv,
- sizeof (*coin_priv),
- "coin",
- strlen ("coin"),
- ps,
- sizeof(*ps),
- &bi->details.cs_values,
- sizeof(bi->details.cs_values),
- NULL,
- 0));
+ GNUNET_CRYPTO_hkdf_gnunet (
+ coin_priv,
+ sizeof (*coin_priv),
+ "coin",
+ strlen ("coin"),
+ ps,
+ sizeof(*ps),
+ GNUNET_CRYPTO_kdf_arg_auto (&bi->details.cs_values)));
return;
}
GNUNET_assert (0);
diff --git a/src/util/tokens.c b/src/util/tokens.c
@@ -73,27 +73,24 @@ TALER_token_use_setup_priv (
return;
case GNUNET_CRYPTO_BSA_RSA:
GNUNET_assert (GNUNET_YES ==
- GNUNET_CRYPTO_kdf (token_priv,
- sizeof (*token_priv),
- "token",
- strlen ("token"),
- master,
- sizeof(*master),
- NULL,
- 0));
+ GNUNET_CRYPTO_hkdf_gnunet (
+ token_priv,
+ sizeof (*token_priv),
+ "token",
+ strlen ("token"),
+ master,
+ sizeof(*master)));
return;
case GNUNET_CRYPTO_BSA_CS:
GNUNET_assert (GNUNET_YES ==
- GNUNET_CRYPTO_kdf (token_priv,
- sizeof (*token_priv),
- "token",
- strlen ("token"),
- master,
- sizeof(*master),
- &bi->details.cs_values,
- sizeof(bi->details.cs_values),
- NULL,
- 0));
+ GNUNET_CRYPTO_hkdf_gnunet (
+ token_priv,
+ sizeof (*token_priv),
+ "token",
+ strlen ("token"),
+ master,
+ sizeof(*master),
+ GNUNET_CRYPTO_kdf_arg_auto (&bi->details.cs_values)));
return;
}
GNUNET_assert (0);
@@ -116,27 +113,24 @@ TALER_token_use_blinding_secret_create (
return;
case GNUNET_CRYPTO_BSA_RSA:
GNUNET_assert (GNUNET_YES ==
- GNUNET_CRYPTO_kdf (&bks->rsa_bks,
- sizeof (bks->rsa_bks),
- "bks",
- strlen ("bks"),
- master,
- sizeof(*master),
- NULL,
- 0));
+ GNUNET_CRYPTO_hkdf_gnunet (
+ &bks->rsa_bks,
+ sizeof (bks->rsa_bks),
+ "bks",
+ strlen ("bks"),
+ master,
+ sizeof(*master)));
return;
case GNUNET_CRYPTO_BSA_CS:
GNUNET_assert (GNUNET_YES ==
- GNUNET_CRYPTO_kdf (&bks->nonce,
- sizeof (bks->nonce),
- "bseed",
- strlen ("bseed"),
- master,
- sizeof(*master),
- &bi->details.cs_values,
- sizeof(bi->details.cs_values),
- NULL,
- 0));
+ GNUNET_CRYPTO_hkdf_gnunet (
+ &bks->nonce,
+ sizeof (bks->nonce),
+ "bseed",
+ strlen ("bseed"),
+ master,
+ sizeof(*master),
+ GNUNET_CRYPTO_kdf_arg_auto (&bi->details.cs_values)));
return;
}
GNUNET_assert (0);