GNUnet debian-0.24.3-29-g453fda2cf
 
Loading...
Searching...
No Matches
messenger_api_message_kind.h File Reference
Include dependency graph for messenger_api_message_kind.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

struct GNUNET_MESSENGER_Messagecreate_message_join (const struct GNUNET_CRYPTO_PrivateKey *key)
 Creates and allocates a new join message containing the clients public key.
 
struct GNUNET_MESSENGER_Messagecreate_message_leave (void)
 Creates and allocates a new leave message.
 
struct GNUNET_MESSENGER_Messagecreate_message_name (const char *name)
 Creates and allocates a new name message containing the name to change to.
 
struct GNUNET_MESSENGER_Messagecreate_message_key (const struct GNUNET_CRYPTO_PrivateKey *key)
 Creates and allocates a new key message containing the public key to change to derived from its private counterpart.
 
struct GNUNET_MESSENGER_Messagecreate_message_id (const struct GNUNET_ShortHashCode *unique_id)
 Creates and allocates a new id message containing the unique member id to change to.
 
struct GNUNET_MESSENGER_Messagecreate_message_request (const struct GNUNET_HashCode *hash)
 Creates and allocates a new request message containing the hash of a missing message.
 
struct GNUNET_MESSENGER_Messagecreate_message_deletion (const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay)
 Creates and allocates a new deletion message containing the hash of a message to delete after a specific delay.
 
struct GNUNET_MESSENGER_Messagecreate_message_subscribtion (const struct GNUNET_ShortHashCode *discourse, const struct GNUNET_TIME_Relative time, uint32_t flags)
 Creates and allocates a new subscribe message for a subscription of a given discourse with a specific time window and flags.
 
struct GNUNET_MESSENGER_Messagecreate_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 an identifier using a specific private_key and shared_key until a given timeout.
 
struct GNUNET_MESSENGER_Messagecreate_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 receive access before a given timeout.
 
struct GNUNET_MESSENGER_Messagecreate_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 group depending on target event encrypting the shared key for a specific public_key.
 
struct GNUNET_MESSENGER_Messagecreate_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 identifier which is using a specific shared_key.
 
struct GNUNET_MESSENGER_Messagecreate_message_group (const union GNUNET_MESSENGER_EpochIdentifier *identifier, const struct GNUNET_HashCode *initiator, const struct GNUNET_HashCode *partner, const struct GNUNET_TIME_Relative timeout)
 Creates and allocates a new group message to propose a group formation between an initiator subgroup and another partner subgroup until a given timeout to improve further epoch key exchange.
 
struct GNUNET_MESSENGER_Messagecreate_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 group selected via its identifier following an announcement or a group formation event encrypting the shared key for a specific established group_key of selected group.
 

Function Documentation

◆ create_message_join()

struct GNUNET_MESSENGER_Message * create_message_join ( const struct GNUNET_CRYPTO_PrivateKey key)

Creates and allocates a new join message containing the clients public key.

(all values are stored as copy)

Parameters
[in]keyPrivate key
Returns
New message

Definition at line 32 of file messenger_api_message_kind.c.

33{
34 struct GNUNET_MESSENGER_Message *message;
35
36 if (! key)
37 return NULL;
38
40
41 if (! message)
42 return NULL;
43
44 memset (&(message->body.leave.epoch), 0,
45 sizeof (struct GNUNET_HashCode));
46
48 return message;
49}
struct GNUNET_HashCode key
The key used in the DHT.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_key_get_public(const struct GNUNET_CRYPTO_PrivateKey *privkey, struct GNUNET_CRYPTO_PublicKey *key)
Retrieves the public key representation of a private key.
@ GNUNET_MESSENGER_KIND_JOIN
The join kind.
struct GNUNET_MESSENGER_Message * create_message(enum GNUNET_MESSENGER_MessageKind kind)
Creates and allocates a new message with a specific kind.
A 512-bit hashcode.
struct GNUNET_MESSENGER_MessageLeave leave
struct GNUNET_MESSENGER_MessageJoin join
struct GNUNET_CRYPTO_PublicKey key
The senders public key to verify its signatures.
struct GNUNET_HashCode epoch
The previous epoch the message was sent from.
struct GNUNET_MESSENGER_MessageBody body
Body.

References GNUNET_MESSENGER_Message::body, create_message(), GNUNET_MESSENGER_MessageLeave::epoch, GNUNET_CRYPTO_key_get_public(), GNUNET_MESSENGER_KIND_JOIN, GNUNET_MESSENGER_MessageBody::join, key, GNUNET_MESSENGER_MessageJoin::key, and GNUNET_MESSENGER_MessageBody::leave.

Referenced by handle_member_id().

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

◆ create_message_leave()

struct GNUNET_MESSENGER_Message * create_message_leave ( void  )

Creates and allocates a new leave message.

Returns
New message

Definition at line 53 of file messenger_api_message_kind.c.

54{
55 struct GNUNET_MESSENGER_Message *message;
56
58
59 if (! message)
60 return NULL;
61
62 memset (&(message->body.leave.epoch), 0,
63 sizeof (struct GNUNET_HashCode));
64
65 return message;
66}
@ GNUNET_MESSENGER_KIND_LEAVE
The leave kind.

References GNUNET_MESSENGER_Message::body, create_message(), GNUNET_MESSENGER_MessageLeave::epoch, GNUNET_MESSENGER_KIND_LEAVE, and GNUNET_MESSENGER_MessageBody::leave.

Referenced by GNUNET_MESSENGER_close_room().

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

◆ create_message_name()

struct GNUNET_MESSENGER_Message * create_message_name ( const char *  name)

Creates and allocates a new name message containing the name to change to.

(all values are stored as copy)

Parameters
[in]nameNew name
Returns
New message

Definition at line 70 of file messenger_api_message_kind.c.

71{
72 struct GNUNET_MESSENGER_Message *message;
73
74 if (! name)
75 return NULL;
76
78
79 if (! message)
80 return NULL;
81
82 message->body.name.name = GNUNET_strdup (name);
83 return message;
84}
static char * name
Name (label) of the records to list.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
@ GNUNET_MESSENGER_KIND_NAME
The name kind.
struct GNUNET_MESSENGER_MessageName name
char * name
The new name which replaces the current senders name.

References GNUNET_MESSENGER_Message::body, create_message(), GNUNET_MESSENGER_KIND_NAME, GNUNET_strdup, name, GNUNET_MESSENGER_MessageName::name, and GNUNET_MESSENGER_MessageBody::name.

Referenced by iterate_send_name_to_room().

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

◆ create_message_key()

struct GNUNET_MESSENGER_Message * create_message_key ( const struct GNUNET_CRYPTO_PrivateKey key)

Creates and allocates a new key message containing the public key to change to derived from its private counterpart.

(all values are stored as copy)

Parameters
[in]keyPrivate key
Returns
New message

Definition at line 88 of file messenger_api_message_kind.c.

89{
90 struct GNUNET_MESSENGER_Message *message;
91
92 if (! key)
93 return NULL;
94
96
97 if (! message)
98 return NULL;
99
101 return message;
102}
@ GNUNET_MESSENGER_KIND_KEY
The key kind.
struct GNUNET_MESSENGER_MessageKey key
struct GNUNET_CRYPTO_PublicKey key
The new public key which replaces the current senders public key.

References GNUNET_MESSENGER_Message::body, create_message(), GNUNET_CRYPTO_key_get_public(), GNUNET_MESSENGER_KIND_KEY, key, GNUNET_MESSENGER_MessageKey::key, and GNUNET_MESSENGER_MessageBody::key.

Referenced by iterate_send_key_to_room().

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

◆ create_message_id()

struct GNUNET_MESSENGER_Message * create_message_id ( const struct GNUNET_ShortHashCode unique_id)

Creates and allocates a new id message containing the unique member id to change to.

(all values are stored as copy)

Parameters
[in]unique_idUnique member id
Returns
New message

Definition at line 106 of file messenger_api_message_kind.c.

107{
108 struct GNUNET_MESSENGER_Message *message;
109
110 if (! unique_id)
111 return NULL;
112
114
115 if (! message)
116 return NULL;
117
118 GNUNET_memcpy (&(message->body.id.id), unique_id,
119 sizeof(struct GNUNET_ShortHashCode));
120
121 return message;
122}
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
@ GNUNET_MESSENGER_KIND_ID
The id kind.
struct GNUNET_MESSENGER_MessageId id
struct GNUNET_ShortHashCode id
The new id which will replace the senders id in a room.
A 256-bit hashcode.

References GNUNET_MESSENGER_Message::body, create_message(), GNUNET_memcpy, GNUNET_MESSENGER_KIND_ID, GNUNET_MESSENGER_MessageId::id, and GNUNET_MESSENGER_MessageBody::id.

Referenced by handle_member_id().

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

◆ create_message_request()

struct GNUNET_MESSENGER_Message * create_message_request ( const struct GNUNET_HashCode hash)

Creates and allocates a new request message containing the hash of a missing message.

(all values are stored as copy)

Parameters
[in]hashHash of message
Returns
New message

Definition at line 126 of file messenger_api_message_kind.c.

127{
128 struct GNUNET_MESSENGER_Message *message;
129
130 if (! hash)
131 return NULL;
132
133 {
134 struct GNUNET_HashCode zero;
135 memset (&zero, 0, sizeof(zero));
136
137 if (0 == GNUNET_CRYPTO_hash_cmp (hash, &zero))
138 return NULL;
139 }
140
142
143 if (! message)
144 return NULL;
145
146 GNUNET_memcpy (&(message->body.request.hash), hash, sizeof(struct
148
149 return message;
150}
static const struct GNUNET_CRYPTO_PrivateKey zero
Public key of all zeros.
int GNUNET_CRYPTO_hash_cmp(const struct GNUNET_HashCode *h1, const struct GNUNET_HashCode *h2)
Compare function for HashCodes, producing a total ordering of all hashcodes.
@ GNUNET_MESSENGER_KIND_REQUEST
The request kind.
struct GNUNET_MESSENGER_MessageRequest request
struct GNUNET_HashCode hash
The hash of the requested message.

References GNUNET_MESSENGER_Message::body, create_message(), GNUNET_CRYPTO_hash_cmp(), GNUNET_memcpy, GNUNET_MESSENGER_KIND_REQUEST, GNUNET_MESSENGER_MessageRequest::hash, GNUNET_MESSENGER_MessageBody::request, and zero.

Referenced by handle_miss_message().

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

◆ create_message_deletion()

struct GNUNET_MESSENGER_Message * create_message_deletion ( const struct GNUNET_HashCode hash,
const struct GNUNET_TIME_Relative  delay 
)

Creates and allocates a new deletion message containing the hash of a message to delete after a specific delay.

(all values are stored as copy)

Parameters
[in]hashHash of message
[in]delayDelay of deletion
Returns
New message

Definition at line 154 of file messenger_api_message_kind.c.

156{
157 struct GNUNET_MESSENGER_Message *message;
158
159 if (! hash)
160 return NULL;
161
163
164 if (! message)
165 return NULL;
166
167 GNUNET_memcpy (&(message->body.deletion.hash), hash, sizeof(struct
169 message->body.deletion.delay = GNUNET_TIME_relative_hton (delay);
170
171 return message;
172}
@ GNUNET_MESSENGER_KIND_DELETION
The deletion kind.
struct GNUNET_TIME_RelativeNBO GNUNET_TIME_relative_hton(struct GNUNET_TIME_Relative a)
Convert relative time to network byte order.
Definition time.c:620
struct GNUNET_MESSENGER_MessageDeletion deletion
struct GNUNET_HashCode hash
The hash of the message to delete.
struct GNUNET_TIME_RelativeNBO delay
The delay of the delete operation to get processed.

References GNUNET_MESSENGER_Message::body, create_message(), GNUNET_MESSENGER_MessageDeletion::delay, GNUNET_MESSENGER_MessageBody::deletion, GNUNET_memcpy, GNUNET_MESSENGER_KIND_DELETION, GNUNET_TIME_relative_hton(), and GNUNET_MESSENGER_MessageDeletion::hash.

Referenced by delete_room_message().

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

◆ create_message_subscribtion()

struct GNUNET_MESSENGER_Message * create_message_subscribtion ( const struct GNUNET_ShortHashCode discourse,
const struct GNUNET_TIME_Relative  time,
uint32_t  flags 
)

Creates and allocates a new subscribe message for a subscription of a given discourse with a specific time window and flags.

(all values are stored as copy)

Parameters
[in]discourseDiscourse
[in]timeTime of subscription
[in]flagsSubscription flags
Returns
New message

Definition at line 176 of file messenger_api_message_kind.c.

179{
180 struct GNUNET_MESSENGER_Message *message;
181
182 if (! discourse)
183 return NULL;
184
186
187 if (! message)
188 return NULL;
189
190 GNUNET_memcpy (&(message->body.subscribtion.discourse), discourse,
191 sizeof (struct GNUNET_ShortHashCode));
192
194 message->body.subscribtion.flags = flags;
195
196 return message;
197}
@ GNUNET_MESSENGER_KIND_SUBSCRIBTION
The subscribtion kind.
struct GNUNET_MESSENGER_MessageSubscribtion subscribtion
uint32_t flags
The flags about the subscription to a discourse.
struct GNUNET_TIME_RelativeNBO time
The time window of the subscription.
struct GNUNET_ShortHashCode discourse
The hash of the discourse to subscribtion.

References GNUNET_MESSENGER_Message::body, create_message(), GNUNET_MESSENGER_MessageSubscribtion::discourse, GNUNET_MESSENGER_MessageSubscribtion::flags, GNUNET_memcpy, GNUNET_MESSENGER_KIND_SUBSCRIBTION, GNUNET_TIME_relative_hton(), GNUNET_MESSENGER_MessageBody::subscribtion, and GNUNET_MESSENGER_MessageSubscribtion::time.

Referenced by handle_discourse_subscription().

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

◆ create_message_announcement()

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 an identifier using a specific private_key and shared_key until a given timeout.

Parameters
[in]identifierEpoch identifier
[in]private_keyPrivate key
[in]shared_keyShared key
[in]timeoutTimeout
Returns
New message

Definition at line 201 of file messenger_api_message_kind.c.

208{
209 struct GNUNET_MESSENGER_Message *message;
210
211 if ((! identifier) || (! private_key) || (! shared_key))
212 return NULL;
213
215
216 if (! message)
217 return NULL;
218
219 GNUNET_memcpy (&(message->body.announcement.identifier), identifier,
220 sizeof (message->body.announcement.identifier));
221
223 private_key, &(message->body.announcement.key));
224
228
230
231 sign_message_by_key (message, shared_key);
232
233 return message;
234}
static struct GNUNET_TIME_Relative timeout
User defined timestamp for completing operations.
Definition gnunet-arm.c:118
void GNUNET_CRYPTO_random_block(enum GNUNET_CRYPTO_Quality mode, void *buffer, size_t length)
Fill block with a random values.
void GNUNET_CRYPTO_ecdhe_key_get_public(const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, struct GNUNET_CRYPTO_EcdhePublicKey *pub)
Extract the public key for the given private key.
Definition crypto_ecc.c:217
@ GNUNET_CRYPTO_QUALITY_NONCE
Randomness for IVs etc.
#define GNUNET_MESSENGER_EPOCH_NONCE_BYTES
@ GNUNET_MESSENGER_KIND_ANNOUNCEMENT
The announcement kind.
void sign_message_by_key(struct GNUNET_MESSENGER_Message *message, const struct GNUNET_CRYPTO_SymmetricSessionKey *key)
Signs the message body via it's own hmac with a specific shared key.
uint8_t nonce[sizeof(struct GNUNET_ShortHashCode)]
union GNUNET_MESSENGER_EpochNonce nonce
The nonce of the announcement.
struct GNUNET_TIME_RelativeNBO timeout
The timeout of the announcement.
union GNUNET_MESSENGER_EpochIdentifier identifier
The identifier of the announcement in an epoch.
struct GNUNET_CRYPTO_EcdhePublicKey key
The public key to appeal access.
struct GNUNET_MESSENGER_MessageAnnouncement announcement
struct GNUNET_MESSENGER_EpochNonceData data

References GNUNET_MESSENGER_MessageBody::announcement, GNUNET_MESSENGER_Message::body, create_message(), GNUNET_MESSENGER_EpochNonce::data, GNUNET_CRYPTO_ecdhe_key_get_public(), GNUNET_CRYPTO_QUALITY_NONCE, GNUNET_CRYPTO_random_block(), GNUNET_memcpy, GNUNET_MESSENGER_EPOCH_NONCE_BYTES, GNUNET_MESSENGER_KIND_ANNOUNCEMENT, GNUNET_TIME_relative_hton(), GNUNET_MESSENGER_MessageAnnouncement::identifier, GNUNET_MESSENGER_MessageAnnouncement::key, GNUNET_MESSENGER_EpochNonceData::nonce, GNUNET_MESSENGER_MessageAnnouncement::nonce, sign_message_by_key(), timeout, and GNUNET_MESSENGER_MessageAnnouncement::timeout.

Referenced by send_epoch_announcement(), and send_epoch_group_announcement().

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

◆ create_message_appeal()

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 receive access before a given timeout.

Parameters
[in]eventHash of announcement event
[in]private_keyPrivate key
[in]timeoutTimeout
Returns
New message

Definition at line 238 of file messenger_api_message_kind.c.

241{
242 struct GNUNET_MESSENGER_Message *message;
243
244 if ((! event) || (! private_key))
245 return NULL;
246
248
249 if (! message)
250 return NULL;
251
252 GNUNET_memcpy (&(message->body.appeal.event), event,
253 sizeof (message->body.appeal.event));
254
256 private_key, &(message->body.appeal.key));
257
259
260 return message;
261}
@ GNUNET_MESSENGER_KIND_APPEAL
The appeal kind.
struct GNUNET_CRYPTO_EcdhePublicKey key
The public key to receive access.
struct GNUNET_TIME_RelativeNBO timeout
The timeout of the appeal.
struct GNUNET_HashCode event
The hash of the linked announcement message event.
struct GNUNET_MESSENGER_MessageAppeal appeal

References GNUNET_MESSENGER_MessageBody::appeal, GNUNET_MESSENGER_Message::body, create_message(), GNUNET_MESSENGER_MessageAppeal::event, GNUNET_CRYPTO_ecdhe_key_get_public(), GNUNET_memcpy, GNUNET_MESSENGER_KIND_APPEAL, GNUNET_TIME_relative_hton(), GNUNET_MESSENGER_MessageAppeal::key, timeout, and GNUNET_MESSENGER_MessageAppeal::timeout.

Referenced by send_epoch_announcement_appeal().

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

◆ create_message_access()

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 group depending on target event encrypting the shared key for a specific public_key.

Parameters
[in]eventHash of appeal or group formation event
[in]public_keyPublic key
[in]shared_keyShared key
Returns
New message

Definition at line 265 of file messenger_api_message_kind.c.

269{
270 struct GNUNET_MESSENGER_Message *message;
271
272 if ((! event) || (! public_key) || (! shared_key))
273 return NULL;
274
276
277 if (! message)
278 return NULL;
279
281 (const uint8_t*)
282 "messenger",
283 strlen ("messenger"),
284 NULL,
285 0,
286 (const uint8_t*) shared_key,
287 sizeof (*shared_key),
288 message->body.access.key,
289 NULL))
290 {
291 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Encrypting key failed!\n");
292
293 destroy_message (message);
294 return NULL;
295 }
296
297 GNUNET_memcpy (&(message->body.access.event), event,
298 sizeof (message->body.access.event));
299
300 sign_message_by_key (message, shared_key);
301
302 return message;
303}
#define GNUNET_log(kind,...)
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hpke_seal_oneshot(const struct GNUNET_CRYPTO_EcdhePublicKey *pkR, const uint8_t *info, size_t info_len, const uint8_t *aad, size_t aad_len, const uint8_t *pt, size_t pt_len, uint8_t *ct, unsigned long long *ct_len)
RFC9180 HPKE encryption.
@ GNUNET_OK
@ GNUNET_ERROR_TYPE_WARNING
@ GNUNET_MESSENGER_KIND_ACCESS
The access kind.
void destroy_message(struct GNUNET_MESSENGER_Message *message)
Destroys a message and frees its memory fully.
struct GNUNET_HashCode event
The hash of the linked announcement or group message event.
uint8_t key[sizeof(struct GNUNET_CRYPTO_SymmetricSessionKey)+16+sizeof(struct GNUNET_CRYPTO_HpkeEncapsulation)]
The encrypted group or epoch key.
struct GNUNET_MESSENGER_MessageAccess access

References GNUNET_MESSENGER_MessageBody::access, GNUNET_MESSENGER_Message::body, create_message(), destroy_message(), GNUNET_MESSENGER_MessageAccess::event, GNUNET_CRYPTO_hpke_seal_oneshot(), GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_memcpy, GNUNET_MESSENGER_KIND_ACCESS, GNUNET_OK, GNUNET_MESSENGER_MessageAccess::key, and sign_message_by_key().

Referenced by send_epoch_announcement_access(), and send_epoch_group_access().

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

◆ create_message_revolution()

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 identifier which is using a specific shared_key.

Parameters
[in]identifierEpoch identifier
[in]shared_keyShared key
Returns
New message

Definition at line 307 of file messenger_api_message_kind.c.

311{
312 struct GNUNET_MESSENGER_Message *message;
313
314 if ((! identifier) || (! shared_key))
315 return NULL;
316
318
319 if (! message)
320 return NULL;
321
322 GNUNET_memcpy (&(message->body.revolution.identifier), identifier,
323 sizeof (message->body.revolution.identifier));
324
326 message->body.revolution.nonce.data.nonce,
328
329 sign_message_by_key (message, shared_key);
330
331 return message;
332}
@ GNUNET_MESSENGER_KIND_REVOLUTION
The revolution kind.
struct GNUNET_MESSENGER_MessageRevolution revolution
union GNUNET_MESSENGER_EpochIdentifier identifier
The identifier of the announcement in an epoch.
union GNUNET_MESSENGER_EpochNonce nonce
The nonce of the revolution.

References GNUNET_MESSENGER_Message::body, create_message(), GNUNET_MESSENGER_EpochNonce::data, GNUNET_CRYPTO_QUALITY_NONCE, GNUNET_CRYPTO_random_block(), GNUNET_memcpy, GNUNET_MESSENGER_EPOCH_NONCE_BYTES, GNUNET_MESSENGER_KIND_REVOLUTION, GNUNET_MESSENGER_MessageRevolution::identifier, GNUNET_MESSENGER_EpochNonceData::nonce, GNUNET_MESSENGER_MessageRevolution::nonce, GNUNET_MESSENGER_MessageBody::revolution, and sign_message_by_key().

Referenced by send_epoch_announcement_revolution(), and send_epoch_group_revolution().

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

◆ create_message_group()

struct GNUNET_MESSENGER_Message * create_message_group ( const union GNUNET_MESSENGER_EpochIdentifier identifier,
const struct GNUNET_HashCode initiator,
const struct GNUNET_HashCode partner,
const struct GNUNET_TIME_Relative  timeout 
)

Creates and allocates a new group message to propose a group formation between an initiator subgroup and another partner subgroup until a given timeout to improve further epoch key exchange.

Parameters
[in]identifierGroup identifier
[in]initiatorInitiator group identifier
[in]partnerPartner group identifier
[in]timeoutTimeout
Returns
New message

Definition at line 336 of file messenger_api_message_kind.c.

340{
341 struct GNUNET_MESSENGER_Message *message;
342
343 if ((! identifier) || (! initiator) || (! partner) ||
344 (! identifier->code.group_bit))
345 return NULL;
346
348
349 if (! message)
350 return NULL;
351
352 GNUNET_memcpy (&(message->body.group.identifier), identifier,
353 sizeof (message->body.group.identifier));
354 GNUNET_memcpy (&(message->body.group.initiator), initiator,
355 sizeof (message->body.group.initiator));
356 GNUNET_memcpy (&(message->body.group.partner), partner,
357 sizeof (message->body.group.partner));
358
360
361 return message;
362}
@ GNUNET_MESSENGER_KIND_GROUP
The group kind.
struct GNUNET_MESSENGER_MessageGroup group
struct GNUNET_TIME_RelativeNBO timeout
The timeout of the group formation.
struct GNUNET_HashCode initiator
The hash of the initiator group announcement.
union GNUNET_MESSENGER_EpochIdentifier identifier
The identifier of the group in an epoch.
struct GNUNET_HashCode partner
The hash of the partner group announcement.
struct GNUNET_MESSENGER_EpochIdentifierCode code

References GNUNET_MESSENGER_Message::body, GNUNET_MESSENGER_EpochIdentifier::code, create_message(), GNUNET_memcpy, GNUNET_MESSENGER_KIND_GROUP, GNUNET_TIME_relative_hton(), GNUNET_MESSENGER_MessageBody::group, GNUNET_MESSENGER_EpochIdentifierCode::group_bit, GNUNET_MESSENGER_MessageGroup::identifier, GNUNET_MESSENGER_MessageGroup::initiator, GNUNET_MESSENGER_MessageGroup::partner, timeout, and GNUNET_MESSENGER_MessageGroup::timeout.

Referenced by send_epoch_group().

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

◆ create_message_authorization()

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 group selected via its identifier following an announcement or a group formation event encrypting the shared key for a specific established group_key of selected group.

Parameters
[in]identifierGroup identifier
[in]eventHash of announcement or group formation event
[in]group_keyEstablished group key
[in]shared_keyShared key
Returns
New message

Definition at line 366 of file messenger_api_message_kind.c.

373{
374 struct GNUNET_MESSENGER_Message *message;
376
377 if ((! identifier) || (! event) || (! group_key) || (! shared_key))
378 return NULL;
379
381
382 if (! message)
383 return NULL;
384
385 GNUNET_CRYPTO_symmetric_derive_iv (&iv, group_key,
386 event, sizeof (*event),
387 identifier, sizeof (*identifier),
388 NULL);
389
390 if (-1 == GNUNET_CRYPTO_symmetric_encrypt (shared_key,
392 group_key,
393 &iv,
394 message->body.authorization.key))
395 {
396 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Encrypting key failed!\n");
397
398 destroy_message (message);
399 return NULL;
400 }
401
402 GNUNET_memcpy (&(message->body.authorization.identifier), identifier,
403 sizeof (message->body.authorization.identifier));
404 GNUNET_memcpy (&(message->body.authorization.event), event,
405 sizeof (message->body.authorization.event));
406
407 sign_message_by_key (message, shared_key);
408
409 return message;
410}
ssize_t GNUNET_CRYPTO_symmetric_encrypt(const void *block, size_t size, const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, void *result)
Encrypt a block using a symmetric sessionkey.
void GNUNET_CRYPTO_symmetric_derive_iv(struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, const struct GNUNET_CRYPTO_SymmetricSessionKey *skey, const void *salt, size_t salt_len,...)
Derive an IV.
#define GNUNET_MESSENGER_AUTHORIZATION_KEY_BYTES
@ GNUNET_MESSENGER_KIND_AUTHORIZATION
The authorization kind.
struct GNUNET_HashCode event
The hash of the linked group message event.
union GNUNET_MESSENGER_EpochIdentifier identifier
The identifier of the group in an epoch.
uint8_t key[sizeof(struct GNUNET_CRYPTO_SymmetricSessionKey)]
The encrypted group or epoch key.
struct GNUNET_MESSENGER_MessageAuthorization authorization

References GNUNET_MESSENGER_MessageBody::authorization, GNUNET_MESSENGER_Message::body, create_message(), destroy_message(), GNUNET_MESSENGER_MessageAuthorization::event, GNUNET_CRYPTO_symmetric_derive_iv(), GNUNET_CRYPTO_symmetric_encrypt(), GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_memcpy, GNUNET_MESSENGER_AUTHORIZATION_KEY_BYTES, GNUNET_MESSENGER_KIND_AUTHORIZATION, GNUNET_MESSENGER_MessageAuthorization::identifier, GNUNET_MESSENGER_MessageAuthorization::key, and sign_message_by_key().

Referenced by send_epoch_announcement_authorization(), and send_epoch_group_authorization().

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