make update
[openssl.git] / crypto / asn1 / d2i_pu.c
index fdbc0ac9e8192d1364d522f32be7c8f883d530c7..4c2bd4e5c8a1e0cf747b10b662c114031285ac85 100644 (file)
 #include <openssl/evp.h>
 #include <openssl/objects.h>
 #include <openssl/asn1.h>
+#ifndef OPENSSL_NO_RSA
+#include <openssl/rsa.h>
+#endif
+#ifndef OPENSSL_NO_DSA
+#include <openssl/dsa.h>
+#endif
+#ifndef OPENSSL_NO_EC
+#include <openssl/ec.h>
+#endif
 
 EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, unsigned char **pp,
             long length)
@@ -82,7 +91,7 @@ EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, unsigned char **pp,
        ret->type=EVP_PKEY_type(type);
        switch (ret->type)
                {
-#ifndef NO_RSA
+#ifndef OPENSSL_NO_RSA
        case EVP_PKEY_RSA:
                if ((ret->pkey.rsa=d2i_RSAPublicKey(NULL,
                        (const unsigned char **)pp,length)) == NULL) /* TMP UGLY CAST */
@@ -92,14 +101,25 @@ EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, unsigned char **pp,
                        }
                break;
 #endif
-#ifndef NO_DSA
+#ifndef OPENSSL_NO_DSA
        case EVP_PKEY_DSA:
-               if ((ret->pkey.dsa=d2i_DSAPublicKey(NULL,pp,length)) == NULL)
+               if ((ret->pkey.dsa=d2i_DSAPublicKey(&(ret->pkey.dsa),
+                       (const unsigned char **)pp,length)) == NULL) /* TMP UGLY CAST */
                        {
                        ASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_ASN1_LIB);
                        goto err;
                        }
                break;
+#endif
+#ifndef OPENSSL_NO_EC
+       case EVP_PKEY_EC:
+               if ((ret->pkey.eckey = o2i_ECPublicKey(&(ret->pkey.eckey),
+                       (const unsigned char **)pp, length)) == NULL)
+                       {
+                       ASN1err(ASN1_F_D2I_PUBLICKEY, ERR_R_ASN1_LIB);
+                       goto err;
+                       }
+       break;
 #endif
        default:
                ASN1err(ASN1_F_D2I_PUBLICKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE);