idnits 2.17.1 draft-ietf-avtcore-srtp-aes-gcm-16.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 : ---------------------------------------------------------------------------- ** There are 6 instances of too long lines in the document, the longest one being 1 character in excess of 72. ** There are 2 instances of lines with control characters in the document. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Line 1856 has weird spacing: '...ved tag a8 66...' -- The document date (June 05, 2015) is 3240 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Missing Reference: 'FERG' is mentioned on line 875, but not defined == Unused Reference: 'Ferg' is defined on line 2290, but no explicit reference was found in the text Summary: 2 errors (**), 0 flaws (~~), 4 warnings (==), 1 comment (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 1 Network Working Group D. McGrew 2 Internet Draft Cisco Systems, Inc. 3 Intended Status: Standards Track K. Igoe 4 Expires: December 07, 2015 National Security Agency 5 June 05, 2015 7 AES-GCM Authenticated Encryption in Secure RTP (SRTP) 8 draft-ietf-avtcore-srtp-aes-gcm-16 10 Status of this Memo 12 This Internet-Draft is submitted to IETF in full conformance with the 13 provisions of BCP 78 and BCP 79. 15 Internet-Drafts are working documents of the Internet Engineering 16 Task Force (IETF). Note that other groups may also distribute 17 working documents as Internet-Drafts. The list of current Internet- 18 Drafts is at http://datatracker.ietf.org/drafts/current. 20 Internet-Drafts are draft documents valid for a maximum of six months 21 and may be updated, replaced, or obsoleted by other documents at any 22 time. It is inappropriate to use Internet-Drafts as reference 23 material or to cite them other than as "work in progress." 25 This Internet-Draft will expire on December 07, 2015. 27 Copyright Notice 29 Copyright (c) 2015 IETF Trust and the persons identified as the 30 document authors. All rights reserved. 32 This document is subject to BCP 78 and the IETF Trust's Legal 33 Provisions Relating to IETF Documents 34 (http://trustee.ietf.org/license-info) in effect on the date of 35 publication of this document. Please review these documents 36 carefully, as they describe your rights and restrictions with respect 37 to this document. Code Components extracted from this document must 38 include Simplified BSD License text as described in Section 4.e of 39 the Trust Legal Provisions and are provided without warranty as 40 described in the Simplified BSD License. 42 Abstract 44 This document defines how the AES-GCM Authenticated Encryption with 45 Associated Data family of algorithms can be used to provide 46 confidentiality and data authentication in the SRTP protocol. 48 Table of Contents 50 1. Introduction.....................................................4 51 2. Conventions Used In This Document................................5 52 3. Overview of the SRTP/SRTCP AEAD security Architecture............5 53 4. Terminology......................................................6 54 5. Generic AEAD Processing..........................................6 55 5.1. Types of Input Data.........................................6 56 5.2. AEAD Invocation Inputs and Outputs..........................6 57 5.2.1. Encrypt Mode...........................................6 58 5.2.2. Decrypt Mode...........................................7 59 5.3. Handling of AEAD Authentication.............................7 60 6. Counter Mode Encryption..........................................7 61 7. Unneeded SRTP/SRTCP Fields.......................................8 62 7.1. SRTP/SRTCP Authentication Field.............................8 63 7.2. RTP Padding.................................................9 64 8. AES-GCM processing for SRTP......................................9 65 8.1. SRTP IV formation for AES-GCM...............................9 66 8.2. Data Types in SRTP Packets..................................9 67 8.3. Handling Header Extensions.................................11 68 8.4. Prevention of SRTP IV Reuse................................12 69 9. AES-GCM Processing of SRTCP Compound Packets....................13 70 9.1. SRTCP IV formation for AES-GCM.............................13 71 9.2. Data Types in Encrypted SRTCP Compound Packets.............14 72 9.3. Data Types in Unencrypted SRTCP Compound Packets...........15 73 9.4. Prevention of SRTCP IV Reuse...............................16 74 10. Constraints on AEAD for SRTP and SRTCP.........................16 75 11. Key Derivation Functions.......................................17 76 12. Summary of AES-GCM in SRTP/SRTCP...............................17 77 13. Security Considerations........................................18 78 13.1. Handling of Security Critical Parameters..................19 79 13.2. Size of the Authentication Tag............................19 80 14. IANA Considerations............................................21 81 14.1. SDES......................................................21 82 14.2. DTLS-SRTP.................................................21 83 14.3. MIKEY.....................................................22 84 15. Parameters for use with MIKEY..................................23 85 16. Some RTP Test Vectors..........................................23 86 16.1. AEAD_AES_128_GCM_8........................................24 87 16.1.1. AEAD_AES_128_GCM_8 Encryption........................24 88 16.1.2. AEAD_AES_128_GCM_8 Decryption........................26 89 16.1.3. AEAD_AES_128_GCM_8 Authentication Tagging............27 90 16.1.4. AEAD_AES_128_GCM_8 Tag Verification..................28 91 16.2. AEAD_AES_128_GCM..........................................29 92 16.2.1. AEAD_AES_128_GCM Encryption..........................29 93 16.2.2. AEAD_AES_128_GCM Decryption..........................31 94 16.2.3. AEAD_AES_128_GCM Authentication Tagging..............32 95 16.2.4. AEAD_AES_128_GCM Tag Verification....................33 96 16.3. AEAD_AES_256_GCM..........................................34 97 16.3.1. AEAD_AES_256_GCM Encryption..........................34 98 16.3.2. AEAD_AES_256_GCM Decryption..........................36 99 16.3.3. AEAD_AES_256_GCM Authentication Tagging..............37 100 16.3.4. AEAD_AES_256_GCM Tag Verification....................38 101 17. RTCP Test Vectors..............................................39 102 17.1. AEAD_AES_128_GCM_8 Encrypt and Tag........................40 103 17.2. AEAD_AES_256_GCM Verify and Decryption....................42 104 17.3. AEAD_AES_128_GCM Tag Only.................................44 105 17.4. AEAD_AES_256_GCM Tag Verification.........................45 106 18. Acknowledgements...............................................46 107 19. References.....................................................47 108 19.1. Normative References......................................47 109 19.2. Informative References....................................47 111 1. Introduction 113 The Secure Real-time Transport Protocol (SRTP) [RFC3711] is a profile 114 of the Real-time Transport Protocol (RTP) [RFC3550], which can 115 provide confidentiality, message authentication, and replay 116 protection to the RTP traffic and to the control traffic for RTP, the 117 Real-time Transport Control Protocol (RTCP). It is important to note 118 that the outgoing SRTP packets from a single endpoint may be 119 originating from several independent data sources. 121 Authenticated encryption [BN00] is a form of encryption that, in 122 addition to providing confidentiality for the plaintext that is 123 encrypted, provides a way to check its integrity and authenticity. 124 Authenticated Encryption with Associated Data, or AEAD [R02], adds 125 the ability to check the integrity and authenticity of some 126 Associated Data (AD), also called "additional authenticated data", 127 that is not encrypted. This specification makes use of the interface 128 to a generic AEAD algorithm as defined in [RFC5116]. 130 The Advanced Encryption Standard (AES) is a block cipher that 131 provides a high level of security, and can accept different key 132 sizes. AES Galois/Counter Mode (AES-GCM) [GCM] is a family of AEAD 133 algorithms based upon AES. This specification makes use of the AES 134 versions that use 128-bit and 256-bit keys, which we call AES-128 and 135 AES-256, respectively. 137 Any AEAD algorithm provides an intrinsic authentication tag. In many 138 applications the authentication tag is truncated to less than full 139 length. In this specification the authentication tag MUST be either 140 8 octets or 16 octets in length, and the 8 byte authentication tag 141 can only be used with AES-128. Thus when used in SRTP, GCM will have 142 three configurations: 144 AEAD_AES_128_GCM_8 AES-128 with an 8 byte authentication tag 145 AEAD_AES_128_GCM AES-128 with a 16 byte authentication tag 146 AEAD_AES_256_GCM AES-256 with a 16 byte authentication tag 148 The key size and the length of the authentication tag are set when 149 the session is initiated and SHOULD NOT be altered. 151 The Galois/Counter Mode of operation (GCM) is an AEAD mode of 152 operation for block ciphers. GCM use counter mode to encrypt the 153 data, an operation that can be efficiently pipelined. Further, GCM 154 authentication uses operations that are particularly well suited to 155 efficient implementation in hardware, making it especially appealing 156 for high-speed implementations, or for implementations in an 157 efficient and compact circuit. 159 In summary, this document defines how to use an AEAD algorithm, 160 particularly AES-GCM, to provide confidentiality and message 161 authentication within SRTP and SRTCP packets. 163 2. Conventions Used In This Document 165 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 166 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 167 "OPTIONAL" in this document are to be interpreted as described in 168 [RFC2119]. 170 3. Overview of the SRTP/SRTCP AEAD security Architecture 172 SRTP/SRTCP AEAD security is based upon the following principles: 174 a) Both privacy and authentication are based upon the use of 175 symmetric algorithms. An AEAD algorithm such as AES-GCM 176 combines privacy and authentication into a single process. 178 b) A secret master key is shared by all participating endpoints, 179 both those originating SRTP/SRTCP packets and those receiving 180 these packets. Any given master key MAY be used 181 simultaneously by several endpoints to originate SRTP/SRTCP 182 packets (as well one or more endpoints using this master key 183 to process inbound data). 185 c) A Key Derivation Function is applied to the shared master key 186 value to form separate encryption keys, authentication keys 187 and salting keys for SRTP and for SRTCP (a total of six 188 keys). This process is described in section 4.3 of 189 [RFC3711]. The master key MUST be at least as large as the 190 encryption key derived from it. Since AEAD algorithms such 191 as AES-GCM combine encryption and authentication into a 192 single process, AEAD algorithms do not make use of separate 193 authentication keys. 195 d) Aside from making modifications to IANA registries to allow 196 AES-GCM to work with SDES, DTLS-SRTP and MIKEY, the details 197 of how the master key is established and shared between the 198 participants are outside the scope of this document. 199 Similarly any mechanism for rekeying an existing session is 200 outside the scope of the document. 202 e) Each time an instantiation of AES-GCM is invoked to encrypt 203 and authenticate an SRTP or SRTCP data packet a new IV is 204 used. SRTP combines the 4-octet synchronization source 205 (SSRC) identifier, the 4-octet rollover counter (ROC), and 206 the 2-octet sequence number (SEQ) with the 12-octet 207 encryption salt to form a 12-octet IV (see section 8.1). 208 SRTCP combines the SSRC and 31-bit SRTCP index with the 209 encryption salt to form a 12-octet IV (see section 9.1). 211 4. Terminology 213 The following terms have very specific meanings in the context of 214 this RFC: 216 Instantiation: In AEAD, an instantiation is an (Encryption_key, 217 salt) pair together with all of the data 218 structures (for example, counters) needed for it 219 to function properly. In SRTP/SRTCP, each 220 endpoint will need two instantiations of the AEAD 221 algorithm for each master key in its possession, 222 one instantiation for SRTP traffic and one 223 instantiation for SRTCP traffic. 225 Invocation: SRTP/SRTCP data streams are broken into packets. 226 Each packet is processed by a single invocation 227 of the appropriate instantiation of the AEAD 228 algorithm. 230 In many applications, each endpoint will have one master key for 231 processing outbound data but may have one or more separate master 232 keys for processing inbound data. 234 5. Generic AEAD Processing 236 5.1. Types of Input Data 238 Associated Data: This is data that is to be authenticated 239 but not encrypted. 241 Plaintext: Data that is to be both encrypted and 242 authenticated. 244 Raw Data: Data that is to be neither encrypted nor 245 authenticated. 247 Which portions of SRTP/SRTCP packets that are to be treated as 248 associated data, which are to be treated as plaintext, and which are 249 to be treated as raw data are covered in sections 8.2, 9.2 and 9.3. 251 5.2. AEAD Invocation Inputs and Outputs 253 5.2.1. Encrypt Mode 255 Inputs: 256 Encryption_key Octet string, either 16 or 32 257 octets long 259 Initialization_Vector Octet string, 12 octets long 260 Associated_Data Octet string of variable length 261 Plaintext Octet string of variable length 263 Outputs 264 Ciphertext* Octet string, length = 265 length(Plaintext)+tag_length 267 (*): In AEAD the authentication tag in embedded in the cipher text. 268 When GCM is being used the ciphertext consists of the encrypted plain 269 text followed by the authentication tag. 271 5.2.2. Decrypt Mode 273 Inputs: 274 Encryption_key Octet string, either 16 or 32 275 octets long 276 Initialization_Vector Octet string, 12 octets long 277 Associated_Data Octet string of variable length 278 Ciphertext Octet string of variable length 280 Outputs 281 Plaintext Octet string, length = 282 length(Ciphertext)-tag_length 283 Validity_Flag Boolean, TRUE if valid, 284 FALSE otherwise 286 5.3. Handling of AEAD Authentication 288 AEAD requires that all incoming packets MUST pass AEAD authentication 289 before any other action takes place. Plaintext and associated data 290 MUST NOT be released until the AEAD authentication tag has been 291 validated. Further the ciphertext MUST NOT be decrypted until the 292 AEAD tag has been validated. 294 Should the AEAD tag prove to be invalid, the packet in question is to 295 be discarded and a Validation Error flag raised. Local policy 296 determines how this flag is to be handled and is outside the scope of 297 this document. 299 6. Counter Mode Encryption 301 Each outbound packet uses a 12-octet IV and an encryption key to form 302 two outputs, a 16-octet first_key_block which is used in forming the 303 authentication tag and a key stream of octets, formed in blocks of 304 16-octets each. The first 16-octet block of key is saved for use in 305 forming the authentication tag, and the remainder of the key stream 306 is XORed to the plaintext to form cipher. This key stream is formed 307 one block at a time by inputting the concatenation of a 12-octet IV 308 (see sections 8.1 and 9.1) with a 4-octet block to AES. The 309 pseudo-code below illustrates this process: 311 def GCM_keystream( Plaintext_len, IV, Encryption_key ): 312 assert Plaintext_len <= (2**36) - 32 ## measured in octets 313 key_stream = "" 314 block_counter = 1 315 first_key_block = AES_ENC( data=IV||block_counter, 316 key=Encryption_key ) 317 while len(key_stream) < Plaintext_len: 318 block_counter = block_counter + 1 319 key_block = AES_ENC( data=IV||block_counter, 320 key=Encryption_key ) 321 key_stream = key_stream || key_block 322 key_stream = truncate( key_stream, Plaintext_len ) 323 return (first_key_block, key_stream ) 325 In theory this keystream generation process allows for the encryption 326 of up to (2^36)-32 octets per invocation (i.e. per packet), far 327 longer than is actually required. 329 With any counter mode, if the same (IV, Encryption_key) pair is used 330 twice, precisely the same keystream is formed. As explained in 331 section 9.1 of RFC 3711, this is a cryptographic disaster. For GCM 332 the consequences are even worse since such a reuse compromises GCM's 333 integrity mechanism not only for the current packet stream but for 334 all future uses of the current encryption_key. 336 7. Unneeded SRTP/SRTCP Fields 338 AEAD counter mode encryption removes the need for certain existing 339 SRTP/SRTCP mechanisms. 341 7.1. SRTP/SRTCP Authentication Field 343 The AEAD message authentication mechanism MUST be the primary message 344 authentication mechanism for AEAD SRTP/SRTCP. Additional SRTP/SRTCP 345 authentication mechanisms SHOULD NOT be used with any AEAD algorithm 346 and the optional SRTP/SRTCP Authentication Tags are NOT RECOMMENDED 347 and SHOULD NOT be present. Note that this contradicts section 3.4 of 348 [RFC3711] which makes the use of the SRTCP Authentication field 349 mandatory, but the presence of the AEAD authentication renders the 350 older authentication methods redundant. 352 Rationale. Some applications use the SRTP/SRTCP Authentication 353 Tag as a means of conveying additional information, notably 354 [RFC4771]. This document retains the Authentication Tag field 355 primarily to preserve compatibility with these applications. 357 7.2. RTP Padding 359 AES-GCM does not requires that the data be padded out to a specific 360 block size, reducing the need to use the padding mechanism provided 361 by RTP. It is RECOMMENDED that the RTP padding mechanism not be used 362 unless it is necessary to disguise the length of the underlying 363 plaintext. 365 8. AES-GCM processing for SRTP 367 8.1. SRTP IV formation for AES-GCM 369 0 0 0 0 0 0 0 0 0 0 1 1 370 0 1 2 3 4 5 6 7 8 9 0 1 371 +--+--+--+--+--+--+--+--+--+--+--+--+ 372 |00|00| SSRC | ROC | SEQ |---+ 373 +--+--+--+--+--+--+--+--+--+--+--+--+ | 374 | 375 +--+--+--+--+--+--+--+--+--+--+--+--+ | 376 | Encryption Salt |->(+) 377 +--+--+--+--+--+--+--+--+--+--+--+--+ | 378 | 379 +--+--+--+--+--+--+--+--+--+--+--+--+ | 380 | Initialization Vector |<--+ 381 +--+--+--+--+--+--+--+--+--+--+--+--+ 383 Figure 1: AES-GCM SRTP Initialization 384 Vector formation. 385 The 12 octet initialization vector used by AES-GCM SRTP is formed by 386 first concatenating 2 octets of zeroes, the 4-octet SSRC, the 4-octet 387 Rollover Counter (ROC) and the 2-octet sequence number SEQ. The 388 resulting 12-octet value is then XORed to the 12-octet salt to form 389 the 12-octet IV. 391 8.2. Data Types in SRTP Packets 393 All SRTP packets MUST be both authenticated and encrypted. The data 394 fields within the RTP packets are broken into Associated Data, 395 Plaintext and Raw Data as follows (see Figure 2): 397 Associated Data: The version V (2 bits), padding flag P (1 bit), 398 extension flag X (1 bit), CSRC count CC (4 bits), 399 marker M (1 bit), the Payload Type PT (7 bits), 400 the sequence number (16 bits), timestamp (32 401 bits), SSRC (32 bits), optional contributing 402 source identifiers (CSRCs, 32 bits each), and 403 optional RTP extension (variable length). 405 Plaintext: The RTP payload (variable length), RTP padding 406 (if used, variable length), and RTP pad count ( 407 if used, 1 octet). 409 Raw Data: The optional variable length SRTP MKI and SRTP 410 authentication tag (whose use is NOT 411 RECOMMENDED). These fields are appended after 412 encryption has been performed. 414 0 1 2 3 415 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 416 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 417 A |V=2|P|X| CC |M| PT | sequence number | 418 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 419 A | timestamp | 420 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 421 A | synchronization source (SSRC) identifier | 422 +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ 423 A | contributing source (CSRC) identifiers (optional) | 424 A | .... | 425 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 426 A | RTP extension (OPTIONAL) | 427 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 428 P | payload ... | 429 P | +-------------------------------+ 430 P | | RTP padding | RTP pad count | 431 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 433 P = Plaintext (to be encrypted and authenticated) 434 A = Associated Data (to be authenticated only) 436 Figure 2: Structure of an RTP packet before Authenticated 437 Encryption 439 Since the AEAD ciphertext is larger than the plaintext by exactly the 440 length of the AEAD authentication tag, the corresponding SRTP 441 encrypted packet replaces the plaintext field by a slightly larger 442 field containing the cipher. Even if the plaintext field is empty, 443 AEAD encryption must still be performed, with the resulting cipher 444 consisting solely of the authentication tag. This tag is to be 445 placed immediately before the optional variable length SRTP MKI and 446 SRTP authentication tag fields. 448 0 1 2 3 449 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 450 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 451 A |V=2|P|X| CC |M| PT | sequence number | 452 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 453 A | timestamp | 454 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 455 A | synchronization source (SSRC) identifier | 456 +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ 457 A | contributing source (CSRC) identifiers (optional) | 458 A | .... | 459 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 460 A | RTP extension (OPTIONAL) | 461 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 462 C | cipher | 463 C | ... | 464 C | | 465 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 466 R : SRTP MKI (OPTIONAL) : 467 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 468 R : SRTP authentication tag (NOT RECOMMENDED) : 469 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 471 C = Ciphertext (encrypted and authenticated) 472 A = Associated Data (authenticated only) 473 R = neither encrypted nor authenticated, added 474 after authenticated encryption completed 476 Figure 3: Structure of an SRTP packet after Authenticated 477 Encryption 479 8.3. Handling Header Extensions 481 RTP header extensions were first defined in RFC 3550. RFC 6904 482 [RFC6904] describes how these header extensions are to be encrypted 483 in SRTP. 485 When RFC 6904 is in use, a separate keystream is generated to encrypt 486 selected RTP header extension elements. For the AEAD_AES_128_GCM and 487 AEAD_AES_128_GCM_8 algorithms, this keystream MUST be generated in 488 the manner defined in [RFC6904] using the AES-CM transform. For the 489 AEAD_AES_256_GCM algorithm, the keystream MUST be generated in the 490 manner defined for the AES_256_CM transform. The originator must 491 perform any required header extension encryption before the AEAD 492 algorithm is invoked. 494 As with the other fields contained within the RTP header, both 495 encrypted and unencrypted header extensions are to be treated by the 496 AEAD algorithm as Associated Data (AD). Thus the AEAD algorithm does 497 not provide any additional privacy for the header extensions, but 498 does provide integrity and authentication. 500 8.4. Prevention of SRTP IV Reuse 502 In order to prevent IV reuse, we must ensure that the (ROC,SEQ,SSRC) 503 triple is never used twice with the same master key. There are two 504 phases to this issue. 506 Counter Management: A rekey MUST be performed to establish a new 507 master key before the (ROC,SEQ) pair cycles 508 back to its original value. Note that 509 implicitly assumes that either the outgoing RTP 510 process is trusted to not attempt to repeat a 511 (ROC,SEQ) value, or that the encryption process 512 ensures that the both the SEQ and ROC numbers 513 of the packets presented to it are always 514 incremented in the proper fashion. This is 515 particularly important for GCM since using the 516 same (ROC,SEQ) value twice compromises the 517 authentication mechanism. For GCM, the 518 (ROC,SEQ) and SSRC values used MUST either be 519 generated or checked by the SRTP 520 implementation, or by a module (e.g. the RTP 521 application) that can be considered equally 522 trusted as the SRTP implementation. While 523 [RFC3711] allows detecting SSRC collisions 524 after they happen, SRTP using GCM with shared 525 master keys MUST prevent SSRC collision from 526 happening even once. 528 SSRC Management: For a given master key, the set of all SSRC 529 values used with that master key must be 530 partitioned into disjoint pools, one pool for 531 each endpoint using that master key to 532 originate outbound data. Each such originating 533 endpoint MUST only issue SSRC values from the 534 pool it has been assigned. Further, each 535 originating endpoint MUST maintain a history of 536 outbound SSRC identifiers that it has issued 537 within the lifetime of the current master key, 538 and when a new synchronization source requests 539 an SSRC identifier it MUST NOT be given an 540 identifier that has been previously issued. A 541 rekey MUST be performed before any of the 542 originating endpoints using that master key 543 exhausts its pool of SSRC values. Further, the 544 identity of the entity giving out SSRC values 545 MUST be verified, and the SSRC signaling MUST 546 be integrity protected. 548 9. AES-GCM Processing of SRTCP Compound Packets 550 All SRTCP compound packets MUST be authenticated, but unlike SRTP, 551 SRTCP packet encryption is optional. A sender can select which 552 packets to encrypt, and indicates this choice with a 1-bit encryption 553 flag (located just before the 31-bit SRTCP index) 555 9.1. SRTCP IV formation for AES-GCM 557 The 12-octet initialization vector used by AES-GCM SRTCP is formed by 558 first concatenating 2-octets of zeroes, the 4-octet Synchronization 559 Source identifier (SSRC), 2-octets of zeroes, a single zero bit, and 560 the 31-bit SRTCP Index. The resulting 12-octet value is then XORed 561 to the 12-octet salt to form the 12-octet IV. 563 0 1 2 3 4 5 6 7 8 9 9 11 564 +--+--+--+--+--+--+--+--+--+--+--+--+ 565 |00|00| SSRC |00|00|0+SRTCP Idx|---+ 566 +--+--+--+--+--+--+--+--+--+--+--+--+ | 567 | 568 +--+--+--+--+--+--+--+--+--+--+--+--+ | 569 | Encryption Salt |->(+) 570 +--+--+--+--+--+--+--+--+--+--+--+--+ | 571 | 572 +--+--+--+--+--+--+--+--+--+--+--+--+ | 573 | Initialization Vector |<--+ 574 +--+--+--+--+--+--+--+--+--+--+--+--+ 576 Figure 4: SRTCP Initialization Vector formation 578 9.2. Data Types in Encrypted SRTCP Compound Packets 580 0 1 2 3 581 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 582 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 583 A |V=2|P| RC | Packet Type | length | 584 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 585 A | synchronization source (SSRC) of Sender | 586 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 587 P | sender info : 588 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 589 P | report block 1 : 590 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 591 P | report block 2 : 592 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 593 P | ... : 594 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 595 P |V=2|P| SC | Packet Type | length | 596 +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ 597 P | SSRC/CSRC_1 | 598 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 599 P | SDES items : 600 +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ 601 P | ... : 602 +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ 603 A |1| SRTCP index | 604 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 605 R | SRTCP MKI (optional) index : 606 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 607 R : SRTCP authentication tag (NOT RECOMMENDED) : 608 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 610 P = Plaintext (to be encrypted and authenticated) 611 A = Associated Data (to be authenticated only) 612 R = neither encrypted nor authenticated, added after 613 encryption 615 Figure 5: AEAD SRTCP inputs when encryption flag = 1. 617 When the encryption flag is set to 1, the SRTCP packet is broken into 618 plaintext, associated data, and raw (untouched) data (as shown above 619 in figure 5): 621 Associated Data: The packet version V (2 bits), padding flag P (1 622 bit), reception report count RC (5 bits), packet 623 type (8 bits), length (2 octets), SSRC (4 624 octets), encryption flag (1 bit) and SRTCP index 625 (31 bits). 627 Raw Data: The optional variable length SRTCP MKI and SRTCP 628 authentication tag (whose use is NOT 629 RECOMMENDED). 631 Plaintext: All other data. 633 Note that the plaintext comes in one contiguous field. Since the 634 AEAD cipher is larger than the plaintext by exactly the length of the 635 AEAD authentication tag, the corresponding SRTCP encrypted packet 636 replaces the plaintext field with a slightly larger field containing 637 the cipher. Even if the plaintext field is empty, AEAD encryption 638 must still be performed, with the resulting cipher consisting solely 639 of the authentication tag. This tag is to be placed immediately 640 before the encryption flag and SRTCP index. 642 9.3. Data Types in Unencrypted SRTCP Compound Packets 644 0 1 2 3 645 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 646 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 647 A |V=2|P| RC | Packet Type | length | 648 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 649 A | synchronization source (SSRC) of Sender | 650 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 651 A | sender info : 652 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 653 A | report block 1 : 654 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 655 A | report block 2 : 656 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 657 A | ... : 658 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 659 A |V=2|P| SC | Packet Type | length | 660 +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ 661 A | SSRC/CSRC_1 | 662 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 663 A | SDES items : 664 +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ 665 A | ... : 666 +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ 667 A |0| SRTCP index | 668 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 669 R | SRTCP MKI (optional) index : 670 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 671 R : authentication tag (NOT RECOMMENDED) : 672 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 674 A = Associated Data (to be authenticated only) 675 R = neither encrypted nor authenticated, added after 676 encryption 678 Figure 6: AEAD SRTCP inputs when encryption flag = 0 680 When the encryption flag is set to 0, the SRTCP compound packet is 681 broken into plaintext, associated data, and raw (untouched) data as 682 follows (see figure 6): 684 Plaintext: None. 686 Raw Data: The variable length optional SRTCP MKI and SRTCP 687 authentication tag (whose use is NOT 688 RECOMMENDED). 690 Associated Data: All other data. 692 Even though there is no ciphertext in this RTCP packet, AEAD 693 encryption returns a cipher field which is precisely the length of 694 the AEAD authentication tag. This cipher is to be placed before the 695 Encryption flag and the SRTCP index in the authenticated SRTCP 696 packet. 698 9.4. Prevention of SRTCP IV Reuse 700 A new master key MUST be established before the 31-bit SRTCP index 701 cycles back to its original value. Ideally, a rekey should be 702 performed and a new master key put in place well before the SRTCP 703 cycles back to the starting value. 705 The comments on SSRC management in section 8.4 also apply. 707 10. Constraints on AEAD for SRTP and SRTCP 709 In general, any AEAD algorithm can accept inputs with varying 710 lengths, but each algorithm can accept only a limited range of 711 lengths for a specific parameter. In this section, we describe the 712 constraints on the parameter lengths that any AEAD algorithm must 713 support to be used in AEAD-SRTP. Additionally, we specify a complete 714 parameter set for one specific family of AEAD algorithms, namely 715 AES-GCM. 717 All AEAD algorithms used with SRTP/SRTCP MUST satisfy the five 718 constraints listed below: 720 PARAMETER Meaning Value 722 A_MAX maximum associated MUST be at least 12 octets. 723 data length 724 N_MIN minimum nonce (IV) MUST be 12 octets. 725 length 726 N_MAX maximum nonce (IV) MUST be 12 octets. 727 length 728 P_MAX maximum plaintext GCM: MUST be <= 2^36-32 octets. 729 length per invocation 731 C_MAX maximum ciphertext GCM: MUST be <= 2^36-16 octets. 732 length per invocation 734 For sake of clarity we specify two additional parameters: 736 AEAD Authentication Tag Length MUST be 8 or 16 octets, 737 Maximum number of invocations SRTP: MUST be at most 2^48, 738 for a given instantiation SRTCP: MUST be at most 2^31. 739 Block Counter size GCM: MUST be 32 bits. 741 The reader is reminded that the ciphertext is longer than the 742 plaintext by exactly the length of the AEAD authentication tag. 744 11. Key Derivation Functions 746 A Key Derivation Function (KDF) is used to derive all of the required 747 encryption and authentication keys from a secret value shared by the 748 endpoints. Both AEAD_AES_128_GCM and AEAD_AES_128_GCM_8 algorithms 749 MUST use the (128-bit) AES_CM_PRF Key Derivation Function described 750 in [RFC3711]. AEAD_AES_256_GCM MUST use the AES_256_CM_PRF Key 751 Derivation Function described in [RFC6188]. 753 12. Summary of AES-GCM in SRTP/SRTCP 755 For convenience, much of the information about the use of AES-GCM 756 family of algorithms in SRTP is collected in the tables contained in 757 this section. 759 The AES-GCM family of AEAD algorithms is built around the AES block 760 cipher algorithm. AES-GCM uses AES counter mode for encryption and 761 Galois Message Authentication Code (GMAC) for authentication. A 762 detailed description of the AES-GCM family can be found in 763 [RFC5116]. The following members of the AES-GCM family may be used 764 with SRTP/SRTCP: 766 Name Key Size AEAD Tag Size Reference 767 ================================================================ 768 AEAD_AES_128_GCM_8 16 octets 8 octets [RFC5282] 769 AEAD_AES_128_GCM 16 octets 16 octets [RFC5116] 770 AEAD_AES_256_GCM 32 octets 16 octets [RFC5116] 772 Table 1: AES-GCM algorithms for SRTP/SRTCP 774 Any implementation of AES-GCM SRTP MUST support both AEAD_AES_128_GCM 775 and AEAD_AES_256_GCM (the versions with 16 octet AEAD authentication 776 tags), and it MAY support AEAD_AES_128_GCM_8. Below we summarize 777 parameters associated with these three GCM algorithms: 779 +--------------------------------+------------------------------+ 780 | Parameter | Value | 781 +--------------------------------+------------------------------+ 782 | Master key length | 128 bits | 783 | Master salt length | 96 bits | 784 | Key Derivation Function | AES_CM_PRF [RFC3711] | 785 | Maximum key lifetime (SRTP) | 2^48 packets | 786 | Maximum key lifetime (SRTCP) | 2^31 packets | 787 | Cipher (for SRTP and SRTCP) | AEAD_AES_128_GCM_8 | 788 | AEAD authentication tag length | 64 bits | 789 +--------------------------------+------------------------------+ 791 Table 2: The AEAD_AES_128_GCM_8 Crypto Suite 793 +--------------------------------+------------------------------+ 794 | Parameter | Value | 795 +--------------------------------+------------------------------+ 796 | Master key length | 128 bits | 797 | Master salt length | 96 bits | 798 | Key Derivation Function | AES_CM_PRF [RFC3711] | 799 | Maximum key lifetime (SRTP) | 2^48 packets | 800 | Maximum key lifetime (SRTCP) | 2^31 packets | 801 | Cipher (for SRTP and SRTCP) | AEAD_AES_128_GCM | 802 | AEAD authentication tag length | 128 bits | 803 +--------------------------------+------------------------------+ 805 Table 3: The AEAD_AES_128_GCM Crypto Suite 807 +--------------------------------+------------------------------+ 808 | Parameter | Value | 809 +--------------------------------+------------------------------+ 810 | Master key length | 256 bits | 811 | Master salt length | 96 bits | 812 | Key Derivation Function | AES_256_CM_PRF [RFC6188] | 813 | Maximum key lifetime (SRTP) | 2^48 packets | 814 | Maximum key lifetime (SRTCP) | 2^31 packets | 815 | Cipher (for SRTP and SRTCP) | AEAD_AES_256_GCM | 816 | AEAD authentication tag length | 128 bits | 817 +--------------------------------+------------------------------+ 818 Table 4: The AEAD_AES_256_GCM Crypto Suite 820 13. Security Considerations 821 13.1. Handling of Security Critical Parameters 823 As with any security process, the implementer must take care to 824 ensure cryptographically sensitive parameters are properly handled. 825 Many of these recommendations hold for all SRTP cryptographic 826 algorithms, but we include them here to emphasize their importance. 828 - If the master salt is to be kept secret, it MUST be properly 829 erased when no longer needed. 830 - The secret master key and all keys derived from it MUST be kept 831 secret. All keys MUST be properly erased when no longer 832 needed. 833 - At the start of each packet, the block counter MUST be reset to 834 1. The block counter is incremented after each block key has 835 been produced, but it MUST NOT be allowed to exceed 2^32-1 for 836 GCM. Note that even though the block counter is reset at the 837 start of each packet, IV uniqueness is ensured by the inclusion 838 of SSRC/ROC/SEQ or SRTCP Index in the IV. (The reader is 839 reminded that the first block of key produced is reserved for 840 use in authenticating the packet and is not used to encrypt 841 plaintext.) 842 - Each time a rekey occurs, the initial values of both the 31-bit 843 SRTCP index and the 48-bit SRTP packet index (ROC||SEQ) MUST be 844 saved in order to prevent IV reuse. 845 - Processing MUST cease if either the 31-bit SRTCP index or the 846 48-bit packet index ROC||SEQ cycles back to its initial value. 847 Processing MUST NOT resume until a new SRTP/SRTCP session has 848 been established using a new SRTP master key. Ideally, a rekey 849 should be done well before any of these counters cycle. 851 13.2. Size of the Authentication Tag 853 We require that the AEAD authentication tag must be at least 8 854 octets, significantly reducing the probability of an adversary 855 successfully introducing fraudulent data. The goal of an 856 authentication tag is to reduce the probability of a successful 857 forgery occurring anywhere in the network we are attempting to 858 defend. There are three relevant factors to consider: 860 - How low should one make the probability that an adversary can 861 succeed in introducing a forgery into the network we are trying 862 to protect? 863 - How many packets can an adversary hijack in an attempt to 864 introduce a forgery? 865 - What is the size of the authentication tag that will be used? 867 Neither of the attacks considered below is viable with a 16-octet tag 868 because the amount of data required to run the attack is prohibitive 869 in the 16-octet case. In the following discussions we shall assume 870 that the tag size is 8 octets = 64 bits. 872 Niels Ferguson of Microsoft discovered an attack which allows the 873 recovery of the secret hash subkey H, whose compromise would allow an 874 adversary to modify packets in transit and have the recipient accept 875 these modified packets as being valid (see [FERG]. This attack 876 requires the careful modification of a large number of packets while 877 in transit, using the recipient as an oracle as to whether or not the 878 recipient has accepted a given packet as being valid. Note that 879 silently discarding invalid packets blocks this attack. 881 NIST recommends mitigating this attack by limiting the number of 882 packets sent to at most 2^37 before the keys must be changed. This 883 reduces the probability of the attacker having enough data to 884 successfully run the Ferguson attack to about 2^-26. 886 Note that because GCM encrypts plain text by XORing it to a 887 keystream, flipping a bit of cipher will flip the corresponding bit 888 of plain text. But any change to either the cipher or the additional 889 authenticated data will change the authentication tag in a way that 890 depends upon the secret hash subkey H. 892 The second type of attack is a brute force attack. There is nothing 893 clever about this attack; we merely keep bombarding the recipient 894 with modified packets until by chance we find one that has a valid 895 GMAC. A priori there is a probability p=2^-64 that a given modified 896 packet being accepted as valid. Ferguson has a technique to reduce 897 this to a mere p=2^-52, albeit at the cost of severely reducing the 898 types of modifications that can be made. 900 If we use p=2^-52, a mere N=2^26 forgeries are needed until the 901 probability of success approaches the 2^-26 value achieved by the 902 Ferguson attack. Using the more realistic value of p=2^-64 raises 903 this to N=2^38 forgery attempts. 905 Sadly frequently changing the key has no effect on the brute force 906 attack. However the damage done by this attack is far less than in 907 the Ferguson attack. The brute force attack only results in a single 908 forged packet being accepted while the Ferguson attack allows the 909 attacker to easily manufacture as many authentically tagged forged 910 messages as they want once H has been recovered. 912 The above discussions lead to the following requirements: 914 - This document follows the NIST SP 800-38D and requires that when 915 an 8-octet authentication tag is being used the key must be 916 changed before 2^37 packets have been sent. Since SRTCP already 917 imposes a limit of 2^31 packets, the 2^37 limit only affects 918 SRTP. 919 - In applications where the successful introduction even a of 920 single forged packet into the network being protected could have 921 serious consequences, 8-octet tags SHOULD NOT be used. 923 14. IANA Considerations 925 14.1. SDES 927 SDP Security Descriptions [RFC4568] defines SRTP "crypto suites". A 928 crypto suite corresponds to a particular AEAD algorithm in SRTP. In 929 order to allow Security Descriptions to signal the use of the 930 algorithms defined in this document, IANA will register the following 931 crypto suites into the "SRTP Crypto Suite Registrations" subregistry 932 of the "Session Description Protocol (SDP) Security Descriptions" 933 registry. 935 srtp-crypto-suite-ext = "AEAD_AES_128_GCM_8" / 936 "AEAD_AES_128_GCM" / 937 "AEAD_AES_256_GCM" / 938 srtp-crypto-suite-ext 940 14.2. DTLS-SRTP 942 DTLS-SRTP [RFC5764] defines a DTLS-SRTP "SRTP Protection Profile". 943 These also correspond to the use of an AEAD algorithm in SRTP. In 944 order to allow the use of the algorithms defined in this document in 945 DTLS-SRTP, we request IANA register the following SRTP Protection 946 Profiles: 948 SRTP_AEAD_AES_128_GCM = {TBD, TBD } 949 SRTP_AEAD_AES_128_GCM_8 = {TBD, TBD } 950 SRTP_AEAD_AES_256_GCM = {TBD, TBD } 952 Below we list the SRTP transform parameters for each of these 953 protection profile. Unless separate parameters for SRTCP and SRTCP 954 are explicitly listed, these parameters apply to both SRTP and 955 SRTCP. 957 SRTP_AEAD_AES_128_GCM 958 cipher: AES_128_GCM 959 cipher_key_length: 128 bits 960 cipher_salt_length: 96 bits 961 aead_auth_tag_length: 16 octets 962 auth_function: NULL 963 auth_key_length: N/A 964 auth_tag_length: N/A 965 maximum lifetime: at most 2^31 SRTCP packets and 966 at most 2^48 SRTP packets 967 SRTP_AEAD_AES_128_GCM_64 968 cipher: AES_128_GCM 969 cipher_key_length: 128 bits 970 cipher_salt_length: 96 bits 971 aead_auth_tag_length: 8 octets 972 auth_function: NULL 973 auth_key_length: N/A 974 auth_tag_length: N/A 975 maximum lifetime: at most 2^31 SRTCP packets and 976 at most 2^37 SRTP packets 978 SRTP_AEAD_AES_256_GCM 979 cipher: AES_256_GCM 980 cipher_key_length: 256 bits 981 cipher_salt_length: 96 bits 982 aead_auth_tag_length: 16 octets 983 auth_function: NULL 984 auth_key_length: N/A 985 auth_tag_length: N/A 986 maximum lifetime: at most 2^31 SRTCP packets and 987 at most 2^48 SRTP packets 989 Note that these SRTP Protection Profiles do not specify an 990 auth_function, auth_key_length, or auth_tag_length because all of 991 these profiles use AEAD algorithms, and thus do not use a separate 992 auth_function, auth_key, or auth_tag. The term aead_auth_tag_length 993 is used to emphasize that this refers to the authentication tag 994 provided by the AEAD algorithm and that this tag is not located in 995 the authentication tag field provided by SRTP/SRTCP. 997 14.3. MIKEY 999 In accordance with "MIKEY: Multimedia Internet KEYing" [RFC3830], 1000 IANA maintains several subregitries under "Multimedia Internet KEYing 1001 (MIKEY) Payload Name Spaces". This document requires additions to 1002 two of the MIKEY subregistries. 1004 In the "MIKEY Security Protocol Parameters" subregistry we request 1005 the following addition: 1007 Type | Meaning | Possible values 1008 ---------------------------------------------------------------- 1009 TBD | AEAD authentication tag length | 8 octets or 16 octets 1011 This list is, of course, intended for use with GCM. It is 1012 conceivable that new AEAD algorithms introduced at some point in the 1013 future may require a different set of Authentication tag lengths. 1015 In the "Encryption Algorithm" subregistry (derived from Table 1016 6.10.1.b of [RFC3830]) we request the following addition: 1018 SRTP encr | Value | Default Session | Default Auth. 1019 Algorithm | | Encr. Key Length | Tag Length 1020 ----------------------------------------------------------- 1021 AES-GCM | TBD | 16 octets | 16 octets 1023 The encryption algorithm, session encryption key length, and AEAD 1024 authentication tag sizes received from MIKEY fully determine the AEAD 1025 algorithm to be used. The exact mapping is described in section 15. 1027 15. Parameters for use with MIKEY 1029 MIKEY specifies the algorithm family separately from the key length 1030 (which is specified by the Session Encryption key length) and the 1031 authentication tag length (specified by AEAD Auth tag length). 1033 +------------+-------------+-------------+ 1034 | Encryption | Encryption | AEAD Auth | 1035 | Algorithm | Key Length | Tag Length | 1036 +============+=============+=============+ 1037 AEAD_AES_128_GCM_8 | AES-GCM | 16 octets | 8 octets | 1038 +------------+-------------+-------------+ 1039 AEAD_AES_128_GCM | AES-GCM | 16 octets | 16 octets | 1040 +------------+-------------+-------------+ 1041 AEAD_AES_256_GCM | AES-GCM | 32 octets | 16 octets | 1042 +============+=============+=============+ 1044 Table 6: Mapping MIKEY parameters to AEAD algorithm 1046 Section 11 in this document restricts the choice of Key Derivation 1047 Function for AEAD algorithms. To enforce this restriction in MIKEY, 1048 we require that the SRTP PRF has value AES-CM whenever an AEAD 1049 algorithm is used. Note that, according to Section 6.10.1 in 1050 [RFC3830], the input key length of the Key Derivation Function (i.e. 1051 the SRTP master key length) is always equal to the session encryption 1052 key length. This means, for example, that AEAD_AES_256_GCM will use 1053 AES_256_CM_PRF as the Key Derivation Function. 1055 16. Some RTP Test Vectors 1057 The examples in this section are all based upon the same RTP packet 1059 8040f17b 8041f8d3 5501a0b2 47616c6c 1060 69612065 7374206f 6d6e6973 20646976 1061 69736120 696e2070 61727465 73207472 1062 6573 1064 consisting of a 12 octet header (8040f17b 8041f8d3 5501a0b2) and a 38 1065 octet payload (47616c6c 69612065 7374206f 6d6e6973 20646976 69736120 1066 696e2070 61727465 73207472 6573) which is just the ASCII string 1067 "Gallia est omnis divisa in partes tres". The salt used (51756964 1068 2070726f 2071756f) comes from the ASCII string "Quid pro quo". The 1069 16 octet (128 bit) key is 00 01 02 ... 0f and the 32 octet (256 bit) 1070 key is 00 01 02 ... 1f. The RTP payload type (1000000 binary = 64 1071 decimal) was at the time this document was written an unassigned 1072 value. 1074 As shown in section 8.1, the IV is formed XORing two 12-octet 1075 values. The first 12-octet value is formed by concatenating two zero 1076 octets, the 4-octet SSRC (found in the 9th thru 12th octets of the 1077 packet), the 4-octet rollover counter ROC maintained at each end of 1078 the link, and the 2-octet sequence number SEQ (found in the 3rd and 1079 4th octets of the packet). The second 12-octet value is the salt, a 1080 value that is held constant at least until the key is changed. 1082 | Pad | SSRC | ROC | SEQ | 1083 00 00 55 01 a0 b2 00 00 00 00 f1 7b 1084 salt 51 75 69 64 20 70 72 6f 20 71 75 6f 1085 ------------------------------------ 1086 IV 51 75 3c 65 80 c2 72 6f 20 71 84 14 1088 All of the RTP examples use this IV. 1090 16.1. AEAD_AES_128_GCM_8 1092 16.1.1. AEAD_AES_128_GCM_8 Encryption 1094 Encrypting the following packet: 1096 8040f17b 8041f8d3 5501a0b2 47616c6c 1097 69612065 7374206f 6d6e6973 20646976 1098 69736120 696e2070 61727465 73207472 1099 6573 1101 Form the IV 1102 | Pad | SSRC | ROC | SEQ | 1103 00 00 55 01 a0 b2 00 00 00 00 f1 7b 1104 salt: 51 75 69 64 20 70 72 6f 20 71 75 6f 1105 IV: 51 75 3c 65 80 c2 72 6f 20 71 84 14 1107 Key: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 1108 AAD: 8040f17b 8041f8d3 5501a0b2 1109 PT: 47616c6c 69612065 7374206f 6d6e6973 1110 20646976 69736120 696e2070 61727465 1111 73207472 6573 1112 IV: 51 75 3c 65 80 c2 72 6f 20 71 84 14 1113 H: c6a13b37878f5b826f4f8162a1c8d879 1115 Encrypt plaintext 1116 block # 0 1117 IV||blk_cntr: 51753c6580c2726f2071841400000002 1118 key_block: b5 2c 8f cf 92 55 fe 09 df ce a6 73 f0 10 22 b9 1119 plain_block: 47 61 6c 6c 69 61 20 65 73 74 20 6f 6d 6e 69 73 1120 cipher_block: f2 4d e3 a3 fb 34 de 6c ac ba 86 1c 9d 7e 4b ca 1121 block # 1 1122 IV||blk_cntr: 51753c6580c2726f2071841400000003 1123 key_block: 9e 07 52 a3 64 5a 2f 4f 2b cb d4 0a 30 b5 a5 fe 1124 plain_block: 20 64 69 76 69 73 61 20 69 6e 20 70 61 72 74 65 1125 cipher_block: be 63 3b d5 0d 29 4e 6f 42 a5 f4 7a 51 c7 d1 9b 1126 block # 2 1127 IV||blk_cntr: 51753c6580c2726f2071841400000004 1128 key_block: 45 fe 4e ad ed 40 0a 5d 1a f3 63 f9 0c e1 49 3b 1129 plain_block: 73 20 74 72 65 73 1130 cipher_block: 36 de 3a df 88 33 1132 Cipher before tag appended 1133 f24de3a3 fb34de6c acba861c 9d7e4bca 1134 be633bd5 0d294e6f 42a5f47a 51c7d19b 1135 36de3adf 8833 1137 Compute GMAC tag 1139 Process AAD 1140 AAD word: 8040f17b8041f8d35501a0b200000000 1141 partial hash: bcfb3d1d0e6e3e78ba45403377dba11b 1143 Process Cipher 1144 Cipher word: f24de3a3fb34de6cacba861c9d7e4bca 1145 partial hash: 0ebc0abe1b15b32fedd2b07888c1ef61 1146 Cipher word: be633bd50d294e6f42a5f47a51c7d19b 1147 partial hash: 438e5797011ea860585709a2899f4685 1148 Cipher word: 36de3adf883300000000000000000000 1149 partial hash: 336fb643310d7bac2aeaa76247f6036d 1151 Proceess Length Word 1152 Length word: 00000000000000600000000000000130 1153 partial hash: 1b964067078c408c4e442a8f015e5264 1155 Turn GHASH into GMAC 1156 GHASH: 1b 96 40 67 07 8c 40 8c 4e 44 2a 8f 01 5e 52 64 1157 K0: 92 0b 3f 40 b9 3d 2a 1d 1c 8b 5c d1 e5 67 5e aa 1158 full GMAC: 89 9d 7f 27 be b1 6a 91 52 cf 76 5e e4 39 0c ce 1159 truncated GMAC: 89 9d 7f 27 be b1 6a 91 1161 Cipher with tag 1162 f24de3a3 fb34de6c acba861c 9d7e4bca 1163 be633bd5 0d294e6f 42a5f47a 51c7d19b 1164 36de3adf 8833899d 7f27beb1 6a91 1166 Encrypted and Tagged packet: 1168 8040f17b 8041f8d3 5501a0b2 f24de3a3 1169 fb34de6c acba861c 9d7e4bca be633bd5 1170 0d294e6f 42a5f47a 51c7d19b 36de3adf 1171 8833899d 7f27beb1 6a91 1173 16.1.2. AEAD_AES_128_GCM_8 Decryption 1175 Decrypting the following packet: 1177 8040f17b 8041f8d3 5501a0b2 f24de3a3 1178 fb34de6c acba861c 9d7e4bca be633bd5 1179 0d294e6f 42a5f47a 51c7d19b 36de3adf 1180 8833899d 7f27beb1 6a91 1182 Form the IV 1183 | Pad | SSRC | ROC | SEQ | 1184 00 00 55 01 a0 b2 00 00 00 00 f1 7b 1185 salt: 51 75 69 64 20 70 72 6f 20 71 75 6f 1186 IV: 51 75 3c 65 80 c2 72 6f 20 71 84 14 1188 Key: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 1189 AAD: 8040f17b 8041f8d3 5501a0b2 1190 CT: f24de3a3 fb34de6c acba861c 9d7e4bca 1191 be633bd5 0d294e6f 42a5f47a 51c7d19b 1192 36de3adf 8833899d 7f27beb1 6a91 1193 IV: 51 75 3c 65 80 c2 72 6f 20 71 84 14 1194 H: c6a13b37878f5b826f4f8162a1c8d879 1196 Verify received tag 89 9d 7f 27 be b1 6a 91 1198 Process AAD 1199 AAD word: 8040f17b8041f8d35501a0b200000000 1200 partial hash: bcfb3d1d0e6e3e78ba45403377dba11b 1202 Process Cipher 1203 Cipher word: f24de3a3fb34de6cacba861c9d7e4bca 1204 partial hash: 0ebc0abe1b15b32fedd2b07888c1ef61 1205 Cipher word: be633bd50d294e6f42a5f47a51c7d19b 1206 partial hash: 438e5797011ea860585709a2899f4685 1207 Cipher word: 36de3adf883300000000000000000000 1208 partial hash: 336fb643310d7bac2aeaa76247f6036d 1210 Proceess Length Word 1211 Length word: 00000000000000600000000000000130 1212 partial hash: 1b964067078c408c4e442a8f015e5264 1214 Turn GHASH into GMAC 1215 GHASH: 1b 96 40 67 07 8c 40 8c 4e 44 2a 8f 01 5e 52 64 1216 K0: 92 0b 3f 40 b9 3d 2a 1d 1c 8b 5c d1 e5 67 5e aa 1217 full GMAC: 89 9d 7f 27 be b1 6a 91 52 cf 76 5e e4 39 0c ce 1218 truncated GMAC: 89 9d 7f 27 be b1 6a 91 1219 Received tag = 899d7f27 beb16a91 1220 Computed tag = 899d7f27 beb16a91 1221 Received tag verified. 1223 Decrypt cipher 1224 block # 0 1225 IV||blk_cntr: 51753c6580c2726f2071841400000002 1226 key_block: b5 2c 8f cf 92 55 fe 09 df ce a6 73 f0 10 22 b9 1227 cipher_block: f2 4d e3 a3 fb 34 de 6c ac ba 86 1c 9d 7e 4b ca 1228 plain_block: 47 61 6c 6c 69 61 20 65 73 74 20 6f 6d 6e 69 73 1229 block # 1 1230 IV||blk_cntr: 51753c6580c2726f2071841400000003 1231 key_block: 9e 07 52 a3 64 5a 2f 4f 2b cb d4 0a 30 b5 a5 fe 1232 cipher_block: be 63 3b d5 0d 29 4e 6f 42 a5 f4 7a 51 c7 d1 9b 1233 plain_block: 20 64 69 76 69 73 61 20 69 6e 20 70 61 72 74 65 1234 block # 2 1235 IV||blk_cntr: 51753c6580c2726f2071841400000004 1236 key_block: 45 fe 4e ad ed 40 0a 5d 1a f3 63 f9 0c e1 49 3b 1237 cipher_block: 36 de 3a df 88 33 1238 plain_block: 73 20 74 72 65 73 1240 Verified and Taged packet: 1241 47616c6c 69612065 7374206f 6d6e6973 1242 20646976 69736120 696e2070 61727465 1243 73207472 6573 1245 16.1.3. AEAD_AES_128_GCM_8 Authentication Tagging 1247 Tagging the following packet: 1249 8040f17b 8041f8d3 5501a0b2 47616c6c 1250 69612065 7374206f 6d6e6973 20646976 1251 69736120 696e2070 61727465 73207472 1252 6573 1254 Form the IV 1255 | Pad | SSRC | ROC | SEQ | 1256 00 00 55 01 a0 b2 00 00 00 00 f1 7b 1257 salt: 51 75 69 64 20 70 72 6f 20 71 75 6f 1258 IV: 51 75 3c 65 80 c2 72 6f 20 71 84 14 1260 Key: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 1261 AAD: 8040f17b 8041f8d3 5501a0b2 47616c6c 1262 69612065 7374206f 6d6e6973 20646976 1263 69736120 696e2070 61727465 73207472 1264 6573 1265 IV: 51 75 3c 65 80 c2 72 6f 20 71 84 14 1266 H: c6a13b37878f5b826f4f8162a1c8d879 1268 Encrypt plaintext 1270 Compute GMAC tag 1271 Process AAD 1272 AAD word: 8040f17b8041f8d35501a0b247616c6c 1273 partial hash: 79f41fea34a474a77609d8925e9f2b22 1274 AAD word: 696120657374206f6d6e697320646976 1275 partial hash: 84093a2f85abf17ab37d3ce2f706138f 1276 AAD word: 69736120696e20706172746573207472 1277 partial hash: ab2760fee24e6dec754739d8059cd144 1278 AAD word: 65730000000000000000000000000000 1279 partial hash: e84f3c55d287fc561c41d09a8aada4be 1281 Proceess Length Word 1282 Length word: 00000000000001900000000000000000 1283 partial hash: b04200c26b81c98af55cc2eafccd1cbc 1285 Turn GHASH into GMAC 1286 GHASH: b0 42 00 c2 6b 81 c9 8a f5 5c c2 ea fc cd 1c bc 1287 K0: 92 0b 3f 40 b9 3d 2a 1d 1c 8b 5c d1 e5 67 5e aa 1288 full GMAC: 22 49 3f 82 d2 bc e3 97 e9 d7 9e 3b 19 aa 42 16 1289 truncated GMAC: 22 49 3f 82 d2 bc e3 97 1291 Cipher with tag 1292 22493f82 d2bce397 1294 Tagged Packet: 1295 8040f17b 8041f8d3 5501a0b2 47616c6c 1296 69612065 7374206f 6d6e6973 20646976 1297 69736120 696e2070 61727465 73207472 1298 65732249 3f82d2bc e397 1300 16.1.4. AEAD_AES_128_GCM_8 Tag Verification 1302 Verifying the following packet: 1304 8040f17b 8041f8d3 5501a0b2 47616c6c 1305 69612065 7374206f 6d6e6973 20646976 1306 69736120 696e2070 61727465 73207472 1307 65732249 3f82d2bc e397 1309 Form the IV 1310 | Pad | SSRC | ROC | SEQ | 1311 00 00 55 01 a0 b2 00 00 00 00 f1 7b 1312 salt: 51 75 69 64 20 70 72 6f 20 71 75 6f 1313 IV: 51 75 3c 65 80 c2 72 6f 20 71 84 14 1315 Key: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 1316 AAD: 8040f17b 8041f8d3 5501a0b2 47616c6c 1317 69612065 7374206f 6d6e6973 20646976 1318 69736120 696e2070 61727465 73207472 1319 6573 1320 CT: 22493f82 d2bce397 1321 IV: 51 75 3c 65 80 c2 72 6f 20 71 84 14 1322 H: c6a13b37878f5b826f4f8162a1c8d879 1324 Verify received tag 22 49 3f 82 d2 bc e3 97 1326 Process AAD 1327 AAD word: 8040f17b8041f8d35501a0b247616c6c 1328 partial hash: 79f41fea34a474a77609d8925e9f2b22 1329 AAD word: 696120657374206f6d6e697320646976 1330 partial hash: 84093a2f85abf17ab37d3ce2f706138f 1331 AAD word: 69736120696e20706172746573207472 1332 partial hash: ab2760fee24e6dec754739d8059cd144 1333 AAD word: 65730000000000000000000000000000 1334 partial hash: e84f3c55d287fc561c41d09a8aada4be 1336 Proceess Length Word 1337 Length word: 00000000000001900000000000000000 1338 partial hash: b04200c26b81c98af55cc2eafccd1cbc 1340 Turn GHASH into GMAC 1341 GHASH: b0 42 00 c2 6b 81 c9 8a f5 5c c2 ea fc cd 1c bc 1342 K0: 92 0b 3f 40 b9 3d 2a 1d 1c 8b 5c d1 e5 67 5e aa 1343 full GMAC: 22 49 3f 82 d2 bc e3 97 e9 d7 9e 3b 19 aa 42 16 1344 truncated GMAC: 22 49 3f 82 d2 bc e3 97 1346 Received tag = 22493f82 d2bce397 1347 Computed tag = 22493f82 d2bce397 1348 Received tag verified. 1350 16.2. AEAD_AES_128_GCM 1352 16.2.1. AEAD_AES_128_GCM Encryption 1354 Encrypting the following packet: 1356 8040f17b 8041f8d3 5501a0b2 47616c6c 1357 69612065 7374206f 6d6e6973 20646976 1358 69736120 696e2070 61727465 73207472 1359 6573 1361 Form the IV 1362 | Pad | SSRC | ROC | SEQ | 1363 00 00 55 01 a0 b2 00 00 00 00 f1 7b 1364 salt: 51 75 69 64 20 70 72 6f 20 71 75 6f 1365 IV: 51 75 3c 65 80 c2 72 6f 20 71 84 14 1367 Key: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 1368 AAD: 8040f17b 8041f8d3 5501a0b2 1369 PT: 47616c6c 69612065 7374206f 6d6e6973 1370 20646976 69736120 696e2070 61727465 1371 73207472 6573 1372 IV: 51 75 3c 65 80 c2 72 6f 20 71 84 14 1373 H: c6a13b37878f5b826f4f8162a1c8d879 1375 Encrypt plaintext 1376 block # 0 1377 IV||blk_cntr: 51753c6580c2726f2071841400000002 1378 key_block: b5 2c 8f cf 92 55 fe 09 df ce a6 73 f0 10 22 b9 1379 plain_block: 47 61 6c 6c 69 61 20 65 73 74 20 6f 6d 6e 69 73 1380 cipher_block: f2 4d e3 a3 fb 34 de 6c ac ba 86 1c 9d 7e 4b ca 1381 block # 1 1382 IV||blk_cntr: 51753c6580c2726f2071841400000003 1383 key_block: 9e 07 52 a3 64 5a 2f 4f 2b cb d4 0a 30 b5 a5 fe 1384 plain_block: 20 64 69 76 69 73 61 20 69 6e 20 70 61 72 74 65 1385 cipher_block: be 63 3b d5 0d 29 4e 6f 42 a5 f4 7a 51 c7 d1 9b 1386 block # 2 1387 IV||blk_cntr: 51753c6580c2726f2071841400000004 1388 key_block: 45 fe 4e ad ed 40 0a 5d 1a f3 63 f9 0c e1 49 3b 1389 plain_block: 73 20 74 72 65 73 1390 cipher_block: 36 de 3a df 88 33 1392 Cipher before tag appended 1393 f24de3a3 fb34de6c acba861c 9d7e4bca 1394 be633bd5 0d294e6f 42a5f47a 51c7d19b 1395 36de3adf 8833 1397 Compute GMAC tag 1399 Process AAD 1400 AAD word: 8040f17b8041f8d35501a0b200000000 1401 partial hash: bcfb3d1d0e6e3e78ba45403377dba11b 1403 Process Cipher 1404 Cipher word: f24de3a3fb34de6cacba861c9d7e4bca 1405 partial hash: 0ebc0abe1b15b32fedd2b07888c1ef61 1406 Cipher word: be633bd50d294e6f42a5f47a51c7d19b 1407 partial hash: 438e5797011ea860585709a2899f4685 1408 Cipher word: 36de3adf883300000000000000000000 1409 partial hash: 336fb643310d7bac2aeaa76247f6036d 1411 Proceess Length Word 1412 Length word: 00000000000000600000000000000130 1413 partial hash: 1b964067078c408c4e442a8f015e5264 1415 Turn GHASH into GMAC 1416 GHASH: 1b 96 40 67 07 8c 40 8c 4e 44 2a 8f 01 5e 52 64 1417 K0: 92 0b 3f 40 b9 3d 2a 1d 1c 8b 5c d1 e5 67 5e aa 1418 full GMAC: 89 9d 7f 27 be b1 6a 91 52 cf 76 5e e4 39 0c ce 1420 Cipher with tag 1421 f24de3a3 fb34de6c acba861c 9d7e4bca 1422 be633bd5 0d294e6f 42a5f47a 51c7d19b 1423 36de3adf 8833899d 7f27beb1 6a9152cf 1424 765ee439 0cce 1426 Encrypted and Tagged packet: 1427 8040f17b 8041f8d3 5501a0b2 f24de3a3 1428 fb34de6c acba861c 9d7e4bca be633bd5 1429 0d294e6f 42a5f47a 51c7d19b 36de3adf 1430 8833899d 7f27beb1 6a9152cf 765ee439 1431 0cce 1433 16.2.2. AEAD_AES_128_GCM Decryption 1435 Decrypting the following packet: 1437 8040f17b 8041f8d3 5501a0b2 f24de3a3 1438 fb34de6c acba861c 9d7e4bca be633bd5 1439 0d294e6f 42a5f47a 51c7d19b 36de3adf 1440 8833899d 7f27beb1 6a9152cf 765ee439 1441 0cce 1443 Form the IV 1444 | Pad | SSRC | ROC | SEQ | 1445 00 00 55 01 a0 b2 00 00 00 00 f1 7b 1446 salt: 51 75 69 64 20 70 72 6f 20 71 75 6f 1447 IV: 51 75 3c 65 80 c2 72 6f 20 71 84 14 1449 Key: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 1450 AAD: 8040f17b 8041f8d3 5501a0b2 1451 CT: f24de3a3 fb34de6c acba861c 9d7e4bca 1452 be633bd5 0d294e6f 42a5f47a 51c7d19b 1453 36de3adf 8833899d 7f27beb1 6a9152cf 1454 765ee439 0cce 1455 IV: 51 75 3c 65 80 c2 72 6f 20 71 84 14 1456 H: c6a13b37878f5b826f4f8162a1c8d879 1458 Verify received tag 89 9d 7f 27 be b1 6a 91 52 cf 76 5e e4 39 0c ce 1460 Process AAD 1461 AAD word: 8040f17b8041f8d35501a0b200000000 1462 partial hash: bcfb3d1d0e6e3e78ba45403377dba11b 1464 Process Cipher 1465 Cipher word: f24de3a3fb34de6cacba861c9d7e4bca 1466 partial hash: 0ebc0abe1b15b32fedd2b07888c1ef61 1467 Cipher word: be633bd50d294e6f42a5f47a51c7d19b 1468 partial hash: 438e5797011ea860585709a2899f4685 1469 Cipher word: 36de3adf883300000000000000000000 1470 partial hash: 336fb643310d7bac2aeaa76247f6036d 1472 Proceess Length Word 1473 Length word: 00000000000000600000000000000130 1474 partial hash: 1b964067078c408c4e442a8f015e5264 1476 Turn GHASH into GMAC 1477 GHASH: 1b 96 40 67 07 8c 40 8c 4e 44 2a 8f 01 5e 52 64 1478 K0: 92 0b 3f 40 b9 3d 2a 1d 1c 8b 5c d1 e5 67 5e aa 1479 full GMAC: 89 9d 7f 27 be b1 6a 91 52 cf 76 5e e4 39 0c ce 1481 Received tag = 899d7f27 beb16a91 52cf765e e4390cce 1482 Computed tag = 899d7f27 beb16a91 52cf765e e4390cce 1483 Received tag verified. 1485 Decrypt cipher 1486 block # 0 1487 IV||blk_cntr: 51753c6580c2726f2071841400000002 1488 key_block: b5 2c 8f cf 92 55 fe 09 df ce a6 73 f0 10 22 b9 1489 cipher_block: f2 4d e3 a3 fb 34 de 6c ac ba 86 1c 9d 7e 4b ca 1490 plain_block: 47 61 6c 6c 69 61 20 65 73 74 20 6f 6d 6e 69 73 1491 block # 1 1492 IV||blk_cntr: 51753c6580c2726f2071841400000003 1493 key_block: 9e 07 52 a3 64 5a 2f 4f 2b cb d4 0a 30 b5 a5 fe 1494 cipher_block: be 63 3b d5 0d 29 4e 6f 42 a5 f4 7a 51 c7 d1 9b 1495 plain_block: 20 64 69 76 69 73 61 20 69 6e 20 70 61 72 74 65 1496 block # 2 1497 IV||blk_cntr: 51753c6580c2726f2071841400000004 1498 key_block: 45 fe 4e ad ed 40 0a 5d 1a f3 63 f9 0c e1 49 3b 1499 cipher_block: 36 de 3a df 88 33 1500 plain_block: 73 20 74 72 65 73 1502 Verified and Taged packet: 1503 47616c6c 69612065 7374206f 6d6e6973 1504 20646976 69736120 696e2070 61727465 1505 73207472 6573 1507 16.2.3. AEAD_AES_128_GCM Authentication Tagging 1509 Tagging the following packet: 1511 8040f17b 8041f8d3 5501a0b2 47616c6c 1512 69612065 7374206f 6d6e6973 20646976 1513 69736120 696e2070 61727465 73207472 1514 6573 1516 Form the IV 1517 | Pad | SSRC | ROC | SEQ | 1518 00 00 55 01 a0 b2 00 00 00 00 f1 7b 1519 salt: 51 75 69 64 20 70 72 6f 20 71 75 6f 1520 IV: 51 75 3c 65 80 c2 72 6f 20 71 84 14 1522 Key: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 1523 AAD: 8040f17b 8041f8d3 5501a0b2 47616c6c 1524 69612065 7374206f 6d6e6973 20646976 1525 69736120 696e2070 61727465 73207472 1526 6573 1527 IV: 51 75 3c 65 80 c2 72 6f 20 71 84 14 1528 H: c6a13b37878f5b826f4f8162a1c8d879 1530 Encrypt plaintext 1532 Compute GMAC tag 1534 Process AAD 1535 AAD word: 8040f17b8041f8d35501a0b247616c6c 1536 partial hash: 79f41fea34a474a77609d8925e9f2b22 1537 AAD word: 696120657374206f6d6e697320646976 1538 partial hash: 84093a2f85abf17ab37d3ce2f706138f 1539 AAD word: 69736120696e20706172746573207472 1540 partial hash: ab2760fee24e6dec754739d8059cd144 1541 AAD word: 65730000000000000000000000000000 1542 partial hash: e84f3c55d287fc561c41d09a8aada4be 1544 Proceess Length Word 1545 Length word: 00000000000001900000000000000000 1546 partial hash: b04200c26b81c98af55cc2eafccd1cbc 1548 Turn GHASH into GMAC 1549 GHASH: b0 42 00 c2 6b 81 c9 8a f5 5c c2 ea fc cd 1c bc 1550 K0: 92 0b 3f 40 b9 3d 2a 1d 1c 8b 5c d1 e5 67 5e aa 1551 full GMAC: 22 49 3f 82 d2 bc e3 97 e9 d7 9e 3b 19 aa 42 16 1553 Cipher with tag 1554 22493f82 d2bce397 e9d79e3b 19aa4216 1556 Tagged Packet: 1557 8040f17b 8041f8d3 5501a0b2 47616c6c 1558 69612065 7374206f 6d6e6973 20646976 1559 69736120 696e2070 61727465 73207472 1560 65732249 3f82d2bc e397e9d7 9e3b19aa 1561 4216 1563 16.2.4. AEAD_AES_128_GCM Tag Verification 1565 Verifying the following packet: 1567 8040f17b 8041f8d3 5501a0b2 47616c6c 1568 69612065 7374206f 6d6e6973 20646976 1569 69736120 696e2070 61727465 73207472 1570 65732249 3f82d2bc e397e9d7 9e3b19aa 1571 4216 1573 Form the IV 1574 | Pad | SSRC | ROC | SEQ | 1575 00 00 55 01 a0 b2 00 00 00 00 f1 7b 1576 salt: 51 75 69 64 20 70 72 6f 20 71 75 6f 1577 IV: 51 75 3c 65 80 c2 72 6f 20 71 84 14 1579 Key: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 1580 AAD: 8040f17b 8041f8d3 5501a0b2 47616c6c 1581 69612065 7374206f 6d6e6973 20646976 1582 69736120 696e2070 61727465 73207472 1583 6573 1584 CT: 22493f82 d2bce397 e9d79e3b 19aa4216 1585 IV: 51 75 3c 65 80 c2 72 6f 20 71 84 14 1586 H: c6a13b37878f5b826f4f8162a1c8d879 1588 Verify received tag 22 49 3f 82 d2 bc e3 97 e9 d7 9e 3b 19 aa 42 16 1590 Process AAD 1591 AAD word: 8040f17b8041f8d35501a0b247616c6c 1592 partial hash: 79f41fea34a474a77609d8925e9f2b22 1593 AAD word: 696120657374206f6d6e697320646976 1594 partial hash: 84093a2f85abf17ab37d3ce2f706138f 1595 AAD word: 69736120696e20706172746573207472 1596 partial hash: ab2760fee24e6dec754739d8059cd144 1597 AAD word: 65730000000000000000000000000000 1598 partial hash: e84f3c55d287fc561c41d09a8aada4be 1600 Proceess Length Word 1601 Length word: 00000000000001900000000000000000 1602 partial hash: b04200c26b81c98af55cc2eafccd1cbc 1604 Turn GHASH into GMAC 1605 GHASH: b0 42 00 c2 6b 81 c9 8a f5 5c c2 ea fc cd 1c bc 1606 K0: 92 0b 3f 40 b9 3d 2a 1d 1c 8b 5c d1 e5 67 5e aa 1607 full GMAC: 22 49 3f 82 d2 bc e3 97 e9 d7 9e 3b 19 aa 42 16 1609 Received tag = 22493f82 d2bce397 e9d79e3b 19aa4216 1610 Computed tag = 22493f82 d2bce397 e9d79e3b 19aa4216 1611 Received tag verified. 1613 16.3. AEAD_AES_256_GCM 1615 16.3.1. AEAD_AES_256_GCM Encryption 1617 Encrypting the following packet: 1619 8040f17b 8041f8d3 5501a0b2 47616c6c 1620 69612065 7374206f 6d6e6973 20646976 1621 69736120 696e2070 61727465 73207472 1622 6573 1624 Form the IV 1625 | Pad | SSRC | ROC | SEQ | 1626 00 00 55 01 a0 b2 00 00 00 00 f1 7b 1627 salt: 51 75 69 64 20 70 72 6f 20 71 75 6f 1628 IV: 51 75 3c 65 80 c2 72 6f 20 71 84 14 1630 Key: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 1631 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 1633 AAD: 8040f17b 8041f8d3 5501a0b2 1634 PT: 47616c6c 69612065 7374206f 6d6e6973 1635 20646976 69736120 696e2070 61727465 1636 73207472 6573 1637 IV: 51 75 3c 65 80 c2 72 6f 20 71 84 14 1638 H: f29000b62a499fd0a9f39a6add2e7780 1640 Encrypt plaintext 1641 block # 0 1642 IV||blk_cntr: 51753c6580c2726f2071841400000002 1643 key_block: 75 d0 b2 14 c1 43 de 77 9c eb 58 95 5e 40 5a d9 1644 plain_block: 47 61 6c 6c 69 61 20 65 73 74 20 6f 6d 6e 69 73 1645 cipher_block: 32 b1 de 78 a8 22 fe 12 ef 9f 78 fa 33 2e 33 aa 1646 block # 1 1647 IV||blk_cntr: 51753c6580c2726f2071841400000003 1648 key_block: 91 e4 7b 4e f3 2b 83 d3 dc 65 0a 72 17 8d da 6a 1649 plain_block: 20 64 69 76 69 73 61 20 69 6e 20 70 61 72 74 65 1650 cipher_block: b1 80 12 38 9a 58 e2 f3 b5 0b 2a 02 76 ff ae 0f 1651 block # 2 1652 IV||blk_cntr: 51753c6580c2726f2071841400000004 1653 key_block: 68 86 43 eb dd 08 07 98 16 3a 16 d5 e5 04 f6 3a 1654 plain_block: 73 20 74 72 65 73 1655 cipher_block: 1b a6 37 99 b8 7b 1657 Cipher before tag appended 1658 32b1de78 a822fe12 ef9f78fa 332e33aa 1659 b1801238 9a58e2f3 b50b2a02 76ffae0f 1660 1ba63799 b87b 1662 Compute GMAC tag 1664 Process AAD 1665 AAD word: 8040f17b8041f8d35501a0b200000000 1666 partial hash: 0154dcb75485b71880e1957c877351bd 1668 Process Cipher 1669 Cipher word: 32b1de78a822fe12ef9f78fa332e33aa 1670 partial hash: c3f07db9a8b9cb4345eb07f793d322d2 1671 Cipher word: b18012389a58e2f3b50b2a0276ffae0f 1672 partial hash: 6d1e66fe32eb32ecd8906ceab09db996 1673 Cipher word: 1ba63799b87b00000000000000000000 1674 partial hash: b3d1d2f1fa3b366619bc42cd2eedafee 1676 Proceess Length Word 1677 Length word: 00000000000000600000000000000130 1678 partial hash: 7debf5fa1fac3bd318d5e1a7ee401091 1680 Turn GHASH into GMAC 1681 GHASH: 7d eb f5 fa 1f ac 3b d3 18 d5 e1 a7 ee 40 10 91 1682 K0: 07 48 2e cc c0 53 ed 63 e1 6e 99 df 39 e7 7c 82 1683 full GMAC: 7a a3 db 36 df ff d6 b0 f9 bb 78 78 d7 a7 6c 13 1685 Cipher with tag 1686 32b1de78 a822fe12 ef9f78fa 332e33aa 1687 b1801238 9a58e2f3 b50b2a02 76ffae0f 1688 1ba63799 b87b7aa3 db36dfff d6b0f9bb 1689 7878d7a7 6c13 1691 Encrypted and Tagged packet: 1692 8040f17b 8041f8d3 5501a0b2 32b1de78 1693 a822fe12 ef9f78fa 332e33aa b1801238 1694 9a58e2f3 b50b2a02 76ffae0f 1ba63799 1695 b87b7aa3 db36dfff d6b0f9bb 7878d7a7 1696 6c13 1698 16.3.2. AEAD_AES_256_GCM Decryption 1700 Decrypting the following packet: 1702 8040f17b 8041f8d3 5501a0b2 32b1de78 1703 a822fe12 ef9f78fa 332e33aa b1801238 1704 9a58e2f3 b50b2a02 76ffae0f 1ba63799 1705 b87b7aa3 db36dfff d6b0f9bb 7878d7a7 1706 6c13 1708 Form the IV 1709 | Pad | SSRC | ROC | SEQ | 1710 00 00 55 01 a0 b2 00 00 00 00 f1 7b 1711 salt: 51 75 69 64 20 70 72 6f 20 71 75 6f 1712 IV: 51 75 3c 65 80 c2 72 6f 20 71 84 14 1714 Key: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 1715 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 1716 AAD: 8040f17b 8041f8d3 5501a0b2 1717 CT: 32b1de78 a822fe12 ef9f78fa 332e33aa 1718 b1801238 9a58e2f3 b50b2a02 76ffae0f 1719 1ba63799 b87b7aa3 db36dfff d6b0f9bb 1720 7878d7a7 6c13 1721 IV: 51 75 3c 65 80 c2 72 6f 20 71 84 14 1722 H: f29000b62a499fd0a9f39a6add2e7780 1724 Verify received tag 7a a3 db 36 df ff d6 b0 f9 bb 78 78 d7 a7 6c 13 1726 Process AAD 1727 AAD word: 8040f17b8041f8d35501a0b200000000 1728 partial hash: 0154dcb75485b71880e1957c877351bd 1730 Process Cipher 1731 Cipher word: 32b1de78a822fe12ef9f78fa332e33aa 1732 partial hash: c3f07db9a8b9cb4345eb07f793d322d2 1733 Cipher word: b18012389a58e2f3b50b2a0276ffae0f 1734 partial hash: 6d1e66fe32eb32ecd8906ceab09db996 1735 Cipher word: 1ba63799b87b00000000000000000000 1736 partial hash: b3d1d2f1fa3b366619bc42cd2eedafee 1738 Proceess Length Word 1739 Length word: 00000000000000600000000000000130 1740 partial hash: 7debf5fa1fac3bd318d5e1a7ee401091 1742 Turn GHASH into GMAC 1743 GHASH: 7d eb f5 fa 1f ac 3b d3 18 d5 e1 a7 ee 40 10 91 1744 K0: 07 48 2e cc c0 53 ed 63 e1 6e 99 df 39 e7 7c 82 1745 full GMAC: 7a a3 db 36 df ff d6 b0 f9 bb 78 78 d7 a7 6c 13 1747 Received tag = 7aa3db36 dfffd6b0 f9bb7878 d7a76c13 1748 Computed tag = 7aa3db36 dfffd6b0 f9bb7878 d7a76c13 1749 Received tag verified. 1751 Decrypt cipher 1752 block # 0 1753 IV||blk_cntr: 51753c6580c2726f2071841400000002 1754 key_block: 75 d0 b2 14 c1 43 de 77 9c eb 58 95 5e 40 5a d9 1755 cipher_block: 32 b1 de 78 a8 22 fe 12 ef 9f 78 fa 33 2e 33 aa 1756 plain_block: 47 61 6c 6c 69 61 20 65 73 74 20 6f 6d 6e 69 73 1757 block # 1 1758 IV||blk_cntr: 51753c6580c2726f2071841400000003 1759 key_block: 91 e4 7b 4e f3 2b 83 d3 dc 65 0a 72 17 8d da 6a 1760 cipher_block: b1 80 12 38 9a 58 e2 f3 b5 0b 2a 02 76 ff ae 0f 1761 plain_block: 20 64 69 76 69 73 61 20 69 6e 20 70 61 72 74 65 1762 block # 2 1763 IV||blk_cntr: 51753c6580c2726f2071841400000004 1764 key_block: 68 86 43 eb dd 08 07 98 16 3a 16 d5 e5 04 f6 3a 1765 cipher_block: 1b a6 37 99 b8 7b 1766 plain_block: 73 20 74 72 65 73 1768 Verified and Taged packet: 1769 47616c6c 69612065 7374206f 6d6e6973 1770 20646976 69736120 696e2070 61727465 1771 73207472 6573 1773 16.3.3. AEAD_AES_256_GCM Authentication Tagging 1775 Tagging the following packet: 1777 8040f17b 8041f8d3 5501a0b2 47616c6c 1778 69612065 7374206f 6d6e6973 20646976 1779 69736120 696e2070 61727465 73207472 1780 6573 1782 Form the IV 1783 | Pad | SSRC | ROC | SEQ | 1784 00 00 55 01 a0 b2 00 00 00 00 f1 7b 1785 salt: 51 75 69 64 20 70 72 6f 20 71 75 6f 1786 IV: 51 75 3c 65 80 c2 72 6f 20 71 84 14 1788 Key: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 1789 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 1790 AAD: 8040f17b 8041f8d3 5501a0b2 47616c6c 1791 69612065 7374206f 6d6e6973 20646976 1792 69736120 696e2070 61727465 73207472 1793 6573 1794 IV: 51 75 3c 65 80 c2 72 6f 20 71 84 14 1795 H: f29000b62a499fd0a9f39a6add2e7780 1797 Encrypt plaintext 1799 Compute GMAC tag 1801 Process AAD 1802 AAD word: 8040f17b8041f8d35501a0b247616c6c 1803 partial hash: c059753e6763791762ca630d8ef97714 1804 AAD word: 696120657374206f6d6e697320646976 1805 partial hash: a4e3401e712900dc4f1d2303bc4b2675 1806 AAD word: 69736120696e20706172746573207472 1807 partial hash: 1c8c1af883de0d67878f379a19c65987 1808 AAD word: 65730000000000000000000000000000 1809 partial hash: 958462781aa8e8feacce6d93b54472ac 1811 Proceess Length Word 1812 Length word: 00000000000001900000000000000000 1813 partial hash: af2efb5dcfdb9900e7127721fdb56956 1815 Turn GHASH into GMAC 1816 GHASH: af 2e fb 5d cf db 99 00 e7 12 77 21 fd b5 69 56 1817 K0: 07 48 2e cc c0 53 ed 63 e1 6e 99 df 39 e7 7c 82 1818 full GMAC: a8 66 d5 91 0f 88 74 63 06 7c ee fe c4 52 15 d4 1820 Cipher with tag 1821 a866d591 0f887463 067ceefe c45215d4 1823 Tagged Packet: 1824 8040f17b 8041f8d3 5501a0b2 47616c6c 1825 69612065 7374206f 6d6e6973 20646976 1826 69736120 696e2070 61727465 73207472 1827 6573a866 d5910f88 7463067c eefec452 1828 15d4 1830 16.3.4. AEAD_AES_256_GCM Tag Verification 1832 Verifying the following packet: 1834 8040f17b 8041f8d3 5501a0b2 47616c6c 1835 69612065 7374206f 6d6e6973 20646976 1836 69736120 696e2070 61727465 73207472 1837 6573a866 d5910f88 7463067c eefec452 1838 15d4 1840 Form the IV 1841 | Pad | SSRC | ROC | SEQ | 1842 00 00 55 01 a0 b2 00 00 00 00 f1 7b 1843 salt: 51 75 69 64 20 70 72 6f 20 71 75 6f 1844 IV: 51 75 3c 65 80 c2 72 6f 20 71 84 14 1846 Key: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 1847 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 1848 AAD: 8040f17b 8041f8d3 5501a0b2 47616c6c 1849 69612065 7374206f 6d6e6973 20646976 1850 69736120 696e2070 61727465 73207472 1851 6573 1852 CT: a866d591 0f887463 067ceefe c45215d4 1853 IV: 51 75 3c 65 80 c2 72 6f 20 71 84 14 1854 H: f29000b62a499fd0a9f39a6add2e7780 1856 Verify received tag a8 66 d5 91 0f 88 74 63 06 7c ee fe c4 52 15 d4 1858 Process AAD 1859 AAD word: 8040f17b8041f8d35501a0b247616c6c 1860 partial hash: c059753e6763791762ca630d8ef97714 1861 AAD word: 696120657374206f6d6e697320646976 1862 partial hash: a4e3401e712900dc4f1d2303bc4b2675 1863 AAD word: 69736120696e20706172746573207472 1864 partial hash: 1c8c1af883de0d67878f379a19c65987 1865 AAD word: 65730000000000000000000000000000 1866 partial hash: 958462781aa8e8feacce6d93b54472ac 1868 Proceess Length Word 1869 Length word: 00000000000001900000000000000000 1870 partial hash: af2efb5dcfdb9900e7127721fdb56956 1872 Turn GHASH into GMAC 1873 GHASH: af 2e fb 5d cf db 99 00 e7 12 77 21 fd b5 69 56 1874 K0: 07 48 2e cc c0 53 ed 63 e1 6e 99 df 39 e7 7c 82 1875 full GMAC: a8 66 d5 91 0f 88 74 63 06 7c ee fe c4 52 15 d4 1877 Received tag = a866d591 0f887463 067ceefe c45215d4 1878 Computed tag = a866d591 0f887463 067ceefe c45215d4 1879 Received tag verified. 1881 17. RTCP Test Vectors 1883 The examples in this section are all based upon the same RTCP packet: 1885 81c8000e 4d617273 4e545031 4e545031 1886 52545020 0000042a 0000eb98 4c756e61 1887 deadbeef deadbeef deadbeef deadbeef 1888 deadbeef 1890 with 32-bit SRTCP index 000005d4. 1892 As shown in section 9.1, the IV is formed by XORing two 12-octet 1893 values. The first 12-octet value is formed by concatenating two zero 1894 octets, the 4-octet SSRC (found in the 5th thru 8th octets of the RTP 1895 packet), another 2 padding octets and the 31-bit SRTCP index, right 1896 justified in a 32-bit = 4-octet field with a single "0" bit 1897 pre-pended as padding. An example of SRTCP IV formation is shown 1898 below: 1900 | Pad | SSRC | Pad | 0+SRTCP | 1901 00 00 4d 61 72 73 00 00 00 00 05 d4 1902 salt 51 75 69 64 20 70 72 6f 20 71 75 6f 1903 ------------------------------------ 1904 IV 51 75 24 05 52 03 72 6f 20 71 70 bb 1906 In an SRTCP packet a 1-bit encryption flag is pre-pended to the 1907 31-bit SRTCP index to form a 32-bit value we shall call the ESRTCP 1908 word. The E flag is one if the SRTCP packet has been encrypted and 1909 zero if it has been tagged but not encrypted. Note that the ESRTCP 1910 field is only present in an SRTCP packet, not in an RTCP packet. The 1911 full ESRTCP word is part of the AAD. 1913 When encrypting and tagging an RTCP packet (E flag = 1), the SRTCP 1914 packet consists of the following fields in the following order: 1916 - The first 8 octets of the RTCP packet (part of the AAD). 1917 - The cipher. 1918 - The ESRTCP word (the final part of the AAD). 1919 - Any raw data that might have been appended to the end of the 1920 original RTCP packet. 1922 Recall that AEAD treats the authentication tag as an integral part of 1923 the cipher, and in fact the authentication tag is the last 8 or 16 1924 octets of the cipher. 1926 The reader is reminded that when the RTCP packet is to be tagged but 1927 not encrypted (E flag = 0), GCM will produce cipher that consists 1928 solely of the 8 or 16 byte authentication tag. The tagged SRTCP 1929 consists of the following fields in the order listed below: 1931 - All of the AAD save for the ECSRTP word. 1932 - The cipher (= the authentication tag). 1933 - The ESRTCP word (the final part of the AAD). 1934 - Any raw data that might have been appended to the end of the 1935 original RTCP packet. 1937 17.1. AEAD_AES_128_GCM_8 Encrypt and Tag 1939 Encrypting the following packet: 1941 81c8000d 4d617273 4e545031 4e545032 1942 52545020 0000042a 0000e930 4c756e61 1943 deadbeef deadbeef deadbeef deadbeef 1944 deadbeef 1946 Key size = 128 bits 1947 Tag size = 8 octets 1949 Form the IV 1950 | Pad | SSRC | Pad | SRTCP | 1951 00 00 4d 61 72 73 00 00 00 00 05 d4 1952 salt: 51 75 69 64 20 70 72 6f 20 71 75 6f 1953 IV: 51 75 24 05 52 03 72 6f 20 71 70 bb 1955 Key: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 1956 AAD: 81c8000d 4d617273 800005d4 1957 PT: 4e545031 4e545032 52545020 0000042a 1958 0000e930 4c756e61 deadbeef deadbeef 1959 deadbeef deadbeef deadbeef 1960 IV: 51 75 24 05 52 03 72 6f 20 71 70 bb 1961 H: c6a13b37878f5b826f4f8162a1c8d879 1963 Encrypt plaintext 1964 block # 0 1965 IV||blk_cntr: 517524055203726f207170bb00000002 1966 key_block: 2d bd 18 b4 92 8e e6 4e f5 73 87 46 2f 6b 7a b3 1967 plain_block: 4e 54 50 31 4e 54 50 32 52 54 50 20 00 00 04 2a 1968 cipher_block: 63 e9 48 85 dc da b6 7c a7 27 d7 66 2f 6b 7e 99 1969 block # 1 1970 IV||blk_cntr: 517524055203726f207170bb00000003 1971 key_block: 7f f5 29 c7 20 73 9d 4c 18 db 1b 1e ad a0 d1 35 1972 plain_block: 00 00 e9 30 4c 75 6e 61 de ad be ef de ad be ef 1973 cipher_block: 7f f5 c0 f7 6c 06 f3 2d c6 76 a5 f1 73 0d 6f da 1974 block # 2 1975 IV||blk_cntr: 517524055203726f207170bb00000004 1976 key_block: 92 4d 25 a9 58 9d 83 02 d5 14 99 b4 e0 14 78 15 1977 plain_block: de ad be ef de ad be ef de ad be ef 1978 cipher_block: 4c e0 9b 46 86 30 3d ed 0b b9 27 5b 1980 Cipher before tag appended 1981 63e94885 dcdab67c a727d766 2f6b7e99 1982 7ff5c0f7 6c06f32d c676a5f1 730d6fda 1983 4ce09b46 86303ded 0bb9275b 1985 Compute GMAC tag 1987 Process AAD 1988 AAD word: 81c8000d4d617273800005d400000000 1989 partial hash: 085d6eb166c555aa62982f630430ec6e 1991 Process Cipher 1992 Cipher word: 63e94885dcdab67ca727d7662f6b7e99 1993 partial hash: 8c9221be93466d68bbb16fa0d42b0187 1994 Cipher word: 7ff5c0f76c06f32dc676a5f1730d6fda 1995 partial hash: 221ebb044ec9fd0bf116d7780f198792 1996 Cipher word: 4ce09b4686303ded0bb9275b00000000 1997 partial hash: 50f70b9ca110ab312dce212657328dae 1999 Proceess Length Word 2000 Length word: 00000000000000600000000000000160 2001 partial hash: 7296107c9716534371dfc1a30c5ffeb5 2003 Turn GHASH into GMAC 2004 GHASH: 72 96 10 7c 97 16 53 43 71 df c1 a3 0c 5f fe b5 2005 K0: ba dc b4 24 01 d9 1e 6c b4 74 39 d1 49 86 14 6b 2006 full GMAC: c8 4a a4 58 96 cf 4d 2f c5 ab f8 72 45 d9 ea de 2007 truncated GMAC: c8 4a a4 58 96 cf 4d 2f 2009 Cipher with tag 2010 63e94885 dcdab67c a727d766 2f6b7e99 2011 7ff5c0f7 6c06f32d c676a5f1 730d6fda 2012 4ce09b46 86303ded 0bb9275b c84aa458 2013 96cf4d2f 2015 Add SRTCP with Eflag set. 2016 Cext:63e94885 dcdab67c a727d766 2f6b7e99 2017 7ff5c0f7 6c06f32d c676a5f1 730d6fda 2018 4ce09b46 86303ded 0bb9275b c84aa458 2019 96cf4d2f 800005d4 2021 Encrypted and Tagged packet: 2022 81c8000d 4d617273 63e94885 dcdab67c 2023 a727d766 2f6b7e99 7ff5c0f7 6c06f32d 2024 c676a5f1 730d6fda 4ce09b46 86303ded 2025 0bb9275b c84aa458 96cf4d2f 800005d4 2027 17.2. AEAD_AES_256_GCM Verify and Decryption 2029 Key size = 256 bits 2030 Tag size = 16 octets 2032 Proceess Length Word 2033 Decrypting the following packet: 2035 81c8000d 4d617273 d50ae4d1 f5ce5d30 2036 4ba297e4 7d470c28 2c3ece5d bffe0a50 2037 a2eaa5c1 110555be 8415f658 c61de047 2038 6f1b6fad 1d1eb30c 4446839f 57ff6f6c 2039 b26ac3be 800005d4 2041 Key size = 256 bits 2042 Key size = 16 octets 2044 Form the IV 2045 | Pad | SSRC | Pad | SRTCP | 2046 00 00 4d 61 72 73 00 00 00 00 05 d4 2047 salt: 51 75 69 64 20 70 72 6f 20 71 75 6f 2048 IV: 51 75 24 05 52 03 72 6f 20 71 70 bb 2050 Key: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 2051 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 2052 AAD: 81c8000d 4d617273 800005d4 2053 CT: d50ae4d1 f5ce5d30 4ba297e4 7d470c28 2054 2c3ece5d bffe0a50 a2eaa5c1 110555be 2055 8415f658 c61de047 6f1b6fad 1d1eb30c 2056 4446839f 57ff6f6c b26ac3be 2057 IV: 51 75 24 05 52 03 72 6f 20 71 70 bb 2058 H: f29000b62a499fd0a9f39a6add2e7780 2060 Verify received tag 1d 1e b3 0c 44 46 83 9f 57 ff 6f 6c b2 6a c3 be 2062 Process AAD 2063 AAD word: 81c8000d4d617273800005d400000000 2064 partial hash: 3ae5afd36dead5280b18950400176b5b 2066 Process Cipher 2067 Cipher word: d50ae4d1f5ce5d304ba297e47d470c28 2068 partial hash: e90fab7546f6940781227227ac926ebe 2069 Cipher word: 2c3ece5dbffe0a50a2eaa5c1110555be 2070 partial hash: 9b236807d8b2dab07583adce367aa88f 2071 Cipher word: 8415f658c61de0476f1b6fad00000000 2072 partial hash: e69313f423a75e3e0b7eb93321700e86 2074 Proceess Length Word 2075 Length word: 00000000000000600000000000000160 2076 partial hash: 3a284af2616fdf505faf37eec39fbc8b 2078 Turn GHASH into GMAC 2079 GHASH: 3a 28 4a f2 61 6f df 50 5f af 37 ee c3 9f bc 8b 2080 K0: 27 36 f9 fe 25 29 5c cf 08 50 58 82 71 f5 7f 35 2081 full GMAC: 1d 1e b3 0c 44 46 83 9f 57 ff 6f 6c b2 6a c3 be 2083 Received tag = 1d1eb30c 4446839f 57ff6f6c b26ac3be 2084 Computed tag = 1d1eb30c 4446839f 57ff6f6c b26ac3be 2085 Received tag verified. 2087 Decrypt cipher 2088 block # 0 2089 IV||blk_cntr: 517524055203726f207170bb00000002 2090 key_block: 9b 5e b4 e0 bb 9a 0d 02 19 f6 c7 c4 7d 47 08 02 2091 cipher_block: d5 0a e4 d1 f5 ce 5d 30 4b a2 97 e4 7d 47 0c 28 2092 plain_block: 4e 54 50 31 4e 54 50 32 52 54 50 20 00 00 04 2a 2093 block # 1 2094 IV||blk_cntr: 517524055203726f207170bb00000003 2095 key_block: 2c 3e 27 6d f3 8b 64 31 7c 47 1b 2e cf a8 eb 51 2096 cipher_block: 2c 3e ce 5d bf fe 0a 50 a2 ea a5 c1 11 05 55 be 2097 plain_block: 00 00 e9 30 4c 75 6e 61 de ad be ef de ad be ef 2098 block # 2 2099 IV||blk_cntr: 517524055203726f207170bb00000004 2100 key_block: 5a b8 48 b7 18 b0 5e a8 b1 b6 d1 42 3b 74 39 55 2101 cipher_block: 84 15 f6 58 c6 1d e0 47 6f 1b 6f ad 2102 plain_block: de ad be ef de ad be ef de ad be ef 2104 Verified and Decrypted packet: 2105 81c8000d 4d617273 4e545031 4e545032 2106 52545020 0000042a 0000e930 4c756e61 2107 deadbeef deadbeef deadbeef deadbeef 2108 deadbeef 2110 17.3. AEAD_AES_128_GCM Tag Only 2112 Tagging the following packet: 2114 81c8000d 4d617273 4e545031 4e545032 2115 52545020 0000042a 0000e930 4c756e61 2116 deadbeef deadbeef deadbeef deadbeef 2117 deadbeef 2119 Key size = 128 bits 2120 Tag size = 16 octets 2122 Form the IV 2123 | Pad | SSRC | Pad | SRTCP | 2124 00 00 4d 61 72 73 00 00 00 00 05 d4 2125 salt: 51 75 69 64 20 70 72 6f 20 71 75 6f 2126 IV: 51 75 24 05 52 03 72 6f 20 71 70 bb 2128 Key: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 2129 AAD: 81c8000d 4d617273 4e545031 4e545032 2130 52545020 0000042a 0000e930 4c756e61 2131 deadbeef deadbeef deadbeef deadbeef 2132 deadbeef 000005d4 2133 IV: 51 75 24 05 52 03 72 6f 20 71 70 bb 2134 H: c6a13b37878f5b826f4f8162a1c8d879 2136 Compute GMAC tag 2138 Process AAD 2139 AAD word: 81c8000d4d6172734e5450314e545032 2140 partial hash: f8dbbe278e06afe17fb4fb2e67f0a22e 2141 AAD word: 525450200000042a0000e9304c756e61 2142 partial hash: 6ccd900dfd0eb292f68f8a410d0648ec 2143 AAD word: deadbeefdeadbeefdeadbeefdeadbeef 2144 partial hash: 6a14be0ea384c6b746235ba955a57ff5 2145 AAD word: deadbeef000005d40000000000000000 2146 partial hash: cc81f14905670a1e37f8bc81a91997cd 2148 Proceess Length Word 2149 Length word: 00000000000001c00000000000000000 2150 partial hash: 3ec16d4c3c0e90a59e91be415bd976d8 2152 Turn GHASH into GMAC 2153 GHASH: 3e c1 6d 4c 3c 0e 90 a5 9e 91 be 41 5b d9 76 d8 2154 K0: ba dc b4 24 01 d9 1e 6c b4 74 39 d1 49 86 14 6b 2155 full GMAC: 84 1d d9 68 3d d7 8e c9 2a e5 87 90 12 5f 62 b3 2157 Cipher with tag 2158 841dd968 3dd78ec9 2ae58790 125f62b3 2160 Tagged Packet: 2161 81c8000d 4d617273 4e545031 4e545032 2162 52545020 0000042a 0000e930 4c756e61 2163 deadbeef deadbeef deadbeef deadbeef 2164 deadbeef 841dd968 3dd78ec9 2ae58790 2165 125f62b3 000005d4 2167 17.4. AEAD_AES_256_GCM Tag Verification 2169 Key size = 256 bits 2170 Tag size = 16 octets 2172 Proceess Length Word 2173 Verifying the following packet: 2175 81c8000d 4d617273 4e545031 4e545032 2176 52545020 0000042a 0000e930 4c756e61 2177 deadbeef deadbeef deadbeef deadbeef 2178 deadbeef 91db4afb feee5a97 8fab4393 2179 ed2615fe 000005d4 2181 Key size = 256 bits 2182 Key size = 16 octets 2184 Form the IV 2185 | Pad | SSRC | Pad | SRTCP | 2186 00 00 4d 61 72 73 00 00 00 00 05 d4 2187 salt: 51 75 69 64 20 70 72 6f 20 71 75 6f 2188 IV: 51 75 24 05 52 03 72 6f 20 71 70 bb 2190 Key: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 2191 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 2192 AAD: 81c8000d 4d617273 4e545031 4e545032 2193 52545020 0000042a 0000e930 4c756e61 2194 deadbeef deadbeef deadbeef deadbeef 2195 deadbeef 000005d4 2196 CT: 91db4afb feee5a97 8fab4393 ed2615fe 2197 IV: 51 75 24 05 52 03 72 6f 20 71 70 bb 2198 H: f29000b62a499fd0a9f39a6add2e7780 2200 Verify received tag 91 db 4a fb fe ee 5a 97 8f ab 43 93 ed 26 15 fe 2202 Process AAD 2203 AAD word: 81c8000d4d6172734e5450314e545032 2204 partial hash: 7bc665c71676a5a5f663b3229af4b85c 2205 AAD word: 525450200000042a0000e9304c756e61 2206 partial hash: 34ed77752703ab7d69f44237910e3bc0 2207 AAD word: deadbeefdeadbeefdeadbeefdeadbeef 2208 partial hash: 74a59f1a99282344d64ab1c8a2be6cf8 2209 AAD word: deadbeef000005d40000000000000000 2210 partial hash: 126335c0baa7ab1b79416ceeb9f7a518 2212 Proceess Length Word 2213 Length word: 00000000000001c00000000000000000 2214 partial hash: b6edb305dbc7065887fb1b119cd36acb 2216 Turn GHASH into GMAC 2217 GHASH: b6 ed b3 05 db c7 06 58 87 fb 1b 11 9c d3 6a cb 2218 K0: 27 36 f9 fe 25 29 5c cf 08 50 58 82 71 f5 7f 35 2219 full GMAC: 91 db 4a fb fe ee 5a 97 8f ab 43 93 ed 26 15 fe 2221 Received tag = 91db4afb feee5a97 8fab4393 ed2615fe 2222 Computed tag = 91db4afb feee5a97 8fab4393 ed2615fe 2223 Received tag verified. 2225 Verified Packet: 2226 81c8000d 4d617273 4e545031 4e545032 2227 52545020 0000042a 0000e930 4c756e61 2228 deadbeef deadbeef deadbeef deadbeef 2229 deadbeef 2231 18. Acknowledgements 2233 The authors would like to thank Michael Peck, Michael Torla, Qin Wu, 2234 Magnus Westerlund, Oscar Ohllson, Woo-Hwan Kim, John Mattsson, 2235 Richard Barnes, John Mattisson, Morris Dworkin, Stehen Farrell and 2236 many other reviewers who provided valuable comments on earlier drafts 2237 of this document. 2239 19. References 2241 19.1. Normative References 2243 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2244 Requirement Levels", BCP 14, RFC 2119, March 1997. 2246 [RFC3550] Schulzrinne, H., Casner, S., Frederick, R., and V. 2247 Jacobson, "RTP: A Transport Protocol for Real-Time 2248 Applications", STD 64, RFC 3550, July 2003. 2250 [RFC3711] Baugher, M., McGrew, D., Naslund, M., Carrara, E., and 2251 K. Norrman, "The Secure Real-time Transport Protocol 2252 (SRTP)", RFC 3711, September 2003. 2254 [RFC3830] Arkko, J., Carrara, E., Lindholm, F., Naslund, M.,and 2255 Norrman, K, "MIKEY: Multimedia Internet KEYing", RFC 3830, 2256 August 2004. 2258 [RFC4568] Andreasen, F., Baugher, M., and D.Wing, "Session 2259 Description Protocol (SDP): Security Descriptions for 2260 Media Streams", RFC 4568, July 2006. 2262 [RFC5116] McGrew, D., "An Interface and Algorithms for 2263 Authenticated Encryption with Associated Data", RFC 5116, 2264 January 2008. 2266 [RFC5282] McGrew, D. and D. Black, "Using Authenticated Encryption 2267 Algorithms with the Encrypted Payload of the Internet Key 2268 Exchange version 2 (IKEv2) Protocol", RFC 5282, 2269 August 2008. 2271 [RFC5764] McGrew, D. and E. Rescorla, "Datagram Transport Layer 2272 Security (DTLS) Extension to Establish Keys for the Secure 2273 Real-time Transport Protocol (SRTP)", RFC 5764, May 2010. 2275 [RFC6188] D. McGrew, "The Use of AES-192 and AES-256 in Secure 2276 RTP", RFC 6188, March 2011. 2278 [RFC6904] J. Lennox, "Encryption of Header Extensions in the Secure 2279 Real-Time Transport Protocol (SRTP)", January 2013. 2281 19.2. Informative References 2283 [BN00] Bellare, M. and C. Namprempre, "Authenticated encryption: 2285 Relations among notions and analysis of the generic 2286 composition paradigm", Proceedings of ASIACRYPT 2000, 2287 Springer-Verlag, LNCS 1976, pp. 531-545 http:// 2288 www-cse.ucsd.edu/users/mihir/papers/oem.html. 2290 [Ferg] Ferguson, N., "Authentication weaknesses in GCM", http:// 2291 csrc.nist.gov/groups/ST/toolkit/BCM/documents/comments/ 2292 CWC-GCM/Ferguson2.pdf. May 2005. 2294 [GCM] Dworkin, M., "NIST Special Publication 800-38D: 2295 Recommendation for Block Cipher Modes of Operation: 2296 Galois/Counter Mode (GCM) and GMAC.", U.S. National 2297 Institute of Standards and Technology http:// 2298 csrc.nist.gov/publications/nistpubs/800-38D/SP800-38D.pdf. 2300 [R02] Rogaway, P., "Authenticated encryption with Associated- 2301 Data", ACM Conference on Computer and Communication 2302 Security (CCS'02), pp. 98-107, ACM Press, 2303 2002. http://www.cs.ucdavis.edu/~rogaway/papers/ad.html. 2305 [RFC4771] Lehtovirta, V., Naslund, M., and K. Norrman, "Integrity 2306 Transform Carrying Roll-Over Counter for the Secure Real- 2307 time Transport Protocol (SRTP)", RFC 4771, January 2007. 2309 Author's Address 2311 David A. McGrew 2312 Cisco Systems, Inc. 2313 510 McCarthy Blvd. 2314 Milpitas, CA 95035 2315 US 2316 Phone: (408) 525 8651 2317 Email: mcgrew@cisco.com 2318 URI: http://www.mindspring.com/~dmcgrew/dam.htm 2320 Kevin M. Igoe 2321 NSA/CSS Commercial Solutions Center 2322 National Security Agency 2323 EMail: kmigoe@nsa.gov 2325 Acknowledgement 2327 Funding for the RFC Editor function is provided by the IETF 2328 Administrative Support Activity (IASA).