/*
- silcmessage.h
+ silcmessage.h
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 1997 - 2002 Pekka Riikonen
+ Copyright (C) 1997 - 2005 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
*
* This interface defines also the SILC_MESSAGE_FLAG_SIGNED Payload,
* which defines how channel messages and private messages can be digitally
- * signed. This interface provides the payload parsing, encoding,
+ * signed. This interface provides the payload parsing, encoding,
* signature computing and signature verification routines.
*
***/
/****s* silccore/SilcMessageAPI/SilcMessagePayload
*
* NAME
- *
+ *
* typedef struct SilcMessagePayloadStruct *SilcMessagePayload;
*
*
/****s* silccore/SilcMessageAPI/SilcMessageSignedPayload
*
* NAME
- *
+ *
* typedef struct SilcMessageSignedPayloadStruct *SilcMessageSignedPayload;
*
*
/****d* silccore/SilcMessageAPI/SilcMessageFlags
*
* NAME
- *
+ *
* typedef SilcUInt16 SilcMessageFlags;
*
* DESCRIPTION
*
- * The message flags type definition and the message flags. The
+ * The message flags type definition and the message flags. The
* message flags are used to indicate some status of the message.
*
* SOURCE
#define SILC_MESSAGE_FLAG_REPLY 0x0040 /* A reply */
#define SILC_MESSAGE_FLAG_DATA 0x0080 /* MIME object */
#define SILC_MESSAGE_FLAG_UTF8 0x0100 /* UTF-8 string */
-#define SILC_MESSAGE_FLAG_RESERVED 0x0200 /* to 0x0800 */
-#define SILC_MESSAGE_FLAG_PRIVATE 0x1000 /* to 0x8000 */
+#define SILC_MESSAGE_FLAG_ACK 0x0200 /* ACK messages */
+#define SILC_MESSAGE_FLAG_RESERVED 0x0400 /* to 0x1000 */
+#define SILC_MESSAGE_FLAG_PRIVATE 0x2000 /* to 0x8000 */
/***/
/****f* silccore/SilcMessageAPI/silc_message_payload_decrypt
*
* SYNOPSIS
*
- * bool silc_message_payload_decrypt(unsigned char *data,
+ * SilcBool silc_message_payload_decrypt(unsigned char *data,
* size_t data_len,
- * bool private_message,
- * bool static_key,
+ * SilcBool private_message,
+ * SilcBool static_key,
* SilcCipher cipher,
* SilcHmac hmac,
- * bool check_mac);
+ * SilcBool check_mac);
*
* DESCRIPTION
*
*
* This is usually used by the Message Payload interface itself but can
* be called by the appliation if separate decryption process is required.
- * For example server might need to call this directly in some
+ * For example server might need to call this directly in some
* circumstances. The `cipher' is used to decrypt the payload. If
* `check_mac' is FALSE then MAC is not verified.
*
***/
-bool silc_message_payload_decrypt(unsigned char *data,
+SilcBool silc_message_payload_decrypt(unsigned char *data,
size_t data_len,
- bool private_message,
- bool static_key,
+ SilcBool private_message,
+ SilcBool static_key,
SilcCipher cipher,
SilcHmac hmac,
- bool check_mac);
+ SilcBool check_mac);
/****f* silccore/SilcMessageAPI/silc_message_payload_parse
*
* SYNOPSIS
*
- * SilcMessagePayload
+ * SilcMessagePayload
* silc_message_payload_parse(unsigned char *payload,
* SilcUInt32 payload_len,
- * bool private_message,
- * bool static_key,
+ * SilcBool private_message,
+ * SilcBool static_key,
* SilcCipher cipher,
* SilcHmac hmac);
*
* (no private message key) and this merely decodes the payload.
*
***/
-SilcMessagePayload
+SilcMessagePayload
silc_message_payload_parse(unsigned char *payload,
SilcUInt32 payload_len,
- bool private_message,
- bool static_key,
+ SilcBool private_message,
+ SilcBool static_key,
SilcCipher cipher,
SilcHmac hmac);
*
* SYNOPSIS
*
- * bool silc_message_payload_encrypt(unsigned char *data,
+ * SilcBool silc_message_payload_encrypt(unsigned char *data,
* SilcUInt32 data_len,
* SilcUInt32 true_len,
* unsigned char *iv,
*
* This is usually used by the Message Payload interface itself but can
* be called by the appliation if separate encryption process is required.
- * For example server might need to call this directly in some
+ * For example server might need to call this directly in some
* circumstances. The `cipher' is used to encrypt the payload and `hmac'
* to compute the MAC for the payload.
*
***/
-bool silc_message_payload_encrypt(unsigned char *data,
+SilcBool silc_message_payload_encrypt(unsigned char *data,
SilcUInt32 data_len,
SilcUInt32 true_len,
unsigned char *iv,
* SilcBuffer silc_message_payload_encode(SilcMessageFlags flags,
* const unsigned char *data,
* SilcUInt32 data_len,
- * bool generate_iv,
- * bool private_message,
+ * SilcBool generate_iv,
+ * SilcBool private_message,
* SilcCipher cipher,
* SilcHmac hmac,
* SilcRng rng,
SilcBuffer silc_message_payload_encode(SilcMessageFlags flags,
const unsigned char *data,
SilcUInt32 data_len,
- bool generate_iv,
- bool private_message,
+ SilcBool generate_iv,
+ SilcBool private_message,
SilcCipher cipher,
SilcHmac hmac,
SilcRng rng,
*
* DESCRIPTION
*
- * Return the MAC of the payload. The caller must already know the
+ * Return the MAC of the payload. The caller must already know the
* length of the MAC. The caller must not free the MAC.
*
***/
*
* DESCRIPTION
*
- * Return the IV of the payload. The caller must already know the
+ * Return the IV of the payload. The caller must already know the
* length of the IV. The caller must not free the IV.
*
***/
*
* SYNOPSIS
*
- * const SilcMessageSignedPayload
+ * SilcMessageSignedPayload
* silc_message_get_signature(SilcMessagePayload payload);
*
* DESCRIPTION
* could not be retrieved from the message.
*
* The caller SHOULD verify the signature by calling the
- * silc_message_signed_verify function.
+ * silc_message_signed_verify function. Caller must not free the
+ * returned payload pointer.
*
***/
-const SilcMessageSignedPayload
+SilcMessageSignedPayload
silc_message_get_signature(SilcMessagePayload payload);
/****f* silccore/SilcMessageAPI/silc_message_signed_payload_parse
* is used to produce the signature. This function returns the encoded
* payload with the signature or NULL on error. Caller must free the
* returned buffer. The `hash' SHOULD be SHA-1 hash function.
- *
+ *
* Application usually does not need to call this since the function
* silc_message_payload_encode calls this automatically if the caller
* wants to sign the message.
* SYNOPSIS
*
* SilcPublicKey
- * silc_message_signed_get_public_key(SilcMessageSignedPayload sig);
+ * silc_message_signed_get_public_key(SilcMessageSignedPayload sig,
+ * const unsigned char **pk_data,
+ * SilcUInt32 *pk_data_len);
*
* DESCRIPTION
*
***/
SilcPublicKey
silc_message_signed_get_public_key(SilcMessageSignedPayload sig,
- unsigned char **pk_data,
+ const unsigned char **pk_data,
SilcUInt32 *pk_data_len);
#endif /* SILCMESSAGE_H */