diff options
Diffstat (limited to 'src/testing/testing_cmd_recover_secret.c')
-rw-r--r-- | src/testing/testing_cmd_recover_secret.c | 64 |
1 files changed, 33 insertions, 31 deletions
diff --git a/src/testing/testing_cmd_recover_secret.c b/src/testing/testing_cmd_recover_secret.c index 55c0168..1f3e832 100644 --- a/src/testing/testing_cmd_recover_secret.c +++ b/src/testing/testing_cmd_recover_secret.c @@ -3,14 +3,14 @@ Copyright (C) 2020, 2021 Anastasis SARL Anastasis is free software; you can redistribute it and/or modify it under the - terms of the GNU Lesser General Public License as published by the Free Software + terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. Anastasis is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. + A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU Affero General Public License along with + You should have received a copy of the GNU General Public License along with Anastasis; see the file COPYING.GPL. If not, see <http://www.gnu.org/licenses/> */ /** @@ -67,11 +67,6 @@ struct RecoverSecretState json_t *id_data; /** - * Salt to be used to derive the id - */ - struct ANASTASIS_CRYPTO_ProviderSaltP *salt; - - /** * Recovery information from the lookup */ struct ANASTASIS_RecoveryInformation *ri; @@ -113,13 +108,19 @@ policy_lookup_cb (void *cls, { struct RecoverSecretState *rss = cls; - rss->ri = (struct ANASTASIS_RecoveryInformation *) ri; if (NULL == ri) { GNUNET_break (0); TALER_TESTING_interpreter_fail (rss->is); return; } + if (0 == ri->cs_len) + { + GNUNET_break (0); + TALER_TESTING_interpreter_fail (rss->is); + return; + } + rss->ri = (struct ANASTASIS_RecoveryInformation *) ri; TALER_TESTING_interpreter_next (rss->is); } @@ -188,14 +189,14 @@ recover_secret_run (void *cls, { struct RecoverSecretState *rss = cls; const struct TALER_TESTING_Command *ref; - const struct ANASTASIS_CRYPTO_ProviderSaltP *salt; + const struct ANASTASIS_CRYPTO_ProviderSaltP *provider_salt; rss->is = is; if (NULL != rss->download_reference) { - ref = TALER_TESTING_interpreter_lookup_command - (is, - rss->download_reference); + ref = TALER_TESTING_interpreter_lookup_command ( + is, + rss->download_reference); if (NULL == ref) { GNUNET_break (0); @@ -203,9 +204,8 @@ recover_secret_run (void *cls, return; } if (GNUNET_OK != - ANASTASIS_TESTING_get_trait_salt (ref, - 0, - &salt)) + ANASTASIS_TESTING_get_trait_provider_salt (ref, + &provider_salt)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (rss->is); @@ -224,24 +224,25 @@ recover_secret_run (void *cls, return; } if (GNUNET_OK != - ANASTASIS_TESTING_get_trait_core_secret (ref, - 0, - &rss->core_secret)) + ANASTASIS_TESTING_get_trait_core_secret ( + ref, + &rss->core_secret)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (rss->is); return; } } - rss->recovery = ANASTASIS_recovery_begin (is->ctx, - rss->id_data, - rss->version, - rss->anastasis_url, - salt, - &policy_lookup_cb, - rss, - &core_secret_cb, - rss); + rss->recovery = ANASTASIS_recovery_begin ( + TALER_TESTING_interpreter_get_context (is), + rss->id_data, + rss->version, + rss->anastasis_url, + provider_salt, + &policy_lookup_cb, + rss, + &core_secret_cb, + rss); if (NULL == rss->recovery) { GNUNET_break (0); @@ -307,7 +308,7 @@ recover_secret_cleanup (void *cls, * @param index index number of the object to extract. * @return #GNUNET_OK on success */ -static int +static enum GNUNET_GenericReturnValue recover_secret_traits (void *cls, const void **ret, const char *trait, @@ -327,8 +328,9 @@ recover_secret_traits (void *cls, } { struct TALER_TESTING_Trait traits[] = { - ANASTASIS_TESTING_make_trait_challenge (index, - rss->ri->cs[index]), + ANASTASIS_TESTING_make_trait_challenges ( + index, + (const struct ANASTASIS_Challenge **) &rss->ri->cs[index]), TALER_TESTING_trait_end () }; |