Check if key is already accelerated.
authorPekka Riikonen <priikone@silcnet.org>
Fri, 13 Jul 2007 20:06:16 +0000 (20:06 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Fri, 13 Jul 2007 20:06:16 +0000 (20:06 +0000)
lib/silcacc/silcacc_pkcs.c

index c7920a29e3745668735369a964b85307c4d15d02..03395afcca64d4c69498a50d8852347b4465c490 100644 (file)
@@ -280,6 +280,11 @@ SilcPublicKey silc_acc_public_key(SilcAccelerator acc,
     return NULL;
   }
 
+  if (silc_acc_get_public_key(NULL, public_key)) {
+    SILC_LOG_DEBUG(("Pubilc key %p is already accelerated", public_key));
+    return NULL;
+  }
+
   /* Check that accelerator supports this public key algorithm */
   alg = silc_pkcs_get_algorithm(public_key);
   if (!alg)
@@ -363,6 +368,11 @@ SilcPrivateKey silc_acc_private_key(SilcAccelerator acc,
     return NULL;
   }
 
+  if (silc_acc_get_private_key(NULL, private_key)) {
+    SILC_LOG_DEBUG(("Private key %p is already accelerated", private_key));
+    return NULL;
+  }
+
   /* Check that accelerator supports this private key algorithm */
   alg = silc_pkcs_get_algorithm(private_key);
   if (!alg)