From 92e8953b0ea2f6b320d9939ee895dba25696dcc3 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Fri, 13 Jul 2007 20:06:16 +0000 Subject: [PATCH] Check if key is already accelerated. --- lib/silcacc/silcacc_pkcs.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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) -- 2.24.0