src of unsigned_read should be const
mabuchner opened this issue · comments
The ltc_math_descriptor.unsigned_read
function pointer has a non-const src
pointer argument, which the function is not supposed to modify
libtomcrypt/src/headers/tomcrypt_math.h
Line 179 in 673f5ce
This is error prone as one might accidentally swap dst and src.
The src pointer should get marked as const
.
int (*unsigned_read)(void *dst,
const unsigned char *src,
unsigned long len);
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
libtomcrypt/src/pk/ecc/ecc_verify_hash.c
Line 78 in 673f5ce