Hi Eugene,
The error you are receiving is MBEDTLS_ERR_ECP_VERIFY_FAILED
I have tried reproducing this with your changes, but I don’t get the failure.
I believe it is some platform related issue, most likely stack corruption with this larger curve.
Have you changed any other configuration from the default values?
Regards,
Mbed TLS Team member
Ron
I think this is platform specific error. In case of K82 it is not so clear how to disconnect LTC HW accelerator for that operations what can’t be accelerated due natural LTC HW limitations for ECC up to 512 bits only.
Finally. I’m able to pass those tests by disabling the next definitions:
So consistency of P-521 after that modifications are not so clear for now.
May be I should found extra P-521 relative tests for be sure if everything OK.
Or may be better to exclude LTC from picture at all and use pure genericSW implementation ?
Hi Eugene,
The definitions you showed me are not part of Mbed TLS configuration, and these are probably part of your own proprietary fork.
AS much as I would like to assist you, it seems you are working on an unsupported fork ( In addition Mbed TLS 2.6.0 is not an LTS branch), as I don’t know what other changes your codebase has compared to Mbed TLS.
However, since you disabled your alternative implementation, it is reasonable that you would not encounter failures, as you described that your LTC HW accelerator can’t work on p521 curve, and that the sw implementation should work.
Regards,
Mbed TLS Team member
Ron
I have taken mbedTLS variant what is part of standart SDK for NXP K82 MCU.
And just try to configure it in way where P-521 works with maximum performance.
I just wondering of mbedTLS 2.7.5 is better than 2.6.0 in case of P-521 ?
HI Eugene,
There weren’t many changes in P521 from 2.6.0 to 2.7.5 , however, 2.7.5 is from the Mbed TLS 2.7 LTS branch, which will receive bug fixes and security updates, so I recommend you update to 2.7 branch.
I also would like to ask you to do mbedTLS more friendly for low end MCU with simple MPU.
For run mbedTLS code with User priviledges, all global/static variables should be removed.
If they need , they should be defined as part of cryptosuites handlers for example.
For example ecp_curves.c has definition:
/*
Set an MPI to static value 1
*/
static inline void ecp_mpi_set1( mbedtls_mpi *X )
{
static mbedtls_mpi_uint one = { 1 }; // Static !!!
X->s = 1;
X->n = 1;
X->p = one;
}
It is possible to add this variable to mbedtls group to the end and populate it where it is need.