aboutsummaryrefslogtreecommitdiff
path: root/crypto/asn1/d2i_pr.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2006-06-05 11:52:46 +0000
committerDr. Stephen Henson <steve@openssl.org>2006-06-05 11:52:46 +0000
commit01b8b3c7d2d8f835257ac1cb2512273aa27bfba8 (patch)
treefb224473dca22be551086f10ed34240c802c6335 /crypto/asn1/d2i_pr.c
parent8fecd4b4f1bd6f066ba0a9f96387f00ac0dd99bf (diff)
downloadopenssl-01b8b3c7d2d8f835257ac1cb2512273aa27bfba8.zip
openssl-01b8b3c7d2d8f835257ac1cb2512273aa27bfba8.tar.gz
openssl-01b8b3c7d2d8f835257ac1cb2512273aa27bfba8.tar.bz2
Complete EVP_PKEY_ASN1_METHOD ENGINE support.
Diffstat (limited to 'crypto/asn1/d2i_pr.c')
-rw-r--r--crypto/asn1/d2i_pr.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/crypto/asn1/d2i_pr.c b/crypto/asn1/d2i_pr.c
index b4e47d4..b2791ea 100644
--- a/crypto/asn1/d2i_pr.c
+++ b/crypto/asn1/d2i_pr.c
@@ -61,6 +61,7 @@
#include <openssl/bn.h>
#include <openssl/evp.h>
#include <openssl/objects.h>
+#include <openssl/engine.h>
#include <openssl/asn1.h>
#include "asn1_locl.h"
@@ -77,25 +78,27 @@ EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp,
return(NULL);
}
}
- else ret= *a;
-
- ret->save_type=type;
- ret->type=EVP_PKEY_type(type);
- ret->ameth = EVP_PKEY_asn1_find(type);
- if (ret->ameth)
+ else
{
- if (!ret->ameth->old_priv_decode ||
- !ret->ameth->old_priv_decode(ret, pp, length))
+ ret= *a;
+ if (ret->engine)
{
- ASN1err(ASN1_F_D2I_PRIVATEKEY,ERR_R_ASN1_LIB);
- goto err;
+ ENGINE_finish(ret->engine);
+ ret->engine = NULL;
}
}
- else
+
+ if (!EVP_PKEY_set_type(ret, type))
{
ASN1err(ASN1_F_D2I_PRIVATEKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE);
goto err;
- /* break; */
+ }
+
+ if (!ret->ameth->old_priv_decode ||
+ !ret->ameth->old_priv_decode(ret, pp, length))
+ {
+ ASN1err(ASN1_F_D2I_PRIVATEKEY,ERR_R_ASN1_LIB);
+ goto err;
}
if (a != NULL) (*a)=ret;
return(ret);