Added Parameter dont_register_crypto_library to
authorPatrik Weiskircher <pat@silcnet.org>
Sun, 27 Mar 2005 17:12:31 +0000 (17:12 +0000)
committerPatrik Weiskircher <pat@silcnet.org>
Sun, 27 Mar 2005 17:12:31 +0000 (17:12 +0000)
SilcClientParam. If set to TRUE, silcclient library will
not initalize the Crypto Libraries and application
will need to do it.

CHANGES
lib/silcclient/client.c
lib/silcclient/silcclient.h

diff --git a/CHANGES b/CHANGES
index 114813a906df587d34b7ee9d1298f1997b186dd0..bee7872ac9a4c0671ca82f801f4ee86f97f5e4f4 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,11 @@
+Sun Mar 27 19:03:31 CEST 2005  Patrik Weiskircher <pat@icore.at>
+
+       * 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 <priikone@silcnet.org>
 
        * Imported new silc_utf8_[encode|decode] routines from
index ef4e7e0517873371a4b31be243f3ff09ddd82204..9dfeaf2cc6595e342b54575548250e40ce2c19b8 100644 (file)
@@ -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);
index cc80e8f656bef22f1566e5eb1d2395485daab5a3..edcf29061a852ecac8ac0c12b2abcc117d37c5df 100644 (file)
@@ -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;
 /***/