Fix memory leak cause by race condition when creating public keys.
[openssl.git] / crypto / asn1 / i2d_pu.c
index 2fcc5554a70b3a1f251894724e4fe579e0d7cb92..34286dbd359f9a7724057c9fb737765b5c2a80fb 100644 (file)
@@ -67,8 +67,8 @@
 #ifndef OPENSSL_NO_DSA
 #include <openssl/dsa.h>
 #endif
-#ifndef OPENSSL_NO_ECDSA
-#include <openssl/ecdsa.h>
+#ifndef OPENSSL_NO_EC
+#include <openssl/ec.h>
 #endif
 
 int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp)
@@ -83,9 +83,9 @@ int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp)
        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));
+#ifndef OPENSSL_NO_EC
+       case EVP_PKEY_EC:
+               return(i2o_ECPublicKey(a->pkey.ec, pp));
 #endif
        default:
                ASN1err(ASN1_F_I2D_PUBLICKEY,ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE);