ret->pkey.ecdsa->write_params = 0;
EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)	{	EVP_PKEY *ret=NULL;	long j;	int type;	unsigned char *p;#if !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_ECDSA)	const unsigned char *cp;	X509_ALGOR *a;#endif	if (key == NULL) goto err;	if (key->pkey != NULL)		{		CRYPTO_add(&key->pkey->references, 1, CRYPTO_LOCK_EVP_PKEY);		return(key->pkey);		}	if (key->public_key == NULL) goto err;	type=OBJ_obj2nid(key->algor->algorithm);	if ((ret = EVP_PKEY_new()) == NULL)		{		X509err(X509_F_X509_PUBKEY_GET, ERR_R_MALLOC_FAILURE);		goto err;		}	ret->type = EVP_PKEY_type(type);	/* the parameters must be extracted before the public key (ECDSA!) */	#if !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_ECDSA)	a=key->algor;#endif	if (0)		;#ifndef OPENSSL_NO_DSA	else if (ret->type == EVP_PKEY_DSA)		{		if (a->parameter && (a->parameter->type == V_ASN1_SEQUENCE))			{			if ((ret->pkey.dsa = DSA_new()) == NULL)				{				X509err(X509_F_X509_PUBKEY_GET, ERR_R_MALLOC_FAILURE);				goto err;				}			ret->pkey.dsa->write_params=0;			cp=p=a->parameter->value.sequence->data;			j=a->parameter->value.sequence->length;			if (!d2i_DSAparams(&ret->pkey.dsa, &cp, (long)j))				goto err;			}		ret->save_parameters=1;		}#endif#ifndef OPENSSL_NO_ECDSA	else if (ret->type == EVP_PKEY_ECDSA)		{		if (a->parameter && (a->parameter->type == V_ASN1_SEQUENCE))			{			if ((ret->pkey.ecdsa= ECDSA_new()) == NULL)				{				X509err(X509_F_X509_PUBKEY_GET, ERR_R_MALLOC_FAILURE);				goto err;				}			ret->pkey.ecdsa->write_params = 0;			cp = p = a->parameter->value.sequence->data;			j = a->parameter->value.sequence->length;			if (!d2i_ECDSAParameters(&ret->pkey.ecdsa, &cp, (long)j))				{				X509err(X509_F_X509_PUBKEY_GET, ERR_R_ECDSA_LIB);				goto err;				}			}		ret->save_parameters = 1;		}#endif	p=key->public_key->data;        j=key->public_key->length;        if ((ret = d2i_PublicKey(type, &ret, &p, (long)j)) == NULL)		{		X509err(X509_F_X509_PUBKEY_GET, X509_R_ERR_ASN1_LIB);		goto err;		}	key->pkey = ret;	CRYPTO_add(&ret->references, 1, CRYPTO_LOCK_EVP_PKEY);	return(ret);err:	if (ret != NULL)		EVP_PKEY_free(ret);	return(NULL);	}