use asn1 callbacks for new, free and d2i
[oweals/openssl.git] / crypto / pem / pem_info.c
index 14e0643129392b0580e6b5053b7c416c03d16ebf..1644dfcaac7311ca1adf4b9a74bc94b65caa3bf8 100644 (file)
 #include <openssl/evp.h>
 #include <openssl/x509.h>
 #include <openssl/pem.h>
+#ifndef OPENSSL_NO_RSA
 #include <openssl/rsa.h>
+#endif
+#ifndef OPENSSL_NO_DSA
 #include <openssl/dsa.h>
+#endif
 
 #ifndef OPENSSL_NO_FP_API
 STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u)
@@ -127,7 +131,7 @@ start:
                if (    (strcmp(name,PEM_STRING_X509) == 0) ||
                        (strcmp(name,PEM_STRING_X509_OLD) == 0))
                        {
-                       (D2I_OF(X509))d2i=d2i_X509;
+                       d2i=(D2I_OF(void))d2i_X509;
                        if (xi->x509 != NULL)
                                {
                                if (!sk_X509_INFO_push(ret,xi)) goto err;
@@ -138,7 +142,7 @@ start:
                        }
                else if ((strcmp(name,PEM_STRING_X509_TRUSTED) == 0))
                        {
-                       (D2I_OF(X509))d2i=d2i_X509_AUX;
+                       d2i=(D2I_OF(void))d2i_X509_AUX;
                        if (xi->x509 != NULL)
                                {
                                if (!sk_X509_INFO_push(ret,xi)) goto err;
@@ -149,7 +153,7 @@ start:
                        }
                else if (strcmp(name,PEM_STRING_X509_CRL) == 0)
                        {
-                       (D2I_OF(X509_CRL))d2i=d2i_X509_CRL;
+                       d2i=(D2I_OF(void))d2i_X509_CRL;
                        if (xi->crl != NULL)
                                {
                                if (!sk_X509_INFO_push(ret,xi)) goto err;
@@ -162,7 +166,7 @@ start:
 #ifndef OPENSSL_NO_RSA
                        if (strcmp(name,PEM_STRING_RSA) == 0)
                        {
-                       (D2I_OF(RSA))d2i=d2i_RSAPrivateKey;
+                       d2i=(D2I_OF(void))d2i_RSAPrivateKey;
                        if (xi->x_pkey != NULL) 
                                {
                                if (!sk_X509_INFO_push(ret,xi)) goto err;
@@ -186,7 +190,7 @@ start:
 #ifndef OPENSSL_NO_DSA
                        if (strcmp(name,PEM_STRING_DSA) == 0)
                        {
-                       (D2I_OF(RSA))d2i=d2i_DSAPrivateKey;
+                       d2i=(D2I_OF(void))d2i_DSAPrivateKey;
                        if (xi->x_pkey != NULL) 
                                {
                                if (!sk_X509_INFO_push(ret,xi)) goto err;
@@ -210,7 +214,7 @@ start:
 #ifndef OPENSSL_NO_EC
                        if (strcmp(name,PEM_STRING_ECPRIVATEKEY) == 0)
                        {
-                               (D2I_OF(EC_KEY))d2i=d2i_ECPrivateKey;
+                               d2i=(D2I_OF(void))d2i_ECPrivateKey;
                                if (xi->x_pkey != NULL) 
                                {
                                        if (!sk_X509_INFO_push(ret,xi)) goto err;
@@ -225,7 +229,7 @@ start:
                        if ((xi->x_pkey->dec_pkey=EVP_PKEY_new()) == NULL)
                                goto err;
                        xi->x_pkey->dec_pkey->type=EVP_PKEY_EC;
-                       pp=&(xi->x_pkey->dec_pkey->pkey.eckey);
+                       pp=&(xi->x_pkey->dec_pkey->pkey.ec);
                        if ((int)strlen(header) > 10) /* assume encrypted */
                                raw=1;
                        }