add Certicom licensing e-mail address
[openssl.git] / crypto / asn1 / i2d_pr.c
index b6b821d73c71c222d13d66925552d604381cc465..bbf2a0d2d6b06c9878189cd4a5f168655057e2bf 100644 (file)
 
 #include <stdio.h>
 #include "cryptlib.h"
-#include "bn.h"
-#include "evp.h"
-#include "objects.h"
+#include <openssl/bn.h>
+#include <openssl/evp.h>
+#include <openssl/objects.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
 
-int i2d_PrivateKey(a,pp)
-EVP_PKEY *a;
-unsigned char **pp;
+int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp)
        {
-#ifndef NO_RSA
+#ifndef OPENSSL_NO_RSA
        if (a->type == EVP_PKEY_RSA)
                {
                return(i2d_RSAPrivateKey(a->pkey.rsa,pp));
                }
        else
 #endif
-#ifndef NO_DSA
+#ifndef OPENSSL_NO_DSA
        if (a->type == EVP_PKEY_DSA)
                {
                return(i2d_DSAPrivateKey(a->pkey.dsa,pp));
                }
 #endif
+#ifndef OPENSSL_NO_EC
+       if (a->type == EVP_PKEY_EC)
+               {
+               return(i2d_ECPrivateKey(a->pkey.eckey, pp));
+               }
+#endif
 
        ASN1err(ASN1_F_I2D_PRIVATEKEY,ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE);
        return(-1);