updates.
authorPekka Riikonen <priikone@silcnet.org>
Tue, 18 Jul 2006 13:12:57 +0000 (13:12 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Tue, 18 Jul 2006 13:12:57 +0000 (13:12 +0000)
lib/silcasn1/silcasn1_decode.c
lib/silcasn1/silcber.h
lib/silccore/silcmessage.c
lib/silccore/silcmessage.h
lib/silccrypt/silccipher.c
lib/silccrypt/silcpkcs.h
lib/silccrypt/silcpkcs1.h
lib/silcutil/silcbuffmt.h
lib/silcutil/silcfsm.h

index 5fcfb4c7ec40e1e104969d81c31d8b8c241198b8..efb1534f63e4afb5d7bcb997abaa747942da9dd5 100644 (file)
@@ -310,7 +310,8 @@ silc_asn1_decoder(SilcAsn1 asn1, SilcStack stack1, SilcAsn1Tag type,
       }
     }
 
-    /* Short integer is actually big integer, so handle it correctly */
+    /* Short integer is actually big integer in the BER data, so handle
+       it correctly */
     if (type == SILC_ASN1_TAG_SHORT_INTEGER && type == tag)
       tag = SILC_ASN1_TAG_INTEGER;
 
index 244c856ce619579591f33b19c4c05864d278077e..2360c780ae88b07466ce169955835c81035be016 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 2003 - 2005 Pekka Riikonen
+  Copyright (C) 2003 - 2006 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
 #ifndef SILCBER_H
 #define SILCBER_H
 
+/****d* silcasn1/SilcBerAPI/SilcBerClass
+ *
+ * NAME
+ *
+ *    typedef enum { ... } SilcBerClass;
+ *
+ * DESCRIPTION
+ *
+ *    Defines the BER classes.
+ *
+ */
 typedef enum {
   SILC_BER_CLASS_UNIVERSAL       = 0x00,   /* Universal */
   SILC_BER_CLASS_APPLICATION     = 0x01,   /* Application */
   SILC_BER_CLASS_CONTEXT         = 0x02,   /* Context-specific */
   SILC_BER_CLASS_PRIVATE         = 0x03,   /* Private */
 } SilcBerClass;
+/***/
 
+/****d* silcasn1/SilcBerAPI/SilcBerEncoding
+ *
+ * NAME
+ *
+ *    typedef enum { ... } SilcBerEncoding;
+ *
+ * DESCRIPTION
+ *
+ *    Defines the BER encoding type.
+ *
+ */
 typedef enum {
   SILC_BER_ENC_PRIMITIVE         = 0x00,
   SILC_BER_ENC_CONSTRUCTED       = 0x01,
 } SilcBerEncoding;
+/***/
 
 /****f* silcasn1/SilcBerAPI/silc_ber_encode
  *
  * SYNOPSIS
  *
- *    SilcBool silc_ber_encode(SilcBuffer ber, SilcBerClass ber_class,
- *                         SilcBerEncoding encoding, SilcUInt32 tag,
- *                         const unsigned char *data, SilcUInt32 data_len,
- *                         SilcBool indefinite);
+ *    SilcBool
+ *    silc_ber_encode(SilcBuffer ber, SilcBerClass ber_class,
+ *                    SilcBerEncoding encoding, SilcUInt32 tag,
+ *                    const unsigned char *data, SilcUInt32 data_len,
+ *                    SilcBool indefinite);
  *
  * DESCRIPTION
  *
@@ -66,18 +91,19 @@ typedef enum {
  *
  ***/
 SilcBool silc_ber_encode(SilcBuffer ber, SilcBerClass ber_class,
-                    SilcBerEncoding encoding, SilcUInt32 tag,
-                    const unsigned char *data, SilcUInt32 data_len,
-                    SilcBool indefinite);
+                        SilcBerEncoding encoding, SilcUInt32 tag,
+                        const unsigned char *data, SilcUInt32 data_len,
+                        SilcBool indefinite);
 
 /****f* silcasn1/SilcBerAPI/silc_ber_decode
  *
  * SYNOPSIS
  *
- *    SilcBool silc_ber_decode(SilcBuffer ber, SilcBerClass *ber_class,
- *                         SilcBerEncoding *encoding, SilcUInt32 *tag,
- *                         const unsigned char **data, SilcUInt32 *data_len,
- *                         SilcBool *indefinite, SilcUInt32 *identifier_len);
+ *    SilcBool
+ *    silc_ber_decode(SilcBuffer ber, SilcBerClass *ber_class,
+ *                    SilcBerEncoding *encoding, SilcUInt32 *tag,
+ *                    const unsigned char **data, SilcUInt32 *data_len,
+ *                    SilcBool *indefinite, SilcUInt32 *identifier_len);
  *
  * DESCRIPTION
  *
@@ -93,9 +119,9 @@ SilcBool silc_ber_encode(SilcBuffer ber, SilcBerClass ber_class,
  *
  ***/
 SilcBool silc_ber_decode(SilcBuffer ber, SilcBerClass *ber_class,
-                    SilcBerEncoding *encoding, SilcUInt32 *tag,
-                    const unsigned char **data, SilcUInt32 *data_len,
-                    SilcBool *indefinite, SilcUInt32 *identifier_len);
+                        SilcBerEncoding *encoding, SilcUInt32 *tag,
+                        const unsigned char **data, SilcUInt32 *data_len,
+                        SilcBool *indefinite, SilcUInt32 *identifier_len);
 
 /****f* silcasn1/SilcBerAPI/silc_ber_encoded_len
  *
index 15ab266efaa90c721a5392545b2e01f4e6eada4d..9af6a072af44c9a69280b9931ea4fef72bdc3a45 100644 (file)
@@ -60,12 +60,12 @@ struct SilcMessagePayloadStruct {
 /* Decrypts the Message Payload. The `data' is the actual Message Payload */
 
 SilcBool silc_message_payload_decrypt(unsigned char *data,
-                                 size_t data_len,
-                                 SilcBool private_message,
-                                 SilcBool static_key,
-                                 SilcCipher cipher,
-                                 SilcHmac hmac,
-                                 SilcBool check_mac)
+                                     size_t data_len,
+                                     SilcBool private_message,
+                                     SilcBool static_key,
+                                     SilcCipher cipher,
+                                     SilcHmac hmac,
+                                     SilcBool check_mac)
 {
   SilcUInt32 mac_len, iv_len = 0, block_len;
   SilcUInt16 len, totlen, dlen;
@@ -230,12 +230,12 @@ silc_message_payload_parse(unsigned char *payload,
    The `true_len' is the data length which is used to create MAC out of. */
 
 SilcBool silc_message_payload_encrypt(unsigned char *data,
-                                 SilcUInt32 data_len,
-                                 SilcUInt32 true_len,
-                                 unsigned char *iv,
-                                 SilcUInt32 iv_len,
-                                 SilcCipher cipher,
-                                 SilcHmac hmac)
+                                     SilcUInt32 data_len,
+                                     SilcUInt32 true_len,
+                                     unsigned char *iv,
+                                     SilcUInt32 iv_len,
+                                     SilcCipher cipher,
+                                     SilcHmac hmac)
 {
   unsigned char mac[32];
   SilcUInt32 mac_len;
index 3ffa7ba12ffcac6cf7c563281ba7fa0f80d709ef..282b4437b125859e0fee53be38ce88ae6a291b46 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2005 Pekka Riikonen
+  Copyright (C) 1997 - 2006 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
@@ -107,12 +107,12 @@ typedef SilcUInt16 SilcMessageFlags;
  * SYNOPSIS
  *
  *    SilcBool silc_message_payload_decrypt(unsigned char *data,
- *                                      size_t data_len,
- *                                      SilcBool private_message,
- *                                      SilcBool static_key,
- *                                      SilcCipher cipher,
- *                                      SilcHmac hmac,
- *                                      SilcBool check_mac);
+ *                                          size_t data_len,
+ *                                          SilcBool private_message,
+ *                                          SilcBool static_key,
+ *                                          SilcCipher cipher,
+ *                                          SilcHmac hmac,
+ *                                          SilcBool check_mac);
  *
  * DESCRIPTION
  *
@@ -132,12 +132,12 @@ typedef SilcUInt16 SilcMessageFlags;
  *
  ***/
 SilcBool silc_message_payload_decrypt(unsigned char *data,
-                                 size_t data_len,
-                                 SilcBool private_message,
-                                 SilcBool static_key,
-                                 SilcCipher cipher,
-                                 SilcHmac hmac,
-                                 SilcBool check_mac);
+                                     size_t data_len,
+                                     SilcBool private_message,
+                                     SilcBool static_key,
+                                     SilcCipher cipher,
+                                     SilcHmac hmac,
+                                     SilcBool check_mac);
 
 /****f* silccore/SilcMessageAPI/silc_message_payload_parse
  *
@@ -181,12 +181,12 @@ silc_message_payload_parse(unsigned char *payload,
  * SYNOPSIS
  *
  *    SilcBool silc_message_payload_encrypt(unsigned char *data,
- *                                      SilcUInt32 data_len,
- *                                      SilcUInt32 true_len,
- *                                      unsigned char *iv,
- *                                      SilcUInt32 iv_len,
- *                                      SilcCipher cipher,
- *                                      SilcHmac hmac);
+ *                                          SilcUInt32 data_len,
+ *                                          SilcUInt32 true_len,
+ *                                          unsigned char *iv,
+ *                                          SilcUInt32 iv_len,
+ *                                          SilcCipher cipher,
+ *                                          SilcHmac hmac);
  *
  * DESCRIPTION
  *
@@ -203,12 +203,12 @@ silc_message_payload_parse(unsigned char *payload,
  *
  ***/
 SilcBool silc_message_payload_encrypt(unsigned char *data,
-                                 SilcUInt32 data_len,
-                                 SilcUInt32 true_len,
-                                 unsigned char *iv,
-                                 SilcUInt32 iv_len,
-                                 SilcCipher cipher,
-                                 SilcHmac hmac);
+                                     SilcUInt32 data_len,
+                                     SilcUInt32 true_len,
+                                     unsigned char *iv,
+                                     SilcUInt32 iv_len,
+                                     SilcCipher cipher,
+                                     SilcHmac hmac);
 
 /****f* silccore/SilcMessageAPI/silc_message_payload_encode
  *
index 2264d5cfc51b8212392aaccaf03f2ebf4c9c2821..d8b73215e36c90f05814beec80f2db0345a55ee5 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2005 Pekka Riikonen
+  Copyright (C) 1997 - 2006 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
@@ -304,8 +304,8 @@ char *silc_cipher_get_supported(void)
 /* Encrypts */
 
 SilcBool silc_cipher_encrypt(SilcCipher cipher, const unsigned char *src,
-                        unsigned char *dst, SilcUInt32 len,
-                        unsigned char *iv)
+                            unsigned char *dst, SilcUInt32 len,
+                            unsigned char *iv)
 {
 #ifdef SILC_DEBUG
   assert((len & (cipher->cipher->block_len - 1)) == 0);
@@ -319,8 +319,8 @@ SilcBool silc_cipher_encrypt(SilcCipher cipher, const unsigned char *src,
 /* Decrypts */
 
 SilcBool silc_cipher_decrypt(SilcCipher cipher, const unsigned char *src,
-                        unsigned char *dst, SilcUInt32 len,
-                        unsigned char *iv)
+                            unsigned char *dst, SilcUInt32 len,
+                            unsigned char *iv)
 {
 #ifdef SILC_DEBUG
   /*  assert((len & (cipher->cipher->block_len - 1)) == 0); */
@@ -334,7 +334,7 @@ SilcBool silc_cipher_decrypt(SilcCipher cipher, const unsigned char *src,
 /* Sets the key for the cipher */
 
 SilcBool silc_cipher_set_key(SilcCipher cipher, const unsigned char *key,
-                        SilcUInt32 keylen)
+                            SilcUInt32 keylen)
 {
   return cipher->cipher->set_key(cipher->context, key, keylen);
 }
index c6a915c9a812607397bebdca5481dc2d15f54fcb..f0dfca17a306080053fddd768c506b06a1f742b3 100644 (file)
@@ -621,7 +621,7 @@ SilcBool silc_pkcs_private_key_alloc(SilcPKCSType type,
  *
  * DESCRIPTION
  *
- *    Returns the key length in bits from the public key.
+ *    Returns the key length in bits from the private key.
  *
  ***/
 SilcUInt32 silc_pkcs_private_key_get_len(SilcPrivateKey private_key);
index 30cee1cd6b8aa1e2e74625e6862c2b7aa0114dc6..2218106e49d0b3ab4c88daaf1e42e7f5919d11e4 100644 (file)
@@ -57,11 +57,11 @@ typedef enum {
  * SYNOPSIS
  *
  *    SilcBool silc_pkcs1_encode(SilcPkcs1BlockType bt,
- *                           const unsigned char *data,
- *                           SilcUInt32 data_len,
- *                           unsigned char *dest_data,
- *                           SilcUInt32 dest_data_size,
- *                           SilcRng rng);
+ *                               const unsigned char *data,
+ *                               SilcUInt32 data_len,
+ *                               unsigned char *dest_data,
+ *                               SilcUInt32 dest_data_size,
+ *                               SilcRng rng);
  *
  * DESCRIPTION
  *
@@ -89,11 +89,11 @@ SilcBool silc_pkcs1_encode(SilcPkcs1BlockType bt,
  * SYNOPSIS
  *
  *    SilcBool silc_pkcs1_decode(SilcPkcs1BlockType bt,
- *                           const unsigned char *data,
- *                           SilcUInt32 data_len,
- *                           unsigned char *dest_data,
- *                           SilcUInt32 dest_data_size,
- *                           SilcUInt32 *dest_len);
+ *                               const unsigned char *data,
+ *                               SilcUInt32 data_len,
+ *                               unsigned char *dest_data,
+ *                               SilcUInt32 dest_data_size,
+ *                               SilcUInt32 *dest_len);
  *
  * DESCRIPTION
  *
index 4c3436a52b9095f92fe9cbe621807ee74bf2d195..feb4754ea698e652abc22693e7c514345800bbaf 100644 (file)
@@ -61,6 +61,9 @@
  *    if (ret < 0)
  *      error;
  *
+ *    // Free the allocated data
+ *    silc_buffer_purge(&buffer);
+ *
  ***/
 int silc_buffer_format(SilcBuffer dst, ...);
 
index 8822b2dd79e549015e1670c74c003ce968845132..d1e253ecc650f53d580b2783330d41329a438a3c 100644 (file)
@@ -140,7 +140,7 @@ typedef enum {
  *    returns SILC_FSM_FINISH.  This function will be called through
  *    the scheduler; it will not be called immediately after the state
  *    function returns SILC_FSM_FINISH, but will be called later.
- *    The `fsm' may be freed or uninitialized in this function.
+ *    The `fsm' may be freed in this function.
  *
  ***/
 typedef void (*SilcFSMDestructor)(SilcFSM fsm, void *fsm_context,
@@ -161,7 +161,7 @@ typedef void (*SilcFSMDestructor)(SilcFSM fsm, void *fsm_context,
  *    returns SILC_FSM_FINISH.  This function will be called through
  *    the scheduler; it will not be called immediately after the state
  *    function returns SILC_FSM_FINISH, but will be called later.  The
- *    `thread' may be freed or uninitialized in this function.
+ *    `thread' may be freed in this function.
  *
  * NOTES
  *
@@ -317,8 +317,8 @@ do {                                                \
  *    works with normal FSM threads, but especially with real system threads
  *    it does not guarantee that the FSM won't continue before the thread has
  *    actually terminated.  Usually this is not a problem, but it can be a
- *    problem if the FSM is waiting to be freed or uninitialized.  In this
- *    case using this macro is strongly recommended.
+ *    problem if the FSM is waiting to be freed.  In this case using this
+ *    macro is strongly recommended.
  *
  ***/
 #define SILC_FSM_THREAD_WAIT(thread)           \
@@ -491,8 +491,7 @@ SilcFSMThread silc_fsm_thread_alloc(SilcFSM fsm,
  *    Initializes a pre-allocated SilcFSMThread context.  This call is
  *    equivalent to silc_fsm_thread_alloc except that this takes the
  *    pre-allocated context as argument.  The silc_fsm_free must not be
- *    called if this was called.  Returns TRUE if the initialization is Ok
- *    or FALSE if error occurred.  If the `real_thread' is TRUE then the
+ *    called if this was called.  If the `real_thread' is TRUE then the
  *    thread will actually be executed in real thread, if platform supports
  *    them.
  *
@@ -874,7 +873,7 @@ void silc_fsm_sema_free(SilcFSMSema sema);
  * EXAMPLE
  *
  *    // Signalling example
- *    ctx->sema = silc_fsm_sema_alloc(fsm, 0);
+ *    ctx->async_sema = silc_fsm_sema_alloc(fsm, 0);
  *    ...
  *
  *    SILC_FSM_STATE(silc_foo_state)
@@ -935,7 +934,6 @@ do {                                                \
  *      SilcBool timedout;
  *      ...
  *
- *
  *      // Wait here for async call to complete, or 10 seconds for timeout
  *      SILC_FSM_SEMA_TIMEDWAIT(ctx->async_sema, 10, 0, &timedout);
  *