Created SILC Crypto Toolkit git repository.
[crypto.git] / lib / silcskr / silcskr.c
index a339661230fc2dbf6e0a678508b4995cfeb36cae..1923da2508a1b11bfe7d8cca034d5ca8d0b7ac3e 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 2005 - 2007 Pekka Riikonen
+  Copyright (C) 2005 - 2008 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@
 
 */
 
-#include "silc.h"
+#include "silccrypto.h"
 #include "silcskr.h"
 
 /************************** Types and definitions ***************************/
@@ -168,7 +168,7 @@ static SilcUInt32 silc_skr_hash(void *key, void *user_context)
     break;
   }
 
-  return type->type + silc_hash_string(type->data, user_context);
+  return type->type + silc_hash_string_case(type->data, user_context);
 }
 
 /* Hash table comparison function for key entries */
@@ -375,7 +375,7 @@ static SilcSKRStatus silc_skr_add_silc(SilcSKR skr,
 #endif /* SILC_DEBUG */
 
   /* Get the SILC public key */
-  silc_pubkey = silc_pkcs_get_context(SILC_PKCS_SILC, public_key);
+  silc_pubkey = silc_pkcs_public_key_get_pkcs(SILC_PKCS_SILC, public_key);
   ident = &silc_pubkey->identifier;
 
   SILC_LOG_DEBUG(("Adding SILC public key %p [%s], context %p",
@@ -492,6 +492,9 @@ static SilcSKRStatus silc_skr_add_silc_simple(SilcSKR skr,
 {
   SilcSKRKeyInternal key;
   SilcSKRStatus status = SILC_SKR_ERROR;
+#if defined(SILC_DEBUG)
+  char tmp[256];
+#endif /* SILC_DEBUG */
 
   SILC_LOG_DEBUG(("Adding SILC public key"));
 
@@ -516,6 +519,12 @@ static SilcSKRStatus silc_skr_add_silc_simple(SilcSKR skr,
   key->key.key = public_key;
   key->key.key_context = key_context;
 
+#if defined(SILC_DEBUG)
+  silc_skr_type_string(SILC_SKR_FIND_USAGE, SILC_32_TO_PTR(usage),
+                      tmp, sizeof(tmp) - 1);
+  SILC_LOG_DEBUG(("Search cons %s", tmp));
+#endif /* SILC_DEBUG */
+
   /* Add key specifics */
 
   if (!silc_skr_add_entry(skr, SILC_SKR_FIND_PUBLIC_KEY,
@@ -555,7 +564,7 @@ static SilcSKRStatus silc_skr_del_silc_public_key(SilcSKR skr,
   SilcDList entry;
 
   /* Get the SILC public key */
-  silc_pubkey = silc_pkcs_get_context(SILC_PKCS_SILC, public_key);
+  silc_pubkey = silc_pkcs_public_key_get_pkcs(SILC_PKCS_SILC, public_key);
   ident = &silc_pubkey->identifier;
 
   SILC_LOG_DEBUG(("Deleting SILC public key [%s]", ident->username));