[pkg-opensc-commit] [libp11] 03/86: PKCS11_get_private_key() fixed to only return the private key
Eric Dorland
eric at moszumanska.debian.org
Sun Jul 24 21:40:16 UTC 2016
This is an automated email from the git hooks/post-receive script.
eric pushed a commit to branch master
in repository libp11.
commit 057b50eed11e65373b2b60ebd1ff2242503b0894
Author: Michał Trojnara <Michal.Trojnara at stunnel.org>
Date: Fri Jan 22 12:40:07 2016 +0100
PKCS11_get_private_key() fixed to only return the private key
libp11 0.4.0 will include engine_pkcs11, so compatibility with
a bug in engine_pkcs11 <= 0.2.0 is no longer needed.
---
src/p11_key.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/p11_key.c b/src/p11_key.c
index bfa6f0d..d86a761 100644
--- a/src/p11_key.c
+++ b/src/p11_key.c
@@ -277,9 +277,7 @@ int PKCS11_get_key_type(PKCS11_KEY * key)
/*
* Create an EVP_PKEY OpenSSL object for a given key
- * Returns either private or public key object depending on the isPrivate
- * value for compatibility with a bug in engine_pkcs11 <= 0.2.0
- * TODO: Fix this when the affected engine_pkcs11 is phased out
+ * Always returns the private key object
*/
EVP_PKEY *PKCS11_get_private_key(PKCS11_KEY * key)
{
@@ -287,6 +285,11 @@ EVP_PKEY *PKCS11_get_private_key(PKCS11_KEY * key)
if (key == NULL)
return NULL;
+ if (!key->isPrivate) {
+ key = PKCS11_find_key_from_key(key);
+ if (key == NULL)
+ return NULL;
+ }
if (key->evp_key == NULL) {
kpriv = PRIVKEY(key);
key->evp_key = kpriv->ops->get_evp_key(key);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opensc/libp11.git
More information about the pkg-opensc-commit
mailing list