idnits 2.17.1 draft-ietf-ipsec-ah-hmac-sha-03.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** Cannot find the required boilerplate sections (Copyright, IPR, etc.) in this document. Expected boilerplate is as follows today (2024-04-26) according to https://trustee.ietf.org/license-info : IETF Trust Legal Provisions of 28-dec-2009, Section 6.a: This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79. IETF Trust Legal Provisions of 28-dec-2009, Section 6.b(i), paragraph 2: Copyright (c) 2024 IETF Trust and the persons identified as the document authors. All rights reserved. IETF Trust Legal Provisions of 28-dec-2009, Section 6.b(i), paragraph 3: This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- ** Missing expiration date. The document expiration date should appear on the first and last page. ** The document seems to lack a 1id_guidelines paragraph about Internet-Drafts being working documents. ** The document seems to lack a 1id_guidelines paragraph about 6 months document validity. ** The document seems to lack a 1id_guidelines paragraph about the list of current Internet-Drafts. ** The document seems to lack a 1id_guidelines paragraph about the list of Shadow Directories. == No 'Intended status' indicated for this document; assuming Proposed Standard Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The document seems to lack an IANA Considerations section. (See Section 2.2 of https://www.ietf.org/id-info/checklist for how to handle the case when there are no actions for IANA.) ** The document seems to lack an Authors' Addresses Section. ** The document seems to lack separate sections for Informative/Normative References. All references will be assumed normative when checking for downward references. ** There are 30 instances of too long lines in the document, the longest one being 14 characters in excess of 72. ** The abstract seems to contain references ([HMAC-MD5], [RFC-1826]), which it shouldn't. Please replace those with straight textual mentions of the documents in question. ** The document seems to lack a both a reference to RFC 2119 and the recommended RFC 2119 boilerplate, even if it appears to use RFC 2119 keywords. RFC 2119 keyword, line 78: '... Authentication Header specification [RFC-1826] SHOULD implement this...' RFC 2119 keyword, line 99: '...ant implementations MUST support a key...' RFC 2119 keyword, line 100: '... Implementations SHOULD support longer...' RFC 2119 keyword, line 103: '...following concerns MUST be considered....' RFC 2119 keyword, line 105: '...bited and implementations MUST prevent...' (6 more instances...) Miscellaneous warnings: ---------------------------------------------------------------------------- -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (October 30, 1996) is 10040 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Unused Reference: 'RFC-1828' is defined on line 252, but no explicit reference was found in the text == Unused Reference: 'URL' is defined on line 258, but no explicit reference was found in the text ** Obsolete normative reference: RFC 1825 (Obsoleted by RFC 2401) ** Obsolete normative reference: RFC 1826 (Obsoleted by RFC 2402) ** Downref: Normative reference to an Historic RFC: RFC 1828 -- Possible downref: Non-RFC (?) normative reference: ref. 'HMAC-MD5' -- Possible downref: Non-RFC (?) normative reference: ref. 'FIPS-180-1' -- Possible downref: Non-RFC (?) normative reference: ref. 'URL' -- Possible downref: Non-RFC (?) normative reference: ref. 'SCHNEIER' -- Possible downref: Non-RFC (?) normative reference: ref. 'ESP-DES-MD5' Summary: 15 errors (**), 0 flaws (~~), 3 warnings (==), 7 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 1 Network Working Group S. Chang (NIST) 2 R. Glenn (NIST) 3 October 30, 1996 4 Internet Draft 6 HMAC-SHA IP Authentication with Replay Prevention 7 9 Status of This Memo 11 Distribution of this memo is unlimited. 13 This document is an Internet-Draft. Internet Drafts are working 14 documents of the Internet Engineering Task Force (IETF), its Areas, 15 and its Working Groups. Note that other groups may also distribute 16 working documents as Internet Drafts. 18 Internet Drafts are draft documents valid for a maximum of six 19 months, and may be updated, replaced, or obsoleted by other documents 20 at any time. It is not appropriate to use Internet Drafts as 21 reference material, or to cite them other than as a ``working draft'' 22 or ``work in progress.'' 24 To learn the current status of any Internet-Draft, please check the 25 ``1id-abstracts.txt'' listing contained in the internet-drafts Shadow 26 Directories on: 28 ftp.is.co.za (Africa) 29 nic.nordu.net (Europe) 30 ds.internic.net (US East Coast) 31 ftp.isi.edu (US West Coast) 32 munnari.oz.au (Pacific Rim) 34 Abstract 36 This document describes a keyed-SHA transform to be used in 37 conjunction with the IP Authentication Header [RFC-1826]. The 38 particular transform is based on [HMAC-MD5]. An option is also 39 specified to guard against replay attacks. 41 Contents 43 1. Introduction...................................................3 44 1.1 Keys........................................................3 45 1.2 Data Size...................................................4 46 2 Packet Format..................................................4 47 2.1 Replay Prevention...........................................4 48 2.2 Authentication Data Calculation.............................5 49 3. Security Considerations........................................6 50 ACKNOWLEDGMENTS....................................................6 51 REFERENCES.........................................................6 52 CONTACTS...........................................................6 54 1. Introduction 56 The IP Authentication Header (AH) provides integrity and 57 authentication for IP datagrams [RFC-1826]. The transform specified 58 in this document uses a keyed-SHA mechanism based on [HMAC-MD5]. The 59 mechanism uses the (key-less) SHA hash function [FIPS-180-1] which 60 produces a message digest. When combined with an AH Key, 61 authentication data is produced. This value is placed in the 62 Authentication Data field of the AH [RFC-1826]. This value is also 63 the basis for the data integrity service offered by the AH protocol. 65 To provide protection against replay attacks, a Replay Prevention 66 field is included as a transform option. This field is used to help 67 prevent attacks in which a message is stored and re-used later, 68 replacing or repeating the original. The Security Parameters Index 69 (SPI) [RFC-1825] is used to determine whether this option is included 70 in the AH. 72 Familiarity with the following documents is assumed: "Security 73 Architecture for the Internet Protocol" [RFC-1825], "IP 74 Authentication Header" [RFC-1826], and "HMAC-MD5: Keyed-MD5 for 75 Message Authentication" [HMAC-MD5]. 77 All implementations that claim conformance or compliance with the IP 78 Authentication Header specification [RFC-1826] SHOULD implement this 79 HMAC-SHA transform. 81 1.1 Keys 83 The AH Key is used as a shared secret between two communicating 84 parties. The Key is not a cryptographic key as used in a traditional 85 sense. Instead, the AH key (shared secret) is hashed with the 86 transmitted data and thus, assures that an intervening party cannot 87 duplicate the authentication data. 89 Even though an AH key is not a cryptographic key, the rudimentary 90 concerns of cryptographic keys still apply. Consider that the 91 algorithm and most of the data used to produce the output is known. 92 The strength of the transform lies in the singular mapping of the key 93 (which needs to be strong) and the IP datagram (which is known) to 94 the authentication data. Thus, implementations should, and as 95 frequently as possible, change the AH key. Keys need to be chosen at 96 random, or generated using a cryptographically strong pseudo-random 97 generator seeded with a random seed. [HMAC-MD5] 99 All conforming and compliant implementations MUST support a key 100 length of 160 bits or less. Implementations SHOULD support longer 101 key lengths as well. It is advised that the key length be chosen to 102 be the length of the hash output, which is 160 bits for SHA. For 103 other key lengths the following concerns MUST be considered. 105 A key length of zero is prohibited and implementations MUST prevent 106 key lengths of zero from being used with this transform, since no 107 effective authentication could be provided by a zero-length key. SHA 108 operates on 64-byte blocks. Keys longer than 64-bytes are first 109 hashed using SHA. The resulting hash is then used to calculate the 110 authentication data." 112 1.2 Data Size 114 SHA generates a message digest of 160 bits. To maintain 64-bit word 115 alignment, all conforming and compliant implementations MUST include 116 the ability to pad the message digest to 192 bits as described in 117 this paragraph. Implementations MAY also include the ability to use 118 the 160 bit message digest with out the pad when 64-bit alignment is 119 not required. Padding is added by appending 32 zero bits to SHA 120 message digest. The length of the Authentication Data, specified in 121 the Length field of the AH in 32-bit words, should include the 122 padding bits, if present. Upon receipt, the value of the padded bits 123 MUST be zero and are otherwise ignored. 125 2. Packet Format 127 +---------------+---------------+---------------+---------------+ 128 | Next Header | Length | RESERVED | 129 +---------------+---------------+---------------+---------------+ 130 | SPI | 131 +---------------+---------------+---------------+---------------+ 132 | Replay Prevention | 133 | | 134 +---------------+---------------+---------------+---------------+ 135 | | 136 + Authentication Data | 137 | | 138 +---------------+---------------+---------------+---------------+ 139 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 141 The Next Header, RESERVED, and SPI fields are specified in [RFC- 142 1826]. The Length field is the length of the Replay Prevention field 143 and the Authentication Data in 32-bit words. 145 2.1 Replay Prevention 147 The Replay Prevention field is a 64-bit value used to guarantee that 148 each packet exchanged between two parties is different. Each IPsec 149 Security Association specifies whether Replay Prevention is used for 150 that Security Association. If Replay Prevention is NOT in use, then 151 the Authentication Data field will directly follow the SPI field. 152 This field is used to help prevent attacks in which a message is 153 stored and re-used later, replacing or repeating the original. 155 The 64-bit field is an up counter starting at a value of 1. 157 The secret shared key must not be used for a period of time that 158 allows the counter to wrap, that is, to transmit more than 2^64 159 packets using a single key. 161 Upon receipt, the replay value is assured to be increasing. The 162 implementation may accept out of order packets. The number of packets 163 to accept out of order is an implementation detail. If an "out of 164 order window" is supported, the implementation shall ensure that any 165 and all packets accepted out of order are guaranteed not to have 166 arrived before. That is, the implementation will accept any packet at 167 most once. 169 When the destination address is a multicast address, replay 170 protection is in use, and more than one sender is sharing the same 171 IPsec Security Association to that multicast destination address, 172 then Replay Protection SHOULD NOT be enabled. When replay protection 173 is desired for a multicast session having multiple senders to the 174 same multicast destination address, each sender SHOULD have its own 175 IPsec Security Association. 177 [ESP-DES-MD5] provides example code that implements a 32 packet 178 replay window and a test routine to show how it works. 180 2.2 Authentication Data Calculation 182 The computation of the 160-bit SHA digest is described 183 in [FIPS-180-1]. The digest is calculated over 184 the entire IP datagram. Fields within the datagram that are variant 185 during transit and the authentication data field itself must contain 186 all zeros prior to the computation [RFC-1826]. 187 The Replay Prevention field, if present, is included in the calculation. 189 To compute HMAC-SHA over the data 'text', the following is calculated: 191 SHA (K XOR opad, SHA (K XOR ipad, text)) 193 K denotes the secret key shared by the parties. If K is longer 194 than 64-bytes it MUST first be hashed using SHA. 195 In this case, K is the resulting hash. The variables 'ipad', 'opad' 196 denote fixed strings for inner and outer padding respectively. 198 The two strings are: 200 ipad = the byte 0x36 repeated 64 times, 201 opad = the byte 0x5C repeated 64 times. 203 The calculation of the authentication data consists of the following steps: 205 (1) append zeros to the end of K to create a 64 byte string (e.g., if K is 206 of length 20 bytes it will be appended with 44 zero bytes 0x00) 207 (2) XOR (bitwise exclusive-OR) the 64 byte string computed in step (1) with 208 ipad 209 (3) concatenate to the 64 byte string resulting from step (2) the data 210 stream 'text' 211 (4) apply SHA to the stream generated in step (3) 212 (5) XOR the 64 byte string computed in step (1) with opad 213 (6) concatenate to the 64 byte string resulting from step (5) the SHA result 214 of step (4) 215 (7) apply SHA to the stream generated in step (6) 216 (8) The sender then zero pads the resulting hash to a 64-bit boundary 217 for word alignment. IPv4 implemenations choosing not to pad will not 218 zero pad the resulting hash. The receiver then compares the generated 219 160-bit hash to the first 160-bits of authentication data contained in 220 the AH. 222 A similar computation is described in more detail, along with example 223 code and performance improvements, in [HMAC-MD5]. Implementers 224 should consult [HMAC-MD5] for more information on this technique 225 for keying a cryptographic hash function. 227 3. Security Considerations 229 The security provided by this transform is based on the strength of 230 SHA, the correctness of the algorithm's implementation, the security 231 of the key management mechanism and its implementation, the strength 232 of the associated secret key, and upon the correctness of the 233 implementations in all of the participating systems. 235 At this time there are no known cryptographic attacks against SHA 236 [SCHNEIER]. The 160-bit digest makes SHA more resistant to brute 237 force attacks than MD4 and MD5 which produce a 128-bit digest. 239 Acknowledgments 241 This document is largely based on text written by Hugo Krawczyk. The 242 format used was derived from work by William Simpson and Perry Metzger. 243 The text on replay prevention is derived directly from work by Jim 244 Hughes. 246 References 248 [RFC-1825] R. Atkinson, "Security Architecture for the Internet Protocol", 249 RFC-1825, August 1995. 250 [RFC-1826] R. Atkinson, "IP Authentication Header", 251 RFC-1826, August 1995. 252 [RFC-1828] P. Metzger, W. A. Simpson, "IP Authentication using Keyed MD5", 253 RFC-1828, August 1995. 254 [HMAC-MD5] H. Krawczyk, M. Bellare, R. Canetti, "HMAC-MD5: Keyed-MD5 255 for Message Authentication", Internet Draft, March, 1996. 256 [FIPS-180-1] NIST, FIPS PUB 180-1: Secure Hash Standard, April 1995. 257 [URL] http://csrc.nist.gov/fips/fip180-1.txt (ascii) 258 [URL] http://csrc.nist.gov/fips/fip180-1.ps (postscript) 259 [SCHNEIER] B. Schneier, "Applied Cryptography Protocols, Algorithms, and 260 Source Code in C", John Wiley & Sons, Inc. 1994. 261 [ESP-DES-MD5] J. Hughes, "Combined DES-CBC, MD5, and Replay Prevention 262 Security Transform", Internet Draft, April, 1996. 264 Contacts 266 Shu-jen Chang 267 NIST 268 Building 820, Room 456 269 Gaithersburg, MD 20899 271 shu-jen.chang@nist.gov 273 Robert Glenn 274 NIST 275 Building 820, Room 455 276 Gaithersburg, MD 20899 278 rob.glenn@nist.gov