gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-sync] branch master updated: adaptations for signing API change i


From: gnunet
Subject: [taler-sync] branch master updated: adaptations for signing API change in GNUnet (#6164)
Date: Wed, 08 Apr 2020 18:18:38 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository sync.

The following commit(s) were added to refs/heads/master by this push:
     new 3e60624  adaptations for signing API change in GNUnet (#6164)
3e60624 is described below

commit 3e606246a518b8e7049d94e499df5e7ce13b37e9
Author: Christian Grothoff <address@hidden>
AuthorDate: Wed Apr 8 16:36:20 2020 +0200

    adaptations for signing API change in GNUnet (#6164)
---
 src/lib/sync_api_download.c       | 11 ++++++-----
 src/lib/sync_api_upload.c         | 19 +++++++------------
 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))
       {

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]