Hmm, that's a weird place to crash. I doubt that this has anything to do
with 32-bit vs 64-bit. It looks like memory corruption. Perhaps an
uninitialized variable or a use-after-free. I suggest trying to run your
code with Asan
(https://github.com/google/sanitizers/wiki/AddressSanitizer) and Msan
(https://github.com/google/sanitizers/wiki/MemorySanitizer), both
natively available on Ubuntu, they tend to be good at finding this kind
of issues (we use them quite a bit when we're working on Mbed TLS, as
well as in our CI).
Best regards,
--
Gilles Peskine
Mbed TLS developer
On 26/04/2024 19:05, blaine via mbed-tls wrote:
> hello:
> Recently, I am transplanting mbedtls from a 32-bit system to a
> 64-bit system. The compilation operating system is ubuntu20.4. The
> screenshot below is the code I use mbedtls(version number: 2.24.0). In
> the API mbedtls_rsa_gen_key implementation, there is a line of code
> that is ""MBEDTLS_MPI_CHK( mbedtls_mpi_lset( &ctx ->E, exponent )
> );"", the program crashed at the memset in mbedtls_mpi_set during
> execution. This has not happened on 32-bit platforms before, so I
> would like to ask whether it has something to do with the platform
> used or whether I call the API. It’s a question about how to use it,
> thank you very much
>
>
>