Function silc_message_payload_parse
SYNOPSIS
SilcMessagePayload
silc_message_payload_parse(unsigned char *payload,
SilcUInt32 payload_len,
SilcBool private_message,
SilcBool static_key,
SilcCipher cipher,
SilcHmac hmac,
unsigned char *sender_id,
SilcUInt32 sender_id_len,
unsigned char *receiver_id,
SilcUInt32 receiver_id_len,
SilcStack stack,
SilcBool no_allocation,
SilcMessagePayload message);
DESCRIPTION
Parses Message Payload returning new payload structure. This also
decrypts the payload and checks the MAC. If the payload is
channel message then `private_message' is FALSE, and if it is
private message it is TRUE. If the private message key is static
(pre-shared key) then protocol dictates that the IV is present
and `static_key' must be set to TRUE. If the key is not static
(Key Agreement was done for the key) then it MUST be FALSE. For
channel messages the `static_key' is ignored.
If the `hmac' is no provided then the MAC of the channel message is
not verified. If the message is private message and `cipher' is NULL
then this assumes that the packet was decrypted with session keys
(no private message key) and this merely decodes the payload.
The `sender_id' and `receiver_id' are the IDs from the packet header
of the packet where this message payload was received.
If the `message' is non-NULL then that pre-allocated context is
used in parsing. Same context is returned. Otherwise new context
is allocated and returned. If the `stack' is non-NULL then memory
is allocated from that stack. If `no_allocation' is TRUE then the
`message' must be provided and data is merely parsed and referenced
from `payload' and will become invalid when `payload' invalidates.
If `no_allocation' is TRUE the routine does not do any allocations.
|