idnits 2.17.1 draft-ovsienko-babel-hmac-authentication-07.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 (March 3, 2014) is 3707 days in the past. Is this intentional? Checking references for intended status: Experimental ---------------------------------------------------------------------------- == Missing Reference: 'TLV' is mentioned on line 2298, 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) March 3, 2014 5 Intended status: Experimental 6 Expires: September 4, 2014 8 Babel HMAC Cryptographic Authentication 9 draft-ovsienko-babel-hmac-authentication-07 11 Abstract 13 This document describes a cryptographic authentication mechanism for 14 Babel routing protocol, updating, but not superseding 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 September 4, 2014. 35 Copyright Notice 37 Copyright (c) 2014 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 . . . . . . . . . . . . . . . . . . . . 6 55 2.1. Mandatory-to-Implement and Optional Hash Algorithms . . . 6 56 2.2. Definition of Padding . . . . . . . . . . . . . . . . . . 7 57 2.3. Cryptographic Sequence Number Specifics . . . . . . . . . 9 58 2.4. Definition of HMAC . . . . . . . . . . . . . . . . . . . . 9 59 3. Updates to Protocol Data Structures . . . . . . . . . . . . . 11 60 3.1. RxAuthRequired . . . . . . . . . . . . . . . . . . . . . . 11 61 3.2. LocalTS . . . . . . . . . . . . . . . . . . . . . . . . . 12 62 3.3. LocalPC . . . . . . . . . . . . . . . . . . . . . . . . . 12 63 3.4. MaxDigestsIn . . . . . . . . . . . . . . . . . . . . . . . 12 64 3.5. MaxDigestsOut . . . . . . . . . . . . . . . . . . . . . . 12 65 3.6. ANM Table . . . . . . . . . . . . . . . . . . . . . . . . 13 66 3.7. ANM Timeout . . . . . . . . . . . . . . . . . . . . . . . 14 67 3.8. Configured Security Associations . . . . . . . . . . . . . 15 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 . . . . . . . . . . . . . . . . 21 74 5.1. Per-Interface TS/PC Number Updates . . . . . . . . . . . . 21 75 5.2. Deriving ESAs from CSAs . . . . . . . . . . . . . . . . . 23 76 5.3. Updates to Packet Sending . . . . . . . . . . . . . . . . 25 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 . . . . . . . . . . . . . . . . . . 44 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 Although the HMAC construct is just one of many possible approaches 148 to cryptographic authentication of packets, this mechanism makes use 149 of relevant prior experience by using HMAC too and its solution space 150 correlates with the solution spaces of the mechanisms above. At the 151 same time, it allows for a future extension that treats HMAC as a 152 particular case of a more generic mechanism. Practical experience 153 with the mechanism defined herein should be useful in designing such 154 future extension. 156 This specification defines the use of the cryptographic sequence 157 number in details sufficient to make replay attack protection 158 strength predictable. That is, an operator can tell the strength 159 from the declared characteristics of an implementation and, whereas 160 the implementation allows to change relevant parameters, the effect 161 of a reconfiguration. 163 This mechanism explicitly allows for multiple HMAC results per 164 authenticated packet. Since meaningful data items of a given packet 165 remain the same, each such HMAC result stands for a different secret 166 key and/or a different hash algorithm. This enables a simultaneous, 167 independent authentication within multiple domains. This 168 specification is not novel in this regard, e.g., L2TPv3 allows for 1 169 or 2 results per authenticated packet ([RFC3931] Section 5.4.1). 171 An important concern addressed by this mechanism is limiting the 172 amount of HMAC computations done per authenticated packet, 173 independently for sending and receiving. Without these limits the 174 number of computations per packet could be as high as the number of 175 configured authentication keys (in the sending case) or as the number 176 of keys multiplied by the number of supplied HMAC results (in the 177 receiving case). 179 These limits establish a basic competition between the configured 180 keys and (in the receiving case) an additional competition between 181 the supplied HMAC results. This specification defines related data 182 structures and procedures in a way to make such competition 183 transparent and predictable for an operator. 185 Wherever this specification mentions the operator reading or changing 186 a particular data structure, variable, parameter, or event counter 187 "at runtime", it is up to the implementor how this is to be done. 188 For example, the implementation can employ an interactive CLI, or a 189 management protocol such as SNMP, or an inter-process communication 190 mean such as a local socket, or a combination of these. 192 1.1. Requirements Language 194 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 195 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 196 document are to be interpreted as described in BCP 14 [RFC2119]. 198 2. Cryptographic Aspects 200 2.1. Mandatory-to-Implement and Optional Hash Algorithms 202 [RFC2104] defines HMAC as a construct that can use any cryptographic 203 hash algorithm with a known digest length and internal block size. 204 This specification preserves this property of HMAC by defining data 205 processing that itself does not depend on any particular hash 206 algorithm either. However, since this mechanism is a protocol 207 extension case, there are relevant design considerations to take into 208 account. 210 Section 4.5 of [RFC6709] suggests selecting one hash algorithm as 211 mandatory-to-implement for the purpose of global interoperability 212 (Section 3.2 ibid.) and selecting another of distinct lineage as 213 recommended for implementation for the purpose of cryptographic 214 agility. This specification makes the latter property guaranteed, 215 rather than probable, through an elevation of the requirement level. 216 There are two hash algorithms mandatory-to-implement, unambiguously 217 defined and generally available in multiple implementations each. 219 An implementation of this mechanism MUST include support for two hash 220 algorithms: 222 o RIPEMD-160 (160-bit digest) 224 o SHA-1 (160-bit digest) 226 Besides that, an implementation of this mechanism MAY include support 227 for additional hash algorithms, provided each such algorithm is 228 publicly and openly specified and its digest length is 128 bits or 229 more (to meet the constraint implied in Section 2.2). Implementors 230 SHOULD consider strong, well-known hash algorithms as additional 231 implementation options and MUST NOT consider hash algorithms for that 232 by the time of implementation meaningful attacks exist or that are 233 commonly viewed as deprecated. 235 In the latter case it is important to take into account 236 considerations both common (such as those made in [RFC4270]) and 237 specific to the HMAC application of the hash algorithm. E.g., 238 [RFC6151] considers MD5 collisions and concludes that new protocol 239 designs should not use HMAC-MD5, while [RFC6194] includes a 240 comparable analysis of SHA-1 that finds HMAC-SHA-1 secure for the 241 same purpose. 243 For example, the following hash algorithms meet these requirements at 244 the time of this writing (in alphabetical order): 246 o GOST R 34.11-94 (256-bit digest) 248 o SHA-224 (224-bit digest, SHA-2 family) 250 o SHA-256 (256-bit digest, SHA-2 family) 252 o SHA-384 (384-bit digest, SHA-2 family) 254 o SHA-512 (512-bit digest, SHA-2 family) 256 o Tiger (192-bit digest) 258 o Whirlpool (512-bit digest, 2nd rev., 2003) 260 The set of hash algorithms available in an implementation MUST be 261 clearly stated. When known weak authentication keys exist for a hash 262 algorithm used in the HMAC construct, an implementation MUST deny a 263 use of such keys. 265 2.2. Definition of Padding 267 Many practical applications of HMAC for authentication of datagram- 268 based network protocols (including routing protocols) involve the 269 padding procedure, a design-specific conditioning of the message that 270 both the sender and the receiver perform before the HMAC computation. 271 Specific padding procedure of this mechanism addresses the following 272 needs: 274 o Data Initialization 276 A design that places the HMAC result(s) computed for a message 277 inside the same message after the computation has to allocate in 278 the message some data unit(s) purposed for the result(s) (in this 279 mechanism it is the HMAC TLV(s), see Section 4.3). The padding 280 procedure sets respective octets of the data unit(s), in the 281 simplest case to a fixed value known as the padding constant. 283 Particular value of the constant is specific to each design. For 284 instance, in [RIP2-AUTH] as well as works derived from it 285 ([ISIS-AUTH-B], [OSPF2-AUTH], and [OSPF3-AUTH]) the value is 286 0x878FE1F3. In many other designs (for instance, [RFC3315], 287 [RFC3931], [RFC4030], [RFC4302], [RFC5176], and [ISIS-AUTH-A]) the 288 value is 0x00. 290 However, the HMAC construct is defined on the base of a 291 cryptographic hash algorithm, that is, an algorithm meeting 292 particular set of requirements made for any input message. Thus 293 any padding constant values, whether single- or multiple-octet, as 294 well as any other message conditioning methods, don't affect 295 cryptographic characteristics of the hash algorithm and the HMAC 296 construct respectively. 298 o Source Address Protection 300 In the specific case of datagram-based routing protocols the 301 protocol packet (that is, the message being authenticated) often 302 does not include network layer addresses, although the source and 303 (to a lesser extent) the destination address of the datagram may 304 be meaningful in the scope of the protocol instance. 306 In Babel the source address may be used as a prefix hext hop (see 307 Section 3.5.3 of [BABEL]). A well-known (see Section 2.3 of 308 [OSPF3-AUTH]) solution to the source address protection problem is 309 to set the first respective octets of the data unit(s) above to 310 the source address (yet setting the rest of the octets to the 311 padding constant). This procedure adapts this solution to the 312 specifics of Babel, which allows for exchange of protocol packets 313 using both IPv4 and IPv6 datagrams (see Section 4 of [BABEL]). 314 Even though in the case of IPv6 exchange a Babel speaker currently 315 uses only link-local source addresses (Section 3.1 ibid.), this 316 procedure protects all octets of an arbitrary given source address 317 for the reasons of future extensibility. The procedure implies 318 that future Babel extensions will never use an IPv4-mapped IPv6 319 address as a packet source address. 321 This procedure does not protect the destination address, which is 322 currently considered meaningless (ibid.) in the same scope. A 323 future extension that looks to add such protection would likely 324 use a new TLV or sub-TLV to include the destination address into 325 the protocol packet (see Section 4.1). 327 Description of the padding procedure: 329 1. Set the first 16 octets of the Digest field of the given HMAC TLV 330 to: 332 * the given source address, if it is an IPv6 address, or 334 * the IPv4-mapped IPv6 address (per Section 2.5.5.2 of 335 [RFC4291]) holding the given source address, if it is an IPv4 336 address. 338 2. Set the remaining (TLV Length - 18) octets of the Digest field of 339 the given HMAC TLV to 0x00. 341 For an example of a Babel packet with padded HMAC TLVs see Table 3. 343 2.3. Cryptographic Sequence Number Specifics 345 Operation of this mechanism may involve multiple local and multiple 346 remote cryptographic sequence numbers, each essentially being a 347 48-bit unsigned integer. This specification uses a term "TS/PC 348 number" to avoid confusion with the route's (Section 2.5 of [BABEL]) 349 or node's (Section 3.2.1 ibid.) sequence numbers of the original 350 Babel specification and to stress the fact that there are two 351 distinguished parts of this 48-bit number, each handled in its 352 specific way (see Section 5.1): 354 0 1 2 3 4 355 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 356 +-+-+-+-+-+-+-+-+-+-+-//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 357 | TS // | PC | 358 +-+-+-+-+-+-+-+-+-+-//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 359 // 361 The high-order 32 bits are called "timestamp" (TS) and the low-order 362 16 bits are called "packet counter" (PC). 364 This mechanism stores, updates, compares, and encodes each TS/PC 365 number as two independent unsigned integers, TS and PC respectively. 366 Such comparison of TS/PC numbers performed in item 3 of Section 5.4 367 is algebraically equivalent to comparison of respective 48-bit 368 unsigned integers. Any byte order conversion, when required, is 369 performed on TS and PC parts independently. 371 2.4. Definition of HMAC 373 The algorithm description below uses the following nomenclature, 374 which is consistent with [FIPS-198]: 376 Text Is the data on which the HMAC is calculated (note item (b) of 377 Section 9). In this specification it is the contents of a 378 Babel packet ranging from the beginning of the Magic field of 379 the Babel packet header to the end of the last octet of the 380 Packet Body field, as defined in Section 4.2 of [BABEL] (see 381 Figure 2). 383 H Is the specific hash algorithm (see Section 2.1). 385 K Is a sequence of octets of an arbitrary, known length. 387 Ko Is the cryptographic key used with the hash algorithm. 389 B Is the block size of H, measured in octets rather than bits. 390 Note that B is the internal block size, not the digest length. 392 L Is the digest length of H, measured in octets rather than 393 bits. 395 XOR Is the bitwise exclusive-or operation. 397 Opad Is the hexadecimal value 0x5C repeated B times. 399 Ipad Is the hexadecimal value 0x36 repeated B times. 401 The algorithm below is the original, unmodified HMAC construct as 402 defined in both [RFC2104] and [FIPS-198], hence it is different from 403 the algorithms defined in [RIP2-AUTH], [ISIS-AUTH-B], [OSPF2-AUTH], 404 and [OSPF3-AUTH] in exactly two regards: 406 o The algorithm below sets the size of Ko to B, not to L (L is not 407 greater than B). This resolves both ambiguity in XOR expressions 408 and incompatibility in handling of keys that have length greater 409 than L but not greater than B. 411 o The algorithm below does not change value of Text before or after 412 the computation. Both padding of a Babel packet before the 413 computation and placing of the result inside the packet are 414 performed elsewhere. 416 The intent of this is to enable the most straightforward use of 417 cryptographic libraries by implementations of this specification. At 418 the time of this writing implementations of the original HMAC 419 construct coupled with hash algorithms of choice are generally 420 available. 422 Description of the algorithm: 424 1. Preparation of the Key 426 In this application, Ko is always B octets long. If K is B 427 octets long, then Ko is set to K. If K is more than B octets 428 long, then Ko is set to H(K) with the necessary amount of zeroes 429 appended to the end of H(K), such that Ko is B octets long. If K 430 is less than B octets long, then Ko is set to K with zeroes 431 appended to the end of K, such that Ko is B octets long. 433 2. First-Hash 435 A First-Hash, also known as the inner hash, is computed as 436 follows: 438 First-Hash = H(Ko XOR Ipad || Text) 440 3. Second-Hash 442 A second hash, also known as the outer hash, is computed as 443 follows: 445 Second-Hash = H(Ko XOR Opad || First-Hash) 447 4. Result 449 The resulting Second-Hash becomes the authentication data that is 450 returned as the result of HMAC calculation. 452 Note that in the case of Babel the Text parameter will never exceed a 453 few thousands of octets in length. In this specific case the 454 optimization discussed in Section 6 of [FIPS-198] applies, namely, 455 for a given K that is more than B octets long the following 456 associated intermediate results may be precomputed only once: Ko, 457 (Ko XOR Ipad), and (Ko XOR Opad). 459 3. Updates to Protocol Data Structures 461 3.1. RxAuthRequired 463 RxAuthRequired is a boolean parameter, its default value MUST be 464 TRUE. An implementation SHOULD make RxAuthRequired a per-interface 465 parameter, but MAY make it specific to the whole protocol instance. 466 The conceptual purpose of RxAuthRequired is to enable a smooth 467 migration from an unauthenticated to an authenticated Babel packet 468 exchange and back (see Section 7.3). Current value of RxAuthRequired 469 directly affects the receiving procedure defined in Section 5.4. An 470 implementation SHOULD allow the operator to change RxAuthRequired 471 value at runtime or by means of Babel speaker restart. An 472 implementation MUST allow the operator to discover the effective 473 value of RxAuthRequired at runtime or from the system documentation. 475 3.2. LocalTS 477 LocalTS is a 32-bit unsigned integer variable, it is the TS part of a 478 per-interface TS/PC number. LocalTS is a strictly per-interface 479 variable not intended to be changed by the operator. Its 480 initialization is explained in Section 5.1. 482 3.3. LocalPC 484 LocalPC is a 16-bit unsigned integer variable, it is the PC part of a 485 per-interface TS/PC number. LocalPC is a strictly per-interface 486 variable not intended to be changed by the operator. Its 487 initialization is explained in Section 5.1. 489 3.4. MaxDigestsIn 491 MaxDigestsIn is an unsigned integer parameter conceptually purposed 492 for limiting the amount of CPU time spent processing a received 493 authenticated packet. The receiving procedure performs the most CPU- 494 intensive operation, the HMAC computation, only at most MaxDigestsIn 495 (Section 5.4 item 7) times for a given packet. 497 MaxDigestsIn value MUST be at least 2. An implementation SHOULD make 498 MaxDigestsIn a per-interface parameter, but MAY make it specific to 499 the whole protocol instance. An implementation SHOULD allow the 500 operator to change the value of MaxDigestsIn at runtime or by means 501 of Babel speaker restart. An implementation MUST allow the operator 502 to discover the effective value of MaxDigestsIn at runtime or from 503 the system documentation. 505 3.5. MaxDigestsOut 507 MaxDigestsOut is an unsigned integer parameter conceptually purposed 508 for limiting the amount of a sent authenticated packet's space spent 509 on authentication data. The sending procedure adds at most 510 MaxDigestsOut (Section 5.3 item 5) HMAC results to a given packet, 511 concurring with the output buffer management explained in 512 Section 6.2. 514 The MaxDigestsOut value MUST be at least 2. An implementation SHOULD 515 make MaxDigestsOut a per-interface parameter, but MAY make it 516 specific to the whole protocol instance. An implementation SHOULD 517 allow the operator to change the value of MaxDigestsOut at runtime or 518 by means of Babel speaker restart, in a safe range. The maximum safe 519 value of MaxDigestsOut is implementation-specific (see Section 6.2). 520 An implementation MUST allow the operator to discover the effective 521 value of MaxDigestsOut at runtime or from the system documentation. 523 3.6. ANM Table 525 The ANM (Authentic Neighbours Memory) table resembles the neighbour 526 table defined in Section 3.2.3 of [BABEL]. Note that the term 527 "neighbour table" means the neighbour table of the original Babel 528 specification, and the term "ANM table" means the table defined 529 herein. Indexing of the ANM table is done in exactly the same way as 530 indexing of the neighbour table, but purpose, field set and 531 associated procedures are different. 533 The conceptual purpose of the ANM table is to provide longer term 534 replay attack protection than it would be possible using the 535 neighbour table. Expiry of an inactive entry in the neighbour table 536 depends on the last received Hello Interval of the neighbour and 537 typically stands for tens to hundreds of seconds (see Appendix A and 538 Appendix B of [BABEL]). Expiry of an inactive entry in the ANM table 539 depends only on the local speaker's configuration. The ANM table 540 retains (for at least the amount of seconds set by ANM timeout 541 parameter defined in Section 3.7) a copy of TS/PC number advertised 542 in authentic packets by each remote Babel speaker. 544 The ANM table is indexed by pairs of the form (Interface, Source). 545 Every table entry consists of the following fields: 547 o Interface 549 An implementation-specific reference to the local node's interface 550 that the authentic packet was received through. 552 o Source 554 The source address of the Babel speaker that the authentic packet 555 was received from. 557 o LastTS 559 A 32-bit unsigned integer, the TS part of a remote TS/PC number. 561 o LastPC 563 A 16-bit unsigned integer, the PC part of a remote TS/PC number. 565 Each ANM table entry has an associated aging timer, which is reset by 566 the receiving procedure (Section 5.4 item 9). If the timer expires, 567 the entry is deleted from the ANM table. 569 An implementation SHOULD use a persistent memory (NVRAM) to retain 570 the contents of ANM table across restarts of the Babel speaker, but 571 only as long as both the Interface field reference and expiry of the 572 aging timer remain correct. An implementation MUST make it clear, if 573 and how persistent memory is used for ANM table. An implementation 574 SHOULD allow the operator to retrieve the current contents of ANM 575 table at runtime. An implementation SHOULD allow the operator to 576 remove some or all of ANM table entries at runtime or by means of 577 Babel speaker restart. 579 3.7. ANM Timeout 581 ANM timeout is an unsigned integer parameter. An implementation 582 SHOULD make ANM timeout a per-interface parameter, but MAY make it 583 specific to the whole protocol instance. ANM timeout is conceptually 584 purposed for limiting the maximum age (in seconds) of entries in the 585 ANM table standing for inactive Babel speakers. The maximum age is 586 immediately related to replay attack protection strength. The 587 strongest protection is achieved with the maximum possible value of 588 ANM timeout set, but it may not provide the best overall result for 589 specific network segments and implementations of this mechanism. 591 In the first turn, implementations unable to maintain local TS/PC 592 number strictly increasing across Babel speaker restarts will reuse 593 the advertised TS/PC numbers after each restart (see Section 5.1). 594 The neighbouring speakers will treat the new packets as replayed and 595 discard them until the aging timer of respective ANM table entry 596 expires or the new TS/PC number exceeds the one stored in the entry. 598 Another possible, but less probable, case could be an environment 599 using IPv6 for Babel datagrams exchange and involving physical moves 600 of network interfaces hardware between Babel speakers. Even 601 performed without restarting the speakers, these would cause random 602 drops of the TS/PC number advertised for a given (Interface, Source) 603 index, as viewed by neighbouring speakers, since IPv6 link-local 604 addresses are typically derived from interface hardware addresses. 606 Assuming that in such cases the operators would prefer to use a lower 607 ANM timeout value to let the entries expire on their own rather than 608 having to manually remove them from the ANM table each time, an 609 implementation SHOULD set the default value of ANM timeout to a value 610 between 30 and 300 seconds. 612 At the same time, network segments may exist with every Babel speaker 613 having its advertised TS/PC number strictly increasing over the 614 deployed lifetime. Assuming that in such cases the operators would 615 prefer using a much higher ANM timeout value, an implementation 616 SHOULD allow the operator to change the value of ANM timeout at 617 runtime or by means of Babel speaker restart. An implementation MUST 618 allow the operator to discover the effective value of ANM timeout at 619 runtime or from the system documentation. 621 3.8. Configured Security Associations 623 A Configured Security Association (CSA) is a data structure 624 conceptually purposed for associating authentication keys and hash 625 algorithms with Babel interfaces. All CSAs are managed in finite 626 sequences, one sequence per interface ("interface's sequence of CSAs" 627 hereafter). Each interface's sequence of CSAs, as an integral part 628 of the Babel speaker configuration, MAY be intended for a persistent 629 storage as long as this conforms with the implementation's key 630 management policy. The default state of an interface's sequence of 631 CSAs is empty, which has a special meaning of no authentication 632 configured for the interface. The sending (Section 5.3 item 1) and 633 the receiving (Section 5.4 item 1) procedures address this convention 634 accordingly. 636 A single CSA structure consists of the following fields: 638 o HashAlgo 640 An implementation-specific reference to one of the hash algorithms 641 supported by this implementation (see Section 2.1). 643 o KeyChain 645 A finite sequence of elements ("KeyChain sequence" hereafter) 646 representing authentication keys, each element being a structure 647 consisting of the following fields: 649 * LocalKeyID 651 An unsigned integer of an implementation-specific bit length. 653 * AuthKeyOctets 655 A sequence of octets of an arbitrary, known length to be used 656 as the authentication key. 658 * KeyStartAccept 660 The time that this Babel speaker will begin considering this 661 authentication key for accepting packets with authentication 662 data. 664 * KeyStartGenerate 666 The time that this Babel speaker will begin considering this 667 authentication key for generating packet authentication data. 669 * KeyStopGenerate 671 The time that this Babel speaker will stop considering this 672 authentication key for generating packet authentication data. 674 * KeyStopAccept 676 The time that this Babel speaker will stop considering this 677 authentication key for accepting packets with authentication 678 data. 680 Since there is no limit imposed on the number of CSAs per interface, 681 but the number of HMAC computations per sent/received packet is 682 limited (through MaxDigestsOut and MaxDigestsIn respectively), only a 683 fraction of the associated keys and hash algorithms may appear used 684 in the process. The ordering of elements within a sequence of CSAs 685 and within a KeyChain sequence is important to make the association 686 selection process deterministic and transparent. Once this ordering 687 is deterministic at the Babel interface level, the intermediate data 688 derived by the procedure defined in Section 5.2 will be 689 deterministically ordered as well. 691 An implementation SHOULD allow an operator to set any arbitrary order 692 of elements within a given interface's sequence of CSAs and within 693 the KeyChain sequence of a given CSA. Regardless if this requirement 694 is or isn't met, the implementation MUST provide a mean to discover 695 the actual element order used. Whichever order is used by an 696 implementation, it MUST be preserved across Babel speaker restarts. 698 Note that none of the CSA structure fields is constrained to contain 699 unique values. Section 6.4 explains this in more detail. It is 700 possible for the KeyChain sequence to be empty, although this is not 701 the intended manner of CSAs use. 703 The KeyChain sequence has a direct prototype, which is the "key 704 chain" syntax item of some existing router configuration languages. 705 Whereas an implementation already implements this syntax item, it is 706 suggested to reuse it, that is, to implement a CSA syntax item 707 referring to a key chain item instead of reimplementing the latter in 708 full. 710 3.9. Effective Security Associations 712 An Effective Security Association (ESA) is a data structure 713 immediately used in sending (Section 5.3) and receiving (Section 5.4) 714 procedures. Its conceptual purpose is to determine a runtime 715 interface between those procedures and the deriving procedure defined 716 in Section 5.2. All ESAs are temporary data units managed as 717 elements of finite sequences that are not intended for a persistent 718 storage. Element ordering within each such finite sequence 719 ("sequence of ESAs" hereafter) MUST be preserved as long as the 720 sequence exists. 722 A single ESA structure consists of the following fields: 724 o HashAlgo 726 An implementation-specific reference to one of the hash algorithms 727 supported by this implementation (see Section 2.1). 729 o KeyID 731 A 16-bit unsigned integer. 733 o AuthKeyOctets 735 A sequence of octets of an arbitrary, known length to be used as 736 the authentication key. 738 Note that among the protocol data structures introduced by this 739 mechanism ESA is the only one not directly interfaced with the system 740 operator (see Figure 1), it is not immediately present in the 741 protocol encoding either. However, ESA is not just a possible 742 implementation technique, but an integral part of this specification: 743 the deriving (Section 5.2), the sending (Section 5.3), and the 744 receiving (Section 5.4) procedures are defined in terms of the ESA 745 structure and its semantics provided herein. ESA is as meaningful 746 for a correct implementation as the other protocol data structures. 748 4. Updates to Protocol Encoding 750 4.1. Justification 752 Choice of encoding is very important in the long term. The protocol 753 encoding limits various authentication mechanism designs and 754 encodings, which in turn limit future developments of the protocol. 756 Considering existing implementations of Babel protocol instance 757 itself and related modules of packet analysers, the current encoding 758 of Babel allows for compact and robust decoders. At the same time, 759 this encoding allows for future extensions of Babel by three (not 760 excluding each other) principal means defined by Section 4.2 and 761 Section 4.3 of [BABEL] and further discussed in 763 [I-D.chroboczek-babel-extension-mechanism]: 765 a. A Babel packet consists of a four-octet header followed by a 766 packet body, that is, a sequence of TLVs (see Figure 2). Besides 767 the header and the body, an actual Babel datagram may have an 768 arbitrary amount of trailing data between the end of the packet 769 body and the end of the datagram. An instance of the original 770 protocol silently ignores such trailing data. 772 b. The packet body uses a binary format allowing for 256 TLV types 773 and imposing no requirements on TLV ordering or number of TLVs of 774 a given type in a packet. [BABEL] allocates TLV types 0 through 775 10 (see Table 1), defines TLV body structure for each and 776 establishes the requirement for a Babel protocol instance to 777 ignore any unknown TLV types silently. This makes it possible to 778 examine a packet body (to validate the framing and/or to pick 779 particular TLVs for further processing) considering only the type 780 (to distinguish between a Pad1 TLV and any other TLV) and the 781 length of each TLV, regardless if and how many additional TLV 782 types are eventually deployed. 784 c. Within each TLV of the packet body there may be some "extra data" 785 after the "expected length" of the TLV body. An instance of the 786 original protocol silently ignores any such extra data. Note 787 that any TLV types without the expected length defined (such as 788 PadN TLV) cannot be extended with the extra data. 790 Considering each principal extension mean for the specific purpose of 791 adding authentication data items to each protocol packet, the 792 following arguments can be made: 794 o Use of the TLV extra data of some existing TLV type would not be a 795 solution, since no particular TLV type is guaranteed to be present 796 in a Babel packet. 798 o Use of the TLV extra data could also conflict with future 799 developments of the protocol encoding. 801 o Since the packet trailing data is currently unstructured, using it 802 would involve defining an encoding structure and associated 803 procedures, adding to the complexity of both specification and 804 implementation and increasing the exposure to protocol attacks 805 such as fuzzing. 807 o A naive use of the packet trailing data would make it unavailable 808 to any future extension of Babel. Since this mechanism is 809 possibly not the last extension and since some other extensions 810 may allow no other embedding means except the packet trailing 811 data, the defined encoding structure would have to enable 812 multiplexing of data items belonging to different extensions. 813 Such a definition is out of the scope of this work. 815 o Deprecating an extension (or only its protocol encoding) that uses 816 purely purpose-allocated TLVs is as simple as deprecating the 817 TLVs. 819 o Use of purpose-allocated TLVs is transparent for both the original 820 protocol and any its future extensions, regardless of the 821 embedding mean(s) used by the latter. 823 Considering all of the above, this mechanism neither uses the packet 824 trailing data nor uses the TLV extra data, but uses two new TLV 825 types: type 11 for a TS/PC number and type 12 for an HMAC result (see 826 Table 1). 828 4.2. TS/PC TLV 830 The purpose of a TS/PC TLV is to store a single TS/PC number. There 831 is exactly one TS/PC TLV in an authenticated Babel packet. 833 0 1 2 3 834 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 835 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 836 | Type = 11 | Length | PacketCounter | 837 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 838 | Timestamp | 839 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 841 Fields: 843 Type Set to 11 to indicate a TS/PC TLV. 845 Length The length of the body, exclusive of the Type and 846 Length fields. 848 PacketCounter A 16-bit unsigned integer in network byte order, the 849 PC part of a TS/PC number stored in this TLV. 851 Timestamp A 32-bit unsigned integer in network byte order, the 852 TS part of a TS/PC number stored in this TLV. 854 Note that the ordering of PacketCounter and Timestamp in the TLV 855 structure is opposite to the ordering of TS and PC in "TS/PC" term 856 and the 48-bit equivalent (see Section 2.3). 858 Considering the "expected length" and the "extra data" in the 859 definition of Section 4.3 of [BABEL], the expected length of a TS/PC 860 TLV body is unambiguously defined as 6 octets. The receiving 861 procedure correctly processes any TS/PC TLV with body length not less 862 than the expected, ignoring any extra data (Section 5.4 items 3 and 863 9). The sending procedure produces a TS/PC TLV with body length 864 equal to the expected and Length field set respectively (Section 5.3 865 item 3). 867 Future Babel extensions (such as sub-TLVs) MAY modify the sending 868 procedure to include the extra data after the fixed-size TS/PC TLV 869 body defined herein, making necessary adjustments to Length TLV 870 field, "Body length" packet header field and output buffer management 871 explained in Section 6.2. 873 4.3. HMAC TLV 875 The purpose of an HMAC TLV is to store a single HMAC result. To 876 assist a receiver in reproducing the HMAC computation, LocalKeyID 877 modulo 2^16 of the authentication key is also provided in the TLV. 878 There is at least one HMAC TLV in an authenticated Babel packet. 880 0 1 2 3 881 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 882 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 883 | Type = 12 | Length | KeyID | 884 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 885 | Digest... 886 +-+-+-+-+-+-+-+-+-+-+-+- 888 Fields: 890 Type Set to 12 to indicate an HMAC TLV. 892 Length The length of the body, exclusive of the Type and 893 Length fields. 895 KeyID A 16-bit unsigned integer in network byte order. 897 Digest A variable-length sequence of octets, which is at 898 least 16 octets long (see Section 2.2). 900 Considering the "expected length" and the "extra data" in the 901 definition of Section 4.3 of [BABEL], the expected length of an HMAC 902 TLV body is not defined. The receiving and the padding procedures 903 process every octet of the Digest field, deriving the field boundary 904 from the Length field value (Section 5.4 item 7 and Section 2.2 905 respectively). The sending procedure produces HMAC TLVs with Length 906 field precisely sizing the Digest field to match digest length of the 907 hash algorithm used (Section 5.3 items 5 and 8). 909 The HMAC TLV structure defined herein is final, future Babel 910 extensions MUST NOT extend it with any extra data. 912 5. Updates to Protocol Operation 914 5.1. Per-Interface TS/PC Number Updates 916 The LocalTS and LocalPC interface-specific variables constitute the 917 TS/PC number of a Babel interface. This number is advertised in the 918 TS/PC TLV of authenticated Babel packets sent from that interface. 919 There is only one property mandatory for the advertised TS/PC number: 920 its 48-bit equivalent (see Section 2.3) MUST be strictly increasing 921 within the scope of a given interface of a Babel speaker as long as 922 the protocol instance is continuously operating. This property 923 combined with ANM tables of neighbouring Babel speakers provides them 924 with the most basic replay attack protection. 926 Initialization and increment are two principal updates performed on 927 an interface TS/PC number. The initialization is performed when a 928 new interface becomes a part of a Babel protocol instance. The 929 increment is performed by the sending procedure (Section 5.3 item 2) 930 before advertising the TS/PC number in a TS/PC TLV. 932 Depending on particular implementation method of these two updates 933 the advertised TS/PC number may possess additional properties 934 improving the replay attack protection strength. This includes, but 935 is not limited to the methods below. 937 a. The most straightforward implementation would use LocalTS as a 938 plain wrap counter, defining the updates as follows: 940 initialization Set LocalPC to 0, set LocalTS to 0. 942 increment Increment LocalPC by 1. If LocalPC wraps (0xFFFF 943 + 1 = 0x0000), increment LocalTS by 1. 945 In this case the advertised TS/PC numbers would be reused after 946 each Babel protocol instance restart, making neighbouring 947 speakers reject authenticated packets until the respective ANM 948 table entries expire or the new TS/PC number exceeds the old (see 949 Section 3.6 and Section 3.7). 951 b. A more advanced implementation could make a use of any 32-bit 952 unsigned integer timestamp (number of time units since an 953 arbitrary epoch) such as the UNIX timestamp, whereas the 954 timestamp itself spans a reasonable time range and is guaranteed 955 against a decrease (such as one resulting from network time use). 956 The updates would be defined as follows: 958 initialization Set LocalPC to 0, set LocalTS to 0. 960 increment If the current timestamp is greater than LocalTS, 961 set LocalTS to the current timestamp and LocalPC 962 to 0, then consider the update complete. 963 Otherwise increment LocalPC by 1 and, if LocalPC 964 wraps, increment LocalTS by 1. 966 In this case the advertised TS/PC number would remain unique 967 across the speaker's deployed lifetime without the need for any 968 persistent storage. However, a suitable timestamp source is not 969 available in every implementation case. 971 c. Another advanced implementation could use LocalTS in a way 972 similar to the "wrap/boot counter" suggested in Section 4.1.1 of 973 [OSPF3-AUTH], defining the updates as follows: 975 initialization Set LocalPC to 0. If there is a TS value stored 976 in NVRAM for the current interface, set LocalTS 977 to the stored TS value, then increment the stored 978 TS value by 1. Otherwise set LocalTS to 0 and 979 set the stored TS value to 1. 981 increment Increment LocalPC by 1. If LocalPC wraps, set 982 LocalTS to the TS value stored in NVRAM for the 983 current interface, then increment the stored TS 984 value by 1. 986 In this case the advertised TS/PC number would also remain unique 987 across the speaker's deployed lifetime, relying on NVRAM for 988 storing multiple TS numbers, one per interface. 990 As long as the TS/PC number retains its mandatory property stated 991 above, it is up to the implementor, which TS/PC number updates 992 methods are available and if the operator can configure the method 993 per-interface and/or at runtime. However, an implementation MUST 994 disclose the essence of each update method it includes, in a 995 comprehensible form such as natural language description, pseudocode, 996 or source code. An implementation MUST allow the operator to 997 discover, which update method is effective for any given interface, 998 either at runtime or from the system documentation. These 999 requirements are necessary to enable the optimal (see Section 3.7) 1000 management of ANM timeout in a network segment. 1002 Note that wrapping (0xFFFFFFFF + 1 = 0x00000000) of LastTS is 1003 unlikely, but possible, causing the advertised TS/PC number to be 1004 reused. Resolving this situation requires replacing all 1005 authentication keys of the involved interface. In addition to that, 1006 if the wrap was caused by a timestamp reaching its end of epoch, 1007 using this mechanism will be impossible for the involved interface 1008 until some different timestamp or update implementation method is 1009 used. 1011 5.2. Deriving ESAs from CSAs 1013 Neither receiving nor sending procedures work with the contents of 1014 interface's sequence of CSAs directly, both (Section 5.4 item 4 and 1015 Section 5.3 item 4 respectively) derive a sequence of ESAs from the 1016 sequence of CSAs and use the derived sequence (see Figure 1). There 1017 are two main goals achieved through this indirection: 1019 o Elimination of expired authentication keys and deduplication of 1020 security associations. This is done as early as possible to keep 1021 subsequent procedures focused on their respective tasks. 1023 o Maintenance of particular ordering within the derived sequence of 1024 ESAs. The ordering deterministically depends on the ordering 1025 within the interface's sequence of CSAs and the ordering within 1026 KeyChain sequence of each CSA. The particular correlation 1027 maintained by this procedure implements a concept of fair 1028 (independent of number of keys contained by each) competition 1029 between CSAs. 1031 The deriving procedure uses the following input arguments: 1033 o input sequence of CSAs 1035 o direction (sending or receiving) 1037 o current time (CT) 1039 The processing of input arguments begins with an empty output 1040 sequence of ESAs and consists of the following steps: 1042 1. Make a temporary copy of the input sequence of CSAs. 1044 2. Remove all expired authentication keys from each KeyChain 1045 sequence of the copy, that is, any keys such that: 1047 * for receiving: KeyStartAccept is greater than CT or 1048 KeyStopAccept is less than CT 1050 * for sending: KeyStartGenerate is greater than CT or 1051 KeyStopGenerate is less than CT 1053 Note well that there are no special exceptions. Remove all 1054 expired keys, even if there are no keys left after that (see 1055 Section 7.4). 1057 3. Use the copy to populate the output sequence of ESAs as follows: 1059 1. When the KeyChain sequence of the first CSA contains at least 1060 one key, use its first key to produce an ESA with fields set 1061 as follows: 1063 HashAlgo Set to HashAlgo of the current CSA. 1065 KeyID Set to LocalKeyID modulo 2^16 of the current 1066 key of the current CSA. 1068 AuthKeyOctets Set to AuthKeyOctets of the current key of the 1069 current CSA. 1071 Append this ESA to the end of the output sequence. 1073 2. When the KeyChain sequence of the second CSA contains at 1074 least one key, use its first key the same way and so forth 1075 until all first keys of the copy are processed. 1077 3. When the KeyChain sequence of the first CSA contains at least 1078 two keys, use its second key the same way. 1080 4. When the KeyChain sequence of the second CSA contains at 1081 least two keys, use its second key the same way and so forth 1082 until all second keys of the copy are processed. 1084 5. And so forth until all keys of all CSAs of the copy are 1085 processed, exactly once each. 1087 In the description above the ordinals ("first", "second", and so 1088 on) with regard to keys stand for an element position after the 1089 removal of expired keys, not before. For example, if a KeyChain 1090 sequence was { Ka, Kb, Kc, Kd } before the removal and became 1091 { Ka, Kd } after, then Ka would be the "first" element and Kd 1092 would be the "second". 1094 4. Deduplicate the ESAs in the output sequence, that is, wherever 1095 two or more ESAs exist that share the same (HashAlgo, KeyID, 1096 AuthKeyOctets) triplet value, remove all of these ESAs except the 1097 one closest to the beginning of the sequence. 1099 The resulting sequence will contain zero or more unique ESAs, ordered 1100 in a way deterministically correlated with ordering of CSAs within 1101 the original input sequence of CSAs and ordering of keys within each 1102 KeyChain sequence. This ordering maximizes the probability of having 1103 equal amount of keys per original CSA in any N first elements of the 1104 resulting sequence. Possible optimisations of this deriving 1105 procedure are outlined in Section 6.3. 1107 5.3. Updates to Packet Sending 1109 Perform the following authentication-specific processing after the 1110 instance of the original protocol considers an outgoing Babel packet 1111 ready for sending, but before the packet is actually sent (see 1112 Figure 1). After that send the packet regardless if the 1113 authentication-specific processing modified the outgoing packet or 1114 left it intact. 1116 1. If the current outgoing interface's sequence of CSAs is empty, 1117 finish authentication-specific processing and consider the packet 1118 ready for sending. 1120 2. Increment TS/PC number of the current outgoing interface as 1121 explained in Section 5.1. 1123 3. Add to the packet body (see the note at the end of this section) 1124 a TS/PC TLV with fields set as follows: 1126 Type Set to 11. 1128 Length Set to 6. 1130 PacketCounter Set to the current value of LocalPC variable of 1131 the current outgoing interface. 1133 Timestamp Set to the current value of LocalTS variable of 1134 the current outgoing interface. 1136 Note that the current step may involve byte order conversion. 1138 4. Derive a sequence of ESAs using procedure defined in Section 5.2 1139 with the current interface's sequence of CSAs as the input 1140 sequence of CSAs, the current time as CT and "sending" as the 1141 direction. Proceed to the next step even if the derived sequence 1142 is empty. 1144 5. Iterate over the derived sequence using its ordering. For each 1145 ESA add to the packet body (see the note at the end of this 1146 section) an HMAC TLV with fields set as follows: 1148 Type Set to 12. 1150 Length Set to 2 plus digest length of HashAlgo of the current 1151 ESA. 1153 KeyID Set to KeyID of the current ESA. 1155 Digest Size exactly equal to the digest length of HashAlgo of 1156 the current ESA. Pad (see Section 2.2) using the source 1157 address of the current packet (see Section 6.1). 1159 As soon as there are MaxDigestsOut HMAC TLVs added to the current 1160 packet body, immediately proceed to the next step. 1162 Note that the current step may involve byte order conversion. 1164 6. Increment the "Body length" field value of the current packet 1165 header by the total length of TS/PC and HMAC TLVs appended to the 1166 current packet body so far. 1168 Note that the current step may involve byte order conversion. 1170 7. Make a temporary copy of the current packet. 1172 8. Iterate over the derived sequence again, using the same order and 1173 number of elements. For each ESA (and respectively for each HMAC 1174 TLV recently appended to the current packet body) compute an HMAC 1175 result (see Section 2.4) using the temporary copy (not the 1176 original packet) as Text, HashAlgo of the current ESA as H, and 1177 AuthKeyOctets of the current ESA as K. Write the HMAC result to 1178 the Digest field of the current HMAC TLV (see Table 4) of the 1179 current packet (not the copy). 1181 9. After this point, allow no more changes to the current packet 1182 header and body and consider it ready for sending. 1184 Note that even when the derived sequence of ESAs is empty, the packet 1185 is sent anyway with only a TS/PC TLV appended to its body. Although 1186 such a packet would not be authenticated, the presence of the sole 1187 TS/PC TLV would indicate authentication key exhaustion to operators 1188 of neighbouring Babel speakers. See also Section 7.4. 1190 Also note that it is possible to place the authentication-specific 1191 TLVs in the packet's sequence of TLVs in a number of different valid 1192 ways so long as there is exactly one TS/PC TLV in the sequence and 1193 the ordering of HMAC TLVs relative to each other, as produced in step 1194 5 above, is preserved. 1196 For example, see Figure 2. The diagrams represent a Babel packet 1197 without (D1) and with (D2, D3, D4) authentication-specific TLVs. The 1198 optional trailing data block that is present in D1 is preserved in 1199 D2, D3, and D4. Indexing (1, 2, ..., n) of the HMAC TLVs means the 1200 order in which the sending procedure produced them (and respectively 1201 the HMAC results). In D2 the added TLVs are appended: the previously 1202 existing TLVs are followed by the TS/PC TLV, which is followed by the 1203 HMAC TLVs. In D3 the added TLVs are prepended: the TS/PC TLV is the 1204 first and is followed by the HMAC TLVs, which are followed by the 1205 previously existing TLVs. In D4 the added TLVs are intermixed with 1206 the previously existing TLVs and the TS/PC TLV is placed after the 1207 HMAC TLVs. All three packets meet the requirements above. 1209 Implementors SHOULD use appending (D2) for adding the authentication- 1210 specific TLVs to the sequence, this is expected to result in more 1211 straightforward implementation and troubleshooting in most use cases. 1213 5.4. Updates to Packet Receiving 1215 Perform the following authentication-specific processing after an 1216 incoming Babel packet is received from the local network stack, but 1217 before it is processed by the Babel protocol instance (see Figure 1). 1218 The final action conceptually depends not only upon the result of the 1219 authentication-specific processing, but also on the current value of 1220 RxAuthRequired parameter. Immediately after any processing step 1221 below accepts or refuses the packet, either deliver the packet to the 1222 instance of the original protocol (when the packet is accepted or 1223 RxAuthRequired is FALSE) or discard it (when the packet is refused 1224 and RxAuthRequired is TRUE). 1226 1. If the current incoming interface's sequence of CSAs is empty, 1227 accept the packet. 1229 2. If the current packet does not contain exactly one TS/PC TLV, 1230 refuse it. 1232 3. Perform a lookup in the ANM table for an entry having Interface 1233 equal to the current incoming interface and Source equal to the 1234 source address of the current packet. If such an entry does not 1235 exist, immediately proceed to the next step. Otherwise, compare 1236 the entry's LastTS and LastPC field values with Timestamp and 1237 PacketCounter values respectively of the TS/PC TLV of the 1238 packet. That is, refuse the packet, if at least one of the 1239 following two conditions is true: 1241 * Timestamp is less than LastTS 1242 * Timestamp is equal to LastTS and PacketCounter is not greater 1243 than LastPC 1245 Note that the current step may involve byte order conversion. 1247 4. Derive a sequence of ESAs using procedure defined in Section 5.2 1248 with the current interface's sequence of CSAs as the input 1249 sequence of CSAs, current time as CT and "receiving" as the 1250 direction. If the derived sequence is empty, refuse the packet. 1252 5. Make a temporary copy of the current packet. 1254 6. Pad (see Section 2.2) every HMAC TLV present in the temporary 1255 copy (not the original packet) using the source address of the 1256 original packet. 1258 7. Iterate over all the HMAC TLVs of the original input packet (not 1259 the copy) using their order of appearance in the packet. For 1260 each HMAC TLV look up all ESAs in the derived sequence such that 1261 2 plus digest length of HashAlgo of the ESA is equal to Length 1262 of the TLV and KeyID of the ESA is equal to value of KeyID of 1263 the TLV. Iterate over these ESAs in the relative order of their 1264 appearance on the full sequence of ESAs. Note that nesting the 1265 iterations the opposite way (over ESAs, then over HMAC TLVs) 1266 would be wrong. 1268 For each of these ESAs compute an HMAC result (see Section 2.4) 1269 using the temporary copy (not the original packet) as Text, 1270 HashAlgo of the current ESA as H, and AuthKeyOctets of the 1271 current ESA as K. If the current HMAC result exactly matches the 1272 contents of Digest field of the current HMAC TLV, immediately 1273 proceed to the next step. Otherwise, if the number of HMAC 1274 computations done for the current packet so far is equal to 1275 MaxDigestsIn, immediately proceed to the next step. Otherwise 1276 follow the normal order of iterations. 1278 Note that the current step may involve byte order conversion. 1280 8. Refuse the input packet unless there was a matching HMAC result 1281 in the previous step. 1283 9. Modify the ANM table, using the same index as for the entry 1284 lookup above, to contain an entry with LastTS set to the value 1285 of Timestamp and LastPC set to the value of PacketCounter fields 1286 of the TS/PC TLV of the current packet. That is, either add a 1287 new ANM table entry or update the existing one, depending on the 1288 result of the entry lookup above. Reset the entry's aging timer 1289 to the current value of ANM timeout. 1291 Note that the current step may involve byte order conversion. 1293 10. Accept the input packet. 1295 Note that RxAuthRequired affects only the final action, but not the 1296 defined flow of authentication-specific processing. The purpose of 1297 this is to preserve authentication-specific processing feedback (such 1298 as log messages and event counters updates) even with RxAuthRequired 1299 set to FALSE. This allows an operator to predict the effect of 1300 changing RxAuthRequired from FALSE to TRUE during a migration 1301 scenario (Section 7.3) implementation. 1303 5.5. Authentication-Specific Statistics Maintenance 1305 A Babel speaker implementing this mechanism SHOULD maintain a set of 1306 counters for the following events, per protocol instance and per 1307 interface: 1309 o Sending of an unauthenticated Babel packet through an interface 1310 having an empty sequence of CSAs (Section 5.3 item 1). 1312 o Sending of an unauthenticated Babel packet with a TS/PC TLV but 1313 without any HMAC TLVs due to an empty derived sequence of ESAs 1314 (Section 5.3 item 4). 1316 o Sending of an authenticated Babel packet containing both TS/PC and 1317 HMAC TLVs (Section 5.3 item 9). 1319 o Accepting of a Babel packet received through an interface having 1320 an empty sequence of CSAs (Section 5.4 item 1). 1322 o Refusing of a received Babel packet due to an empty derived 1323 sequence of ESAs (Section 5.4 item 4). 1325 o Refusing of a received Babel packet that does not contain exactly 1326 one TS/PC TLV (Section 5.4 item 2). 1328 o Refusing of a received Babel packet due to the TS/PC TLV failing 1329 the ANM table check (Section 5.4 item 3). In the view of future 1330 extensions this event SHOULD leave out some small amount, per 1331 current (Interface, Source, LastTS, LastPC) tuple, of the packets 1332 refused due to Timestamp value being equal to LastTS and 1333 PacketCounter value being equal to LastPC. 1335 o Refusing of a received Babel packet missing any HMAC TLVs 1336 (Section 5.4 item 8). 1338 o Refusing of a received Babel packet due to none of the processed 1339 HMAC TLVs passing the ESA check (Section 5.4 item 8). 1341 o Accepting of a received Babel packet having both TS/PC and HMAC 1342 TLVs (Section 5.4 item 10). 1344 o Delivery of a refused packet to the instance of the original 1345 protocol due to RxAuthRequired parameter set to FALSE. 1347 Note that terms "accepting" and "refusing" are used in the sense of 1348 the receiving procedure, that is, "accepting" does not mean a packet 1349 delivered to the instance of the original protocol purely because the 1350 RxAuthRequired parameter is set to FALSE. Event counters readings 1351 SHOULD be available to the operator at runtime. 1353 6. Implementation Notes 1355 6.1. Source Address Selection for Sending 1357 Section 3.1 of [BABEL] allows for exchange of protocol datagrams 1358 using IPv4 or IPv6 or both. The source address of the datagram is a 1359 unicast (link-local in the case of IPv6) address. Within an address 1360 family used by a Babel speaker there may be more than one addresses 1361 eligible for the exchange and assigned to the same network interface. 1362 The original specification considers this case out of scope and 1363 leaves it up to the speaker's network stack to select one particular 1364 address as the datagram source address. But the sending procedure 1365 requires (Section 5.3 item 5) exact knowledge of packet source 1366 address for proper padding of HMAC TLVs. 1368 As long as a network interface has more than one addresses eligible 1369 for the exchange within the same address family, the Babel speaker 1370 SHOULD internally choose one of those addresses for Babel packet 1371 sending purposes and make this choice to both the sending procedure 1372 and the network stack (see Figure 1). Wherever this requirement 1373 cannot be met, this limitation MUST be clearly stated in the system 1374 documentation to allow an operator to plan network address management 1375 accordingly. 1377 6.2. Output Buffer Management 1379 An instance of the original protocol buffers produced TLVs until the 1380 buffer becomes full or a delay timer has expired. This is performed 1381 independently for each Babel interface with each buffer sized 1382 according to the interface MTU (see Sections 3.1 and 4 of [BABEL]). 1384 Since TS/PC and HMAC TLVs and any other TLVs, in the first place 1385 those of the original protocol, share the same packet space (see 1386 Figure 2) and respectively the same buffer space, a particular 1387 portion of each interface buffer needs to be reserved for 1 TS/PC TLV 1388 and up to MaxDigestsOut HMAC TLVs. The amount (R) of this reserved 1389 buffer space is calculated as follows: 1391 R = St + MaxDigestsOut * Sh = 1392 = 8 + MaxDigestsOut * (4 + Lmax) 1394 St Is the size of a TS/PC TLV. 1396 Sh Is the size of an HMAC TLV. 1398 Lmax Is the maximum digest length in octets possible for a 1399 particular interface. It SHOULD be calculated based on 1400 particular interface's sequence of CSAs, but MAY be taken as 1401 the maximum digest length supported by particular 1402 implementation. 1404 An implementation allowing for per-interface value of MaxDigestsOut 1405 or Lmax has to account for different value of R across different 1406 interfaces, even having the same MTU. An implementation allowing for 1407 runtime change of the value of R (due to MaxDigestsOut or Lmax) has 1408 to take care of the TLVs already buffered by the time of the change, 1409 especially when the value of R increases. 1411 The maximum safe value of MaxDigestsOut parameter depends on the 1412 interface MTU and maximum digest length used. In general, at least 1413 200-300 octets of a Babel packet should be always available to data 1414 other than TS/PC and HMAC TLVs. An implementation following the 1415 requirements of Section 4 of [BABEL] would send packets sized 512 1416 octets or larger. If, for example, the maximum digest length is 64 1417 octets and MaxDigestsOut value is 4, the value of R would be 280, 1418 leaving less than a half of a 512-octet packet for any other TLVs. 1419 As long as the interface MTU is larger or digest length is smaller, 1420 higher values of MaxDigestsOut can be used safely. 1422 6.3. Optimisations of ESAs Deriving 1424 The following optimisations of the ESAs deriving procedure can reduce 1425 amount of CPU time consumed by authentication-specific processing, 1426 preserving an implementation's effective behaviour. 1428 a. The most straightforward implementation would treat the deriving 1429 procedure as a per-packet action. But since the procedure is 1430 deterministic (its output depends on its input only), it is 1431 possible to significantly reduce the number of times the 1432 procedure is performed. 1434 The procedure would obviously return the same result for the same 1435 input arguments (sequence of CSAs, direction, CT) values. 1436 However, it is possible to predict when the result will remain 1437 the same even for a different input. That is, when the input 1438 sequence of CSAs and the direction both remain the same but CT 1439 changes, the result will remain the same as long as CT's order on 1440 the time axis (relative to all critical points of the sequence of 1441 CSAs) remains unchanged. Here, the critical points are 1442 KeyStartAccept and KeyStopAccept (for the "receiving" direction) 1443 and KeyStartGenerate and KeyStopGenerate (for the "sending" 1444 direction) of all keys of all CSAs of the input sequence. In 1445 other words, in this case the result will remain the same as long 1446 as both none of the active keys expire and none of the inactive 1447 keys enter into operation. 1449 An implementation optimised this way would perform the full 1450 deriving procedure for a given (interface, direction) pair only 1451 after an operator's change to the interface's sequence of CSAs or 1452 after reaching one of the critical points mentioned above. 1454 b. Considering that the sending procedure iterates over at most 1455 MaxDigestsOut elements of the derived sequence of ESAs 1456 (Section 5.3 item 5), there would be little sense in the case of 1457 "sending" direction in returning more than MaxDigestsOut ESAs in 1458 the derived sequence. Note that a similar optimisation would be 1459 relatively difficult in the case of "receiving" direction, since 1460 the number of ESAs actually used in examining a particular 1461 received packet (not to be confused with the number of HMAC 1462 computations) depends on additional factors besides just 1463 MaxDigestsIn. 1465 6.4. Security Associations Duplication 1467 This specification defines three data structures as finite sequences: 1468 a KeyChain sequence, an interface's sequence of CSAs, and a sequence 1469 of ESAs. There are associated semantics to take into account during 1470 implementation, in that the same element can appear multiple times at 1471 different positions of the sequence. In particular, none of CSA 1472 structure fields (including HashAlgo, LocalKeyID, and AuthKeyOctets) 1473 alone or in a combination has to be unique within a given CSA, or 1474 within a given sequence of CSAs, or within all sequences of CSAs of a 1475 Babel speaker. 1477 In the CSA space defined this way, for any two authentication keys 1478 their one field (in)equality would not imply their another field 1479 (in)equality. In other words, it is acceptable to have more than one 1480 authentication key with the same LocalKeyID or the same AuthKeyOctets 1481 or both at a time. It is a conscious design decision that CSA 1482 semantics allow for duplication of security associations. 1483 Consequently, ESA semantics allow for duplication of intermediate 1484 ESAs in the sequence until the explicit deduplication (Section 5.2 1485 item 4). 1487 One of the intentions of this is to define the security association 1488 management in a way that allows the addressing of some specifics of 1489 Babel as a mesh routing protocol. For example, a system operator 1490 configuring a Babel speaker to participate in more than one 1491 administrative domain could find each domain using its own 1492 authentication key (AuthKeyOctets) under the same LocalKeyID value, 1493 e.g., a "well-known" or "default" value like 0 or 1. Since 1494 reconfiguring the domains to use distinct LocalKeyID values isn't 1495 always feasible, the multi-domain Babel speaker using several 1496 distinct authentication keys under the same LocalKeyID would make a 1497 valid use case for such duplication. 1499 Furthermore, if in this situation the operator decided to migrate one 1500 of the domains to a different LocalKeyID value in a seamless way, 1501 respective Babel speakers would use the same authentication key 1502 (AuthKeyOctets) under two different LocalKeyID values for the time of 1503 the transition (see also item (e) of Section 9). This would make a 1504 similar use case. 1506 Another intention of this design decision is to decouple security 1507 association management from authentication key management as much as 1508 possible, so that the latter, be it manual keying or a key management 1509 protocol, could be designed and implemented independently. This way 1510 the additional key management constraints, if any, would remain out 1511 of scope of this authentication mechanism. A similar thinking 1512 justifies LocalKeyID field having bit length in ESA structure 1513 definition, but not in that of CSA. 1515 7. Network Management Aspects 1517 7.1. Backward Compatibility 1519 Support of this mechanism is optional, it does not change the default 1520 behaviour of a Babel speaker and causes no compatibility issues with 1521 speakers properly implementing the original Babel specification. 1522 Given two Babel speakers, one implementing this mechanism and 1523 configured for authenticated exchange (A) and another not 1524 implementing it (B), these would not distribute routing information 1525 uni-directionally or form a routing loop or experience other protocol 1526 logic issues specific purely to the use of this mechanism. 1528 The Babel design requires a bi-directional neighbour reachability 1529 condition between two given speakers for a successful exchange of 1530 routing information. Apparently, in the case above neighbour 1531 reachability would be uni-directional. Presence of TS/PC and HMAC 1532 TLVs in Babel packets sent by A would be transparent to B. But lack 1533 of authentication data in Babel packets send by B would make them 1534 effectively invisible to the instance of the original protocol of A. 1535 Uni-directional links are not specific to use of this mechanism, they 1536 naturally exist on their own and are properly detected and coped with 1537 by the original protocol (see Section 3.4.2 of [BABEL]). 1539 7.2. Multi-Domain Authentication 1541 The receiving procedure treats a packet as authentic as soon as one 1542 of its HMAC TLVs passes the check against the derived sequence of 1543 ESAs. This allows for packet exchange authenticated with multiple 1544 (hash algorithm, authentication key) pairs simultaneously, in 1545 combinations as arbitrary as permitted by MaxDigestsIn and 1546 MaxDigestsOut. 1548 For example, consider three Babel speakers with one interface each, 1549 configured with the following CSAs: 1551 o speaker A: (hash algorithm H1; key SK1), (hash algorithm H1; key 1552 SK2) 1554 o speaker B: (hash algorithm H1; key SK1) 1556 o speaker C: (hash algorithm H1; key SK2) 1558 Packets sent by A would contain 2 HMAC TLVs each, packets sent by B 1559 and C would contain 1 HMAC TLV each. A and B would authenticate the 1560 exchange between themselves using H1 and SK1; A and C would use H1 1561 and SK2; B and C would discard each other's packets. 1563 Consider a similar set of speakers configured with different CSAs: 1565 o speaker D: (hash algorithm H2; key SK3), (hash algorithm H3; key 1566 SK4) 1568 o speaker E: (hash algorithm H2; key SK3), (hash algorithm H4, keys 1569 SK5 and SK6) 1571 o speaker F: (hash algorithm H3; keys SK4 and SK7), (hash algorithm 1572 H5, key SK8) 1574 Packets sent by D would contain 2 HMAC TLVs each, packets sent by E 1575 and F would contain 3 HMAC TLVs each. D and E would authenticate the 1576 exchange between themselves using H2 and SK3; D and F would use H3 1577 and SK4; E and F would discard each other's packets. The 1578 simultaneous use of H4, SK5, and SK6 by E, as well as use of SK7, H5, 1579 and SK8 by F (for their own purposes) would remain insignificant to 1580 A. 1582 An operator implementing a multi-domain authentication should keep in 1583 mind that values of MaxDigestsIn and MaxDigestsOut may be different 1584 both within the same Babel speaker and across different speakers. 1585 Since the minimum value of both parameters is 2 (see Section 3.4 and 1586 Section 3.5), when more than 2 authentication domains are configured 1587 simultaneously it is advised to confirm that every involved speaker 1588 can handle sufficient number of HMAC results for both sending and 1589 receiving. 1591 The recommended method of Babel speaker configuration for multi- 1592 domain authentication is not only using a different authentication 1593 key for each domain, but also using a separate CSA for each domain, 1594 even when hash algorithms are the same. This allows for fair 1595 competition between CSAs and sometimes limits the consequences of a 1596 possible misconfiguration to the scope of one CSA. See also item (e) 1597 of Section 9. 1599 7.3. Migration to and from Authenticated Exchange 1601 It is common in practice to consider a migration to authenticated 1602 exchange of routing information only after the network has already 1603 been deployed and put to an active use. Performing the migration in 1604 a way without regular traffic interruption is typically demanded, and 1605 this specification allows a smooth migration using the RxAuthRequired 1606 interface parameter defined in Section 3.1. This measure is similar 1607 to the "transition mode" suggested in Section 5 of [OSPF3-AUTH]. 1609 An operator performing the migration needs to arrange configuration 1610 changes as follows: 1612 1. Decide on particular hash algorithm(s) and key(s) to be used. 1614 2. Identify all speakers and their involved interfaces that need to 1615 be migrated to authenticated exchange. 1617 3. For each of the speakers and the interfaces to be reconfigured 1618 first set RxAuthRequired parameter to FALSE, then configure 1619 necessary CSA(s). 1621 4. Examine the speakers to confirm that Babel packets are 1622 successfully authenticated according to the configuration 1623 (supposedly, through examining ANM table entries and 1624 authentication-specific statistics, see Figure 1) and address any 1625 discrepancies before proceeding further. 1627 5. For each of the speakers and the reconfigured interfaces set the 1628 RxAuthRequired parameter to TRUE. 1630 Likewise, temporarily setting RxAuthRequired to FALSE can be used to 1631 migrate smoothly from an authenticated packet exchange back to 1632 unauthenticated one. 1634 7.4. Handling of Authentication Keys Exhaustion 1636 This specification employs a common concept of multiple authenticaion 1637 keys co-existing for a given interface, with two independent lifetime 1638 ranges associated with each key (one for sending and another for 1639 receiving). It is typically recommended to configure the keys using 1640 finite lifetimes, adding new keys before the old keys expire. 1641 However, it is obviously possible for all keys to expire for a given 1642 interface (for sending or receiving or both). Possible ways of 1643 addressing this situation raise their own concerns: 1645 o Automatic switching to unauthenticated protocol exchange. This 1646 behaviour invalidates the initial purposes of authentication and 1647 is commonly viewed as "unacceptable" ([RIP2-AUTH] Section 5.1, 1648 [OSPF2-AUTH] Section 3.2, [OSPF3-AUTH] Section 3). 1650 o Stopping routing information exchange over the interface. This 1651 behaviour is likely to impact regular traffic routing and is 1652 commonly viewed as "not advisable" (ibid.). 1654 o Use of the "most recently expired" key over its intended lifetime 1655 range. This behaviour is commonly recommended for implementation 1656 (ibid.), although it may become a problem due to an offline 1657 cryptographic attack (see item (e) of Section 9) or a compromise 1658 of the key. In addition, telling a recently expired key from a 1659 key never ever been in a use may be impossible after a router 1660 restart. 1662 Design of this mechanism prevents the automatic switching to 1663 unauthenticated exchange and is consistent with similar 1664 authentication mechanisms in this regard. But since the best choice 1665 between two other options depends on local site policy, this decision 1666 is left up to the operator rather than the implementor (in a way 1667 resembling the "fail secure" configuration knob described in Section 1668 5.1 of [RIP2-AUTH]). 1670 Although the deriving procedure does not allow for any exceptions in 1671 expired keys filtering (Section 5.2 item 2), the operator can 1672 trivially enforce one of the two remaining behaviour options through 1673 local key management procedures. In particular, when using the key 1674 over its intended lifetime is more preferred than regular traffic 1675 disruption, the operator would explicitly leave the old key expiry 1676 time open until the new key is added to the router configuration. In 1677 the opposite case the operator would always configure the old key 1678 with a finite lifetime and bear associated risks. 1680 8. Implementation Status 1682 [RFC Editor: before publication please remove this section and the 1683 reference to [RFC6982], along the offered experiment of which this 1684 section exists to assist document reviewers.] 1686 At the time of this writing the original Babel protocol is available 1687 in two free, production-quality implementations, both of which 1688 support IPv4 and IPv6 routing but exchange Babel packets using IPv6 1689 only: 1691 o The "standalone" babeld, a BSD-licensed software with source code 1692 publicly available [1]. 1694 That implementation does not support this authentication 1695 mechanism. 1697 o The integrated babeld component of Quagga-RE, a work derived from 1698 Quagga routing protocol suite, a GPL-lisensed software with source 1699 code publicly available [2]. 1701 That implementation supports this authentication mechanism as 1702 defined in revision 05 of this document. It supports both 1703 mandatory-to-implement hash algorithms (RIPEMD-160 and SHA-1) and 1704 a few additional algorithms (SHA-224, SHA-256, SHA-384, SHA-512 1705 and Whirlpool). It does not support more than one link-local IPv6 1706 address per interface. It implements authentication-specific 1707 parameters, data structures and methods as follows (whether a 1708 parameter can be "changed at runtime", it is done by means of CLI 1709 and can also be set in a configuration file): 1711 * MaxDigestsIn value is fixed to 4. 1713 * MaxDigestsOut value is fixed to 4. 1715 * RxAuthRequired value is specific to each interface and can be 1716 changed at runtime. 1718 * ANM Table contents is not retained across speaker restarts, can 1719 be retrieved and reset (all entries at once) by means of CLI. 1721 * ANM Timeout value is specific to the whole protocol instance, 1722 has a default value of 300 seconds and can be changed at 1723 runtime. 1725 * Ordering of elements within each interface's sequence of CSAs 1726 is arbitrary as set by operator at runtime. CSAs are 1727 implemented to refer to existing key chain syntax items. 1728 Elements of an interface's sequence of CSAs are constrained to 1729 be unique reference-wise, but not contents-wise, that is, it is 1730 possible to duplicate security associations using a different 1731 key chain name to contain the same keys. 1733 * Ordering of elements within each KeyChain sequence is fixed to 1734 the sort order of LocalKeyID. LocalKeyID is constrained to be 1735 unique within each KeyChain sequence. 1737 * TS/PC number updates method can be configured at runtime for 1738 the whole protocol instance to one of two methods standing for 1739 items (a) and (b) of Section 5.1. The default method is (b). 1741 * Most of the authentication-specific statistics counters listed 1742 in Section 5.5 are implemented (per protocol instance and per 1743 each interface) and their readings are available by means of 1744 CLI with an option to log respective events into a file. 1746 No other implementations of this authentication mechanism are 1747 known to exist, thus interoperability can only be assessed on 1748 paper. The only existing implementation has been tested to be 1749 fully compatible with itself regardless of a speaker CPU 1750 endianness. 1752 9. Security Considerations 1754 Use of this mechanism implies requirements common to a use of shared 1755 authentication keys, including, but not limited to: 1757 o holding the keys secret, 1759 o including sufficient amounts of random bits into each key, 1761 o rekeying on a regular basis, and 1763 o never reusing a used key for a different purpose 1765 That said, proper design and implementation of a key management 1766 policy is out of scope of this work. Many publications on this 1767 subject exist and should be used for this purpose (BCP 107 [RFC4107], 1768 BCP 132 [RFC4962], and [RFC6039] may be suggested as starting 1769 points). 1771 It is possible for a network that exercises authentication keys 1772 rollover to experience accidental expiration of all the keys for a 1773 network interface as discussed at greater length in Section 7.4. 1774 With that and the guidance of Section 5.1 of [RIP2-AUTH] in mind, in 1775 such an event the Babel speaker MUST send a "last key expired" 1776 notification to the operator (e.g. via syslog, SNMP, and/or other 1777 implementation-specific means). Also, any actual occurrence of an 1778 authentication key expiration MUST cause a security event to be 1779 logged by the implementation, most likely as the respective event 1780 listed in Section 5.5. The log item MUST include at least a note 1781 that the authentication key has expired, the Babel routing protocol 1782 instance(s) affected, the network interface(s) affected, the 1783 LocalKeyID that is affected, and the current date/time. Operators 1784 are encouraged to check such logs as an operational security 1785 practice. 1787 Considering particular attacks being in-scope or out of scope on one 1788 hand and measures taken to protect against particular in-scope 1789 attacks on the other, the original Babel protocol and this 1790 authentication mechanism are in line with similar datagram-based 1791 routing protocols and their respective mechanisms. In particular, 1792 the primary concerns addressed are: 1794 a. Peer Entity Authentication 1796 The Babel speaker authentication mechanism defined herein is 1797 believed to be as strong as is the class itself that it belongs 1798 to. This specification is built on fundamental concepts 1799 implemented for authentication of similar routing protocols: per- 1800 packet authentication, use of HMAC construct, use of shared keys. 1801 Although this design approach does not address all possible 1802 concerns, it is so far known to be sufficient for most practical 1803 cases. 1805 b. Data Integrity 1807 Meaningful parts of a Babel datagram are the contents of the 1808 Babel packet (in the definition of Section 4.2 of [BABEL]) and 1809 the source address of the datagram (Section 3.5.3 ibid.). This 1810 mechanism authenticates both parts using the HMAC construct, so 1811 that making any meaningful change to an authenticated packet 1812 after it has been emitted by the sender should be as hard as 1813 attacking the HMAC construct itself or successfully recovering 1814 the authentication key. 1816 Note well that any trailing data of the Babel datagram is not 1817 meaningful in the scope of the original specification and does 1818 not belong to the Babel packet. Integrity of the trailing data 1819 is respectively not protected by this mechanism. At the same 1820 time, although any TLV extra data is also not meaningful in the 1821 same scope, its integrity is protected, since this extra data is 1822 a part of the Babel packet (see Figure 2). 1824 c. Replay Attacks 1826 This specification establishes a basic replay protection measure 1827 (see Section 3.6), defines a timeout parameter affecting its 1828 strength (see Section 3.7), and outlines implementation methods 1829 also affecting protection strength in several ways (see 1830 Section 5.1). The implementor's choice of the timeout value and 1831 particular implementation methods may be suboptimal due to, for 1832 example, insufficient hardware resources of the Babel speaker. 1833 Furthermore, it may be possible that an operator configures the 1834 timeout and the methods to address particular local specifics and 1835 this further weakens the protection. An operator concerned about 1836 replay attack protection strength should understand these factors 1837 and their meaning in a given network segment. 1839 d. Denial of Service 1841 Proper deployment of this mechanism in a Babel network 1842 significantly increases the efforts required for an attacker to 1843 feed arbitrary Babel PDUs into protocol exchange (with an intent 1844 of attacking a particular Babel speaker or disrupting exchange of 1845 regular traffic in a routing domain). It also protects the 1846 neighbour table from being flooded with forged speaker entries. 1848 At the same time, this protection comes with a price of CPU time 1849 being spent on HMAC computations. This may be a concern for low- 1850 performance CPUs combined with high-speed interfaces, as 1851 sometimes seen in embedded systems and hardware routers. The 1852 MaxDigestsIn parameter, which is used to limit the maximum amount 1853 of CPU time spent on a single received Babel packet, addresses 1854 this concern to some extent. 1856 The following in-scope concerns are not addressed: 1858 e. Offline Cryptographic Attacks 1860 This mechanism is obviously subject to offline cryptographic 1861 attacks. As soon as an attacker has obtained a copy of an 1862 authenticated Babel packet of interest (which gets easier to do 1863 in wireless networks), he has got all the parameters of the 1864 authentication-specific processing performed by the sender, 1865 except authentication key(s) and choice of particular hash 1866 algorithm(s). Since digest lengths of common hash algorithms are 1867 well-known and can be matched with those seen in the packet, 1868 complexity of this attack is essentially that of the 1869 authentication key attack. 1871 Viewing the cryptographic strength of particular hash algorithms 1872 as a concern of its own, the main practical means of resisting 1873 offline cryptographic attacks on this mechanism are periodic 1874 rekeying and use of strong keys with a sufficient number of 1875 random bits. 1877 It is important to understand that in the case of multiple keys 1878 being used within single interface (for a multi-domain 1879 authentication or during a key rollover) the strength of the 1880 combined configuration would be that of the weakest key, since 1881 only one successful HMAC test is required for an authentic 1882 packet. Operators concerned about offline cryptographic attacks 1883 should enforce the same strength policy for all keys used for a 1884 given interface. 1886 Note that a special pathological case is possible with this 1887 mechanism. Whenever two or more authentication keys are 1888 configured for a given interface such that all keys share the 1889 same AuthKeyOctets and the same HashAlgo, but LocalKeyID modulo 1890 2^16 is different for each key, these keys will not be treated as 1891 duplicate (Section 5.2 item 4), but an HMAC result computed for a 1892 given packet will be the same for each of these keys. In the 1893 case of sending procedure this can produce multiple HMAC TLVs 1894 with exactly the same value of the Digest field, but different 1895 values of KeyID field. In this case the attacker will see that 1896 the keys are the same, even without the knowledge of the key 1897 itself. Reuse of authentication keys is not the intended use 1898 case of this mechanism and should be strongly avoided. 1900 f. Non-repudiation 1902 This specification relies on a use of shared keys. There is no 1903 timestamp infrastructure and no key revocation mechanism defined 1904 to address a shared key compromise. Establishing the time that a 1905 particular authentic Babel packet was generated is thus not 1906 possible. Proving that a particular Babel speaker had actually 1907 sent a given authentic packet is also impossible as soon as the 1908 shared key is claimed compromised. Even with the shared key not 1909 being compromised, reliably identifying the speaker that had 1910 actually sent a given authentic Babel packet is not possible any 1911 better than proving the speaker belongs to the group sharing the 1912 key (any of the speakers sharing a key can impose any other 1913 speaker sharing the same key). 1915 g. Confidentiality Violations 1917 The original Babel protocol does not encrypt any of the 1918 information contained in its packets. The contents of a Babel 1919 packet is trivial to decode, revealing network topology details. 1920 This mechanism does not improve this situation in any way. Since 1921 routing protocol messages are not the only kind of information 1922 subject to confidentiality concerns, a complete solution to this 1923 problem is likely to include measures based on the channel 1924 security model, such as IPSec and WPA2 at the time of this 1925 writing. 1927 h. Key Management 1929 Any authentication key exchange/distribution concerns are left 1930 out of scope. However, the internal representation of 1931 authentication keys (see Section 3.8) allows for diverse key 1932 management means, manual configuration in the first place. 1934 i. Message Deletion 1936 Any message deletion attacks are left out of scope. Since a 1937 datagram deleted by an attacker cannot be distinguished from a 1938 datagram naturally lost in transmission and since datagram-based 1939 routing protocols are designed to withstand a certain loss of 1940 packets, the currently established practice is treating 1941 authentication purely as a per-packet function without any added 1942 detection of lost packets. 1944 10. IANA Considerations 1946 [RFC Editor: please do not remove this section.] 1948 At the time of this publication Babel TLV Types namespace did not 1949 have an IANA registry. TLV types 11 and 12 were assigned (see 1950 Table 1) to the TS/PC and HMAC TLV types by Juliusz Chroboczek, 1951 designer of the original Babel protocol. Therefore, this document 1952 has no IANA actions. 1954 11. Acknowledgements 1956 Thanks to Randall Atkinson and Matthew Fanto for their comprehensive 1957 work on [RIP2-AUTH] that initiated a series of publications on 1958 routing protocols authentication, including this one. This 1959 specification adopts many concepts belonging to the whole series. 1961 Thanks to Juliusz Chroboczek, Gabriel Kerneis, and Matthieu Boutier. 1962 This document incorporates many technical and editorial corrections 1963 based on their feedback. Thanks to all contributors to Babel, 1964 because this work would not be possible without the prior works. 1965 Thanks to Dominic Mulligan for editorial proofreading of this 1966 document. Thanks to Riku Hietamaki for suggesting the test vectors 1967 section. 1969 Thanks to Jim Gettys and Dave Taht for developing CeroWrt wireless 1970 router project and collaborating on many integration issues. A 1971 practical need for Babel authentication emerged during a research 1972 based on CeroWrt that eventually became the very first use case of 1973 this mechanism. 1975 Thanks to Kunihiro Ishiguro and Paul Jakma for establishing GNU Zebra 1976 and Quagga routing software projects respectively. Thanks to Werner 1977 Koch, the author of Libgcrypt. The very first implementation of this 1978 mechanism was made on base of Quagga and Libgcrypt. 1980 This document was produced using the xml2rfc ([RFC2629]) authoring 1981 tool. 1983 12. References 1985 12.1. Normative References 1987 [RFC2104] Krawczyk, H., Bellare, M., and R. Canetti, "HMAC: Keyed- 1988 Hashing for Message Authentication", RFC 2104, 1989 February 1997. 1991 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1992 Requirement Levels", BCP 14, RFC 2119, March 1997. 1994 [RFC4291] Hinden, R. and S. Deering, "IP Version 6 Addressing 1995 Architecture", RFC 4291, February 2006. 1997 [FIPS-198] 1998 US National Institute of Standards & Technology, "The 1999 Keyed-Hash Message Authentication Code (HMAC)", FIPS 2000 PUB 198-1, July 2008. 2002 [BABEL] Chroboczek, J., "The Babel Routing Protocol", RFC 6126, 2003 April 2011. 2005 12.2. Informative References 2007 [RFC2629] Rose, M., "Writing I-Ds and RFCs using XML", RFC 2629, 2008 June 1999. 2010 [RFC3315] Droms, R., Bound, J., Volz, B., Lemon, T., Perkins, C., 2011 and M. Carney, "Dynamic Host Configuration Protocol for 2012 IPv6 (DHCPv6)", RFC 3315, July 2003. 2014 [RFC3931] Lau, J., Townsley, M., and I. Goyret, "Layer Two Tunneling 2015 Protocol - Version 3 (L2TPv3)", RFC 3931, March 2005. 2017 [RFC4030] Stapp, M. and T. Lemon, "The Authentication Suboption for 2018 the Dynamic Host Configuration Protocol (DHCP) Relay Agent 2019 Option", RFC 4030, March 2005. 2021 [RFC4107] Bellovin, S. and R. Housley, "Guidelines for Cryptographic 2022 Key Management", BCP 107, RFC 4107, June 2005. 2024 [RFC4270] Hoffman, P. and B. Schneier, "Attacks on Cryptographic 2025 Hashes in Internet Protocols", RFC 4270, November 2005. 2027 [RFC4302] Kent, S., "IP Authentication Header", RFC 4302, 2028 December 2005. 2030 [RIP2-AUTH] 2031 Atkinson, R. and M. Fanto, "RIPv2 Cryptographic 2032 Authentication", RFC 4822, February 2007. 2034 [RFC4962] Housley, R. and B. Aboba, "Guidance for Authentication, 2035 Authorization, and Accounting (AAA) Key Management", 2036 BCP 132, RFC 4962, July 2007. 2038 [RFC5176] Chiba, M., Dommety, G., Eklund, M., Mitton, D., and B. 2039 Aboba, "Dynamic Authorization Extensions to Remote 2040 Authentication Dial In User Service (RADIUS)", RFC 5176, 2041 January 2008. 2043 [ISIS-AUTH-A] 2044 Li, T. and R. Atkinson, "IS-IS Cryptographic 2045 Authentication", RFC 5304, October 2008. 2047 [ISIS-AUTH-B] 2048 Bhatia, M., Manral, V., Li, T., Atkinson, R., White, R., 2049 and M. Fanto, "IS-IS Generic Cryptographic 2050 Authentication", RFC 5310, February 2009. 2052 [OSPF2-AUTH] 2053 Bhatia, M., Manral, V., Fanto, M., White, R., Barnes, M., 2054 Li, T., and R. Atkinson, "OSPFv2 HMAC-SHA Cryptographic 2055 Authentication", RFC 5709, October 2009. 2057 [RFC6039] Manral, V., Bhatia, M., Jaeggli, J., and R. White, "Issues 2058 with Existing Cryptographic Protection Methods for Routing 2059 Protocols", RFC 6039, October 2010. 2061 [RFC6151] Turner, S. and L. Chen, "Updated Security Considerations 2062 for the MD5 Message-Digest and the HMAC-MD5 Algorithms", 2063 RFC 6151, March 2011. 2065 [RFC6194] Polk, T., Chen, L., Turner, S., and P. Hoffman, "Security 2066 Considerations for the SHA-0 and SHA-1 Message-Digest 2067 Algorithms", RFC 6194, March 2011. 2069 [OSPF3-AUTH] 2070 Bhatia, M., Manral, V., and A. Lindem, "Supporting 2071 Authentication Trailer for OSPFv3", RFC 6506, 2072 February 2012. 2074 [RFC6709] Carpenter, B., Aboba, B., and S. Cheshire, "Design 2075 Considerations for Protocol Extensions", RFC 6709, 2076 September 2012. 2078 [RFC6982] Sheffer, Y. and A. Farrel, "Improving Awareness of Running 2079 Code: The Implementation Status Section", RFC 6982, 2080 July 2013. 2082 [I-D.chroboczek-babel-extension-mechanism] 2083 Chroboczek, J., "Extension Mechanism for the Babel Routing 2084 Protocol", draft-chroboczek-babel-extension-mechanism-00 2085 (work in progress), June 2013. 2087 URIs 2089 [1] 2091 [2] 2093 Appendix A. Figures and Tables 2095 +-------------------------------------------------------------+ 2096 | authentication-specific statistics | 2097 +-------------------------------------------------------------+ 2098 ^ | ^ 2099 | v | 2100 | +-----------------------------------------------+ | 2101 | | system operator | | 2102 | +-----------------------------------------------+ | 2103 | ^ | ^ | ^ | ^ | ^ | | 2104 | | v | | | | | | | v | 2105 +---+ +---------+ | | | | | | +---------+ +---+ 2106 | |->| ANM | | | | | | | | LocalTS |->| | 2107 | R |<-| table | | | | | | | | LocalPC |<-| T | 2108 | x | +---------+ | v | v | v +---------+ | x | 2109 | | +----------------+ +---------+ +----------------+ | | 2110 | p | | MaxDigestsIn | | | | MaxDigestsOut | | p | 2111 | r |<-| ANM timeout | | CSAs | | |->| r | 2112 | o | | RxAuthRequired | | | | | | o | 2113 | c | +----------------+ +---------+ +----------------+ | c | 2114 | e | +-------------+ | | +-------------+ | e | 2115 | s | | Rx ESAs | | | | Tx ESAs | | s | 2116 | s |<-| (temporary) |<----+ +---->| (temporary) |->| s | 2117 | i | +-------------+ +-------------+ | i | 2118 | n | +------------------------------+----------------+ | n | 2119 | g | | instance of | output buffers |=>| g | 2120 | |=>| the original +----------------+ | | 2121 | | | protocol | source address |->| | 2122 +---+ +------------------------------+----------------+ +---+ 2123 /\ | || 2124 || v \/ 2125 +-------------------------------------------------------------+ 2126 | network stack | 2127 +-------------------------------------------------------------+ 2128 /\ || /\ || /\ || /\ || 2129 || \/ || \/ || \/ || \/ 2130 +---------+ +---------+ +---------+ +---------+ 2131 | speaker | | speaker | ... | speaker | | speaker | 2132 +---------+ +---------+ +---------+ +---------+ 2134 Flow of control data : ---> 2135 Flow of Babel datagrams/packets: ===> 2137 Figure 1: Interaction Diagram 2139 P 2140 |<---------------------------->| (D1) 2141 | B | 2142 | |<------------------------->| 2143 | | | 2144 +--+-----+-----+...+-----+-----+--+ P: Babel packet 2145 |H |some |some | |some |some |T | H: Babel packet header 2146 | |TLV |TLV | |TLV |TLV | | B: Babel packet body 2147 | | | | | | | | T: optional trailing data block 2148 +--+-----+-----+...+-----+-----+--+ 2150 P 2151 |<----------------------------------------------------->| (D2) 2152 | B | 2153 | |<-------------------------------------------------->| 2154 | | | 2155 +--+-----+-----+...+-----+-----+------+------+...+------+--+ 2156 |H |some |some | |some |some |TS/PC |HMAC | |HMAC |T | 2157 | |TLV |TLV | |TLV |TLV |TLV |TLV 1 | |TLV n | | 2158 | | | | | | | | | | | | 2159 +--+-----+-----+...+-----+-----+------+------+...+------+--+ 2161 P 2162 |<----------------------------------------------------->| (D3) 2163 | B | 2164 | |<-------------------------------------------------->| 2165 | | | 2166 +--+------+------+...+------+-----+-----+...+-----+-----+--+ 2167 |H |TS/PC |HMAC | |HMAC |some |some | |some |some |T | 2168 | |TLV |TLV 1 | |TLV n |TLV |TLV | |TLV |TLV | | 2169 | | | | | | | | | | | | 2170 +--+------+------+...+------+-----+-----+...+-----+-----+--+ 2172 P 2173 |<------------------------------------------------------------>| (D4) 2174 | B | 2175 | |<--------------------------------------------------------->| 2176 | | | 2177 +--+-----+------+-----+------+...+-----+------+...+------+-----+--+ 2178 |H |some |HMAC |some |HMAC | |some |HMAC | |TS/PC |some |T | 2179 | |TLV |TLV 1 |TLV |TLV 2 | |TLV |TLV n | |TLV |TLV | | 2180 | | | | | | | | | | | | | 2181 +--+-----+------+-----+------+...+-----+------+...+------+-----+--+ 2183 Figure 2: Babel Datagram Structure 2185 +-------+-------------------------+---------------+ 2186 | Value | Name | Reference | 2187 +-------+-------------------------+---------------+ 2188 | 0 | Pad1 | [BABEL] | 2189 | 1 | PadN | [BABEL] | 2190 | 2 | Acknowledgement Request | [BABEL] | 2191 | 3 | Acknowledgement | [BABEL] | 2192 | 4 | Hello | [BABEL] | 2193 | 5 | IHU | [BABEL] | 2194 | 6 | Router-Id | [BABEL] | 2195 | 7 | Next Hop | [BABEL] | 2196 | 8 | Update | [BABEL] | 2197 | 9 | Route Request | [BABEL] | 2198 | 10 | Seqno Request | [BABEL] | 2199 | 11 | TS/PC | this document | 2200 | 12 | HMAC | this document | 2201 +-------+-------------------------+---------------+ 2203 Table 1: Babel TLV Types Namespace 2205 +--------------+-----------------------------+-------------------+ 2206 | Packet field | Packet octets (hexadecimal) | Meaning (decimal) | 2207 +--------------+-----------------------------+-------------------+ 2208 | Magic | 2a | 42 | 2209 | Version | 02 | version 2 | 2210 | Body length | 00:14 | 20 octets | 2211 | [TLV] Type | 04 | 4 (Hello) | 2212 | [TLV] Length | 06 | 6 octets | 2213 | Reserved | 00:00 | no meaning | 2214 | Seqno | 09:25 | 2341 | 2215 | Interval | 01:90 | 400 (40.0 s) | 2216 | [TLV] Type | 08 | 8 (Update) | 2217 | [TLV] Length | 0a | 10 octets | 2218 | AE | 00 | 0 (wildcard) | 2219 | Flags | 40 | default router-id | 2220 | Plen | 00 | 0 bits | 2221 | Omitted | 00 | 0 bits | 2222 | Interval | ff:ff | infinity | 2223 | Seqno | 68:21 | 26657 | 2224 | Metric | ff:ff | infinity | 2225 +--------------+-----------------------------+-------------------+ 2227 Table 2: A Babel Packet without Authentication TLVs 2229 +---------------+-------------------------------+-------------------+ 2230 | Packet field | Packet octets (hexadecimal) | Meaning (decimal) | 2231 +---------------+-------------------------------+-------------------+ 2232 | Magic | 2a | 42 | 2233 | Version | 02 | version 2 | 2234 | Body length | 00:4c | 76 octets | 2235 | [TLV] Type | 04 | 4 (Hello) | 2236 | [TLV] Length | 06 | 6 octets | 2237 | Reserved | 00:00 | no meaning | 2238 | Seqno | 09:25 | 2341 | 2239 | Interval | 01:90 | 400 (40.0 s) | 2240 | [TLV] Type | 08 | 8 (Update) | 2241 | [TLV] Length | 0a | 10 octets | 2242 | AE | 00 | 0 (wildcard) | 2243 | Flags | 40 | default router-id | 2244 | Plen | 00 | 0 bits | 2245 | Omitted | 00 | 0 bits | 2246 | Interval | ff:ff | infinity | 2247 | Seqno | 68:21 | 26657 | 2248 | Metric | ff:ff | infinity | 2249 | [TLV] Type | 0b | 11 (TS/PC) | 2250 | [TLV] Length | 06 | 6 octets | 2251 | PacketCounter | 00:01 | 1 | 2252 | Timestamp | 52:1d:7e:8b | 1377664651 | 2253 | [TLV] Type | 0c | 12 (HMAC) | 2254 | [TLV] Length | 16 | 22 octets | 2255 | KeyID | 00:c8 | 200 | 2256 | Digest | fe:80:00:00:00:00:00:00:0a:11 | padding | 2257 | | 96:ff:fe:1c:10:c8:00:00:00:00 | | 2258 | [TLV] Type | 0c | 12 (HMAC) | 2259 | [TLV] Length | 16 | 22 octets | 2260 | KeyID | 00:64 | 100 | 2261 | Digest | fe:80:00:00:00:00:00:00:0a:11 | padding | 2262 | | 96:ff:fe:1c:10:c8:00:00:00:00 | | 2263 +---------------+-------------------------------+-------------------+ 2265 Table 3: A Babel Packet with Each HMAC TLV Padded Using IPv6 Address 2266 fe80::0a11:96ff:fe1c:10c8 2268 +---------------+-------------------------------+-------------------+ 2269 | Packet field | Packet octets (hexadecimal) | Meaning (decimal) | 2270 +---------------+-------------------------------+-------------------+ 2271 | Magic | 2a | 42 | 2272 | Version | 02 | version 2 | 2273 | Body length | 00:4c | 76 octets | 2274 | [TLV] Type | 04 | 4 (Hello) | 2275 | [TLV] Length | 06 | 6 octets | 2276 | Reserved | 00:00 | no meaning | 2277 | Seqno | 09:25 | 2341 | 2278 | Interval | 01:90 | 400 (40.0 s) | 2279 | [TLV] Type | 08 | 8 (Update) | 2280 | [TLV] Length | 0a | 10 octets | 2281 | AE | 00 | 0 (wildcard) | 2282 | Flags | 40 | default router-id | 2283 | Plen | 00 | 0 bits | 2284 | Omitted | 00 | 0 bits | 2285 | Interval | ff:ff | infinity | 2286 | Seqno | 68:21 | 26657 | 2287 | Metric | ff:ff | infinity | 2288 | [TLV] Type | 0b | 11 (TS/PC) | 2289 | [TLV] Length | 06 | 6 octets | 2290 | PacketCounter | 00:01 | 1 | 2291 | Timestamp | 52:1d:7e:8b | 1377664651 | 2292 | [TLV] Type | 0c | 12 (HMAC) | 2293 | [TLV] Length | 16 | 22 octets | 2294 | KeyID | 00:c8 | 200 | 2295 | Digest | c6:f1:06:13:30:3c:fa:f3:eb:5d | HMAC result | 2296 | | 60:3a:ed:fd:06:55:83:f7:ee:79 | | 2297 | [TLV] Type | 0c | 12 (HMAC) | 2298 | [TLV] Length | 16 | 22 octets | 2299 | KeyID | 00:64 | 100 | 2300 | Digest | df:32:16:5e:d8:63:16:e5:a6:4d | HMAC result | 2301 | | c7:73:e0:b5:22:82:ce:fe:e2:3c | | 2302 +---------------+-------------------------------+-------------------+ 2304 Table 4: A Babel Packet with Each HMAC TLV Containing an HMAC Result 2306 Appendix B. Test Vectors 2308 The test vectors below may be used to verify the correctness of some 2309 procedures performed by an implementation of this mechanism, namely: 2311 o appending of TS/PC and HMAC TLVs to the Babel packet body, 2313 o padding of the HMAC TLV(s), 2314 o computation of the HMAC result(s), and 2316 o placement of the result(s) in the TLV(s). 2318 This verification isn't exhaustive, there are other important 2319 implementation aspects that would require testing methods of their 2320 own. 2322 The test vectors were produced as follows. 2324 1. A Babel speaker with a network interface with IPv6 link-local 2325 address fe80::0a11:96ff:fe1c:10c8 was configured to use two CSAs 2326 for the interface: 2328 * CSA1={HashAlgo=RIPEMD-160, KeyChain={{LocalKeyID=200, 2329 AuthKeyOctets=Key26}}} 2331 * CSA2={HashAlgo=SHA-1, KeyChain={{LocalKeyId=100, 2332 AuthKeyOctets=Key70}}} 2334 The authentication keys above are: 2336 * Key26 in ASCII: 2338 ABCDEFGHIJKLMNOPQRSTUVWXYZ 2340 * Key26 in hexadecimal: 2342 41:42:43:44:45:46:47:48:49:4a:4b:4c:4d:4e:4f:50 2343 51:52:53:54:55:56:57:58:59:5a 2345 * Key70 in ASCII: 2347 This=key=is=exactly=70=octets=long.=ABCDEFGHIJKLMNOPQRSTUVWXYZ01234567 2349 * Key70 in hexadecimal: 2351 54:68:69:73:3d:6b:65:79:3d:69:73:3d:65:78:61:63 2352 74:6c:79:3d:37:30:3d:6f:63:74:65:74:73:3d:6c:6f 2353 6e:67:2e:3d:41:42:43:44:45:46:47:48:49:4a:4b:4c 2354 4d:4e:4f:50:51:52:53:54:55:56:57:58:59:5a:30:31 2355 32:33:34:35:36:37 2357 The length of each key was picked to relate (in the terms of 2358 Section 2.4) with the properties of respective hash algorithm as 2359 follows: 2361 * the digest length (L) of both RIPEMD-160 and SHA-1 is 20 2362 octets, 2364 * the internal block size (B) of both RIPEMD-160 and SHA-1 is 64 2365 octets, 2367 * the length of Key26 (26) is greater than L but less than B, 2368 and 2370 * the length of Key70 (70) is greater than B (and thus greater 2371 than L). 2373 KeyStartAccept, KeyStopAccept, KeyStartGenerate and 2374 KeyStopGenerate were set to make both authentication keys valid. 2376 2. The instance of the original protocol of the speaker produced a 2377 Babel packet (PktO) to be sent from the interface. Table 2 2378 provides a decoding of PktO, contents of which is below: 2380 2a:02:00:14:04:06:00:00:09:25:01:90:08:0a:00:40 2381 00:00:ff:ff:68:21:ff:ff 2383 3. The authentication mechanism appended one TS/PC TLV and two HMAC 2384 TLVs to the packet body, updated the "Body length" packet header 2385 field and padded the Digest field of the HMAC TLVs using the 2386 link-local IPv6 address of the interface and necessary amount of 2387 zeroes. Table 3 provides a decoding of the resulting temporary 2388 packet (PktT), contents of which is below: 2390 2a:02:00:4c:04:06:00:00:09:25:01:90:08:0a:00:40 2391 00:00:ff:ff:68:21:ff:ff:0b:06:00:01:52:1d:7e:8b 2392 0c:16:00:c8:fe:80:00:00:00:00:00:00:0a:11:96:ff 2393 fe:1c:10:c8:00:00:00:00:0c:16:00:64:fe:80:00:00 2394 00:00:00:00:0a:11:96:ff:fe:1c:10:c8:00:00:00:00 2396 4. The authentication mechanism produced two HMAC results, 2397 performing the computations as follows: 2399 * For H=RIPEMD-160, K=Key26, and Text=PktT the HMAC result is: 2401 c6:f1:06:13:30:3c:fa:f3:eb:5d:60:3a:ed:fd:06:55 2402 83:f7:ee:79 2404 * For H=SHA-1, K=Key70, and Text=PktT the HMAC result is: 2406 df:32:16:5e:d8:63:16:e5:a6:4d:c7:73:e0:b5:22:82 2407 ce:fe:e2:3c 2408 5. The authentication mechanism placed each HMAC result into 2409 respective HMAC TLV, producing the final authenticated Babel 2410 packet (PktA), which was eventually sent from the interface. 2411 Table 4 provides a decoding of PktA, contents of which is below: 2413 2a:02:00:4c:04:06:00:00:09:25:01:90:08:0a:00:40 2414 00:00:ff:ff:68:21:ff:ff:0b:06:00:01:52:1d:7e:8b 2415 0c:16:00:c8:c6:f1:06:13:30:3c:fa:f3:eb:5d:60:3a 2416 ed:fd:06:55:83:f7:ee:79:0c:16:00:64:df:32:16:5e 2417 d8:63:16:e5:a6:4d:c7:73:e0:b5:22:82:ce:fe:e2:3c 2419 Interpretation of this process is to be done in the view of Figure 1, 2420 differently for the sending and the receiving directions. 2422 For the sending direction, given a Babel speaker configured using the 2423 IPv6 address and the sequence of CSAs as described above, the 2424 implementation SHOULD (see notes in Section 5.3) produce exactly the 2425 temporary packet PktT if the original protocol instance produces 2426 exactly the packet PktO to be sent from the interface. If the 2427 temporary packet exactly matches PktT, the HMAC results computed 2428 afterwards MUST exactly match respective results above and the final 2429 authenticated packet MUST exactly match the PktA above. 2431 For the receiving direction, given a Babel speaker configured using 2432 the sequence of CSAs as described above (but a different IPv6 2433 address), the implementation MUST (assuming the TS/PC check didn't 2434 fail) produce exactly the temporary packet PktT above if its network 2435 stack receives through the interface exactly the packet PktA above 2436 from the source IPv6 address above. The first HMAC result computed 2437 afterwards MUST match the first result above. The receiving 2438 procedure doesn't compute the second HMAC result in this case, but if 2439 the implementor decides to compute it anyway for the verification 2440 purpose, it MUST exactly match the second result above. 2442 Author's Address 2444 Denis Ovsienko 2445 Yandex 2446 16, Leo Tolstoy St. 2447 Moscow, 119021 2448 Russia 2450 Email: infrastation@yandex.ru