Changed the version string variables to #defines.
[silc.git] / apps / silcd / protocol.c
index 06922c364641772e407a40a789f9266e8789e940..c033ff743e715fad0079c15d92d816b678a68ae2 100644 (file)
@@ -29,8 +29,6 @@ SILC_TASK_CALLBACK(silc_server_protocol_connection_auth);
 SILC_TASK_CALLBACK(silc_server_protocol_key_exchange);
 SILC_TASK_CALLBACK(silc_server_protocol_rekey);
 
-extern char *silc_version_string;
-
 /*
  * Key Exhange protocol functions
  */
@@ -219,6 +217,7 @@ int silc_server_protocol_ke_set_keys(SilcServer server,
 {
   SilcUnknownEntry conn_data;
   SilcIDListData idata;
+  const char *cname = silc_cipher_get_name(cipher);
 
   SILC_LOG_DEBUG(("Setting new keys into use"));
 
@@ -226,14 +225,14 @@ int silc_server_protocol_ke_set_keys(SilcServer server,
   idata = (SilcIDListData)conn_data;
 
   /* Allocate cipher to be used in the communication */
-  if (!silc_cipher_alloc(cipher->cipher->name, &idata->send_key)) {
+  if (!silc_cipher_alloc((char *)cname, &idata->send_key)) {
     silc_free(conn_data);
-    SILC_LOG_ERROR(("Cannot allocate algorithm: %s", cipher->cipher->name));
+    SILC_LOG_ERROR(("Cannot allocate algorithm: %s", cname));
     return FALSE;
   }
-  if (!silc_cipher_alloc(cipher->cipher->name, &idata->receive_key)) {
+  if (!silc_cipher_alloc((char *)cname, &idata->receive_key)) {
     silc_free(conn_data);
-    SILC_LOG_ERROR(("Cannot allocate algorithm: %s", cipher->cipher->name));
+    SILC_LOG_ERROR(("Cannot allocate algorithm: %s", cname));
     return FALSE;
   }
   
@@ -314,7 +313,7 @@ int silc_server_protocol_ke_set_keys(SilcServer server,
 
   SILC_LOG_INFO(("%s (%s) security properties: %s %s %s %s", 
                 sock->hostname, sock->ip,
-                idata->send_key->cipher->name,
+                silc_cipher_get_name(idata->send_key),
                 (char *)silc_hmac_get_name(idata->hmac_send),
                 silc_hash_get_name(idata->hash),
                 ske->prop->flags & SILC_SKE_SP_FLAG_PFS ? "PFS" : ""));
@@ -781,7 +780,8 @@ silc_server_get_public_key_auth(SilcServer server,
                                          ske->start_payload_copy->len),
                     SILC_STR_END);
 
-  *auth_data = silc_calloc(silc_pkcs_get_key_len(pkcs), sizeof(**auth_data));
+  *auth_data = silc_calloc((silc_pkcs_get_key_len(pkcs) / 8) + 1,
+                          sizeof(**auth_data));
   if (silc_pkcs_sign_with_hash(pkcs, ske->prop->hash, auth->data, 
                               auth->len, *auth_data, auth_data_len)) {
     silc_buffer_free(auth);