I want to use the wiki UMAC example to protect the integrity of the communication between 2 devices. Unfortunately I am not quite sure of the meaning of the parameters and I don't want to get it wrong:
The following C function generates a 24 bit UMAC. It assumes that secret is a multiple of 24 bits, msg is not longer than secret and result already contains the 24 secret bits e.g. f(nonce). nonce does not need to be contained in msg.
void UHash24 (uchar *msg, uchar *secret, int len, uchar *result) - msg - my message
- secret I assume it is the secret Key (present on both devices) 16 byte key which I'll duplicate as many times as necessary to make it bigger than the msg length.
- len - the msg length
- result - here I don't understand what f(nonce) mean - I have a 4 byte nonce - I assume that I should make a function to convert it to 3 byte?
I have seen in another post that secret should be f(nonce, Key) - is this a good suggestion? (f could be Tea algorithm)
Can I use the same f function, get only 3 bytes and use it for the result parameter?