From fcc426a825910c180fa84cd8ce074e727c284192 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Sun, 10 Feb 2002 16:42:10 +0000 Subject: [PATCH] updates. --- apps/irssi/src/silc/core/silc-core.c | 66 +++++++++++++++------------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/apps/irssi/src/silc/core/silc-core.c b/apps/irssi/src/silc/core/silc-core.c index 6bbf3a6e..a9c4137e 100644 --- a/apps/irssi/src/silc/core/silc-core.c +++ b/apps/irssi/src/silc/core/silc-core.c @@ -177,16 +177,18 @@ static void silc_nickname_format_parse(const char *nickname, static void silc_register_cipher(SilcClient client, const char *cipher) { int i; - - for (i = 0; silc_default_ciphers[i].name; i++) - if (!strcmp(silc_default_ciphers[i].name, cipher)) { - silc_cipher_register(&silc_default_ciphers[i]); - break; - } - if (!silc_cipher_is_supported(cipher)) { - SILC_LOG_ERROR(("Unknown cipher `%s'", cipher)); - exit(1); + if (cipher) { + for (i = 0; silc_default_ciphers[i].name; i++) + if (!strcmp(silc_default_ciphers[i].name, cipher)) { + silc_cipher_register(&silc_default_ciphers[i]); + break; + } + + if (!silc_cipher_is_supported(cipher)) { + SILC_LOG_ERROR(("Unknown cipher `%s'", cipher)); + exit(1); + } } /* Register other defaults */ @@ -196,16 +198,18 @@ static void silc_register_cipher(SilcClient client, const char *cipher) static void silc_register_hash(SilcClient client, const char *hash) { int i; - - for (i = 0; silc_default_hash[i].name; i++) - if (!strcmp(silc_default_hash[i].name, hash)) { - silc_hash_register(&silc_default_hash[i]); - break; + + if (hash) { + for (i = 0; silc_default_hash[i].name; i++) + if (!strcmp(silc_default_hash[i].name, hash)) { + silc_hash_register(&silc_default_hash[i]); + break; + } + + if (!silc_hash_is_supported(hash)) { + SILC_LOG_ERROR(("Unknown hash function `%s'", hash)); + exit(1); } - - if (!silc_hash_is_supported(hash)) { - SILC_LOG_ERROR(("Unknown hash function `%s'", hash)); - exit(1); } /* Register other defaults */ @@ -215,16 +219,18 @@ static void silc_register_hash(SilcClient client, const char *hash) static void silc_register_hmac(SilcClient client, const char *hmac) { int i; - - for (i = 0; silc_default_hmacs[i].name; i++) - if (!strcmp(silc_default_hmacs[i].name, hmac)) { - silc_hmac_register(&silc_default_hmacs[i]); - break; + + if (hmac) { + for (i = 0; silc_default_hmacs[i].name; i++) + if (!strcmp(silc_default_hmacs[i].name, hmac)) { + silc_hmac_register(&silc_default_hmacs[i]); + break; + } + + if (!silc_hmac_is_supported(hmac)) { + SILC_LOG_ERROR(("Unknown HMAC `%s'", hmac)); + exit(1); } - - if (!silc_hmac_is_supported(hmac)) { - SILC_LOG_ERROR(("Unknown HMAC `%s'", hmac)); - exit(1); } /* Register other defaults */ @@ -329,9 +335,9 @@ void silc_core_init_finish(SERVER_REC *server) silc_client = silc_client_alloc(&ops, ¶ms, NULL, silc_version_string); /* Crypto settings */ - settings_add_str("server", "crypto_default_cipher", "aes-256-cbc"); - settings_add_str("server", "crypto_default_hash", "sha1"); - settings_add_str("server", "crypto_default_hmac", "hmac-sha1-96"); + settings_add_str("server", "crypto_default_cipher", SILC_DEFAULT_CIPHER); + settings_add_str("server", "crypto_default_hash", SILC_DEFAULT_HASH); + settings_add_str("server", "crypto_default_hmac", SILC_DEFAULT_HMAC); /* Get the ciphers and stuff from config file */ def_cipher = settings_get_str("crypto_default_cipher"); -- 2.24.0