diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-04-08 16:36:20 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-04-08 16:36:20 +0200 |
commit | 3e606246a518b8e7049d94e499df5e7ce13b37e9 (patch) | |
tree | 79feae1dbe0007660cc2145912554cf690f21a9f | |
parent | b2efa7c110f9fd172b7fee40eecf14fee1f09ca6 (diff) | |
download | sync-3e606246a518b8e7049d94e499df5e7ce13b37e9.tar.gz sync-3e606246a518b8e7049d94e499df5e7ce13b37e9.tar.bz2 sync-3e606246a518b8e7049d94e499df5e7ce13b37e9.zip |
adaptations for signing API change in GNUnet (#6164)
-rw-r--r-- | src/lib/sync_api_download.c | 11 | ||||
-rw-r--r-- | src/lib/sync_api_upload.c | 19 | ||||
-rw-r--r-- | src/sync/sync-httpd_backup_post.c | 13 |
3 files changed, 20 insertions, 23 deletions
diff --git a/src/lib/sync_api_download.c b/src/lib/sync_api_download.c index f381075..e7e90cd 100644 --- a/src/lib/sync_api_download.c +++ b/src/lib/sync_api_download.c @@ -109,17 +109,18 @@ handle_download_finished (void *cls, case MHD_HTTP_OK: { struct SYNC_DownloadDetails dd; - struct SYNC_UploadSignaturePS usp; + struct SYNC_UploadSignaturePS usp = { + .purpose.purpose = htonl (TALER_SIGNATURE_SYNC_BACKUP_UPLOAD), + .purpose.size = htonl (sizeof (usp)), + .old_backup_hash = download->sync_previous + }; - usp.purpose.purpose = htonl (TALER_SIGNATURE_SYNC_BACKUP_UPLOAD); - usp.purpose.size = htonl (sizeof (usp)); - usp.old_backup_hash = download->sync_previous; GNUNET_CRYPTO_hash (data, data_size, &usp.new_backup_hash); if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_SYNC_BACKUP_UPLOAD, - &usp.purpose, + &usp, &download->account_sig.eddsa_sig, &download->account_pub.eddsa_pub)) { diff --git a/src/lib/sync_api_upload.c b/src/lib/sync_api_upload.c index 67a9477..a582be9 100644 --- a/src/lib/sync_api_upload.c +++ b/src/lib/sync_api_upload.c @@ -281,28 +281,23 @@ SYNC_upload (struct GNUNET_CURL_Context *ctx, SYNC_UploadCallback cb, void *cb_cls) { - struct SYNC_UploadSignaturePS usp; struct SYNC_AccountSignatureP account_sig; struct SYNC_UploadOperation *uo; CURL *eh; struct curl_slist *job_headers; + struct SYNC_UploadSignaturePS usp = { + .purpose.purpose = htonl (TALER_SIGNATURE_SYNC_BACKUP_UPLOAD), + .purpose.size = htonl (sizeof (usp)) + }; - memset (&usp, 0, sizeof (usp)); - usp.purpose.purpose = htonl (TALER_SIGNATURE_SYNC_BACKUP_UPLOAD); - usp.purpose.size = htonl (sizeof (usp)); if (NULL != prev_backup_hash) usp.old_backup_hash = *prev_backup_hash; GNUNET_CRYPTO_hash (backup, backup_size, &usp.new_backup_hash); - if (GNUNET_OK != - GNUNET_CRYPTO_eddsa_sign (&priv->eddsa_priv, - &usp.purpose, - &account_sig.eddsa_sig)) - { - GNUNET_break (0); - return NULL; - } + GNUNET_CRYPTO_eddsa_sign (&priv->eddsa_priv, + &usp, + &account_sig.eddsa_sig); /* setup our HTTP headers */ job_headers = NULL; diff --git a/src/sync/sync-httpd_backup_post.c b/src/sync/sync-httpd_backup_post.c index 70d19df..c8a421d 100644 --- a/src/sync/sync-httpd_backup_post.c +++ b/src/sync/sync-httpd_backup_post.c @@ -717,15 +717,16 @@ SH_backup_post (struct MHD_Connection *connection, } /* validate signature */ { - struct SYNC_UploadSignaturePS usp; + struct SYNC_UploadSignaturePS usp = { + .purpose.size = htonl (sizeof (usp)), + .purpose.purpose = htonl (TALER_SIGNATURE_SYNC_BACKUP_UPLOAD), + .old_backup_hash = bc->old_backup_hash, + .new_backup_hash = bc->new_backup_hash + }; - usp.purpose.size = htonl (sizeof (struct SYNC_UploadSignaturePS)); - usp.purpose.purpose = htonl (TALER_SIGNATURE_SYNC_BACKUP_UPLOAD); - usp.old_backup_hash = bc->old_backup_hash; - usp.new_backup_hash = bc->new_backup_hash; if (GNUNET_OK != GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_SYNC_BACKUP_UPLOAD, - &usp.purpose, + &usp, &bc->account_sig.eddsa_sig, &account->eddsa_pub)) { |