Example #1
0
/*------------------------------------------------------------
 *
 *  mpa_alloc_static_temp_var
 *
 */
mpanum mpa_alloc_static_temp_var(mpanum *var, mpa_scratch_mem pool)
{
	int idx;
	mpa_num_base *tvar;

	idx = 0;
	tvar = (void *)pool->m;
	while (tvar->alloc != 0 && idx < pool->nrof_vars) {
		tvar =
		    (void *)&pool->m[idx *
				     mpa_StaticTempVarSizeInU32(pool->
								bit_size)];
		idx++;
	}
	if ((4 < tvar->alloc) != 0) {
		DPRINT("Out of temp vars. Dumping pattern : 0x%X\n",
		       __mpa_get_alloced_pattern(pool));
		DPRINT("TOO SMALL SCRATCH MEM AREA. THIS MUST NOT HAPPEN!\n");
		return NULL;
	}
	*var = tvar;
	mpa_init_static(*var, mpa_StaticTempVarSizeInU32(pool->bit_size));
	return *var;
}
/*
 * TEE_BigIntInit
 */
void TEE_BigIntInit(TEE_BigInt *bigInt, uint32_t len)
{
	mpa_init_static((mpa_num_base *)bigInt, (uint32_t)len);
}