[PATCH] irmd: Don't always send pub key in alloc response

  • From: Dimitri Staessens <dimitri@ouroboros.rocks>
  • To: ouroboros@xxxxxxxxxxxxx
  • Date: Sat, 28 Mar 2020 16:08:28 +0100

The allocation response was always containing an ECDHE key, which is
not needed if the client doesn't request an encrypted flow.

Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
---
 src/irmd/main.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/irmd/main.c b/src/irmd/main.c
index 1c928dc..3709a3e 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -1358,6 +1358,11 @@ static int flow_accept(pid_t              pid,
 
         pthread_rwlock_unlock(&irmd.reg_lock);
 
+        if (f->qs.cypher_s == 0) { /* no crypto requested, don't send pubkey */
+                data = NULL;
+                len = 0;
+        }
+
         if (ipcp_flow_alloc_resp(pid_n1, flow_id, pid_n, 0, data, len)) {
                 pthread_rwlock_wrlock(&irmd.flows_lock);
                 list_del(&f->next);
-- 
2.25.2


Other related posts:

  • » [PATCH] irmd: Don't always send pub key in alloc response - Dimitri Staessens