static EVP_PKEY *
load_netscape_key(BIO *err, BIO *key, const char *file,
		const char *key_descrip, int format)
	{
	EVP_PKEY *pkey;
	BUF_MEM *buf;
	RSA	*rsa;
	const unsigned char *p;
	int size, i;
	buf=BUF_MEM_new();
	pkey = EVP_PKEY_new();
	size = 0;
	if (buf == NULL || pkey == NULL)
		goto error;
	for (;;)
		{
		if (!BUF_MEM_grow_clean(buf,size+1024*10))
			goto error;
		i = BIO_read(key, &(buf->data[size]), 1024*10);
		size += i;
		if (i == 0)
			break;
		if (i < 0)
			{
				BIO_printf(err, "Error reading %s %s",
					key_descrip, file);
				goto error;
			}
		}
	p=(unsigned char *)buf->data;
	rsa = d2i_RSA_NET(NULL,&p,(long)size,NULL,
		(format == FORMAT_IISSGC ? 1 : 0));
	if (rsa == NULL)
		goto error;
	BUF_MEM_free(buf);
	EVP_PKEY_set1_RSA(pkey, rsa);
	return pkey;
error:
	BUF_MEM_free(buf);
	EVP_PKEY_free(pkey);
	return NULL;
	}
['static EVP_PKEY *\nload_netscape_key(BIO *err, BIO *key, const char *file,\n\t\tconst char *key_descrip, int format)\n\t{\n\tEVP_PKEY *pkey;\n\tBUF_MEM *buf;\n\tRSA\t*rsa;\n\tconst unsigned char *p;\n\tint size, i;\n\tbuf=BUF_MEM_new();\n\tpkey = EVP_PKEY_new();\n\tsize = 0;\n\tif (buf == NULL || pkey == NULL)\n\t\tgoto error;\n\tfor (;;)\n\t\t{\n\t\tif (!BUF_MEM_grow_clean(buf,size+1024*10))\n\t\t\tgoto error;\n\t\ti = BIO_read(key, &(buf->data[size]), 1024*10);\n\t\tsize += i;\n\t\tif (i == 0)\n\t\t\tbreak;\n\t\tif (i < 0)\n\t\t\t{\n\t\t\t\tBIO_printf(err, "Error reading %s %s",\n\t\t\t\t\tkey_descrip, file);\n\t\t\t\tgoto error;\n\t\t\t}\n\t\t}\n\tp=(unsigned char *)buf->data;\n\trsa = d2i_RSA_NET(NULL,&p,(long)size,NULL,\n\t\t(format == FORMAT_IISSGC ? 1 : 0));\n\tif (rsa == NULL)\n\t\tgoto error;\n\tBUF_MEM_free(buf);\n\tEVP_PKEY_set1_RSA(pkey, rsa);\n\treturn pkey;\nerror:\n\tBUF_MEM_free(buf);\n\tEVP_PKEY_free(pkey);\n\treturn NULL;\n\t}', 'BUF_MEM *BUF_MEM_new(void)\n\t{\n\tBUF_MEM *ret;\n\tret=OPENSSL_malloc(sizeof(BUF_MEM));\n\tif (ret == NULL)\n\t\t{\n\t\tBUFerr(BUF_F_BUF_MEM_NEW,ERR_R_MALLOC_FAILURE);\n\t\treturn(NULL);\n\t\t}\n\tret->length=0;\n\tret->max=0;\n\tret->data=NULL;\n\treturn(ret);\n\t}', 'void *CRYPTO_malloc(int num, const char *file, int line)\n\t{\n\tvoid *ret = NULL;\n\textern unsigned char cleanse_ctr;\n\tif (num < 0) return NULL;\n\tallow_customize = 0;\n\tif (malloc_debug_func != NULL)\n\t\t{\n\t\tallow_customize_debug = 0;\n\t\tmalloc_debug_func(NULL, num, file, line, 0);\n\t\t}\n\tret = malloc_ex_func(num,file,line);\n#ifdef LEVITTE_DEBUG_MEM\n\tfprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\\n", ret, num);\n#endif\n\tif (malloc_debug_func != NULL)\n\t\tmalloc_debug_func(ret, num, file, line, 1);\n        if(ret && (num > 2048))\n                ((unsigned char *)ret)[0] = cleanse_ctr;\n\treturn ret;\n\t}', 'void ERR_put_error(int lib, int func, int reason, const char *file,\n\t     int line)\n\t{\n\tERR_STATE *es;\n#ifdef _OSD_POSIX\n\tif (strncmp(file,"*POSIX(", sizeof("*POSIX(")-1) == 0) {\n\t\tchar *end;\n\t\tfile += sizeof("*POSIX(")-1;\n\t\tend = &file[strlen(file)-1];\n\t\tif (*end == \')\')\n\t\t\t*end = \'\\0\';\n\t\tif ((end = strrchr(file, \'/\')) != NULL)\n\t\t\tfile = &end[1];\n\t}\n#endif\n\tes=ERR_get_state();\n\tes->top=(es->top+1)%ERR_NUM_ERRORS;\n\tif (es->top == es->bottom)\n\t\tes->bottom=(es->bottom+1)%ERR_NUM_ERRORS;\n\tes->err_flags[es->top]=0;\n\tes->err_buffer[es->top]=ERR_PACK(lib,func,reason);\n\tes->err_file[es->top]=file;\n\tes->err_line[es->top]=line;\n\terr_clear_data(es,es->top);\n\t}', 'EVP_PKEY *EVP_PKEY_new(void)\n\t{\n\tEVP_PKEY *ret;\n\tret=(EVP_PKEY *)OPENSSL_malloc(sizeof(EVP_PKEY));\n\tif (ret == NULL)\n\t\t{\n\t\tEVPerr(EVP_F_EVP_PKEY_NEW,ERR_R_MALLOC_FAILURE);\n\t\treturn(NULL);\n\t\t}\n\tret->type=EVP_PKEY_NONE;\n\tret->references=1;\n\tret->pkey.ptr=NULL;\n\tret->attributes=NULL;\n\tret->save_parameters=1;\n\treturn(ret);\n\t}', 'void BUF_MEM_free(BUF_MEM *a)\n\t{\n\tif(a == NULL)\n\t    return;\n\tif (a->data != NULL)\n\t\t{\n\t\tmemset(a->data,0,(unsigned int)a->max);\n\t\tOPENSSL_free(a->data);\n\t\t}\n\tOPENSSL_free(a);\n\t}']