From 6cceb617af887df49df74729bb1813bbd75a1346 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 4 Dec 2020 20:29:18 +0100 Subject: centralize (most) offline signing/verifying operations into offline_signatures.c --- src/testing/testing_api_cmd_revoke_denom_key.c | 13 +++---------- src/testing/testing_api_cmd_revoke_sign_key.c | 13 +++---------- src/testing/testing_api_cmd_set_wire_fee.c | 24 +++++++----------------- src/testing/testing_api_cmd_wire_add.c | 15 ++++----------- src/testing/testing_api_cmd_wire_del.c | 15 ++++----------- 5 files changed, 21 insertions(+), 59 deletions(-) (limited to 'src/testing') diff --git a/src/testing/testing_api_cmd_revoke_denom_key.c b/src/testing/testing_api_cmd_revoke_denom_key.c index 7dffcf395..fd7695bce 100644 --- a/src/testing/testing_api_cmd_revoke_denom_key.c +++ b/src/testing/testing_api_cmd_revoke_denom_key.c @@ -187,16 +187,9 @@ revoke_run (void *cls, } else { - struct TALER_MasterDenominationKeyRevocationPS kv = { - .purpose.purpose = htonl ( - TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED), - .purpose.size = htonl (sizeof (kv)), - .h_denom_pub = denom_pub->h_key - }; - - GNUNET_CRYPTO_eddsa_sign (&is->master_priv.eddsa_priv, - &kv, - &master_sig.eddsa_signature); + TALER_exchange_offline_denomination_revoke_sign (&denom_pub->h_key, + &is->master_priv, + &master_sig); } rs->kh = TALER_EXCHANGE_management_revoke_denomination_key ( is->ctx, diff --git a/src/testing/testing_api_cmd_revoke_sign_key.c b/src/testing/testing_api_cmd_revoke_sign_key.c index d85f63053..599fe180b 100644 --- a/src/testing/testing_api_cmd_revoke_sign_key.c +++ b/src/testing/testing_api_cmd_revoke_sign_key.c @@ -187,16 +187,9 @@ revoke_run (void *cls, } else { - struct TALER_MasterSigningKeyRevocationPS kv = { - .purpose.purpose = htonl ( - TALER_SIGNATURE_MASTER_SIGNING_KEY_REVOKED), - .purpose.size = htonl (sizeof (kv)), - .exchange_pub = *exchange_pub - }; - - GNUNET_CRYPTO_eddsa_sign (&is->master_priv.eddsa_priv, - &kv, - &master_sig.eddsa_signature); + TALER_exchange_offline_signkey_revoke_sign (exchange_pub, + &is->master_priv, + &master_sig); } rs->kh = TALER_EXCHANGE_management_revoke_signing_key ( is->ctx, diff --git a/src/testing/testing_api_cmd_set_wire_fee.c b/src/testing/testing_api_cmd_set_wire_fee.c index 1f8b3994a..613e0f713 100644 --- a/src/testing/testing_api_cmd_set_wire_fee.c +++ b/src/testing/testing_api_cmd_set_wire_fee.c @@ -152,23 +152,13 @@ wire_add_run (void *cls, } else { - struct TALER_MasterWireFeePS kv = { - .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_WIRE_FEES), - .purpose.size = htonl (sizeof (kv)), - .start_date = GNUNET_TIME_absolute_hton (start_time), - .end_date = GNUNET_TIME_absolute_hton (end_time), - }; - - GNUNET_CRYPTO_hash (ds->wire_method, - strlen (ds->wire_method) + 1, - &kv.h_wire_method); - TALER_amount_hton (&kv.wire_fee, - &wire_fee); - TALER_amount_hton (&kv.closing_fee, - &closing_fee); - GNUNET_CRYPTO_eddsa_sign (&is->master_priv.eddsa_priv, - &kv, - &master_sig.eddsa_signature); + TALER_exchange_offline_wire_fee_sign (ds->wire_method, + start_time, + end_time, + &wire_fee, + &closing_fee, + &is->master_priv, + &master_sig); } ds->dh = TALER_EXCHANGE_management_set_wire_fees ( is->ctx, diff --git a/src/testing/testing_api_cmd_wire_add.c b/src/testing/testing_api_cmd_wire_add.c index 6f25a0f86..8d8a3a4f6 100644 --- a/src/testing/testing_api_cmd_wire_add.c +++ b/src/testing/testing_api_cmd_wire_add.c @@ -126,17 +126,10 @@ wire_add_run (void *cls, } else { - struct TALER_MasterAddWirePS kv = { - .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_ADD_WIRE), - .purpose.size = htonl (sizeof (kv)), - .start_date = GNUNET_TIME_absolute_hton (now), - }; - - TALER_exchange_wire_signature_hash (ds->payto_uri, - &kv.h_wire); - GNUNET_CRYPTO_eddsa_sign (&is->master_priv.eddsa_priv, - &kv, - &master_sig1.eddsa_signature); + TALER_exchange_offline_wire_add_sign (ds->payto_uri, + now, + &is->master_priv, + &master_sig1); TALER_exchange_wire_signature_make (ds->payto_uri, &is->master_priv, &master_sig2); diff --git a/src/testing/testing_api_cmd_wire_del.c b/src/testing/testing_api_cmd_wire_del.c index 2019d1366..2a1c9e455 100644 --- a/src/testing/testing_api_cmd_wire_del.c +++ b/src/testing/testing_api_cmd_wire_del.c @@ -122,17 +122,10 @@ wire_del_run (void *cls, } else { - struct TALER_MasterDelWirePS kv = { - .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_DEL_WIRE), - .purpose.size = htonl (sizeof (kv)), - .end_date = GNUNET_TIME_absolute_hton (now), - }; - - TALER_exchange_wire_signature_hash (ds->payto_uri, - &kv.h_wire); - GNUNET_CRYPTO_eddsa_sign (&is->master_priv.eddsa_priv, - &kv, - &master_sig.eddsa_signature); + TALER_exchange_offline_wire_del_sign (ds->payto_uri, + now, + &is->master_priv, + &master_sig); } ds->dh = TALER_EXCHANGE_management_disable_wire ( is->ctx, -- cgit v1.2.3