Modular add/sub/mul incorrect result if result and modulus pointer are equal

Werner Koch wk at gnupg.org
Fri Jun 2 11:27:46 CEST 2023


On Fri,  2 Jun 2023 03:20, Guido Vranken said:
> In the following program, the results of addm, subm or mulm are all zero,
> but should be 6, 5 and 1, respectively.

I modified the included mpicalc program (patch against 1.10 attached) to
allow for addm and subm but can't replicate your findings.:

$ mpicalc
2
4
7
M+pc
06
2 
4
7
M-pc
05
2
4
7
mpc
01

I have not checked your code, though.


Shalom-Salam,

   Werner

-- 
The pioneers of a warless world are the youth that
refuse military service.             - A. Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-mpicalc-Allow-for-addm-and-subm.patch
Type: text/x-diff
Size: 2860 bytes
Desc: not available
URL: <https://lists.gnupg.org/pipermail/gcrypt-devel/attachments/20230602/4e022f94/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: <https://lists.gnupg.org/pipermail/gcrypt-devel/attachments/20230602/4e022f94/attachment.sig>


More information about the Gcrypt-devel mailing list