- } else {
-#ifdef SILC_SIM
- /* Load (try at least) the crypto SIM module */
- char buf[1023], *alg_name;
- SilcCipherObject cipher_obj;
- SilcSim sim;
-
- memset(&cipher_obj, 0, sizeof(cipher_obj));
- cipher_obj.name = cipher->name;
- cipher_obj.block_len = cipher->block_length;
- cipher_obj.key_len = cipher->key_length * 8;
-
- /* build the libname */
- snprintf(buf, sizeof(buf), "%s/%s", config->module_path,
- cipher->module);
- sim = silc_sim_alloc(SILC_SIM_CIPHER, buf, 0);
-
- alg_name = strdup(cipher->name);
- if (strchr(alg_name, '-'))
- *strchr(alg_name, '-') = '\0';
-
- if (silc_sim_load(sim)) {
- cipher_obj.set_key =
- silc_sim_getsym(sim, silc_sim_symname(alg_name,
- SILC_CIPHER_SIM_SET_KEY));
- SILC_LOG_DEBUG(("set_key=%p", cipher_obj.set_key));
- cipher_obj.set_key_with_string =
- silc_sim_getsym(sim,
- silc_sim_symname(alg_name,
- SILC_CIPHER_SIM_SET_KEY_WITH_STRING));
- SILC_LOG_DEBUG(("set_key_with_string=%p",
- cipher_obj.set_key_with_string));
- cipher_obj.encrypt =
- silc_sim_getsym(sim, silc_sim_symname(alg_name,
- SILC_CIPHER_SIM_ENCRYPT_CBC));
- SILC_LOG_DEBUG(("encrypt_cbc=%p", cipher_obj.encrypt));
- cipher_obj.decrypt =
- silc_sim_getsym(sim, silc_sim_symname(alg_name,
- SILC_CIPHER_SIM_DECRYPT_CBC));
- SILC_LOG_DEBUG(("decrypt_cbc=%p", cipher_obj.decrypt));
- cipher_obj.context_len =
- silc_sim_getsym(sim, silc_sim_symname(alg_name,
- SILC_CIPHER_SIM_CONTEXT_LEN));
- SILC_LOG_DEBUG(("context_len=%p", cipher_obj.context_len));
-
- /* Put the SIM to the list of all SIM's in server */
- silc_dlist_add(server->sim, sim);
-
- silc_free(alg_name);
- } else {
- SILC_LOG_ERROR(("Error configuring ciphers"));
- silc_server_stop(server);
- exit(1);
- }
-
- /* Register the cipher */
- silc_cipher_register(&cipher_obj);
-#else
- SILC_LOG_ERROR(("Dynamic module support not compiled, "
- "can't load modules!"));
- silc_server_stop(server);
- exit(1);
-#endif