From: Pekka Riikonen Date: Fri, 13 Jul 2007 20:06:16 +0000 (+0000) Subject: Check if key is already accelerated. X-Git-Tag: 1.2.beta1~181 X-Git-Url: http://git.silcnet.org/gitweb/?p=crypto.git;a=commitdiff_plain;h=92e8953b0ea2f6b320d9939ee895dba25696dcc3 Check if key is already accelerated. --- diff --git a/lib/silcacc/silcacc_pkcs.c b/lib/silcacc/silcacc_pkcs.c index c7920a29..03395afc 100644 --- a/lib/silcacc/silcacc_pkcs.c +++ b/lib/silcacc/silcacc_pkcs.c @@ -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)