do some calculation on this bug number like encrypt it or xor it with some random data
i expect to get the exact number of bytes by the mbedtls_mpi_size
but if the first bytes appear to be 0 ( because my encryption ) im getting less bytes than expected .
( because the mbedtls_mpi_size dont count the leading zero )
Hi @tavitzur
Thank you for your question.
It is reasonable that you are not receiving same size, as the returned value is the size in bytes of the actual number.
The leading zeros are not part of the number.
Regards,
Mbed TLS Team member
Ron
Hi Tomer,
The size returned is the size of the bignum, in bytes.
If you want to have a buffer holding the value of the bignum, just have a maximal value of the original bignum, and the bignum after the operation you did.
Regards,
Mbed TLS Team member
Ron