gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] 120/164: Added checks for byzantine bounds


From: gnunet
Subject: [gnunet] 120/164: Added checks for byzantine bounds
Date: Fri, 30 Jul 2021 15:33:06 +0200

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

grothoff pushed a commit to branch master
in repository gnunet.

commit 9e26cb5a4280dc7f71fb4180b3a16b4c5d36b42e
Author: Elias Summermatter <elias.summermatter@seccom.ch>
AuthorDate: Sat May 29 14:51:24 2021 +0200

    Added checks for byzantine bounds
---
 src/setu/gnunet-service-setu.c | 38 ++++++++++++++++++++++++++++++++++++++
 src/setu/perf_setu_api.c       |  2 +-
 2 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/src/setu/gnunet-service-setu.c b/src/setu/gnunet-service-setu.c
index a309568e7..aa2a2eba0 100644
--- a/src/setu/gnunet-service-setu.c
+++ b/src/setu/gnunet-service-setu.c
@@ -1283,6 +1283,25 @@ send_client_done (void *cls)
                   ev);
 }
 
+/**
+ * Check if all given byzantine parameters are in given boundaries
+ * @param op
+ * @return indicator if all given byzantine parameters are in given boundaries
+ */
+
+static int
+check_byzantine_bounds(struct Operation *op) {
+    if (op->byzantine != GNUNET_YES)
+        return GNUNET_OK;
+    if(op->remote_element_count + op->remote_set_diff > 
op->upper_element_boundary)
+        return GNUNET_SYSERR;
+    if(op->local_element_count + op->local_set_diff > 
op->upper_element_boundary)
+        return GNUNET_SYSERR;
+    if(op->remote_element_count < op->byzantine_lower_bound)
+        return GNUNET_SYSERR;
+    return GNUNET_OK;
+}
+
 
 /* FIXME: the destroy logic is a mess and should be cleaned up! */
 
@@ -2606,6 +2625,15 @@ handle_union_p2p_send_full (void *cls,
     op->remote_set_diff = ntohl(msg->remote_set_difference);
     op->local_set_diff = ntohl(msg->local_set_difference);
 
+    if(check_byzantine_bounds(op) != GNUNET_OK) {
+        LOG (GNUNET_ERROR_TYPE_ERROR,
+             "PROTOCOL VIOLATION: Parameters transmitted from other peer do 
not satisfie byzantine "
+             "criteria\n");
+        GNUNET_break_op (0);
+        fail_union_operation (op);
+        return;
+    }
+
     /** Calculate avg element size if not initial sync **/
     uint64_t avg_element_size = 0;
     if(0 == op->number_elements_local) {
@@ -3309,6 +3337,16 @@ handle_union_p2p_request_full (void *cls,
   op->remote_set_diff = ntohl(msg->remote_set_difference);
   op->local_set_diff = ntohl(msg->local_set_difference);
 
+
+  if(check_byzantine_bounds(op) != GNUNET_OK) {
+      LOG (GNUNET_ERROR_TYPE_ERROR,
+           "PROTOCOL VIOLATION: Parameters transmitted from other peer do not 
satisfie byzantine "
+           "criteria\n");
+      GNUNET_break_op (0);
+      fail_union_operation (op);
+      return;
+  }
+
   perf_rtt.request_full.received += 1;
 
   LOG (GNUNET_ERROR_TYPE_DEBUG,
diff --git a/src/setu/perf_setu_api.c b/src/setu/perf_setu_api.c
index a10851b2b..a0b94ce83 100644
--- a/src/setu/perf_setu_api.c
+++ b/src/setu/perf_setu_api.c
@@ -404,7 +404,7 @@ run (void *cls,
                 "Running real set-reconciliation\n");
     //init_set1 ();
     // limit ~23800 element total
-    initRandomSets(0, 500,1,32);
+    initRandomSets(0, 1,500,32);
 }
 
 void perf_thread() {

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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