Polish API unsigned long outlen vs. unsigned long *outlen #176

Open
opened 2017-03-23 14:01:18 -05:00 by karel-m · 3 comments
karel-m commented 2017-03-23 14:01:18 -05:00 (Migrated from github.com)

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 */
based on discussion in #171 I have found the following places where we IMO handle incosistently `outlen` ```C 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 */ ```
sjaeckel commented 2017-03-23 18:04:47 -05:00 (Migrated from github.com)

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...

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...
rofl0r commented 2017-03-23 18:16:03 -05:00 (Migrated from github.com)

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.
karel-m commented 2017-03-24 01:25:02 -05:00 (Migrated from github.com)

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)

> 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)
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-libtom/libtomcrypt#176
No description provided.