GNUnet 0.27.0
 
Loading...
Searching...
No Matches
messenger_api_epoch_announcement.c File Reference
Include dependency graph for messenger_api_epoch_announcement.c:

Go to the source code of this file.

Functions

static void random_epoch_announcement_identifier (union GNUNET_MESSENGER_EpochIdentifier *identifier)
 
static enum GNUNET_GenericReturnValue derive_epoch_announcement_key (const struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_MESSENGER_EpochAnnouncement *previous, struct GNUNET_CRYPTO_SymmetricSessionKey *key)
 
struct GNUNET_MESSENGER_EpochAnnouncementcreate_epoch_announcement (struct GNUNET_MESSENGER_Epoch *epoch, const union GNUNET_MESSENGER_EpochIdentifier *identifier, enum GNUNET_GenericReturnValue valid)
 Creates and allocates a new epoch announcement for a given epoch using a specific announcement identifier or NULL.
 
void destroy_epoch_announcement (struct GNUNET_MESSENGER_EpochAnnouncement *announcement)
 Destroys a given epoch announcement and frees its resources.
 
uint32_t get_epoch_announcement_size (const struct GNUNET_MESSENGER_EpochAnnouncement *announcement)
 Returns the size of a given epoch announcement in terms of members.
 
uint32_t get_epoch_announcement_members_count (const struct GNUNET_MESSENGER_EpochAnnouncement *announcement)
 Returns the current amount of members of a given epoch announcement.
 
enum GNUNET_GenericReturnValue is_epoch_announcement_completed (const struct GNUNET_MESSENGER_EpochAnnouncement *announcement)
 Returns whether a given epoch announcement is complete in terms of confirmed announcements from its members.
 
enum GNUNET_GenericReturnValue is_epoch_announcement_announced (const struct GNUNET_MESSENGER_EpochAnnouncement *announcement)
 Returns whether the client has announced being part of a given epoch announcement owning its secret key.
 
static void task_epoch_announcement_appeal (void *cls)
 
void set_epoch_announcement_appeal (struct GNUNET_MESSENGER_EpochAnnouncement *announcement, struct GNUNET_TIME_Relative timeout)
 Sets a specified timeout for a given epoch announcement of the client for its own appeal of the announced secret key.
 
enum GNUNET_GenericReturnValue is_epoch_announcement_appealed (const struct GNUNET_MESSENGER_EpochAnnouncement *announcement)
 Returns whether a given epoch announcement of the client is currently appealing for its secret key from other members.
 
static void handle_secret_messages_with_key (struct GNUNET_MESSENGER_EpochAnnouncement *announcement)
 
void set_epoch_announcement_key (struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_CRYPTO_SymmetricSessionKey *shared_key, enum GNUNET_GenericReturnValue write_record)
 Sets the secret key of a given epoch announcement to a shared key.
 
const struct GNUNET_CRYPTO_SymmetricSessionKeyget_epoch_announcement_key (const struct GNUNET_MESSENGER_EpochAnnouncement *announcement)
 Returns the secret key of a given epoch announcement or NULL.
 
static enum GNUNET_GenericReturnValue is_epoch_announcement_key_derived_from (const struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_MESSENGER_EpochAnnouncement *previous)
 
static void handle_secret_message_with_key (struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_HashCode *hash, enum GNUNET_GenericReturnValue update)
 
static enum GNUNET_GenericReturnValue it_handle_secret_message (void *cls, const struct GNUNET_HashCode *hash, void *value)
 
void handle_epoch_announcement_message (struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
 Handles an encrypted message with hash by a given epoch announcement using its secret key for decryption if available.
 
enum GNUNET_GenericReturnValue confirm_epoch_announcement_member (struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_Message *message, struct GNUNET_MESSENGER_Contact *contact, enum GNUNET_GenericReturnValue sent)
 Confirms an announcement message with its hash to a given epoch announcement as confirmation for a specific contact.
 
enum GNUNET_GenericReturnValue revoke_epoch_announcement_member (struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_Message *message, struct GNUNET_MESSENGER_Contact *contact)
 Revokes an announcement message with its hash from a given epoch announcement removing the caused confirmation for a specific contact to be its member.
 
enum GNUNET_GenericReturnValue is_epoch_announcement_member (const struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_MESSENGER_Contact *contact)
 Returns whether a specific contact is confirmed member of a given epoch announcement.
 
enum GNUNET_GenericReturnValue get_epoch_announcement_member_hash (const struct GNUNET_MESSENGER_EpochAnnouncement *announcement, struct GNUNET_HashCode *hash, enum GNUNET_GenericReturnValue other)
 Provides an announcement hash of a member from a given epoch announcement.
 
void invalidate_epoch_announcement (struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_MESSENGER_Contact *contact)
 Invalidates a given epoch announcement by a specific contact.
 
enum GNUNET_GenericReturnValue send_epoch_announcement (struct GNUNET_MESSENGER_EpochAnnouncement *announcement)
 Tries to send an announcement message by the client for a given epoch announcement using its secret key.
 
static enum GNUNET_GenericReturnValue it_store_any_event (void *cls, const struct GNUNET_HashCode *key, void *value)
 
enum GNUNET_GenericReturnValue send_epoch_announcement_appeal (struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_HashCode *event)
 Tries to send an appeal message by the client responding to a previous event in regards to a given epoch announcement requesting its secret key from other members.
 
enum GNUNET_GenericReturnValue send_epoch_announcement_access (struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_HashCode *event)
 Tries to send an access message by the client responding to a previous event in regards to a given epoch announcement using its secret key.
 
enum GNUNET_GenericReturnValue send_epoch_announcement_revolution (struct GNUNET_MESSENGER_EpochAnnouncement *announcement)
 Tries to send a revolution message by the client for a given epoch announcement using its secret key.
 
enum GNUNET_GenericReturnValue send_epoch_announcement_authorization (struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_MESSENGER_EpochGroup *group, const struct GNUNET_HashCode *event)
 Tries to send an authorization message by the client responding to a previous event in regards to a given epoch announcement using the secret key from a permitted epoch group.
 
void handle_epoch_announcement (struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_Contact *sender, enum GNUNET_GenericReturnValue sent)
 Handles an announcement message with hash from its sender inside a given epoch announcement as first stage.
 
void handle_epoch_announcement_delay (struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_Contact *sender, enum GNUNET_GenericReturnValue sent)
 Handles an announcement message with hash from its sender inside a given epoch announcement as second stage after custom delay.
 
void handle_epoch_announcement_access (struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
 Handles an access message with hash from its sender inside a given epoch announcement.
 
static void cont_write_epoch_announcement_record (void *cls, enum GNUNET_ErrorCode ec)
 
void write_epoch_announcement_record (struct GNUNET_MESSENGER_EpochAnnouncement *announcement, enum GNUNET_GenericReturnValue deleted)
 Writes/Deletes the GNS record of a given epoch announcement depending on a provided flag that states whether an existing record should be deleted.
 

Function Documentation

◆ random_epoch_announcement_identifier()

static void random_epoch_announcement_identifier ( union GNUNET_MESSENGER_EpochIdentifier identifier)
static

Definition at line 37 of file messenger_api_epoch_announcement.c.

39{
40 GNUNET_assert (identifier);
41
43 identifier,
44 sizeof (*identifier));
45
46 identifier->code.group_bit = 0;
47 identifier->code.level_bits = 0;
48}
void GNUNET_CRYPTO_random_block(enum GNUNET_CRYPTO_Quality mode, void *buffer, size_t length)
Fill block with a random values.
@ GNUNET_CRYPTO_QUALITY_WEAK
No good quality of the operation is needed (i.e., random numbers can be pseudo-random).
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
struct GNUNET_MESSENGER_EpochIdentifierCode code

References GNUNET_MESSENGER_EpochIdentifier::code, GNUNET_assert, GNUNET_CRYPTO_QUALITY_WEAK, GNUNET_CRYPTO_random_block(), GNUNET_MESSENGER_EpochIdentifierCode::group_bit, and GNUNET_MESSENGER_EpochIdentifierCode::level_bits.

Referenced by create_epoch_announcement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ derive_epoch_announcement_key()

static enum GNUNET_GenericReturnValue derive_epoch_announcement_key ( const struct GNUNET_MESSENGER_EpochAnnouncement announcement,
const struct GNUNET_MESSENGER_EpochAnnouncement previous,
struct GNUNET_CRYPTO_SymmetricSessionKey key 
)
static

Definition at line 52 of file messenger_api_epoch_announcement.c.

57{
58 const struct GNUNET_CRYPTO_SymmetricSessionKey *previous_key;
59
60 GNUNET_assert ((announcement) && (previous) && (key));
61
62 previous_key = get_epoch_announcement_key (previous);
63
64 if (! previous_key)
65 return GNUNET_SYSERR;
66
68 key,
69 sizeof (*key),
72 previous_key,
73 sizeof (*previous_key),
76 return GNUNET_SYSERR;
77 else
78 return GNUNET_OK;
79}
struct GNUNET_HashCode key
The key used in the DHT.
struct GNUNET_REGEX_Announcement * announcement
#define GNUNET_CRYPTO_hkdf_gnunet(result, out_len, xts, xts_len, skm, skm_len,...)
A peculiar HKDF instantiation that tried to mimic Truncated NMAC.
#define GNUNET_CRYPTO_kdf_arg_auto(d)
@ GNUNET_OK
@ GNUNET_YES
@ GNUNET_SYSERR
const struct GNUNET_CRYPTO_SymmetricSessionKey * get_epoch_announcement_key(const struct GNUNET_MESSENGER_EpochAnnouncement *announcement)
Returns the secret key of a given epoch announcement or NULL.
#define GNUNET_MESSENGER_SALT_EPOCH_KEY

References announcement, get_epoch_announcement_key(), GNUNET_assert, GNUNET_CRYPTO_hkdf_gnunet, GNUNET_CRYPTO_kdf_arg_auto, GNUNET_MESSENGER_SALT_EPOCH_KEY, GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, and key.

Referenced by create_epoch_announcement(), and is_epoch_announcement_key_derived_from().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_epoch_announcement()

struct GNUNET_MESSENGER_EpochAnnouncement * create_epoch_announcement ( struct GNUNET_MESSENGER_Epoch epoch,
const union GNUNET_MESSENGER_EpochIdentifier identifier,
enum GNUNET_GenericReturnValue  valid 
)

Creates and allocates a new epoch announcement for a given epoch using a specific announcement identifier or NULL.

Additionally a flag specifies whether that group needs to be valid to allow key derivation based on that property.

Parameters
[in,out]epochEpoch
[in]identifierAnnouncement identifier
[in]validValidity flag
Returns
New epoch announcement or NULL

Definition at line 83 of file messenger_api_epoch_announcement.c.

87{
89 const struct GNUNET_MESSENGER_EpochAnnouncement *previous;
90
92
94
95 if (! announcement)
96 return NULL;
97
99
100 if ((GNUNET_YES == valid) && (previous) &&
101 (GNUNET_YES != previous->valid))
102 previous = NULL;
103
104 if (previous)
105 identifier = &(previous->identifier);
106
107 if (identifier)
108 GNUNET_memcpy (&(announcement->identifier), identifier,
109 sizeof (announcement->identifier));
110 else
112
113 GNUNET_assert (! announcement->identifier.code.group_bit);
114
115 announcement->announcement_expiration = GNUNET_TIME_absolute_get_zero_ ();
116 announcement->appeal = NULL;
117
118 announcement->appeal_task = NULL;
119
120 announcement->epoch = epoch;
123 announcement->shared_key = NULL;
124 announcement->query = NULL;
125
127
128 announcement->valid = GNUNET_YES;
129 announcement->stored = GNUNET_NO;
130
131 if (previous)
132 {
134
136 previous,
137 &key))
138 {
140
141 announcement->valid = previous->valid;
142 }
143 }
144
145 return announcement;
146}
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
@ GNUNET_NO
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get_zero_(void)
Return absolute time of 0ms.
Definition time.c:142
const struct GNUNET_MESSENGER_EpochAnnouncement * get_epoch_previous_announcement(struct GNUNET_MESSENGER_Epoch *epoch, const union GNUNET_MESSENGER_EpochIdentifier *identifier)
Returns the epoch announcement of a previous epoch from a given epoch using a specific announcement i...
uint32_t get_epoch_announcement_size(const struct GNUNET_MESSENGER_EpochAnnouncement *announcement)
Returns the size of a given epoch announcement in terms of members.
static enum GNUNET_GenericReturnValue derive_epoch_announcement_key(const struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_MESSENGER_EpochAnnouncement *previous, struct GNUNET_CRYPTO_SymmetricSessionKey *key)
static void random_epoch_announcement_identifier(union GNUNET_MESSENGER_EpochIdentifier *identifier)
void set_epoch_announcement_key(struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_CRYPTO_SymmetricSessionKey *shared_key, enum GNUNET_GenericReturnValue write_record)
Sets the secret key of a given epoch announcement to a shared key.
struct GNUNET_MESSENGER_EpochMembership * create_epoch_membership(uint32_t size)
Creates and allocates a new membership for subgroups of an epoch with specified size.
union GNUNET_MESSENGER_EpochIdentifier identifier

References announcement, create_epoch_membership(), derive_epoch_announcement_key(), GNUNET_MESSENGER_EpochAnnouncement::epoch, get_epoch_announcement_size(), get_epoch_previous_announcement(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_create(), GNUNET_memcpy, GNUNET_new, GNUNET_NO, GNUNET_OK, GNUNET_TIME_absolute_get_zero_(), GNUNET_YES, GNUNET_MESSENGER_EpochAnnouncement::identifier, key, random_epoch_announcement_identifier(), set_epoch_announcement_key(), and GNUNET_MESSENGER_EpochAnnouncement::valid.

Referenced by generate_room_epoch_announcement(), and get_epoch_announcement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ destroy_epoch_announcement()

void destroy_epoch_announcement ( struct GNUNET_MESSENGER_EpochAnnouncement announcement)

Destroys a given epoch announcement and frees its resources.

Parameters
[in,out]announcementEpoch announcement

Definition at line 150 of file messenger_api_epoch_announcement.c.

152{
154
155 if (announcement->messages)
157
158 if (announcement->membership)
160
161 if (announcement->shared_key)
162 GNUNET_free (announcement->shared_key);
163
164 if (announcement->query)
166
167 if (announcement->appeal_task)
169
170 if (announcement->appeal)
171 GNUNET_free (announcement->appeal);
172
174}
void GNUNET_CONTAINER_multihashmap_destroy(struct GNUNET_CONTAINER_MultiHashMap *map)
Destroy a hash map.
#define GNUNET_free(ptr)
Wrapper around free.
void GNUNET_NAMESTORE_cancel(struct GNUNET_NAMESTORE_QueueEntry *qe)
Cancel a namestore operation.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition scheduler.c:986
void destroy_epoch_membership(struct GNUNET_MESSENGER_EpochMembership *membership)
Destroys and frees resources of a given membership.

References announcement, destroy_epoch_membership(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_free, GNUNET_NAMESTORE_cancel(), and GNUNET_SCHEDULER_cancel().

Referenced by generate_room_epoch_announcement(), get_epoch_announcement(), and iterate_destroy_announcement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_epoch_announcement_size()

uint32_t get_epoch_announcement_size ( const struct GNUNET_MESSENGER_EpochAnnouncement announcement)

Returns the size of a given epoch announcement in terms of members.

Parameters
[in]announcementEpoch announcement
Returns
Maximum announcement size

Definition at line 178 of file messenger_api_epoch_announcement.c.

180{
182
183 return get_epoch_size (announcement->epoch);
184}
uint32_t get_epoch_size(const struct GNUNET_MESSENGER_Epoch *epoch)
Returns the amount of members by a given epoch or zero as long as it's not fully initialized yet.

References announcement, get_epoch_size(), and GNUNET_assert.

Referenced by create_epoch_announcement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_epoch_announcement_members_count()

uint32_t get_epoch_announcement_members_count ( const struct GNUNET_MESSENGER_EpochAnnouncement announcement)

Returns the current amount of members of a given epoch announcement.

Parameters
[in]announcementEpoch announcement
Returns
Amount of confirmed members of announcement

Definition at line 188 of file messenger_api_epoch_announcement.c.

191{
193
194 return get_epoch_membership_count (announcement->membership);
195}
uint32_t get_epoch_membership_count(const struct GNUNET_MESSENGER_EpochMembership *membership)
Returns the current amount of individual members inside a given epoch membership.

References announcement, get_epoch_membership_count(), and GNUNET_assert.

Referenced by is_epoch_group_missing_announcement(), is_other_epoch_announcement_better(), and send_epoch_announcement_appeal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_epoch_announcement_completed()

enum GNUNET_GenericReturnValue is_epoch_announcement_completed ( const struct GNUNET_MESSENGER_EpochAnnouncement announcement)

Returns whether a given epoch announcement is complete in terms of confirmed announcements from its members.

Parameters
[in]announcementEpoch announcement
Returns
GNUNET_YES if complete, otherwise GNUNET_NO

Definition at line 199 of file messenger_api_epoch_announcement.c.

202{
204
205 return is_epoch_membership_completed (announcement->membership);
206}
enum GNUNET_GenericReturnValue is_epoch_membership_completed(const struct GNUNET_MESSENGER_EpochMembership *membership)
Returns whether a given epoch membership is complete, meaning that all of its intended members have p...

References announcement, GNUNET_assert, and is_epoch_membership_completed().

Referenced by handle_epoch_announcement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_epoch_announcement_announced()

enum GNUNET_GenericReturnValue is_epoch_announcement_announced ( const struct GNUNET_MESSENGER_EpochAnnouncement announcement)

Returns whether the client has announced being part of a given epoch announcement owning its secret key.

Parameters
[in]announcementEpoch announcement
Returns
GNUNET_YES if client is active member of the group, otherwise GNUNET_NO

Definition at line 210 of file messenger_api_epoch_announcement.c.

213{
215
216 return is_epoch_membership_member (announcement->membership, NULL);
217}
enum GNUNET_GenericReturnValue is_epoch_membership_member(const struct GNUNET_MESSENGER_EpochMembership *membership, const struct GNUNET_MESSENGER_Contact *contact)
Returns whether a specific contact is announced member of a given epoch membership.

References announcement, GNUNET_assert, and is_epoch_membership_member().

Referenced by handle_epoch_announcement(), and propose_epoch_group().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ task_epoch_announcement_appeal()

static void task_epoch_announcement_appeal ( void *  cls)
static

Definition at line 221 of file messenger_api_epoch_announcement.c.

222{
224 struct GNUNET_HashCode event;
225
226 GNUNET_assert (cls);
227
228 announcement = cls;
229 announcement->appeal_task = NULL;
230
232 return;
233
235 GNUNET_YES))
236 return;
237
239}
enum GNUNET_GenericReturnValue send_epoch_announcement_appeal(struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_HashCode *event)
Tries to send an appeal message by the client responding to a previous event in regards to a given ep...
enum GNUNET_GenericReturnValue get_epoch_announcement_member_hash(const struct GNUNET_MESSENGER_EpochAnnouncement *announcement, struct GNUNET_HashCode *hash, enum GNUNET_GenericReturnValue other)
Provides an announcement hash of a member from a given epoch announcement.
enum GNUNET_GenericReturnValue is_epoch_announcement_member(const struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_MESSENGER_Contact *contact)
Returns whether a specific contact is confirmed member of a given epoch announcement.
A 512-bit hashcode.

References announcement, get_epoch_announcement_member_hash(), GNUNET_assert, GNUNET_OK, GNUNET_YES, is_epoch_announcement_member(), and send_epoch_announcement_appeal().

Referenced by set_epoch_announcement_appeal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_epoch_announcement_appeal()

void set_epoch_announcement_appeal ( struct GNUNET_MESSENGER_EpochAnnouncement announcement,
struct GNUNET_TIME_Relative  timeout 
)

Sets a specified timeout for a given epoch announcement of the client for its own appeal of the announced secret key.

Parameters
[in,out]announcementEpoch announcement
[in]timeoutTimeout of appeal

Definition at line 243 of file messenger_api_epoch_announcement.c.

246{
247 struct GNUNET_TIME_Absolute timepoint;
248
250
252
253 if (! announcement->appeal)
255 else if (GNUNET_TIME_absolute_cmp (*(announcement->appeal), >, timepoint))
256 return;
257
258 GNUNET_memcpy (announcement->appeal, &timepoint, sizeof (timepoint));
259
260 if (announcement->appeal_task)
262
264 *(announcement->appeal),
268}
static struct GNUNET_TIME_Relative timeout
User defined timestamp for completing operations.
Definition gnunet-arm.c:118
@ GNUNET_SCHEDULER_PRIORITY_HIGH
Run with high priority (important requests).
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_at_with_priority(struct GNUNET_TIME_Absolute at, enum GNUNET_SCHEDULER_Priority priority, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run at the specified time.
Definition scheduler.c:1124
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition time.c:111
#define GNUNET_TIME_absolute_cmp(t1, op, t2)
Compare two absolute times.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_add(struct GNUNET_TIME_Absolute start, struct GNUNET_TIME_Relative duration)
Add a given relative duration to the given start time.
Definition time.c:452
static void task_epoch_announcement_appeal(void *cls)
Time for absolute times used by GNUnet, in microseconds.

References announcement, GNUNET_assert, GNUNET_memcpy, GNUNET_new, GNUNET_SCHEDULER_add_at_with_priority(), GNUNET_SCHEDULER_cancel(), GNUNET_SCHEDULER_PRIORITY_HIGH, GNUNET_TIME_absolute_add(), GNUNET_TIME_absolute_cmp, GNUNET_TIME_absolute_get(), task_epoch_announcement_appeal(), and timeout.

Referenced by handle_appeal_message(), and send_epoch_announcement_appeal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_epoch_announcement_appealed()

enum GNUNET_GenericReturnValue is_epoch_announcement_appealed ( const struct GNUNET_MESSENGER_EpochAnnouncement announcement)

Returns whether a given epoch announcement of the client is currently appealing for its secret key from other members.

Parameters
[in]announcementEpoch announcement
Returns
GNUNET_YES if it is appealing, otherwise GNUNET_NO

Definition at line 272 of file messenger_api_epoch_announcement.c.

275{
276 struct GNUNET_TIME_Relative time;
277
279
280 if (! announcement->appeal)
281 return GNUNET_NO;
282
284
286 return GNUNET_NO;
287
288 return GNUNET_YES;
289}
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_remaining(struct GNUNET_TIME_Absolute future)
Given a timestamp in the future, how much time remains until then?
Definition time.c:406
bool GNUNET_TIME_relative_is_zero(struct GNUNET_TIME_Relative rel)
Test if rel is zero.
Definition time.c:660
Time for relative time used by GNUnet, in microseconds.

References announcement, GNUNET_assert, GNUNET_NO, GNUNET_TIME_absolute_get_remaining(), GNUNET_TIME_relative_is_zero(), and GNUNET_YES.

Referenced by handle_epoch_announcement_delay().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_secret_messages_with_key()

static void handle_secret_messages_with_key ( struct GNUNET_MESSENGER_EpochAnnouncement announcement)
static

Definition at line 408 of file messenger_api_epoch_announcement.c.

410{
412
414 return;
415
419}
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MultiHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
static enum GNUNET_GenericReturnValue it_handle_secret_message(void *cls, const struct GNUNET_HashCode *hash, void *value)

References announcement, get_epoch_announcement_key(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_iterate(), and it_handle_secret_message().

Referenced by set_epoch_announcement_key().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_epoch_announcement_key()

void set_epoch_announcement_key ( struct GNUNET_MESSENGER_EpochAnnouncement announcement,
const struct GNUNET_CRYPTO_SymmetricSessionKey shared_key,
enum GNUNET_GenericReturnValue  write_record 
)

Sets the secret key of a given epoch announcement to a shared key.

An additional flag decides whether the shared key has been loaded from storage or whether it should write its record afterwards.

Parameters
[in,out]announcementEpoch announcement
[in]shared_keyShared key or NULL
[in]write_recordGNUNET_YES if the record should be written, otherwise GNUNET_NO

Definition at line 297 of file messenger_api_epoch_announcement.c.

302{
304
305 if ((GNUNET_NO == write_record) && (shared_key))
306 announcement->stored = GNUNET_YES;
307
308 if (announcement->shared_key)
309 return;
310
311 announcement->shared_key = GNUNET_new (struct
313
314 if (! announcement->shared_key)
315 return;
316
317 if (shared_key)
318 GNUNET_memcpy (announcement->shared_key, shared_key,
319 sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey));
320 else
322
324
325 if (GNUNET_YES != announcement->stored)
327
329}
void GNUNET_CRYPTO_symmetric_create_session_key(struct GNUNET_CRYPTO_SymmetricSessionKey *key)
Create a new random session key.
void update_epoch_announcement(struct GNUNET_MESSENGER_Epoch *epoch, struct GNUNET_MESSENGER_EpochAnnouncement *announcement)
Updates the main announcement of a given epoch, looking into replacing the current main announcement ...
static void handle_secret_messages_with_key(struct GNUNET_MESSENGER_EpochAnnouncement *announcement)
void write_epoch_announcement_record(struct GNUNET_MESSENGER_EpochAnnouncement *announcement, enum GNUNET_GenericReturnValue deleted)
Writes/Deletes the GNS record of a given epoch announcement depending on a provided flag that states ...

References announcement, GNUNET_assert, GNUNET_CRYPTO_symmetric_create_session_key(), GNUNET_memcpy, GNUNET_new, GNUNET_NO, GNUNET_YES, handle_secret_messages_with_key(), update_epoch_announcement(), and write_epoch_announcement_record().

Referenced by create_epoch_announcement(), generate_room_epoch_announcement(), handle_authorization_message(), handle_epoch_announcement_access(), and read_handle_epoch_key().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_epoch_announcement_key()

◆ is_epoch_announcement_key_derived_from()

static enum GNUNET_GenericReturnValue is_epoch_announcement_key_derived_from ( const struct GNUNET_MESSENGER_EpochAnnouncement announcement,
const struct GNUNET_MESSENGER_EpochAnnouncement previous 
)
static

Definition at line 343 of file messenger_api_epoch_announcement.c.

349{
350 const struct GNUNET_CRYPTO_SymmetricSessionKey *shared_key;
352
353 GNUNET_assert ((announcement) && (previous));
354
356
357 if (! shared_key)
358 return GNUNET_SYSERR;
359
361 return GNUNET_SYSERR;
362
363 if (0 == GNUNET_memcmp (shared_key, &key))
364 return GNUNET_YES;
365 else
366 return GNUNET_NO;
367}
#define GNUNET_memcmp(a, b)
Compare memory in a and b, where both must be of the same pointer type.

References announcement, derive_epoch_announcement_key(), get_epoch_announcement_key(), GNUNET_assert, GNUNET_memcmp, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, and key.

Referenced by invalidate_epoch_announcement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_secret_message_with_key()

static void handle_secret_message_with_key ( struct GNUNET_MESSENGER_EpochAnnouncement announcement,
const struct GNUNET_HashCode hash,
enum GNUNET_GenericReturnValue  update 
)
static

Definition at line 371 of file messenger_api_epoch_announcement.c.

375{
376 const struct GNUNET_CRYPTO_SymmetricSessionKey *shared_key;
377
378 GNUNET_assert ((announcement) && (hash));
379
381
382 GNUNET_assert ((shared_key) && (announcement->epoch) && (announcement->epoch->
383 room));
384
386 hash, shared_key, update))
388}
int GNUNET_CONTAINER_multihashmap_remove_all(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key)
Remove all entries for the given key from the map.
enum GNUNET_GenericReturnValue update_room_secret_message(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_CRYPTO_SymmetricSessionKey *key, enum GNUNET_GenericReturnValue update)
Updates a secret message with a given hash in a room for the client API trying to decrypt it with the...

References announcement, get_epoch_announcement_key(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_remove_all(), GNUNET_NO, and update_room_secret_message().

Referenced by handle_epoch_announcement_message(), and it_handle_secret_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ it_handle_secret_message()

static enum GNUNET_GenericReturnValue it_handle_secret_message ( void *  cls,
const struct GNUNET_HashCode hash,
void *  value 
)
static

Definition at line 392 of file messenger_api_epoch_announcement.c.

395{
397
398 GNUNET_assert ((cls) && (hash));
399
400 announcement = cls;
401
403 return GNUNET_YES;
404}
static void handle_secret_message_with_key(struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_HashCode *hash, enum GNUNET_GenericReturnValue update)

References announcement, GNUNET_assert, GNUNET_YES, and handle_secret_message_with_key().

Referenced by handle_secret_messages_with_key().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_epoch_announcement_message()

void handle_epoch_announcement_message ( struct GNUNET_MESSENGER_EpochAnnouncement announcement,
const struct GNUNET_MESSENGER_Message message,
const struct GNUNET_HashCode hash 
)

Handles an encrypted message with hash by a given epoch announcement using its secret key for decryption if available.

Parameters
[in,out]announcementEpoch announcement
[in]messageMessage
[in]hashHash of message

Definition at line 423 of file messenger_api_epoch_announcement.c.

428{
429 GNUNET_assert ((announcement) && (message) && (hash) &&
431
433 {
435 messages, hash))
436 return;
437
439 hash, NULL,
441 return;
442 }
443
445}
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_contains(const struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key)
Check if the map contains any value under the given key (including values that are NULL).
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_put(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST
, ' bother checking if a value already exists (faster than GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE...
@ GNUNET_MESSENGER_KIND_SECRET
The secret kind.
enum GNUNET_MESSENGER_MessageKind kind
The kind of the message.
struct GNUNET_MESSENGER_MessageHeader header
Header.

References announcement, get_epoch_announcement_key(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_contains(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_MESSENGER_KIND_SECRET, GNUNET_NO, GNUNET_YES, handle_secret_message_with_key(), GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_MessageHeader::kind, and GNUNET_MESSENGER_EpochAnnouncement::messages.

Referenced by handle_secret_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ confirm_epoch_announcement_member()

enum GNUNET_GenericReturnValue confirm_epoch_announcement_member ( struct GNUNET_MESSENGER_EpochAnnouncement announcement,
const struct GNUNET_HashCode hash,
const struct GNUNET_MESSENGER_Message message,
struct GNUNET_MESSENGER_Contact contact,
enum GNUNET_GenericReturnValue  sent 
)

Confirms an announcement message with its hash to a given epoch announcement as confirmation for a specific contact.

An additional flag specifies whether the message has been sent by the client or not.

Parameters
[in,out]announcementEpoch announcement
[in]hashHash of message
[in]messageMessage
[in,out]contactContact
[in]sentSent flag
Returns
GNUNET_YES on success, GNUNET_SYSERR on internal failure, otherwise GNUNET_NO

Definition at line 449 of file messenger_api_epoch_announcement.c.

456{
458
459 GNUNET_assert ((announcement) && (hash) && (message) && (contact));
460
461 if (GNUNET_YES != is_epoch_member (announcement->epoch, contact))
462 return GNUNET_SYSERR;
463
465 hash,
466 message,
467 contact,
468 sent);
469
470 if (GNUNET_YES != result)
471 return result;
472
474 return GNUNET_YES;
475}
static int result
Global testing status.
GNUNET_GenericReturnValue
Named constants for return values.
enum GNUNET_GenericReturnValue is_epoch_member(const struct GNUNET_MESSENGER_Epoch *epoch, const struct GNUNET_MESSENGER_Contact *contact)
Returns whether a specific contact is member of a given epoch.
enum GNUNET_GenericReturnValue confirm_epoch_membership_announcment(struct GNUNET_MESSENGER_EpochMembership *membership, const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_Message *message, struct GNUNET_MESSENGER_Contact *contact, enum GNUNET_GenericReturnValue sent)
Adds an announcement message with its hash to a given epoch membership as confirmation for a specific...

References announcement, confirm_epoch_membership_announcment(), GNUNET_assert, GNUNET_SYSERR, GNUNET_YES, is_epoch_member(), result, and update_epoch_announcement().

Referenced by handle_epoch_announcement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ revoke_epoch_announcement_member()

enum GNUNET_GenericReturnValue revoke_epoch_announcement_member ( struct GNUNET_MESSENGER_EpochAnnouncement announcement,
const struct GNUNET_HashCode hash,
const struct GNUNET_MESSENGER_Message message,
struct GNUNET_MESSENGER_Contact contact 
)

Revokes an announcement message with its hash from a given epoch announcement removing the caused confirmation for a specific contact to be its member.

This might be caused by deletion of the original announcement message by that member.

Parameters
[in,out]announcementEpoch announcement
[in]hashHash of message
[in]messageMessage
[in,out]contactContact
Returns
GNUNET_YES on success, otherwise GNUNET_NO

Definition at line 479 of file messenger_api_epoch_announcement.c.

485{
486 GNUNET_assert ((announcement) && (hash) && (message) && (contact));
487
489 return GNUNET_SYSERR;
490
492 hash, contact);
493}
@ GNUNET_MESSENGER_KIND_ANNOUNCEMENT
The announcement kind.
enum GNUNET_GenericReturnValue revoke_epoch_membership_announcement(struct GNUNET_MESSENGER_EpochMembership *membership, const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_Contact *contact)
Drops an announcement message with a provided hash from a given epoch membership to revoke the confir...

References announcement, GNUNET_assert, GNUNET_MESSENGER_KIND_ANNOUNCEMENT, GNUNET_SYSERR, GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_MessageHeader::kind, and revoke_epoch_membership_announcement().

Referenced by handle_room_delayed_deletion().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_epoch_announcement_member()

enum GNUNET_GenericReturnValue is_epoch_announcement_member ( const struct GNUNET_MESSENGER_EpochAnnouncement announcement,
const struct GNUNET_MESSENGER_Contact contact 
)

Returns whether a specific contact is confirmed member of a given epoch announcement.

Parameters
[in]announcementEpoch announcement
[in]contactContact
Returns
GNUNET_YES if the contact is a member, otherwise GNUNET_NO

Definition at line 497 of file messenger_api_epoch_announcement.c.

500{
502
503 return is_epoch_membership_member (announcement->membership, contact);
504}

References announcement, GNUNET_assert, and is_epoch_membership_member().

Referenced by handle_appeal_message(), handle_epoch_announcement(), handle_room_delayed_appeal(), it_check_epoch_announcement_member(), and task_epoch_announcement_appeal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_epoch_announcement_member_hash()

enum GNUNET_GenericReturnValue get_epoch_announcement_member_hash ( const struct GNUNET_MESSENGER_EpochAnnouncement announcement,
struct GNUNET_HashCode hash,
enum GNUNET_GenericReturnValue  other 
)

Provides an announcement hash of a member from a given epoch announcement.

Depending on a flag it provides some hash of another member or the clients own announcement.

Parameters
[in]announcementEpoch announcement
[out]hashHash of announcement
[in]otherOther flag
Returns
GNUNET_OK on success, otherwise GNUNET_SYSERR

Definition at line 508 of file messenger_api_epoch_announcement.c.

513{
514 GNUNET_assert ((announcement) && (hash));
515
517 announcement->membership, hash, other);
518}
enum GNUNET_GenericReturnValue get_epoch_membership_member_hash(const struct GNUNET_MESSENGER_EpochMembership *membership, struct GNUNET_HashCode *hash, enum GNUNET_GenericReturnValue other)
Provides an announcement hash of a member from a given epoch membership.

References announcement, get_epoch_membership_member_hash(), and GNUNET_assert.

Referenced by handle_access_message(), propose_epoch_group(), and task_epoch_announcement_appeal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ invalidate_epoch_announcement()

void invalidate_epoch_announcement ( struct GNUNET_MESSENGER_EpochAnnouncement announcement,
const struct GNUNET_MESSENGER_Contact contact 
)

Invalidates a given epoch announcement by a specific contact.

Parameters
[in,out]announcementEpoch announcement
[in]contactContact

Definition at line 522 of file messenger_api_epoch_announcement.c.

526{
527 const struct GNUNET_MESSENGER_Message *message;
528 struct GNUNET_MESSENGER_EpochAnnouncement *previous;
529 struct GNUNET_MESSENGER_Epoch *epoch;
530
532
533 if (GNUNET_NO == announcement->valid)
534 return;
535
536 if ((contact) && (GNUNET_YES != is_epoch_member (announcement->epoch,
537 contact)))
538 return;
539
540 announcement->valid = GNUNET_NO;
542
543 message = get_room_message (announcement->epoch->room,
544 &(announcement->epoch->hash));
545
546 if (! message)
547 goto skip_traversal;
548
549 switch (message->header.kind)
550 {
552 epoch = get_room_epoch (
553 announcement->epoch->room, &(message->body.join.epoch), GNUNET_NO);
554
555 if (epoch)
556 previous = get_epoch_announcement (
557 epoch, &(announcement->identifier), GNUNET_SYSERR);
558 else
559 previous = NULL;
560 break;
562 epoch = get_room_epoch (
563 announcement->epoch->room, &(message->body.leave.epoch), GNUNET_NO);
564
565 if (epoch)
566 previous = get_epoch_announcement (
567 epoch, &(announcement->identifier), GNUNET_SYSERR);
568 else
569 previous = NULL;
570 break;
572 epoch = get_room_epoch (
573 announcement->epoch->room, &(message->body.merge.epochs[0]), GNUNET_NO);
574
575 if (epoch)
576 {
577 previous = get_epoch_announcement (
578 epoch, &(announcement->identifier), GNUNET_SYSERR);
579
580 if ((previous) &&
582 announcement)))
583 previous = NULL;
584 }
585 else
586 previous = NULL;
587
588 if (! previous)
589 {
590 epoch = get_room_epoch (
591 announcement->epoch->room, &(message->body.merge.epochs[1]), GNUNET_NO);
592
593 if (epoch)
594 previous = get_epoch_announcement (
595 epoch, &(announcement->identifier), GNUNET_SYSERR);
596 }
597 break;
598 default:
599 previous = NULL;
600 break;
601 }
602
603 if ((previous) &&
605 announcement)))
606 previous = NULL;
607
608 if (previous)
609 invalidate_epoch_announcement (previous, contact);
610
611skip_traversal:
612 if (announcement->epoch->main_announcement != announcement)
613 return;
614
615 announcement->epoch->main_announcement = get_epoch_announcement (
616 announcement->epoch, NULL, GNUNET_YES);
617}
@ GNUNET_MESSENGER_KIND_LEAVE
The leave kind.
@ GNUNET_MESSENGER_KIND_JOIN
The join kind.
@ GNUNET_MESSENGER_KIND_MERGE
The merge kind.
struct GNUNET_MESSENGER_EpochAnnouncement * get_epoch_announcement(struct GNUNET_MESSENGER_Epoch *epoch, const union GNUNET_MESSENGER_EpochIdentifier *identifier, enum GNUNET_GenericReturnValue valid)
Returns the epoch announcement of a given epoch using a specific unique identifier or NULL.
void invalidate_epoch_announcement(struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_MESSENGER_Contact *contact)
Invalidates a given epoch announcement by a specific contact.
static enum GNUNET_GenericReturnValue is_epoch_announcement_key_derived_from(const struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_MESSENGER_EpochAnnouncement *previous)
const struct GNUNET_MESSENGER_Message * get_room_message(const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
Returns a message locally stored from a map for a given hash in a room.
struct GNUNET_MESSENGER_Epoch * get_room_epoch(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, enum GNUNET_GenericReturnValue recent)
Returns the epoch in a given room from a specific epoch hash that represents the exact message the ep...
struct GNUNET_MESSENGER_MessageMerge merge
struct GNUNET_MESSENGER_MessageLeave leave
struct GNUNET_MESSENGER_MessageJoin join
struct GNUNET_HashCode epoch
The previous epoch the message was sent from.
struct GNUNET_HashCode epoch
The previous epoch the message was sent from.
struct GNUNET_HashCode epochs[2]
The previous epochs the message was sent from.
struct GNUNET_MESSENGER_MessageBody body
Body.

References announcement, GNUNET_MESSENGER_Message::body, GNUNET_MESSENGER_MessageJoin::epoch, GNUNET_MESSENGER_MessageLeave::epoch, GNUNET_MESSENGER_MessageMerge::epochs, get_epoch_announcement(), get_room_epoch(), get_room_message(), GNUNET_assert, GNUNET_MESSENGER_KIND_JOIN, GNUNET_MESSENGER_KIND_LEAVE, GNUNET_MESSENGER_KIND_MERGE, GNUNET_NO, GNUNET_SYSERR, GNUNET_YES, GNUNET_MESSENGER_Message::header, invalidate_epoch_announcement(), is_epoch_announcement_key_derived_from(), is_epoch_member(), GNUNET_MESSENGER_MessageBody::join, GNUNET_MESSENGER_MessageHeader::kind, GNUNET_MESSENGER_MessageBody::leave, GNUNET_MESSENGER_MessageBody::merge, and write_epoch_announcement_record().

Referenced by handle_revolution_message(), invalidate_epoch_announcement(), and iterate_epoch_announcement_invalidation().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_epoch_announcement()

enum GNUNET_GenericReturnValue send_epoch_announcement ( struct GNUNET_MESSENGER_EpochAnnouncement announcement)

Tries to send an announcement message by the client for a given epoch announcement using its secret key.

Parameters
[in,out]announcementEpoch announcement
Returns
GNUNET_OK on success, otherwise GNUNET_SYSERR

Definition at line 621 of file messenger_api_epoch_announcement.c.

623{
625 const struct GNUNET_CRYPTO_EcdhePrivateKey *private_key;
627 struct GNUNET_MESSENGER_Message *message;
628
630
632
633 if (! key)
634 return GNUNET_SYSERR;
635
637 announcement->announcement_expiration);
638
640 return GNUNET_NO;
641
644
645 private_key = get_epoch_private_key (announcement->epoch,
646 timeout);
647
648 if (! private_key)
649 return GNUNET_SYSERR;
650
652
653 message = create_message_announcement (&(announcement->identifier),
654 private_key,
655 key,
656 timeout);
657
658 if (! message)
659 return GNUNET_SYSERR;
660
661 send_epoch_message (announcement->epoch, message);
662
663 announcement->announcement_expiration = GNUNET_TIME_absolute_add (
665
666 return GNUNET_OK;
667}
struct GNUNET_TIME_Relative GNUNET_TIME_relative_get_hour_(void)
Return relative time of 1 hour.
Definition time.c:187
struct GNUNET_TIME_Relative GNUNET_TIME_relative_multiply(struct GNUNET_TIME_Relative rel, unsigned long long factor)
Multiply relative time by a given factor.
Definition time.c:486
const struct GNUNET_TIME_Relative get_epoch_private_key_timeout(const struct GNUNET_MESSENGER_Epoch *epoch)
Returns the current relative timeout for the private key (ECDHE) of a given epoch that limits the usa...
const struct GNUNET_CRYPTO_EcdhePrivateKey * get_epoch_private_key(struct GNUNET_MESSENGER_Epoch *epoch, const struct GNUNET_TIME_Relative timeout)
Returns the asymmetric private key (ECDHE) from a handle for a given epoch that can be used for HPKE ...
void send_epoch_message(const struct GNUNET_MESSENGER_Epoch *epoch, struct GNUNET_MESSENGER_Message *message)
Sends a created and allocated message in a room of a given epoch enforcing the message gets interpret...
struct GNUNET_MESSENGER_Message * create_message_announcement(const union GNUNET_MESSENGER_EpochIdentifier *identifier, const struct GNUNET_CRYPTO_EcdhePrivateKey *private_key, const struct GNUNET_CRYPTO_SymmetricSessionKey *shared_key, const struct GNUNET_TIME_Relative timeout)
Creates and allocates a new announcement message for an announcement of a given epoch or group under ...
Private ECC key encoded for transmission.

References announcement, create_message_announcement(), get_epoch_announcement_key(), get_epoch_private_key(), get_epoch_private_key_timeout(), GNUNET_assert, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, GNUNET_TIME_absolute_add(), GNUNET_TIME_absolute_get(), GNUNET_TIME_absolute_get_remaining(), GNUNET_TIME_relative_get_hour_(), GNUNET_TIME_relative_is_zero(), GNUNET_TIME_relative_multiply(), GNUNET_YES, key, send_epoch_message(), and timeout.

Referenced by generate_room_epoch_announcement(), handle_authorization_message(), handle_epoch_announcement(), and handle_epoch_announcement_access().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ it_store_any_event()

static enum GNUNET_GenericReturnValue it_store_any_event ( void *  cls,
const struct GNUNET_HashCode key,
void *  value 
)
static

Definition at line 671 of file messenger_api_epoch_announcement.c.

674{
675 struct GNUNET_HashCode *event;
676
677 GNUNET_assert ((cls) && (key));
678
679 event = cls;
680
681 GNUNET_memcpy (event, key, sizeof (*event));
682 return GNUNET_NO;
683}

References GNUNET_assert, GNUNET_memcpy, GNUNET_NO, and key.

Referenced by send_epoch_announcement_appeal().

Here is the caller graph for this function:

◆ send_epoch_announcement_appeal()

enum GNUNET_GenericReturnValue send_epoch_announcement_appeal ( struct GNUNET_MESSENGER_EpochAnnouncement announcement,
const struct GNUNET_HashCode event 
)

Tries to send an appeal message by the client responding to a previous event in regards to a given epoch announcement requesting its secret key from other members.

Parameters
[in,out]announcementEpoch announcement
[in]eventHash of event message
Returns
GNUNET_OK on success, otherwise GNUNET_SYSERR

Definition at line 687 of file messenger_api_epoch_announcement.c.

690{
691 const struct GNUNET_CRYPTO_EcdhePrivateKey *private_key;
693 struct GNUNET_HashCode event_hash;
694 struct GNUNET_MESSENGER_Message *message;
695
697
699 private_key = get_epoch_private_key (announcement->epoch,
700 timeout);
701
702 if (! private_key)
703 return GNUNET_SYSERR;
704
706
707 if ((! event) ||
709 membership->members
710 , event)))
711 {
713 return GNUNET_SYSERR;
714
717 &event_hash);
718
719 event = &event_hash;
720 }
721
722 message = create_message_appeal (event,
723 private_key,
724 timeout);
725
726 if (! message)
727 return GNUNET_SYSERR;
728
730 send_epoch_message (announcement->epoch, message);
731 return GNUNET_OK;
732}
void set_epoch_announcement_appeal(struct GNUNET_MESSENGER_EpochAnnouncement *announcement, struct GNUNET_TIME_Relative timeout)
Sets a specified timeout for a given epoch announcement of the client for its own appeal of the annou...
static enum GNUNET_GenericReturnValue it_store_any_event(void *cls, const struct GNUNET_HashCode *key, void *value)
uint32_t get_epoch_announcement_members_count(const struct GNUNET_MESSENGER_EpochAnnouncement *announcement)
Returns the current amount of members of a given epoch announcement.
struct GNUNET_MESSENGER_Message * create_message_appeal(const struct GNUNET_HashCode *event, const struct GNUNET_CRYPTO_EcdhePrivateKey *private_key, const struct GNUNET_TIME_Relative timeout)
Creates and allocates a new appeal message for an epoch announcement using a specific private_key to ...

References announcement, create_message_appeal(), get_epoch_announcement_members_count(), get_epoch_private_key(), get_epoch_private_key_timeout(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_contains(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_OK, GNUNET_SYSERR, GNUNET_TIME_relative_get_hour_(), GNUNET_YES, it_store_any_event(), send_epoch_message(), set_epoch_announcement_appeal(), and timeout.

Referenced by handle_epoch_announcement_delay(), and task_epoch_announcement_appeal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_epoch_announcement_access()

enum GNUNET_GenericReturnValue send_epoch_announcement_access ( struct GNUNET_MESSENGER_EpochAnnouncement announcement,
const struct GNUNET_HashCode event 
)

Tries to send an access message by the client responding to a previous event in regards to a given epoch announcement using its secret key.

Parameters
[in,out]announcementEpoch announcement
[in]eventHash of event message
Returns
GNUNET_OK on success, otherwise GNUNET_SYSERR

Definition at line 736 of file messenger_api_epoch_announcement.c.

739{
740 struct GNUNET_MESSENGER_Room *room;
742 const struct GNUNET_MESSENGER_Message *appeal_message;
743 const struct GNUNET_CRYPTO_EcdhePublicKey *public_key;
744 struct GNUNET_MESSENGER_Message *message;
745
746 GNUNET_assert ((announcement) && (event));
747
748 room = announcement->epoch->room;
750
751 if (! key)
752 return GNUNET_SYSERR;
753
754 appeal_message = get_room_message (room, event);
755
756 if (! appeal_message)
757 return GNUNET_SYSERR;
758
759 if (GNUNET_MESSENGER_KIND_APPEAL != appeal_message->header.kind)
760 return GNUNET_SYSERR;
761
763 membership->members,
764 &(appeal_message->
766 ))
767 return GNUNET_SYSERR;
768
769 public_key = &(appeal_message->body.appeal.key);
770 message = create_message_access (event,
771 public_key,
772 key);
773
774 if (! message)
775 return GNUNET_SYSERR;
776
777 send_epoch_message (announcement->epoch, message);
778 return GNUNET_OK;
779}
@ GNUNET_MESSENGER_KIND_APPEAL
The appeal kind.
struct GNUNET_MESSENGER_Message * create_message_access(const struct GNUNET_HashCode *event, const struct GNUNET_CRYPTO_EcdhePublicKey *public_key, const struct GNUNET_CRYPTO_SymmetricSessionKey *shared_key)
Creates and allocates a new access message to grant access to the shared_key of an announced epoch or...
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and encr...
struct GNUNET_CRYPTO_EcdhePublicKey key
The public key to receive access.
struct GNUNET_HashCode event
The hash of the linked announcement message event.
struct GNUNET_MESSENGER_MessageAppeal appeal

References announcement, GNUNET_MESSENGER_MessageBody::appeal, GNUNET_MESSENGER_Message::body, create_message_access(), GNUNET_MESSENGER_MessageAppeal::event, get_epoch_announcement_key(), get_room_message(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_contains(), GNUNET_MESSENGER_KIND_APPEAL, GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, GNUNET_MESSENGER_Message::header, key, GNUNET_MESSENGER_MessageAppeal::key, GNUNET_MESSENGER_MessageHeader::kind, and send_epoch_message().

Referenced by handle_room_delayed_appeal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_epoch_announcement_revolution()

enum GNUNET_GenericReturnValue send_epoch_announcement_revolution ( struct GNUNET_MESSENGER_EpochAnnouncement announcement)

Tries to send a revolution message by the client for a given epoch announcement using its secret key.

Parameters
[in,out]announcementEpoch announcement
Returns
GNUNET_OK on success, otherwise GNUNET_SYSERR

Definition at line 783 of file messenger_api_epoch_announcement.c.

785{
787 struct GNUNET_MESSENGER_Message *message;
788
790
792
793 if (! key)
794 return GNUNET_SYSERR;
795
796 message = create_message_revolution (&(announcement->identifier),
797 key);
798
799 if (! message)
800 return GNUNET_SYSERR;
801
802 send_epoch_message (announcement->epoch, message);
803 return GNUNET_OK;
804}
struct GNUNET_MESSENGER_Message * create_message_revolution(const union GNUNET_MESSENGER_EpochIdentifier *identifier, const struct GNUNET_CRYPTO_SymmetricSessionKey *shared_key)
Creates and allocates a new revolution message for an announced epoch or group selected by its identi...

References announcement, create_message_revolution(), get_epoch_announcement_key(), GNUNET_assert, GNUNET_OK, GNUNET_SYSERR, key, and send_epoch_message().

Referenced by handle_epoch_announcement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_epoch_announcement_authorization()

enum GNUNET_GenericReturnValue send_epoch_announcement_authorization ( struct GNUNET_MESSENGER_EpochAnnouncement announcement,
const struct GNUNET_MESSENGER_EpochGroup group,
const struct GNUNET_HashCode event 
)

Tries to send an authorization message by the client responding to a previous event in regards to a given epoch announcement using the secret key from a permitted epoch group.

Parameters
[in,out]announcementEpoch announcement
[in]groupEpoch group
[in]eventHash of event message
Returns
GNUNET_OK on success, otherwise GNUNET_SYSERR

Definition at line 808 of file messenger_api_epoch_announcement.c.

814{
815 struct GNUNET_MESSENGER_Room *room;
817 const struct GNUNET_MESSENGER_Message *announcement_message;
818 const union GNUNET_MESSENGER_EpochIdentifier *identifier;
819 const struct GNUNET_CRYPTO_SymmetricSessionKey *group_key;
820 struct GNUNET_MESSENGER_Message *message;
821
822 GNUNET_assert ((announcement) && (group) && (event));
823
824 room = group->epoch->room;
826
827 if (! key)
828 return GNUNET_SYSERR;
829
830 if (! group->identifier.code.group_bit)
831 return GNUNET_SYSERR;
832
833 announcement_message = get_room_message (room, event);
834
835 if ((! announcement_message) ||
836 (GNUNET_MESSENGER_KIND_ANNOUNCEMENT != announcement_message->header.kind))
837 return GNUNET_SYSERR;
838
839 identifier = &(announcement_message->body.announcement.identifier);
840
841 if (0 != GNUNET_memcmp (&(announcement->identifier), identifier))
842 return GNUNET_SYSERR;
843
844 if (GNUNET_YES != verify_message_by_key (announcement_message, key))
845 return GNUNET_SYSERR;
846
847 group_key = get_epoch_group_key (group);
848
849 if (! group_key)
850 return GNUNET_SYSERR;
851
852 message = create_message_authorization (&(group->identifier),
853 event,
854 group_key,
855 key);
856
857 if (! message)
858 return GNUNET_SYSERR;
859
860 send_epoch_message (announcement->epoch, message);
861 return GNUNET_OK;
862}
const struct GNUNET_CRYPTO_SymmetricSessionKey * get_epoch_group_key(const struct GNUNET_MESSENGER_EpochGroup *group)
Returns the secret key of a given epoch group or NULL.
enum GNUNET_GenericReturnValue verify_message_by_key(const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_CRYPTO_SymmetricSessionKey *key)
Verifies the hmac of a given message body with a specific shared key.
struct GNUNET_MESSENGER_Message * create_message_authorization(const union GNUNET_MESSENGER_EpochIdentifier *identifier, const struct GNUNET_HashCode *event, const struct GNUNET_CRYPTO_SymmetricSessionKey *group_key, const struct GNUNET_CRYPTO_SymmetricSessionKey *shared_key)
Creates and allocates a new authorization message to grant access to the shared_key of a specific gro...
struct GNUNET_MESSENGER_Epoch * epoch
union GNUNET_MESSENGER_EpochIdentifier identifier
struct GNUNET_MESSENGER_Room * room
union GNUNET_MESSENGER_EpochIdentifier identifier
The identifier of the announcement in an epoch.
struct GNUNET_MESSENGER_MessageAnnouncement announcement
An epoch identifier unifies an epoch identifier code and its 256bit hash representation.

References announcement, GNUNET_MESSENGER_MessageBody::announcement, GNUNET_MESSENGER_Message::body, GNUNET_MESSENGER_EpochIdentifier::code, create_message_authorization(), GNUNET_MESSENGER_EpochGroup::epoch, get_epoch_announcement_key(), get_epoch_group_key(), get_room_message(), GNUNET_assert, GNUNET_memcmp, GNUNET_MESSENGER_KIND_ANNOUNCEMENT, GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, GNUNET_MESSENGER_EpochIdentifierCode::group_bit, GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_MessageAnnouncement::identifier, GNUNET_MESSENGER_EpochGroup::identifier, key, GNUNET_MESSENGER_MessageHeader::kind, GNUNET_MESSENGER_Epoch::room, send_epoch_message(), and verify_message_by_key().

Referenced by handle_epoch_announcement_access().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_epoch_announcement()

void handle_epoch_announcement ( struct GNUNET_MESSENGER_EpochAnnouncement announcement,
const struct GNUNET_MESSENGER_Message message,
const struct GNUNET_HashCode hash,
struct GNUNET_MESSENGER_Contact sender,
enum GNUNET_GenericReturnValue  sent 
)

Handles an announcement message with hash from its sender inside a given epoch announcement as first stage.

Parameters
[in,out]announcementEpoch announcement
[in]messageMessage
[in]hashHash of message
[in]senderSender of message
[in]sentSent flag

Definition at line 866 of file messenger_api_epoch_announcement.c.

872{
875
876 GNUNET_assert ((announcement) && (message) && (hash) && (sender));
877
879
880 if (key)
881 {
882 if (GNUNET_OK != verify_message_by_key (message, key))
883 return;
884
887 &(announcement->epoch->hash),
888 &(announcement->identifier),
889 sender);
890
893 {
895 return;
896 }
897 }
898
900 hash,
901 message,
902 sender,
903 sent))
904 return;
905
906 if ((GNUNET_YES != sent) &&
908 {
909 const struct GNUNET_MESSENGER_Contact *contact;
910
911 contact = get_handle_contact (
912 get_room_handle (announcement->epoch->room),
913 get_room_key (announcement->epoch->room));
914
916
918 get_message_timeout (message),
920 announcement->membership));
921 }
922 else if (announcement->epoch->main_group)
924 get_message_timeout (message),
925 get_epoch_group_position_factor (announcement->epoch->main_group));
926 else
928
929 delay_room_action (announcement->epoch->room, hash, timeout);
930}
struct GNUNET_TIME_Relative GNUNET_TIME_relative_get_zero_(void)
Return relative time of 0ms.
Definition time.c:133
struct GNUNET_TIME_Relative GNUNET_TIME_relative_multiply_double(struct GNUNET_TIME_Relative rel, double factor)
Multiply relative time by a given factor.
Definition time.c:506
double get_epoch_position_factor(const struct GNUNET_MESSENGER_Epoch *epoch, const struct GNUNET_MESSENGER_Contact *contact, const struct GNUNET_MESSENGER_EpochMembership *membership)
Returns a relative member position of a specific contact inside a given epoch in relation to its list...
enum GNUNET_GenericReturnValue send_epoch_announcement(struct GNUNET_MESSENGER_EpochAnnouncement *announcement)
Tries to send an announcement message by the client for a given epoch announcement using its secret k...
enum GNUNET_GenericReturnValue is_epoch_announcement_completed(const struct GNUNET_MESSENGER_EpochAnnouncement *announcement)
Returns whether a given epoch announcement is complete in terms of confirmed announcements from its m...
enum GNUNET_GenericReturnValue send_epoch_announcement_revolution(struct GNUNET_MESSENGER_EpochAnnouncement *announcement)
Tries to send a revolution message by the client for a given epoch announcement using its secret key.
enum GNUNET_GenericReturnValue confirm_epoch_announcement_member(struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_Message *message, struct GNUNET_MESSENGER_Contact *contact, enum GNUNET_GenericReturnValue sent)
Confirms an announcement message with its hash to a given epoch announcement as confirmation for a sp...
enum GNUNET_GenericReturnValue is_epoch_announcement_announced(const struct GNUNET_MESSENGER_EpochAnnouncement *announcement)
Returns whether the client has announced being part of a given epoch announcement owning its secret k...
double get_epoch_group_position_factor(const struct GNUNET_MESSENGER_EpochGroup *group)
Returns a relative member position of the client inside a given epoch group in relation to its list o...
struct GNUNET_MESSENGER_Contact * get_handle_contact(struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key)
Returns the contact of a given handle in a room identified by a given key.
struct GNUNET_TIME_Relative get_message_timeout(const struct GNUNET_MESSENGER_Message *message)
Return the relative timeout of the content from a given message that controls when a delayed handling...
void cancel_room_actions_by(struct GNUNET_MESSENGER_Room *room, enum GNUNET_MESSENGER_MessageKind kind, const struct GNUNET_HashCode *epoch_hash, const union GNUNET_MESSENGER_EpochIdentifier *identifier, const struct GNUNET_MESSENGER_Contact *contact)
Searches queued actions to handle messages of a specific message kind in a room with any delay and ca...
const struct GNUNET_HashCode * get_room_key(const struct GNUNET_MESSENGER_Room *room)
Return a the hash representation of a given room.
struct GNUNET_MESSENGER_Handle * get_room_handle(struct GNUNET_MESSENGER_Room *room)
Returns the messenger handle of the room.
void delay_room_action(struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay)
Enqueues delayed handling of a message in a room under a given hash once a specific delay has timed o...

References announcement, cancel_room_actions_by(), confirm_epoch_announcement_member(), delay_room_action(), get_epoch_announcement_key(), get_epoch_group_position_factor(), get_epoch_position_factor(), get_handle_contact(), get_message_timeout(), get_room_handle(), get_room_key(), GNUNET_assert, GNUNET_MESSENGER_KIND_APPEAL, GNUNET_OK, GNUNET_TIME_relative_get_zero_(), GNUNET_TIME_relative_multiply_double(), GNUNET_YES, is_epoch_announcement_announced(), is_epoch_announcement_completed(), is_epoch_announcement_member(), key, send_epoch_announcement(), send_epoch_announcement_revolution(), timeout, and verify_message_by_key().

Referenced by handle_announcement_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_epoch_announcement_delay()

void handle_epoch_announcement_delay ( struct GNUNET_MESSENGER_EpochAnnouncement announcement,
const struct GNUNET_MESSENGER_Message message,
const struct GNUNET_HashCode hash,
struct GNUNET_MESSENGER_Contact sender,
enum GNUNET_GenericReturnValue  sent 
)

Handles an announcement message with hash from its sender inside a given epoch announcement as second stage after custom delay.

Parameters
[in,out]announcementEpoch announcement
[in]messageMessage
[in]hashHash of message
[in]senderSender of message
[in]sentSent flag

Definition at line 934 of file messenger_api_epoch_announcement.c.

941{
943
944 GNUNET_assert ((announcement) && (message) && (hash) && (sender));
945
946 if (GNUNET_YES == is_room_public (announcement->epoch->room))
947 return;
948
949 if ((GNUNET_YES == sent) && (GNUNET_YES == announcement->valid))
951 announcement->epoch,
953
956 return;
957
958 timeout = get_message_timeout (message);
959
961 return;
962
964}
void propose_epoch_group(struct GNUNET_MESSENGER_Epoch *epoch, const struct GNUNET_TIME_Relative timeout)
Tries to propose a new group inside a given epoch that will automatically be formed by using the clie...
enum GNUNET_GenericReturnValue is_epoch_announcement_appealed(const struct GNUNET_MESSENGER_EpochAnnouncement *announcement)
Returns whether a given epoch announcement of the client is currently appealing for its secret key fr...
enum GNUNET_GenericReturnValue is_room_public(const struct GNUNET_MESSENGER_Room *room)
Returns whether a given room is public or using epoch keys to encrypt private traffic and sync those ...

References announcement, get_epoch_announcement_key(), get_message_timeout(), GNUNET_assert, GNUNET_TIME_relative_get_hour_(), GNUNET_TIME_relative_is_zero(), GNUNET_YES, is_epoch_announcement_appealed(), is_room_public(), propose_epoch_group(), send_epoch_announcement_appeal(), and timeout.

Referenced by handle_room_delayed_announcement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_epoch_announcement_access()

void handle_epoch_announcement_access ( struct GNUNET_MESSENGER_EpochAnnouncement announcement,
const struct GNUNET_MESSENGER_Message message,
const struct GNUNET_HashCode hash 
)

Handles an access message with hash from its sender inside a given epoch announcement.

Parameters
[in,out]announcementEpoch announcement
[in]messageMessage
[in]hashHash of message
[in]senderSender of message
[in]sentSent flag

Definition at line 968 of file messenger_api_epoch_announcement.c.

973{
974 const struct GNUNET_CRYPTO_EcdhePrivateKey *private_key;
975 struct GNUNET_CRYPTO_HpkePrivateKey private_hpke;
976 struct GNUNET_CRYPTO_SymmetricSessionKey shared_key;
977 const struct GNUNET_MESSENGER_Message *appeal_message;
978
979 GNUNET_assert ((announcement) && (message) && (hash));
980
981 private_key = get_epoch_private_key (announcement->epoch,
983
984 if (! private_key)
985 {
987 "Private key for decrypting shared key is missing!\n");
988 return;
989 }
990 GNUNET_memcpy (&private_hpke.ecdhe_key,
991 private_key,
992 sizeof *private_key);
994 message,
995 &private_hpke,
996 &shared_key))
997 return;
998
1000 return;
1001
1003
1004 appeal_message = get_room_message (
1005 announcement->epoch->room,
1006 &(message->body.access.event));
1007
1008 if ((announcement->epoch->main_group) &&
1009 (appeal_message) &&
1010 (GNUNET_MESSENGER_KIND_APPEAL == appeal_message->header.kind) &&
1011 (GNUNET_YES == is_epoch_group_compatible (announcement->epoch->main_group,
1012 announcement->epoch)) &&
1014 announcement->epoch->main_group, announcement)))
1016 announcement, announcement->epoch->main_group,
1017 &(appeal_message->body.appeal.event));
1018
1020}
#define GNUNET_log(kind,...)
@ GNUNET_ERROR_TYPE_DEBUG
enum GNUNET_GenericReturnValue send_epoch_announcement_authorization(struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_MESSENGER_EpochGroup *group, const struct GNUNET_HashCode *event)
Tries to send an authorization message by the client responding to a previous event in regards to a g...
enum GNUNET_GenericReturnValue is_epoch_group_compatible(const struct GNUNET_MESSENGER_EpochGroup *group, const struct GNUNET_MESSENGER_Epoch *epoch)
Returns whether a given epoch group is compatible with a specific epoch with its members.
enum GNUNET_GenericReturnValue is_epoch_group_missing_announcement(const struct GNUNET_MESSENGER_EpochGroup *group, const struct GNUNET_MESSENGER_EpochAnnouncement *announcement)
Returns whether any member of a given epoch group is missing in a provided epoch announcement.
enum GNUNET_GenericReturnValue extract_access_message_key(const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_CRYPTO_HpkePrivateKey *key, struct GNUNET_CRYPTO_SymmetricSessionKey *shared_key)
Extracts the shared epoch or group key from an access message using the private ephemeral key from an...
A public key used for decryption.
struct GNUNET_HashCode event
The hash of the linked announcement or group message event.
struct GNUNET_MESSENGER_MessageAccess access

References GNUNET_MESSENGER_MessageBody::access, announcement, GNUNET_MESSENGER_MessageBody::appeal, GNUNET_MESSENGER_Message::body, GNUNET_CRYPTO_HpkePrivateKey::ecdhe_key, GNUNET_MESSENGER_MessageAppeal::event, GNUNET_MESSENGER_MessageAccess::event, extract_access_message_key(), get_epoch_announcement_key(), get_epoch_private_key(), get_room_message(), GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_memcpy, GNUNET_MESSENGER_KIND_APPEAL, GNUNET_NO, GNUNET_TIME_relative_get_hour_(), GNUNET_YES, GNUNET_MESSENGER_Message::header, is_epoch_group_compatible(), is_epoch_group_missing_announcement(), GNUNET_MESSENGER_MessageHeader::kind, send_epoch_announcement(), send_epoch_announcement_authorization(), and set_epoch_announcement_key().

Referenced by handle_access_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cont_write_epoch_announcement_record()

static void cont_write_epoch_announcement_record ( void *  cls,
enum GNUNET_ErrorCode  ec 
)
static

Definition at line 1024 of file messenger_api_epoch_announcement.c.

1026{
1028
1029 GNUNET_assert (cls);
1030
1031 announcement = cls;
1032
1033 if (GNUNET_EC_NONE != ec)
1035 "Error writing epoch key record: %d\n", (int) ec);
1036
1037 announcement->query = NULL;
1038}
@ GNUNET_EC_NONE
No error (success).
@ GNUNET_ERROR_TYPE_ERROR

References announcement, GNUNET_assert, GNUNET_EC_NONE, GNUNET_ERROR_TYPE_ERROR, and GNUNET_log.

Referenced by write_epoch_announcement_record().

Here is the caller graph for this function:

◆ write_epoch_announcement_record()

void write_epoch_announcement_record ( struct GNUNET_MESSENGER_EpochAnnouncement announcement,
enum GNUNET_GenericReturnValue  deleted 
)

Writes/Deletes the GNS record of a given epoch announcement depending on a provided flag that states whether an existing record should be deleted.

Parameters
[in,out]announcementEpoch announcement
[in]deletedDeleted flag

Definition at line 1042 of file messenger_api_epoch_announcement.c.

1045{
1046 const struct GNUNET_MESSENGER_Handle *handle;
1047 const struct GNUNET_HashCode *hash;
1048 const struct GNUNET_ShortHashCode *identifier;
1049 const struct GNUNET_CRYPTO_SymmetricSessionKey *shared_key;
1050
1051 GNUNET_assert ((announcement) && (announcement->epoch));
1052
1053 handle = get_room_handle (announcement->epoch->room);
1054
1055 if (! handle)
1056 return;
1057
1058 hash = &(announcement->epoch->hash);
1059 identifier = &(announcement->identifier.hash);
1060
1061 if (GNUNET_YES == deleted)
1062 {
1063 shared_key = NULL;
1064 }
1065 else
1066 {
1067 shared_key = announcement->shared_key;
1068
1069 if (! shared_key)
1070 return;
1071 }
1072
1074 handle, announcement->epoch->room,
1075 hash, identifier, shared_key,
1076 GNUNET_YES == announcement->valid?
1081 &(announcement->query));
1082}
static struct GNUNET_VPN_Handle * handle
Handle to vpn service.
Definition gnunet-vpn.c:35
@ GNUNET_MESSENGER_FLAG_EPOCH_NONE
The none flag.
@ GNUNET_MESSENGER_FLAG_EPOCH_VALID
The valid flag.
static void cont_write_epoch_announcement_record(void *cls, enum GNUNET_ErrorCode ec)
enum GNUNET_GenericReturnValue store_handle_epoch_key(const struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_ShortHashCode *identifier, const struct GNUNET_CRYPTO_SymmetricSessionKey *shared_key, uint32_t flags, GNUNET_NAMESTORE_ContinuationWithStatus cont, void *cont_cls, struct GNUNET_NAMESTORE_QueueEntry **query)
Stores/deletes a shared_key for a given room from a handle in an epoch with certain hash using a spec...
A 256-bit hashcode.

References announcement, cont_write_epoch_announcement_record(), get_room_handle(), GNUNET_assert, GNUNET_MESSENGER_FLAG_EPOCH_NONE, GNUNET_MESSENGER_FLAG_EPOCH_VALID, GNUNET_YES, handle, and store_handle_epoch_key().

Referenced by invalidate_epoch_announcement(), it_announcement_store_key(), and set_epoch_announcement_key().

Here is the call graph for this function:
Here is the caller graph for this function: