Hi Enzo,
You mean as copying crypt_message() and adapt for AES-GMAC signing, instead of having the common parts in a separate function? I'll change that on v3, I just thought it'd be better to have less duplicate code.
..
Why wasting time to allocate/free a 12 byte buffer for every pdu? Can't we have a named structure and pass in a reference from the caller, which has it on the stack?
Got it. I'll fix this for v3.
For both just see this from line 624 up to 963.
https://git.samba.org/sfrench/cifs-2.6.git/?p=sfrench/cifs-2.6.git;a=blob;f=fs/cifs/smb2transport.c;h=4b912c75caa32d8f66a21286c5c28b982ea8efa1;hb=4b912c75caa32d8f66a21286c5c28b982ea8efa1#l624
I think smb2_sg_set_buf() should be moved to a header in order to avoid having it twice. The verify argument to smb311_calc_aes_gmac should be renamed to allocate_crypto in order match smb3_calc_aes_cmac(), and the logic related to allocate_crypto if most likely the fix, as you mentioned in the other mail. And all the huge comments should be removed, as it's now no longer mixed with signing and is relatively simple to follow... metze