Home
last modified time | relevance | path

Searched hist:"7696 ab7fe0b24e5f9981bb1487d0ee8d529ea305" (Results 1 – 1 of 1) sorted by relevance

/optee_os/lib/libutee/
H A Dtee_api_arith_mpi.c7696ab7fe0b24e5f9981bb1487d0ee8d529ea305 Thu Mar 14 15:48:16 UTC 2019 Jens Wiklander <jens.wiklander@linaro.org> libutee: lessen dependency on mbedtls internals

Until now tee_api_arith_mpi.c assumed that for instance
TEE_BigIntConvertFromOctetString() wouldn't do a
mbedtls_mpi_free(mpi);
mbedtls_mpi_init(mpi);
sequence on the supplied mpi argument. Doing so replaces the special
allocation type MBEDTLS_MPI_ALLOC_TYPE_STATIC with
MBEDTLS_MPI_ALLOC_TYPE_MALLOC. This results in the value of the mpi
argument isn't propagated further to the dest argument of
TEE_BigIntConvertFromOctetString().

With this patch we're instead explicitly copying the value of
mbedtls_mpi to a TEE_BigInt when the value should be returned.

This patch is also needed when upgrading to mbedtls-2.16 or there will
be errors.

Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (QEMU, GP)
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>