Exemplo n.º 1
0
/* store */
static int unsigned_write(void *a, unsigned char *b)
{
	LTC_ARGCHK(a != NULL);
	LTC_ARGCHK(b != NULL);
	size_t len = unsigned_size(a);
	mpa_get_oct_str(b, &len, (const mpanum) a);
	return CRYPT_OK;
}
Exemplo n.º 2
0
/*
 * TEE_BigIntConvertToOctetString
 */
TEE_Result TEE_BigIntConvertToOctetString(uint8_t *buffer,
					  uint32_t *bufferLen,
					  const TEE_BigInt *bigInt)
{
	mpanum n = (mpa_num_base *)bigInt;
	size_t size = *bufferLen;
	TEE_Result res;

	if (mpa_get_oct_str(buffer, &size, n) != 0)
		res = TEE_ERROR_SHORT_BUFFER;
	else
		res = TEE_SUCCESS;

	*bufferLen = size;

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

	return res;
}