From: Pekka Riikonen Date: Tue, 18 Jul 2006 13:12:57 +0000 (+0000) Subject: updates. X-Git-Tag: silc.client.1.1.beta1~295 X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=commitdiff_plain;h=e9d3aad89a27b967d228fa1ff6cb8a1bdd7052c7 updates. --- diff --git a/lib/silcasn1/silcasn1_decode.c b/lib/silcasn1/silcasn1_decode.c index 5fcfb4c7..efb1534f 100644 --- a/lib/silcasn1/silcasn1_decode.c +++ b/lib/silcasn1/silcasn1_decode.c @@ -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; diff --git a/lib/silcasn1/silcber.h b/lib/silcasn1/silcber.h index 244c856c..2360c780 100644 --- a/lib/silcasn1/silcber.h +++ b/lib/silcasn1/silcber.h @@ -4,7 +4,7 @@ Author: Pekka Riikonen - 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 @@ -35,26 +35,51 @@ #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 * diff --git a/lib/silccore/silcmessage.c b/lib/silccore/silcmessage.c index 15ab266e..9af6a072 100644 --- a/lib/silccore/silcmessage.c +++ b/lib/silccore/silcmessage.c @@ -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; diff --git a/lib/silccore/silcmessage.h b/lib/silccore/silcmessage.h index 3ffa7ba1..282b4437 100644 --- a/lib/silccore/silcmessage.h +++ b/lib/silccore/silcmessage.h @@ -4,7 +4,7 @@ Author: Pekka Riikonen - 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 * diff --git a/lib/silccrypt/silccipher.c b/lib/silccrypt/silccipher.c index 2264d5cf..d8b73215 100644 --- a/lib/silccrypt/silccipher.c +++ b/lib/silccrypt/silccipher.c @@ -4,7 +4,7 @@ Author: Pekka Riikonen - 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); } diff --git a/lib/silccrypt/silcpkcs.h b/lib/silccrypt/silcpkcs.h index c6a915c9..f0dfca17 100644 --- a/lib/silccrypt/silcpkcs.h +++ b/lib/silccrypt/silcpkcs.h @@ -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); diff --git a/lib/silccrypt/silcpkcs1.h b/lib/silccrypt/silcpkcs1.h index 30cee1cd..2218106e 100644 --- a/lib/silccrypt/silcpkcs1.h +++ b/lib/silccrypt/silcpkcs1.h @@ -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 * diff --git a/lib/silcutil/silcbuffmt.h b/lib/silcutil/silcbuffmt.h index 4c3436a5..feb4754e 100644 --- a/lib/silcutil/silcbuffmt.h +++ b/lib/silcutil/silcbuffmt.h @@ -61,6 +61,9 @@ * if (ret < 0) * error; * + * // Free the allocated data + * silc_buffer_purge(&buffer); + * ***/ int silc_buffer_format(SilcBuffer dst, ...); diff --git a/lib/silcutil/silcfsm.h b/lib/silcutil/silcfsm.h index 8822b2dd..d1e253ec 100644 --- a/lib/silcutil/silcfsm.h +++ b/lib/silcutil/silcfsm.h @@ -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); *