From: Marcel Poul Date: Tue, 31 Jan 2012 12:50:59 +0000 (+0000) Subject: add references instead of duplicate key X-Git-Tag: glite-jobid-api-c_R_2_1_0_2~22 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=ea0aa42dadcad04e23a62036abc4f156b4f3c2dd;p=jra1mw.git add references instead of duplicate key --- diff --git a/emi.canl.canl-c/src/canl_cred.c b/emi.canl.canl-c/src/canl_cred.c index 7f9d22d..cc221dc 100644 --- a/emi.canl.canl-c/src/canl_cred.c +++ b/emi.canl.canl-c/src/canl_cred.c @@ -102,22 +102,8 @@ canl_ctx_set_cred(canl_ctx ctx, canl_cred cred) static int pkey_dup(glb_ctx *cc, EVP_PKEY **to, EVP_PKEY *from) { - /* TODO Support for other key types could be here*/ - switch (EVP_PKEY_type(from->type)) { - case EVP_PKEY_RSA: - { - RSA *rsa = NULL; - RSA *dup_rsa = NULL; - rsa = EVP_PKEY_get1_RSA(from); - if (!rsa ) - return set_error(cc, ENOMEM, POSIX_ERROR, "Cannot " - "get rsa key out of credential handler"); - dup_rsa = RSAPrivateKey_dup(rsa); - RSA_free(rsa); - EVP_PKEY_set1_RSA(*to, dup_rsa); - break; - } - } + CRYPTO_add(&from->references,1,CRYPTO_LOCK_EVP_PKEY); + *to = from; return 0; }