#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_ECDSA
+#include <openssl/ecdsa.h>
+#endif
-int i2d_PublicKey(a,pp)
-EVP_PKEY *a;
-unsigned char **pp;
+int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp)
{
switch (a->type)
{
-#ifndef NO_RSA
+#ifndef OPENSSL_NO_RSA
case EVP_PKEY_RSA:
return(i2d_RSAPublicKey(a->pkey.rsa,pp));
#endif
-#ifndef NO_DSA
+#ifndef OPENSSL_NO_DSA
case EVP_PKEY_DSA:
return(i2d_DSAPublicKey(a->pkey.dsa,pp));
+#endif
+#ifndef OPENSSL_NO_ECDSA
+ case EVP_PKEY_ECDSA:
+ return(ECDSAPublicKey_get_octet_string(a->pkey.ecdsa, pp));
#endif
default:
ASN1err(ASN1_F_I2D_PUBLICKEY,ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE);