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


crypto/ec/ec_asn1.c:802:1: start of procedure ec_asn1_parameters2group()
800.   	}
801.   
802. > static EC_GROUP *ec_asn1_parameters2group(const ECPARAMETERS *params)
803.   	{
804.   	int			ok = 0, tmp;

crypto/ec/ec_asn1.c:804:2: 
802.   static EC_GROUP *ec_asn1_parameters2group(const ECPARAMETERS *params)
803.   	{
804. > 	int			ok = 0, tmp;
805.   	EC_GROUP		*ret = NULL;
806.   	BIGNUM			*p = NULL, *a = NULL, *b = NULL;

crypto/ec/ec_asn1.c:805:2: 
803.   	{
804.   	int			ok = 0, tmp;
805. > 	EC_GROUP		*ret = NULL;
806.   	BIGNUM			*p = NULL, *a = NULL, *b = NULL;
807.   	EC_POINT		*point=NULL;

crypto/ec/ec_asn1.c:806:2: 
804.   	int			ok = 0, tmp;
805.   	EC_GROUP		*ret = NULL;
806. > 	BIGNUM			*p = NULL, *a = NULL, *b = NULL;
807.   	EC_POINT		*point=NULL;
808.   	X9_62_CHARACTERISTIC_TWO *char_two = NULL;

crypto/ec/ec_asn1.c:807:2: 
805.   	EC_GROUP		*ret = NULL;
806.   	BIGNUM			*p = NULL, *a = NULL, *b = NULL;
807. > 	EC_POINT		*point=NULL;
808.   	X9_62_CHARACTERISTIC_TWO *char_two = NULL;
809.   	X9_62_PENTANOMIAL	*penta = NULL;

crypto/ec/ec_asn1.c:808:2: 
806.   	BIGNUM			*p = NULL, *a = NULL, *b = NULL;
807.   	EC_POINT		*point=NULL;
808. > 	X9_62_CHARACTERISTIC_TWO *char_two = NULL;
809.   	X9_62_PENTANOMIAL	*penta = NULL;
810.   	unsigned char		*pp;

crypto/ec/ec_asn1.c:809:2: 
807.   	EC_POINT		*point=NULL;
808.   	X9_62_CHARACTERISTIC_TWO *char_two = NULL;
809. > 	X9_62_PENTANOMIAL	*penta = NULL;
810.   	unsigned char		*pp;
811.   

crypto/ec/ec_asn1.c:812:7: Taking false branch
810.   	unsigned char		*pp;
811.   
812.   	if (!params->fieldID || !params->fieldID->fieldType || 
             ^
813.   	    !params->fieldID->parameters)
814.   		{

crypto/ec/ec_asn1.c:812:27: Taking false branch
810.   	unsigned char		*pp;
811.   
812.   	if (!params->fieldID || !params->fieldID->fieldType || 
                                 ^
813.   	    !params->fieldID->parameters)
814.   		{

crypto/ec/ec_asn1.c:813:7: Taking false branch
811.   
812.   	if (!params->fieldID || !params->fieldID->fieldType || 
813.   	    !params->fieldID->parameters)
             ^
814.   		{
815.   		ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, EC_R_ASN1_ERROR);

crypto/ec/ec_asn1.c:820:7: Taking false branch
818.   
819.   	/* now extract the curve parameters a and b */
820.   	if (!params->curve || !params->curve->a || 
             ^
821.   	    !params->curve->a->data || !params->curve->b ||
822.   	    !params->curve->b->data)

crypto/ec/ec_asn1.c:820:25: Taking false branch
818.   
819.   	/* now extract the curve parameters a and b */
820.   	if (!params->curve || !params->curve->a || 
                               ^
821.   	    !params->curve->a->data || !params->curve->b ||
822.   	    !params->curve->b->data)

crypto/ec/ec_asn1.c:821:7: Taking false branch
819.   	/* now extract the curve parameters a and b */
820.   	if (!params->curve || !params->curve->a || 
821.   	    !params->curve->a->data || !params->curve->b ||
             ^
822.   	    !params->curve->b->data)
823.   		{

crypto/ec/ec_asn1.c:821:34: Taking false branch
819.   	/* now extract the curve parameters a and b */
820.   	if (!params->curve || !params->curve->a || 
821.   	    !params->curve->a->data || !params->curve->b ||
                                        ^
822.   	    !params->curve->b->data)
823.   		{

crypto/ec/ec_asn1.c:822:7: Taking false branch
820.   	if (!params->curve || !params->curve->a || 
821.   	    !params->curve->a->data || !params->curve->b ||
822.   	    !params->curve->b->data)
             ^
823.   		{
824.   		ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, EC_R_ASN1_ERROR);

crypto/ec/ec_asn1.c:827:2: Skipping BN_bin2bn(): empty list of specs
825.   		goto err;
826.   		}
827.   	a = BN_bin2bn(params->curve->a->data, params->curve->a->length, NULL);
        ^
828.   	if (a == NULL)
829.   		{

crypto/ec/ec_asn1.c:828:6: Taking false branch
826.   		}
827.   	a = BN_bin2bn(params->curve->a->data, params->curve->a->length, NULL);
828.   	if (a == NULL)
            ^
829.   		{
830.   		ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_BN_LIB);

crypto/ec/ec_asn1.c:833:2: Skipping BN_bin2bn(): empty list of specs
831.   		goto err;
832.   		}
833.   	b = BN_bin2bn(params->curve->b->data, params->curve->b->length, NULL);
        ^
834.   	if (b == NULL)
835.   		{

crypto/ec/ec_asn1.c:834:6: Taking false branch
832.   		}
833.   	b = BN_bin2bn(params->curve->b->data, params->curve->b->length, NULL);
834.   	if (b == NULL)
            ^
835.   		{
836.   		ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_BN_LIB);

crypto/ec/ec_asn1.c:841:2: 
839.   
840.   	/* get the field parameters */
841. > 	tmp = OBJ_obj2nid(params->fieldID->fieldType);
842.   
843.   	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:843:6: Taking false branch
841.   	tmp = OBJ_obj2nid(params->fieldID->fieldType);
842.   
843.   	if (tmp == NID_X9_62_characteristic_two_field)
            ^
844.   		{
845.   		ASN1_TYPE *parameters = params->fieldID->parameters;

crypto/ec/ec_asn1.c:940:11: Taking false branch
938.   			}
939.   		}
940.   	else if (tmp == NID_X9_62_prime_field)
                 ^
941.   		{
942.   		/* we have a curve over a prime field */

crypto/ec/ec_asn1.c:966:6: Taking true branch
964.   
965.   	/* extract seed (optional) */
966.   	if (params->curve->seed != NULL)
            ^
967.   		{
968.   		if (ret->seed != NULL)

crypto/ec/ec_asn1.c:968:7: 
966.   	if (params->curve->seed != NULL)
967.   		{
968. > 		if (ret->seed != NULL)
969.   			OPENSSL_free(ret->seed);
970.   		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;
	X9_62_CHARACTERISTIC_TWO *char_two = NULL;
	X9_62_PENTANOMIAL	*penta = NULL;
	unsigned char		*pp;
	if (!params->fieldID || !params->fieldID->fieldType ||
	    !params->fieldID->parameters)
		{
		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)
		{
		ASN1_TYPE *parameters = params->fieldID->parameters;
		if (parameters->type !=  V_ASN1_SEQUENCE)
			{
			ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, EC_R_ASN1_ERROR);
			goto err;
			}
		if ((p = BN_new()) == NULL)
			{
			ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP,
			      ERR_R_MALLOC_FAILURE);
			goto err;
			}
		pp = M_ASN1_STRING_data(parameters->value.sequence);
		char_two = d2i_X9_62_CHARACTERISTIC_TWO(NULL,
			(const unsigned char **) &pp,
			M_ASN1_STRING_length(parameters->value.sequence));
		if (char_two == NULL)
			{
			ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_ASN1_LIB);
			goto err;
			}
		tmp = OBJ_obj2nid(char_two->basis);
		if (tmp ==  NID_X9_62_tpBasis)
			{
			long tmp_long;
			if (char_two->parameters->type != V_ASN1_INTEGER ||
				char_two->parameters->value.integer == NULL)
				{
				ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP,
					EC_R_ASN1_ERROR);
				goto err;
				}
			tmp_long = ASN1_INTEGER_get(char_two->parameters->value.integer);
			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)
			{
			if (char_two->parameters->type != V_ASN1_SEQUENCE ||
				char_two->parameters->value.sequence == NULL)
				{
				ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP,
					EC_R_ASN1_ERROR);
				goto err;
				}
			pp = M_ASN1_STRING_data(
				char_two->parameters->value.sequence);
			penta = d2i_X9_62_PENTANOMIAL(NULL,
				(const unsigned char **) &pp,
				M_ASN1_STRING_length(
				char_two->parameters->value.sequence));
			if (penta == NULL)
				{
				ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP,
					ERR_R_ASN1_LIB);
				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->parameters->type != V_ASN1_INTEGER ||
		    !params->fieldID->parameters->value.integer)
			{
			ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, EC_R_ASN1_ERROR);
			goto err;
			}
		p = ASN1_INTEGER_to_BN(params->fieldID->parameters->value.integer, 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->cofactor || !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;
	a = ASN1_INTEGER_to_BN(params->order, a);
	b = ASN1_INTEGER_to_BN(params->cofactor, b);
	if (!a || !b)
		{
		ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_ASN1_LIB);
		goto err;
		}
	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;
		}
	EC_GROUP_set_point_conversion_form(ret, (point_conversion_form_t)
				(params->base->data[0] & ~0x01));
	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);
	if (char_two)
		X9_62_CHARACTERISTIC_TWO_free(char_two);
	if (penta)
		X9_62_PENTANOMIAL_free(penta);
	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\tX9_62_CHARACTERISTIC_TWO *char_two = NULL;\n\tX9_62_PENTANOMIAL\t*penta = NULL;\n\tunsigned char\t\t*pp;\n\tif (!params->fieldID || !params->fieldID->fieldType ||\n\t    !params->fieldID->parameters)\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\tASN1_TYPE *parameters = params->fieldID->parameters;\n\t\tif (parameters->type !=  V_ASN1_SEQUENCE)\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\tif ((p = BN_new()) == NULL)\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\tpp = M_ASN1_STRING_data(parameters->value.sequence);\n\t\tchar_two = d2i_X9_62_CHARACTERISTIC_TWO(NULL,\n\t\t\t(const unsigned char **) &pp,\n\t\t\tM_ASN1_STRING_length(parameters->value.sequence));\n\t\tif (char_two == 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\ttmp = OBJ_obj2nid(char_two->basis);\n\t\tif (tmp ==  NID_X9_62_tpBasis)\n\t\t\t{\n\t\t\tlong tmp_long;\n\t\t\tif (char_two->parameters->type != V_ASN1_INTEGER ||\n\t\t\t\tchar_two->parameters->value.integer == NULL)\n\t\t\t\t{\n\t\t\t\tECerr(EC_F_EC_ASN1_PARAMETERS2GROUP,\n\t\t\t\t\tEC_R_ASN1_ERROR);\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\ttmp_long = ASN1_INTEGER_get(char_two->parameters->value.integer);\n\t\t\tif (!BN_set_bit(p, (int)char_two->m)) goto err;\n\t\t\tif (!BN_set_bit(p, (int)tmp_long)) 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_ppBasis)\n\t\t\t{\n\t\t\tif (char_two->parameters->type != V_ASN1_SEQUENCE ||\n\t\t\t\tchar_two->parameters->value.sequence == NULL)\n\t\t\t\t{\n\t\t\t\tECerr(EC_F_EC_ASN1_PARAMETERS2GROUP,\n\t\t\t\t\tEC_R_ASN1_ERROR);\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\tpp = M_ASN1_STRING_data(\n\t\t\t\tchar_two->parameters->value.sequence);\n\t\t\tpenta = d2i_X9_62_PENTANOMIAL(NULL,\n\t\t\t\t(const unsigned char **) &pp,\n\t\t\t\tM_ASN1_STRING_length(\n\t\t\t\tchar_two->parameters->value.sequence));\n\t\t\tif (penta == NULL)\n\t\t\t\t{\n\t\t\t\tECerr(EC_F_EC_ASN1_PARAMETERS2GROUP,\n\t\t\t\t\tERR_R_ASN1_LIB);\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,\n\t\t\t\tEC_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->parameters->type != V_ASN1_INTEGER ||\n\t\t    !params->fieldID->parameters->value.integer)\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->parameters->value.integer, 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->cofactor || !params->base ||\n\t    !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\ta = ASN1_INTEGER_to_BN(params->order, a);\n\tb = ASN1_INTEGER_to_BN(params->cofactor, b);\n\tif (!a || !b)\n\t\t{\n\t\tECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_ASN1_LIB);\n\t\tgoto err;\n\t\t}\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\tEC_GROUP_set_point_conversion_form(ret, (point_conversion_form_t)\n\t\t\t\t(params->base->data[0] & ~0x01));\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\tif (char_two)\n\t\tX9_62_CHARACTERISTIC_TWO_free(char_two);\n\tif (penta)\n\t\tX9_62_PENTANOMIAL_free(penta);\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}']