Network Working Group J. Viega
Internet-Draft Secure Software, Inc.
Expires: October 26, 2004 D. McGrew
Cisco Systems, Inc.
April 27, 2004
The Use of Galois/Counter Mode (GCM) in IPsec ESP
draft-ietf-ipsec-ciph-aes-gcm-00.txt
Status of this Memo
This document is an Internet-Draft and is in full conformance with
all provisions of Section 10 of RFC2026.
Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF), its areas, and its working groups. Note that other
groups may also distribute working documents as Internet-Drafts.
Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress."
The list of current Internet-Drafts can be accessed at http://
www.ietf.org/ietf/1id-abstracts.txt.
The list of Internet-Draft Shadow Directories can be accessed at
http://www.ietf.org/shadow.html.
This Internet-Draft will expire on October 26, 2004.
Copyright Notice
Copyright (C) The Internet Society (2004). All Rights Reserved.
Abstract
This memo describes the use of the Advanced Encryption Standard (AES)
in Galois/Counter Mode (GCM) as an IPsec Encapsulating Security
Payload (ESP) mechanism to provide confidentiality and data origin
authentication. This method can be efficiently implemented in
hardware for speeds of 10 gigabits per second and above, and is also
well-suited to software implementations.
Viega & McGrew Expires October 26, 2004 [Page 1]
Internet-Draft GCM ESP April 2004
Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1 Conventions Used In This Document . . . . . . . . . . . . . . 3
2. AES-GCM . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3. ESP Payload Data . . . . . . . . . . . . . . . . . . . . . . . 5
3.1 Initialization Vector (IV) . . . . . . . . . . . . . . . . . . 5
3.2 Ciphertext . . . . . . . . . . . . . . . . . . . . . . . . . . 5
4. Nonce Format . . . . . . . . . . . . . . . . . . . . . . . . . 6
5. AAD Construction . . . . . . . . . . . . . . . . . . . . . . . 7
6. Integrity Check Value (ICV) . . . . . . . . . . . . . . . . . 8
7. Packet Expansion . . . . . . . . . . . . . . . . . . . . . . . 9
8. IKE Conventions . . . . . . . . . . . . . . . . . . . . . . . 10
8.1 Keying Material and Salt Values . . . . . . . . . . . . . . . 10
8.2 Phase 1 Identifier . . . . . . . . . . . . . . . . . . . . . . 10
8.3 Phase 2 Identifier . . . . . . . . . . . . . . . . . . . . . . 10
8.4 Key Length Attribute . . . . . . . . . . . . . . . . . . . . . 11
9. Test Vectors . . . . . . . . . . . . . . . . . . . . . . . . . 12
10. Security Considerations . . . . . . . . . . . . . . . . . . . 13
11. Design Rationale . . . . . . . . . . . . . . . . . . . . . . . 14
12. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 15
13. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 16
Normative References . . . . . . . . . . . . . . . . . . . . . 17
Informative References . . . . . . . . . . . . . . . . . . . . 18
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . 18
Intellectual Property and Copyright Statements . . . . . . . . 20
Viega & McGrew Expires October 26, 2004 [Page 2]
Internet-Draft GCM ESP April 2004
1. Introduction
This document describes the use of AES in GCM mode (AES-GCM) as an
IPSec ESP mechanism for confidentiality and data origin
authentication. We refer to this method as AES-GCM-ESP. This
mechanism is not only efficient and secure, it also enables
high-speed implementations in hardware, and thus allows IPsec
connections that can make effective use of emerging 10-gigabit and
40-gigabit network devices.
Counter mode (CTR) has emerged as the preffered encryption method for
high-speed implementations. Unlike conventional encryption modes
like CBC and CBC-MAC, CTR can be efficiently implemented at high data
rates because it can be pipelined. The ESP CTR protocol describes
how this mode can be used with IPsec ESP [RFC3686].
Unfortunately, CTR provides no data origin authentication, and thus
the ESP CTR standard requires the use of a data origin authentication
algorithm in conjunction with CTR. This requirement is problematic,
because none of the standard data origin authentication algorithms
can be efficiently implemented for high data rates. GCM solves this
problem, because under the hood, it combines CTR mode with a secure,
parallelizable and efficient authentication mechanism.
This document does not cover implementation details of GCM. Those
details can be found in [GCM], along with test vectors.
1.1 Conventions Used In This Document
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in [RFC2119].
Viega & McGrew Expires October 26, 2004 [Page 3]
Internet-Draft GCM ESP April 2004
2. AES-GCM
GCM is a block cipher mode of operation providing both
confidentiality and data origin authentication. The GCM
authenticated encryption operation has four inputs: a secret key, an
initialization vector (IV), a plaintext, and an input for additional
authenticated data (AAD). It has two outputs, a ciphertext whose
length is identical to the plaintext, and an authentication tag. In
the following, we describe how the IV, plaintext, and AAD are formed
from the ESP fields, and how the ESP packet is formed from the
ciphertext and authentication tag.
ESP also defines an IV. For clarity, we refer to the AES-GCM IV as a
nonce in the context of AES-GCM-ESP. The same nonce and key
combination MUST NOT be used more than once.
Since reusing an nonce/key combination destroys the security
guarantees of AES-GCM mode, it can be difficult to use this mode
securely when using statically configured keys. For safety's sake,
implementations MUST use an automated key mangement system, such as
the Internet Key Exchange (IKE) [RFC2409], to ensure that this
requirement is met.
Viega & McGrew Expires October 26, 2004 [Page 4]
Internet-Draft GCM ESP April 2004
3. ESP Payload Data
The ESP Payload Data is comprised of an eight-octet initialization
vector (IV) followed by the ciphertext. The payload field, as
defined in [RFC2406], is structured as shown in Figure 1, along with
the ICV associated with the payload.
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Initialization Vector |
| (8 octets) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
~ Ciphertext (variable) ~
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 1: ESP Payload Encrytped with AES-GCM.
3.1 Initialization Vector (IV)
The AES-GCM-ESP IV field MUST be eight octets. For a given key, the
IV MUST NOT repeat. The most natural way to implement this is with a
counter, but it can be anything that guarantees uniqueness, such as a
linear feedback shift register (LFSR). Note that the encrypter can
use any IV generation method that meets the uniqueness requirement,
without coordinating with the decrypter.
3.2 Ciphertext
The plaintext input to AES-GCM is formed by concatenating the
plaintext data described by the Next Header field with the Padding,
the Pad Length, and the Next Header field. The Ciphertext field
consists of the ciphertext output from the AES-GCM algorithm. The
length of the ciphertext is identical to that of the plaintext.
Implementations that do not seek to hide the length of the plaintext
SHOULD use the minimum amount of padding required, which will be less
than four octets.
Viega & McGrew Expires October 26, 2004 [Page 5]
Internet-Draft GCM ESP April 2004
4. Nonce Format
The nonce passed to the GCM-AES encryption algorithm has the
following layout:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Salt |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Initialization Vector |
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 2: Nonce Format
The components of the nonce are as follows:
Salt
The salt field is a four-octet value that is assigned at the
beginning of the security association, and then remains constant
for the life of the security association. The salt SHOULD be
unpredictable (i.e., chosen at random) before it is selected, but
need not be secret. We describe how to set the salt for a
Security Association established via the Internet Key Exchange in
Section 8.1.
Initialization Vector
The IV field is described in section Section 3.1.
Viega & McGrew Expires October 26, 2004 [Page 6]
Internet-Draft GCM ESP April 2004
5. AAD Construction
The data integrity and data origin authentication for the SPI and
(Extended) Sequence Number fields is provided without encrypting
them. This is done by including those fields in the AES-GCM
Additional Authenticated Data (AAD) field. Two formats of the AAD
are defined: one for 32-bit sequence numbers, and one for 64-bit
extended sequence numbers. The format with 32-bit sequence numbers
is shown in Figure 3, and the format with 64-bit extended sequence
numbers is shown in Figure 4.
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| SPI |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 32-bit Sequence Number |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 3: AAD Format with 32-bit Sequence Number
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| SPI |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 64-bit Extended Sequence Number |
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 4: AAD Format with 64-bit Extended Sequence Number
Viega & McGrew Expires October 26, 2004 [Page 7]
Internet-Draft GCM ESP April 2004
6. Integrity Check Value (ICV)
The ICV consists solely of the AES-GCM Authentication Tag.
Implementations MUST support a full-length 16-octet ICV, and MAY
support 4, 8 or 12 octet ICVs and MUST NOT support other ICV lengths.
Although ESP does not require that an ICV be present, AES-GCM-ESP
intentionally does not allow a zero-length ICV. This is because GCM
provides no integrity protection whatsoever when used with a
zero-length Authentication Tag.
Viega & McGrew Expires October 26, 2004 [Page 8]
Internet-Draft GCM ESP April 2004
7. Packet Expansion
The IV adds an additional eight octets to the packet and the ICV adds
an additional 4, 8, 12 or 16 octets. These are the only sources of
packet expansion, other than the 10-13 bytes taken up by the ESP SPI,
Sequence Number, Padding, Pad Length, and Next Header fields (if the
minimal amount of padding is used).
Viega & McGrew Expires October 26, 2004 [Page 9]
Internet-Draft GCM ESP April 2004
8. IKE Conventions
This section describes the conventions used to generate keying
material and salt values for use with AES-GCM-ESP using the Internet
Key Exchange (IKE) [RFC2409] protocol. The identifiers and
attributes needed to negotiate a security association using
AES-GCM-ESP are also defined.
8.1 Keying Material and Salt Values
IKE makes use of a pseudo-random function (PRF) to derive keying
material. The PRF is used iteratively to derive keying material of
arbitrary size, called KEYMAT. Keying material is extracted from the
output string without regard to boundaries.
The size of the KEYMAT for the AES-GCM-ESP MUST be four octets longer
than is needed for the associated AES key. The keying material is
used as follows:
AES-GCM-ESP with a 128 bit key
The KEYMAT requested for each AES-GCM key is 20 octets. The first
16 octets are the 128-bit AES key, and the remaining four octets
are used as the salt value in the nonce.
AES-GCM-ESP with a 192 bit key
The KEYMAT requested for each AES-GCM key is 28 octets. The first
24 octets are the 192-bit AES key, and the remaining four octets
are used as the salt value in the nonce.
AES-GCM-ESP with a 256 bit key
The KEYMAT requested for each AES GCM key is 36 octets. The first
32 octets are the 256-bit AES key, and the remaining four octets
are used as the salt value in the nonce.
8.2 Phase 1 Identifier
This document does not specify the conventions for using AES-GCM for
IKE Phase 1 negotiations. For AES-GCM to be used in this manner, a
separate specification is needed, and an Encryption Algorithm
Identifier needs to be assigned. Implementations SHOULD use an IKE
Phase 1 cipher which is at least as strong as AES-GCM. The use of AES
CBC [RFC3602] with the same key size as used by AES-GCM-ESP is
RECOMMENDED.
8.3 Phase 2 Identifier
For IKE Phase 2 negotiations, IANA has assigned <TBD> as the ESP
Viega & McGrew Expires October 26, 2004 [Page 10]
Internet-Draft GCM ESP April 2004
Transform Identifier for AES-GCM with an eight-byte explicit IV.
8.4 Key Length Attribute
Since the AES supports three key lengths, the Key Length attribute
MUST be specified in the IKE Phase 2 exchange [RFC2407]. The Key
Length attribute MUST have a value of 128, 192 or 256.
Viega & McGrew Expires October 26, 2004 [Page 11]
Internet-Draft GCM ESP April 2004
9. Test Vectors
Appendix B of [GCM] provides test vectors that will assist
implementers with AES-GCM mode.
Viega & McGrew Expires October 26, 2004 [Page 12]
Internet-Draft GCM ESP April 2004
10. Security Considerations
GCM is provably secure against adversaries that can adaptively choose
plaintexts, ciphertexts, ICVs and the AAD field, under standard
cryptographic assumptions (roughly, that the output of the underlying
cipher under a randomly chosen key is indistinguishable from a
randomly selected output). Essentially, this means that, if used
within its intended parameters, a break of GCM implies a break of the
underlying block cipher. The proof of security for GCM is available
in [GCMP].
The most important security consideration is that the IV never repeat
for a given key. In part, this is handled by disallowing the use of
AES-GCM when using statically configured keys, as discussed in
Section 2.
When IKE is used to establish fresh keys between two peer entities,
separate keys are established for the two traffic flows. If a
different mechanism is used to establish fresh keys, one that
establishes only a single key to encrypt packets, then there is a
high probability that the peers will select the same IV values for
some packets. Thus, to avoid counter block collisions, ESP
implementations that permit use of the same key for encrypting and
decrypting packets with the same peer MUST ensure that the two peers
assign different salt values to the security association (SA).
The other consideration is that, as with any encryption mode, the
security of all data protected under a given security association
decreases slightly with each message.
To protect against this problem, implementations MUST generate a
fresh key before encrypting 2^64 blocks of data with a given key.
Note that it is impossible to reach this limit when using 32-bit
Sequence Numbers.
Note that, for each message, GCM calls the block cipher once for each
full 16-octet block in the payload, once for any remaining octets in
the payload, and one additional time in computing the ICV.
Clearly, smaller ICV values are more likely to be subject to forgery
attacks. Implementations SHOULD use as large a size as reasonable.
Viega & McGrew Expires October 26, 2004 [Page 13]
Internet-Draft GCM ESP April 2004
11. Design Rationale
This specification was designed to be as similar to the AES-CCM ESP
[CCM-ESP] and AES-CTR ESP [RFC3686] mechanisms as reasonable, while
promoting simple, efficient implementations in both hardware and
software. We re-use the design and implementation experience from
those standards.
The major difference with CCM is that the CCM ESP mechanism requires
an 11-octet nonce, whereas the GCM ESP mechanism requires using a
12-octet nonce. GCM is specially optimized to handle the 12-octet
nonce case efficiently. Nonces of other lengths would cause
unnecessary additional complexity and delays, particularly in
hardware implementations. The additional octet of nonce is used to
increase the size of the salt.
Viega & McGrew Expires October 26, 2004 [Page 14]
Internet-Draft GCM ESP April 2004
12. IANA Considerations
Currently, no ESP transform numbers have been assigned for use with
the AES-GCM transform.
Viega & McGrew Expires October 26, 2004 [Page 15]
Internet-Draft GCM ESP April 2004
13. Acknowledgements
This work is closely modeled after Russ Housley's AES-CCM transform
[CCM-ESP]. Portions of this document are directly copied from that
draft. We thank Russ for his support of this work.
Additionally, the GCM mode of operation was originally conceived as
an improvement to CWC mode [CWC], the first unencumbered block cipher
mode capable of supporting high-speed authenticated encryption.
Viega & McGrew Expires October 26, 2004 [Page 16]
Internet-Draft GCM ESP April 2004
Normative References
[GCM] McGrew, D. and J. Viega, "The Galois/Counter Mode of
Operation (GCM)", Submission to NIST. http://
csrc.nist.gov/CryptoToolkit/modes/proposedmodes/gcm/
gcm-spec.pdf, January 2004.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997.
[RFC2406] Kent, S. and R. Atkinson, "IP Encapsulating Security
Payload (ESP)", RFC 2406, November 1998.
[RFC2407] Piper, D., "The Internet IP Security Domain of
Interpretation for ISAKMP", RFC 2407, November 1998.
[RFC3602] Frankel, S., Glenn, R. and S. Kelly, "The AES-CBC Cipher
Algorithm and Its Use with IPsec", RFC 3602, September
2003.
Viega & McGrew Expires October 26, 2004 [Page 17]
Internet-Draft GCM ESP April 2004
Informative References
[CCM-ESP] Housley, R., "Using AES CCM Mode With IPsec ESP", Work In
Progress. <draft-ietf-ipsec-ciph-aes-ccm-05.txt>.
[CWC] Kohno, T., Viega, J. and D. Whiting, "CWC: A
high-performance conventional authenticated encryption
mode", Fast Software Encryption. http://eprint.iacr.org/
2003/106.pdf, February 2004.
[GCMP] McGrew, D., "Security Analysis of Galois/Counter Mode
(GCM)", http://www.cryptobarn.com/papers/gcm-sec.pdf,
March 2004.
[RFC2409] Harkins, D. and D. Carrel, "The Internet Key Exchange
(IKE)", RFC 2409, November 1998.
[RFC2675] Borman, D., Deering, S. and R. Hinden, "IPv6 Jumbograms",
RFC 2675, August 1999.
[RFC3610] Whiting, D., Housley, R. and N. Ferguson, "Counter with
CBC-MAC (CCM)", RFC 3610, September 2003.
[RFC3686] Housley, R., "Using Advanced Encryption Standard (AES)
Counter Mode With IPsec Encapsulating Security Payload
(ESP)", RFC 3686, January 2004.
Authors' Addresses
John Viega
Secure Software, Inc.
4100 Lafayette Center Dr., Suite 100
Chantilly, VA 20151
US
Phone: (703) 814 4402
EMail: viega@securesoftware.com
Viega & McGrew Expires October 26, 2004 [Page 18]
Internet-Draft GCM ESP April 2004
David A. McGrew
Cisco Systems, Inc.
510 McCarthy Blvd.
Milpitas, CA 95035
US
Phone: (408) 525 8651
EMail: mcgrew@cisco.com
URI: http://www.mindspring.com/~dmcgrew/dam.htm
Viega & McGrew Expires October 26, 2004 [Page 19]
Internet-Draft GCM ESP April 2004
Intellectual Property Statement
The IETF takes no position regarding the validity or scope of any
intellectual property or other rights that might be claimed to
pertain to the implementation or use of the technology described in
this document or the extent to which any license under such rights
might or might not be available; neither does it represent that it
has made any effort to identify any such rights. Information on the
IETF's procedures with respect to rights in standards-track and
standards-related documentation can be found in BCP-11. Copies of
claims of rights made available for publication and any assurances of
licenses to be made available, or the result of an attempt made to
obtain a general license or permission for the use of such
proprietary rights by implementors or users of this specification can
be obtained from the IETF Secretariat.
The IETF invites any interested party to bring to its attention any
copyrights, patents or patent applications, or other proprietary
rights which may cover technology that may be required to practice
this standard. Please address the information to the IETF Executive
Director.
Full Copyright Statement
Copyright (C) The Internet Society (2004). All Rights Reserved.
This document and translations of it may be copied and furnished to
others, and derivative works that comment on or otherwise explain it
or assist in its implementation may be prepared, copied, published
and distributed, in whole or in part, without restriction of any
kind, provided that the above copyright notice and this paragraph are
included on all such copies and derivative works. However, this
document itself may not be modified in any way, such as by removing
the copyright notice or references to the Internet Society or other
Internet organizations, except as needed for the purpose of
developing Internet standards in which case the procedures for
copyrights defined in the Internet Standards process must be
followed, or as required to translate it into languages other than
English.
The limited permissions granted above are perpetual and will not be
revoked by the Internet Society or its successors or assignees.
This document and the information contained herein is provided on an
"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
Viega & McGrew Expires October 26, 2004 [Page 20]
Internet-Draft GCM ESP April 2004
HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Acknowledgment
Funding for the RFC Editor function is currently provided by the
Internet Society.
Viega & McGrew Expires October 26, 2004 [Page 21]