Topic: [SOLVED] How to use the AES-GCM mode of operation?
Hi,
I want to use the AES-GCM mode for encryption/decryption. The manual refers to the aesgcm_test() function in <cyassl_root>/ctaocrypt/test/test.c as an example, however it is difficult to understand what the different parameters are in the code as there are no comments.
More specifically, what are the arguments in the following functions supposed to be?
AesGcmSetKey(&enc, k, sizeof(k));
AesGcmEncrypt(&enc, c2, p, sizeof(c2), iv, sizeof(iv), t2, sizeof(t2), a, sizeof(a));
AesGcmDecrypt(&enc, p2, c2, sizeof(p2), iv, sizeof(iv), t2, sizeof(t2), a, sizeof(a));
I guess k is the key and iv is obvious as well. c2, p2 and t2 are ciphertext, plaintext and tag buffers probably (not sure tbh), but what is supposed to be put in p and a? One of these should be for the original plaintext to be encrypted, i think ... but what about the other one? Can anyone please help with a detailed clarification? Thanks.