diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-03-05 12:04:13 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-03-05 12:04:13 +0100 |
commit | 43f8ab6b48d6a51988c85fdc1bcd4f9d4f1a7a01 (patch) | |
tree | 0e419a57c85b8066696e17793ea4d5a4b9e819a8 /src/util/offline_signatures.c | |
parent | 4835ddf60b80a720657d42e2de57a79f258328cd (diff) | |
download | exchange-43f8ab6b48d6a51988c85fdc1bcd4f9d4f1a7a01.tar.xz |
add signing/verifying functions for global fees
Diffstat (limited to 'src/util/offline_signatures.c')
-rw-r--r-- | src/util/offline_signatures.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/util/offline_signatures.c b/src/util/offline_signatures.c index bc1625992..5aef4ac3e 100644 --- a/src/util/offline_signatures.c +++ b/src/util/offline_signatures.c @@ -473,6 +473,54 @@ TALER_exchange_offline_wire_fee_verify ( void +TALER_exchange_offline_global_fee_sign ( + struct GNUNET_TIME_Timestamp start_time, + struct GNUNET_TIME_Timestamp end_time, + const struct TALER_GlobalFeeSet *fees, + const struct TALER_MasterPrivateKeyP *master_priv, + struct TALER_MasterSignatureP *master_sig) +{ + struct TALER_MasterGlobalFeePS kv = { + .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_GLOBAL_FEES), + .purpose.size = htonl (sizeof (kv)), + .start_date = GNUNET_TIME_timestamp_hton (start_time), + .end_date = GNUNET_TIME_timestamp_hton (end_time), + }; + + TALER_global_fee_set_hton (&kv.fees, + fees); + GNUNET_CRYPTO_eddsa_sign (&master_priv->eddsa_priv, + &kv, + &master_sig->eddsa_signature); +} + + +enum GNUNET_GenericReturnValue +TALER_exchange_offline_global_fee_verify ( + struct GNUNET_TIME_Timestamp start_time, + struct GNUNET_TIME_Timestamp end_time, + const struct TALER_GlobalFeeSet *fees, + const struct TALER_MasterPublicKeyP *master_pub, + const struct TALER_MasterSignatureP *master_sig) +{ + struct TALER_MasterGlobalFeePS wf = { + .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_GLOBAL_FEES), + .purpose.size = htonl (sizeof (wf)), + .start_date = GNUNET_TIME_timestamp_hton (start_time), + .end_date = GNUNET_TIME_timestamp_hton (end_time) + }; + + TALER_global_fee_set_hton (&wf.fees, + fees); + return + GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_GLOBAL_FEES, + &wf, + &master_sig->eddsa_signature, + &master_pub->eddsa_pub); +} + + +void TALER_exchange_offline_extension_config_hash_sign ( const struct TALER_ExtensionConfigHashP *h_config, const struct TALER_MasterPrivateKeyP *master_priv, |