From: Patrik Weiskircher Date: Sun, 27 Mar 2005 17:12:31 +0000 (+0000) Subject: Added Parameter dont_register_crypto_library to X-Git-Tag: silc.server.0.9.19~39 X-Git-Url: http://git.silcnet.org/gitweb/?a=commitdiff_plain;h=4c4192317b1ce2f117e0e5241d280a608ad3f48c;p=silc.git Added Parameter dont_register_crypto_library to SilcClientParam. If set to TRUE, silcclient library will not initalize the Crypto Libraries and application will need to do it. --- diff --git a/CHANGES b/CHANGES index 114813a9..bee7872a 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,11 @@ +Sun Mar 27 19:03:31 CEST 2005 Patrik Weiskircher + + * Added Parameter dont_register_crypto_library to + SilcClientParam. If set to TRUE, silcclient library will + not initalize the Crypto Libraries and application + will need to do it. Affected file lib/silcclient/silcclient.h, + lib/silcclient/client.c. + Sun Mar 27 19:02:48 EEST 2005 Pekka Riikonen * Imported new silc_utf8_[encode|decode] routines from diff --git a/lib/silcclient/client.c b/lib/silcclient/client.c index ef4e7e05..9dfeaf2c 100644 --- a/lib/silcclient/client.c +++ b/lib/silcclient/client.c @@ -87,11 +87,13 @@ void silc_client_free(SilcClient client) if (client) { if (client->rng) silc_rng_free(client->rng); - - silc_cipher_unregister_all(); - silc_pkcs_unregister_all(); - silc_hash_unregister_all(); - silc_hmac_unregister_all(); + + if (!client->internal->params->dont_register_crypto_library) { + silc_cipher_unregister_all(); + silc_pkcs_unregister_all(); + silc_hash_unregister_all(); + silc_hmac_unregister_all(); + } silc_hash_free(client->md5hash); silc_hash_free(client->sha1hash); @@ -118,13 +120,15 @@ bool silc_client_init(SilcClient client) assert(client->hostname); assert(client->realname); - /* Initialize the crypto library. If application has done this already - this has no effect. Also, we will not be overriding something - application might have registered earlier. */ - silc_cipher_register_default(); - silc_pkcs_register_default(); - silc_hash_register_default(); - silc_hmac_register_default(); + if (!client->internal->params->dont_register_crypto_library) { + /* Initialize the crypto library. If application has done this already + this has no effect. Also, we will not be overriding something + application might have registered earlier. */ + silc_cipher_register_default(); + silc_pkcs_register_default(); + silc_hash_register_default(); + silc_hmac_register_default(); + } /* Initialize hash functions for client to use */ silc_hash_alloc("md5", &client->md5hash); diff --git a/lib/silcclient/silcclient.h b/lib/silcclient/silcclient.h index cc80e8f6..edcf2906 100644 --- a/lib/silcclient/silcclient.h +++ b/lib/silcclient/silcclient.h @@ -850,6 +850,11 @@ typedef struct { not want to use them set this to TRUE. See SilcAttribute and silc_client_attribute_add for more information on attributes. */ bool ignore_requested_attributes; + + /* If this is set to TRUE, the silcclient library will not register and + deregister the cipher, pkcs, hash and hmac algorithms. The application + itself will need to handle that. */ + bool dont_register_crypto_library; } SilcClientParams; /***/