Ghash
   HOME

TheInfoList



OR:

In
cryptography Cryptography, or cryptology (from grc, , translit=kryptós "hidden, secret"; and ''graphein'', "to write", or ''-logia'', "study", respectively), is the practice and study of techniques for secure communication in the presence of adver ...
, Galois/Counter Mode (GCM) is a
mode of operation In cryptography, a block cipher mode of operation is an algorithm that uses a block cipher to provide information security such as confidentiality or authenticity. A block cipher by itself is only suitable for the secure cryptographic transform ...
for symmetric-key cryptographic
block cipher In cryptography, a block cipher is a deterministic algorithm operating on fixed-length groups of bits, called ''blocks''. Block ciphers are specified cryptographic primitive, elementary components in the design of many cryptographic protocols and ...
s which is widely adopted for its performance. GCM throughput rates for state-of-the-art, high-speed communication channels can be achieved with inexpensive hardware resources. The operation is an
authenticated encryption Authenticated Encryption (AE) and Authenticated Encryption with Associated Data (AEAD) are forms of encryption which simultaneously assure the confidentiality and authenticity of data. Programming interface A typical application programming in ...
algorithm In mathematics and computer science, an algorithm () is a finite sequence of rigorous instructions, typically used to solve a class of specific Computational problem, problems or to perform a computation. Algorithms are used as specificat ...
designed to provide both data authenticity (integrity) and confidentiality. GCM is defined for block ciphers with a block size of 128 bits. Galois Message Authentication Code (GMAC) is an authentication-only variant of the GCM which can form an incremental
message authentication code In cryptography, a message authentication code (MAC), sometimes known as a ''tag'', is a short piece of information used for authenticating a message. In other words, to confirm that the message came from the stated sender (its authenticity) and ...
. 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. GCM can take full advantage of parallel processing and implementing GCM can make efficient use of an
instruction pipeline In computer engineering, instruction pipelining or ILP is a technique for implementing instruction-level parallelism within a single processor. Pipelining attempts to keep every part of the processor busy with some instruction by dividing inco ...
or a hardware pipeline. By contrast, the
cipher block chaining In cryptography, a block cipher mode of operation is an algorithm that uses a block cipher to provide information security such as confidentiality or authenticity. A block cipher by itself is only suitable for the secure cryptographic transforma ...
(CBC) mode of operation incurs
pipeline stall In the design of pipelined computer processors, a pipeline stall is a delay in execution of an instruction in order to resolve a hazard. Details In a standard five-stage pipeline, during the decoding stage, the control unit will determine whe ...
s that hamper its efficiency and performance.


Basic operation

Like in normal
counter mode In cryptography, a block cipher mode of operation is an algorithm that uses a block cipher to provide information security such as confidentiality or authenticity. A block cipher by itself is only suitable for the secure cryptographic transforma ...
, blocks are numbered sequentially, and then this block number is combined with an
initialization vector In cryptography, an initialization vector (IV) or starting variable (SV) is an input to a cryptographic primitive being used to provide the initial state. The IV is typically required to be random or pseudorandom, but sometimes an IV only needs to ...
(IV) and encrypted with a block cipher , usually AES. The result of this encryption is then
XORed Exclusive or or exclusive disjunction is a Logical connective, logical operation that is true if and only if its arguments differ (one is true, the other is false). It is Table of logic symbols, symbolized by the prefix operator J and by the ...
with the
plaintext In cryptography, plaintext usually means unencrypted information pending input into cryptographic algorithms, usually encryption algorithms. This usually refers to data that is transmitted or stored unencrypted. Overview With the advent of comp ...
to produce the
ciphertext In cryptography, ciphertext or cyphertext is the result of encryption performed on plaintext using an algorithm, called a cipher. Ciphertext is also known as encrypted or encoded information because it contains a form of the original plaintext ...
. Like all counter modes, this is essentially a
stream cipher stream cipher is a symmetric key cipher where plaintext digits are combined with a pseudorandom cipher digit stream (keystream). In a stream cipher, each plaintext digit is encrypted one at a time with the corresponding digit of the keystream ...
, and so it is essential that a different IV is used for each stream that is encrypted. The ciphertext blocks are considered coefficients of a
polynomial In mathematics, a polynomial is an expression consisting of indeterminates (also called variables) and coefficients, that involves only the operations of addition, subtraction, multiplication, and positive-integer powers of variables. An exa ...
which is then evaluated at a key-dependent point , using
finite field arithmetic In mathematics, finite field arithmetic is arithmetic in a finite field (a field containing a finite number of elements) contrary to arithmetic in a field with an infinite number of elements, like the field of rational numbers. There are infin ...
. The result is then encrypted, producing an authentication tag that can be used to verify the integrity of the data. The encrypted text then contains the IV, ciphertext, and authentication tag.


Mathematical basis

GCM combines the well-known
counter mode In cryptography, a block cipher mode of operation is an algorithm that uses a block cipher to provide information security such as confidentiality or authenticity. A block cipher by itself is only suitable for the secure cryptographic transforma ...
of encryption with the new Galois mode of authentication. The key-feature is the ease of parallel-computation of the
Galois field In mathematics, a finite field or Galois field (so-named in honor of Évariste Galois) is a field that contains a finite number of elements. As with any field, a finite field is a set on which the operations of multiplication, addition, subtra ...
multiplication used for authentication. This feature permits higher throughput than encryption algorithms, like CBC, which use chaining modes. The GF(2128) field used is defined by the polynomial : x^ + x^7 + x^2 + 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 : \text(H,A,C) = X_ where ''H'' = ''Ek''(0128) is the Hash Key, a string of 128 zero bits encrypted using the
block cipher In cryptography, a block cipher is a deterministic algorithm operating on fixed-length groups of bits, called ''blocks''. Block ciphers are specified cryptographic primitive, elementary components in the design of many cryptographic protocols and ...
, ''A'' is data which is only authenticated (not encrypted), ''C'' is the
ciphertext In cryptography, ciphertext or cyphertext is the result of encryption performed on plaintext using an algorithm, called a cipher. Ciphertext is also known as encrypted or encoded information because it contains a form of the original plaintext ...
, ''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 is defined below. First, the authenticated text and the cipher text are separately zero-padded to multiples of 128 bits and combined into a single message ''Si'': : S_i = \begin A_i & \texti = 1, \ldots, m - 1 \\ A^*_m \parallel 0^ & \texti = m \\ C_ & \texti = m + 1, \ldots, m + n - 1 \\ C^*_n \parallel 0^& \texti = m + n \\ \operatorname(A) \parallel \operatorname(C) & \texti = m + n + 1 \end 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 \parallel denotes concatenation of bit strings. Then ''Xi'' is defined as: : X_i = \sum_^i S_j \cdot H^ = \begin 0 & \texti=0 \\ \left(X_ \oplus S_i\right) \cdot H & \text i = 1, \ldots, m + n + 1 \end The second form is an efficient iterative algorithm (each ''Xi'' depends on ''X''''i''−1) produced by applying
Horner's method In mathematics and computer science, Horner's method (or Horner's scheme) is an algorithm for polynomial evaluation. Although named after William George Horner, this method is much older, as it has been attributed to Joseph-Louis Lagrange by Hor ...
to the first. Only the final ''X''''m''+''n''+1 remains an output. If it is necessary to parallelize the hash computation, this can be done by interleaving ''k'' times: : \begin X^'_i & = \begin 0 & \texti \leq 0 \\ \left(X^'_ \oplus S_i \right) \cdot H^k & \text i = 1, \ldots, m + n + 1 - k \\ \end \\ pt X_i & = \sum_^k \left( X^'_ \oplus S_ \right) \cdot H^ \end If the length of the IV is not 96, the GHASH function is used to calculate ''Counter 0'': : \begin Counter 0 = \begin IV \parallel 0^ \parallel 1 & \text len(IV) = 96 \\ \text( \ IV \parallel 0^ \ \parallel \ 0^ \parallel len_(IV) \ ) \text s = ( 128 - ( len(IV) \mod 128 )) \mod 128 & \text \end \end GCM was designed by
John Viega John Viega (born February 22, 1974) is an American computer security author, researcher and professional. Early life He earned his BA from the University of Virginia. As an undergraduate, he worked in Randy Pausch's Stage 3 Research Group, as an ...
and David A. McGrew to be an improvement to Carter–Wegman counter mode (CWC mode). In November 2007,
NIST The National Institute of Standards and Technology (NIST) is an agency of the United States Department of Commerce whose mission is to promote American innovation and industrial competitiveness. NIST's activities are organized into physical sci ...
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 IEEE 802.1AE (also known as MACsec) is a network security standard that operates at the medium access control layer and defines connectionless data confidentiality and integrity for media access independent protocols. It is standardized by the I ...
(MACsec) Ethernet security, IEEE 802.11ad (also dubbed
WiGig WiGig, alternatively known as 60 GHz Wi-Fi, refers to a set of 60 GHz wireless network protocols. It includes the current IEEE 802.11ad standard and also the IEEE 802.11ay standard. The WiGig specification allows devices to communicate wi ...
), ANSI (
INCITS The InterNational Committee for Information Technology Standards (INCITS), (pronounced "insights"), is an ANSI-accredited standards development organization composed of Information technology developers. It was formerly known as the X3 and NCITS. ...
)
Fibre Channel Fibre Channel (FC) is a high-speed data transfer protocol providing in-order, lossless delivery of raw block data. Fibre Channel is primarily used to connect computer data storage to servers in storage area networks (SAN) in commercial data cen ...
Security Protocols (FC-SP),
IEEE P1619 Institute of Electrical and Electronics Engineers (IEEE) standardization project for encryption of stored data, but more generically refers to the Security in Storage Working Group (SISWG), which includes a family of standards for protection of st ...
.1 tape storage,
IETF The Internet Engineering Task Force (IETF) is a standards organization for the Internet and is responsible for the technical standards that make up the Internet protocol suite (TCP/IP). It has no formal membership roster or requirements and a ...
IPsec In computing, Internet Protocol Security (IPsec) is a secure network protocol suite that authenticates and encrypts packets of data to provide secure encrypted communication between two computers over an Internet Protocol network. It is used in ...
standards,
SSH The Secure Shell Protocol (SSH) is a cryptographic network protocol for operating network services securely over an unsecured network. Its most notable applications are remote login and command-line execution. SSH applications are based on ...
, TLS 1.2 and TLS 1.3. AES-GCM is included in the
NSA Suite B Cryptography NSA Suite B Cryptography was a set of cryptographic algorithms promulgated by the National Security Agency as part of its Cryptographic Modernization Program. It was to serve as an interoperable cryptographic base for both unclassified informati ...
and its latest replacement in 2018 Commercial National Security Algorithm (CNSA) suite. GCM mode is used in the
SoftEther VPN SoftEther VPN is free open-source, cross-platform, multi-protocol VPN client and VPN server software, developed as part of Daiyuu Nobori's master's thesis research at the University of Tsukuba. VPN protocols such as SSL VPN, L2TP/IPsec, OpenVPN, ...
server and client, as well as
OpenVPN OpenVPN is a virtual private network (VPN) system that implements techniques to create secure point-to-point or site-to-site connections in routed or bridged configurations and remote access facilities. It implements both client and server appl ...
since version 2.4.


Performance

GCM requires one block cipher operation and one 128-bit multiplication in the
Galois field In mathematics, a finite field or Galois field (so-named in honor of Évariste Galois) is a field that contains a finite number of elements. As with any field, a finite field is a set on which the operations of multiplication, addition, subtra ...
per each block (128 bit) of encrypted and authenticated data. The block cipher operations are easily pipelined or parallelized; the multiplication operations are easily pipelined and can be parallelized with some modest effort (either by parallelizing the actual operation, by adapting
Horner's method In mathematics and computer science, Horner's method (or Horner's scheme) is an algorithm for polynomial evaluation. Although named after William George Horner, this method is much older, as it has been attributed to Joseph-Louis Lagrange by Hor ...
per the original NIST submission, or both). Intel has added the PCLMULQDQ instruction, highlighting its use for GCM. In 2011, SPARC added the XMULX and XMULXHI instructions, which also perform 64 × 64 bit
carry-less multiplication The carry-less product of two binary numbers is the result of carry-less multiplication of these numbers. This operation conceptually works like long multiplication except for the fact that the carry is discarded instead of applied to the more s ...
. In 2015, SPARC added the XMPMUL instruction, which performs XOR multiplication of much larger values, up to 2048 × 2048 bit input values producing a 4096-bit result. These instructions enable fast multiplication over GF(2''n''), and can be used with any field representation. Impressive performance results are published for GCM on a number of platforms. Käsper and Schwabe described a "Faster and Timing-Attack Resistant AES-GCM" that achieves 10.68 cycles per byte AES-GCM authenticated encryption on 64-bit Intel processors. Dai et al. report 3.5 cycles per byte for the same algorithm when using Intel's AES-NI and PCLMULQDQ instructions. Shay Gueron and Vlad Krasnov achieved 2.47 cycles per byte on the 3rd generation Intel processors. Appropriate patches were prepared for the
OpenSSL OpenSSL is a software library for applications that provide secure communications over computer networks against eavesdropping or need to identify the party at the other end. It is widely used by Internet servers, including the majority of HTT ...
and NSS libraries. When both authentication and encryption need to be performed on a message, a software implementation can achieve speed gains by overlapping the execution of those operations. Performance is increased by exploiting
instruction-level parallelism Instruction-level parallelism (ILP) is the parallel or simultaneous execution of a sequence of instructions in a computer program. More specifically ILP refers to the average number of instructions run per step of this parallel execution. Discu ...
by interleaving operations. This process is called function stitching, and while in principle it can be applied to any combination of cryptographic algorithms, GCM is especially suitable. Manley and Gregg show the ease of optimizing when using function stitching with GCM. They present a program generator that takes an annotated C version of a cryptographic algorithm and generates code that runs well on the target processor. GCM has been criticized for example by Silicon Labs in the embedded world because the parallel processing isn't suited for performant use of cryptographic hardware engines and therefore reduces the performance of encryption for some of the most performance-sensitive devices.


Patents

According to the authors' statement, GCM is unencumbered by patents.


Security

GCM is proven secure in the concrete security model. It is secure when it is used with a block cipher that is indistinguishable from a random permutation; however, security depends on choosing a unique
initialization vector In cryptography, an initialization vector (IV) or starting variable (SV) is an input to a cryptographic primitive being used to provide the initial state. The IV is typically required to be random or pseudorandom, but sometimes an IV only needs to ...
for every encryption performed with the same key (''see''
stream cipher attack Stream ciphers, where plaintext bits are combined with a cipher bit stream by an exclusive-or operation ( xor), can be very secure if used properly. However, they are vulnerable to attacks if certain precautions are not followed: *keys must neve ...
). For any given key and initialization vector combination, GCM is limited to encrypting bits of plain text (64 GiB). NIST Special Publication 800-38D includes guidelines for initialization vector selection. The authentication strength depends on the length of the authentication tag, like with all symmetric message authentication codes. The use of shorter authentication tags with GCM is discouraged. The bit-length of the tag, denoted ''t'', is a security parameter. In general, ''t'' may be any one of the following five values: 128, 120, 112, 104, or 96. For certain applications, ''t'' may be 64 or 32, but the use of these two tag lengths constrains the length of the input data and the lifetime of the key. Appendix C in NIST SP 800-38D provides guidance for these constraints (for example, if and the maximal packet size is 210 bytes, the authentication decryption function should be invoked no more than 211 times; if and the maximal packet size is 215 bytes, the authentication decryption function should be invoked no more than 232 times). Like with any message authentication code, if the adversary chooses a ''t''-bit tag at random, it is expected to be correct for given data with probability measure 2−''t''. With GCM, however, an adversary can increase their likelihood of success by choosing tags with n words – the total length of the ciphertext plus any additional authenticated data (AAD) – with probability measure 2−''t'' by a factor of n. Although, one must bear in mind that these optimal tags are still dominated by the algorithm's survival measure for arbitrarily large ''t''. Moreover, GCM is neither well-suited for use with very short tag-lengths nor very long messages. Ferguson and Saarinen independently described how an attacker can perform optimal attacks against GCM authentication, which meet the lower bound on its security. Ferguson showed that, if ''n'' denotes the total number of blocks in the encoding (the input to the GHASH function), then there is a method of constructing a targeted ciphertext forgery that is expected to succeed with a probability of approximately ''n''⋅2−''t''. If the tag length ''t'' is shorter than 128, then each successful forgery in this attack increases the probability that subsequent targeted forgeries will succeed, and leaks information about the hash subkey, ''H''. Eventually, ''H'' may be compromised entirely and the authentication assurance is completely lost.Niels Ferguson
Authentication Weaknesses in GCM
2005-05-20
Independent of this attack, an adversary may attempt to systematically guess many different tags for a given input to authenticated decryption and thereby increase the probability that one (or more) of them, eventually, will be considered valid. For this reason, the system or protocol that implements GCM should monitor and, if necessary, limit the number of unsuccessful verification attempts for each key. Saarinen described GCM
weak key In cryptography, a weak key is a key, which, used with a specific cipher, makes the cipher behave in some undesirable way. Weak keys usually represent a very small fraction of the overall keyspace, which usually means that, if one generates a rando ...
s. This work gives some valuable insights into how polynomial hash-based authentication works. More precisely, this work describes a particular way of forging a GCM message, given a valid GCM message, that works with probability of about for messages that are bits long. However, this work does not show a more effective attack than was previously known; the success probability in observation 1 of this paper matches that of lemma 2 from the INDOCRYPT 2004 analysis (setting and ). Saarinen also described a GCM variant
Sophie Germain Counter Mode A new mode called Sophie Germain Counter Mode (SGCM) has been proposed as a variant of the Galois/Counter Mode of operation for block ciphers. Instead of the binary field GF(2128), it uses modular arithmetic in GF(''p'') where ''p'' is a safe pr ...
(SGCM) based on
Sophie Germain prime In number theory, a prime number ''p'' is a if 2''p'' + 1 is also prime. The number 2''p'' + 1 associated with a Sophie Germain prime is called a . For example, 11 is a Sophie Germain prime and 2 × 11 +  ...
s.


See also

*
Authenticated encryption Authenticated Encryption (AE) and Authenticated Encryption with Associated Data (AEAD) are forms of encryption which simultaneously assure the confidentiality and authenticity of data. Programming interface A typical application programming in ...
*
Block cipher mode of operation In cryptography, a block cipher mode of operation is an algorithm that uses a block cipher to provide information security such as confidentiality or authenticity. A block cipher by itself is only suitable for the secure cryptographic transform ...
*
AES-GCM-SIV AES-GCM-SIV is a mode of operation for the Advanced Encryption Standard which provides similar performance to Galois/Counter Mode as well as misuse resistance in the event of the reuse of a cryptographic nonce. The construction is defined in RFC 84 ...


References


External links


NIST Special Publication SP800-38D defining GCM and GMAC
* : The Use of Galois/Counter Mode (GCM) in IPsec Encapsulating Security Payload (ESP) * : The Use of Galois Message Authentication Code (GMAC) in IPsec ESP and AH * : AES Galois Counter Mode (GCM) Cipher Suites for TLS * : Addition of the Camellia Cipher Suites to Transport Layer Security (TLS)


IEEE Security in Storage Working Group
developed the P1619.1 standard

works o
Fibre Channel – Security Protocols
project.
AES-GCM and AES-CCM Authenticated Encryption in Secure RTP (SRTP)

The Galois/Counter Mode of Operation (GCM)
{{DEFAULTSORT:Galois Counter Mode Block cipher modes of operation Finite fields Message authentication codes Authenticated-encryption schemes