示例#1
0
/* read */
static int unsigned_read(void *a, unsigned char *b, unsigned long len)
{
	LTC_ARGCHK(a != NULL);
	LTC_ARGCHK(b != NULL);
	mpa_set_oct_str((mpanum) a, b, len, 0);
	return CRYPT_OK;
}
/*
 * TEE_BigIntConvertFromOctetString
 */
TEE_Result TEE_BigIntConvertFromOctetString(TEE_BigInt *dest,
					    const uint8_t *buffer,
					    uint32_t bufferLen,
					    int32_t sign)
{
	TEE_Result res;
	mpanum mpa_dest = (mpa_num_base *)dest;
	bool negative = sign < 0;

	if (mpa_set_oct_str(mpa_dest, buffer, bufferLen, negative) != 0)
		res = TEE_ERROR_OVERFLOW;
	else
		res = TEE_SUCCESS;

	if (res != TEE_SUCCESS &&
	    res != TEE_ERROR_OVERFLOW)
		TEE_Panic(res);

	return res;
}