<div dir="ltr"><div>In the program below, the result of the computation -5 - 2 should be -7, but it is 7.</div><div><br></div><div>Compare with the behavior of gcry_mpi_add_ui and gcry_mpi_mul_ui (commented), which do produce a negative result, as they should.</div><div><br></div><div>This was tested on the latest repository checkout.<br></div><div><br></div><div>#include <gcrypt.h></div><br>#define CF_CHECK_EQ(expr, res) if ( (expr) != (res) ) { goto end; }<br><br>int main(void)<br>{<br>    gcry_mpi_t A;<br>    gcry_mpi_t res;<br>    gcry_error_t err;<br>    char *buf;<br><br>    CF_CHECK_EQ(err = gcry_mpi_scan(&A, GCRYMPI_FMT_HEX, "-5", 0, NULL), 0);<br>    CF_CHECK_EQ(err = gcry_mpi_scan(&res, GCRYMPI_FMT_HEX, "0", 0, NULL), 0);<br>    gcry_mpi_sub_ui(res, A, 2);<br>    //gcry_mpi_add_ui(res, A, 2);<br>    //gcry_mpi_mul_ui(res, A, 2);<br>    CF_CHECK_EQ(err = gcry_mpi_aprint(GCRYMPI_FMT_HEX, (unsigned char**)&buf, NULL, res), 0);<br>    printf("%s\n", buf);<br>end:<br><br>    return 0;<br>}<br></div>