From 9b499de7f8fdbb24c32b8a0a84bb2fbbcdab782a Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Wed, 13 Feb 2008 17:18:47 +0200 Subject: [PATCH] Header documentation changes and other small fixes --- TODO | 170 +++++++++++++++++++------------ lib/silcacc/silcacc.h | 26 ++--- lib/silcasn1/silcasn1.h | 118 +++++++++++++-------- lib/silcasn1/silcasn1_decode.c | 2 +- lib/silcasn1/silcasn1_encode.c | 4 +- lib/silcasn1/silcber.h | 12 +-- lib/silccrypt/ciphers_def.h | 36 ++++--- lib/silccrypt/sha256_x86.S | 2 +- lib/silccrypt/silccipher.h | 6 +- lib/silccrypt/tests/Makefile.am | 2 +- lib/silccrypt/tests/test_cast5.c | 2 +- lib/silcmath/silcmath.h | 6 +- lib/silcmath/silcmp.h | 96 ++++++++--------- lib/silcssh/silcssh.c | 2 +- lib/silcssh/silcssh.h | 25 ++--- 15 files changed, 291 insertions(+), 218 deletions(-) diff --git a/TODO b/TODO index 057a5976..1308c5a3 100644 --- a/TODO +++ b/TODO @@ -11,50 +11,41 @@ on some of the TODO entries simply let us know about it by dropping a note to silc-devel mailing list or appear on 'silc' channel on SILCNet. -SKR Library, lib/silcskr/ -========================= +Crypto Library, lib/silccrypt/ +============================== - o Add fingerprint as search constraint. + o SilcHmac must be replaced with generic SilcMac so that we can add + others than just HMAC algorithms. Backwards support (via #define's) + must be preserved. - o Add OpenPGP support. Adding, removing, fetching PGP keys. (Keyring - support?) + o Change the DSA implementation to support FIPS186-3. This means that + the q length is determined by the key length. Also note that specific + hash functions must be used with different q lengths. - o Add support for importing public keys from a directory and/or from a - file. Add support for exporting the repository (different formats for - different key types?). - - o Change the entire silc_skr_find API. Remove SilcSKRFind and just simply - add the find constraints as variable argument list to silc_skr_find, eg: - - silc_skr_find(skr, schedule, callback, context, - SILC_SKR_FIND_PUBLIC_KEY, public_key, - SILC_SKR_FIND_COUNTRY, "FI", - SILC_SKR_FIND_USAGE, SILC_SKR_USAGE_AUTH, - SILC_SKR_FIND_END); + o AES CBC is missing proper alignment code (see silc_1_1_branch). - NULL argument would be ignored and skipped. + o The asynchronous functions to perhaps to _async to preserve backwards + compatibility with synchronous versions, and make easier to migrate + from 1.1 to 1.2. - o Add OR logical rule in addition of the current default AND, eg: + o Do GCC vs ICC benchmarks of all key algorithms. - // Found key(s) MUST have this public key AND this country. - silc_skr_find(skr, schedule, callback, context, - SILC_SKR_FIND_RULE_AND, - SILC_SKR_FIND_PUBLIC_KEY, public_key, - SILC_SKR_FIND_COUNTRY, "FI", - SILC_SKR_FIND_END); + o silc_pkcs_public_key_alloc should accept also SILC_PKCS_ANY as argument + and try all supported PKCS until one succeeds (ala load_public_key). - // Found key(s) MUST have this public key OR this key context - silc_skr_find(skr, schedule, callback, context, - SILC_SKR_FIND_RULE_OR, - SILC_SKR_FIND_PUBLIC_KEY, public_key, - SILC_SKR_FIND_CONTEXT, key_context, - SILC_SKR_FIND_END); + o Add fingerprint to SilcSILCPublicKey and retrieval to silcpk.h, and + possibly to silcpkcs.h. - o SilcStack to SKR API. + /* Return fingerprint of the `public_key'. Returns also the algorithm + that has been used to make the fingerprint. */ + const unsigned char * + silc_pkcs_get_fingerprint(SilcPublicKey public_key, + const char **hash_algorithm, + SilcUInt32 *fingerprint_len); + o Add DSA support to SILC public key. -Crypto Library, lib/silccrypt/ -============================== + o Global RNG must be changed to use SILC Global API. o Add silc_crypto_init and silc_crypto_uninit. The _init should take SilcStack that will act as global memory pool for all of crypto @@ -64,31 +55,15 @@ Crypto Library, lib/silccrypt/ preference over the default once, ie. user can always dictate the order of algorithms. (***DONE) - o Add fingerprint to SilcSILCPublicKey and retrieval to silcpk.h, and - possibly to silcpkcs.h. - - /* Return fingerprint of the `public_key'. Returns also the algorithm - that has been used to make the fingerprint. */ - const unsigned char * - silc_pkcs_get_fingerprint(SilcPublicKey public_key, - const char **hash_algorithm, - SilcUInt32 *fingerprint_len); - o Change SILC PKCS API to asynchronous, so that accelerators can be used. All PKCS routines should now take callbacks as argument and they should be delivered to SilcPKCSObject and SilcPKCSAlgorithm too. (***DONE) - o The asynchronous functions to perhaps to _async to preserve backwards - compatibility with synchronous versions, and make easier to migrate - from 1.1 to 1.2. - o Change PKCS Algorithm API to take SilcPKCSAlgorithm as argument to encrypt, decrypt, sign and verify functions. We may need to for exmaple check the alg->hash, supported hash functions. Maybe deliver it also to all other functions in SilcPKCSAlgorithm to be consistent. (***DONE) - o Add DSA support to SILC public key. - o Add DSS support. (***DONE) o Implement the defined SilcDH API. The definition is in @@ -96,27 +71,65 @@ Crypto Library, lib/silccrypt/ be accelerated. Also take into account that it could use elliptic curves. + o All cipher, hash, hmac etc. allocation routines should take their name + in as const char * not const unsigned char *. (***DONE) + o Add ECDSA support. o Add ECDH support. - o AES CBC is missing proper alignment code (see silc_1_1_branch). - o All cipher, hash, hmac etc. allocation routines should take their name - in as const char * not const unsigned char *. (***DONE) +SKR Library, lib/silcskr/ +========================= + + o Add fingerprint as search constraint. + + o Add SSH support. (***DONE, TESTING NEEDED) + + o Add OpenPGP support. Adding, removing, fetching PGP keys. (Keyring + support?) + + o Add support for importing public keys from a directory and/or from a + file. Add support for exporting the repository (different formats for + different key types?). + + o Change the entire silc_skr_find API. Remove SilcSKRFind and just simply + add the find constraints as variable argument list to silc_skr_find, eg: + + silc_skr_find(skr, schedule, callback, context, + SILC_SKR_FIND_PUBLIC_KEY, public_key, + SILC_SKR_FIND_COUNTRY, "FI", + SILC_SKR_FIND_USAGE, SILC_SKR_USAGE_AUTH, + SILC_SKR_FIND_END); + + NULL argument would be ignored and skipped. + + o Add OR logical rule in addition of the current default AND, eg: + + // Found key(s) MUST have this public key AND this country. + silc_skr_find(skr, schedule, callback, context, + SILC_SKR_FIND_RULE_AND, + SILC_SKR_FIND_PUBLIC_KEY, public_key, + SILC_SKR_FIND_COUNTRY, "FI", + SILC_SKR_FIND_END); + + // Found key(s) MUST have this public key OR this key context + silc_skr_find(skr, schedule, callback, context, + SILC_SKR_FIND_RULE_OR, + SILC_SKR_FIND_PUBLIC_KEY, public_key, + SILC_SKR_FIND_CONTEXT, key_context, + SILC_SKR_FIND_END); + + o SilcStack to SKR API. SILC Accelerator Library ======================== - o SILC Accelerator API. Provides generic way to use different kind of - accelerators. Basically implements SILC PKCS API so that SilcPublicKey - and SilcPrivateKey can be used but they call the accelerators. - (***DONE) - - o Implement software accelerator. It is a thread pool system where the - public key and private key operations are executed in threads. - (***DONE) + o Add SilcCipher support to SilcAccelerator and software accelerator. + Accelerate at least ciphers using CTR mode which can be done in + parallel. Do it in producer/consumer fashion where threads generate + key stream and other thread(s) encrypt using the key stream. o Add init options to SilcAcceleratorObject as a SilcAcceleratorOption structure. Each accelerator defines the options that they support and @@ -139,9 +152,14 @@ SILC Accelerator Library o Diffie-Hellman acceleration - (o Symmetric key cryptosystem acceleration? They are always sycnhronouos - even with hardware acceleration so the crypto API shouldn't require - changes.) maybe + o SILC Accelerator API. Provides generic way to use different kind of + accelerators. Basically implements SILC PKCS API so that SilcPublicKey + and SilcPrivateKey can be used but they call the accelerators. + (***DONE) + + o Implement software accelerator. It is a thread pool system where the + public key and private key operations are executed in threads. + (***DONE) lib/silcmath @@ -194,12 +212,34 @@ lib/silcasn1 lib/silcpgp =========== - o OpenPGP certificate support, allowing the use of PGP public keys. + o OpenPGP certificate support, allowing the use of PGP public keys and + private keys. + + o Signatures for data, public keys and private keys (Signature packet). + + o Signature verification from public keys, private keys and other signed + data (Signature packet). + + o Encryption and decryption support (Packet tags 8 and 18 most likely). + + o Retrieval of User ID from public key and private key (Used ID packet + and User Attribute packet). + + o Creation of OpenPGP key pairs. + + o Trust packet handling (GNU PG compatible) from public and private keys. + + o Add option that the signature format doesn't use the OpenPGP format + but whatever is the default in SILC crypto library. lib/silcssh =========== + o Add option that the signature format doesn't use the SSH2 protocol + but whatever is the default in SILC crypto library; + silc_ssh_private_key_set_signature_type, or something. + o SSH2 public key/private key support, allowing the use of SSH2 keys. RFC 4716. (***DONE) diff --git a/lib/silcacc/silcacc.h b/lib/silcacc/silcacc.h index ea97437a..a7ec70b2 100644 --- a/lib/silcacc/silcacc.h +++ b/lib/silcacc/silcacc.h @@ -4,7 +4,7 @@ Author: Pekka Riikonen - Copyright (C) 2007 Pekka Riikonen + Copyright (C) 2007 - 2008 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 @@ -26,7 +26,7 @@ #ifndef SILCACC_H #define SILCACC_H -/****s* silcacc/SilcAccAPI/SilcAccelerator +/****s* silcacc/SilcAccelerator * * NAME * @@ -56,7 +56,7 @@ typedef struct SilcAcceleratorObject { #endif /* 0 */ } *SilcAccelerator, SilcAcceleratorStruct; -/****f* silcacc/SilcAccAPI/silc_acc_register +/****f* silcacc/silc_acc_register * * SYNOPSIS * @@ -76,7 +76,7 @@ typedef struct SilcAcceleratorObject { ***/ SilcBool silc_acc_register(const SilcAccelerator acc); -/****f* silcacc/SilcAccAPI/silc_acc_unregister +/****f* silcacc/silc_acc_unregister * * SYNOPSIS * @@ -90,7 +90,7 @@ SilcBool silc_acc_register(const SilcAccelerator acc); ***/ void silc_acc_unregister(SilcAccelerator acc); -/****f* silcacc/SilcAccAPI/silc_acc_find +/****f* silcacc/silc_acc_find * * SYNOPSIS * @@ -104,7 +104,7 @@ void silc_acc_unregister(SilcAccelerator acc); ***/ SilcAccelerator silc_acc_find(const char *name); -/****f* silcacc/SilcAccAPI/silc_acc_init +/****f* silcacc/silc_acc_init * * SYNOPSIS * @@ -126,7 +126,7 @@ SilcAccelerator silc_acc_find(const char *name); ***/ SilcBool silc_acc_init(SilcAccelerator acc, SilcSchedule schedule, ...); -/****f* silcacc/SilcAccAPI/silc_acc_uninit +/****f* silcacc/silc_acc_uninit * * SYNOPSIS * @@ -142,7 +142,7 @@ SilcBool silc_acc_init(SilcAccelerator acc, SilcSchedule schedule, ...); ***/ SilcBool silc_acc_uninit(SilcAccelerator acc); -/****f* silcacc/SilcAccAPI/silc_acc_get_supported +/****f* silcacc/silc_acc_get_supported * * SYNOPSIS * @@ -156,7 +156,7 @@ SilcBool silc_acc_uninit(SilcAccelerator acc); ***/ SilcDList silc_acc_get_supported(void); -/****f* silcacc/SilcAccAPI/silc_acc_get_name +/****f* silcacc/silc_acc_get_name * * SYNOPSIS * @@ -169,7 +169,7 @@ SilcDList silc_acc_get_supported(void); ***/ const char *silc_acc_get_name(SilcAccelerator acc); -/****f* silcacc/SilcAccAPI/silc_acc_public_key +/****f* silcacc/silc_acc_public_key * * SYNOPSIS * @@ -192,7 +192,7 @@ const char *silc_acc_get_name(SilcAccelerator acc); SilcPublicKey silc_acc_public_key(SilcAccelerator acc, SilcPublicKey public_key); -/****f* silcacc/SilcAccAPI/silc_acc_private_key +/****f* silcacc/silc_acc_private_key * * SYNOPSIS * @@ -215,7 +215,7 @@ SilcPublicKey silc_acc_public_key(SilcAccelerator acc, SilcPrivateKey silc_acc_private_key(SilcAccelerator acc, SilcPrivateKey private_key); -/****f* silcacc/SilcAccAPI/silc_acc_get_public_key +/****f* silcacc/silc_acc_get_public_key * * SYNOPSIS * @@ -232,7 +232,7 @@ SilcPrivateKey silc_acc_private_key(SilcAccelerator acc, SilcPublicKey silc_acc_get_public_key(SilcAccelerator acc, SilcPublicKey public_key); -/****f* silcacc/SilcAccAPI/silc_acc_get_private_key +/****f* silcacc/silc_acc_get_private_key * * SYNOPSIS * diff --git a/lib/silcasn1/silcasn1.h b/lib/silcasn1/silcasn1.h index c0445182..baef012d 100644 --- a/lib/silcasn1/silcasn1.h +++ b/lib/silcasn1/silcasn1.h @@ -4,7 +4,7 @@ Author: Pekka Riikonen - Copyright (C) 2003 - 2007 Pekka Riikonen + Copyright (C) 2003 - 2008 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 @@ -23,6 +23,7 @@ * * Efficient Abstract Syntax Notation One (ASN.1) implementation. This * interface provides simple and efficient ASN.1 encoder and decoder. + * * The encoder directly encodes BER encoded data blocks from variable * argument list of ASN.1 types. Multiple trees can be encoded at once * and multiple nodes can be encoded into the tree at once. By default @@ -46,12 +47,33 @@ * References: ITU-T X.680 - X.693 * http://www.itu.int/ITU-T/studygroups/com17/languages/ * + * EXAMPLE + * + * silc_asn1_encode(asn1, buf, + * SILC_ASN1_SEQUENCE, + * SILC_ASN1_BOOLEAN(bool_val), + * SILC_ASN1_OCTET_STRING(string, string_len), + * SILC_ASN1_SEQUENCE_T(0, 2), + * SILC_ASN1_BOOLEAN_T(SILC_ASN1_EXPLICIT, 100, foo), + * SILC_ASN1_END, + * SILC_ASN1_OCTET_STRING_T(0, 1, string2, string2_len), + * SILC_ASN1_END, SILC_ASN1_END); + * + * Creates ASN.1 tree that looks something like: + * + * buf ::= SEQUENCE { + * bool_val BOOLEAN, + * string OCTET-STRING, + * [2] SEQUENCE { + * foo [100] EXPLICIT BOOLEAN } + * string2 [1] OCTET-STRING } + * ***/ #ifndef SILCASN1_H #define SILCASN1_H -/****s* silcasn1/SilcASN1API/SilcAsn1 +/****s* silcasn1/SilcAsn1 * * NAME * @@ -68,7 +90,7 @@ ***/ typedef struct SilcAsn1Object *SilcAsn1; -/****s* silcasn1/SilcASN1API/SilcAsn1Struct +/****s* silcasn1/SilcAsn1Struct * * NAME * @@ -84,7 +106,7 @@ typedef struct SilcAsn1Object *SilcAsn1; ***/ typedef struct SilcAsn1Object SilcAsn1Struct; -/****d* silcasn1/SilcASN1API/SilcAsn1Options +/****d* silcasn1/SilcAsn1Options * * NAME * @@ -130,7 +152,7 @@ typedef enum { /* Default. If only this is set then defaults are implied. */ SILC_ASN1_DEFAULT = 0x0000, - /* Class options. User does not need to set these unless specificly + /* Class options. User does not need to set these unless specifically wanted to do so. If SILC_ASN1_DEFAULT is set the SILC_ASN1_CONTEXT is implied if any of the tag options are set. Otherwise SILC_ASN1_UNIVERSAL is implied. Only one of these can bet set at once. */ @@ -163,7 +185,7 @@ typedef enum { } SilcAsn1Options; /***/ -/****d* silcasn1/SilcASN1API/SilcAsn1Tag +/****d* silcasn1/SilcAsn1Tag * * NAME * @@ -212,7 +234,7 @@ typedef enum { #include "silcasn1_i.h" -/****f* silcasn1/SilcASN1API/silc_asn1_alloc +/****f* silcasn1/silc_asn1_alloc * * SYNOPSIS * @@ -240,7 +262,7 @@ typedef enum { ***/ SilcAsn1 silc_asn1_alloc(SilcStack stack); -/****f* silcasn1/SilcASN1API/silc_asn1_free +/****f* silcasn1/silc_asn1_free * * SYNOPSIS * @@ -255,7 +277,7 @@ SilcAsn1 silc_asn1_alloc(SilcStack stack); ***/ void silc_asn1_free(SilcAsn1 asn1); -/****f* silcasn1/SilcASN1API/silc_asn1_init +/****f* silcasn1/silc_asn1_init * * SYNOPSIS * @@ -276,7 +298,7 @@ void silc_asn1_free(SilcAsn1 asn1); ***/ SilcBool silc_asn1_init(SilcAsn1 asn1, SilcStack stack); -/****f* silcasn1/SilcASN1API/silc_asn1_uninit +/****f* silcasn1/silc_asn1_uninit * * SYNOPSIS * @@ -290,7 +312,7 @@ SilcBool silc_asn1_init(SilcAsn1 asn1, SilcStack stack); ***/ void silc_asn1_uninit(SilcAsn1 asn1); -/****f* silcasn1/SilcASN1API/silc_asn1_encode +/****f* silcasn1/silc_asn1_encode * * SYNOPSIS * @@ -303,7 +325,7 @@ void silc_asn1_uninit(SilcAsn1 asn1); * trees and nodes that are encoded into the `dest'. By default, the * memory for `dest' is allocated from the `asn1', and the buffer becomes * invalid either by calling silc_asn1_free, silc_asn1_uninit, or when - * silc_asn1_encode is called for the next time. + * silc_asn1_encode is called for the next time with `asn1' context. * * If the SILC_ASN1_OPTS macro with SILC_ASN1_ALLOC option is given then * the `dest' is dynamically allocated and caller must free it by itself. @@ -344,7 +366,7 @@ void silc_asn1_uninit(SilcAsn1 asn1); ***/ SilcBool silc_asn1_encode(SilcAsn1 asn1, SilcBuffer dest, ...); -/****f* silcasn1/SilcASN1API/silc_asn1_decode +/****f* silcasn1/silc_asn1_decode * * SYNOPSIS * @@ -402,7 +424,7 @@ SilcBool silc_asn1_encode(SilcAsn1 asn1, SilcBuffer dest, ...); ***/ SilcBool silc_asn1_decode(SilcAsn1 asn1, SilcBuffer src, ...); -/****f* silcasn1/SilcASN1API/SILC_ASN1_OPTS +/****f* silcasn1/SILC_ASN1_OPTS * * SYNOPSIS * @@ -433,7 +455,7 @@ SilcBool silc_asn1_decode(SilcAsn1 asn1, SilcBuffer src, ...); ***/ #define SILC_ASN1_OPTS(opts) SILC_ASN1_TAG_OPTS, (opts) -/****f* silcasn1/SilcASN1API/SILC_ASN1_ANY +/****f* silcasn1/SILC_ASN1_ANY * * SYNOPSIS * @@ -473,7 +495,7 @@ SilcBool silc_asn1_decode(SilcAsn1 asn1, SilcBuffer src, ...); #define SILC_ASN1_ANY(x) SILC_ASN1_U1(ANY, x) #define SILC_ASN1_ANY_T(o, t, x) SILC_ASN1_T1(ANY, o, t, x) -/****f* silcasn1/SilcASN1API/SILC_ASN1_ANY_PRIMITIVE +/****f* silcasn1/SILC_ASN1_ANY_PRIMITIVE * * SYNOPSIS * @@ -519,7 +541,7 @@ SilcBool silc_asn1_decode(SilcAsn1 asn1, SilcBuffer src, ...); #define SILC_ASN1_ANY_PRIMITIVE(t, x) SILC_ASN1_T1(ANY_PRIMITIVE, 0, t, x) #define SILC_ASN1_ANY_PRIMITIVE_T(o, t, x) SILC_ASN1_T1(ANY_PRIMITIVE, o, t, x) -/****f* silcasn1/SilcASN1API/SILC_ASN1_SEQUENCE +/****f* silcasn1/SILC_ASN1_SEQUENCE * * SYNOPSIS * @@ -546,11 +568,17 @@ SilcBool silc_asn1_decode(SilcAsn1 asn1, SilcBuffer src, ...); * SILC_ASN1_BOOLEAN(boolval), * SILC_ASN1_END, SILC_ASN1_END); * + * silc_asn1_encode(asn1, tree2, + * SILC_ASN1_SEQUENCE_T(SILC_ASN1_PRIVATE, 101), + * SILC_ASN1_ANY(node), + * SILC_ASN1_BOOLEAN(boolval), + * SILC_ASN1_END, SILC_ASN1_END); + * ***/ #define SILC_ASN1_SEQUENCE SILC_ASN1_U0(SEQUENCE) #define SILC_ASN1_SEQUENCE_T(o, t) SILC_ASN1_T0(SEQUENCE, o, t) -/****f* silcasn1/SilcASN1API/SILC_ASN1_SET +/****f* silcasn1/SILC_ASN1_SET * * SYNOPSIS * @@ -580,7 +608,7 @@ SilcBool silc_asn1_decode(SilcAsn1 asn1, SilcBuffer src, ...); #define SILC_ASN1_SET SILC_ASN1_U0(SET) #define SILC_ASN1_SET_T(o, t) SILC_ASN1_T0(SET, o, t) -/****f* silcasn1/SilcASN1API/SILC_ASN1_SEQUENCE_OF +/****f* silcasn1/SILC_ASN1_SEQUENCE_OF * * SYNOPSIS * @@ -614,7 +642,7 @@ SilcBool silc_asn1_decode(SilcAsn1 asn1, SilcBuffer src, ...); ***/ #define SILC_ASN1_SEQUENCE_OF(x, c) SILC_ASN1_U2(SEQUENCE_OF, x, c) -/****f* silcasn1/SilcASN1API/SILC_ASN1_SET_OF +/****f* silcasn1/SILC_ASN1_SET_OF * * SYNOPSIS * @@ -645,7 +673,7 @@ SilcBool silc_asn1_decode(SilcAsn1 asn1, SilcBuffer src, ...); ***/ #define SILC_ASN1_SET_OF(x, c) SILC_ASN1_U2(SEQUENCE_OF, x, c) -/****f* silcasn1/SilcASN1API/SILC_ASN1_CHOICE +/****f* silcasn1/SILC_ASN1_CHOICE * * SYNOPSIS * @@ -674,7 +702,7 @@ SilcBool silc_asn1_decode(SilcAsn1 asn1, SilcBuffer src, ...); ***/ #define SILC_ASN1_CHOICE(x) SILC_ASN1_U1(CHOICE, x) -/****f* silcasn1/SilcASN1API/SILC_ASN1_BOOLEAN +/****f* silcasn1/SILC_ASN1_BOOLEAN * * SYNOPSIS * @@ -697,13 +725,13 @@ SilcBool silc_asn1_decode(SilcAsn1 asn1, SilcBuffer src, ...); #define SILC_ASN1_BOOLEAN(x) SILC_ASN1_U1(BOOLEAN, x) #define SILC_ASN1_BOOLEAN_T(o, t, x) SILC_ASN1_T1(BOOLEAN, o, t, x) -/****f* silcasn1/SilcASN1API/SILC_ASN1_INT +/****f* silcasn1/SILC_ASN1_INT * * SYNOPSIS * * Encoding: * SILC_ASN1_INT(integer) - * SILC_ASN1_INT_T(opts, tag, &integer) + * SILC_ASN1_INT_T(opts, tag, integer) * * Decoding: * SILC_ASN1_INT(&integer) @@ -720,13 +748,13 @@ SilcBool silc_asn1_decode(SilcAsn1 asn1, SilcBuffer src, ...); #define SILC_ASN1_INT(x) SILC_ASN1_U1(INTEGER, x) #define SILC_ASN1_INT_T(o, t, x) SILC_ASN1_T1(INTEGER, o, t, x) -/****f* silcasn1/SilcASN1API/SILC_ASN1_SHORT_INT +/****f* silcasn1/SILC_ASN1_SHORT_INT * * SYNOPSIS * * Encoding: * SILC_ASN1_SHORT_INT(integer) - * SILC_ASN1_SHORT_INT_T(opts, tag, &integer) + * SILC_ASN1_SHORT_INT_T(opts, tag, integer) * * Decoding: * SILC_ASN1_SHORT_INT(&integer) @@ -743,13 +771,13 @@ SilcBool silc_asn1_decode(SilcAsn1 asn1, SilcBuffer src, ...); #define SILC_ASN1_SHORT_INT(x) SILC_ASN1_U1(SHORT_INTEGER, x) #define SILC_ASN1_SHORT_INT_T(o, t, x) SILC_ASN1_T1(SHORT_INTEGER, o, t, x) -/****f* silcasn1/SilcASN1API/SILC_ASN1_ENUM +/****f* silcasn1/SILC_ASN1_ENUM * * SYNOPSIS * * Encoding: * SILC_ASN1_ENUM(enum) - * SILC_ASN1_ENUM_T(opts, tag, &enum) + * SILC_ASN1_ENUM_T(opts, tag, enum) * * Decoding: * SILC_ASN1_ENUM(&enum) @@ -766,7 +794,7 @@ SilcBool silc_asn1_decode(SilcAsn1 asn1, SilcBuffer src, ...); #define SILC_ASN1_ENUM(x) SILC_ASN1_U1(ENUM, x) #define SILC_ASN1_ENUM_T(o, t, x) SILC_ASN1_T1(ENUM, o, t, x) -/****f* silcasn1/SilcASN1API/SILC_ASN1_BIT_STRING +/****f* silcasn1/SILC_ASN1_BIT_STRING * * SYNOPSIS * @@ -791,7 +819,7 @@ SilcBool silc_asn1_decode(SilcAsn1 asn1, SilcBuffer src, ...); #define SILC_ASN1_BIT_STRING(x, xl) SILC_ASN1_U2(BIT_STRING, x, xl) #define SILC_ASN1_BIT_STRING_T(o, t, x, xl) SILC_ASN1_T2(BIT_STRING, o, t, x, xl) -/****f* silcasn1/SilcASN1API/SILC_ASN1_NULL +/****f* silcasn1/SILC_ASN1_NULL * * SYNOPSIS * @@ -817,7 +845,7 @@ SilcBool silc_asn1_decode(SilcAsn1 asn1, SilcBuffer src, ...); #define SILC_ASN1_NULL(x) SILC_ASN1_U1(NULL, x) #define SILC_ASN1_NULL_T(o, t, x) SILC_ASN1_T1(NULL, o, t, x) -/****f* silcasn1/SilcASN1API/SILC_ASN1_OID +/****f* silcasn1/SILC_ASN1_OID * * SYNOPSIS * @@ -840,7 +868,7 @@ SilcBool silc_asn1_decode(SilcAsn1 asn1, SilcBuffer src, ...); #define SILC_ASN1_OID(x) SILC_ASN1_U1(OID, x) #define SILC_ASN1_OID_T(o, t, x) SILC_ASN1_UT(OID, o, t, x) -/****f* silcasn1/SilcASN1API/SILC_ASN1_OCTET_STRING +/****f* silcasn1/SILC_ASN1_OCTET_STRING * * SYNOPSIS * @@ -864,7 +892,7 @@ SilcBool silc_asn1_decode(SilcAsn1 asn1, SilcBuffer src, ...); #define SILC_ASN1_OCTET_STRING(x, xl) SILC_ASN1_U2(OCTET_STRING, x, xl) #define SILC_ASN1_OCTET_STRING_T(o, t, x, xl) SILC_ASN1_T2(OCTET_STRING, o, t, x, xl) -/****f* silcasn1/SilcASN1API/SILC_ASN1_UTF8_STRING +/****f* silcasn1/SILC_ASN1_UTF8_STRING * * SYNOPSIS * @@ -893,7 +921,7 @@ SilcBool silc_asn1_decode(SilcAsn1 asn1, SilcBuffer src, ...); #define SILC_ASN1_UTF8_STRING(x, xl) SILC_ASN1_U2(UTF8_STRING, x, xl) #define SILC_ASN1_UTF8_STRING_T(o, t, x, xl) SILC_ASN1_T2(UTF8_STRING, o, t, x, xl) -/****f* silcasn1/SilcASN1API/SILC_ASN1_NUMERIC_STRING +/****f* silcasn1/SILC_ASN1_NUMERIC_STRING * * SYNOPSIS * @@ -922,7 +950,7 @@ SilcBool silc_asn1_decode(SilcAsn1 asn1, SilcBuffer src, ...); #define SILC_ASN1_NUMERIC_STRING(x, xl) SILC_ASN1_U2(NUMERIC_STRING, x, xl) #define SILC_ASN1_NUMERIC_STRING_T(o, t, x, xl) SILC_ASN1_T2(NUMERIC_STRING, o, t, x, xl) -/****f* silcasn1/SilcASN1API/SILC_ASN1_PRINTABLE_STRING +/****f* silcasn1/SILC_ASN1_PRINTABLE_STRING * * SYNOPSIS * @@ -951,7 +979,7 @@ SilcBool silc_asn1_decode(SilcAsn1 asn1, SilcBuffer src, ...); #define SILC_ASN1_PRINTABLE_STRING(x, xl) SILC_ASN1_U2(PRINTABLE_STRING, x, xl) #define SILC_ASN1_PRINTABLE_STRING_T(o, t, x, xl) SILC_ASN1_T2(PRINTABLE_STRING, o, t, x, xl) -/****f* silcasn1/SilcASN1API/SILC_ASN1_TELETEX_STRING +/****f* silcasn1/SILC_ASN1_TELETEX_STRING * * SYNOPSIS * @@ -980,7 +1008,7 @@ SilcBool silc_asn1_decode(SilcAsn1 asn1, SilcBuffer src, ...); #define SILC_ASN1_TELETEX_STRING(x, xl) SILC_ASN1_U2(TELETEX_STRING, x, xl) #define SILC_ASN1_TELETEX_STRING_T(o, t, x, xl) SILC_ASN1_T2(TELETEX_STRING, o, t, x, xl) -/****f* silcasn1/SilcASN1API/SILC_ASN1_IA5_STRING +/****f* silcasn1/SILC_ASN1_IA5_STRING * * SYNOPSIS * @@ -1009,7 +1037,7 @@ SilcBool silc_asn1_decode(SilcAsn1 asn1, SilcBuffer src, ...); #define SILC_ASN1_IA5_STRING(x, xl) SILC_ASN1_U2(IA5_STRING, x, xl) #define SILC_ASN1_IA5_STRING_T(o, t, x, xl) SILC_ASN1_T2(IA5_STRING, o, t, x, xl) -/****f* silcasn1/SilcASN1API/SILC_ASN1_VISIBLE_STRING +/****f* silcasn1/SILC_ASN1_VISIBLE_STRING * * SYNOPSIS * @@ -1038,7 +1066,7 @@ SilcBool silc_asn1_decode(SilcAsn1 asn1, SilcBuffer src, ...); #define SILC_ASN1_VISIBLE_STRING(x, xl) SILC_ASN1_U2(VISIBLE_STRING, x, xl) #define SILC_ASN1_VISIBLE_STRING_T(o, t, x, xl) SILC_ASN1_T2(VISIBLE_STRING, o, t, x, xl) -/****f* silcasn1/SilcASN1API/SILC_ASN1_UNIVERSAL_STRING +/****f* silcasn1/SILC_ASN1_UNIVERSAL_STRING * * SYNOPSIS * @@ -1067,7 +1095,7 @@ SilcBool silc_asn1_decode(SilcAsn1 asn1, SilcBuffer src, ...); #define SILC_ASN1_UNIVERSAL_STRING(x, xl) SILC_ASN1_U2(UNIVERSAL_STRING, x, xl) #define SILC_ASN1_UNIVERSAL_STRING_T(o, t, x, xl) SILC_ASN1_T2(UNIVERSAL_STRING, o, t, x, xl) -/****f* silcasn1/SilcASN1API/SILC_ASN1_BMP_STRING +/****f* silcasn1/SILC_ASN1_BMP_STRING * * SYNOPSIS * @@ -1096,7 +1124,7 @@ SilcBool silc_asn1_decode(SilcAsn1 asn1, SilcBuffer src, ...); #define SILC_ASN1_BMP_STRING(x, xl) SILC_ASN1_U2(BMP_STRING, x, xl) #define SILC_ASN1_BMP_STRING_T(o, t, x, xl) SILC_ASN1_T2(BMP_STRING, o, t, x, xl) -/****f* silcasn1/SilcASN1API/SILC_ASN1_UNRESTRICTED_STRING +/****f* silcasn1/SILC_ASN1_UNRESTRICTED_STRING * * SYNOPSIS * @@ -1125,7 +1153,7 @@ SilcBool silc_asn1_decode(SilcAsn1 asn1, SilcBuffer src, ...); #define SILC_ASN1_UNRESTRICTED_STRING(x, xl) SILC_ASN1_U2(UNRESTRICTED_STRING, x, xl) #define SILC_ASN1_UNRESTRICTED_STRING_T(o, t, x, xl) SILC_ASN1_T2(UNRESTRICTED_STRING, o, t, x, xl) -/****f* silcasn1/SilcASN1API/SILC_ASN1_GENERAL_STRING +/****f* silcasn1/SILC_ASN1_GENERAL_STRING * * SYNOPSIS * @@ -1154,7 +1182,7 @@ SilcBool silc_asn1_decode(SilcAsn1 asn1, SilcBuffer src, ...); #define SILC_ASN1_GENERAL_STRING(x, xl) SILC_ASN1_U2(GENERAL_STRING, x, xl) #define SILC_ASN1_GENERAL_STRING_T(o, t, x, xl) SILC_ASN1_T2(GENERAL_STRING, o, t, x, xl) -/****f* silcasn1/SilcASN1API/SILC_ASN1_UTC_TIME +/****f* silcasn1/SILC_ASN1_UTC_TIME * * SYNOPSIS * @@ -1177,7 +1205,7 @@ SilcBool silc_asn1_decode(SilcAsn1 asn1, SilcBuffer src, ...); #define SILC_ASN1_UTC_TIME(x) SILC_ASN1_U1(UTC_TIME, x) #define SILC_ASN1_UTC_TIME_T(o, t, x) SILC_ASN1_T1(UTC_TIME, o, t, x) -/****f* silcasn1/SilcASN1API/SILC_ASN1_GEN_TIME +/****f* silcasn1/SILC_ASN1_GEN_TIME * * SYNOPSIS * @@ -1200,7 +1228,7 @@ SilcBool silc_asn1_decode(SilcAsn1 asn1, SilcBuffer src, ...); #define SILC_ASN1_GEN_TIME(x) SILC_ASN1_U1(GENERALIZED_TIME, x) #define SILC_ASN1_GEN_TIME_T(o, t, x) SILC_ASN1_T1(GENERALIZED_TIME, o, t, x) -/****f* silcasn1/SilcASN1API/SILC_ASN1_END +/****f* silcasn1/SILC_ASN1_END * * SYNOPSIS * diff --git a/lib/silcasn1/silcasn1_decode.c b/lib/silcasn1/silcasn1_decode.c index 0d7416c9..a85f2740 100644 --- a/lib/silcasn1/silcasn1_decode.c +++ b/lib/silcasn1/silcasn1_decode.c @@ -590,7 +590,7 @@ silc_asn1_decoder(SilcAsn1 asn1, SilcStack stack1, SilcAsn1Tag type, goto fail; } - *(*val) = (rdata[0] == 0xff ? TRUE : FALSE); + *(*val) = (rdata[0] != 0x00 ? TRUE : FALSE); break; } diff --git a/lib/silcasn1/silcasn1_encode.c b/lib/silcasn1/silcasn1_encode.c index 8b4c7a8c..5b4c0071 100644 --- a/lib/silcasn1/silcasn1_encode.c +++ b/lib/silcasn1/silcasn1_encode.c @@ -189,7 +189,7 @@ silc_asn1_encoder(SilcAsn1 asn1, SilcStack stack1, SilcStack stack2, SILC_LOG_DEBUG(("Error decoding underlaying node for ANY")); goto fail; } - assert(enc == SILC_BER_ENC_CONSTRUCTED); + SILC_VERIFY(enc == SILC_BER_ENC_CONSTRUCTED); /* Now encode with implicit tagging */ len = silc_ber_encoded_len(tag, d_len, FALSE); @@ -485,7 +485,7 @@ silc_asn1_encoder(SilcAsn1 asn1, SilcStack stack1, SilcStack stack2, /* Encode empty BER block */ SilcBool val = va_arg(asn1->ap, SilcUInt32); - assert(indef == FALSE); + SILC_VERIFY(indef == FALSE); if (!val) break; diff --git a/lib/silcasn1/silcber.h b/lib/silcasn1/silcber.h index 8c0ec694..d4df8974 100644 --- a/lib/silcasn1/silcber.h +++ b/lib/silcasn1/silcber.h @@ -4,7 +4,7 @@ Author: Pekka Riikonen - Copyright (C) 2003 - 2007 Pekka Riikonen + Copyright (C) 2003 - 2008 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,7 +35,7 @@ #ifndef SILCBER_H #define SILCBER_H -/****d* silcasn1/SilcBerAPI/SilcBerClass +/****d* silcasn1/SilcBerClass * * NAME * @@ -54,7 +54,7 @@ typedef enum { } SilcBerClass; /***/ -/****d* silcasn1/SilcBerAPI/SilcBerEncoding +/****d* silcasn1/SilcBerEncoding * * NAME * @@ -71,7 +71,7 @@ typedef enum { } SilcBerEncoding; /***/ -/****f* silcasn1/SilcBerAPI/silc_ber_encode +/****f* silcasn1/silc_ber_encode * * SYNOPSIS * @@ -95,7 +95,7 @@ SilcBool silc_ber_encode(SilcBuffer ber, SilcBerClass ber_class, const unsigned char *data, SilcUInt32 data_len, SilcBool indefinite); -/****f* silcasn1/SilcBerAPI/silc_ber_decode +/****f* silcasn1/silc_ber_decode * * SYNOPSIS * @@ -123,7 +123,7 @@ SilcBool silc_ber_decode(SilcBuffer ber, SilcBerClass *ber_class, const unsigned char **data, SilcUInt32 *data_len, SilcBool *indefinite, SilcUInt32 *identifier_len); -/****f* silcasn1/SilcBerAPI/silc_ber_encoded_len +/****f* silcasn1/silc_ber_encoded_len * * SYNOPSIS * diff --git a/lib/silccrypt/ciphers_def.h b/lib/silccrypt/ciphers_def.h index c550827e..d99da6df 100644 --- a/lib/silccrypt/ciphers_def.h +++ b/lib/silccrypt/ciphers_def.h @@ -80,7 +80,7 @@ do { \ #define SILC_CBC_DEC_LSB_128_32(len, iv, block_prev, block, \ block_dec, src, dst, i, dec) \ do { \ - if (len & (16 - 1)) \ + if (!len || len & (16 - 1)) \ return FALSE; \ \ SILC_GET32_LSB(block_prev[0], &iv[0]); \ @@ -162,7 +162,7 @@ do { \ #define SILC_CBC_DEC_MSB_128_32(len, iv, block_prev, block, \ block_dec, src, dst, i, dec) \ do { \ - if (len & (16 - 1)) \ + if (!len || len & (16 - 1)) \ return FALSE; \ \ SILC_GET32_MSB(block_prev[0], &iv[0]); \ @@ -236,7 +236,7 @@ do { \ #define SILC_CBC_DEC_MSB_64_32(len, iv, block_prev, block, \ block_dec, src, dst, i, dec) \ do { \ - if (len & (8 - 1)) \ + if (!len || len & (8 - 1)) \ return FALSE; \ \ SILC_GET32_MSB(block_prev[0], &iv[0]); \ @@ -438,6 +438,7 @@ do { \ #define SILC_CFB_DEC_LSB_128_32(iv, cfb, pad, src, dst, dec) \ do { \ + unsigned char temp; \ while (len-- > 0) { \ if (pad == 16) { \ SILC_GET32_LSB(cfb[0], iv); \ @@ -453,9 +454,9 @@ do { \ SILC_PUT32_LSB(cfb[3], iv + 12); \ pad = 0; \ } \ - iv[pad] = *src ^ iv[pad]; \ - *dst = iv[pad]; \ - iv[pad++] = *src; \ + temp = *src; \ + *dst = temp ^ iv[pad]; \ + iv[pad++] = temp; \ dst++; \ src++; \ } \ @@ -491,6 +492,7 @@ do { \ #define SILC_CFB_DEC_MSB_128_32(iv, cfb, pad, src, dst, dec) \ do { \ + unsigned char temp; \ while (len-- > 0) { \ if (pad == 16) { \ SILC_GET32_MSB(cfb[0], iv); \ @@ -506,9 +508,9 @@ do { \ SILC_PUT32_MSB(cfb[3], iv + 12); \ pad = 0; \ } \ - iv[pad] = *src ^ iv[pad]; \ - *dst = iv[pad]; \ - iv[pad++] = *src; \ + temp = *src; \ + *dst = temp ^ iv[pad]; \ + iv[pad++] = temp; \ dst++; \ src++; \ } \ @@ -540,6 +542,7 @@ do { \ #define SILC_CFB_DEC_MSB_64_32(iv, cfb, pad, src, dst, dec) \ do { \ + unsigned char temp; \ while (len-- > 0) { \ if (pad == 8) { \ SILC_GET32_MSB(cfb[0], iv); \ @@ -551,9 +554,9 @@ do { \ SILC_PUT32_MSB(cfb[1], iv + 4); \ pad = 0; \ } \ - iv[pad] = *src ^ iv[pad]; \ - *dst = iv[pad]; \ - iv[pad++] = *src; \ + temp = *src; \ + *dst = temp ^ iv[pad]; \ + iv[pad++] = temp; \ dst++; \ src++; \ } \ @@ -578,15 +581,16 @@ do { \ /* CFB 128-bit block, MSB, the 8-bit iv argument must be decrypted. */ #define SILC_CFB_DEC_MSB_128_8(iv, pad, src, dst, dec) \ - do { \ +do { \ + unsigned char temp; \ while (len-- > 0) { \ if (pad == 16) { \ dec; \ pad = 0; \ } \ - iv[pad] = *src ^ iv[pad]; \ - *dst = iv[pad]; \ - iv[pad++] = *src; \ + temp = *src; \ + *dst = temp ^ iv[pad]; \ + iv[pad++] = temp; \ dst++; \ src++; \ } \ diff --git a/lib/silccrypt/sha256_x86.S b/lib/silccrypt/sha256_x86.S index a2ab83d2..cfc1ee83 100644 --- a/lib/silccrypt/sha256_x86.S +++ b/lib/silccrypt/sha256_x86.S @@ -48,7 +48,7 @@ */ -#include "../../silcdefs.h" +#include "../../cryptodefs.h" #ifdef SILC_SHA256_X86 diff --git a/lib/silccrypt/silccipher.h b/lib/silccrypt/silccipher.h index a0503c89..7011bdfd 100644 --- a/lib/silccrypt/silccipher.h +++ b/lib/silccrypt/silccipher.h @@ -4,7 +4,7 @@ Author: Pekka Riikonen - Copyright (C) 1997 - 2007 Pekka Riikonen + Copyright (C) 1997 - 2008 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 @@ -301,7 +301,7 @@ SilcBool silc_cipher_decrypt(SilcCipher cipher, const unsigned char *src, * SYNOPSIS * * SilcBool silc_cipher_set_key(SilcCipher cipher, const unsigned char *key, - * SilcUInt32 keylen, SilcBool encryption); + * SilcUInt32 bit_keylen, SilcBool encryption); * * DESCRIPTION * @@ -311,7 +311,7 @@ SilcBool silc_cipher_decrypt(SilcCipher cipher, const unsigned char *src, * ***/ SilcBool silc_cipher_set_key(SilcCipher cipher, const unsigned char *key, - SilcUInt32 keylen, SilcBool encryption); + SilcUInt32 bit_keylen, SilcBool encryption); /****f* silccrypt/SilcCipherAPI/silc_cipher_set_iv * diff --git a/lib/silccrypt/tests/Makefile.am b/lib/silccrypt/tests/Makefile.am index 838a57c3..443d1a9c 100644 --- a/lib/silccrypt/tests/Makefile.am +++ b/lib/silccrypt/tests/Makefile.am @@ -48,6 +48,6 @@ test_silcpkcs_SOURCES = test_silcpkcs.c test_dsa_SOURCES = test_dsa.c LIBS = $(SILC_COMMON_LIBS) -LDADD = -L.. -L../.. -lsilc +LDADD = -L.. -L../.. -lsct include $(top_srcdir)/Makefile.defines.in diff --git a/lib/silccrypt/tests/test_cast5.c b/lib/silccrypt/tests/test_cast5.c index af76bced..aa201b02 100644 --- a/lib/silccrypt/tests/test_cast5.c +++ b/lib/silccrypt/tests/test_cast5.c @@ -1,4 +1,4 @@ -#include "silc.h" +#include "silccrypto.h" /* First test vector, 8 bytes plaintext, 128 bits key */ const unsigned char key1[] = "\x01\x23\x45\x67\x12\x34\x56\x78\x23\x45\x67\x89\x34\x56\x78\x9a"; diff --git a/lib/silcmath/silcmath.h b/lib/silcmath/silcmath.h index c3e09b47..966cd6d9 100644 --- a/lib/silcmath/silcmath.h +++ b/lib/silcmath/silcmath.h @@ -4,7 +4,7 @@ Author: Pekka Riikonen - Copyright (C) 1997 - 2007 Pekka Riikonen + Copyright (C) 1997 - 2008 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 @@ -32,7 +32,7 @@ #include "silcrng.h" -/****f* silcmath/SilcMathAPI/silc_math_gen_prime +/****f* silcmath/silc_math_gen_prime * * SYNOPSIS * @@ -54,7 +54,7 @@ SilcBool silc_math_gen_prime(SilcMPInt *prime, SilcUInt32 bits, SilcBool verbose, SilcRng rng); -/****f* silcmath/SilcMathAPI/silc_math_prime_test +/****f* silcmath/silc_math_prime_test * * SYNOPSIS * diff --git a/lib/silcmath/silcmp.h b/lib/silcmath/silcmp.h index 662de172..fe893902 100644 --- a/lib/silcmath/silcmp.h +++ b/lib/silcmath/silcmp.h @@ -4,7 +4,7 @@ Author: Pekka Riikonen - Copyright (C) 1997 - 2007 Pekka Riikonen + Copyright (C) 1997 - 2008 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 @@ -43,7 +43,7 @@ #endif /* SILC_DIST_TFM */ #endif -/****d* silcmath/SilcMPAPI/SilcMPInt +/****d* silcmath/SilcMPInt * * NAME * @@ -60,7 +60,7 @@ typedef SILC_MP_INT SilcMPInt; /***/ -/****f* silcmath/SilcMPAPI/silc_mp_init +/****f* silcmath/silc_mp_init * * SYNOPSIS * @@ -75,7 +75,7 @@ typedef SILC_MP_INT SilcMPInt; ***/ void silc_mp_init(SilcMPInt *mp); -/****f* silcmath/SilcMPAPI/silc_mp_sinit +/****f* silcmath/silc_mp_sinit * * SYNOPSIS * @@ -92,7 +92,7 @@ void silc_mp_init(SilcMPInt *mp); ***/ SilcBool silc_mp_sinit(SilcStack stack, SilcMPInt *mp); -/****f* silcmath/SilcMPAPI/silc_mp_uninit +/****f* silcmath/silc_mp_uninit * * SYNOPSIS * @@ -105,7 +105,7 @@ SilcBool silc_mp_sinit(SilcStack stack, SilcMPInt *mp); ***/ void silc_mp_uninit(SilcMPInt *mp); -/****f* silcmath/SilcMPAPI/silc_mp_suninit +/****f* silcmath/silc_mp_suninit * * SYNOPSIS * @@ -118,7 +118,7 @@ void silc_mp_uninit(SilcMPInt *mp); ***/ void silc_mp_suninit(SilcStack stack, SilcMPInt *mp); -/****f* silcmath/SilcMPAPI/silc_mp_size +/****f* silcmath/silc_mp_size * * SYNOPSIS * @@ -131,7 +131,7 @@ void silc_mp_suninit(SilcStack stack, SilcMPInt *mp); ***/ size_t silc_mp_size(SilcMPInt *mp); -/****f* silcmath/SilcMPAPI/silc_mp_sizeinbase +/****f* silcmath/silc_mp_sizeinbase * * SYNOPSIS * @@ -153,7 +153,7 @@ size_t silc_mp_size(SilcMPInt *mp); ***/ size_t silc_mp_sizeinbase(SilcMPInt *mp, int base); -/****f* silcmath/SilcMPAPI/silc_mp_set +/****f* silcmath/silc_mp_set * * SYNOPSIS * @@ -167,7 +167,7 @@ size_t silc_mp_sizeinbase(SilcMPInt *mp, int base); ***/ void silc_mp_set(SilcMPInt *dst, SilcMPInt *src); -/****f* silcmath/SilcMPAPI/silc_mp_set_ui +/****f* silcmath/silc_mp_set_ui * * SYNOPSIS * @@ -181,7 +181,7 @@ void silc_mp_set(SilcMPInt *dst, SilcMPInt *src); ***/ void silc_mp_set_ui(SilcMPInt *dst, SilcUInt32 ui); -/****f* silcmath/SilcMPAPI/silc_mp_set_si +/****f* silcmath/silc_mp_set_si * * SYNOPSIS * @@ -195,7 +195,7 @@ void silc_mp_set_ui(SilcMPInt *dst, SilcUInt32 ui); ***/ void silc_mp_set_si(SilcMPInt *dst, SilcInt32 si); -/****f* silcmath/SilcMPAPI/silc_mp_set_str +/****f* silcmath/silc_mp_set_str * * SYNOPSIS * @@ -214,7 +214,7 @@ void silc_mp_set_si(SilcMPInt *dst, SilcInt32 si); ***/ void silc_mp_set_str(SilcMPInt *dst, const char *str, int base); -/****f* silcmath/SilcMPAPI/silc_mp_get_ui +/****f* silcmath/silc_mp_get_ui * * SYNOPSIS * @@ -227,7 +227,7 @@ void silc_mp_set_str(SilcMPInt *dst, const char *str, int base); ***/ SilcUInt32 silc_mp_get_ui(SilcMPInt *mp); -/****f* silcmath/SilcMPAPI/silc_mp_get_str +/****f* silcmath/silc_mp_get_str * * SYNOPSIS * @@ -247,7 +247,7 @@ SilcUInt32 silc_mp_get_ui(SilcMPInt *mp); ***/ char *silc_mp_get_str(char *str, SilcMPInt *mp, int base); -/****f* silcmath/SilcMPAPI/silc_mp_add +/****f* silcmath/silc_mp_add * * SYNOPSIS * @@ -260,7 +260,7 @@ char *silc_mp_get_str(char *str, SilcMPInt *mp, int base); ***/ void silc_mp_add(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2); -/****f* silcmath/SilcMPAPI/silc_mp_add_ui +/****f* silcmath/silc_mp_add_ui * * SYNOPSIS * @@ -274,7 +274,7 @@ void silc_mp_add(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2); ***/ void silc_mp_add_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui); -/****f* silcmath/SilcMPAPI/silc_mp_sub +/****f* silcmath/silc_mp_sub * * SYNOPSIS * @@ -287,7 +287,7 @@ void silc_mp_add_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui); ***/ void silc_mp_sub(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2); -/****f* silcmath/SilcMPAPI/silc_mp_sub_ui +/****f* silcmath/silc_mp_sub_ui * * SYNOPSIS * @@ -301,7 +301,7 @@ void silc_mp_sub(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2); ***/ void silc_mp_sub_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui); -/****f* silcmath/SilcMPAPI/silc_mp_mul +/****f* silcmath/silc_mp_mul * * SYNOPSIS * @@ -314,7 +314,7 @@ void silc_mp_sub_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui); ***/ void silc_mp_mul(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2); -/****f* silcmath/SilcMPAPI/silc_mp_mul_ui +/****f* silcmath/silc_mp_mul_ui * * SYNOPSIS * @@ -328,7 +328,7 @@ void silc_mp_mul(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2); ***/ void silc_mp_mul_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui); -/****f* silcmath/SilcMPAPI/silc_mp_mul_2exp +/****f* silcmath/silc_mp_mul_2exp * * SYNOPSIS * @@ -342,7 +342,7 @@ void silc_mp_mul_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui); ***/ void silc_mp_mul_2exp(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 exp); -/****f* silcmath/SilcMPAPI/silc_mp_sqrt +/****f* silcmath/silc_mp_sqrt * * SYNOPSIS * @@ -355,7 +355,7 @@ void silc_mp_mul_2exp(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 exp); ***/ void silc_mp_sqrt(SilcMPInt *dst, SilcMPInt *src); -/****f* silcmath/SilcMPAPI/silc_mp_div +/****f* silcmath/silc_mp_div * * SYNOPSIS * @@ -369,7 +369,7 @@ void silc_mp_sqrt(SilcMPInt *dst, SilcMPInt *src); ***/ void silc_mp_div(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2); -/****f* silcmath/SilcMPAPI/silc_mp_div_ui +/****f* silcmath/silc_mp_div_ui * * SYNOPSIS * @@ -383,7 +383,7 @@ void silc_mp_div(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2); ***/ void silc_mp_div_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui); -/****f* silcmath/SilcMPAPI/silc_mp_div_qr +/****f* silcmath/silc_mp_div_qr * * SYNOPSIS * @@ -401,7 +401,7 @@ void silc_mp_div_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui); void silc_mp_div_qr(SilcMPInt *q, SilcMPInt *r, SilcMPInt *mp1, SilcMPInt *mp2); -/****f* silcmath/SilcMPAPI/silc_mp_div_2exp +/****f* silcmath/silc_mp_div_2exp * * SYNOPSIS * @@ -415,7 +415,7 @@ void silc_mp_div_qr(SilcMPInt *q, SilcMPInt *r, SilcMPInt *mp1, ***/ void silc_mp_div_2exp(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 exp); -/****f* silcmath/SilcMPAPI/silc_mp_div_2exp_qr +/****f* silcmath/silc_mp_div_2exp_qr * * SYNOPSIS * @@ -433,7 +433,7 @@ void silc_mp_div_2exp(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 exp); void silc_mp_div_2exp_qr(SilcMPInt *q, SilcMPInt *r, SilcMPInt *mp1, SilcUInt32 exp); -/****f* silcmath/SilcMPAPI/silc_mp_mod +/****f* silcmath/silc_mp_mod * * SYNOPSIS * @@ -449,7 +449,7 @@ void silc_mp_div_2exp_qr(SilcMPInt *q, SilcMPInt *r, SilcMPInt *mp1, ***/ void silc_mp_mod(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2); -/****f* silcmath/SilcMPAPI/silc_mp_mod_ui +/****f* silcmath/silc_mp_mod_ui * * SYNOPSIS * @@ -464,7 +464,7 @@ void silc_mp_mod(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2); ***/ void silc_mp_mod_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui); -/****f* silcmath/SilcMPAPI/silc_mp_mod_2exp +/****f* silcmath/silc_mp_mod_2exp * * SYNOPSIS * @@ -480,7 +480,7 @@ void silc_mp_mod_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui); ***/ void silc_mp_mod_2exp(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui); -/****f* silcmath/SilcMPAPI/silc_mp_pow +/****f* silcmath/silc_mp_pow * * SYNOPSIS * @@ -494,7 +494,7 @@ void silc_mp_mod_2exp(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 ui); ***/ void silc_mp_pow(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *exp); -/****f* silcmath/SilcMPAPI/silc_mp_pow_ui +/****f* silcmath/silc_mp_pow_ui * * SYNOPSIS * @@ -508,7 +508,7 @@ void silc_mp_pow(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *exp); ***/ void silc_mp_pow_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 exp); -/****f* silcmath/SilcMPAPI/silc_mp_pow_mod +/****f* silcmath/silc_mp_pow_mod * * SYNOPSIS * @@ -524,7 +524,7 @@ void silc_mp_pow_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 exp); void silc_mp_pow_mod(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *exp, SilcMPInt *mod); -/****f* silcmath/SilcMPAPI/silc_mp_pow_mod_ui +/****f* silcmath/silc_mp_pow_mod_ui * * SYNOPSIS * @@ -540,7 +540,7 @@ void silc_mp_pow_mod(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *exp, void silc_mp_pow_mod_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 exp, SilcMPInt *mod); -/****f* silcmath/SilcMPAPI/silc_mp_modinv +/****f* silcmath/silc_mp_modinv * * SYNOPSIS * @@ -568,7 +568,7 @@ void silc_mp_pow_mod_ui(SilcMPInt *dst, SilcMPInt *mp1, SilcUInt32 exp, ***/ void silc_mp_modinv(SilcMPInt *inv, SilcMPInt *a, SilcMPInt *n); -/****f* silcmath/SilcMPAPI/silc_mp_gcd +/****f* silcmath/silc_mp_gcd * * SYNOPSIS * @@ -582,7 +582,7 @@ void silc_mp_modinv(SilcMPInt *inv, SilcMPInt *a, SilcMPInt *n); ***/ void silc_mp_gcd(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2); -/****f* silcmath/SilcMPAPI/silc_mp_gcdext +/****f* silcmath/silc_mp_gcdext * * SYNOPSIS * @@ -598,7 +598,7 @@ void silc_mp_gcd(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2); void silc_mp_gcdext(SilcMPInt *g, SilcMPInt *s, SilcMPInt *t, SilcMPInt *mp1, SilcMPInt *mp2); -/****f* silcmath/SilcMPAPI/silc_mp_cmp +/****f* silcmath/silc_mp_cmp * * SYNOPSIS * @@ -612,7 +612,7 @@ void silc_mp_gcdext(SilcMPInt *g, SilcMPInt *s, SilcMPInt *t, SilcMPInt *mp1, ***/ int silc_mp_cmp(SilcMPInt *mp1, SilcMPInt *mp2); -/****f* silcmath/SilcMPAPI/silc_mp_cmp_si +/****f* silcmath/silc_mp_cmp_si * * SYNOPSIS * @@ -626,7 +626,7 @@ int silc_mp_cmp(SilcMPInt *mp1, SilcMPInt *mp2); ***/ int silc_mp_cmp_si(SilcMPInt *mp1, SilcInt32 si); -/****f* silcmath/SilcMPAPI/silc_mp_cmp_ui +/****f* silcmath/silc_mp_cmp_ui * * SYNOPSIS * @@ -641,7 +641,7 @@ int silc_mp_cmp_si(SilcMPInt *mp1, SilcInt32 si); ***/ int silc_mp_cmp_ui(SilcMPInt *mp1, SilcUInt32 ui); -/****f* silcmath/SilcMPAPI/silc_mp_mp2bin +/****f* silcmath/silc_mp_mp2bin * * SYNOPSIS * @@ -658,7 +658,7 @@ int silc_mp_cmp_ui(SilcMPInt *mp1, SilcUInt32 ui); unsigned char *silc_mp_mp2bin(SilcMPInt *val, SilcUInt32 len, SilcUInt32 *ret_len); -/****f* silcmath/SilcMPAPI/silc_mp_mp2bin_noalloc +/****f* silcmath/silc_mp_mp2bin_noalloc * * SYNOPSIS * @@ -674,7 +674,7 @@ unsigned char *silc_mp_mp2bin(SilcMPInt *val, SilcUInt32 len, void silc_mp_mp2bin_noalloc(SilcMPInt *val, unsigned char *dst, SilcUInt32 dst_len); -/****f* silcmath/SilcMPAPI/silc_mp_bin2mp +/****f* silcmath/silc_mp_bin2mp * * SYNOPSIS * @@ -689,7 +689,7 @@ void silc_mp_mp2bin_noalloc(SilcMPInt *val, unsigned char *dst, ***/ void silc_mp_bin2mp(unsigned char *data, SilcUInt32 len, SilcMPInt *ret); -/****f* silcmath/SilcMPAPI/silc_mp_abs +/****f* silcmath/silc_mp_abs * * SYNOPSIS * @@ -702,7 +702,7 @@ void silc_mp_bin2mp(unsigned char *data, SilcUInt32 len, SilcMPInt *ret); ***/ void silc_mp_abs(SilcMPInt *dst, SilcMPInt *src); -/****f* silcmath/SilcMPAPI/silc_mp_neg +/****f* silcmath/silc_mp_neg * * SYNOPSIS * @@ -715,7 +715,7 @@ void silc_mp_abs(SilcMPInt *dst, SilcMPInt *src); ***/ void silc_mp_neg(SilcMPInt *dst, SilcMPInt *src); -/****f* silcmath/SilcMPAPI/silc_mp_and +/****f* silcmath/silc_mp_and * * SYNOPSIS * @@ -728,7 +728,7 @@ void silc_mp_neg(SilcMPInt *dst, SilcMPInt *src); ***/ void silc_mp_and(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2); -/****f* silcmath/SilcMPAPI/silc_mp_or +/****f* silcmath/silc_mp_or * * SYNOPSIS * @@ -741,7 +741,7 @@ void silc_mp_and(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2); ***/ void silc_mp_or(SilcMPInt *dst, SilcMPInt *mp1, SilcMPInt *mp2); -/****f* silcmath/SilcMPAPI/silc_mp_xor +/****f* silcmath/silc_mp_xor * * SYNOPSIS * diff --git a/lib/silcssh/silcssh.c b/lib/silcssh/silcssh.c index 6252929c..927489c3 100644 --- a/lib/silcssh/silcssh.c +++ b/lib/silcssh/silcssh.c @@ -284,7 +284,7 @@ int silc_ssh_public_key_decode(unsigned char *key, SilcUInt32 key_len, SILC_STR_ADVANCE, SILC_STR_UI32_STRING_ALLOC(&type), SILC_STR_END) < 0) { - SILC_LOG_ERROR(("Malformed SSH2 public key")); + SILC_LOG_DEBUG(("Malformed SSH2 public key")); goto err; } diff --git a/lib/silcssh/silcssh.h b/lib/silcssh/silcssh.h index 6c52bc7a..f07b7cb1 100644 --- a/lib/silcssh/silcssh.h +++ b/lib/silcssh/silcssh.h @@ -4,7 +4,7 @@ Author: Pekka Riikonen - Copyright (C) 2007 Pekka Riikonen + Copyright (C) 2007 - 2008 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 @@ -31,7 +31,8 @@ * signatures and verification. Both RSA and DSS SSH2 keys are supported. * The library supports the standard SSH2 public key file format defined * in RFC 4716 and the OpenSSH public key file format. The private key file - * format support includes OpenSSH private key files. + * format support includes OpenSSH private key files. The signature format + * is compliant with the SSH2 protocol. * * EXAMPLE * @@ -69,7 +70,7 @@ #ifndef SILCSSH_H #define SILCSSH_H -/****d* silcssh/SilcSshAPI/SilcSshKeyType +/****d* silcssh/SilcSshKeyType * * NAME * @@ -87,7 +88,7 @@ typedef enum { SILC_SSH_KEY_SSH2 = 2, /* SSH2 public key, RFC 4716 */ } SilcSshKeyType; -/****s* silcssh/SilcSshAPI/SilcSshPublicKey +/****s* silcssh/SilcSshPublicKey * * NAME * @@ -109,7 +110,7 @@ typedef struct SilcSshPublicKeyStruct { } *SilcSshPublicKey; /***/ -/****s* silcssh/SilcSshAPI/SilcSshPrivateKey +/****s* silcssh/SilcSshPrivateKey * * NAME * @@ -131,7 +132,7 @@ typedef struct SilcSshPrivateKeyStruct { } *SilcSshPrivateKey; /***/ -/****f* silcssh/SilcSshAPI/silc_ssh_generate_key +/****f* silcssh/silc_ssh_generate_key * * SYNOPSIS * @@ -160,7 +161,7 @@ SilcBool silc_ssh_generate_key(const char *algorithm, SilcPublicKey *ret_public_key, SilcPrivateKey *ret_private_key); -/****f* silcssh/SilcSshAPI/silc_ssh_public_key_decode +/****f* silcssh/silc_ssh_public_key_decode * * SYNOPSIS * @@ -184,7 +185,7 @@ SilcBool silc_ssh_generate_key(const char *algorithm, int silc_ssh_public_key_decode(unsigned char *key, SilcUInt32 key_len, SilcSshPublicKey *ret_public_key); -/****f* silcssh/SilcSshAPI/silc_ssh_public_key_encode +/****f* silcssh/silc_ssh_public_key_encode * * SYNOPSIS * @@ -208,7 +209,7 @@ unsigned char *silc_ssh_public_key_encode(SilcStack stack, SilcSshPublicKey public_key, SilcUInt32 *ret_key_len); -/****f* silcssh/SilcSshAPI/silc_ssh_public_key_free +/****f* silcssh/silc_ssh_public_key_free * * SYNOPSIS * @@ -223,7 +224,7 @@ unsigned char *silc_ssh_public_key_encode(SilcStack stack, ***/ void silc_ssh_public_key_free(SilcSshPublicKey public_key); -/****f* silcssh/SilcSshAPI/silc_ssh_public_key_get_field +/****f* silcssh/silc_ssh_public_key_get_field * * SYNOPSIS * @@ -244,7 +245,7 @@ void silc_ssh_public_key_free(SilcSshPublicKey public_key); const char *silc_ssh_public_key_get_field(SilcSshPublicKey public_key, const char *field); -/****f* silcssh/SilcSshAPI/silc_ssh_public_key_add_field +/****f* silcssh/silc_ssh_public_key_add_field * * SYNOPSIS * @@ -262,7 +263,7 @@ SilcBool silc_ssh_public_key_add_field(SilcSshPublicKey public_key, const char *field, const char *value); -/****f* silcssh/SilcSshAPI/silc_ssh_public_key_set_type +/****f* silcssh/silc_ssh_public_key_set_type * * SYNOPSIS * -- 2.24.0