static void BN_POOL_release(BN_POOL *p, unsigned int num)
	{
	unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;
	p->used -= num;
	while(num--)
		{
		bn_check_top(p->current->vals + offset);
		if(!offset)
			{
			offset = BN_CTX_POOL_SIZE - 1;
			p->current = p->current->prev;
			}
		else
			offset--;
		}
	}
['int ec_GF2m_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *ctx)\n\t{\n\tint ret = -1;\n\tBN_CTX *new_ctx = NULL;\n\tBIGNUM *lh, *y2;\n\tint (*field_mul)(const EC_GROUP *, BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *);\n\tint (*field_sqr)(const EC_GROUP *, BIGNUM *, const BIGNUM *, BN_CTX *);\n\tif (EC_POINT_is_at_infinity(group, point))\n\t\treturn 1;\n\tfield_mul = group->meth->field_mul;\n\tfield_sqr = group->meth->field_sqr;\n\tif (!point->Z_is_one) return -1;\n\tif (ctx == NULL)\n\t\t{\n\t\tctx = new_ctx = BN_CTX_new();\n\t\tif (ctx == NULL)\n\t\t\treturn -1;\n\t\t}\n\tBN_CTX_start(ctx);\n\ty2 = BN_CTX_get(ctx);\n\tlh = BN_CTX_get(ctx);\n\tif (lh == NULL) goto err;\n\tif (!BN_GF2m_add(lh, &point->X, &group->a)) goto err;\n\tif (!field_mul(group, lh, lh, &point->X, ctx)) goto err;\n\tif (!BN_GF2m_add(lh, lh, &point->Y)) goto err;\n\tif (!field_mul(group, lh, lh, &point->X, ctx)) goto err;\n\tif (!BN_GF2m_add(lh, lh, &group->b)) goto err;\n\tif (!field_sqr(group, y2, &point->Y, ctx)) goto err;\n\tif (!BN_GF2m_add(lh, lh, y2)) goto err;\n\tret = BN_is_zero(lh);\n err:\n\tif (ctx) BN_CTX_end(ctx);\n\tif (new_ctx) BN_CTX_free(new_ctx);\n\treturn ret;\n\t}', 'BIGNUM *BN_CTX_get(BN_CTX *ctx)\n\t{\n\tBIGNUM *ret;\n\tCTXDBG_ENTRY("BN_CTX_get", ctx);\n\tif(ctx->err_stack || ctx->too_many) return NULL;\n\tif((ret = BN_POOL_get(&ctx->pool)) == NULL)\n\t\t{\n\t\tctx->too_many = 1;\n\t\tBNerr(BN_F_BN_CTX_GET,BN_R_TOO_MANY_TEMPORARY_VARIABLES);\n\t\treturn NULL;\n\t\t}\n\tBN_zero(ret);\n\tctx->used++;\n\tCTXDBG_RET(ctx, ret);\n\treturn ret;\n\t}', 'void BN_CTX_end(BN_CTX *ctx)\n\t{\n\tCTXDBG_ENTRY("BN_CTX_end", ctx);\n\tif(ctx->err_stack)\n\t\tctx->err_stack--;\n\telse\n\t\t{\n\t\tunsigned int fp = BN_STACK_pop(&ctx->stack);\n\t\tif(fp < ctx->used)\n\t\t\tBN_POOL_release(&ctx->pool, ctx->used - fp);\n\t\tctx->used = fp;\n\t\tctx->too_many = 0;\n\t\t}\n\tCTXDBG_EXIT(ctx);\n\t}', 'static void BN_POOL_release(BN_POOL *p, unsigned int num)\n\t{\n\tunsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;\n\tp->used -= num;\n\twhile(num--)\n\t\t{\n\t\tbn_check_top(p->current->vals + offset);\n\t\tif(!offset)\n\t\t\t{\n\t\t\toffset = BN_CTX_POOL_SIZE - 1;\n\t\t\tp->current = p->current->prev;\n\t\t\t}\n\t\telse\n\t\t\toffset--;\n\t\t}\n\t}']