aes gcm Algorithm

Both GCM and GMAC can accept initialization vectors of arbitrary length. Different block cipher modes of operation can have significantly different performance and efficiency characteristics, even when used with the same block cipher.

aes gcm source code, pseudocode and analysis

This procedure is named function stitching, and while in principle it can be apply to any combination of cryptographic algorithms, GCM is particularly suitable. They show a plan generator that takes an annotated c version of a cryptographic algorithm and generates code that runs well on the target CPU.