idnits 2.17.1 draft-ovsienko-babel-hmac-authentication-05.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- -- The draft header indicates that this document updates RFC6126, but the abstract doesn't seem to directly say this. It does mention RFC6126 though, so this could be OK. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == The document seems to lack the recommended RFC 2119 boilerplate, even if it appears to use RFC 2119 keywords -- however, there's a paragraph with a matching beginning. Boilerplate error? (The document does seem to have the reference to RFC 2119 which the ID-Checklist requires). -- The document date (October 18, 2013) is 3840 days in the past. Is this intentional? Checking references for intended status: Experimental ---------------------------------------------------------------------------- == Missing Reference: 'TLV' is mentioned on line 2271, but not defined ** Obsolete normative reference: RFC 6126 (ref. 'BABEL') (Obsoleted by RFC 8966) -- Obsolete informational reference (is this intentional?): RFC 2629 (Obsoleted by RFC 7749) -- Obsolete informational reference (is this intentional?): RFC 3315 (Obsoleted by RFC 8415) -- Obsolete informational reference (is this intentional?): RFC 6506 (ref. 'OSPF3-AUTH') (Obsoleted by RFC 7166) -- Obsolete informational reference (is this intentional?): RFC 6982 (Obsoleted by RFC 7942) == Outdated reference: A later version (-04) exists of draft-chroboczek-babel-extension-mechanism-00 Summary: 1 error (**), 0 flaws (~~), 4 warnings (==), 6 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group D. Ovsienko 3 Internet-Draft Yandex 4 Updates: 6126 (if approved) October 18, 2013 5 Intended status: Experimental 6 Expires: April 21, 2014 8 Babel HMAC Cryptographic Authentication 9 draft-ovsienko-babel-hmac-authentication-05 11 Abstract 13 This document describes a cryptographic authentication mechanism for 14 Babel routing protocol, updating, but not superceding RFC 6126. The 15 mechanism allocates two new TLV types for the authentication data, 16 uses HMAC and is both optional and backward compatible. 18 Status of this Memo 20 This Internet-Draft is submitted in full conformance with the 21 provisions of BCP 78 and BCP 79. 23 Internet-Drafts are working documents of the Internet Engineering 24 Task Force (IETF). Note that other groups may also distribute 25 working documents as Internet-Drafts. The list of current Internet- 26 Drafts is at http://datatracker.ietf.org/drafts/current/. 28 Internet-Drafts are draft documents valid for a maximum of six months 29 and may be updated, replaced, or obsoleted by other documents at any 30 time. It is inappropriate to use Internet-Drafts as reference 31 material or to cite them other than as "work in progress." 33 This Internet-Draft will expire on April 21, 2014. 35 Copyright Notice 37 Copyright (c) 2013 IETF Trust and the persons identified as the 38 document authors. All rights reserved. 40 This document is subject to BCP 78 and the IETF Trust's Legal 41 Provisions Relating to IETF Documents 42 (http://trustee.ietf.org/license-info) in effect on the date of 43 publication of this document. Please review these documents 44 carefully, as they describe your rights and restrictions with respect 45 to this document. Code Components extracted from this document must 46 include Simplified BSD License text as described in Section 4.e of 47 the Trust Legal Provisions and are provided without warranty as 48 described in the Simplified BSD License. 50 Table of Contents 52 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4 53 1.1. Requirements Language . . . . . . . . . . . . . . . . . . 5 54 2. Cryptographic Aspects . . . . . . . . . . . . . . . . . . . . 5 55 2.1. Mandatory-to-Implement and Optional Hash Algorithms . . . 5 56 2.2. Definition of Padding . . . . . . . . . . . . . . . . . . 7 57 2.3. Cryptographic Sequence Number Specifics . . . . . . . . . 8 58 2.4. Definition of HMAC . . . . . . . . . . . . . . . . . . . . 9 59 3. Updates to Protocol Data Structures . . . . . . . . . . . . . 11 60 3.1. RxAuthRequired . . . . . . . . . . . . . . . . . . . . . . 11 61 3.2. LocalTS . . . . . . . . . . . . . . . . . . . . . . . . . 11 62 3.3. LocalPC . . . . . . . . . . . . . . . . . . . . . . . . . 11 63 3.4. MaxDigestsIn . . . . . . . . . . . . . . . . . . . . . . . 12 64 3.5. MaxDigestsOut . . . . . . . . . . . . . . . . . . . . . . 12 65 3.6. ANM Table . . . . . . . . . . . . . . . . . . . . . . . . 12 66 3.7. ANM Timeout . . . . . . . . . . . . . . . . . . . . . . . 13 67 3.8. Configured Security Associations . . . . . . . . . . . . . 14 68 3.9. Effective Security Associations . . . . . . . . . . . . . 16 69 4. Updates to Protocol Encoding . . . . . . . . . . . . . . . . . 17 70 4.1. Justification . . . . . . . . . . . . . . . . . . . . . . 17 71 4.2. TS/PC TLV . . . . . . . . . . . . . . . . . . . . . . . . 19 72 4.3. HMAC TLV . . . . . . . . . . . . . . . . . . . . . . . . . 20 73 5. Updates to Protocol Operation . . . . . . . . . . . . . . . . 20 74 5.1. Per-Interface TS/PC Number Updates . . . . . . . . . . . . 20 75 5.2. Deriving ESAs from CSAs . . . . . . . . . . . . . . . . . 22 76 5.3. Updates to Packet Sending . . . . . . . . . . . . . . . . 24 77 5.4. Updates to Packet Receiving . . . . . . . . . . . . . . . 27 78 5.5. Authentication-Specific Statistics Maintenance . . . . . . 29 79 6. Implementation Notes . . . . . . . . . . . . . . . . . . . . . 30 80 6.1. Source Address Selection for Sending . . . . . . . . . . . 30 81 6.2. Output Buffer Management . . . . . . . . . . . . . . . . . 30 82 6.3. Optimisations of ESAs Deriving . . . . . . . . . . . . . . 31 83 6.4. Security Associations Duplication . . . . . . . . . . . . 32 84 7. Network Management Aspects . . . . . . . . . . . . . . . . . . 33 85 7.1. Backward Compatibility . . . . . . . . . . . . . . . . . . 33 86 7.2. Multi-Domain Authentication . . . . . . . . . . . . . . . 34 87 7.3. Migration to and from Authenticated Exchange . . . . . . . 35 88 7.4. Handling of Authentication Keys Exhaustion . . . . . . . . 36 89 8. Implementation Status . . . . . . . . . . . . . . . . . . . . 37 90 9. Security Considerations . . . . . . . . . . . . . . . . . . . 38 91 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 42 92 11. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 42 93 12. References . . . . . . . . . . . . . . . . . . . . . . . . . . 43 94 12.1. Normative References . . . . . . . . . . . . . . . . . . . 43 95 12.2. Informative References . . . . . . . . . . . . . . . . . . 43 96 Appendix A. Figures and Tables . . . . . . . . . . . . . . . . . 46 97 Appendix B. Test Vectors . . . . . . . . . . . . . . . . . . . . 50 98 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 53 100 1. Introduction 102 [RFC Editor: before publication please remove the sentence below.] 103 Comments are solicited and should be addressed to the author. 105 Authentication of routing protocol exchanges is a common mean of 106 securing computer networks. Use of protocol authentication 107 mechanisms helps in ascertaining that only the intended routers 108 participate in routing information exchange, and that the exchanged 109 routing information is not modified by a third party. 111 [BABEL] ("the original specification") defines data structures, 112 encoding, and the operation of a basic Babel routing protocol 113 instance ("instance of the original protocol"). This document ("this 114 specification") defines data structures, encoding, and the operation 115 of an extension to the Babel protocol, an authentication mechanism 116 ("this mechanism"). Both the instance of the original protocol and 117 this mechanism are mostly self-contained and interact only at 118 coupling points defined in this specification. 120 A major design goal of this mechanism is transparency to operators 121 that is not affected by implementation and configuration specifics. 122 A complying implementation makes all meaningful details of 123 authentication-specific processing clear to the operator, even when 124 some of the operational parameters cannot be changed. 126 The currently established (see [RIP2-AUTH], [OSPF2-AUTH], 127 [OSPF3-AUTH], [ISIS-AUTH-A], and [RFC6039]) approach to 128 authentication mechanism design for datagram-based routing protocols 129 such as Babel relies on two principal data items embedded into 130 protocol packets, typically as two integral parts of a single data 131 structure: 133 o A fixed-length unsigned integer, typically called a cryptographic 134 sequence number, used in replay attack protection. 136 o A variable-length sequence of octets, a result of the HMAC 137 construct (see [RFC2104]) computed on meaningful data items of the 138 packet (including the cryptographic sequence number) on one hand 139 and a secret key on the other, used in proving that both the 140 sender and the receiver share the same secret key and that the 141 meaningful data was not changed in transmission. 143 Depending on the design specifics either all protocol packets are 144 authenticated or only those protecting the integrity of protocol 145 exchange. This mechanism authenticates all protocol packets. 147 This specification defines the use of the cryptographic sequence 148 number in details sufficient to make replay attack protection 149 strength predictable. That is, an operator can tell the strength 150 from the declared characteristics of an implementation and, whereas 151 the implementation allows to change relevant parameters, the effect 152 of a reconfiguration. 154 This mechanism explicitly allows for multiple HMAC results per 155 authenticated packet. Since meaningful data items of a given packet 156 remain the same, each such HMAC result stands for a different secret 157 key and/or a different hash algorithm. This enables a simultaneous, 158 independent authentication within multiple domains. This 159 specification is not novel in this regard, e.g., L2TPv3 allows for 1 160 or 2 results per authenticated packet ([RFC3931] Section 5.4.1). 162 An important concern addressed by this mechanism is limiting the 163 amount of HMAC computations done per authenticated packet, 164 independently for sending and receiving. Without these limits the 165 number of computations per packet could be as high as the number of 166 configured authentication keys (in the sending case) or as the number 167 of keys multiplied by the number of supplied HMAC results (in the 168 receiving case). 170 These limits establish a basic competition between the configured 171 keys and (in the receiving case) an additional competition between 172 the supplied HMAC results. This specification defines related data 173 structures and procedures in a way to make such competition 174 transparent and predictable for an operator. 176 Wherever this specification mentions the operator reading or changing 177 a particular data structure, variable, parameter, or event counter 178 "at runtime", it is up to the implementor how this is to be done. 179 For example, the implementation can employ an interactive CLI, or a 180 management protocol such as SNMP, or an inter-process communication 181 mean such as a local socket, or a combination of these. 183 1.1. Requirements Language 185 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 186 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 187 document are to be interpreted as described in BCP 14 [RFC2119]. 189 2. Cryptographic Aspects 191 2.1. Mandatory-to-Implement and Optional Hash Algorithms 193 [RFC2104] defines HMAC as a construct that can use any cryptographic 194 hash algorithm with a known digest length and internal block size. 196 This specification preserves this property of HMAC by defining data 197 processing that itself does not depend on any particular hash 198 algorithm either. However, since this mechanism is a protocol 199 extension case, there are relevant design considerations to take into 200 account. 202 Section 4.5 of [RFC6709] suggests selecting one hash algorithm as 203 mandatory-to-implement for the purpose of global interoperability 204 (Section 3.2 ibid.) and selecting another of distinct lineage as 205 recommended for implementation for the purpose of cryptographic 206 agility. This specification makes the latter property guaranteed, 207 rather than probable, through an elevation of the requirement level. 208 There are two hash algorithms mandatory-to-implement, unambiguously 209 defined and generally available in multiple implementations each. 211 An implementation of this mechanism MUST include support for two hash 212 algorithms: 214 o RIPEMD-160 (160-bit digest) 216 o SHA-1 (160-bit digest) 218 Besides that, an implementation of this mechanism MAY include support 219 for additional hash algorithms, provided each such algorithm is 220 publicly and openly specified and its digest length is 128 bits or 221 more (to meet the constraint implied in Section 2.2). Implementors 222 SHOULD consider strong, well-known hash algorithms as additional 223 implementation options and MUST NOT consider hash algorithms for that 224 by the time of implementation meaningful attacks exist or that are 225 commonly viewed as deprecated. 227 In the latter case it is important to take into account 228 considerations both common (such as those made in [RFC4270]) and 229 specific to the HMAC application of the hash algorithm. E.g., 230 [RFC6151] considers MD5 collisions and concludes that new protocol 231 designs should not use HMAC-MD5, while [RFC6194] includes a 232 comparable analysis of SHA-1 that finds HMAC-SHA-1 secure for the 233 same purpose. 235 For example, the following hash algorithms meet these requirements at 236 the time of this writing (in alphabetical order): 238 o GOST R 34.11-94 (256-bit digest) 240 o SHA-224 (224-bit digest, SHA-2 family) 242 o SHA-256 (256-bit digest, SHA-2 family) 243 o SHA-384 (384-bit digest, SHA-2 family) 245 o SHA-512 (512-bit digest, SHA-2 family) 247 o Tiger (192-bit digest) 249 o Whirlpool (512-bit digest, 2nd rev., 2003) 251 The set of hash algorithms available in an implementation MUST be 252 clearly stated. When known weak authentication keys exist for a hash 253 algorithm used in the HMAC construct, an implementation MUST deny a 254 use of such keys. 256 2.2. Definition of Padding 258 Many practical applications of HMAC for authentication of datagram- 259 based network protocols (including routing protocols) involve the 260 padding procedure, a design-specific conditioning of the message that 261 both the sender and the receiver perform before the HMAC computation. 262 Specific padding procedure of this mechanism addresses the following 263 needs: 265 o Data Initialization 267 A design that places the HMAC result(s) computed for a message 268 inside the same message after the computation has to allocate in 269 the message some data unit(s) purposed for the result(s) (in this 270 mechanism it is the HMAC TLV(s), see Section 4.3). The padding 271 procedure sets respective octets of the data unit(s), in the 272 simplest case to a fixed value known as the padding constant. 274 Particular value of the constant is specific to each design. For 275 instance, in [RIP2-AUTH] as well as works derived from it 276 ([ISIS-AUTH-B], [OSPF2-AUTH], and [OSPF3-AUTH]) the value is 277 0x878FE1F3. In many other designs (for instance, [RFC3315], 278 [RFC3931], [RFC4030], [RFC4302], [RFC5176], and [ISIS-AUTH-A]) the 279 value is 0x00. 281 However, the HMAC construct is defined on the base of a 282 cryptographic hash algorithm, that is, an algorithm meeting 283 particular set of requirements made for any input message. Thus 284 any padding constant values, whether single- or multiple-octet, as 285 well as any other message conditioning methods, don't affect 286 cryptographic characteristics of the hash algorithm and the HMAC 287 construct respectively. 289 o Source Address Protection 290 In the specific case of datagram-based routing protocols the 291 protocol packet (that is, the message being authenticated) often 292 does not include network layer addresses, although the source and 293 (to a lesser extent) the destination address of the datagram may 294 be meaningful in the scope of the protocol instance. 296 In Babel the source address may be used as a prefix hext hop (see 297 Section 3.5.3 of [BABEL]). A well-known (see Section 2.3 of 298 [OSPF3-AUTH]) solution to the source address protection problem is 299 to set the first respective octets of the data unit(s) above to 300 the source address (yet setting the rest of the octets to the 301 padding constant). This procedure adapts this solution to the 302 specifics of Babel, which allows for exchange of protocol packets 303 using both IPv4 and IPv6 datagrams (see Section 4 of [BABEL]). 304 Even though in the case of IPv6 exchange a Babel speaker currently 305 uses only link-local source addresses (Section 3.1 ibid.), this 306 procedure protects all octets of an arbitrary given source address 307 for the reasons of future extensibility. The procedure implies 308 that future Babel extensions will never use an IPv4-mapped IPv6 309 address as a packet source address. 311 This procedure does not protect the destination address, which is 312 currently considered meaningless (ibid.) in the same scope. A 313 future extension that looks to add such protection would likely 314 use a new TLV or sub-TLV to include the destination address into 315 the protocol packet (see Section 4.1). 317 Description of the padding procedure: 319 1. Set the first 16 octets of the Digest field of the given HMAC TLV 320 to: 322 * the given source address, if it is an IPv6 address, or 324 * the IPv4-mapped IPv6 address (per Section 2.5.5.2 of 325 [RFC4291]) holding the given source address, if it is an IPv4 326 address. 328 2. Set the remaining (TLV Length - 18) octets of the Digest field of 329 the given HMAC TLV to 0x00. 331 For an example of a Babel packet with padded HMAC TLVs see Table 3. 333 2.3. Cryptographic Sequence Number Specifics 335 Operation of this mechanism may involve multiple local and multiple 336 remote cryptographic sequence numbers, each essentially being a 337 48-bit unsigned integer. This specification uses a term "TS/PC 338 number" to avoid confusion with the route's (Section 2.5 of [BABEL]) 339 or node's (Section 3.2.1 ibid.) sequence numbers of the original 340 Babel specification and to stress the fact that there are two 341 distinguished parts of this 48-bit number, each handled in its 342 specific way (see Section 5.1): 344 0 1 2 3 4 345 0 1 2 3 4 5 6 7 8 9 0 // 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 346 +-+-+-+-+-+-+-+-+-+-+-//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 347 | TS // | PC | 348 +-+-+-+-+-+-+-+-+-+-//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 349 // 351 The high-order 32 bits are called "timestamp" (TS) and the low-order 352 16 bits are called "packet counter" (PC). 354 This mechanism stores, updates, compares, and encodes each TS/PC 355 number as two independent unsigned integers, TS and PC respectively. 356 Such comparison of TS/PC numbers performed in item 3 of Section 5.4 357 is algebraically equivalent to comparison of respective 48-bit 358 unsigned integers. Any byte order conversion, when required, is 359 performed on TS and PC parts independently. 361 2.4. Definition of HMAC 363 The algorithm description below uses the following nomenclature, 364 which is consistent with [FIPS-198]: 366 Text Is the data on which the HMAC is calculated (note item (b) of 367 Section 9). In this specification it is the contents of a 368 Babel packet ranging from the beginning of the Magic field of 369 the Babel packet header to the end of the last octet of the 370 Packet Body field, as defined in Section 4.2 of [BABEL] (see 371 Figure 2). 373 H Is the specific hash algorithm (see Section 2.1). 375 K Is a sequence of octets of an arbitrary, known length. 377 Ko Is the cryptographic key used with the hash algorithm. 379 B Is the block size of H, measured in octets rather than bits. 380 Note that B is the internal block size, not the digest length. 382 L Is the digest length of H, measured in octets rather than 383 bits. 385 XOR Is the bitwise exclusive-or operation. 387 Opad Is the hexadecimal value 0x5C repeated B times. 389 Ipad Is the hexadecimal value 0x36 repeated B times. 391 The algorithm below is the original, unmodified HMAC construct as 392 defined in both [RFC2104] and [FIPS-198], hence it is different from 393 the algorithms defined in [RIP2-AUTH], [ISIS-AUTH-B], [OSPF2-AUTH], 394 and [OSPF3-AUTH] in exactly two regards: 396 o The algorithm below sets the size of Ko to B, not to L (L is not 397 greater than B). This resolves both ambiguity in XOR expressions 398 and incompatibility in handling of keys that have length greater 399 than L but not greater than B. 401 o The algorithm below does not change value of Text before or after 402 the computation. Both padding of a Babel packet before the 403 computation and placing of the result inside the packet are 404 performed elsewhere. 406 The intent of this is to enable the most straightforward use of 407 cryptographic libraries by implementations of this specification. At 408 the time of this writing implementations of the original HMAC 409 construct coupled with hash algorithms of choice are generally 410 available. 412 Description of the algorithm: 414 1. Preparation of the Key 416 In this application, Ko is always B octets long. If K is B 417 octets long, then Ko is set to K. If K is more than B octets 418 long, then Ko is set to H(K) with the necessary amount of zeroes 419 appended to the end of H(K), such that Ko is B octets long. If K 420 is less than B octets long, then Ko is set to K with zeroes 421 appended to the end of K, such that Ko is B octets long. 423 2. First-Hash 425 A First-Hash, also known as the inner hash, is computed as 426 follows: 428 First-Hash = H(Ko XOR Ipad || Text) 430 3. Second-Hash 431 A second hash, also known as the outer hash, is computed as 432 follows: 434 Second-Hash = H(Ko XOR Opad || First-Hash) 436 4. Result 438 The resulting Second-Hash becomes the authentication data that is 439 returned as the result of HMAC calculation. 441 Note that in the case of Babel the Text parameter will never exceed a 442 few thousands of octets in length. In this specific case the 443 optimization discussed in Section 6 of [FIPS-198] applies, namely, 444 for a given K that is more than B octets long the following 445 associated intermediate results may be precomputed only once: Ko, 446 (Ko XOR Ipad), and (Ko XOR Opad). 448 3. Updates to Protocol Data Structures 450 3.1. RxAuthRequired 452 RxAuthRequired is a boolean parameter, its default value MUST be 453 TRUE. An implementation SHOULD make RxAuthRequired a per-interface 454 parameter, but MAY make it specific to the whole protocol instance. 455 The conceptual purpose of RxAuthRequired is to enable a smooth 456 migration from an unauthenticated to an authenticated Babel packet 457 exchange and back (see Section 7.3). Current value of RxAuthRequired 458 directly affects the receiving procedure defined in Section 5.4. An 459 implementation SHOULD allow the operator to change RxAuthRequired 460 value at runtime or by means of Babel speaker restart. An 461 implementation MUST allow the operator to discover the effective 462 value of RxAuthRequired at runtime or from the system documentation. 464 3.2. LocalTS 466 LocalTS is a 32-bit unsigned integer variable, it is the TS part of a 467 per-interface TS/PC number. LocalTS is a strictly per-interface 468 variable not intended to be changed by the operator. Its 469 initialization is explained in Section 5.1. 471 3.3. LocalPC 473 LocalPC is a 16-bit unsigned integer variable, it is the PC part of a 474 per-interface TS/PC number. LocalPC is a strictly per-interface 475 variable not intended to be changed by the operator. Its 476 initialization is explained in Section 5.1. 478 3.4. MaxDigestsIn 480 MaxDigestsIn is an unsigned integer parameter conceptually purposed 481 for limiting the amount of CPU time spent processing a received 482 authenticated packet. The receiving procedure performs the most CPU- 483 intensive operation, the HMAC computation, only at most MaxDigestsIn 484 (Section 5.4 item 7) times for a given packet. 486 MaxDigestsIn value MUST be at least 2. An implementation SHOULD make 487 MaxDigestsIn a per-interface parameter, but MAY make it specific to 488 the whole protocol instance. An implementation SHOULD allow the 489 operator to change the value of MaxDigestsIn at runtime or by means 490 of Babel speaker restart. An implementation MUST allow the operator 491 to discover the effective value of MaxDigestsIn at runtime or from 492 the system documentation. 494 3.5. MaxDigestsOut 496 MaxDigestsOut is an unsigned integer parameter conceptually purposed 497 for limiting the amount of a sent authenticated packet's space spent 498 on authentication data. The sending procedure adds at most 499 MaxDigestsOut (Section 5.3 item 5) HMAC results to a given packet, 500 concurring with the output buffer management explained in 501 Section 6.2. 503 The MaxDigestsOut value MUST be at least 2. An implementation SHOULD 504 make MaxDigestsOut a per-interface parameter, but MAY make it 505 specific to the whole protocol instance. An implementation SHOULD 506 allow the operator to change the value of MaxDigestsOut at runtime or 507 by means of Babel speaker restart, in a safe range. The maximum safe 508 value of MaxDigestsOut is implementation-specific (see Section 6.2). 509 An implementation MUST allow the operator to discover the effective 510 value of MaxDigestsOut at runtime or from the system documentation. 512 3.6. ANM Table 514 The ANM (Authentic Neighbours Memory) table resembles the neighbour 515 table defined in Section 3.2.3 of [BABEL]. Note that the term 516 "neighbour table" means the neighbour table of the original Babel 517 specification, and the term "ANM table" means the table defined 518 herein. Indexing of the ANM table is done in exactly the same way as 519 indexing of the neighbour table, but purpose, field set and 520 associated procedures are different. 522 The conceptual purpose of the ANM table is to provide longer term 523 replay attack protection than it would be possible using the 524 neighbour table. Expiry of an inactive entry in the neighbour table 525 depends on the last received Hello Interval of the neighbour and 526 typically stands for tens to hundreds of seconds (see Appendix A and 527 Appendix B of [BABEL]). Expiry of an inactive entry in the ANM table 528 depends only on the local speaker's configuration. The ANM table 529 retains (for at least the amount of seconds set by ANM timeout 530 parameter defined in Section 3.7) a copy of TS/PC number advertised 531 in authentic packets by each remote Babel speaker. 533 The ANM table is indexed by pairs of the form (Interface, Source). 534 Every table entry consists of the following fields: 536 o Interface 538 An implementation-specific reference to the local node's interface 539 that the authentic packet was received through. 541 o Source 543 The source address of the Babel speaker that the authentic packet 544 was received from. 546 o LastTS 548 A 32-bit unsigned integer, the TS part of a remote TS/PC number. 550 o LastPC 552 A 16-bit unsigned integer, the PC part of a remote TS/PC number. 554 Each ANM table entry has an associated aging timer, which is reset by 555 the receiving procedure (Section 5.4 item 9). If the timer expires, 556 the entry is deleted from the ANM table. 558 An implementation SHOULD use a persistent memory (NVRAM) to retain 559 the contents of ANM table across restarts of the Babel speaker, but 560 only as long as both the Interface field reference and expiry of the 561 aging timer remain correct. An implementation MUST make it clear, if 562 and how persistent memory is used for ANM table. An implementation 563 SHOULD allow the operator to retrieve the current contents of ANM 564 table at runtime. An implementation SHOULD allow the operator to 565 remove some or all of ANM table entries at runtime or by means of 566 Babel speaker restart. 568 3.7. ANM Timeout 570 ANM timeout is an unsigned integer parameter. An implementation 571 SHOULD make ANM timeout a per-interface parameter, but MAY make it 572 specific to the whole protocol instance. ANM timeout is conceptually 573 purposed for limiting the maximum age (in seconds) of entries in the 574 ANM table standing for inactive Babel speakers. The maximum age is 575 immediately related to replay attack protection strength. The 576 strongest protection is achieved with the maximum possible value of 577 ANM timeout set, but it may not provide the best overall result for 578 specific network segments and implementations of this mechanism. 580 In the first turn, implementations unable to maintain local TS/PC 581 number strictly increasing across Babel speaker restarts will reuse 582 the advertised TS/PC numbers after each restart (see Section 5.1). 583 The neighbouring speakers will treat the new packets as replayed and 584 discard them until the aging timer of respective ANM table entry 585 expires or the new TS/PC number exceeds the one stored in the entry. 587 Another possible, but less probable, case could be an environment 588 using IPv6 for Babel datagrams exchange and involving physical moves 589 of network interfaces hardware between Babel speakers. Even 590 performed without restarting the speakers, these would cause random 591 drops of the TS/PC number advertised for a given (Interface, Source) 592 index, as viewed by neighbouring speakers, since IPv6 link-local 593 addresses are typically derived from interface hardware addresses. 595 Assuming that in such cases the operators would prefer to use a lower 596 ANM timeout value to let the entries expire on their own rather than 597 having to manually remove them from the ANM table each time, an 598 implementation SHOULD set the default value of ANM timeout to a value 599 between 30 and 300 seconds. 601 At the same time, network segments may exist with every Babel speaker 602 having its advertised TS/PC number strictly increasing over the 603 deployed lifetime. Assuming that in such cases the operators would 604 prefer using a much higher ANM timeout value, an implementation 605 SHOULD allow the operator to change the value of ANM timeout at 606 runtime or by means of Babel speaker restart. An implementation MUST 607 allow the operator to discover the effective value of ANM timeout at 608 runtime or from the system documentation. 610 3.8. Configured Security Associations 612 A Configured Security Association (CSA) is a data structure 613 conceptually purposed for associating authentication keys and hash 614 algorithms with Babel interfaces. All CSAs are managed in finite 615 sequences, one sequence per interface ("interface's sequence of CSAs" 616 hereafter). Each interface's sequence of CSAs, as an integral part 617 of the Babel speaker configuration, MAY be intended for a persistent 618 storage as long as this conforms with the implementation's key 619 management policy. The default state of an interface's sequence of 620 CSAs is empty, which has a special meaning of no authentication 621 configured for the interface. The sending (Section 5.3 item 1) and 622 the receiving (Section 5.4 item 1) procedures address this convention 623 accordingly. 625 A single CSA structure consists of the following fields: 627 o HashAlgo 629 An implementation-specific reference to one of the hash algorithms 630 supported by this implementation (see Section 2.1). 632 o KeyChain 634 A finite sequence of elements ("KeyChain sequence" hereafter) 635 representing authentication keys, each element being a structure 636 consisting of the following fields: 638 * LocalKeyID 640 An unsigned integer of an implementation-specific bit length. 642 * AuthKeyOctets 644 A sequence of octets of an arbitrary, known length to be used 645 as the authentication key. 647 * KeyStartAccept 649 The time that this Babel speaker will begin considering this 650 authentication key for accepting packets with authentication 651 data. 653 * KeyStartGenerate 655 The time that this Babel speaker will begin considering this 656 authentication key for generating packet authentication data. 658 * KeyStopGenerate 660 The time that this Babel speaker will stop considering this 661 authentication key for generating packet authentication data. 663 * KeyStopAccept 665 The time that this Babel speaker will stop considering this 666 authentication key for accepting packets with authentication 667 data. 669 Since there is no limit imposed on the number of CSAs per interface, 670 but the number of HMAC computations per sent/received packet is 671 limited (through MaxDigestsOut and MaxDigestsIn respectively), only a 672 fraction of the associated keys and hash algorithms may appear used 673 in the process. The ordering of elements within a sequence of CSAs 674 and within a KeyChain sequence is important to make the association 675 selection process deterministic and transparent. Once this ordering 676 is deterministic at the Babel interface level, the intermediate data 677 derived by the procedure defined in Section 5.2 will be 678 deterministically ordered as well. 680 An implementation SHOULD allow an operator to set any arbitrary order 681 of elements within a given interface's sequence of CSAs and within 682 the KeyChain sequence of a given CSA. Regardless if this requirement 683 is or isn't met, the implementation MUST provide a mean to discover 684 the actual element order used. Whichever order is used by an 685 implementation, it MUST be preserved across Babel speaker restarts. 687 Note that none of the CSA structure fields is constrained to contain 688 unique values. Section 6.4 explains this in more detail. It is 689 possible for the KeyChain sequence to be empty, although this is not 690 the intended manner of CSAs use. 692 The KeyChain sequence has a direct prototype, which is the "key 693 chain" syntax item of some existing router configuration languages. 694 Whereas an implementation already implements this syntax item, it is 695 suggested to reuse it, that is, to implement a CSA syntax item 696 referring to a key chain item instead of reimplementing the latter in 697 full. 699 3.9. Effective Security Associations 701 An Effective Security Association (ESA) is a data structure 702 immediately used in sending (Section 5.3) and receiving (Section 5.4) 703 procedures. Its conceptual purpose is to determine a runtime 704 interface between those procedures and the deriving procedure defined 705 in Section 5.2. All ESAs are temporary data units managed as 706 elements of finite sequences that are not intended for a persistent 707 storage. Element ordering within each such finite sequence 708 ("sequence of ESAs" hereafter) MUST be preserved as long as the 709 sequence exists. 711 A single ESA structure consists of the following fields: 713 o HashAlgo 715 An implementation-specific reference to one of the hash algorithms 716 supported by this implementation (see Section 2.1). 718 o KeyID 720 A 16-bit unsigned integer. 722 o AuthKeyOctets 724 A sequence of octets of an arbitrary, known length to be used as 725 the authentication key. 727 Note that among the protocol data structures introduced by this 728 mechanism ESA is the only one not directly interfaced with the system 729 operator (see Figure 1), it is not immediately present in the 730 protocol encoding either. However, ESA is not just a possible 731 implementation technique, but an integral part of this specification: 732 the deriving (Section 5.2), the sending (Section 5.3), and the 733 receiving (Section 5.4) procedures are defined in terms of the ESA 734 structure and its semantics provided herein. ESA is as meaningful 735 for a correct implementation as the other protocol data structures. 737 4. Updates to Protocol Encoding 739 4.1. Justification 741 Choice of encoding is very important in the long term. The protocol 742 encoding limits various authentication mechanism designs and 743 encodings, which in turn limit future developments of the protocol. 745 Considering existing implementations of Babel protocol instance 746 itself and related modules of packet analysers, the current encoding 747 of Babel allows for compact and robust decoders. At the same time, 748 this encoding allows for future extensions of Babel by three (not 749 excluding each other) principal means defined by Section 4.2 and 750 Section 4.3 of [BABEL] and further discussed in 751 [I-D.chroboczek-babel-extension-mechanism]: 753 a. A Babel packet consists of a four-octet header followed by a 754 packet body, that is, a sequence of TLVs (see Figure 2). Besides 755 the header and the body, an actual Babel datagram may have an 756 arbitrary amount of trailing data between the end of the packet 757 body and the end of the datagram. An instance of the original 758 protocol silently ignores such trailing data. 760 b. The packet body uses a binary format allowing for 256 TLV types 761 and imposing no requirements on TLV ordering or number of TLVs of 762 a given type in a packet. [BABEL] allocates TLV types 0 through 763 10 (see Table 1), defines TLV body structure for each and 764 establishes the requirement for a Babel protocol instance to 765 ignore any unknown TLV types silently. This makes it possible to 766 examine a packet body (to validate the framing and/or to pick 767 particular TLVs for further processing) considering only the type 768 (to distinguish between a Pad1 TLV and any other TLV) and the 769 length of each TLV, regardless if and how many additional TLV 770 types are eventually deployed. 772 c. Within each TLV of the packet body there may be some "extra data" 773 after the "expected length" of the TLV body. An instance of the 774 original protocol silently ignores any such extra data. Note 775 that any TLV types without the expected length defined (such as 776 PadN TLV) cannot be extended with the extra data. 778 Considering each principal extension mean for the specific purpose of 779 adding authentication data items to each protocol packet, the 780 following arguments can be made: 782 o Use of the TLV extra data of some existing TLV type would not be a 783 solution, since no particular TLV type is guaranteed to be present 784 in a Babel packet. 786 o Use of the TLV extra data could also conflict with future 787 developments of the protocol encoding. 789 o Since the packet trailing data is currently unstructured, using it 790 would involve defining an encoding structure and associated 791 procedures, adding to the complexity of both specification and 792 implementation and increasing the exposure to protocol attacks 793 such as fuzzing. 795 o A naive use of the packet trailing data would make it unavailable 796 to any future extension of Babel. Since this mechanism is 797 possibly not the last extension and since some other extensions 798 may allow no other embedding means except the packet trailing 799 data, the defined encoding structure would have to enable 800 multiplexing of data items belonging to different extensions. 801 Such a definition is out of the scope of this work. 803 o Deprecating an extension (or only its protocol encoding) that uses 804 purely purpose-allocated TLVs is as simple as deprecating the 805 TLVs. 807 o Use of purpose-allocated TLVs is transparent for both the original 808 protocol and any its future extensions, regardless of the 809 embedding mean(s) used by the latter. 811 Considering all of the above, this mechanism neither uses the packet 812 trailing data nor uses the TLV extra data, but uses two new TLV 813 types: type 11 for a TS/PC number and type 12 for an HMAC result (see 814 Table 1). 816 4.2. TS/PC TLV 818 The purpose of a TS/PC TLV is to store a single TS/PC number. There 819 is exactly one TS/PC TLV in an authenticated Babel packet. 821 0 1 2 3 822 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 823 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 824 | Type = 11 | Length | PacketCounter | 825 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 826 | Timestamp | 827 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 829 Fields: 831 Type Set to 11 to indicate a TS/PC TLV. 833 Length The length of the body, exclusive of the Type and 834 Length fields. 836 PacketCounter A 16-bit unsigned integer in network byte order, the 837 PC part of a TS/PC number stored in this TLV. 839 Timestamp A 32-bit unsigned integer in network byte order, the 840 TS part of a TS/PC number stored in this TLV. 842 Note that the ordering of PacketCounter and Timestamp in the TLV 843 structure is opposite to the ordering of TS and PC in "TS/PC" term 844 and the 48-bit equivalent (see Section 2.3). 846 Considering the "expected length" and the "extra data" in the 847 definition of Section 4.3 of [BABEL], the expected length of a TS/PC 848 TLV body is unambiguously defined as 6 octets. The receiving 849 procedure correctly processes any TS/PC TLV with body length not less 850 than the expected, ignoring any extra data (Section 5.4 items 3 and 851 9). The sending procedure produces a TS/PC TLV with body length 852 equal to the expected and Length field set respectively (Section 5.3 853 item 3). 855 Future Babel extensions (such as sub-TLVs) MAY modify the sending 856 procedure to include the extra data after the fixed-size TS/PC TLV 857 body defined herein, making necessary adjustments to Length TLV 858 field, "Body length" packet header field and output buffer management 859 explained in Section 6.2. 861 4.3. HMAC TLV 863 The purpose of an HMAC TLV is to store a single HMAC result. To 864 assist a receiver in reproducing the HMAC computation, LocalKeyID 865 modulo 2^16 of the authentication key is also provided in the TLV. 866 There is at least one HMAC TLV in an authenticated Babel packet. 868 0 1 2 3 869 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 870 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 871 | Type = 12 | Length | KeyID | 872 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 873 | Digest... 874 +-+-+-+-+-+-+-+-+-+-+-+- 876 Fields: 878 Type Set to 12 to indicate an HMAC TLV. 880 Length The length of the body, exclusive of the Type and 881 Length fields. 883 KeyID A 16-bit unsigned integer in network byte order. 885 Digest A variable-length sequence of octets, which is at 886 least 16 octets long (see Section 2.2). 888 Considering the "expected length" and the "extra data" in the 889 definition of Section 4.3 of [BABEL], the expected length of an HMAC 890 TLV body is not defined. The receiving and the padding procedures 891 process every octet of the Digest field, deriving the field boundary 892 from the Length field value (Section 5.4 item 7 and Section 2.2 893 respectively). The sending procedure produces HMAC TLVs with Length 894 field precisely sizing the Digest field to match digest length of the 895 hash algorithm used (Section 5.3 items 5 and 8). 897 The HMAC TLV structure defined herein is final, future Babel 898 extensions MUST NOT extend it with any extra data. 900 5. Updates to Protocol Operation 902 5.1. Per-Interface TS/PC Number Updates 904 The LocalTS and LocalPC interface-specific variables constitute the 905 TS/PC number of a Babel interface. This number is advertised in the 906 TS/PC TLV of authenticated Babel packets sent from that interface. 907 There is only one property mandatory for the advertised TS/PC number: 909 its 48-bit equivalent (see Section 2.3) MUST be strictly increasing 910 within the scope of a given interface of a Babel speaker as long as 911 the protocol instance is continuously operating. This property 912 combined with ANM tables of neighbouring Babel speakers provides them 913 with the most basic replay attack protection. 915 Initialization and increment are two principal updates performed on 916 an interface TS/PC number. The initialization is performed when a 917 new interface becomes a part of a Babel protocol instance. The 918 increment is performed by the sending procedure (Section 5.3 item 2) 919 before advertising the TS/PC number in a TS/PC TLV. 921 Depending on particular implementation method of these two updates 922 the advertised TS/PC number may possess additional properties 923 improving the replay attack protection strength. This includes, but 924 is not limited to the methods below. 926 a. The most straightforward implementation would use LocalTS as a 927 plain wrap counter, defining the updates as follows: 929 initialization Set LocalPC to 0, set LocalTS to 0. 931 increment Increment LocalPC by 1. If LocalPC wraps (0xFFFF 932 + 1 = 0x0000), increment LocalTS by 1. 934 In this case the advertised TS/PC numbers would be reused after 935 each Babel protocol instance restart, making neighbouring 936 speakers reject authenticated packets until the respective ANM 937 table entries expire or the new TS/PC number exceeds the old (see 938 Section 3.6 and Section 3.7). 940 b. A more advanced implementation could make a use of any 32-bit 941 unsigned integer timestamp (number of time units since an 942 arbitrary epoch) such as the UNIX timestamp, whereas the 943 timestamp itself spans a reasonable time range and is guaranteed 944 against a decrease (such as one resulting from network time use). 945 The updates would be defined as follows: 947 initialization Set LocalPC to 0, set LocalTS to 0. 949 increment If the current timestamp is greater than LocalTS, 950 set LocalTS to the current timestamp and LocalPC 951 to 0, then consider the update complete. 952 Otherwise increment LocalPC by 1 and, if LocalPC 953 wraps, increment LocalTS by 1. 955 In this case the advertised TS/PC number would remain unique 956 across the speaker's deployed lifetime without the need for any 957 persistent storage. However, a suitable timestamp source is not 958 available in every implementation case. 960 c. Another advanced implementation could use LocalTS in a way 961 similar to the "wrap/boot counter" suggested in Section 4.1.1 of 962 [OSPF3-AUTH], defining the updates as follows: 964 initialization Set LocalPC to 0. If there is a TS value stored 965 in NVRAM for the current interface, set LocalTS 966 to the stored TS value, then increment the stored 967 TS value by 1. Otherwise set LocalTS to 0 and 968 set the stored TS value to 1. 970 increment Increment LocalPC by 1. If LocalPC wraps, set 971 LocalTS to the TS value stored in NVRAM for the 972 current interface, then increment the stored TS 973 value by 1. 975 In this case the advertised TS/PC number would also remain unique 976 across the speaker's deployed lifetime, relying on NVRAM for 977 storing multiple TS numbers, one per interface. 979 As long as the TS/PC number retains its mandatory property stated 980 above, it is up to the implementor, which TS/PC number updates 981 methods are available and if the operator can configure the method 982 per-interface and/or at runtime. However, an implementation MUST 983 disclose the essence of each update method it includes, in a 984 comprehensible form such as natural language description, pseudocode, 985 or source code. An implementation MUST allow the operator to 986 discover, which update method is effective for any given interface, 987 either at runtime or from the system documentation. These 988 requirements are necessary to enable the optimal (see Section 3.7) 989 management of ANM timeout in a network segment. 991 Note that wrapping (0xFFFFFFFF + 1 = 0x00000000) of LastTS is 992 unlikely, but possible, causing the advertised TS/PC number to be 993 reused. Resolving this situation requires replacing all 994 authentication keys of the involved interface. In addition to that, 995 if the wrap was caused by a timestamp reaching its end of epoch, 996 using this mechanism will be impossible for the involved interface 997 until some different timestamp or update implementation method is 998 used. 1000 5.2. Deriving ESAs from CSAs 1002 Neither receiving nor sending procedures work with the contents of 1003 interface's sequence of CSAs directly, both (Section 5.4 item 4 and 1004 Section 5.3 item 4 respectively) derive a sequence of ESAs from the 1005 sequence of CSAs and use the derived sequence (see Figure 1). There 1006 are two main goals achieved through this indirection: 1008 o Elimination of expired authentication keys and deduplication of 1009 security associations. This is done as early as possible to keep 1010 subsequent procedures focused on their respective tasks. 1012 o Maintenance of particular ordering within the derived sequence of 1013 ESAs. The ordering deterministically depends on the ordering 1014 within the interface's sequence of CSAs and the ordering within 1015 KeyChain sequence of each CSA. The particular correlation 1016 maintained by this procedure implements a concept of fair 1017 (independent of number of keys contained by each) competition 1018 between CSAs. 1020 The deriving procedure uses the following input arguments: 1022 o input sequence of CSAs 1024 o direction (sending or receiving) 1026 o current time (CT) 1028 The processing of input arguments begins with an empty output 1029 sequence of ESAs and consists of the following steps: 1031 1. Make a temporary copy of the input sequence of CSAs. 1033 2. Remove all expired authentication keys from each KeyChain 1034 sequence of the copy, that is, any keys such that: 1036 * for receiving: KeyStartAccept is greater than CT or 1037 KeyStopAccept is less than CT 1039 * for sending: KeyStartGenerate is greater than CT or 1040 KeyStopGenerate is less than CT 1042 Note well that there are no special exceptions. Remove all 1043 expired keys, even if there are no keys left after that (see 1044 Section 7.4). 1046 3. Use the copy to populate the output sequence of ESAs as follows: 1048 1. When the KeyChain sequence of the first CSA contains at least 1049 one key, use its first key to produce an ESA with fields set 1050 as follows: 1052 HashAlgo Set to HashAlgo of the current CSA. 1054 KeyID Set to LocalKeyID modulo 2^16 of the current 1055 key of the current CSA. 1057 AuthKeyOctets Set to AuthKeyOctets of the current key of the 1058 current CSA. 1060 Append this ESA to the end of the output sequence. 1062 2. When the KeyChain sequence of the second CSA contains at 1063 least one key, use its first key the same way and so forth 1064 until all first keys of the copy are processed. 1066 3. When the KeyChain sequence of the first CSA contains at least 1067 two keys, use its second key the same way. 1069 4. When the KeyChain sequence of the second CSA contains at 1070 least two keys, use its second key the same way and so forth 1071 until all second keys of the copy are processed. 1073 5. And so forth until all keys of all CSAs of the copy are 1074 processed, exactly once each. 1076 In the description above the ordinals ("first", "second", and so 1077 on) with regard to keys stand for an element position after the 1078 removal of expired keys, not before. For example, if a KeyChain 1079 sequence was { Ka, Kb, Kc, Kd } before the removal and became 1080 { Ka, Kd } after, then Ka would be the "first" element and Kd 1081 would be the "second". 1083 4. Deduplicate the ESAs in the output sequence, that is, wherever 1084 two or more ESAs exist that share the same (HashAlgo, KeyID, 1085 AuthKeyOctets) triplet value, remove all of these ESAs except the 1086 one closest to the beginning of the sequence. 1088 The resulting sequence will contain zero or more unique ESAs, ordered 1089 in a way deterministically correlated with ordering of CSAs within 1090 the original input sequence of CSAs and ordering of keys within each 1091 KeyChain sequence. This ordering maximizes the probability of having 1092 equal amount of keys per original CSA in any N first elements of the 1093 resulting sequence. Possible optimisations of this deriving 1094 procedure are outlined in Section 6.3. 1096 5.3. Updates to Packet Sending 1098 Perform the following authentication-specific processing after the 1099 instance of the original protocol considers an outgoing Babel packet 1100 ready for sending, but before the packet is actually sent (see 1101 Figure 1). After that send the packet regardless if the 1102 authentication-specific processing modified the outgoing packet or 1103 left it intact. 1105 1. If the current outgoing interface's sequence of CSAs is empty, 1106 finish authentication-specific processing and consider the packet 1107 ready for sending. 1109 2. Increment TS/PC number of the current outgoing interface as 1110 explained in Section 5.1. 1112 3. Add to the packet body (see the note at the end of this section) 1113 a TS/PC TLV with fields set as follows: 1115 Type Set to 11. 1117 Length Set to 6. 1119 PacketCounter Set to the current value of LocalPC variable of 1120 the current outgoing interface. 1122 Timestamp Set to the current value of LocalTS variable of 1123 the current outgoing interface. 1125 Note that the current step may involve byte order conversion. 1127 4. Derive a sequence of ESAs using procedure defined in Section 5.2 1128 with the current interface's sequence of CSAs as the input 1129 sequence of CSAs, the current time as CT and "sending" as the 1130 direction. Proceed to the next step even if the derived sequence 1131 is empty. 1133 5. Iterate over the derived sequence using its ordering. For each 1134 ESA add to the packet body (see the note at the end of this 1135 section) an HMAC TLV with fields set as follows: 1137 Type Set to 12. 1139 Length Set to 2 plus digest length of HashAlgo of the current 1140 ESA. 1142 KeyID Set to KeyID of the current ESA. 1144 Digest Size exactly equal to the digest length of HashAlgo of 1145 the current ESA. Pad (see Section 2.2) using the source 1146 address of the current packet (see Section 6.1). 1148 As soon as there are MaxDigestsOut HMAC TLVs added to the current 1149 packet body, immediately proceed to the next step. 1151 Note that the current step may involve byte order conversion. 1153 6. Increment the "Body length" field value of the current packet 1154 header by the total length of TS/PC and HMAC TLVs appended to the 1155 current packet body so far. 1157 Note that the current step may involve byte order conversion. 1159 7. Make a temporary copy of the current packet. 1161 8. Iterate over the derived sequence again, using the same order and 1162 number of elements. For each ESA (and respectively for each HMAC 1163 TLV recently appended to the current packet body) compute an HMAC 1164 result (see Section 2.4) using the temporary copy (not the 1165 original packet) as Text, HashAlgo of the current ESA as H, and 1166 AuthKeyOctets of the current ESA as K. Write the HMAC result to 1167 the Digest field of the current HMAC TLV (see Table 4) of the 1168 current packet (not the copy). 1170 9. After this point, allow no more changes to the current packet 1171 header and body and consider it ready for sending. 1173 Note that even when the derived sequence of ESAs is empty, the packet 1174 is sent anyway with only a TS/PC TLV appended to its body. Although 1175 such a packet would not be authenticated, the presence of the sole 1176 TS/PC TLV would indicate authentication key exhaustion to operators 1177 of neighbouring Babel speakers. See also Section 7.4. 1179 Also note that it is possible to place the authentication-specific 1180 TLVs in the packet's sequence of TLVs in a number of different valid 1181 ways so long as there is exactly one TS/PC TLV in the sequence and 1182 the ordering of HMAC TLVs relative to each other, as produced in step 1183 5 above, is preserved. 1185 For example, see Figure 2. The diagrams represent a Babel packet 1186 without (D1) and with (D2, D3, D4) authentication-specific TLVs. The 1187 optional trailing data block that is present in D1 is preserved in 1188 D2, D3, and D4. Indexing (1, 2, ..., n) of the HMAC TLVs means the 1189 order in which the sending procedure produced them (and respectively 1190 the HMAC results). In D2 the added TLVs are appended: the previously 1191 existing TLVs are followed by the TS/PC TLV, which is followed by the 1192 HMAC TLVs. In D3 the added TLVs are prepended: the TS/PC TLV is the 1193 first and is followed by the HMAC TLVs, which are followed by the 1194 previously existing TLVs. In D4 the added TLVs are intermixed with 1195 the previously existing TLVs and the TS/PC TLV is placed after the 1196 HMAC TLVs. All three packets meet the requirements above. 1198 Implementors SHOULD use appending (D2) for adding the authentication- 1199 specific TLVs to the sequence, this is expected to result in more 1200 straightforward implementation and troubleshooting in most use cases. 1202 5.4. Updates to Packet Receiving 1204 Perform the following authentication-specific processing after an 1205 incoming Babel packet is received from the local network stack, but 1206 before it is processed by the Babel protocol instance (see Figure 1). 1207 The final action conceptually depends not only upon the result of the 1208 authentication-specific processing, but also on the current value of 1209 RxAuthRequired parameter. Immediately after any processing step 1210 below accepts or refuses the packet, either deliver the packet to the 1211 instance of the original protocol (when the packet is accepted or 1212 RxAuthRequired is FALSE) or discard it (when the packet is refused 1213 and RxAuthRequired is TRUE). 1215 1. If the current incoming interface's sequence of CSAs is empty, 1216 accept the packet. 1218 2. If the current packet does not contain exactly one TS/PC TLV, 1219 refuse it. 1221 3. Perform a lookup in the ANM table for an entry having Interface 1222 equal to the current incoming interface and Source equal to the 1223 source address of the current packet. If such an entry does not 1224 exist, immediately proceed to the next step. Otherwise, compare 1225 the entry's LastTS and LastPC field values with Timestamp and 1226 PacketCounter values respectively of the TS/PC TLV of the 1227 packet. That is, refuse the packet, if at least one of the 1228 following two conditions is true: 1230 * Timestamp is less than LastTS 1232 * Timestamp is equal to LastTS and PacketCounter is not greater 1233 than LastPC 1235 Note that the current step may involve byte order conversion. 1237 4. Derive a sequence of ESAs using procedure defined in Section 5.2 1238 with the current interface's sequence of CSAs as the input 1239 sequence of CSAs, current time as CT and "receiving" as the 1240 direction. If the derived sequence is empty, refuse the packet. 1242 5. Make a temporary copy of the current packet. 1244 6. Pad (see Section 2.2) every HMAC TLV present in the temporary 1245 copy (not the original packet) using the source address of the 1246 original packet. 1248 7. Iterate over all the HMAC TLVs of the original input packet (not 1249 the copy) using their order of appearance in the packet. For 1250 each HMAC TLV look up all ESAs in the derived sequence such that 1251 2 plus digest length of HashAlgo of the ESA is equal to Length 1252 of the TLV and KeyID of the ESA is equal to value of KeyID of 1253 the TLV. Iterate over these ESAs in the relative order of their 1254 appearance on the full sequence of ESAs. Note that nesting the 1255 iterations the opposite way (over ESAs, then over HMAC TLVs) 1256 would be wrong. 1258 For each of these ESAs compute an HMAC result (see Section 2.4) 1259 using the temporary copy (not the original packet) as Text, 1260 HashAlgo of the current ESA as H, and AuthKeyOctets of the 1261 current ESA as K. If the current HMAC result exactly matches the 1262 contents of Digest field of the current HMAC TLV, immediately 1263 proceed to the next step. Otherwise, if the number of HMAC 1264 computations done for the current packet so far is equal to 1265 MaxDigestsIn, immediately proceed to the next step. Otherwise 1266 follow the normal order of iterations. 1268 Note that the current step may involve byte order conversion. 1270 8. Refuse the input packet unless there was a matching HMAC result 1271 in the previous step. 1273 9. Modify the ANM table, using the same index as for the entry 1274 lookup above, to contain an entry with LastTS set to the value 1275 of Timestamp and LastPC set to the value of PacketCounter fields 1276 of the TS/PC TLV of the current packet. That is, either add a 1277 new ANM table entry or update the existing one, depending on the 1278 result of the entry lookup above. Reset the entry's aging timer 1279 to the current value of ANM timeout. 1281 Note that the current step may involve byte order conversion. 1283 10. Accept the input packet. 1285 Note that RxAuthRequired affects only the final action, but not the 1286 defined flow of authentication-specific processing. The purpose of 1287 this is to preserve authentication-specific processing feedback (such 1288 as log messages and event counters updates) even with RxAuthRequired 1289 set to FALSE. This allows an operator to predict the effect of 1290 changing RxAuthRequired from FALSE to TRUE during a migration 1291 scenario (Section 7.3) implementation. 1293 5.5. Authentication-Specific Statistics Maintenance 1295 A Babel speaker implementing this mechanism SHOULD maintain a set of 1296 counters for the following events, per protocol instance and per 1297 interface: 1299 o Sending of an unauthenticated Babel packet through an interface 1300 having an empty sequence of CSAs (Section 5.3 item 1). 1302 o Sending of an unauthenticated Babel packet with a TS/PC TLV but 1303 without any HMAC TLVs due to an empty derived sequence of ESAs 1304 (Section 5.3 item 4). 1306 o Sending of an authenticated Babel packet containing both TS/PC and 1307 HMAC TLVs (Section 5.3 item 9). 1309 o Accepting of a Babel packet received through an interface having 1310 an empty sequence of CSAs (Section 5.4 item 1). 1312 o Refusing of a received Babel packet due to an empty derived 1313 sequence of ESAs (Section 5.4 item 4). 1315 o Refusing of a received Babel packet that does not contain exactly 1316 one TS/PC TLV (Section 5.4 item 2). 1318 o Refusing of a received Babel packet due to the TS/PC TLV failing 1319 the ANM table check (Section 5.4 item 3). In the view of future 1320 extensions this event SHOULD leave out some small amount, per 1321 current (Interface, Source, LastTS, LastPC) tuple, of the packets 1322 refused due to Timestamp value being equal to LastTS and 1323 PacketCounter value being equal to LastPC. 1325 o Refusing of a received Babel packet missing any HMAC TLVs 1326 (Section 5.4 item 8). 1328 o Refusing of a received Babel packet due to none of the processed 1329 HMAC TLVs passing the ESA check (Section 5.4 item 8). 1331 o Accepting of a received Babel packet having both TS/PC and HMAC 1332 TLVs (Section 5.4 item 10). 1334 o Delivery of a refused packet to the instance of the original 1335 protocol due to RxAuthRequired parameter set to FALSE. 1337 Note that terms "accepting" and "refusing" are used in the sense of 1338 the receiving procedure, that is, "accepting" does not mean a packet 1339 delivered to the instance of the original protocol purely because the 1340 RxAuthRequired parameter is set to FALSE. Event counters readings 1341 SHOULD be available to the operator at runtime. 1343 6. Implementation Notes 1345 6.1. Source Address Selection for Sending 1347 Section 3.1 of [BABEL] allows for exchange of protocol datagrams 1348 using IPv4 or IPv6 or both. The source address of the datagram is a 1349 unicast (link-local in the case of IPv6) address. Within an address 1350 family used by a Babel speaker there may be more than one addresses 1351 eligible for the exchange and assigned to the same network interface. 1352 The original specification considers this case out of scope and 1353 leaves it up to the speaker's network stack to select one particular 1354 address as the datagram source address. But the sending procedure 1355 requires (Section 5.3 item 5) exact knowledge of packet source 1356 address for proper padding of HMAC TLVs. 1358 As long as a network interface has more than one addresses eligible 1359 for the exchange within the same address family, the Babel speaker 1360 SHOULD internally choose one of those addresses for Babel packet 1361 sending purposes and make this choice to both the sending procedure 1362 and the network stack (see Figure 1). Wherever this requirement 1363 cannot be met, this limitation MUST be clearly stated in the system 1364 documentation to allow an operator to plan network address management 1365 accordingly. 1367 6.2. Output Buffer Management 1369 An instance of the original protocol buffers produced TLVs until the 1370 buffer becomes full or a delay timer has expired. This is performed 1371 independently for each Babel interface with each buffer sized 1372 according to the interface MTU (see Sections 3.1 and 4 of [BABEL]). 1374 Since TS/PC and HMAC TLVs and any other TLVs, in the first place 1375 those of the original protocol, share the same packet space (see 1376 Figure 2) and respectively the same buffer space, a particular 1377 portion of each interface buffer needs to be reserved for 1 TS/PC TLV 1378 and up to MaxDigestsOut HMAC TLVs. The amount (R) of this reserved 1379 buffer space is calculated as follows: 1381 R = St + MaxDigestsOut * Sh = 1382 = 8 + MaxDigestsOut * (4 + Lmax) 1384 St Is the size of a TS/PC TLV. 1386 Sh Is the size of an HMAC TLV. 1388 Lmax Is the maximum digest length in octets possible for a 1389 particular interface. It SHOULD be calculated based on 1390 particular interface's sequence of CSAs, but MAY be taken as 1391 the maximum digest length supported by particular 1392 implementation. 1394 An implementation allowing for per-interface value of MaxDigestsOut 1395 or Lmax has to account for different value of R across different 1396 interfaces, even having the same MTU. An implementation allowing for 1397 runtime change of the value of R (due to MaxDigestsOut or Lmax) has 1398 to take care of the TLVs already buffered by the time of the change, 1399 especially when the value of R increases. 1401 The maximum safe value of MaxDigestsOut parameter depends on the 1402 interface MTU and maximum digest length used. In general, at least 1403 200-300 octets of a Babel packet should be always available to data 1404 other than TS/PC and HMAC TLVs. An implementation following the 1405 requirements of Section 4 of [BABEL] would send packets sized 512 1406 octets or larger. If, for example, the maximum digest length is 64 1407 octets and MaxDigestsOut value is 4, the value of R would be 280, 1408 leaving less than a half of a 512-octet packet for any other TLVs. 1409 As long as the interface MTU is larger or digest length is smaller, 1410 higher values of MaxDigestsOut can be used safely. 1412 6.3. Optimisations of ESAs Deriving 1414 The following optimisations of the ESAs deriving procedure can reduce 1415 amount of CPU time consumed by authentication-specific processing, 1416 preserving an implementation's effective behaviour. 1418 a. The most straightforward implementation would treat the deriving 1419 procedure as a per-packet action. But since the procedure is 1420 deterministic (its output depends on its input only), it is 1421 possible to significantly reduce the number of times the 1422 procedure is performed. 1424 The procedure would obviously return the same result for the same 1425 input arguments (sequence of CSAs, direction, CT) values. 1426 However, it is possible to predict when the result will remain 1427 the same even for a different input. That is, when the input 1428 sequence of CSAs and the direction both remain the same but CT 1429 changes, the result will remain the same as long as CT's order on 1430 the time axis (relative to all critical points of the sequence of 1431 CSAs) remains unchanged. Here, the critical points are 1432 KeyStartAccept and KeyStopAccept (for the "receiving" direction) 1433 and KeyStartGenerate and KeyStopGenerate (for the "sending" 1434 direction) of all keys of all CSAs of the input sequence. In 1435 other words, in this case the result will remain the same as long 1436 as both none of the active keys expire and none of the inactive 1437 keys enter into operation. 1439 An implementation optimised this way would perform the full 1440 deriving procedure for a given (interface, direction) pair only 1441 after an operator's change to the interface's sequence of CSAs or 1442 after reaching one of the critical points mentioned above. 1444 b. Considering that the sending procedure iterates over at most 1445 MaxDigestsOut elements of the derived sequence of ESAs 1446 (Section 5.3 item 5), there would be little sense in the case of 1447 "sending" direction in returning more than MaxDigestsOut unique 1448 ESAs in the derived sequence. Note that a similar optimisation 1449 is impossible in the case of "receiving" direction, since number 1450 of ESAs actually used in examining a particular packet cannot be 1451 determined in advance. 1453 6.4. Security Associations Duplication 1455 This specification defines three data structures as finite sequences: 1456 a KeyChain sequence, an interface's sequence of CSAs, and a sequence 1457 of ESAs. There are associated semantics to take into account during 1458 implementation, in that the same element can appear multiple times at 1459 different positions of the sequence. In particular, none of CSA 1460 structure fields (including HashAlgo, LocalKeyID, and AuthKeyOctets) 1461 alone or in a combination has to be unique within a given CSA, or 1462 within a given sequence of CSAs, or within all sequences of CSAs of a 1463 Babel speaker. 1465 In the CSA space defined this way, for any two authentication keys 1466 their one field (in)equality would not imply their another field 1467 (in)equality. In other words, it is acceptable to have more than one 1468 authentication key with the same LocalKeyID or the same AuthKeyOctets 1469 or both at a time. It is a conscious design decision that CSA 1470 semantics allow for duplication of security associations. 1471 Consequently, ESA semantics allow for duplication of intermediate 1472 ESAs in the sequence until the explicit deduplication (Section 5.2 1473 item 4). 1475 One of the intentions of this is to define the security association 1476 management in a way that allows the addressing of some specifics of 1477 Babel as a mesh routing protocol. For example, a system operator 1478 configuring a Babel speaker to participate in more than one 1479 administrative domain could find each domain using its own 1480 authentication key (AuthKeyOctets) under the same LocalKeyID value, 1481 e.g., a "well-known" or "default" value like 0 or 1. Since 1482 reconfiguring the domains to use distinct LocalKeyID values isn't 1483 always feasible, the multi-domain Babel speaker using several 1484 distinct authentication keys under the same LocalKeyID would make a 1485 valid use case for such duplication. 1487 Furthermore, if in this situation the operator decided to migrate one 1488 of the domains to a different LocalKeyID value in a seamless way, 1489 respective Babel speakers would use the same authentication key 1490 (AuthKeyOctets) under two different LocalKeyID values for the time of 1491 the transition (see also item (e) of Section 9). This would make a 1492 similar use case. 1494 Another intention of this design decision is to decouple security 1495 association management from authentication key management as much as 1496 possible, so that the latter, be it manual keying or a key management 1497 protocol, could be designed and implemented independently. This way 1498 the additional key management constraints, if any, would remain out 1499 of scope of this authentication mechanism. A similar thinking 1500 justifies LocalKeyID field having bit length in ESA structure 1501 definition, but not in that of CSA. 1503 7. Network Management Aspects 1505 7.1. Backward Compatibility 1507 Support of this mechanism is optional, it does not change the default 1508 behaviour of a Babel speaker and causes no compatibility issues with 1509 speakers properly implementing the original Babel specification. 1510 Given two Babel speakers, one implementing this mechanism and 1511 configured for authenticated exchange (A) and another not 1512 implementing it (B), these would not distribute routing information 1513 uni-directionally or form a routing loop or experience other protocol 1514 logic issues specific purely to the use of this mechanism. 1516 The Babel design requires a bi-directional neighbour reachability 1517 condition between two given speakers for a successful exchange of 1518 routing information. Apparently, in the case above neighbour 1519 reachability would be uni-directional. Presence of TS/PC and HMAC 1520 TLVs in Babel packets sent by A would be transparent to B. But lack 1521 of authentication data in Babel packets send by B would make them 1522 effectively invisible to the instance of the original protocol of A. 1523 Uni-directional links are not specific to use of this mechanism, they 1524 naturally exist on their own and are properly detected and coped with 1525 by the original protocol (see Section 3.4.2 of [BABEL]). 1527 7.2. Multi-Domain Authentication 1529 The receiving procedure treats a packet as authentic as soon as one 1530 of its HMAC TLVs passes the check against the derived sequence of 1531 ESAs. This allows for packet exchange authenticated with multiple 1532 (hash algorithm, authentication key) pairs simultaneously, in 1533 combinations as arbitrary as permitted by MaxDigestsIn and 1534 MaxDigestsOut. 1536 For example, consider three Babel speakers with one interface each, 1537 configured with the following CSAs: 1539 o speaker A: (hash algorithm H1; key SK1), (hash algorithm H1; key 1540 SK2) 1542 o speaker B: (hash algorithm H1; key SK1) 1544 o speaker C: (hash algorithm H1; key SK2) 1546 Packets sent by A would contain 2 HMAC TLVs each, packets sent by B 1547 and C would contain 1 HMAC TLV each. A and B would authenticate the 1548 exchange between themselves using H1 and SK1; A and C would use H1 1549 and SK2; B and C would discard each other's packets. 1551 Consider a similar set of speakers configured with different CSAs: 1553 o speaker D: (hash algorithm H2; key SK3), (hash algorithm H3; key 1554 SK4) 1556 o speaker E: (hash algorithm H2; key SK3), (hash algorithm H4, keys 1557 SK5 and SK6) 1559 o speaker F: (hash algorithm H3; keys SK4 and SK7), (hash algorithm 1560 H5, key SK8) 1562 Packets sent by D would contain 2 HMAC TLVs each, packets sent by E 1563 and F would contain 3 HMAC TLVs each. D and E would authenticate the 1564 exchange between themselves using H2 and SK3; D and F would use H3 1565 and SK4; E and F would discard each other's packets. The 1566 simultaneous use of H4, SK5, and SK6 by E, as well as use of SK7, H5, 1567 and SK8 by F (for their own purposes) would remain insignificant to 1568 A. 1570 An operator implementing a multi-domain authentication should keep in 1571 mind that values of MaxDigestsIn and MaxDigestsOut may be different 1572 both within the same Babel speaker and across different speakers. 1573 Since the minimum value of both parameters is 2 (see Section 3.4 and 1574 Section 3.5), when more than 2 authentication domains are configured 1575 simultaneously it is advised to confirm that every involved speaker 1576 can handle sufficient number of HMAC results for both sending and 1577 receiving. 1579 The recommended method of Babel speaker configuration for multi- 1580 domain authentication is not only using a different authentication 1581 key for each domain, but also using a separate CSA for each domain, 1582 even when hash algorithms are the same. This allows for fair 1583 competition between CSAs and sometimes limits the consequences of a 1584 possible misconfiguration to the scope of one CSA. See also item (e) 1585 of Section 9. 1587 7.3. Migration to and from Authenticated Exchange 1589 It is common in practice to consider a migration to authenticated 1590 exchange of routing information only after the network has already 1591 been deployed and put to an active use. Performing the migration in 1592 a way without regular traffic interruption is typically demanded, and 1593 this specification allows a smooth migration using the RxAuthRequired 1594 interface parameter defined in Section 3.1. This measure is similar 1595 to the "transition mode" suggested in Section 5 of [OSPF3-AUTH]. 1597 An operator performing the migration needs to arrange configuration 1598 changes as follows: 1600 1. Decide on particular hash algorithm(s) and key(s) to be used. 1602 2. Identify all speakers and their involved interfaces that need to 1603 be migrated to authenticated exchange. 1605 3. For each of the speakers and the interfaces to be reconfigured 1606 first set RxAuthRequired parameter to FALSE, then configure 1607 necessary CSA(s). 1609 4. Examine the speakers to confirm that Babel packets are 1610 successfully authenticated according to the configuration 1611 (supposedly, through examining ANM table entries and 1612 authentication-specific statistics, see Figure 1) and address any 1613 discrepancies before proceeding further. 1615 5. For each of the speakers and the reconfigured interfaces set the 1616 RxAuthRequired parameter to TRUE. 1618 Likewise, temporarily setting RxAuthRequired to FALSE can be used to 1619 migrate smoothly from an authenticated packet exchange back to 1620 unauthenticated one. 1622 7.4. Handling of Authentication Keys Exhaustion 1624 This specification employs a common concept of multiple authenticaion 1625 keys co-existing for a given interface, with two independent lifetime 1626 ranges associated with each key (one for sending and another for 1627 receiving). It is typically recommended to configure the keys using 1628 finite lifetimes, adding new keys before the old keys expire. 1629 However, it is obviously possible for all keys to expire for a given 1630 interface (for sending or receiving or both). Possible ways of 1631 addressing this situation raise their own concerns: 1633 o Automatic switching to unauthenticated protocol exchange. This 1634 behaviour invalidates the initial purposes of authentication and 1635 is commonly viewed as "unacceptable" ([RIP2-AUTH] Section 5.1, 1636 [OSPF2-AUTH] Section 3.2, [OSPF3-AUTH] Section 3). 1638 o Stopping routing information exchange over the interface. This 1639 behaviour is likely to impact regular traffic routing and is 1640 commonly viewed as "not advisable" (ibid.). 1642 o Use of the "most recently expired" key over its intended lifetime 1643 range. This behaviour is commonly recommended for implementation 1644 (ibid.), although it may become a problem due to an offline 1645 cryptographic attack (see item (e) of Section 9) or a compromise 1646 of the key. In addition, telling a recently expired key from a 1647 key never ever been in a use may be impossible after a router 1648 restart. 1650 Design of this mechanism prevents the automatic switching to 1651 unauthenticated exchange and is consistent with similar 1652 authentication mechanisms in this regard. But since the best choice 1653 between two other options depends on local site policy, this decision 1654 is left up to the operator rather than the implementor (in a way 1655 resembling the "fail secure" configuration knob described in Section 1656 5.1 of [RIP2-AUTH]). 1658 Although the deriving procedure does not allow for any exceptions in 1659 expired keys filtering (Section 5.2 item 2), the operator can 1660 trivially enforce one of the two remaining behaviour options through 1661 local key management procedures. In particular, when using the key 1662 over its intended lifetime is more preferred than regular traffic 1663 disruption, the operator would explicitly leave the old key expiry 1664 time open until the new key is added to the router configuration. In 1665 the opposite case the operator would always configure the old key 1666 with a finite lifetime and bear associated risks. 1668 8. Implementation Status 1670 [RFC Editor: before publication please remove this section and the 1671 reference to [RFC6982], along the offered experiment of which this 1672 section exists to assist document reviewers.] 1674 At the time of this writing the original Babel protocol is available 1675 in two free, production-quality implementations, both of which 1676 support IPv4 and IPv6 routing but exchange Babel packets using IPv6 1677 only: 1679 o The "standalone" babeld, a BSD-licensed software with source code 1680 publicly available [1]. 1682 That implementation does not support this authentication 1683 mechanism. 1685 o The integrated babeld component of Quagga-RE, a work derived from 1686 Quagga routing protocol suite, a GPL-lisensed software with source 1687 code publicly available [2]. 1689 That implementation supports this authentication mechanism as 1690 defined in revision 05 of this document. It supports both 1691 mandatory-to-implement hash algorithms (RIPEMD-160 and SHA-1) and 1692 a few additional algorithms (SHA-224, SHA-256, SHA-384, SHA-512 1693 and Whirlpool). It does not support more than one link-local IPv6 1694 address per interface. It implements authentication-specific 1695 parameters, data structures and methods as follows (whether a 1696 parameter can be "changed at runtime", it is done by means of CLI 1697 and can also be set in a configuration file): 1699 * MaxDigestsIn value is fixed to 4. 1701 * MaxDigestsOut value is fixed to 4. 1703 * RxAuthRequired value is specific to each interface and can be 1704 changed at runtime. 1706 * ANM Table contents is not retained across speaker restarts, can 1707 be retrieved and reset (all entries at once) by means of CLI. 1709 * ANM Timeout value is specific to the whole protocol instance, 1710 has a default value of 300 seconds and can be changed at 1711 runtime. 1713 * Ordering of elements within each interface's sequence of CSAs 1714 is arbitrary as set by operator at runtime. CSAs are 1715 implemented to refer to existing key chain syntax items. 1717 Elements of an interface's sequence of CSAs are constrained to 1718 be unique reference-wise, but not contents-wise, that is, it is 1719 possible to duplicate security associations using a different 1720 key chain name to contain the same keys. 1722 * Ordering of elements within each KeyChain sequence is fixed to 1723 the sort order of LocalKeyID. LocalKeyID is constrained to be 1724 unique within each KeyChain sequence. 1726 * TS/PC number updates method can be configured at runtime for 1727 the whole protocol instance to one of two methods standing for 1728 items (a) and (b) of Section 5.1. The default method is (b). 1730 * Most of the authentication-specific statistics counters listed 1731 in Section 5.5 are implemented (per protocol instance and per 1732 each interface) and their readings are available by means of 1733 CLI with an option to log respective events into a file. 1735 No other implementations of this authentication mechanism are 1736 known to exist, thus interoperability can only be assessed on 1737 paper. The only existing implementation has been tested to be 1738 fully compatible with itself regardless of a speaker CPU 1739 endianness. 1741 9. Security Considerations 1743 Use of this mechanism implies requirements common to a use of shared 1744 authentication keys, including, but not limited to: 1746 o holding the keys secret, 1748 o including sufficient amounts of random bits into each key, 1750 o rekeying on a regular basis, and 1752 o never reusing a used key for a different purpose 1754 That said, proper design and implementation of a key management 1755 policy is out of scope of this work. Many publications on this 1756 subject exist and should be used for this purpose (BCP 107 [RFC4107], 1757 BCP 132 [RFC4962], and [RFC6039] may be suggested as starting 1758 points). 1760 Considering particular attacks being in-scope or out of scope on one 1761 hand and measures taken to protect against particular in-scope 1762 attacks on the other, the original Babel protocol and this 1763 authentication mechanism are in line with similar datagram-based 1764 routing protocols and their respective mechanisms. In particular, 1765 the primary concerns addressed are: 1767 a. Peer Entity Authentication 1769 The Babel speaker authentication mechanism defined herein is 1770 believed to be as strong as is the class itself that it belongs 1771 to. This specification is built on fundamental concepts 1772 implemented for authentication of similar routing protocols: per- 1773 packet authentication, use of HMAC construct, use of shared keys. 1774 Although this design approach does not address all possible 1775 concerns, it is so far known to be sufficient for most practical 1776 cases. 1778 b. Data Integrity 1780 Meaningful parts of a Babel datagram are the contents of the 1781 Babel packet (in the definition of Section 4.2 of [BABEL]) and 1782 the source address of the datagram (Section 3.5.3 ibid.). This 1783 mechanism authenticates both parts using the HMAC construct, so 1784 that making any meaningful change to an authenticated packet 1785 after it has been emitted by the sender should be as hard as 1786 attacking the HMAC construct itself or successfully recovering 1787 the authentication key. 1789 Note well that any trailing data of the Babel datagram is not 1790 meaningful in the scope of the original specification and does 1791 not belong to the Babel packet. Integrity of the trailing data 1792 is respectively not protected by this mechanism. At the same 1793 time, although any TLV extra data is also not meaningful in the 1794 same scope, its integrity is protected, since this extra data is 1795 a part of the Babel packet (see Figure 2). 1797 c. Replay Attacks 1799 This specification establishes a basic replay protection measure 1800 (see Section 3.6), defines a timeout parameter affecting its 1801 strength (see Section 3.7), and outlines implementation methods 1802 also affecting protection strength in several ways (see 1803 Section 5.1). The implementor's choice of the timeout value and 1804 particular implementation methods may be suboptimal due to, for 1805 example, insufficient hardware resources of the Babel speaker. 1806 Furthermore, it may be possible that an operator configures the 1807 timeout and the methods to address particular local specifics and 1808 this further weakens the protection. An operator concerned about 1809 replay attack protection strength should understand these factors 1810 and their meaning in a given network segment. 1812 d. Denial of Service 1814 Proper deployment of this mechanism in a Babel network 1815 significantly increases the efforts required for an attacker to 1816 feed arbitrary Babel PDUs into protocol exchange (with an intent 1817 of attacking a particular Babel speaker or disrupting exchange of 1818 regular traffic in a routing domain). It also protects the 1819 neighbour table from being flooded with forged speaker entries. 1821 At the same time, this protection comes with a price of CPU time 1822 being spent on HMAC computations. This may be a concern for low- 1823 performance CPUs combined with high-speed interfaces, as 1824 sometimes seen in embedded systems and hardware routers. The 1825 MaxDigestsIn parameter, which is used to limit the maximum amount 1826 of CPU time spent on a single received Babel packet, addresses 1827 this concern to some extent. 1829 The following in-scope concerns are not addressed: 1831 e. Offline Cryptographic Attacks 1833 This mechanism is obviously subject to offline cryptographic 1834 attacks. As soon as an attacker has obtained a copy of an 1835 authenticated Babel packet of interest (which gets easier to do 1836 in wireless networks), he has got all the parameters of the 1837 authentication-specific processing performed by the sender, 1838 except authentication key(s) and choice of particular hash 1839 algorithm(s). Since digest lengths of common hash algorithms are 1840 well-known and can be matched with those seen in the packet, 1841 complexity of this attack is essentially that of the 1842 authentication key attack. 1844 Viewing the cryptographic strength of particular hash algorithms 1845 as a concern of its own, the main practical means of resisting 1846 offline cryptographic attacks on this mechanism are periodic 1847 rekeying and use of strong keys with a sufficient number of 1848 random bits. 1850 It is important to understand that in the case of multiple keys 1851 being used within single interface (for a multi-domain 1852 authentication or during a key rollover) the strength of the 1853 combined configuration would be that of the weakest key, since 1854 only one successful HMAC test is required for an authentic 1855 packet. Operators concerned about offline cryptographic attacks 1856 should enforce the same strength policy for all keys used for a 1857 given interface. 1859 Note that a special pathological case is possible with this 1860 mechanism. Whenever two or more authentication keys are 1861 configured for a given interface such that all keys share the 1862 same AuthKeyOctets and the same HashAlgo, but LocalKeyID modulo 1863 2^16 is different for each key, these keys will not be treated as 1864 duplicate (Section 5.2 item 4), but an HMAC result computed for a 1865 given packet will be the same for each of these keys. In the 1866 case of sending procedure this can produce multiple HMAC TLVs 1867 with exactly the same value of the Digest field, but different 1868 values of KeyID field. In this case the attacker will see that 1869 the keys are the same, even without the knowledge of the key 1870 itself. Reuse of authentication keys is not the intended use 1871 case of this mechanism and should be strongly avoided. 1873 f. Non-repudiation 1875 This specification relies on a use of shared keys. There is no 1876 timestamp infrastructure and no key revocation mechanism defined 1877 to address a shared key compromise. Establishing the time that a 1878 particular authentic Babel packet was generated is thus not 1879 possible. Proving that a particular Babel speaker had actually 1880 sent a given authentic packet is also impossible as soon as the 1881 shared key is claimed compromised. Even with the shared key not 1882 being compromised, reliably identifying the speaker that had 1883 actually sent a given authentic Babel packet is not possible any 1884 better than proving the speaker belongs to the group sharing the 1885 key (any of the speakers sharing a key can impose any other 1886 speaker sharing the same key). 1888 g. Confidentiality Violations 1890 The original Babel protocol does not encrypt any of the 1891 information contained in its packets. The contents of a Babel 1892 packet is trivial to decode, revealing network topology details. 1893 This mechanism does not improve this situation in any way. Since 1894 routing protocol messages are not the only kind of information 1895 subject to confidentiality concerns, a complete solution to this 1896 problem is likely to include measures based on the channel 1897 security model, such as IPSec and WPA2 at the time of this 1898 writing. 1900 h. Key Management 1902 Any authentication key exchange/distribution concerns are left 1903 out of scope. However, the internal representation of 1904 authentication keys (see Section 3.8) allows for diverse key 1905 management means, manual configuration in the first place. 1907 i. Message Deletion 1909 Any message deletion attacks are left out of scope. Since a 1910 datagram deleted by an attacker cannot be distinguished from a 1911 datagram naturally lost in transmission and since datagram-based 1912 routing protocols are designed to withstand a certain loss of 1913 packets, the currently established practice is treating 1914 authentication purely as a per-packet function without any added 1915 detection of lost packets. 1917 10. IANA Considerations 1919 [RFC Editor: please do not remove this section.] 1921 At the time of this publication Babel TLV Types namespace did not 1922 have an IANA registry. TLV types 11 and 12 were assigned (see 1923 Table 1) to the TS/PC and HMAC TLV types by Juliusz Chroboczek, 1924 designer of the original Babel protocol. Therefore, this document 1925 has no IANA actions. 1927 11. Acknowledgements 1929 Thanks to Randall Atkinson and Matthew Fanto for their comprehensive 1930 work on [RIP2-AUTH] that initiated a series of publications on 1931 routing protocols authentication, including this one. This 1932 specification adopts many concepts belonging to the whole series. 1934 Thanks to Juliusz Chroboczek, Gabriel Kerneis, and Matthieu Boutier. 1935 This document incorporates many technical and editorial corrections 1936 based on their feedback. Thanks to all contributors to Babel, 1937 because this work would not be possible without the prior works. 1938 Thanks to Dominic Mulligan for editorial proofreading of this 1939 document. Thanks to Riku Hietamaki for suggesting the test vectors 1940 section. 1942 Thanks to Jim Gettys and Dave Taht for developing CeroWrt wireless 1943 router project and collaborating on many integration issues. A 1944 practical need for Babel authentication emerged during a research 1945 based on CeroWrt that eventually became the very first use case of 1946 this mechanism. 1948 Thanks to Kunihiro Ishiguro and Paul Jakma for establishing GNU Zebra 1949 and Quagga routing software projects respectively. Thanks to Werner 1950 Koch, the author of Libgcrypt. The very first implementation of this 1951 mechanism was made on base of Quagga and Libgcrypt. 1953 This document was produced using the xml2rfc ([RFC2629]) authoring 1954 tool. 1956 12. References 1958 12.1. Normative References 1960 [RFC2104] Krawczyk, H., Bellare, M., and R. Canetti, "HMAC: Keyed- 1961 Hashing for Message Authentication", RFC 2104, 1962 February 1997. 1964 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1965 Requirement Levels", BCP 14, RFC 2119, March 1997. 1967 [RFC4291] Hinden, R. and S. Deering, "IP Version 6 Addressing 1968 Architecture", RFC 4291, February 2006. 1970 [FIPS-198] 1971 US National Institute of Standards & Technology, "The 1972 Keyed-Hash Message Authentication Code (HMAC)", FIPS 1973 PUB 198-1, July 2008. 1975 [BABEL] Chroboczek, J., "The Babel Routing Protocol", RFC 6126, 1976 April 2011. 1978 12.2. Informative References 1980 [RFC2629] Rose, M., "Writing I-Ds and RFCs using XML", RFC 2629, 1981 June 1999. 1983 [RFC3315] Droms, R., Bound, J., Volz, B., Lemon, T., Perkins, C., 1984 and M. Carney, "Dynamic Host Configuration Protocol for 1985 IPv6 (DHCPv6)", RFC 3315, July 2003. 1987 [RFC3931] Lau, J., Townsley, M., and I. Goyret, "Layer Two Tunneling 1988 Protocol - Version 3 (L2TPv3)", RFC 3931, March 2005. 1990 [RFC4030] Stapp, M. and T. Lemon, "The Authentication Suboption for 1991 the Dynamic Host Configuration Protocol (DHCP) Relay Agent 1992 Option", RFC 4030, March 2005. 1994 [RFC4107] Bellovin, S. and R. Housley, "Guidelines for Cryptographic 1995 Key Management", BCP 107, RFC 4107, June 2005. 1997 [RFC4270] Hoffman, P. and B. Schneier, "Attacks on Cryptographic 1998 Hashes in Internet Protocols", RFC 4270, November 2005. 2000 [RFC4302] Kent, S., "IP Authentication Header", RFC 4302, 2001 December 2005. 2003 [RIP2-AUTH] 2004 Atkinson, R. and M. Fanto, "RIPv2 Cryptographic 2005 Authentication", RFC 4822, February 2007. 2007 [RFC4962] Housley, R. and B. Aboba, "Guidance for Authentication, 2008 Authorization, and Accounting (AAA) Key Management", 2009 BCP 132, RFC 4962, July 2007. 2011 [RFC5176] Chiba, M., Dommety, G., Eklund, M., Mitton, D., and B. 2012 Aboba, "Dynamic Authorization Extensions to Remote 2013 Authentication Dial In User Service (RADIUS)", RFC 5176, 2014 January 2008. 2016 [ISIS-AUTH-A] 2017 Li, T. and R. Atkinson, "IS-IS Cryptographic 2018 Authentication", RFC 5304, October 2008. 2020 [ISIS-AUTH-B] 2021 Bhatia, M., Manral, V., Li, T., Atkinson, R., White, R., 2022 and M. Fanto, "IS-IS Generic Cryptographic 2023 Authentication", RFC 5310, February 2009. 2025 [OSPF2-AUTH] 2026 Bhatia, M., Manral, V., Fanto, M., White, R., Barnes, M., 2027 Li, T., and R. Atkinson, "OSPFv2 HMAC-SHA Cryptographic 2028 Authentication", RFC 5709, October 2009. 2030 [RFC6039] Manral, V., Bhatia, M., Jaeggli, J., and R. White, "Issues 2031 with Existing Cryptographic Protection Methods for Routing 2032 Protocols", RFC 6039, October 2010. 2034 [RFC6151] Turner, S. and L. Chen, "Updated Security Considerations 2035 for the MD5 Message-Digest and the HMAC-MD5 Algorithms", 2036 RFC 6151, March 2011. 2038 [RFC6194] Polk, T., Chen, L., Turner, S., and P. Hoffman, "Security 2039 Considerations for the SHA-0 and SHA-1 Message-Digest 2040 Algorithms", RFC 6194, March 2011. 2042 [OSPF3-AUTH] 2043 Bhatia, M., Manral, V., and A. Lindem, "Supporting 2044 Authentication Trailer for OSPFv3", RFC 6506, 2045 February 2012. 2047 [RFC6709] Carpenter, B., Aboba, B., and S. Cheshire, "Design 2048 Considerations for Protocol Extensions", RFC 6709, 2049 September 2012. 2051 [RFC6982] Sheffer, Y. and A. Farrel, "Improving Awareness of Running 2052 Code: The Implementation Status Section", RFC 6982, 2053 July 2013. 2055 [I-D.chroboczek-babel-extension-mechanism] 2056 Chroboczek, J., "Extension Mechanism for the Babel Routing 2057 Protocol", draft-chroboczek-babel-extension-mechanism-00 2058 (work in progress), June 2013. 2060 URIs 2062 [1] 2064 [2] 2066 Appendix A. Figures and Tables 2068 +-------------------------------------------------------------+ 2069 | authentication-specific statistics | 2070 +-------------------------------------------------------------+ 2071 ^ | ^ 2072 | v | 2073 | +-----------------------------------------------+ | 2074 | | system operator | | 2075 | +-----------------------------------------------+ | 2076 | ^ | ^ | ^ | ^ | ^ | | 2077 | | v | | | | | | | v | 2078 +---+ +---------+ | | | | | | +---------+ +---+ 2079 | |->| ANM | | | | | | | | LocalTS |->| | 2080 | R |<-| table | | | | | | | | LocalPC |<-| T | 2081 | x | +---------+ | v | v | v +---------+ | x | 2082 | | +----------------+ +---------+ +----------------+ | | 2083 | p | | MaxDigestsIn | | | | MaxDigestsOut | | p | 2084 | r |<-| ANM timeout | | CSAs | | |->| r | 2085 | o | | RxAuthRequired | | | | | | o | 2086 | c | +----------------+ +---------+ +----------------+ | c | 2087 | e | +-------------+ | | +-------------+ | e | 2088 | s | | Rx ESAs | | | | Tx ESAs | | s | 2089 | s |<-| (temporary) |<----+ +---->| (temporary) |->| s | 2090 | i | +-------------+ +-------------+ | i | 2091 | n | +------------------------------+----------------+ | n | 2092 | g | | instance of | output buffers |=>| g | 2093 | |=>| the original +----------------+ | | 2094 | | | protocol | source address |->| | 2095 +---+ +------------------------------+----------------+ +---+ 2096 /\ | || 2097 || v \/ 2098 +-------------------------------------------------------------+ 2099 | network stack | 2100 +-------------------------------------------------------------+ 2101 /\ || /\ || /\ || /\ || 2102 || \/ || \/ || \/ || \/ 2103 +---------+ +---------+ +---------+ +---------+ 2104 | speaker | | speaker | ... | speaker | | speaker | 2105 +---------+ +---------+ +---------+ +---------+ 2107 Flow of control data : ---> 2108 Flow of Babel datagrams/packets: ===> 2110 Figure 1: Interaction Diagram 2112 P 2113 |<---------------------------->| (D1) 2114 | B | 2115 | |<------------------------->| 2116 | | | 2117 +--+-----+-----+...+-----+-----+--+ P: Babel packet 2118 |H |some |some | |some |some |T | H: Babel packet header 2119 | |TLV |TLV | |TLV |TLV | | B: Babel packet body 2120 | | | | | | | | T: optional trailing data block 2121 +--+-----+-----+...+-----+-----+--+ 2123 P 2124 |<----------------------------------------------------->| (D2) 2125 | B | 2126 | |<-------------------------------------------------->| 2127 | | | 2128 +--+-----+-----+...+-----+-----+------+------+...+------+--+ 2129 |H |some |some | |some |some |TS/PC |HMAC | |HMAC |T | 2130 | |TLV |TLV | |TLV |TLV |TLV |TLV 1 | |TLV n | | 2131 | | | | | | | | | | | | 2132 +--+-----+-----+...+-----+-----+------+------+...+------+--+ 2134 P 2135 |<----------------------------------------------------->| (D3) 2136 | B | 2137 | |<-------------------------------------------------->| 2138 | | | 2139 +--+------+------+...+------+-----+-----+...+-----+-----+--+ 2140 |H |TS/PC |HMAC | |HMAC |some |some | |some |some |T | 2141 | |TLV |TLV 1 | |TLV n |TLV |TLV | |TLV |TLV | | 2142 | | | | | | | | | | | | 2143 +--+------+------+...+------+-----+-----+...+-----+-----+--+ 2145 P 2146 |<------------------------------------------------------------>| (D4) 2147 | B | 2148 | |<--------------------------------------------------------->| 2149 | | | 2150 +--+-----+------+-----+------+...+-----+------+...+------+-----+--+ 2151 |H |some |HMAC |some |HMAC | |some |HMAC | |TS/PC |some |T | 2152 | |TLV |TLV 1 |TLV |TLV 2 | |TLV |TLV n | |TLV |TLV | | 2153 | | | | | | | | | | | | | 2154 +--+-----+------+-----+------+...+-----+------+...+------+-----+--+ 2156 Figure 2: Babel Datagram Structure 2158 +-------+-------------------------+---------------+ 2159 | Value | Name | Reference | 2160 +-------+-------------------------+---------------+ 2161 | 0 | Pad1 | [BABEL] | 2162 | 1 | PadN | [BABEL] | 2163 | 2 | Acknowledgement Request | [BABEL] | 2164 | 3 | Acknowledgement | [BABEL] | 2165 | 4 | Hello | [BABEL] | 2166 | 5 | IHU | [BABEL] | 2167 | 6 | Router-Id | [BABEL] | 2168 | 7 | Next Hop | [BABEL] | 2169 | 8 | Update | [BABEL] | 2170 | 9 | Route Request | [BABEL] | 2171 | 10 | Seqno Request | [BABEL] | 2172 | 11 | TS/PC | this document | 2173 | 12 | HMAC | this document | 2174 +-------+-------------------------+---------------+ 2176 Table 1: Babel TLV Types Namespace 2178 +--------------+-----------------------------+-------------------+ 2179 | Packet field | Packet octets (hexadecimal) | Meaning (decimal) | 2180 +--------------+-----------------------------+-------------------+ 2181 | Magic | 2a | 42 | 2182 | Version | 02 | version 2 | 2183 | Body length | 00:14 | 20 octets | 2184 | [TLV] Type | 04 | 4 (Hello) | 2185 | [TLV] Length | 06 | 6 octets | 2186 | Reserved | 00:00 | no meaning | 2187 | Seqno | 09:25 | 2341 | 2188 | Interval | 01:90 | 400 (40.0 s) | 2189 | [TLV] Type | 08 | 8 (Update) | 2190 | [TLV] Length | 0a | 10 octets | 2191 | AE | 00 | 0 (wildcard) | 2192 | Flags | 40 | default router-id | 2193 | Plen | 00 | 0 bits | 2194 | Omitted | 00 | 0 bits | 2195 | Interval | ff:ff | infinity | 2196 | Seqno | 68:21 | 26657 | 2197 | Metric | ff:ff | infinity | 2198 +--------------+-----------------------------+-------------------+ 2200 Table 2: A Babel Packet without Authentication TLVs 2202 +---------------+-------------------------------+-------------------+ 2203 | Packet field | Packet octets (hexadecimal) | Meaning (decimal) | 2204 +---------------+-------------------------------+-------------------+ 2205 | Magic | 2a | 42 | 2206 | Version | 02 | version 2 | 2207 | Body length | 00:4c | 76 octets | 2208 | [TLV] Type | 04 | 4 (Hello) | 2209 | [TLV] Length | 06 | 6 octets | 2210 | Reserved | 00:00 | no meaning | 2211 | Seqno | 09:25 | 2341 | 2212 | Interval | 01:90 | 400 (40.0 s) | 2213 | [TLV] Type | 08 | 8 (Update) | 2214 | [TLV] Length | 0a | 10 octets | 2215 | AE | 00 | 0 (wildcard) | 2216 | Flags | 40 | default router-id | 2217 | Plen | 00 | 0 bits | 2218 | Omitted | 00 | 0 bits | 2219 | Interval | ff:ff | infinity | 2220 | Seqno | 68:21 | 26657 | 2221 | Metric | ff:ff | infinity | 2222 | [TLV] Type | 0b | 11 (TS/PC) | 2223 | [TLV] Length | 06 | 6 octets | 2224 | PacketCounter | 00:01 | 1 | 2225 | Timestamp | 52:1d:7e:8b | 1377664651 | 2226 | [TLV] Type | 0c | 12 (HMAC) | 2227 | [TLV] Length | 16 | 22 octets | 2228 | KeyID | 00:c8 | 200 | 2229 | Digest | fe:80:00:00:00:00:00:00:0a:11 | padding | 2230 | | 96:ff:fe:1c:10:c8:00:00:00:00 | | 2231 | [TLV] Type | 0c | 12 (HMAC) | 2232 | [TLV] Length | 16 | 22 octets | 2233 | KeyID | 00:64 | 100 | 2234 | Digest | fe:80:00:00:00:00:00:00:0a:11 | padding | 2235 | | 96:ff:fe:1c:10:c8:00:00:00:00 | | 2236 +---------------+-------------------------------+-------------------+ 2238 Table 3: A Babel Packet with Each HMAC TLV Padded Using IPv6 Address 2239 fe80::0a11:96ff:fe1c:10c8 2241 +---------------+-------------------------------+-------------------+ 2242 | Packet field | Packet octets (hexadecimal) | Meaning (decimal) | 2243 +---------------+-------------------------------+-------------------+ 2244 | Magic | 2a | 42 | 2245 | Version | 02 | version 2 | 2246 | Body length | 00:4c | 76 octets | 2247 | [TLV] Type | 04 | 4 (Hello) | 2248 | [TLV] Length | 06 | 6 octets | 2249 | Reserved | 00:00 | no meaning | 2250 | Seqno | 09:25 | 2341 | 2251 | Interval | 01:90 | 400 (40.0 s) | 2252 | [TLV] Type | 08 | 8 (Update) | 2253 | [TLV] Length | 0a | 10 octets | 2254 | AE | 00 | 0 (wildcard) | 2255 | Flags | 40 | default router-id | 2256 | Plen | 00 | 0 bits | 2257 | Omitted | 00 | 0 bits | 2258 | Interval | ff:ff | infinity | 2259 | Seqno | 68:21 | 26657 | 2260 | Metric | ff:ff | infinity | 2261 | [TLV] Type | 0b | 11 (TS/PC) | 2262 | [TLV] Length | 06 | 6 octets | 2263 | PacketCounter | 00:01 | 1 | 2264 | Timestamp | 52:1d:7e:8b | 1377664651 | 2265 | [TLV] Type | 0c | 12 (HMAC) | 2266 | [TLV] Length | 16 | 22 octets | 2267 | KeyID | 00:c8 | 200 | 2268 | Digest | c6:f1:06:13:30:3c:fa:f3:eb:5d | HMAC result | 2269 | | 60:3a:ed:fd:06:55:83:f7:ee:79 | | 2270 | [TLV] Type | 0c | 12 (HMAC) | 2271 | [TLV] Length | 16 | 22 octets | 2272 | KeyID | 00:64 | 100 | 2273 | Digest | df:32:16:5e:d8:63:16:e5:a6:4d | HMAC result | 2274 | | c7:73:e0:b5:22:82:ce:fe:e2:3c | | 2275 +---------------+-------------------------------+-------------------+ 2277 Table 4: A Babel Packet with Each HMAC TLV Containing an HMAC Result 2279 Appendix B. Test Vectors 2281 The test vectors below may be used to verify the correctness of some 2282 procedures performed by an implementation of this mechanism, namely: 2284 o appending of TS/PC and HMAC TLVs to the Babel packet body, 2286 o padding of the HMAC TLV(s), 2287 o computation of the HMAC result(s), and 2289 o placement of the result(s) in the TLV(s). 2291 This verification isn't exhaustive, there are other important 2292 implementation aspects that would require testing methods of their 2293 own. 2295 The test vectors were produced as follows. 2297 1. A Babel speaker with a network interface with IPv6 link-local 2298 address fe80::0a11:96ff:fe1c:10c8 was configured to use two CSAs 2299 for the interface: 2301 * CSA1={HashAlgo=RIPEMD-160, KeyChain={{LocalKeyID=200, 2302 AuthKeyOctets=Key26}}} 2304 * CSA2={HashAlgo=SHA-1, KeyChain={{LocalKeyId=100, 2305 AuthKeyOctets=Key70}}} 2307 The authentication keys above are: 2309 * Key26 in ASCII: 2311 ABCDEFGHIJKLMNOPQRSTUVWXYZ 2313 * Key26 in hexadecimal: 2315 41:42:43:44:45:46:47:48:49:4a:4b:4c:4d:4e:4f:50 2316 51:52:53:54:55:56:57:58:59:5a 2318 * Key70 in ASCII: 2320 This=key=is=exactly=70=octets=long.=ABCDEFGHIJKLMNOPQRSTUVWXYZ01234567 2322 * Key70 in hexadecimal: 2324 54:68:69:73:3d:6b:65:79:3d:69:73:3d:65:78:61:63 2325 74:6c:79:3d:37:30:3d:6f:63:74:65:74:73:3d:6c:6f 2326 6e:67:2e:3d:41:42:43:44:45:46:47:48:49:4a:4b:4c 2327 4d:4e:4f:50:51:52:53:54:55:56:57:58:59:5a:30:31 2328 32:33:34:35:36:37 2330 The length of each key was picked to relate (in the terms of 2331 Section 2.4) with the properties of respective hash algorithm as 2332 follows: 2334 * the digest length (L) of both RIPEMD-160 and SHA-1 is 20 2335 octets, 2337 * the internal block size (B) of both RIPEMD-160 and SHA-1 is 64 2338 octets, 2340 * the length of Key26 (26) is greater than L but less than B, 2341 and 2343 * the length of Key70 (70) is greater than B (and thus greater 2344 than L). 2346 KeyStartAccept, KeyStopAccept, KeyStartGenerate and 2347 KeyStopGenerate were set to make both authentication keys valid. 2349 2. The instance of the original protocol of the speaker produced a 2350 Babel packet (PktO) to be sent from the interface. Table 2 2351 provides a decoding of PktO, contents of which is below: 2353 2a:02:00:14:04:06:00:00:09:25:01:90:08:0a:00:40 2354 00:00:ff:ff:68:21:ff:ff 2356 3. The authentication mechanism appended one TS/PC TLV and two HMAC 2357 TLVs to the packet body, updated the "Body length" packet header 2358 field and padded the Digest field of the HMAC TLVs using the 2359 link-local IPv6 address of the interface and necessary amount of 2360 zeroes. Table 3 provides a decoding of the resulting temporary 2361 packet (PktT), contents of which is below: 2363 2a:02:00:4c:04:06:00:00:09:25:01:90:08:0a:00:40 2364 00:00:ff:ff:68:21:ff:ff:0b:06:00:01:52:1d:7e:8b 2365 0c:16:00:c8:fe:80:00:00:00:00:00:00:0a:11:96:ff 2366 fe:1c:10:c8:00:00:00:00:0c:16:00:64:fe:80:00:00 2367 00:00:00:00:0a:11:96:ff:fe:1c:10:c8:00:00:00:00 2369 4. The authentication mechanism produced two HMAC results, 2370 performing the computations as follows: 2372 * For H=RIPEMD-160, K=Key26, and Text=PktT the HMAC result is: 2374 c6:f1:06:13:30:3c:fa:f3:eb:5d:60:3a:ed:fd:06:55 2375 83:f7:ee:79 2377 * For H=SHA-1, K=Key70, and Text=PktT the HMAC result is: 2379 df:32:16:5e:d8:63:16:e5:a6:4d:c7:73:e0:b5:22:82 2380 ce:fe:e2:3c 2381 5. The authentication mechanism placed each HMAC result into 2382 respective HMAC TLV, producing the final authenticated Babel 2383 packet (PktA), which was eventually sent from the interface. 2384 Table 4 provides a decoding of PktA, contents of which is below: 2386 2a:02:00:4c:04:06:00:00:09:25:01:90:08:0a:00:40 2387 00:00:ff:ff:68:21:ff:ff:0b:06:00:01:52:1d:7e:8b 2388 0c:16:00:c8:c6:f1:06:13:30:3c:fa:f3:eb:5d:60:3a 2389 ed:fd:06:55:83:f7:ee:79:0c:16:00:64:df:32:16:5e 2390 d8:63:16:e5:a6:4d:c7:73:e0:b5:22:82:ce:fe:e2:3c 2392 Interpretation of this process is to be done in the view of Figure 1, 2393 differently for the sending and the receiving directions. 2395 For the sending direction, given a Babel speaker configured using the 2396 IPv6 address and the sequence of CSAs as described above, the 2397 implementation SHOULD (see notes in Section 5.3) produce exactly the 2398 temporary packet PktT if the original protocol instance produces 2399 exactly the packet PktO to be sent from the interface. If the 2400 temporary packet exactly matches PktT, the HMAC results computed 2401 afterwards MUST exactly match respective results above and the final 2402 authenticated packet MUST exactly match the PktA above. 2404 For the receiving direction, given a Babel speaker configured using 2405 the sequence of CSAs as described above (but a different IPv6 2406 address), the implementation MUST (assuming the TS/PC check didn't 2407 fail) produce exactly the temporary packet PktT above if its network 2408 stack receives through the interface exactly the packet PktA above 2409 from the source IPv6 address above. The first HMAC result computed 2410 afterwards MUST match the first result above. The receiving 2411 procedure doesn't compute the second HMAC result in this case, but if 2412 the implementor decides to compute it anyway for the verification 2413 purpose, it MUST exactly match the second result above. 2415 Author's Address 2417 Denis Ovsienko 2418 Yandex 2419 16, Leo Tolstoy St. 2420 Moscow, 119021 2421 Russia 2423 Email: infrastation@yandex.ru