Closed mabuchner closed 3 weeks ago
In various places libtomcrypt tries to use a constant src
, but it then has to cast away the constness in order to call the unsigned_read
function. E.g. see this
tomcrypt_math.h lacks const in quite a number of places. I supposed this is driven by tomsfastmath, which is also seriously lacking in similar cases (although interestingly enough, fp_read_unsigned_bin
is properly constified, so there's really no excuse for unsigned_bin
...
Things have evolved to become a full constification effort, in #667
The
ltc_math_descriptor.unsigned_read
function pointer has a non-constsrc
pointer argument, which the function is not supposed to modifyhttps://github.com/libtom/libtomcrypt/blob/673f5ce29015a9bba3c96792920a10601b5b0718/src/headers/tomcrypt_math.h#L179
This is error prone as one might accidentally swap dst and src.
The src pointer should get marked as
const
.