reason = ERR_R_EC_LIB; goto err;
if (!EC_GROUP_get_curve_GFp(x, p, a, b, ctx)) { reason = ERR_R_EC_LIB; goto err; } } else { if (!EC_GROUP_get_curve_GF2m(x, p, a, b, ctx)) { reason = ERR_R_EC_LIB; goto err; }
int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off)	{	char str[128];	unsigned char *buffer=NULL;	size_t	buf_len=0, i;	int     ret=0, reason=ERR_R_BIO_LIB;	BN_CTX  *ctx=NULL;	EC_POINT *point=NULL;	BIGNUM	*p=NULL, *a=NULL, *b=NULL, *gen=NULL,		*order=NULL, *cofactor=NULL, *seed=NULL;		static const char *gen_compressed = "Generator (compressed):";	static const char *gen_uncompressed = "Generator (uncompressed):";	static const char *gen_hybrid = "Generator (hybrid):"; 	if (!x)		{		reason = ERR_R_PASSED_NULL_PARAMETER;		goto err;		}	if (EC_GROUP_get_asn1_flag(x))		{		/* the curve parameter are given by an asn1 OID */		int nid;		if (off)			{			if (off > 128)				off=128;			memset(str, ' ', off);			if (BIO_write(bp, str, off) <= 0)				goto err;			}		nid = EC_GROUP_get_nid(x);		if (nid == 0)			goto err;		if (BIO_printf(bp, "ASN1 OID: %s", OBJ_nid2sn(nid)) <= 0)			goto err;		if (BIO_printf(bp, "\n") <= 0)			goto err;		}	else		{		/* explicit parameters */		/* TODO */		point_conversion_form_t form;		if ((p = BN_new()) == NULL || (a = BN_new()) == NULL ||			(b = BN_new()) == NULL || (order = BN_new()) == NULL ||			(cofactor = BN_new()) == NULL)			{			reason = ERR_R_MALLOC_FAILURE;			goto err;			}		if (!EC_GROUP_get_curve_GFp(x, p, a, b, ctx))			{			reason = ERR_R_EC_LIB;			goto err;			}		if ((point = EC_GROUP_get0_generator(x)) == NULL)			{			reason = ERR_R_EC_LIB;			goto err;			}		if (!EC_GROUP_get_order(x, order, NULL) ||             		!EC_GROUP_get_cofactor(x, cofactor, NULL))			{			reason = ERR_R_EC_LIB;			goto err;			}				form = EC_GROUP_get_point_conversion_form(x);		if ((gen = EC_POINT_point2bn(x, point, 				form, NULL, ctx)) == NULL)			{			reason = ERR_R_EC_LIB;			goto err;			}		buf_len = (size_t)BN_num_bytes(p);		if (buf_len < (i = (size_t)BN_num_bytes(a)))			buf_len = i;		if (buf_len < (i = (size_t)BN_num_bytes(b)))			buf_len = i;		if (buf_len < (i = (size_t)BN_num_bytes(gen)))			buf_len = i;		if (buf_len < (i = (size_t)BN_num_bytes(order)))			buf_len = i;		if (buf_len < (i = (size_t)BN_num_bytes(cofactor))) 			buf_len = i;		if (EC_GROUP_get0_seed(x))			{			seed = BN_bin2bn(EC_GROUP_get0_seed(x),				EC_GROUP_get_seed_len(x), NULL);			if (seed == NULL)				{				reason = ERR_R_BN_LIB;				goto err;				}			if (buf_len < (i = (size_t)BN_num_bytes(seed))) 				buf_len = i;			}		buf_len += 10;		if ((buffer = OPENSSL_malloc(buf_len)) == NULL)			{			reason = ERR_R_MALLOC_FAILURE;			goto err;			}		if (off)			{			if (off > 128) off=128;			memset(str,' ',off);			}  		if ((p != NULL) && !print(bp, "P:   ", p, buffer, off)) 			goto err;		if ((a != NULL) && !print(bp, "A:   ", a, buffer, off)) 			goto err;		if ((b != NULL) && !print(bp, "B:   ", b, buffer, off))			goto err;		if (form == POINT_CONVERSION_COMPRESSED)			{			if ((gen != NULL) && !print(bp, gen_compressed, gen,				buffer, off))				goto err;			}		else if (form == POINT_CONVERSION_UNCOMPRESSED)			{			if ((gen != NULL) && !print(bp, gen_uncompressed, gen,				buffer, off))				goto err;			}		else /* form == POINT_CONVERSION_HYBRID */			{			if ((gen != NULL) && !print(bp, gen_hybrid, gen,				buffer, off))				goto err;			}		if ((order != NULL) && !print(bp, "Order: ", order, 			buffer, off)) goto err;		if ((cofactor != NULL) && !print(bp, "Cofactor: ", cofactor, 			buffer, off)) goto err;		if ((seed != NULL) && !print(bp, "Seed:", seed, 			buffer, off)) goto err;		}	ret=1;err:	if (!ret) 		ECerr(EC_F_ECPKPARAMETERS_PRINT, reason);	if (p) 		BN_free(p);	if (a) 		BN_free(a);	if (b)		BN_free(b);	if (gen)		BN_free(gen);	if (order)		BN_free(order);	if (cofactor)		BN_free(cofactor);	if (seed) 		BN_free(seed);	if (ctx)		BN_CTX_free(ctx);	if (buffer != NULL) 		OPENSSL_free(buffer);	return(ret);		}