static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, int max)
	{
	const unsigned char *p= *pp;
	unsigned long ret=0;
	unsigned int i;
	if (max-- < 1) return(0);
	if (*p == 0x80)
		{
		*inf=1;
		ret=0;
		p++;
		}
	else
		{
		*inf=0;
		i= *p&0x7f;
		if (*(p++) & 0x80)
			{
			if (max < (int)i)
				return 0;
			while (i && *p == 0)
				{
				p++;
				i--;
				}
			if (i > sizeof(long))
				return 0;
			while (i-- > 0)
				{
				ret<<=8L;
				ret|= *(p++);
				}
			}
		else
			ret=i;
		}
	if (ret > LONG_MAX)
		return 0;
	*pp=p;
	*rl=(long)ret;
	return(1);
	}
['static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, int max)\n\t{\n\tconst unsigned char *p= *pp;\n\tunsigned long ret=0;\n\tunsigned int i;\n\tif (max-- < 1) return(0);\n\tif (*p == 0x80)\n\t\t{\n\t\t*inf=1;\n\t\tret=0;\n\t\tp++;\n\t\t}\n\telse\n\t\t{\n\t\t*inf=0;\n\t\ti= *p&0x7f;\n\t\tif (*(p++) & 0x80)\n\t\t\t{\n\t\t\tif (max < (int)i)\n\t\t\t\treturn 0;\n\t\t\twhile (i && *p == 0)\n\t\t\t\t{\n\t\t\t\tp++;\n\t\t\t\ti--;\n\t\t\t\t}\n\t\t\tif (i > sizeof(long))\n\t\t\t\treturn 0;\n\t\t\twhile (i-- > 0)\n\t\t\t\t{\n\t\t\t\tret<<=8L;\n\t\t\t\tret|= *(p++);\n\t\t\t\t}\n\t\t\t}\n\t\telse\n\t\t\tret=i;\n\t\t}\n\tif (ret > LONG_MAX)\n\t\treturn 0;\n\t*pp=p;\n\t*rl=(long)ret;\n\treturn(1);\n\t}']