mirror of
https://github.com/cryb-to/cryb-to.git
synced 2024-11-15 02:05:40 +00:00
a09cdc6318
The count we passed to memcmp() in mpi_eq() and mpi_eq_abs() was actually the number of significant words in the MPI, rather than the number of bytes we wanted to compare. Multiply by 4 to get the correct value. To make the intent of the code more apparent, introduce a private MPI_MSW() macro which evaluates to the number of significant words (or 1-based index of the most significant word). This also comes in handy in mpi_{add,sub,mul}_abs(). Add a couple of test cases which not only demonstrate the bug we fixed here but also demonstrate why we must compare whole words: on a big-endian machine, we would be comparing the unused upper bytes of the first and only word instead of the lower bytes which actually hold a value... |
||
---|---|---|
.. | ||
cipher | ||
core | ||
cpe | ||
digest | ||
enc | ||
hash | ||
mac | ||
mpi | ||
oath | ||
rand | ||
rsaref | ||
test | ||
Makefile.am |