crypto/ec/ec_asn1.c:873: error: NULL_DEREFERENCE
  pointer `ret` last assigned on line 741 could be null and is dereferenced at line 873, column 7.
Showing all 40 steps of the trace


crypto/ec/ec_asn1.c:738:1: start of procedure ec_asn1_parameters2group()
736.   	}
737.   
738. > static EC_GROUP *ec_asn1_parameters2group(const ECPARAMETERS *params)
739.   	{
740.   	int			ok = 0, tmp;

crypto/ec/ec_asn1.c:740:2: 
738.   static EC_GROUP *ec_asn1_parameters2group(const ECPARAMETERS *params)
739.   	{
740. > 	int			ok = 0, tmp;
741.   	EC_GROUP		*ret = NULL;
742.   	BIGNUM			*p = NULL, *a = NULL, *b = NULL;

crypto/ec/ec_asn1.c:741:2: 
739.   	{
740.   	int			ok = 0, tmp;
741. > 	EC_GROUP		*ret = NULL;
742.   	BIGNUM			*p = NULL, *a = NULL, *b = NULL;
743.   	EC_POINT		*point=NULL;

crypto/ec/ec_asn1.c:742:2: 
740.   	int			ok = 0, tmp;
741.   	EC_GROUP		*ret = NULL;
742. > 	BIGNUM			*p = NULL, *a = NULL, *b = NULL;
743.   	EC_POINT		*point=NULL;
744.   

crypto/ec/ec_asn1.c:743:2: 
741.   	EC_GROUP		*ret = NULL;
742.   	BIGNUM			*p = NULL, *a = NULL, *b = NULL;
743. > 	EC_POINT		*point=NULL;
744.   
745.   	if (!params->fieldID || !params->fieldID->fieldType || 

crypto/ec/ec_asn1.c:745:7: Taking false branch
743.   	EC_POINT		*point=NULL;
744.   
745.   	if (!params->fieldID || !params->fieldID->fieldType || 
             ^
746.   	    !params->fieldID->p.ptr)
747.   		{

crypto/ec/ec_asn1.c:745:27: Taking false branch
743.   	EC_POINT		*point=NULL;
744.   
745.   	if (!params->fieldID || !params->fieldID->fieldType || 
                                 ^
746.   	    !params->fieldID->p.ptr)
747.   		{

crypto/ec/ec_asn1.c:746:7: Taking false branch
744.   
745.   	if (!params->fieldID || !params->fieldID->fieldType || 
746.   	    !params->fieldID->p.ptr)
             ^
747.   		{
748.   		ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, EC_R_ASN1_ERROR);

crypto/ec/ec_asn1.c:753:7: Taking false branch
751.   
752.   	/* now extract the curve parameters a and b */
753.   	if (!params->curve || !params->curve->a || 
             ^
754.   	    !params->curve->a->data || !params->curve->b ||
755.   	    !params->curve->b->data)

crypto/ec/ec_asn1.c:753:25: Taking false branch
751.   
752.   	/* now extract the curve parameters a and b */
753.   	if (!params->curve || !params->curve->a || 
                               ^
754.   	    !params->curve->a->data || !params->curve->b ||
755.   	    !params->curve->b->data)

crypto/ec/ec_asn1.c:754:7: Taking false branch
752.   	/* now extract the curve parameters a and b */
753.   	if (!params->curve || !params->curve->a || 
754.   	    !params->curve->a->data || !params->curve->b ||
             ^
755.   	    !params->curve->b->data)
756.   		{

crypto/ec/ec_asn1.c:754:34: Taking false branch
752.   	/* now extract the curve parameters a and b */
753.   	if (!params->curve || !params->curve->a || 
754.   	    !params->curve->a->data || !params->curve->b ||
                                        ^
755.   	    !params->curve->b->data)
756.   		{

crypto/ec/ec_asn1.c:755:7: Taking false branch
753.   	if (!params->curve || !params->curve->a || 
754.   	    !params->curve->a->data || !params->curve->b ||
755.   	    !params->curve->b->data)
             ^
756.   		{
757.   		ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, EC_R_ASN1_ERROR);

crypto/ec/ec_asn1.c:760:2: Skipping BN_bin2bn(): empty list of specs
758.   		goto err;
759.   		}
760.   	a = BN_bin2bn(params->curve->a->data, params->curve->a->length, NULL);
        ^
761.   	if (a == NULL)
762.   		{

crypto/ec/ec_asn1.c:761:6: Taking false branch
759.   		}
760.   	a = BN_bin2bn(params->curve->a->data, params->curve->a->length, NULL);
761.   	if (a == NULL)
            ^
762.   		{
763.   		ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_BN_LIB);

crypto/ec/ec_asn1.c:766:2: Skipping BN_bin2bn(): empty list of specs
764.   		goto err;
765.   		}
766.   	b = BN_bin2bn(params->curve->b->data, params->curve->b->length, NULL);
        ^
767.   	if (b == NULL)
768.   		{

crypto/ec/ec_asn1.c:767:6: Taking false branch
765.   		}
766.   	b = BN_bin2bn(params->curve->b->data, params->curve->b->length, NULL);
767.   	if (b == NULL)
            ^
768.   		{
769.   		ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_BN_LIB);

crypto/ec/ec_asn1.c:774:2: 
772.   
773.   	/* get the field parameters */
774. > 	tmp = OBJ_obj2nid(params->fieldID->fieldType);
775.   
776.   	if (tmp == NID_X9_62_characteristic_two_field)

crypto/objects/obj_dat.c:366:1: start of procedure OBJ_obj2nid()
  364.   	}
  365.   
  366. > int OBJ_obj2nid(const ASN1_OBJECT *a)
  367.   	{
  368.   	ASN1_OBJECT **op;

crypto/objects/obj_dat.c:371:6: Taking false branch
  369.   	ADDED_OBJ ad,*adp;
  370.   
  371.   	if (a == NULL)
              ^
  372.   		return(NID_undef);
  373.   	if (a->nid != 0)

crypto/objects/obj_dat.c:373:6: Taking false branch
  371.   	if (a == NULL)
  372.   		return(NID_undef);
  373.   	if (a->nid != 0)
              ^
  374.   		return(a->nid);
  375.   

crypto/objects/obj_dat.c:376:6: Taking true branch
  374.   		return(a->nid);
  375.   
  376.   	if (added != NULL)
              ^
  377.   		{
  378.   		ad.type=ADDED_DATA;

crypto/objects/obj_dat.c:378:3: 
  376.   	if (added != NULL)
  377.   		{
  378. > 		ad.type=ADDED_DATA;
  379.   		ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  380.   		adp=(ADDED_OBJ *)lh_retrieve(added,&ad);

crypto/objects/obj_dat.c:379:3: 
  377.   		{
  378.   		ad.type=ADDED_DATA;
  379. > 		ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  380.   		adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
  381.   		if (adp != NULL) return (adp->obj->nid);

crypto/objects/obj_dat.c:380:3: 
  378.   		ad.type=ADDED_DATA;
  379.   		ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  380. > 		adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
  381.   		if (adp != NULL) return (adp->obj->nid);
  382.   		}

crypto/lhash/lhash.c:248:1: start of procedure lh_retrieve()
    246.   	}
    247.   
    248. > void *lh_retrieve(LHASH *lh, const void *data)
    249.   	{
    250.   	unsigned long hash;

crypto/lhash/lhash.c:254:2: 
    252.   	const void *ret;
    253.   
    254. > 	lh->error=0;
    255.   	rn=getrn(lh,data,&hash);
    256.   

crypto/lhash/lhash.c:255:2: Skipping getrn(): empty list of specs
    253.   
    254.   	lh->error=0;
    255.   	rn=getrn(lh,data,&hash);
            ^
    256.   
    257.   	if (*rn == NULL)

crypto/lhash/lhash.c:257:6: Taking false branch
    255.   	rn=getrn(lh,data,&hash);
    256.   
    257.   	if (*rn == NULL)
                ^
    258.   		{
    259.   		lh->num_retrieve_miss++;

crypto/lhash/lhash.c:264:3: 
    262.   	else
    263.   		{
    264. > 		ret= (*rn)->data;
    265.   		lh->num_retrieve++;
    266.   		}

crypto/lhash/lhash.c:265:3: 
    263.   		{
    264.   		ret= (*rn)->data;
    265. > 		lh->num_retrieve++;
    266.   		}
    267.   	return((void *)ret);

crypto/lhash/lhash.c:267:2: 
    265.   		lh->num_retrieve++;
    266.   		}
    267. > 	return((void *)ret);
    268.   	}
    269.   

crypto/lhash/lhash.c:268:2: return from a call to lh_retrieve
    266.   		}
    267.   	return((void *)ret);
    268.   	}
            ^
    269.   
    270.   static void doall_util_fn(LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func,

crypto/objects/obj_dat.c:381:7: Taking true branch
  379.   		ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  380.   		adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
  381.   		if (adp != NULL) return (adp->obj->nid);
               ^
  382.   		}
  383.   	op=(ASN1_OBJECT **)OBJ_bsearch((char *)&a,(char *)obj_objs,NUM_OBJ,

crypto/objects/obj_dat.c:381:20: 
  379.   		ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  380.   		adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
  381. > 		if (adp != NULL) return (adp->obj->nid);
  382.   		}
  383.   	op=(ASN1_OBJECT **)OBJ_bsearch((char *)&a,(char *)obj_objs,NUM_OBJ,

crypto/objects/obj_dat.c:388:2: return from a call to OBJ_obj2nid
  386.   		return(NID_undef);
  387.   	return((*op)->nid);
  388.   	}
          ^
  389.   
  390.   /* Convert an object name into an ASN1_OBJECT

crypto/ec/ec_asn1.c:776:6: Taking false branch
774.   	tmp = OBJ_obj2nid(params->fieldID->fieldType);
775.   
776.   	if (tmp == NID_X9_62_characteristic_two_field)
            ^
777.   		{
778.   		X9_62_CHARACTERISTIC_TWO *char_two;

crypto/ec/ec_asn1.c:846:11: Taking false branch
844.   			}
845.   		}
846.   	else if (tmp == NID_X9_62_prime_field)
                 ^
847.   		{
848.   		/* we have a curve over a prime field */

crypto/ec/ec_asn1.c:871:6: Taking true branch
869.   
870.   	/* extract seed (optional) */
871.   	if (params->curve->seed != NULL)
            ^
872.   		{
873.   		if (ret->seed != NULL)

crypto/ec/ec_asn1.c:873:7: 
871.   	if (params->curve->seed != NULL)
872.   		{
873. > 		if (ret->seed != NULL)
874.   			OPENSSL_free(ret->seed);
875.   		if (!(ret->seed = OPENSSL_malloc(params->curve->seed->length)))

static EC_GROUP *ec_asn1_parameters2group(const ECPARAMETERS *params)
	{
	int			ok = 0, tmp;
	EC_GROUP		*ret = NULL;
	BIGNUM			*p = NULL, *a = NULL, *b = NULL;
	EC_POINT		*point=NULL;
	if (!params->fieldID || !params->fieldID->fieldType ||
	    !params->fieldID->p.ptr)
		{
		ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, EC_R_ASN1_ERROR);
		goto err;
		}
	if (!params->curve || !params->curve->a ||
	    !params->curve->a->data || !params->curve->b ||
	    !params->curve->b->data)
		{
		ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, EC_R_ASN1_ERROR);
		goto err;
		}
	a = BN_bin2bn(params->curve->a->data, params->curve->a->length, NULL);
	if (a == NULL)
		{
		ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_BN_LIB);
		goto err;
		}
	b = BN_bin2bn(params->curve->b->data, params->curve->b->length, NULL);
	if (b == NULL)
		{
		ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_BN_LIB);
		goto err;
		}
	tmp = OBJ_obj2nid(params->fieldID->fieldType);
	if (tmp == NID_X9_62_characteristic_two_field)
		{
		X9_62_CHARACTERISTIC_TWO *char_two;
		char_two = params->fieldID->p.char_two;
		if ((p = BN_new()) == NULL)
			{
			ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_MALLOC_FAILURE);
			goto err;
			}
		tmp = OBJ_obj2nid(char_two->type);
		if (tmp ==  NID_X9_62_tpBasis)
			{
			long tmp_long;
			if (!char_two->p.tpBasis)
				{
				ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, EC_R_ASN1_ERROR);
				goto err;
				}
			tmp_long = ASN1_INTEGER_get(char_two->p.tpBasis);
			if (!BN_set_bit(p, (int)char_two->m))
				goto err;
			if (!BN_set_bit(p, (int)tmp_long))
				goto err;
			if (!BN_set_bit(p, 0))
				goto err;
			}
		else if (tmp == NID_X9_62_ppBasis)
			{
			X9_62_PENTANOMIAL *penta;
			penta = char_two->p.ppBasis;
			if (!penta)
				{
				ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, EC_R_ASN1_ERROR);
				goto err;
				}
			if (!BN_set_bit(p, (int)char_two->m)) goto err;
			if (!BN_set_bit(p, (int)penta->k1)) goto err;
			if (!BN_set_bit(p, (int)penta->k2)) goto err;
			if (!BN_set_bit(p, (int)penta->k3)) goto err;
			if (!BN_set_bit(p, 0)) goto err;
			}
		else if (tmp == NID_X9_62_onBasis)
			{
			ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, EC_R_NOT_IMPLEMENTED);
			goto err;
			}
		else
			{
			ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, EC_R_ASN1_ERROR);
			goto err;
			}
		ret = EC_GROUP_new_curve_GF2m(p, a, b, NULL);
		if (ret == NULL)
			{
			ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_EC_LIB);
			goto err;
			}
		}
	else if (tmp == NID_X9_62_prime_field)
		{
		if (!params->fieldID->p.prime)
			{
			ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, EC_R_ASN1_ERROR);
			goto err;
			}
		p = ASN1_INTEGER_to_BN(params->fieldID->p.prime, NULL);
		if (p == NULL)
			{
			ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_ASN1_LIB);
			goto err;
			}
		ret = EC_GROUP_new_curve_GFp(p, a, b, NULL);
		if (ret == NULL)
			{
			ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_EC_LIB);
			goto err;
			}
		}
	if (params->curve->seed != NULL)
		{
		if (ret->seed != NULL)
			OPENSSL_free(ret->seed);
		if (!(ret->seed = OPENSSL_malloc(params->curve->seed->length)))
			{
			ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP,
			      ERR_R_MALLOC_FAILURE);
			goto err;
			}
		memcpy(ret->seed, params->curve->seed->data,
		       params->curve->seed->length);
		ret->seed_len = params->curve->seed->length;
		}
	if (!params->order || !params->base || !params->base->data)
		{
		ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, EC_R_ASN1_ERROR);
		goto err;
		}
	if ((point = EC_POINT_new(ret)) == NULL) goto err;
	EC_GROUP_set_point_conversion_form(ret, (point_conversion_form_t)
				(params->base->data[0] & ~0x01));
	if (!EC_POINT_oct2point(ret, point, params->base->data,
		                params->base->length, NULL))
		{
		ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_EC_LIB);
		goto err;
		}
	if ((a = ASN1_INTEGER_to_BN(params->order, a)) == NULL)
		{
		ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_ASN1_LIB);
		goto err;
		}
	if (params->cofactor == NULL)
		{
		if (b)
			{
			BN_free(b);
			b = NULL;
			}
		}
	else
		if ((b = ASN1_INTEGER_to_BN(params->cofactor, b)) == NULL)
			{
			ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_ASN1_LIB);
			goto err;
			}
	if (!EC_GROUP_set_generator(ret, point, a, b))
		{
		ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_EC_LIB);
		goto err;
		}
	ok = 1;
err:	if (!ok)
		{
		if (ret)
			EC_GROUP_clear_free(ret);
		ret = NULL;
		}
	if (p)
		BN_free(p);
	if (a)
		BN_free(a);
	if (b)
		BN_free(b);
	if (point)
		EC_POINT_free(point);
	return(ret);
}
['static EC_GROUP *ec_asn1_parameters2group(const ECPARAMETERS *params)\n\t{\n\tint\t\t\tok = 0, tmp;\n\tEC_GROUP\t\t*ret = NULL;\n\tBIGNUM\t\t\t*p = NULL, *a = NULL, *b = NULL;\n\tEC_POINT\t\t*point=NULL;\n\tif (!params->fieldID || !params->fieldID->fieldType ||\n\t    !params->fieldID->p.ptr)\n\t\t{\n\t\tECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, EC_R_ASN1_ERROR);\n\t\tgoto err;\n\t\t}\n\tif (!params->curve || !params->curve->a ||\n\t    !params->curve->a->data || !params->curve->b ||\n\t    !params->curve->b->data)\n\t\t{\n\t\tECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, EC_R_ASN1_ERROR);\n\t\tgoto err;\n\t\t}\n\ta = BN_bin2bn(params->curve->a->data, params->curve->a->length, NULL);\n\tif (a == NULL)\n\t\t{\n\t\tECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_BN_LIB);\n\t\tgoto err;\n\t\t}\n\tb = BN_bin2bn(params->curve->b->data, params->curve->b->length, NULL);\n\tif (b == NULL)\n\t\t{\n\t\tECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_BN_LIB);\n\t\tgoto err;\n\t\t}\n\ttmp = OBJ_obj2nid(params->fieldID->fieldType);\n\tif (tmp == NID_X9_62_characteristic_two_field)\n\t\t{\n\t\tX9_62_CHARACTERISTIC_TWO *char_two;\n\t\tchar_two = params->fieldID->p.char_two;\n\t\tif ((p = BN_new()) == NULL)\n\t\t\t{\n\t\t\tECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_MALLOC_FAILURE);\n\t\t\tgoto err;\n\t\t\t}\n\t\ttmp = OBJ_obj2nid(char_two->type);\n\t\tif (tmp ==  NID_X9_62_tpBasis)\n\t\t\t{\n\t\t\tlong tmp_long;\n\t\t\tif (!char_two->p.tpBasis)\n\t\t\t\t{\n\t\t\t\tECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, EC_R_ASN1_ERROR);\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\ttmp_long = ASN1_INTEGER_get(char_two->p.tpBasis);\n\t\t\tif (!BN_set_bit(p, (int)char_two->m))\n\t\t\t\tgoto err;\n\t\t\tif (!BN_set_bit(p, (int)tmp_long))\n\t\t\t\tgoto err;\n\t\t\tif (!BN_set_bit(p, 0))\n\t\t\t\tgoto err;\n\t\t\t}\n\t\telse if (tmp == NID_X9_62_ppBasis)\n\t\t\t{\n\t\t\tX9_62_PENTANOMIAL *penta;\n\t\t\tpenta = char_two->p.ppBasis;\n\t\t\tif (!penta)\n\t\t\t\t{\n\t\t\t\tECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, EC_R_ASN1_ERROR);\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\tif (!BN_set_bit(p, (int)char_two->m)) goto err;\n\t\t\tif (!BN_set_bit(p, (int)penta->k1)) goto err;\n\t\t\tif (!BN_set_bit(p, (int)penta->k2)) goto err;\n\t\t\tif (!BN_set_bit(p, (int)penta->k3)) goto err;\n\t\t\tif (!BN_set_bit(p, 0)) goto err;\n\t\t\t}\n\t\telse if (tmp == NID_X9_62_onBasis)\n\t\t\t{\n\t\t\tECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, EC_R_NOT_IMPLEMENTED);\n\t\t\tgoto err;\n\t\t\t}\n\t\telse\n\t\t\t{\n\t\t\tECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, EC_R_ASN1_ERROR);\n\t\t\tgoto err;\n\t\t\t}\n\t\tret = EC_GROUP_new_curve_GF2m(p, a, b, NULL);\n\t\tif (ret == NULL)\n\t\t\t{\n\t\t\tECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_EC_LIB);\n\t\t\tgoto err;\n\t\t\t}\n\t\t}\n\telse if (tmp == NID_X9_62_prime_field)\n\t\t{\n\t\tif (!params->fieldID->p.prime)\n\t\t\t{\n\t\t\tECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, EC_R_ASN1_ERROR);\n\t\t\tgoto err;\n\t\t\t}\n\t\tp = ASN1_INTEGER_to_BN(params->fieldID->p.prime, NULL);\n\t\tif (p == NULL)\n\t\t\t{\n\t\t\tECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_ASN1_LIB);\n\t\t\tgoto err;\n\t\t\t}\n\t\tret = EC_GROUP_new_curve_GFp(p, a, b, NULL);\n\t\tif (ret == NULL)\n\t\t\t{\n\t\t\tECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_EC_LIB);\n\t\t\tgoto err;\n\t\t\t}\n\t\t}\n\tif (params->curve->seed != NULL)\n\t\t{\n\t\tif (ret->seed != NULL)\n\t\t\tOPENSSL_free(ret->seed);\n\t\tif (!(ret->seed = OPENSSL_malloc(params->curve->seed->length)))\n\t\t\t{\n\t\t\tECerr(EC_F_EC_ASN1_PARAMETERS2GROUP,\n\t\t\t      ERR_R_MALLOC_FAILURE);\n\t\t\tgoto err;\n\t\t\t}\n\t\tmemcpy(ret->seed, params->curve->seed->data,\n\t\t       params->curve->seed->length);\n\t\tret->seed_len = params->curve->seed->length;\n\t\t}\n\tif (!params->order || !params->base || !params->base->data)\n\t\t{\n\t\tECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, EC_R_ASN1_ERROR);\n\t\tgoto err;\n\t\t}\n\tif ((point = EC_POINT_new(ret)) == NULL) goto err;\n\tEC_GROUP_set_point_conversion_form(ret, (point_conversion_form_t)\n\t\t\t\t(params->base->data[0] & ~0x01));\n\tif (!EC_POINT_oct2point(ret, point, params->base->data,\n\t\t                params->base->length, NULL))\n\t\t{\n\t\tECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_EC_LIB);\n\t\tgoto err;\n\t\t}\n\tif ((a = ASN1_INTEGER_to_BN(params->order, a)) == NULL)\n\t\t{\n\t\tECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_ASN1_LIB);\n\t\tgoto err;\n\t\t}\n\tif (params->cofactor == NULL)\n\t\t{\n\t\tif (b)\n\t\t\t{\n\t\t\tBN_free(b);\n\t\t\tb = NULL;\n\t\t\t}\n\t\t}\n\telse\n\t\tif ((b = ASN1_INTEGER_to_BN(params->cofactor, b)) == NULL)\n\t\t\t{\n\t\t\tECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_ASN1_LIB);\n\t\t\tgoto err;\n\t\t\t}\n\tif (!EC_GROUP_set_generator(ret, point, a, b))\n\t\t{\n\t\tECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_EC_LIB);\n\t\tgoto err;\n\t\t}\n\tok = 1;\nerr:\tif (!ok)\n\t\t{\n\t\tif (ret)\n\t\t\tEC_GROUP_clear_free(ret);\n\t\tret = NULL;\n\t\t}\n\tif (p)\n\t\tBN_free(p);\n\tif (a)\n\t\tBN_free(a);\n\tif (b)\n\t\tBN_free(b);\n\tif (point)\n\t\tEC_POINT_free(point);\n\treturn(ret);\n}', 'int OBJ_obj2nid(const ASN1_OBJECT *a)\n\t{\n\tASN1_OBJECT **op;\n\tADDED_OBJ ad,*adp;\n\tif (a == NULL)\n\t\treturn(NID_undef);\n\tif (a->nid != 0)\n\t\treturn(a->nid);\n\tif (added != NULL)\n\t\t{\n\t\tad.type=ADDED_DATA;\n\t\tad.obj=(ASN1_OBJECT *)a;\n\t\tadp=(ADDED_OBJ *)lh_retrieve(added,&ad);\n\t\tif (adp != NULL) return (adp->obj->nid);\n\t\t}\n\top=(ASN1_OBJECT **)OBJ_bsearch((char *)&a,(char *)obj_objs,NUM_OBJ,\n\t\tsizeof(ASN1_OBJECT *),obj_cmp);\n\tif (op == NULL)\n\t\treturn(NID_undef);\n\treturn((*op)->nid);\n\t}', 'void *lh_retrieve(LHASH *lh, const void *data)\n\t{\n\tunsigned long hash;\n\tLHASH_NODE **rn;\n\tconst void *ret;\n\tlh->error=0;\n\trn=getrn(lh,data,&hash);\n\tif (*rn == NULL)\n\t\t{\n\t\tlh->num_retrieve_miss++;\n\t\treturn(NULL);\n\t\t}\n\telse\n\t\t{\n\t\tret= (*rn)->data;\n\t\tlh->num_retrieve++;\n\t\t}\n\treturn((void *)ret);\n\t}']