libgnunetchat

library for GNUnet Messenger
Log | Files | Refs | README | LICENSE

commit b7253a37674ef6b1f9df1ad4dff88f5d501dbf53
parent 3412fca0a668db520d7ef121f46686af9c9f04a1
Author: Jacki <jacki@thejackimonster.de>
Date:   Fri,  9 May 2025 17:56:43 +0200

Delay sending name to reduce merges and configure key usage regarding forward secrecy

Signed-off-by: Jacki <jacki@thejackimonster.de>

Diffstat:
Msrc/gnunet_chat_group_intern.c | 6++++--
Msrc/gnunet_chat_handle.c | 5+++--
Msrc/gnunet_chat_handle_intern.c | 5++++-
Msrc/gnunet_chat_lib.c | 13+++++++------
Msrc/gnunet_chat_lobby.c | 5+++--
5 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/src/gnunet_chat_group_intern.c b/src/gnunet_chat_group_intern.c @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - Copyright (C) 2021--2024 GNUnet e.V. + Copyright (C) 2021--2025 GNUnet e.V. GNUnet is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published @@ -25,6 +25,8 @@ #include "gnunet_chat_context.h" #include "gnunet_chat_handle.h" +#include <gnunet/gnunet_messenger_service.h> + #define GNUNET_UNUSED __attribute__ ((unused)) void @@ -69,5 +71,5 @@ search_group_by_topic(void *cls, key ); - handle_send_room_name(group->handle, room); + GNUNET_MESSENGER_use_room_keys(room, GNUNET_NO); } diff --git a/src/gnunet_chat_handle.c b/src/gnunet_chat_handle.c @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - Copyright (C) 2021--2024 GNUnet e.V. + Copyright (C) 2021--2025 GNUnet e.V. GNUnet is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published @@ -1121,7 +1121,8 @@ handle_process_records (struct GNUNET_CHAT_Handle *handle, context = context_create_from_room(handle, room); context_read_records(context, label, count, data); - handle_send_room_name(handle, room); + GNUNET_MESSENGER_use_room_keys( + room, context->topic? GNUNET_NO : GNUNET_YES); if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put( handle->contexts, &key, context, diff --git a/src/gnunet_chat_handle_intern.c b/src/gnunet_chat_handle_intern.c @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - Copyright (C) 2021--2024 GNUnet e.V. + Copyright (C) 2021--2025 GNUnet e.V. GNUnet is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published @@ -880,6 +880,9 @@ skip_msg_handing: contact_update_join(contact, context, &(message->hash), message->flags); + if (GNUNET_MESSENGER_FLAG_SENT & message->flags) + handle_send_room_name(handle, context->room); + break; } case GNUNET_MESSENGER_KIND_KEY: diff --git a/src/gnunet_chat_lib.c b/src/gnunet_chat_lib.c @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - Copyright (C) 2021--2024 GNUnet e.V. + Copyright (C) 2021--2025 GNUnet e.V. GNUnet is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published @@ -1038,13 +1038,13 @@ GNUNET_CHAT_group_create (struct GNUNET_CHAT_Handle *handle, return NULL; struct GNUNET_CHAT_Context *context = context_create_from_room(handle, room); - - handle_send_room_name(handle, room); - context->type = GNUNET_CHAT_CONTEXT_TYPE_GROUP; util_set_name_field(topic, &(context->topic)); + // TODO: wrong key usage! + GNUNET_MESSENGER_use_room_keys(room, GNUNET_YES); // GNUNET_NO); + if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put( handle->contexts, &key, context, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) @@ -1619,7 +1619,7 @@ GNUNET_CHAT_context_request (struct GNUNET_CHAT_Context *context) GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) goto cleanup_room; - handle_send_room_name(handle, room); + GNUNET_MESSENGER_use_room_keys(room, GNUNET_YES); struct GNUNET_MESSENGER_Message msg; memset(&msg, 0, sizeof(msg)); @@ -2907,7 +2907,8 @@ GNUNET_CHAT_invitation_accept (struct GNUNET_CHAT_Invitation *invitation) &door, &(invitation->key) ); - handle_send_room_name(invitation->context->handle, room); + // TODO: guessing forward-secrecy is expected after invite? + GNUNET_MESSENGER_use_room_keys(room, GNUNET_YES); } diff --git a/src/gnunet_chat_lobby.c b/src/gnunet_chat_lobby.c @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - Copyright (C) 2022--2024 GNUnet e.V. + Copyright (C) 2022--2025 GNUnet e.V. GNUnet is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published @@ -108,7 +108,8 @@ lobby_open (struct GNUNET_CHAT_Lobby *lobby, lobby->context = context_create_from_room(lobby->handle, room); - handle_send_room_name(lobby->handle, room); + // TODO: would be better to include key usage into lobby somehow! + GNUNET_MESSENGER_use_room_keys(room, GNUNET_YES); if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put( lobby->handle->contexts, &key, lobby->context,