In cryptography, Galois/Counter Mode (GCM) is a mode of operation for symmetric-key cryptographic block ciphers. The proposal was first published in 2007. The GCM algorithm belongs to the class of authenticated encryption with associated data (AEAD) methods. Given a key K, plaintext P, and associated data AD, GCM encrypts P to produce ciphertext C and an authentication tag T. T is computed from the ciphertext and the unencrypted associated data. A recipient who knows K can use the tag to verify that neither the ciphertext nor the associated data had been modified, and then decrypt the ciphertext to recover the plaintext. GCM uses a block cipher with a block size of 128 bits, (commonly AES-128) run in counter mode for encryption and uses arithmetic in the Galois field GF(2128) to compute the authentication tag, hence its name. Galois Message Authentication Code (GMAC) is an authentication-only variant of GCM that can form an incremental message authentication code. Both GCM and GMAC can accept initialization vectors of arbitrary length. Different block cipher modes of operation can have significantly different performance with the same block cipher. As a counter mode, GCM blocks are independent. This allows encryption and decryption to be parallelized, in contrast to modes like cipher block chaining (CBC) where each block relies on the previous one. GCM was explicitly designed to be patent-free.
Basic operation GCM operates as a counter mode block cipher to produce ciphertext. For authentication, the ciphertext blocks are treated as coefficients of a polynomial evaluated at a key-dependent point H using finite field arithmetic. The result is then encrypted, producing an authentication tag that can be used to verify the integrity of the data, so that the encrypted text has the IV, ciphertext, and authentication tag.
Mathematical basis GCM combines the counter mode of encryption with the Galois mode of authentication. The central feature is the ease of parallel computation of the Galois field multiplication used for authentication. This feature has higher throughput than encryption algorithms like CBC that use chaining modes. The GF(2128) field used is defined by the polynomial
x128+x7+x2+x+1. The authentication tag is constructed by feeding blocks of data into the GHASH function and encrypting the result. This GHASH function is defined by
GHASH(H,A,C)=Xm+n+1, where H=Ek(0128) is the hash key, a string of 128 zero bits encrypted using the block cipher; A is data that is only authenticated (not encrypted); C is the ciphertext; m is the number of 128-bit blocks in A (rounded up); n is the number of 128-bit blocks in C (rounded up); and the variable Xi for i=0,…m+n+1 is defined below. First, the authenticated text and the ciphertext are separately zero-padded to multiples of 128 bits and combined into a single message, Si, defined as
Si={Aifor i=1,…,m−1Am∗∥0128−vfor i=mCi−mfor i=m+1,…,m+n−1Cn∗∥0128−ufor i=m+nlen(A)∥len(C)for i=m+n+1, where len(A) and len(C) are the 64-bit representations of the bit lengths of A and C, respectively; v=len(A) mod 128 is the bit length of the final block of A; u=len(C) mod 128 is the bit length of the final block of C; and ∥ denotes concatenation of bit strings. Then, Xi is defined as:
Xi=∑j=1iSj⋅Hi−j+1={0for i=0(Xi−1⊕Si)⋅Hfor i=1,…,m+n+1. The second form is an efficient iterative algorithm (each Xi depends on Xi−1) produced by applying Horner's method to the first. Only the final Xm+n+1 stays an output. If it is necessary to parallelize the hash computation, this can be done by interleaving k times:
Xi'={0for i≤0(Xi−k'⊕Si)⋅Hkfor i=1,…,m+n+1−kXi=∑j=1k(Xi+j−2k'⊕Si+j−k)⋅Hk−j+1. If the length of the IV is not 96, the GHASH function is used to calculate Counter 0:
Counter0={IV∥031∥1for len(IV)=96GHASH(IV∥0s∥064∥len64(IV)) with s=128−len(IV)mod128otherwise. GCM was designed by John Viega and David A. McGrew as a development based on earlier counter-mode authenticated encryption designs, including Carter–Wegman counter mode (CWC mode). In November 2007, NIST announced the release of NIST Special Publication 800-38D Recommendation for Block Cipher Modes of Operation: Galois/Counter Mode (GCM) and GMAC, making GCM and GMAC official standards.
Use GCM mode is used in the IEEE 802.1AE (MACsec) Ethernet security, WPA3-Enterprise Wi-Fi security protocol, IEEE 802.11ad (also dubbed WiGig), ANSI (INCITS) Fibre Channel Security Protocols (FC-SP), IEEE P1619.1 tape storage, IETF IPsec standards, SSH, TLS 1.2 and TLS 1.3. AES-GCM is included in the NSA Suite B Cryptography and its latest replacement in 2018 Commercial National Security Algorithm (CNSA) suite. GCM mode is used in the SoftEther VPN server and client, as well as OpenVPN, where AES-GCM ciphers are available via configuration and cipher negotiation since version 2.4.
… excerpt ends here. Continue reading the full article.
