idnits 2.17.1 draft-ietf-ipsec-ah-hmac-sha-02.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-23) 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 79: '... Authentication Header specification [RFC-1826] MUST implement this...' RFC 2119 keyword, line 100: '...ant implementations MUST support a key...' RFC 2119 keyword, line 101: '... Implementations SHOULD support longer...' RFC 2119 keyword, line 104: '...following concerns MUST be considered....' RFC 2119 keyword, line 106: '...bited and implementations MUST prevent...' (4 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 (August 30, 1996) is 10098 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 246, but no explicit reference was found in the text == Unused Reference: 'URL' is defined on line 252, 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. -------------------------------------------------------------------------------- 2 Network Working Group S. Chang (NIST) 3 R. Glenn (NIST) 4 August 30, 1996 5 Internet Draft 7 HMAC-SHA IP Authentication with Replay Prevention 8 10 Status of This Memo 12 Distribution of this memo is unlimited. 14 This document is an Internet-Draft. Internet Drafts are working 15 documents of the Internet Engineering Task Force (IETF), its Areas, 16 and its Working Groups. Note that other groups may also distribute 17 working documents as Internet Drafts. 19 Internet Drafts are draft documents valid for a maximum of six 20 months, and may be updated, replaced, or obsoleted by other documents 21 at any time. It is not appropriate to use Internet Drafts as 22 reference material, or to cite them other than as a ``working draft'' 23 or ``work in progress.'' 25 To learn the current status of any Internet-Draft, please check the 26 ``1id-abstracts.txt'' listing contained in the internet-drafts Shadow 27 Directories on: 29 ftp.is.co.za (Africa) 30 nic.nordu.net (Europe) 31 ds.internic.net (US East Coast) 32 ftp.isi.edu (US West Coast) 33 munnari.oz.au (Pacific Rim) 35 Abstract 37 This document describes a keyed-SHA transform to be used in 38 conjunction with the IP Authentication Header [RFC-1826]. The 39 particular transform is based on [HMAC-MD5]. An option is also 40 specified to guard against replay attacks. 42 Contents 44 1. Introduction...................................................3 45 1.1 Keys........................................................3 46 1.2 Data Size...................................................4 47 2 Packet Format..................................................4 48 2.1 Replay Prevention...........................................4 49 2.2 Authentication Data Calculation.............................5 50 3. Security Considerations........................................6 51 ACKNOWLEDGMENTS....................................................6 52 REFERENCES.........................................................6 53 CONTACTS...........................................................6 55 1. Introduction 57 The IP Authentication Header (AH) provides integrity and 58 authentication for IP datagrams [RFC-1826]. The transform specified 59 in this document uses a keyed-SHA mechanism based on [HMAC-MD5]. The 60 mechanism uses the (key-less) SHA hash function [FIPS-180-1] which 61 produces a message digest. When combined with an AH Key, 62 authentication data is produced. This value is placed in the 63 Authentication Data field of the AH [RFC-1826]. This value is also 64 the basis for the data integrity service offered by the AH protocol. 66 To provide protection against replay attacks, a Replay Prevention 67 field is included as a transform option. This field is used to help 68 prevent attacks in which a message is stored and re-used later, 69 replacing or repeating the original. The Security Parameters Index 70 (SPI) [RFC-1825] is used to determine whether this option is included 71 in the AH. 73 Familiarity with the following documents is assumed: "Security 74 Architecture for the Internet Protocol" [RFC-1825], "IP 75 Authentication Header" [RFC-1826], and "HMAC-MD5: Keyed-MD5 for 76 Message Authentication" [HMAC-MD5]. 78 All implementations that claim conformance or compliance with the IP 79 Authentication Header specification [RFC-1826] MUST implement this 80 HMAC-SHA transform. 82 1.1 Keys 84 The AH Key is used as a shared secret between two communicating 85 parties. The Key is not a cryptographic key as used in a traditional 86 sense. Instead, the AH key (shared secret) is hashed with the 87 transmitted data and thus, assures that an intervening party cannot 88 duplicate the authentication data. 90 Even though an AH key is not a cryptographic key, the rudimentary 91 concerns of cryptographic keys still apply. Consider that the 92 algorithm and most of the data used to produce the output is known. 93 The strength of the transform lies in the singular mapping of the key 94 (which needs to be strong) and the IP datagram (which is known) to 95 the authentication data. Thus, implementations should, and as 96 frequently as possible, change the AH key. Keys need to be chosen at 97 random, or generated using a cryptographically strong pseudo-random 98 generator seeded with a random seed. [HMAC-MD5] 100 All conforming and compliant implementations MUST support a key 101 length of 160 bits or less. Implementations SHOULD support longer 102 key lengths as well. It is advised that the key length be chosen to 103 be the length of the hash output, which is 160 bits for SHA. For 104 other key lengths the following concerns MUST be considered. 106 A key length of zero is prohibited and implementations MUST prevent 107 key lengths of zero from being used with this transform, since no 108 effective authentication could be provided by a zero-length key. SHA 109 operates on 64-byte blocks. Keys longer than 64-bytes are first 110 hashed using SHA. The resulting hash is then used to calculate the 111 authentication data." 113 1.2 Data Size 115 SHA generates a message digest of 160 bits. To maintain 64-bit word 116 alignment, all conforming and compliant implementations MUST include 117 the ability to pad the message digest to 192 bits as described in 118 this paragraph. Implementations MAY also include the ability to use 119 the 160 bit message digest with out the pad when 64-bit alignment is 120 not required. Padding is added by appending 32 zero bits to SHA 121 message digest. The length of the Authentication Data, specified in 122 the Length field of the AH in 32-bit words, should include the 123 padding bits, if present. Upon receipt, the value of the padded bits 124 MUST be zero and are otherwise ignored. 126 2. Packet Format 128 +---------------+---------------+---------------+---------------+ 129 | Next Header | Length | RESERVED | 130 +---------------+---------------+---------------+---------------+ 131 | SPI | 132 +---------------+---------------+---------------+---------------+ 133 | Replay Prevention | 134 | | 135 +---------------+---------------+---------------+---------------+ 136 | | 137 + Authentication Data | 138 | | 139 +---------------+---------------+---------------+---------------+ 140 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 142 The Next Header, RESERVED, and SPI fields are specified in [RFC- 143 1826]. The Length field is the length of the Replay Prevention field 144 and the Authentication Data in 32-bit words. 146 2.1 Replay Prevention 148 The Replay Prevention field is a 64-bit value used to guarantee that 149 each packet exchanged between two parties is different. This field 150 is similar to the one specified in [ESP-DES-MD5]. Each IPsec 151 Security Association specifies whether Replay Prevention is used for 152 that Security Association. If Replay Prevention is NOT in use, then 153 the Authentication Data field will directly follow the SPI field. 154 This field is used to help prevent attacks in which a message is 155 stored and re-used later, replacing or repeating the original. 157 The 64-bit field is an up counter starting at a value of 1. 159 The secret shared key must not be used for a period of time that 160 allows the counter to wrap, that is, to transmit more than 2^64 161 packets using a single key. 163 Upon receipt, the replay value is assured to be increasing. The 164 implementation may accept out of order packets. The number of packets 165 to accept out of order is an implementation detail. If an "out of 166 order window" is supported, the implementation shall ensure that any 167 and all packets accepted out of order are guaranteed not to have 168 arrived before. That is, the implementation will accept any packet at 169 most once. 171 [ESP-DES-MD5] provides example code that implements a 32 packet 172 replay window and a test routine to show how it works. 174 2.2 Authentication Data Calculation 176 The computation of the 160-bit SHA digest is described 177 in [FIPS-180-1]. The digest is calculated over 178 the entire IP datagram. Fields within the datagram that are variant 179 during transit and the authentication data field itself must contain 180 all zeros prior to the computation [RFC-1826]. 181 The Replay Prevention field, if present, is included in the calculation. 183 To compute HMAC-SHA over the data 'text', the following is calculated: 185 SHA (K XOR opad, SHA (K XOR ipad, text)) 187 K denotes the secret key shared by the parties. If K is longer 188 than 64-bytes it MUST first be hashed using SHA. 189 In this case, K is the resulting hash. The variables 'ipad', 'opad' 190 denote fixed strings for inner and outer padding respectively. 191 The two strings are: 193 ipad = the byte 0x36 repeated 64 times, 194 opad = the byte 0x5C repeated 64 times. 196 The calculation of the authentication data consists of the following steps: 198 (1) append zeros to the end of K to create a 64 byte string (e.g., if K is 199 of length 20 bytes it will be appended with 44 zero bytes 0x00) 200 (2) XOR (bitwise exclusive-OR) the 64 byte string computed in step (1) with 201 ipad 202 (3) concatenate to the 64 byte string resulting from step (2) the data 203 stream 'text' 204 (4) apply SHA to the stream generated in step (3) 205 (5) XOR the 64 byte string computed in step (1) with opad 206 (6) concatenate to the 64 byte string resulting from step (5) the SHA result 207 of step (4) 208 (7) apply SHA to the stream generated in step (6) 209 (8) The sender then zero pads the resulting hash to a 64-bit boundary 210 for word alignment. IPv4 implemenations choosing not to pad will not 211 zero pad the resulting hash. The receiver then compares the generated 212 160-bit hash to the first 160-bits of authentication data contained in 213 the AH. 215 A similar computation is described in more detail, along with example 216 code and performance improvements, in [HMAC-MD5]. Implementers 217 should consult [HMAC-MD5] for more information on this technique 218 for keying a cryptographic hash function. 220 3. Security Considerations 222 The security provided by this transform is based on the strength of 223 SHA, the correctness of the algorithm's implementation, the security 224 of the key management mechanism and its implementation, the strength 225 of the associated secret key, and upon the correctness of the 226 implementations in all of the participating systems. 228 At this time there are no known cryptographic attacks against SHA 229 [SCHNEIER]. The 160-bit digest makes SHA more resistant to brute 230 force attacks than MD4 and MD5 which produce a 128-bit digest. 232 Acknowledgments 234 This document is largely based on text written by Hugo Krawczyk. The 235 format used was derived from work by William Simpson and Perry Metzger. 236 The text on replay prevention is derived directly from work by Jim 237 Hughes. 239 References 241 [RFC-1825] R. Atkinson, "Security Architecture for the Internet Protocol", 242 RFC-1825, August 1995. 243 [RFC-1826] R. Atkinson, "IP Authentication Header", 244 RFC-1826, August 1995. 246 [RFC-1828] P. Metzger, W. A. Simpson, "IP Authentication using Keyed MD5", 247 RFC-1828, August 1995. 248 [HMAC-MD5] H. Krawczyk, M. Bellare, R. Canetti, "HMAC-MD5: Keyed-MD5 249 for Message Authentication", Internet Draft, March, 1996. 250 [FIPS-180-1] NIST, FIPS PUB 180-1: Secure Hash Standard, April 1995. 251 [URL] http://csrc.nist.gov/fips/fip180-1.txt (ascii) 252 [URL] http://csrc.nist.gov/fips/fip180-1.ps (postscript) 253 [SCHNEIER] B. Schneier, "Applied Cryptography Protocols, Algorithms, and 254 Source Code in C", John Wiley & Sons, Inc. 1994. 255 [ESP-DES-MD5] J. Hughes, "Combined DES-CBC, MD5, and Replay Prevention 256 Security Transform", Internet Draft, April, 1996. 258 Contacts 260 Shu-jen Chang 261 NIST 262 Building 820, Room 456 263 Gaithersburg, MD 20899 265 shu-jen.chang@nist.gov 267 Robert Glenn 268 NIST 269 Building 820, Room 455 270 Gaithersburg, MD 20899 272 rob.glenn@nist.gov