mbedtls: Fix Z->s in mbedtls_mpi_exp_mod()
mbedtls: Fix Z->s in mbedtls_mpi_exp_mod()

Z->s should never be zero, only 1 or -1.
Added additional checks for X, Y and M args to correctly set Z->s.

Closes: https://github.com/espressif/esp-idf/issues/1681
Closes: https://github.com/espressif/esp-idf/issues/3603
Closes: IDFGH-1313

espressif/esp-idf,espressif/esp-idf,espressif/esp-idf,espressif/esp-idf