Merge commit 'origin/silc.1.1.branch'
[silc.git] / lib / silcske / silcconnauth.c
index 3d50902df831a53c2ff527c53d4cf9d22098a0e0..d44e9faf35d7354fdb4632267f405ddd16cd2d4b 100644 (file)
@@ -146,9 +146,9 @@ silc_connauth_get_signature(SilcConnAuth connauth)
                     SILC_STR_END);
 
   /* Compute signature */
-  op = silc_pkcs_sign(private_key, auth->data, silc_buffer_len(auth),
-                     TRUE, ske->prop->hash,
-                     silc_connauth_get_signature_cb, connauth);
+  op = silc_pkcs_sign_async(private_key, auth->data, silc_buffer_len(auth),
+                           TRUE, ske->prop->hash, ske->rng,
+                           silc_connauth_get_signature_cb, connauth);
 
   silc_buffer_free(auth);
 
@@ -172,6 +172,7 @@ static void silc_connauth_verify_signature_cb(SilcBool success,
     return;
   }
 
+  SILC_LOG_DEBUG(("Signature is Ok"));
   SILC_FSM_CALL_CONTINUE(connauth->fsm);
 }
 
@@ -209,9 +210,9 @@ silc_connauth_verify_signature(SilcConnAuth connauth,
                     SILC_STR_END);
 
   /* Verify signature */
-  op = silc_pkcs_verify(pub_key, sign, sign_len, auth->data,
-                       silc_buffer_len(auth), ske->prop->hash,
-                       silc_connauth_verify_signature_cb, connauth);
+  op = silc_pkcs_verify_async(pub_key, sign, sign_len, auth->data,
+                             silc_buffer_len(auth), TRUE, ske->prop->hash,
+                             silc_connauth_verify_signature_cb, connauth);
 
   silc_buffer_free(auth);
 
@@ -646,14 +647,15 @@ SILC_FSM_STATE(silc_connauth_st_responder_authenticate)
     /* Allocate search constraints for finding the key */
     find = silc_skr_find_alloc();
 
-    if (!find || !connauth->auth_data) {
+    if (!find || !connauth->auth_data || !connauth->ske->prop->public_key) {
       /** Out of memory */
       silc_fsm_next(fsm, silc_connauth_st_responder_failure);
       return SILC_FSM_CONTINUE;
     }
 
-    silc_skr_find_set_pkcs_type(find, connauth->ske->pk_type);
-    silc_skr_find_set_public_key(find, connauth->ske->public_key);
+    silc_skr_find_set_pkcs_type(
+                 find, silc_pkcs_get_type(connauth->ske->prop->public_key));
+    silc_skr_find_set_public_key(find, connauth->ske->prop->public_key);
     silc_skr_find_set_usage(find, (SILC_SKR_USAGE_AUTH |
                                   SILC_SKR_USAGE_KEY_AGREEMENT));
 
@@ -702,6 +704,8 @@ SILC_FSM_STATE(silc_connauth_st_responder_authenticate_pk)
                                               connauth->auth_data,
                                               connauth->auth_data_len));
   /* NOT REACHED */
+
+  SILC_LOG_DEBUG(("Signature is Ok"));
 }
 
 SILC_FSM_STATE(silc_connauth_st_responder_success)