ROBODoc documented the SILC Hash Interface and improved
[silc.git] / apps / silcd / protocol.c
index 6aa3ac93b54cb432493347297b4c5d26aab35340..75eb86ed70906707402d6143279145f87e9b5082 100644 (file)
@@ -291,13 +291,14 @@ int silc_server_protocol_ke_set_keys(SilcServer server,
   idata->rekey->ske_group = silc_ske_group_get_number(group);
 
   /* Save the hash */
-  if (!silc_hash_alloc(hash->hash->name, &idata->hash)) {
+  if (!silc_hash_alloc(silc_hash_get_name(hash), &idata->hash)) {
     silc_cipher_free(idata->send_key);
     silc_cipher_free(idata->receive_key);
     silc_hmac_free(idata->hmac_send);
     silc_hmac_free(idata->hmac_receive);
     silc_free(conn_data);
-    SILC_LOG_ERROR(("Cannot allocate algorithm: %s", hash->hash->name));
+    SILC_LOG_ERROR(("Cannot allocate algorithm: %s", 
+                   silc_hash_get_name(hash)));
     return FALSE;
   }
 
@@ -314,7 +315,7 @@ int silc_server_protocol_ke_set_keys(SilcServer server,
                 sock->hostname, sock->ip,
                 idata->send_key->cipher->name,
                 (char *)silc_hmac_get_name(idata->hmac_send),
-                idata->hash->hash->name, 
+                silc_hash_get_name(idata->hash),
                 ske->prop->flags & SILC_SKE_SP_FLAG_PFS ? "PFS" : ""));
 
   return TRUE;
@@ -590,7 +591,7 @@ SILC_TASK_CALLBACK(silc_server_protocol_key_exchange)
        */
       SilcSKEKeyMaterial *keymat;
       int key_len = silc_cipher_get_key_len(ctx->ske->prop->cipher);
-      int hash_len = ctx->ske->prop->hash->hash->hash_len;
+      int hash_len = silc_hash_len(ctx->ske->prop->hash);
 
       /* Process the key material */
       keymat = silc_calloc(1, sizeof(*keymat));
@@ -1236,7 +1237,7 @@ void silc_server_protocol_rekey_generate(SilcServer server,
   SilcIDListData idata = (SilcIDListData)ctx->sock->user_data;
   SilcSKEKeyMaterial *keymat;
   SilcUInt32 key_len = silc_cipher_get_key_len(idata->send_key);
-  SilcUInt32 hash_len = idata->hash->hash->hash_len;
+  SilcUInt32 hash_len = silc_hash_len(idata->hash);
 
   SILC_LOG_DEBUG(("Generating new %s session keys (no PFS)",
                  send ? "sending" : "receiving"));
@@ -1265,7 +1266,7 @@ silc_server_protocol_rekey_generate_pfs(SilcServer server,
   SilcIDListData idata = (SilcIDListData)ctx->sock->user_data;
   SilcSKEKeyMaterial *keymat;
   SilcUInt32 key_len = silc_cipher_get_key_len(idata->send_key);
-  SilcUInt32 hash_len = idata->hash->hash->hash_len;
+  SilcUInt32 hash_len = silc_hash_len(idata->hash);
   unsigned char *tmpbuf;
   SilcUInt32 klen;