libtomcrypt
libtomcrypt copied to clipboard
Polish API `unsigned long outlen` vs. `unsigned long *outlen`
based on discussion in #171 I have found the following places where we IMO handle incosistently outlen
pelican_done(pelican_state *pelmac, unsigned char *out); /* missing outlen*/
crc32_finish(.... void *hash, unsigned long size); /* should be: unsigned long *size */
adler32_finish(.... void *hash, unsigned long size); /* should be: unsigned long *size */
Looking at these it also became obvious to me that there's different paradigms used for different classes of algorithms... like the XXhash_done()
functions always use the same signature as pelican_done()
and TBH I'm not sure yet how much I (dis)like that type of signature...
well i suppose in the case of crc32_finish it's clear that the result len will be 4 bytes, so there's no need to pass a pointer-to where the size is being written to by the callee.
well i suppose in the case of crc32_finish it's clear that the result len will be 4 bytes, so there's no need to pass a pointer-to where the size is being written to by the callee.
But it is exactly the same case in many mac/authenc functions returning a tag of fixed length (where we utilize unsigned long *outlen
parameter)