cmac+hash: change parameter types

For consistency and safety, change the CMC and HSH functions to accept
signed lengths and handle negative values as errors. Also, change the
input data type to void * to not require casting in the caller.
This commit is contained in:
Miroslav Lichvar
2020-07-08 12:02:12 +02:00
parent de4ecc72d1
commit d93aa10bac
13 changed files with 64 additions and 53 deletions

6
hash.h
View File

@@ -48,10 +48,8 @@ typedef enum {
extern int HSH_GetHashId(HSH_Algorithm algorithm);
extern unsigned int HSH_Hash(int id,
const unsigned char *in1, unsigned int in1_len,
const unsigned char *in2, unsigned int in2_len,
unsigned char *out, unsigned int out_len);
extern int HSH_Hash(int id, const void *in1, int in1_len, const void *in2, int in2_len,
unsigned char *out, int out_len);
extern void HSH_Finalise(void);