diff options
author | Florian Dold <florian@dold.me> | 2021-12-09 10:38:02 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-12-09 10:38:12 +0100 |
commit | dcb73693dd69767828b975dc603e6b0dd2d5408d (patch) | |
tree | 89e5b3e9d4ac2efc5c70437e0b50d086c47282f5 /src/exchange-tools | |
parent | 5433c2a475a9325d0b9f0272faa197a6f8e6d24b (diff) |
crypto worker: eddsa signing
Diffstat (limited to 'src/exchange-tools')
-rw-r--r-- | src/exchange-tools/taler-crypto-worker.c | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/src/exchange-tools/taler-crypto-worker.c b/src/exchange-tools/taler-crypto-worker.c index 674724eda..6690b912b 100644 --- a/src/exchange-tools/taler-crypto-worker.c +++ b/src/exchange-tools/taler-crypto-worker.c @@ -137,42 +137,39 @@ run (void *cls, "sent response\n"); continue; } - if (0 == strcmp ("setup_refresh_planchet", op)) + if (0 == strcmp ("eddsa_sign", + op)) { - struct TALER_TransferSecretP transfer_secret; - uint32_t coin_index; + struct GNUNET_CRYPTO_EddsaSignature sig; + struct GNUNET_CRYPTO_EccSignaturePurpose *msg; + struct GNUNET_CRYPTO_EddsaPrivateKey priv; + size_t msg_size; json_t *resp; - struct GNUNET_JSON_Specification eddsa_verify_spec[] = { - GNUNET_JSON_spec_uint32 ("coin_index", - &coin_index), - GNUNET_JSON_spec_fixed_auto ("transfer_secret", - &transfer_secret), + struct GNUNET_JSON_Specification eddsa_sign_spec[] = { + GNUNET_JSON_spec_fixed_auto ("priv", + &priv), + GNUNET_JSON_spec_varsize ("msg", + (void **) &msg, + &msg_size), GNUNET_JSON_spec_end () }; - struct TALER_CoinSpendPublicKeyP coin_pub; - struct TALER_PlanchetSecretsP ps; - - if (GNUNET_OK != - GNUNET_JSON_parse (args, - eddsa_verify_spec, - NULL, - NULL)) + if (GNUNET_OK != GNUNET_JSON_parse (args, + eddsa_sign_spec, + NULL, + NULL)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "malformed op args\n"); global_ret = 1; return; } - TALER_planchet_setup_refresh (&transfer_secret, - coin_index, - &ps); - GNUNET_CRYPTO_eddsa_key_get_public (&ps.coin_priv.eddsa_priv, - &coin_pub.eddsa_pub); - + GNUNET_CRYPTO_eddsa_sign_ ( + &priv, + msg, + &sig + ); resp = GNUNET_JSON_PACK ( - GNUNET_JSON_pack_data_auto ("coin_priv", &ps.coin_priv), - GNUNET_JSON_pack_data_auto ("coin_pub", &coin_pub), - GNUNET_JSON_pack_data_auto ("blinding_key", &ps.blinding_key) + GNUNET_JSON_pack_data_auto ("sig", &sig) ); json_dumpf (resp, stdout, JSON_COMPACT); printf ("\n"); @@ -181,24 +178,26 @@ run (void *cls, "sent response\n"); continue; } - if (0 == strcmp (op, "create_planchet")) + if (0 == strcmp ("setup_refresh_planchet", op)) { struct TALER_TransferSecretP transfer_secret; - uint32_t coin_num_salt; - struct TALER_PlanchetSecretsP ps; - struct TALER_CoinSpendPublicKeyP coin_pub; + uint32_t coin_index; json_t *resp; - struct GNUNET_JSON_Specification eddsa_verify_spec[] = { + struct GNUNET_JSON_Specification setup_refresh_planchet_spec[] = { + GNUNET_JSON_spec_uint32 ("coin_index", + &coin_index), GNUNET_JSON_spec_fixed_auto ("transfer_secret", &transfer_secret), - GNUNET_JSON_spec_uint32 ("coin_index", - &coin_num_salt), GNUNET_JSON_spec_end () }; - if (GNUNET_OK != GNUNET_JSON_parse (args, - eddsa_verify_spec, - NULL, - NULL)) + struct TALER_CoinSpendPublicKeyP coin_pub; + struct TALER_PlanchetSecretsP ps; + + if (GNUNET_OK != + GNUNET_JSON_parse (args, + setup_refresh_planchet_spec, + NULL, + NULL)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "malformed op args\n"); @@ -206,7 +205,8 @@ run (void *cls, return; } TALER_planchet_setup_refresh (&transfer_secret, - coin_num_salt, &ps); + coin_index, + &ps); GNUNET_CRYPTO_eddsa_key_get_public (&ps.coin_priv.eddsa_priv, &coin_pub.eddsa_pub); |