I am using Mbed library in my RSA signature verification algorithm.

However when setting signature with all zeros my program stucks.

after debugging it I see that it stuck at these lines of mbedtls_mpi_mod_mpi

```
while (ret_cmp >= (sint32)0)
{
ret = mbedtls_mpi_sub_mpi(R, R, B);
if (ret != (sint32)0)
{
break;
}
ret_cmp = mbedtls_mpi_cmp_mpi(R, B);
}
```

It never exists this loop as ret_cmp is always 1 and this continues over and over again.

Values are as follows:

1- R:

s: 1

n: 129

limbsPtr: 0x28f034

*limbsPtr:666908898

2-B:

s:1

n:64

limbsPtr: 0x28ea5c

*limbsPtr:1316850821

For sint32 mbedtls_mpi_cmp_mpi(const mbedtls_mpi* const X, const mbedtls_mpi* const Y)

this line is executed where X->s equals 1 so ret is returned as 1 and ret_cmp will always be 1 and it will never exit the loop

else

{

if (cntr > cntr2)

{

ret = X->s;

}

I am not sure if there is additional information needed or not.

Also it will be very helpful to give me some hints about meaning of structure mbedtls_mpi and what is limbs referring to.

Could you check this issue ASAP please?

Thanks in advance.