Debian Codegraph @

rfc8452.html

raw
1 <pre>Internet Research Task Force (IRTF) S. Gueron
2 Request for Comments: 8452 University of Haifa and Amazon
3 Category: Informational A. Langley
4 ISSN: 2070-1721 Google LLC
5 Y. Lindell
6 Bar-Ilan University and Unbound Tech
7 April 2019
8
9
10 <span class="h1">AES-GCM-SIV: Nonce Misuse-Resistant Authenticated Encryption</span>
11
12 Abstract
13
14 This memo specifies two authenticated encryption algorithms that are
15 nonce misuse resistant -- that is, they do not fail catastrophically
16 if a nonce is repeated.
17
18 This document is the product of the Crypto Forum Research Group.
19
20 Status of This Memo
21
22 This document is not an Internet Standards Track specification; it is
23 published for informational purposes.
24
25 This document is a product of the Internet Research Task Force
26 (IRTF). The IRTF publishes the results of Internet-related research
27 and development activities. These results might not be suitable for
28 deployment. This RFC represents the consensus of the Crypto Forum
29 Research Group of the Internet Research Task Force (IRTF). Documents
30 approved for publication by the IRSG are not candidates for any level
31 of Internet Standard; see <a href="./rfc7841#section-2">Section&nbsp;2 of RFC 7841</a>.
32
33 Information about the current status of this document, any errata,
34 and how to provide feedback on it may be obtained at
35 <a href="https://www.rfc-editor.org/info/rfc8452">https://www.rfc-editor.org/info/rfc8452</a>.
36
37 Copyright Notice
38
39 Copyright (c) 2019 IETF Trust and the persons identified as the
40 document authors. All rights reserved.
41
42 This document is subject to <a href="https://www.rfc-editor.org/bcp/bcp78">BCP 78</a> and the IETF Trust's Legal
43 Provisions Relating to IETF Documents
44 (<a href="https://trustee.ietf.org/license-info">https://trustee.ietf.org/license-info</a>) in effect on the date of
45 publication of this document. Please review these documents
46 carefully, as they describe your rights and restrictions with respect
47 to this document.
48
49
50
51
52 <span class="grey">Gueron, et al. Informational [Page 1]</span></pre>
53 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span>
54 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
55
56
57 Table of Contents
58
59 <a href="#section-1">1</a>. Introduction . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-2">2</a>
60 <a href="#section-2">2</a>. Requirements Language . . . . . . . . . . . . . . . . . . . . <a href="#page-3">3</a>
61 <a href="#section-3">3</a>. POLYVAL . . . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-3">3</a>
62 <a href="#section-4">4</a>. Encryption . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-4">4</a>
63 <a href="#section-5">5</a>. Decryption . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-7">7</a>
64 <a href="#section-6">6</a>. AEADs . . . . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-10">10</a>
65 <a href="#section-7">7</a>. Field Operation Examples . . . . . . . . . . . . . . . . . . <a href="#page-10">10</a>
66 <a href="#section-8">8</a>. Worked Example . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-10">10</a>
67 <a href="#section-9">9</a>. Security Considerations . . . . . . . . . . . . . . . . . . . <a href="#page-11">11</a>
68 <a href="#section-10">10</a>. IANA Considerations . . . . . . . . . . . . . . . . . . . . . <a href="#page-14">14</a>
69 <a href="#section-11">11</a>. References . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-14">14</a>
70 <a href="#section-11.1">11.1</a>. Normative References . . . . . . . . . . . . . . . . . . <a href="#page-14">14</a>
71 <a href="#section-11.2">11.2</a>. Informative References . . . . . . . . . . . . . . . . . <a href="#page-15">15</a>
72 <a href="#appendix-A">Appendix A</a>. The Relationship between POLYVAL and GHASH . . . . . <a href="#page-17">17</a>
73 <a href="#appendix-B">Appendix B</a>. Additional Comparisons with AES-GCM . . . . . . . . <a href="#page-19">19</a>
74 <a href="#appendix-C">Appendix C</a>. Test Vectors . . . . . . . . . . . . . . . . . . . . <a href="#page-20">20</a>
75 <a href="#appendix-C.1">C.1</a>. AEAD_AES_128_GCM_SIV . . . . . . . . . . . . . . . . . . <a href="#page-20">20</a>
76 <a href="#appendix-C.2">C.2</a>. AEAD_AES_256_GCM_SIV . . . . . . . . . . . . . . . . . . <a href="#page-30">30</a>
77 <a href="#appendix-C.3">C.3</a>. Counter Wrap Tests . . . . . . . . . . . . . . . . . . . <a href="#page-41">41</a>
78 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-42">42</a>
79 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-42">42</a>
80
81 <span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. Introduction</span>
82
83 The concept of Authenticated Encryption with Additional Data (AEAD)
84 [<a href="./rfc5116" title="&quot;An Interface and Algorithms for Authenticated Encryption&quot;">RFC5116</a>] couples confidentiality and integrity in a single
85 operation, avoiding the risks of the previously common practice of
86 using ad hoc constructions of block-cipher and hash primitives. The
87 most popular AEAD, AES-GCM [<a href="#ref-GCM" title="&quot;Recommendation for Block Cipher Modes of Operation: Galois/Counter Mode (GCM) and GMAC&quot;">GCM</a>], is seeing widespread use due to its
88 attractive performance.
89
90 However, some AEADs (including AES-GCM) suffer catastrophic failures
91 of confidentiality and/or integrity when two distinct messages are
92 encrypted with the same key and nonce. While the requirements for
93 AEADs specify that the pair of (key, nonce) shall only ever be used
94 once, and thus prohibit this, this is a worry in practice.
95
96 Nonce misuse-resistant AEADs do not suffer from this problem. For
97 this class of AEADs, encrypting two messages with the same nonce only
98 discloses whether the messages were equal or not. This is the
99 minimum amount of information that a deterministic algorithm can leak
100 in this situation.
101
102 This memo specifies two nonce misuse-resistant AEADs:
103 AEAD_AES_128_GCM_SIV and AEAD_AES_256_GCM_SIV. These AEADs are
104 designed to be able to take advantage of existing hardware support
105
106
107
108 <span class="grey">Gueron, et al. Informational [Page 2]</span></pre>
109 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span>
110 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
111
112
113 for AES-GCM and can decrypt within 5% of the speed of AES-GCM (for
114 multikilobyte messages). Encryption is, perforce, slower than
115 AES-GCM, because two passes are required in order to achieve that
116 nonce misuse-resistance property. However, measurements suggest that
117 it can still run at two-thirds of the speed of AES-GCM.
118
119 We suggest that these AEADs be considered in any situation where
120 nonce uniqueness cannot be guaranteed. This includes situations
121 where there is no stateful counter or where such state cannot be
122 guaranteed, as when multiple encryptors use the same key. As
123 discussed in <a href="#section-9">Section 9</a>, it is RECOMMENDED to use this scheme with
124 randomly chosen nonces.
125
126 This document represents the consensus of the Crypto Forum Research
127 Group (CFRG).
128
129 <span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. Requirements Language</span>
130
131 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
132 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
133 "OPTIONAL" in this document are to be interpreted as described in
134 <a href="https://www.rfc-editor.org/bcp/bcp14">BCP 14</a> [<a href="./rfc2119" title="&quot;Key words for use in RFCs to Indicate Requirement Levels&quot;">RFC2119</a>] [<a href="./rfc8174" title="&quot;Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words&quot;">RFC8174</a>] when, and only when, they appear in all
135 capitals, as shown here.
136
137 <span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. POLYVAL</span>
138
139 The GCM-SIV construction is similar to GCM: the block cipher is used
140 in counter mode to encrypt the plaintext, and a polynomial
141 authenticator is used to provide integrity. The authenticator in
142 GCM-SIV is called POLYVAL.
143
144 POLYVAL, like GHASH (the authenticator in AES-GCM; see [<a href="#ref-GCM" title="&quot;Recommendation for Block Cipher Modes of Operation: Galois/Counter Mode (GCM) and GMAC&quot;">GCM</a>],
145 Section 6.4), operates in a binary field of size 2^128. The field is
146 defined by the irreducible polynomial x^128 + x^127 + x^126 + x^121 +
147 1. The sum of any two elements in the field is the result of XORing
148 them. The product of any two elements is calculated using standard
149 (binary) polynomial multiplication followed by reduction modulo the
150 irreducible polynomial.
151
152 We define another binary operation on elements of the field:
153 dot(a, b), where dot(a, b) = a * b * x^-128. The value of the field
154 element x^-128 is equal to x^127 + x^124 + x^121 + x^114 + 1. The
155 result of this multiplication, dot(a, b), is another field element.
156
157
158
159
160
161
162
163
164 <span class="grey">Gueron, et al. Informational [Page 3]</span></pre>
165 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span>
166 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
167
168
169 Polynomials in this field are converted to and from 128-bit strings
170 by taking the least significant bit of the first byte to be the
171 coefficient of x^0, the most significant bit of the first byte to be
172 the coefficient of x^7, and so on, until the most significant bit of
173 the last byte is the coefficient of x^127.
174
175 POLYVAL takes a field element, H, and a series of field elements
176 X_1, ..., X_s. Its result is S_s, where S is defined by the
177 iteration S_0 = 0; S_j = dot(S_{j-1} + X_j, H), for j = 1..s.
178
179 We note that POLYVAL(H, X_1, X_2, ...) is equal to
180 ByteReverse(GHASH(ByteReverse(H) * x, ByteReverse(X_1),
181 ByteReverse(X_2), ...)), where ByteReverse is a function that
182 reverses the order of 16 bytes. See <a href="#appendix-A">Appendix A</a> for a more detailed
183 explanation.
184
185 <span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. Encryption</span>
186
187 AES-GCM-SIV encryption takes a 16- or 32-byte key-generating key, a
188 96-bit nonce, and plaintext and additional data byte strings of
189 variable length. It outputs an authenticated ciphertext that will be
190 16 bytes longer than the plaintext. Both encryption and decryption
191 are only defined on inputs that are a whole number of bytes.
192
193 If the key-generating key is 16 bytes long, then AES-128 is used
194 throughout. Otherwise, AES-256 is used throughout.
195
196 The first step of encryption is to generate per-nonce, message-
197 authentication and message-encryption keys. The message-
198 authentication key is 128 bit, and the message-encryption key is
199 either 128 (for AES-128) or 256 bit (for AES-256).
200
201 These keys are generated by encrypting a series of plaintext blocks
202 that contain a 32-bit, little-endian counter followed by the nonce,
203 and then discarding the second half of the resulting ciphertext. In
204 the AES-128 case, 128 + 128 = 256 bits of key material need to be
205 generated, and, since encrypting each block yields 64 bits after
206 discarding half, four blocks need to be encrypted. The counter
207 values for these blocks are 0, 1, 2, and 3. For AES-256, six blocks
208 are needed in total, with counter values 0 through 5 (inclusive).
209
210
211
212
213
214
215
216
217
218
219
220 <span class="grey">Gueron, et al. Informational [Page 4]</span></pre>
221 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-5" ></span>
222 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
223
224
225 In pseudocode form, where "++" indicates concatenation and "x[:8]"
226 indicates taking only the first eight bytes from x:
227
228 func derive_keys(key_generating_key, nonce) {
229 message_authentication_key =
230 AES(key = key_generating_key,
231 block = little_endian_uint32(0) ++ nonce)[:8] ++
232 AES(key = key_generating_key,
233 block = little_endian_uint32(1) ++ nonce)[:8]
234 message_encryption_key =
235 AES(key = key_generating_key,
236 block = little_endian_uint32(2) ++ nonce)[:8] ++
237 AES(key = key_generating_key,
238 block = little_endian_uint32(3) ++ nonce)[:8]
239
240 if bytelen(key_generating_key) == 32 {
241 message_encryption_key ++=
242 AES(key = key_generating_key,
243 block = little_endian_uint32(4) ++ nonce)[:8] ++
244 AES(key = key_generating_key,
245 block = little_endian_uint32(5) ++ nonce)[:8]
246 }
247
248 return message_authentication_key, message_encryption_key
249 }
250
251 Define the "length block" as a 16-byte value that is the
252 concatenation of the 64-bit, little-endian encodings of
253 bytelen(additional_data) * 8 and bytelen(plaintext) * 8. Pad the
254 plaintext and additional data with zeros until they are each a
255 multiple of 16 bytes, the AES block size. Then X_1, X_2, ... (the
256 series of field elements that are inputs to POLYVAL) are the
257 concatenation of the padded additional data, the padded plaintext,
258 and the length block.
259
260 Calculate S_s = POLYVAL(message-authentication-key, X_1, X_2, ...).
261 XOR the first twelve bytes of S_s with the nonce and clear the most
262 significant bit of the last byte. Encrypt the result with AES using
263 the message-encryption key to produce the tag.
264
265 (It's worth highlighting a contrast with AES-GCM here: AES-GCM
266 authenticates the encoded additional data and ciphertext, while
267 AES-GCM-SIV authenticates the encoded additional data and plaintext.)
268
269 The encrypted plaintext is produced by using AES, with the message-
270 encryption key, in counter mode (see [<a href="#ref-SP800-38A">SP800-38A</a>], Section 6.5) on the
271 unpadded plaintext. The initial counter block is the tag with the
272 most significant bit of the last byte set to one. The counter
273
274
275
276 <span class="grey">Gueron, et al. Informational [Page 5]</span></pre>
277 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-6" ></span>
278 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
279
280
281 advances by incrementing the first 32 bits interpreted as an
282 unsigned, little-endian integer, wrapping at 2^32. The result of the
283 encryption is the encrypted plaintext (truncated to the length of the
284 plaintext), followed by the tag.
285
286 In pseudocode form, the encryption process can be expressed as:
287
288 func right_pad_to_multiple_of_16_bytes(input) {
289 while (bytelen(input) % 16 != 0) {
290 input = input ++ "\x00"
291 }
292 return input
293 }
294
295 func AES_CTR(key, initial_counter_block, in) {
296 block = initial_counter_block
297
298 output = ""
299 while bytelen(in) &gt; 0 {
300 keystream_block = AES(key = key, block = block)
301 block[0:4] = little_endian_uint32(
302 read_little_endian_uint32(block[0:4]) + 1)
303
304 todo = min(bytelen(in), bytelen(keystream_block)
305 for j = 0; j &lt; todo; j++ {
306 output = output ++ (keystream_block[j] ^ in[j])
307 }
308
309 in = in[todo:]
310 }
311
312 return output
313 }
314
315 func encrypt(key_generating_key,
316 nonce,
317 plaintext,
318 additional_data) {
319 if bytelen(plaintext) &gt; 2^36 {
320 fail()
321 }
322 if bytelen(additional_data) &gt; 2^36 {
323 fail()
324 }
325
326 message_encryption_key, message_authentication_key =
327 derive_keys(key_generating_key, nonce)
328
329
330
331
332 <span class="grey">Gueron, et al. Informational [Page 6]</span></pre>
333 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-7" ></span>
334 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
335
336
337 length_block =
338 little_endian_uint64(bytelen(additional_data) * 8) ++
339 little_endian_uint64(bytelen(plaintext) * 8)
340 padded_plaintext = right_pad_to_multiple_of_16_bytes(plaintext)
341 padded_ad = right_pad_to_multiple_of_16_bytes(additional_data)
342 S_s = POLYVAL(key = message_authentication_key,
343 input = padded_ad ++ padded_plaintext ++
344 length_block)
345 for i = 0; i &lt; 12; i++ {
346 S_s[i] ^= nonce[i]
347 }
348 S_s[15] &amp;= 0x7f
349 tag = AES(key = message_encryption_key, block = S_s)
350
351 counter_block = tag
352 counter_block[15] |= 0x80
353 return AES_CTR(key = message_encryption_key,
354 initial_counter_block = counter_block,
355 in = plaintext) ++
356 tag
357 }
358
359 <span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>. Decryption</span>
360
361 Decryption takes a 16- or 32-byte key-generating key, a 96-bit nonce,
362 and ciphertext and additional data byte strings of variable length.
363 It either fails or outputs a plaintext that is 16 bytes shorter than
364 the ciphertext.
365
366 To decrypt an AES-GCM-SIV ciphertext, first derive the message-
367 encryption and message-authentication keys in the same manner as when
368 encrypting.
369
370 If the ciphertext is less than 16 bytes or more than 2^36 + 16 bytes,
371 then fail. Otherwise, split the input into the encrypted plaintext
372 and a 16-byte tag. Decrypt the encrypted plaintext with the message-
373 encryption key in counter mode, where the initial counter block is
374 the tag with the most significant bit of the last byte set to one.
375 Advance the counter for each block in the same way as when
376 encrypting. At this point, the plaintext is unauthenticated and MUST
377 NOT be output until the following tag confirmation is complete:
378
379 Pad the additional data and plaintext with zeros until they are each
380 a multiple of 16 bytes, the AES block size. Calculate the length
381 block and X_1, X_2, ... as above and compute
382 S_s = POLYVAL(message-authentication-key, X_1, X_2, ...)
383
384
385
386
387
388 <span class="grey">Gueron, et al. Informational [Page 7]</span></pre>
389 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-8" ></span>
390 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
391
392
393 Compute the expected tag by XORing S_s and the nonce, clearing the
394 most significant bit of the last byte and encrypting with the
395 message-encryption key. Compare the provided and expected tag values
396 in constant time. Fail the decryption if they do not match (and do
397 not release the plaintext); otherwise, return the plaintext.
398
399 In pseudocode form, the decryption process can be expressed as:
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444 <span class="grey">Gueron, et al. Informational [Page 8]</span></pre>
445 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-9" ></span>
446 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
447
448
449 func decrypt(key_generating_key,
450 nonce,
451 ciphertext,
452 additional_data) {
453 if bytelen(ciphertext) &lt; 16 || bytelen(ciphertext) &gt; 2^36 + 16 {
454 fail()
455 }
456 if bytelen(additional_data) &gt; 2^36 {
457 fail()
458 }
459
460 message_encryption_key, message_authentication_key =
461 derive_keys(key_generating_key, nonce)
462
463 tag = ciphertext[bytelen(ciphertext)-16:]
464
465 counter_block = tag
466 counter_block[15] |= 0x80
467 plaintext = AES_CTR(key = message_encryption_key,
468 initial_counter_block = counter_block,
469 in = ciphertext[:bytelen(ciphertext)-16])
470
471 length_block =
472 little_endian_uint64(bytelen(additional_data) * 8) ++
473 little_endian_uint64(bytelen(plaintext) * 8)
474 padded_plaintext = right_pad_to_multiple_of_16_bytes(plaintext)
475 padded_ad = right_pad_to_multiple_of_16_bytes(additional_data)
476 S_s = POLYVAL(key = message_authentication_key,
477 input = padded_ad ++ padded_plaintext ++
478 length_block)
479 for i = 0; i &lt; 12; i++ {
480 S_s[i] ^= nonce[i]
481 }
482 S_s[15] &amp;= 0x7f
483 expected_tag = AES(key = message_encryption_key, block = S_s)
484
485 xor_sum = 0
486 for i := 0; i &lt; bytelen(expected_tag); i++ {
487 xor_sum |= expected_tag[i] ^ tag[i]
488 }
489
490 if xor_sum != 0 {
491 fail()
492 }
493
494 return plaintext
495 }
496
497
498
499
500 <span class="grey">Gueron, et al. Informational [Page 9]</span></pre>
501 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-10" ></span>
502 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
503
504
505 <span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>. AEADs</span>
506
507 We define two AEADs, in the format of <a href="./rfc5116">RFC 5116</a>, that use AES-GCM-SIV:
508 AEAD_AES_128_GCM_SIV and AEAD_AES_256_GCM_SIV. They differ only in
509 the size of the AES key used.
510
511 The key input to these AEADs becomes the key-generating key. Thus,
512 AEAD_AES_128_GCM_SIV takes a 16-byte key and AEAD_AES_256_GCM_SIV
513 takes a 32-byte key.
514
515 The parameters for AEAD_AES_128_GCM_SIV are then as follows:
516 K_LEN is 16, P_MAX is 2^36, A_MAX is 2^36, N_MIN and N_MAX are 12,
517 and C_MAX is 2^36 + 16.
518
519 The parameters for AEAD_AES_256_GCM_SIV differ only in the key size:
520 K_LEN is 32, P_MAX is 2^36, A_MAX is 2^36, N_MIN and N_MAX are 12,
521 and C_MAX is 2^36 + 16.
522
523 <span class="h2"><a class="selflink" id="section-7" href="#section-7">7</a>. Field Operation Examples</span>
524
525 Polynomials in this document will be written as 16-byte values. For
526 example, the sixteen bytes 01000000000000000000000000000492 would
527 represent the polynomial x^127 + x^124 + x^121 + x^114 + 1, which is
528 also the value of x^-128 in this field.
529
530 If a = 66e94bd4ef8a2c3b884cfa59ca342b2e and
531 b = ff000000000000000000000000000000,
532 then a + b = 99e94bd4ef8a2c3b884cfa59ca342b2e,
533 a * b = 37856175e9dc9df26ebc6d6171aa0ae9, and
534 dot(a, b) = ebe563401e7e91ea3ad6426b8140c394.
535
536 <span class="h2"><a class="selflink" id="section-8" href="#section-8">8</a>. Worked Example</span>
537
538 Consider the encryption of the plaintext "Hello world" with the
539 additional data "example" under key ee8e1ed9ff2540ae8f2ba9f50bc2f27c
540 using AEAD_AES_128_GCM_SIV. The random nonce that we'll use for this
541 example is 752abad3e0afb5f434dc4310.
542
543 In order to generate the message-authentication and message-
544 encryption keys, a counter is combined with the nonce to form four
545 blocks. These blocks are encrypted with the key given above:
546
547 Counter | Nonce Ciphertext
548 00000000752abad3e0afb5f434dc4310 -&gt; 310728d9911f1f38c40e952ca83d093e
549 01000000752abad3e0afb5f434dc4310 -&gt; 37b24316c3fab9a046ae90952daa0450
550 02000000752abad3e0afb5f434dc4310 -&gt; a4c5ae624996327947920b2d2412474b
551 03000000752abad3e0afb5f434dc4310 -&gt; c100be4d7e2c6edd1efef004305ab1e7
552
553
554
555
556 <span class="grey">Gueron, et al. Informational [Page 10]</span></pre>
557 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-11" ></span>
558 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
559
560
561 The latter halves of the ciphertext blocks are discarded and the
562 remaining bytes are concatenated to form the per-message keys. Thus,
563 the message-authentication key is 310728d9911f1f3837b24316c3fab9a0,
564 and the message-encryption key is a4c5ae6249963279c100be4d7e2c6edd.
565
566 The length block contains the encoding of the bit lengths of the
567 additional data and plaintext, respectively. The string "example" is
568 seven characters, thus 56 bits (or 0x38 in hex). The string "Hello
569 world" is 11 characters, or 88 = 0x58 bits. Thus, the length block
570 is 38000000000000005800000000000000.
571
572 The input to POLYVAL is the padded additional data, padded plaintext,
573 and then the length block. This is 6578616d706c650000000000000000004
574 8656c6c6f20776f726c64000000000038000000000000005800000000000000,
575 based on the ASCII encoding of "example" (6578616d706c65) and "Hello
576 world" (48656c6c6f20776f726c64).
577
578 Calling POLYVAL with the message-authentication key and the input
579 above results in S_s = ad7fcf0b5169851662672f3c5f95138f.
580
581 Before encrypting, the nonce is XORed in and the most significant bit
582 of the last byte is cleared. This gives
583 d85575d8b1c630e256bb6c2c5f95130f, because that bit happened to be one
584 previously. Encrypting with the message-encryption key (using
585 AES-128) gives the tag, which is 4fbcdeb7e4793f4a1d7e4faa70100af1.
586
587 In order to form the initial counter block, the most significant bit
588 of the last byte of the tag is set to one. That doesn't result in a
589 change in this example. Encrypting this with the message key (using
590 AES-128) gives the first block of the keystream:
591 1551f2c1787e81deac9a99f139540ab5.
592
593 The final ciphertext is the result of XORing the plaintext with the
594 keystream and appending the tag. That gives
595 5d349ead175ef6b1def6fd4fbcdeb7e4793f4a1d7e4faa70100af1.
596
597 <span class="h2"><a class="selflink" id="section-9" href="#section-9">9</a>. Security Considerations</span>
598
599 AES-GCM-SIV decryption involves first producing an unauthenticated
600 plaintext. This plaintext is vulnerable to manipulation by an
601 attacker; thus, if an implementation released some or all of the
602 plaintext before authenticating it, other parts of a system may
603 process malicious data as if it were authentic. AES-GCM might be
604 less likely to lead implementations to do this because there the
605 ciphertext is generally authenticated before, or concurrently with,
606 the plaintext calculation. Therefore, this text requires that
607 implementations MUST NOT release unauthenticated plaintext. Thus,
608 system designers should consider memory limitations when picking the
609
610
611
612 <span class="grey">Gueron, et al. Informational [Page 11]</span></pre>
613 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-12" ></span>
614 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
615
616
617 size of AES-GCM-SIV plaintexts: large plaintexts may not fit in the
618 available memory of some machines, tempting implementations to
619 release unverified plaintext.
620
621 A detailed cryptographic analysis of AES-GCM-SIV appears in
622 [<a href="#ref-AES-GCM-SIV">AES-GCM-SIV</a>], and the remainder of this section is a summary of that
623 paper.
624
625 The AEADs defined in this document calculate fresh AES keys for each
626 nonce. This allows a larger number of plaintexts to be encrypted
627 under a given key. Without this step, AES-GCM-SIV encryption would
628 be limited by the birthday bound like other standard modes (e.g.,
629 AES-GCM, AES-CCM [<a href="./rfc3610" title="&quot;Counter with CBC-MAC (CCM)&quot;">RFC3610</a>], and AES-SIV [<a href="./rfc5297" title="&quot;Synthetic Initialization Vector (SIV) Authenticated Encryption Using the Advanced Encryption Standard (AES)&quot;">RFC5297</a>]). This means that
630 when 2^64 blocks have been encrypted overall, a distinguishing
631 adversary who is trying to break the confidentiality of the scheme
632 has an advantage of 1/2. Thus, in order to limit the adversary's
633 advantage to 2^-32, at most 2^48 blocks can be encrypted overall. In
634 contrast, by deriving fresh keys from each nonce, it is possible to
635 encrypt a far larger number of messages and blocks with AES-GCM-SIV.
636
637 We stress that nonce misuse-resistant schemes guarantee that if a
638 nonce repeats, then the only security loss is that identical
639 plaintexts will produce identical ciphertexts. Since this can also
640 be a concern (as the fact that the same plaintext has been encrypted
641 twice is revealed), we do not recommend using a fixed nonce as a
642 policy. In addition, as we show below, better-than-birthday bounds
643 are achieved by AES-GCM-SIV when the nonce repetition rate is low.
644 Finally, as shown in [<a href="#ref-BHT18" title="&quot;Revisiting AES-GCM- SIV: Multi-user Security, Faster Key Derivation, and Better Bounds&quot;">BHT18</a>], there is a great security benefit in
645 the multiuser/multikey setting when each particular nonce is reused
646 by a small number of users only. We stress that the nonce misuse-
647 resistance property is not intended to be coupled with intentional
648 nonce reuse; rather, such schemes provide the best possible security
649 in the event of nonce reuse. Due to all of the above, it is
650 RECOMMENDED that AES-GCM-SIV nonces be randomly generated.
651
652 Some example usage bounds for AES-GCM-SIV are given below. The
653 adversary's advantage is the "AdvEnc" from [<a href="#ref-key-derive">key-derive</a>] and is
654 colloquially the ability of an attacker to distinguish ciphertexts
655 from random bit strings. The bounds below limit this advantage to
656 2^-32. For up to 256 uses of the same nonce and key (i.e., where one
657 can assume that nonce misuse is no more than this bound), the
658 following message limits should be respected (this assumes a short
659 additional authenticated data (AAD), i.e., less than 64 bytes):
660
661 2^29 messages, where each plaintext is at most 1 GiB
662
663 2^35 messages, where each plaintext is at most 128 MiB
664
665
666
667
668 <span class="grey">Gueron, et al. Informational [Page 12]</span></pre>
669 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-13" ></span>
670 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
671
672
673 2^49 messages, where each plaintext is at most 1 MiB
674
675 2^61 messages, where each plaintext is at most 16 KiB
676
677 Suzuki et al. [<a href="#ref-multi-birthday">multi-birthday</a>] show that even if nonces are selected
678 uniformly at random, the probability that one or more values would be
679 repeated 256 or more times is negligible until the number of nonces
680 reaches 2^102. (Specifically, the probability is 1/((2^96)^(255)) *
681 Binomial(q, 256), where q is the number of nonces.) Since 2^102 is
682 vastly greater than the limit on the number of plaintexts per key
683 given above, we don't feel that this limit on the number of repeated
684 nonces will be a problem. This also means that selecting nonces at
685 random is a safe practice with AES-GCM-SIV. The bounds obtained for
686 random nonces are as follows (as above, for these bounds, the
687 adversary's advantage is at most 2^-32):
688
689 2^32 messages, where each plaintext is at most 8 GiB
690
691 2^48 messages, where each plaintext is at most 32 MiB
692
693 2^64 messages, where each plaintext is at most 128 KiB
694
695 For situations where, for some reason, an even higher number of nonce
696 repeats is possible (e.g., in devices with very poor randomness), the
697 message limits need to be reconsidered. Theorem 7 in [<a href="#ref-AES-GCM-SIV">AES-GCM-SIV</a>]
698 contains more details, but for up to 1,024 repeats of each nonce, the
699 limits would be (again assuming a short AAD, i.e., less than 64
700 bytes):
701
702 2^25 messages, where each plaintext is at most 1 GiB
703
704 2^31 messages, where each plaintext is at most 128 MiB
705
706 2^45 messages, where each plaintext is at most 1 MiB
707
708 2^57 messages, where each plaintext is at most 16 KiB
709
710 In addition to calculating fresh AES keys for each nonce, these AEADs
711 also calculate fresh POLYVAL keys. Previous versions of GCM-SIV did
712 not do this and instead used part of the AEAD's key as the POLYVAL
713 key. Bleichenbacher pointed out [<a href="#ref-Bleichenbacher16">Bleichenbacher16</a>] that this allowed
714 an attacker who controlled the AEAD key to force the POLYVAL key to
715 be zero. If a user of this AEAD authenticated messages with a secret
716 additional-data value, then this would be insecure as the attacker
717 could calculate a valid authenticator without knowing the input.
718 This does not violate the standard properties of an AEAD as the
719
720
721
722
723
724 <span class="grey">Gueron, et al. Informational [Page 13]</span></pre>
725 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-14" ></span>
726 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
727
728
729 additional data is not assumed to be confidential. However, we want
730 these AEADs to be robust against plausible misuse and also to be
731 drop-in replacements for AES-GCM and so derive nonce-specific POLYVAL
732 keys to avoid this issue.
733
734 We also wish to note that the probability of successful forgery
735 increases with the number of attempts that an attacker is permitted.
736 The advantage defined in [<a href="#ref-key-derive">key-derive</a>] and used above is specified in
737 terms of the ability of an attacker to distinguish ciphertexts from
738 random bit strings. It thus covers both confidentiality and
739 integrity, and Theorem 6.2 in [<a href="#ref-key-derive">key-derive</a>] shows that the advantage
740 increases with the number of decryption attempts, although much more
741 slowly than with the number of encryptions; the dependence on the
742 number of decryption queries for forgery is actually only linear, not
743 quadratic. The latter is an artifact of the bound in the paper not
744 being tight. If an attacker is permitted extremely large numbers of
745 attempts, then the tiny probability that any given attempt succeeds
746 may sum to a non-trivial chance.
747
748 A security analysis of a similar scheme without nonce-based key
749 derivation appears in [<a href="#ref-GCM-SIV" title="&quot;GCM-SIV: Full Nonce Misuse- Resistant Authenticated Encryption at Under One Cycle Per Byte&quot;">GCM-SIV</a>], and a full analysis of the bounds
750 when applying nonce-based key derivation appears in [<a href="#ref-key-derive">key-derive</a>]. A
751 larger table of bounds and other information appears at
752 [<a href="#ref-aes-gcm-siv-homepage">aes-gcm-siv-homepage</a>].
753
754 The multiuser/multikey security of AES-GCM-SIV was studied by
755 [<a href="#ref-BHT18" title="&quot;Revisiting AES-GCM- SIV: Multi-user Security, Faster Key Derivation, and Better Bounds&quot;">BHT18</a>], which showed that security is almost the same as in the
756 single-user setting, as long as nonces do not repeat many times
757 across many users. This is the case when nonces are chosen randomly.
758
759 <span class="h2"><a class="selflink" id="section-10" href="#section-10">10</a>. IANA Considerations</span>
760
761 IANA has added two entries to the "AEAD Algorithms" registry:
762 AEAD_AES_128_GCM_SIV (Numeric ID 30) and AEAD_AES_256_GCM_SIV
763 (Numeric ID 31), both referencing this document as their
764 specification.
765
766 <span class="h2"><a class="selflink" id="section-11" href="#section-11">11</a>. References</span>
767
768 <span class="h3"><a class="selflink" id="section-11.1" href="#section-11.1">11.1</a>. Normative References</span>
769
770 [<a id="ref-RFC2119">RFC2119</a>] Bradner, S., "Key words for use in RFCs to Indicate
771 Requirement Levels", <a href="https://www.rfc-editor.org/bcp/bcp14">BCP 14</a>, <a href="./rfc2119">RFC 2119</a>,
772 DOI 10.17487/RFC2119, March 1997,
773 &lt;<a href="https://www.rfc-editor.org/info/rfc2119">https://www.rfc-editor.org/info/rfc2119</a>&gt;.
774
775
776
777
778
779
780 <span class="grey">Gueron, et al. Informational [Page 14]</span></pre>
781 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-15" ></span>
782 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
783
784
785 [<a id="ref-RFC8174">RFC8174</a>] Leiba, B., "Ambiguity of Uppercase vs Lowercase in <a href="./rfc2119">RFC</a>
786 <a href="./rfc2119">2119</a> Key Words", <a href="https://www.rfc-editor.org/bcp/bcp14">BCP 14</a>, <a href="./rfc8174">RFC 8174</a>, DOI 10.17487/RFC8174,
787 May 2017, &lt;<a href="https://www.rfc-editor.org/info/rfc8174">https://www.rfc-editor.org/info/rfc8174</a>&gt;.
788
789 [<a id="ref-SP800-38A">SP800-38A</a>]
790 Dworkin, M., "Recommendation for Block Cipher Modes of
791 Operation: Methods and Techniques", NIST SP 800-38A,
792 DOI 10.6028/NIST.SP.800-38A, December 2001,
793 &lt;<a href="https://csrc.nist.gov/publications/detail/sp/800-38a/final">https://csrc.nist.gov/publications/detail/sp/800-38a/</a>
794 <a href="https://csrc.nist.gov/publications/detail/sp/800-38a/final">final</a>&gt;.
795
796 <span class="h3"><a class="selflink" id="section-11.2" href="#section-11.2">11.2</a>. Informative References</span>
797
798 [<a id="ref-AES-GCM-SIV">AES-GCM-SIV</a>]
799 Gueron, S., Langley, A., and Y. Lindell, "AES-GCM-SIV:
800 Specification and Analysis", July 2017,
801 &lt;<a href="https://eprint.iacr.org/2017/168">https://eprint.iacr.org/2017/168</a>&gt;.
802
803 [<a id="ref-aes-gcm-siv-homepage">aes-gcm-siv-homepage</a>]
804 Gueron, S., Langley, A., and Y. Lindell, "Webpage for the
805 AES-GCM-SIV Mode of Operation",
806 &lt;<a href="https://cyber.biu.ac.il/aes-gcm-siv/">https://cyber.biu.ac.il/aes-gcm-siv/</a>&gt;.
807
808 [<a id="ref-BHT18">BHT18</a>] Bose, P., Hoang, V., and S. Tessaro, "Revisiting AES-GCM-
809 SIV: Multi-user Security, Faster Key Derivation, and
810 Better Bounds", Advances in Cryptology - EUROCRYPT 2018,
811 DOI 10.1007/978-3-319-78381-9_18, May 2018,
812 &lt;<a href="https://eprint.iacr.org/2018/136.pdf">https://eprint.iacr.org/2018/136.pdf</a>&gt;.
813
814 [<a id="ref-Bleichenbacher16">Bleichenbacher16</a>]
815 Bleichenbacher, D., "Subject: AES-GCM-SIV security of the
816 additional data", message to the cfrg mailing list, 24
817 June 2016, &lt;<a href="https://mailarchive.ietf.org/arch/msg/cfrg/qgh-Yxmj7CC7cq2YZLpmfGA3x-o">https://mailarchive.ietf.org/arch/msg/cfrg/</a>
818 <a href="https://mailarchive.ietf.org/arch/msg/cfrg/qgh-Yxmj7CC7cq2YZLpmfGA3x-o">qgh-Yxmj7CC7cq2YZLpmfGA3x-o</a>&gt;.
819
820 [<a id="ref-GCM">GCM</a>] Dworkin, M., "Recommendation for Block Cipher Modes of
821 Operation: Galois/Counter Mode (GCM) and GMAC", NIST
822 SP 800-38D, DOI 10.6028/NIST.SP.800-38D, November 2007,
823 &lt;<a href="https://csrc.nist.gov/publications/detail/sp/800-38d/final">https://csrc.nist.gov/publications/detail/sp/800-38d/</a>
824 <a href="https://csrc.nist.gov/publications/detail/sp/800-38d/final">final</a>&gt;.
825
826 [<a id="ref-GCM-SIV">GCM-SIV</a>] Gueron, S. and Y. Lindell, "GCM-SIV: Full Nonce Misuse-
827 Resistant Authenticated Encryption at Under One Cycle Per
828 Byte", Proceedings of the 22nd ACM SIGSAC Conference on
829 Computer and Communications Security,
830 DOI 10.1145/2810103.2813613, October 2015,
831 &lt;<a href="http://doi.acm.org/10.1145/2810103.2813613">http://doi.acm.org/10.1145/2810103.2813613</a>&gt;.
832
833
834
835
836 <span class="grey">Gueron, et al. Informational [Page 15]</span></pre>
837 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-16" ></span>
838 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
839
840
841 [<a id="ref-key-derive">key-derive</a>]
842 Gueron, S. and Y. Lindell, "Better Bounds for Block Cipher
843 Modes of Operation via Nonce-Based Key Derivation",
844 Proceedings of the 2017 ACM SIGSAC Conference on Computer
845 and Communications Security, DOI 10.1145/3133956.3133992,
846 2017, &lt;<a href="https://doi.org/10.1145/3133956.3133992">https://doi.org/10.1145/3133956.3133992</a>&gt;.
847
848 [<a id="ref-multi-birthday">multi-birthday</a>]
849 Suzuki, K., Tonien, D., Kurosawa, K., and K. Toyota,
850 "Birthday Paradox for Multi-collisions", Information
851 Security and Cryptology - ICISC 2006, Lecture Notes in
852 Computer Science, Volume 4296, DOI 10.1007/11927587_5,
853 2006, &lt;<a href="http://dx.doi.org/10.1007/11927587_5">http://dx.doi.org/10.1007/11927587_5</a>&gt;.
854
855 [<a id="ref-RFC3610">RFC3610</a>] Whiting, D., Housley, R., and N. Ferguson, "Counter with
856 CBC-MAC (CCM)", <a href="./rfc3610">RFC 3610</a>, DOI 10.17487/RFC3610, September
857 2003, &lt;<a href="https://www.rfc-editor.org/info/rfc3610">https://www.rfc-editor.org/info/rfc3610</a>&gt;.
858
859 [<a id="ref-RFC5116">RFC5116</a>] McGrew, D., "An Interface and Algorithms for Authenticated
860 Encryption", <a href="./rfc5116">RFC 5116</a>, DOI 10.17487/RFC5116, January 2008,
861 &lt;<a href="https://www.rfc-editor.org/info/rfc5116">https://www.rfc-editor.org/info/rfc5116</a>&gt;.
862
863 [<a id="ref-RFC5297">RFC5297</a>] Harkins, D., "Synthetic Initialization Vector (SIV)
864 Authenticated Encryption Using the Advanced Encryption
865 Standard (AES)", <a href="./rfc5297">RFC 5297</a>, DOI 10.17487/RFC5297, October
866 2008, &lt;<a href="https://www.rfc-editor.org/info/rfc5297">https://www.rfc-editor.org/info/rfc5297</a>&gt;.
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892 <span class="grey">Gueron, et al. Informational [Page 16]</span></pre>
893 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-17" ></span>
894 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
895
896
897 <span class="h2"><a class="selflink" id="appendix-A" href="#appendix-A">Appendix A</a>. The Relationship between POLYVAL and GHASH</span>
898
899 GHASH and POLYVAL both operate in GF(2^128), although with different
900 irreducible polynomials: POLYVAL works modulo x^128 + x^127 + x^126 +
901 x^121 + 1 and GHASH works modulo x^128 + x^7 + x^2 + x + 1. Note
902 that these irreducible polynomials are the "reverse" of each other.
903
904 GHASH also has a different mapping between 128-bit strings and field
905 elements. Whereas POLYVAL takes the least significant to most
906 significant bits of the first byte to be the coefficients of x^0 to
907 x^7, GHASH takes them to be the coefficients of x^7 to x^0. This
908 continues until, for the last byte, POLYVAL takes the least
909 significant to most significant bits to be the coefficients of x^120
910 to x^127, while GHASH takes them to be the coefficients of x^127 to
911 x^120.
912
913 The combination of these facts means that it's possible to "convert"
914 values between the two by reversing the order of the bytes in a
915 16-byte string. The differing interpretations of bit order takes
916 care of reversing the bits within each byte, and then reversing the
917 bytes does the rest. This may have a practical benefit for
918 implementations that wish to implement both GHASH and POLYVAL.
919
920 In order to be clear which field a given operation is performed in,
921 let mulX_GHASH be a function that takes a 16-byte string, converts it
922 to an element of GHASH's field using GHASH's convention, multiplies
923 it by x, and converts it back to a string. Likewise, let
924 mulX_POLYVAL be a function that converts a 16-byte string to an
925 element of POLYVAL's field using POLYVAL's convention, multiplies it
926 by x, and converts it back.
927
928 Given the 16-byte string 01000000000000000000000000000000, mulX_GHASH
929 of that string is 00800000000000000000000000000000 and mulX_POLYVAL
930 of that string is 02000000000000000000000000000000. As a more
931 general example, given 9c98c04df9387ded828175a92ba652d8, mulX_GHASH
932 of that string is 4e4c6026fc9c3ef6c140bad495d3296c and mulX_POLYVAL
933 of it is 3931819bf271fada0503eb52574ca5f2.
934
935 Lastly, let ByteReverse be the function that takes a 16-byte string
936 and returns a copy where the order of the bytes has been reversed.
937
938
939
940
941
942
943
944
945
946
947
948 <span class="grey">Gueron, et al. Informational [Page 17]</span></pre>
949 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-18" ></span>
950 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
951
952
953 Now GHASH and POLYVAL can be defined in terms of one another:
954
955 POLYVAL(H, X_1, ..., X_n) =
956 ByteReverse(GHASH(mulX_GHASH(ByteReverse(H)), ByteReverse(X_1), ...,
957 ByteReverse(X_n)))
958
959 GHASH(H, X_1, ..., X_n) =
960 ByteReverse(POLYVAL(mulX_POLYVAL(ByteReverse(H)), ByteReverse(X_1),
961 ..., ByteReverse(X_n)))
962
963 As a worked example:
964 let H = 25629347589242761d31f826ba4b757b,
965 X_1 = 4f4f95668c83dfb6401762bb2d01a262, and
966 X_2 = d1a24ddd2721d006bbe45f20d3c9f362.
967 POLYVAL(H, X_1, X_2) = f7a3b47b846119fae5b7866cf5e5b77e.
968
969 If we wished to calculate this given only an implementation of GHASH,
970 then the key for GHASH would be
971
972 mulX_GHASH(ByteReverse(H)) = dcbaa5dd137c188ebb21492c23c9b112.
973
974 Then ByteReverse(GHASH(dcba..., ByteReverse(X_1), ByteReverse(X_2)))
975 = f7a3b47b846119fae5b7866cf5e5b77e, as required.
976
977 In the other direction, GHASH(H, X_1, X_2) =
978 bd9b3997046731fb96251b91f9c99d7a. If we wished to calculate this
979 given only an implementation of POLYVAL, then we would first
980 calculate the key for POLYVAL:
981
982 mulX_POLYVAL(ByteReverse(H)) = f6ea96744df0633aec8424b18e26c54a.
983
984 Then ByteReverse(POLYVAL(f6ea..., ByteReverse(X_1), ByteReverse(X_2)))
985 = bd9b3997046731fb96251b91f9c99d7a.
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004 <span class="grey">Gueron, et al. Informational [Page 18]</span></pre>
1005 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-19" ></span>
1006 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
1007
1008
1009 <span class="h2"><a class="selflink" id="appendix-B" href="#appendix-B">Appendix B</a>. Additional Comparisons with AES-GCM</span>
1010
1011 Some functional properties that differ between AES-GCM and AES-GCM-
1012 SIV that are also worth noting:
1013
1014 AES-GCM allows plaintexts to be encrypted in a streaming fashion --
1015 i.e., the beginning of the plaintext can be encrypted and transmitted
1016 before the entire message has been processed. AES-GCM-SIV requires
1017 two passes for encryption and so cannot do this.
1018
1019 AES-GCM allows a constant additional-data input to be precomputed in
1020 order to save per-message computation. AES-GCM-SIV varies the
1021 authenticator key based on the nonce and so does not permit this.
1022
1023 The performance for AES-GCM versus AES-GCM-SIV on small machines can
1024 be roughly characterized by the number of AES operations and the
1025 number of GF(2^128) multiplications needed to process a message.
1026
1027 Let a = (bytelen(additional-data) + 15) / 16 and
1028 p = (bytelen(plaintext) + 15) / 16.
1029
1030 Then AES-GCM requires p + 1 AES operations and p + a + 1 field
1031 multiplications.
1032
1033 Defined similarly, AES-GCM-SIV with AES-128 requires p + 5 AES
1034 operations and p + a + 1 field multiplications. With AES-256, that
1035 becomes p + 7 AES operations.
1036
1037 With large machines, the available parallelism becomes far more
1038 important, and such simple performance analysis is no longer
1039 representative. For such machines, we find that decryption of AES-
1040 GCM-SIV is only about 5% slower than AES-GCM, as long as the message
1041 is at least a couple of kilobytes. Encryption tends to run about
1042 two-thirds the speed because of the additional pass required.
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060 <span class="grey">Gueron, et al. Informational [Page 19]</span></pre>
1061 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-20" ></span>
1062 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
1063
1064
1065 <span class="h2"><a class="selflink" id="appendix-C" href="#appendix-C">Appendix C</a>. Test Vectors</span>
1066
1067 <span class="h3"><a class="selflink" id="appendix-C.1" href="#appendix-C.1">C.1</a>. AEAD_AES_128_GCM_SIV</span>
1068
1069 Plaintext (0 bytes) =
1070 AAD (0 bytes) =
1071 Key = 01000000000000000000000000000000
1072 Nonce = 030000000000000000000000
1073 Record authentication key = d9b360279694941ac5dbc6987ada7377
1074 Record encryption key = 4004a0dcd862f2a57360219d2d44ef6c
1075 POLYVAL input = 00000000000000000000000000000000
1076 POLYVAL result = 00000000000000000000000000000000
1077 POLYVAL result XOR nonce = 03000000000000000000000000000000
1078 ... and masked = 03000000000000000000000000000000
1079 Tag = dc20e2d83f25705bb49e439eca56de25
1080 Initial counter = dc20e2d83f25705bb49e439eca56dea5
1081 Result (16 bytes) = dc20e2d83f25705bb49e439eca56de25
1082
1083
1084 Plaintext (8 bytes) = 0100000000000000
1085 AAD (0 bytes) =
1086 Key = 01000000000000000000000000000000
1087 Nonce = 030000000000000000000000
1088 Record authentication key = d9b360279694941ac5dbc6987ada7377
1089 Record encryption key = 4004a0dcd862f2a57360219d2d44ef6c
1090 POLYVAL input = 01000000000000000000000000000000
1091 00000000000000004000000000000000
1092 POLYVAL result = eb93b7740962c5e49d2a90a7dc5cec74
1093 POLYVAL result XOR nonce = e893b7740962c5e49d2a90a7dc5cec74
1094 ... and masked = e893b7740962c5e49d2a90a7dc5cec74
1095 Tag = 578782fff6013b815b287c22493a364c
1096 Initial counter = 578782fff6013b815b287c22493a36cc
1097 Result (24 bytes) = b5d839330ac7b786578782fff6013b81
1098 5b287c22493a364c
1099
1100
1101 Plaintext (12 bytes) = 010000000000000000000000
1102 AAD (0 bytes) =
1103 Key = 01000000000000000000000000000000
1104 Nonce = 030000000000000000000000
1105 Record authentication key = d9b360279694941ac5dbc6987ada7377
1106 Record encryption key = 4004a0dcd862f2a57360219d2d44ef6c
1107 POLYVAL input = 01000000000000000000000000000000
1108 00000000000000006000000000000000
1109 POLYVAL result = 48eb6c6c5a2dbe4a1dde508fee06361b
1110 POLYVAL result XOR nonce = 4beb6c6c5a2dbe4a1dde508fee06361b
1111 ... and masked = 4beb6c6c5a2dbe4a1dde508fee06361b
1112 Tag = a4978db357391a0bc4fdec8b0d106639
1113
1114
1115
1116 <span class="grey">Gueron, et al. Informational [Page 20]</span></pre>
1117 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-21" ></span>
1118 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
1119
1120
1121 Initial counter = a4978db357391a0bc4fdec8b0d1066b9
1122 Result (28 bytes) = 7323ea61d05932260047d942a4978db3
1123 57391a0bc4fdec8b0d106639
1124
1125
1126 Plaintext (16 bytes) = 01000000000000000000000000000000
1127 AAD (0 bytes) =
1128 Key = 01000000000000000000000000000000
1129 Nonce = 030000000000000000000000
1130 Record authentication key = d9b360279694941ac5dbc6987ada7377
1131 Record encryption key = 4004a0dcd862f2a57360219d2d44ef6c
1132 POLYVAL input = 01000000000000000000000000000000
1133 00000000000000008000000000000000
1134 POLYVAL result = 20806c26e3c1de019e111255708031d6
1135 POLYVAL result XOR nonce = 23806c26e3c1de019e111255708031d6
1136 ... and masked = 23806c26e3c1de019e11125570803156
1137 Tag = 303aaf90f6fe21199c6068577437a0c4
1138 Initial counter = 303aaf90f6fe21199c6068577437a0c4
1139 Result (32 bytes) = 743f7c8077ab25f8624e2e948579cf77
1140 303aaf90f6fe21199c6068577437a0c4
1141
1142
1143 Plaintext (32 bytes) = 01000000000000000000000000000000
1144 02000000000000000000000000000000
1145 AAD (0 bytes) =
1146 Key = 01000000000000000000000000000000
1147 Nonce = 030000000000000000000000
1148 Record authentication key = d9b360279694941ac5dbc6987ada7377
1149 Record encryption key = 4004a0dcd862f2a57360219d2d44ef6c
1150 POLYVAL input = 01000000000000000000000000000000
1151 02000000000000000000000000000000
1152 00000000000000000001000000000000
1153 POLYVAL result = ce6edc9a50b36d9a98986bbf6a261c3b
1154 POLYVAL result XOR nonce = cd6edc9a50b36d9a98986bbf6a261c3b
1155 ... and masked = cd6edc9a50b36d9a98986bbf6a261c3b
1156 Tag = 1a8e45dcd4578c667cd86847bf6155ff
1157 Initial counter = 1a8e45dcd4578c667cd86847bf6155ff
1158 Result (48 bytes) = 84e07e62ba83a6585417245d7ec413a9
1159 fe427d6315c09b57ce45f2e3936a9445
1160 1a8e45dcd4578c667cd86847bf6155ff
1161
1162
1163 Plaintext (48 bytes) = 01000000000000000000000000000000
1164 02000000000000000000000000000000
1165 03000000000000000000000000000000
1166 AAD (0 bytes) =
1167 Key = 01000000000000000000000000000000
1168 Nonce = 030000000000000000000000
1169
1170
1171
1172 <span class="grey">Gueron, et al. Informational [Page 21]</span></pre>
1173 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-22" ></span>
1174 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
1175
1176
1177 Record authentication key = d9b360279694941ac5dbc6987ada7377
1178 Record encryption key = 4004a0dcd862f2a57360219d2d44ef6c
1179 POLYVAL input = 01000000000000000000000000000000
1180 02000000000000000000000000000000
1181 03000000000000000000000000000000
1182 00000000000000008001000000000000
1183 POLYVAL result = 81388746bc22d26b2abc3dcb15754222
1184 POLYVAL result XOR nonce = 82388746bc22d26b2abc3dcb15754222
1185 ... and masked = 82388746bc22d26b2abc3dcb15754222
1186 Tag = 5e6e311dbf395d35b0fe39c2714388f8
1187 Initial counter = 5e6e311dbf395d35b0fe39c2714388f8
1188 Result (64 bytes) = 3fd24ce1f5a67b75bf2351f181a475c7
1189 b800a5b4d3dcf70106b1eea82fa1d64d
1190 f42bf7226122fa92e17a40eeaac1201b
1191 5e6e311dbf395d35b0fe39c2714388f8
1192
1193
1194 Plaintext (64 bytes) = 01000000000000000000000000000000
1195 02000000000000000000000000000000
1196 03000000000000000000000000000000
1197 04000000000000000000000000000000
1198 AAD (0 bytes) =
1199 Key = 01000000000000000000000000000000
1200 Nonce = 030000000000000000000000
1201 Record authentication key = d9b360279694941ac5dbc6987ada7377
1202 Record encryption key = 4004a0dcd862f2a57360219d2d44ef6c
1203 POLYVAL input = 01000000000000000000000000000000
1204 02000000000000000000000000000000
1205 03000000000000000000000000000000
1206 04000000000000000000000000000000
1207 00000000000000000002000000000000
1208 POLYVAL result = 1e39b6d3344d348f6044f89935d1cf78
1209 POLYVAL result XOR nonce = 1d39b6d3344d348f6044f89935d1cf78
1210 ... and masked = 1d39b6d3344d348f6044f89935d1cf78
1211 Tag = 8a263dd317aa88d56bdf3936dba75bb8
1212 Initial counter = 8a263dd317aa88d56bdf3936dba75bb8
1213 Result (80 bytes) = 2433668f1058190f6d43e360f4f35cd8
1214 e475127cfca7028ea8ab5c20f7ab2af0
1215 2516a2bdcbc08d521be37ff28c152bba
1216 36697f25b4cd169c6590d1dd39566d3f
1217 8a263dd317aa88d56bdf3936dba75bb8
1218
1219
1220 Plaintext (8 bytes) = 0200000000000000
1221 AAD (1 bytes) = 01
1222 Key = 01000000000000000000000000000000
1223 Nonce = 030000000000000000000000
1224 Record authentication key = d9b360279694941ac5dbc6987ada7377
1225
1226
1227
1228 <span class="grey">Gueron, et al. Informational [Page 22]</span></pre>
1229 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-23" ></span>
1230 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
1231
1232
1233 Record encryption key = 4004a0dcd862f2a57360219d2d44ef6c
1234 POLYVAL input = 01000000000000000000000000000000
1235 02000000000000000000000000000000
1236 08000000000000004000000000000000
1237 POLYVAL result = b26781e7e2c1376f96bec195f3709b2a
1238 POLYVAL result XOR nonce = b16781e7e2c1376f96bec195f3709b2a
1239 ... and masked = b16781e7e2c1376f96bec195f3709b2a
1240 Tag = 3b0a1a2560969cdf790d99759abd1508
1241 Initial counter = 3b0a1a2560969cdf790d99759abd1588
1242 Result (24 bytes) = 1e6daba35669f4273b0a1a2560969cdf
1243 790d99759abd1508
1244
1245
1246 Plaintext (12 bytes) = 020000000000000000000000
1247 AAD (1 bytes) = 01
1248 Key = 01000000000000000000000000000000
1249 Nonce = 030000000000000000000000
1250 Record authentication key = d9b360279694941ac5dbc6987ada7377
1251 Record encryption key = 4004a0dcd862f2a57360219d2d44ef6c
1252 POLYVAL input = 01000000000000000000000000000000
1253 02000000000000000000000000000000
1254 08000000000000006000000000000000
1255 POLYVAL result = 111f5affb18e4cc1164a01bdc12a4145
1256 POLYVAL result XOR nonce = 121f5affb18e4cc1164a01bdc12a4145
1257 ... and masked = 121f5affb18e4cc1164a01bdc12a4145
1258 Tag = 08299c5102745aaa3a0c469fad9e075a
1259 Initial counter = 08299c5102745aaa3a0c469fad9e07da
1260 Result (28 bytes) = 296c7889fd99f41917f4462008299c51
1261 02745aaa3a0c469fad9e075a
1262
1263
1264 Plaintext (16 bytes) = 02000000000000000000000000000000
1265 AAD (1 bytes) = 01
1266 Key = 01000000000000000000000000000000
1267 Nonce = 030000000000000000000000
1268 Record authentication key = d9b360279694941ac5dbc6987ada7377
1269 Record encryption key = 4004a0dcd862f2a57360219d2d44ef6c
1270 POLYVAL input = 01000000000000000000000000000000
1271 02000000000000000000000000000000
1272 08000000000000008000000000000000
1273 POLYVAL result = 79745ab508622c8a958543675fac4688
1274 POLYVAL result XOR nonce = 7a745ab508622c8a958543675fac4688
1275 ... and masked = 7a745ab508622c8a958543675fac4608
1276 Tag = 8f8936ec039e4e4bb97ebd8c4457441f
1277 Initial counter = 8f8936ec039e4e4bb97ebd8c4457449f
1278 Result (32 bytes) = e2b0c5da79a901c1745f700525cb335b
1279 8f8936ec039e4e4bb97ebd8c4457441f
1280
1281
1282
1283
1284 <span class="grey">Gueron, et al. Informational [Page 23]</span></pre>
1285 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-24" ></span>
1286 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
1287
1288
1289 Plaintext (32 bytes) = 02000000000000000000000000000000
1290 03000000000000000000000000000000
1291 AAD (1 bytes) = 01
1292 Key = 01000000000000000000000000000000
1293 Nonce = 030000000000000000000000
1294 Record authentication key = d9b360279694941ac5dbc6987ada7377
1295 Record encryption key = 4004a0dcd862f2a57360219d2d44ef6c
1296 POLYVAL input = 01000000000000000000000000000000
1297 02000000000000000000000000000000
1298 03000000000000000000000000000000
1299 08000000000000000001000000000000
1300 POLYVAL result = 2ce7daaf7c89490822051255b12eca6b
1301 POLYVAL result XOR nonce = 2fe7daaf7c89490822051255b12eca6b
1302 ... and masked = 2fe7daaf7c89490822051255b12eca6b
1303 Tag = e6af6a7f87287da059a71684ed3498e1
1304 Initial counter = e6af6a7f87287da059a71684ed3498e1
1305 Result (48 bytes) = 620048ef3c1e73e57e02bb8562c416a3
1306 19e73e4caac8e96a1ecb2933145a1d71
1307 e6af6a7f87287da059a71684ed3498e1
1308
1309
1310 Plaintext (48 bytes) = 02000000000000000000000000000000
1311 03000000000000000000000000000000
1312 04000000000000000000000000000000
1313 AAD (1 bytes) = 01
1314 Key = 01000000000000000000000000000000
1315 Nonce = 030000000000000000000000
1316 Record authentication key = d9b360279694941ac5dbc6987ada7377
1317 Record encryption key = 4004a0dcd862f2a57360219d2d44ef6c
1318 POLYVAL input = 01000000000000000000000000000000
1319 02000000000000000000000000000000
1320 03000000000000000000000000000000
1321 04000000000000000000000000000000
1322 08000000000000008001000000000000
1323 POLYVAL result = 9ca987715d69c1786711dfcd22f830fc
1324 POLYVAL result XOR nonce = 9fa987715d69c1786711dfcd22f830fc
1325 ... and masked = 9fa987715d69c1786711dfcd22f8307c
1326 Tag = 6a8cc3865f76897c2e4b245cf31c51f2
1327 Initial counter = 6a8cc3865f76897c2e4b245cf31c51f2
1328 Result (64 bytes) = 50c8303ea93925d64090d07bd109dfd9
1329 515a5a33431019c17d93465999a8b005
1330 3201d723120a8562b838cdff25bf9d1e
1331 6a8cc3865f76897c2e4b245cf31c51f2
1332
1333
1334 Plaintext (64 bytes) = 02000000000000000000000000000000
1335 03000000000000000000000000000000
1336 04000000000000000000000000000000
1337
1338
1339
1340 <span class="grey">Gueron, et al. Informational [Page 24]</span></pre>
1341 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-25" ></span>
1342 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
1343
1344
1345 05000000000000000000000000000000
1346 AAD (1 bytes) = 01
1347 Key = 01000000000000000000000000000000
1348 Nonce = 030000000000000000000000
1349 Record authentication key = d9b360279694941ac5dbc6987ada7377
1350 Record encryption key = 4004a0dcd862f2a57360219d2d44ef6c
1351 POLYVAL input = 01000000000000000000000000000000
1352 02000000000000000000000000000000
1353 03000000000000000000000000000000
1354 04000000000000000000000000000000
1355 05000000000000000000000000000000
1356 08000000000000000002000000000000
1357 POLYVAL result = ffcd05d5770f34ad9267f0a59994b15a
1358 POLYVAL result XOR nonce = fccd05d5770f34ad9267f0a59994b15a
1359 ... and masked = fccd05d5770f34ad9267f0a59994b15a
1360 Tag = cdc46ae475563de037001ef84ae21744
1361 Initial counter = cdc46ae475563de037001ef84ae217c4
1362 Result (80 bytes) = 2f5c64059db55ee0fb847ed513003746
1363 aca4e61c711b5de2e7a77ffd02da42fe
1364 ec601910d3467bb8b36ebbaebce5fba3
1365 0d36c95f48a3e7980f0e7ac299332a80
1366 cdc46ae475563de037001ef84ae21744
1367
1368
1369 Plaintext (4 bytes) = 02000000
1370 AAD (12 bytes) = 010000000000000000000000
1371 Key = 01000000000000000000000000000000
1372 Nonce = 030000000000000000000000
1373 Record authentication key = d9b360279694941ac5dbc6987ada7377
1374 Record encryption key = 4004a0dcd862f2a57360219d2d44ef6c
1375 POLYVAL input = 01000000000000000000000000000000
1376 02000000000000000000000000000000
1377 60000000000000002000000000000000
1378 POLYVAL result = f6ce9d3dcd68a2fd603c7ecc18fb9918
1379 POLYVAL result XOR nonce = f5ce9d3dcd68a2fd603c7ecc18fb9918
1380 ... and masked = f5ce9d3dcd68a2fd603c7ecc18fb9918
1381 Tag = 07eb1f84fb28f8cb73de8e99e2f48a14
1382 Initial counter = 07eb1f84fb28f8cb73de8e99e2f48a94
1383 Result (20 bytes) = a8fe3e8707eb1f84fb28f8cb73de8e99
1384 e2f48a14
1385
1386
1387 Plaintext (20 bytes) = 03000000000000000000000000000000
1388 04000000
1389 AAD (18 bytes) = 01000000000000000000000000000000
1390 0200
1391 Key = 01000000000000000000000000000000
1392 Nonce = 030000000000000000000000
1393
1394
1395
1396 <span class="grey">Gueron, et al. Informational [Page 25]</span></pre>
1397 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-26" ></span>
1398 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
1399
1400
1401 Record authentication key = d9b360279694941ac5dbc6987ada7377
1402 Record encryption key = 4004a0dcd862f2a57360219d2d44ef6c
1403 POLYVAL input = 01000000000000000000000000000000
1404 02000000000000000000000000000000
1405 03000000000000000000000000000000
1406 04000000000000000000000000000000
1407 9000000000000000a000000000000000
1408 POLYVAL result = 4781d492cb8f926c504caa36f61008fe
1409 POLYVAL result XOR nonce = 4481d492cb8f926c504caa36f61008fe
1410 ... and masked = 4481d492cb8f926c504caa36f610087e
1411 Tag = 24afc9805e976f451e6d87f6fe106514
1412 Initial counter = 24afc9805e976f451e6d87f6fe106594
1413 Result (36 bytes) = 6bb0fecf5ded9b77f902c7d5da236a43
1414 91dd029724afc9805e976f451e6d87f6
1415 fe106514
1416
1417
1418 Plaintext (18 bytes) = 03000000000000000000000000000000
1419 0400
1420 AAD (20 bytes) = 01000000000000000000000000000000
1421 02000000
1422 Key = 01000000000000000000000000000000
1423 Nonce = 030000000000000000000000
1424 Record authentication key = d9b360279694941ac5dbc6987ada7377
1425 Record encryption key = 4004a0dcd862f2a57360219d2d44ef6c
1426 POLYVAL input = 01000000000000000000000000000000
1427 02000000000000000000000000000000
1428 03000000000000000000000000000000
1429 04000000000000000000000000000000
1430 a0000000000000009000000000000000
1431 POLYVAL result = 75cbc23a1a10e348aeb8e384b5cc79fd
1432 POLYVAL result XOR nonce = 76cbc23a1a10e348aeb8e384b5cc79fd
1433 ... and masked = 76cbc23a1a10e348aeb8e384b5cc797d
1434 Tag = bff9b2ef00fb47920cc72a0c0f13b9fd
1435 Initial counter = bff9b2ef00fb47920cc72a0c0f13b9fd
1436 Result (34 bytes) = 44d0aaf6fb2f1f34add5e8064e83e12a
1437 2adabff9b2ef00fb47920cc72a0c0f13
1438 b9fd
1439
1440 Plaintext (0 bytes) =
1441 AAD (0 bytes) =
1442 Key = e66021d5eb8e4f4066d4adb9c33560e4
1443 Nonce = f46e44bb3da0015c94f70887
1444 Record authentication key = 036ee1fe2d7926af68898095e54e7b3c
1445 Record encryption key = 5e46482396008223b5c1d25173d87539
1446 POLYVAL input = 00000000000000000000000000000000
1447 POLYVAL result = 00000000000000000000000000000000
1448 POLYVAL result XOR nonce = f46e44bb3da0015c94f7088700000000
1449
1450
1451
1452 <span class="grey">Gueron, et al. Informational [Page 26]</span></pre>
1453 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-27" ></span>
1454 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
1455
1456
1457 ... and masked = f46e44bb3da0015c94f7088700000000
1458 Tag = a4194b79071b01a87d65f706e3949578
1459 Initial counter = a4194b79071b01a87d65f706e39495f8
1460 Result (16 bytes) = a4194b79071b01a87d65f706e3949578
1461
1462
1463 Plaintext (3 bytes) = 7a806c
1464 AAD (5 bytes) = 46bb91c3c5
1465 Key = 36864200e0eaf5284d884a0e77d31646
1466 Nonce = bae8e37fc83441b16034566b
1467 Record authentication key = 3e28de1120b2981a0155795ca2812af6
1468 Record encryption key = 6d4b78b31a4c9c03d8db0f42f7507fae
1469 POLYVAL input = 46bb91c3c50000000000000000000000
1470 7a806c00000000000000000000000000
1471 28000000000000001800000000000000
1472 POLYVAL result = 43d9a745511dcfa21b96dd606f1d5720
1473 POLYVAL result XOR nonce = f931443a99298e137ba28b0b6f1d5720
1474 ... and masked = f931443a99298e137ba28b0b6f1d5720
1475 Tag = 711bd85bc1e4d3e0a462e074eea428a8
1476 Initial counter = 711bd85bc1e4d3e0a462e074eea428a8
1477 Result (19 bytes) = af60eb711bd85bc1e4d3e0a462e074ee
1478 a428a8
1479
1480
1481 Plaintext (6 bytes) = bdc66f146545
1482 AAD (10 bytes) = fc880c94a95198874296
1483 Key = aedb64a6c590bc84d1a5e269e4b47801
1484 Nonce = afc0577e34699b9e671fdd4f
1485 Record authentication key = 43b8de9cea62330d15cccfc84a33e8c8
1486 Record encryption key = 8e54631607e431e095b54852868e3a27
1487 POLYVAL input = fc880c94a95198874296000000000000
1488 bdc66f14654500000000000000000000
1489 50000000000000003000000000000000
1490 POLYVAL result = 26498e0d2b1ef004e808c458e8f2f515
1491 POLYVAL result XOR nonce = 8989d9731f776b9a8f171917e8f2f515
1492 ... and masked = 8989d9731f776b9a8f171917e8f2f515
1493 Tag = d6a9c45545cfc11f03ad743dba20f966
1494 Initial counter = d6a9c45545cfc11f03ad743dba20f9e6
1495 Result (22 bytes) = bb93a3e34d3cd6a9c45545cfc11f03ad
1496 743dba20f966
1497
1498
1499 Plaintext (9 bytes) = 1177441f195495860f
1500 AAD (15 bytes) = 046787f3ea22c127aaf195d1894728
1501 Key = d5cc1fd161320b6920ce07787f86743b
1502 Nonce = 275d1ab32f6d1f0434d8848c
1503 Record authentication key = 8a51df64d93eaf667c2c09bd454ce5c5
1504 Record encryption key = 43ab276c2b4a473918ca73f2dd85109c
1505
1506
1507
1508 <span class="grey">Gueron, et al. Informational [Page 27]</span></pre>
1509 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-28" ></span>
1510 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
1511
1512
1513 POLYVAL input = 046787f3ea22c127aaf195d189472800
1514 1177441f195495860f00000000000000
1515 78000000000000004800000000000000
1516 POLYVAL result = 63a3451c0b23345ad02bba59956517cf
1517 POLYVAL result XOR nonce = 44fe5faf244e2b5ee4f33ed5956517cf
1518 ... and masked = 44fe5faf244e2b5ee4f33ed59565174f
1519 Tag = 1d02fd0cd174c84fc5dae2f60f52fd2b
1520 Initial counter = 1d02fd0cd174c84fc5dae2f60f52fdab
1521 Result (25 bytes) = 4f37281f7ad12949d01d02fd0cd174c8
1522 4fc5dae2f60f52fd2b
1523
1524
1525 Plaintext (12 bytes) = 9f572c614b4745914474e7c7
1526 AAD (20 bytes) = c9882e5386fd9f92ec489c8fde2be2cf
1527 97e74e93
1528 Key = b3fed1473c528b8426a582995929a149
1529 Nonce = 9e9ad8780c8d63d0ab4149c0
1530 Record authentication key = 22f50707a95dd416df069d670cb775e8
1531 Record encryption key = f674a5584ee21fe97b4cebc468ab61e4
1532 POLYVAL input = c9882e5386fd9f92ec489c8fde2be2cf
1533 97e74e93000000000000000000000000
1534 9f572c614b4745914474e7c700000000
1535 a0000000000000006000000000000000
1536 POLYVAL result = 0cca0423fba9d77fe7e2e6963b08cdd0
1537 POLYVAL result XOR nonce = 9250dc5bf724b4af4ca3af563b08cdd0
1538 ... and masked = 9250dc5bf724b4af4ca3af563b08cd50
1539 Tag = c1dc2f871fb7561da1286e655e24b7b0
1540 Initial counter = c1dc2f871fb7561da1286e655e24b7b0
1541 Result (28 bytes) = f54673c5ddf710c745641c8bc1dc2f87
1542 1fb7561da1286e655e24b7b0
1543
1544
1545 Plaintext (15 bytes) = 0d8c8451178082355c9e940fea2f58
1546 AAD (25 bytes) = 2950a70d5a1db2316fd568378da107b5
1547 2b0da55210cc1c1b0a
1548 Key = 2d4ed87da44102952ef94b02b805249b
1549 Nonce = ac80e6f61455bfac8308a2d4
1550 Record authentication key = 0b00a29a83e7e95b92e3a0783b29f140
1551 Record encryption key = a430c27f285aed913005975c42eed5f3
1552 POLYVAL input = 2950a70d5a1db2316fd568378da107b5
1553 2b0da55210cc1c1b0a00000000000000
1554 0d8c8451178082355c9e940fea2f5800
1555 c8000000000000007800000000000000
1556 POLYVAL result = 1086ef25247aa41009bbc40871d9b350
1557 POLYVAL result XOR nonce = bc0609d3302f1bbc8ab366dc71d9b350
1558 ... and masked = bc0609d3302f1bbc8ab366dc71d9b350
1559 Tag = 83b3449b9f39552de99dc214a1190b0b
1560 Initial counter = 83b3449b9f39552de99dc214a1190b8b
1561
1562
1563
1564 <span class="grey">Gueron, et al. Informational [Page 28]</span></pre>
1565 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-29" ></span>
1566 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
1567
1568
1569 Result (31 bytes) = c9ff545e07b88a015f05b274540aa183
1570 b3449b9f39552de99dc214a1190b0b
1571
1572
1573 Plaintext (18 bytes) = 6b3db4da3d57aa94842b9803a96e07fb
1574 6de7
1575 AAD (30 bytes) = 1860f762ebfbd08284e421702de0de18
1576 baa9c9596291b08466f37de21c7f
1577 Key = bde3b2f204d1e9f8b06bc47f9745b3d1
1578 Nonce = ae06556fb6aa7890bebc18fe
1579 Record authentication key = 21c874a8bad3603d1c3e8784df5b3f9f
1580 Record encryption key = d1c16d72651c3df504eae27129d818e8
1581 POLYVAL input = 1860f762ebfbd08284e421702de0de18
1582 baa9c9596291b08466f37de21c7f0000
1583 6b3db4da3d57aa94842b9803a96e07fb
1584 6de70000000000000000000000000000
1585 f0000000000000009000000000000000
1586 POLYVAL result = 55462a5afa0da8d646481e049ef9c764
1587 POLYVAL result XOR nonce = fb407f354ca7d046f8f406fa9ef9c764
1588 ... and masked = fb407f354ca7d046f8f406fa9ef9c764
1589 Tag = 3e377094f04709f64d7b985310a4db84
1590 Initial counter = 3e377094f04709f64d7b985310a4db84
1591 Result (34 bytes) = 6298b296e24e8cc35dce0bed484b7f30
1592 d5803e377094f04709f64d7b985310a4
1593 db84
1594
1595
1596 Plaintext (21 bytes) = e42a3c02c25b64869e146d7b233987bd
1597 dfc240871d
1598 AAD (35 bytes) = 7576f7028ec6eb5ea7e298342a94d4b2
1599 02b370ef9768ec6561c4fe6b7e7296fa
1600 859c21
1601 Key = f901cfe8a69615a93fdf7a98cad48179
1602 Nonce = 6245709fb18853f68d833640
1603 Record authentication key = 3724f55f1d22ac0ab830da0b6a995d74
1604 Record encryption key = 75ac87b70c05db287de779006105a344
1605 POLYVAL input = 7576f7028ec6eb5ea7e298342a94d4b2
1606 02b370ef9768ec6561c4fe6b7e7296fa
1607 859c2100000000000000000000000000
1608 e42a3c02c25b64869e146d7b233987bd
1609 dfc240871d0000000000000000000000
1610 1801000000000000a800000000000000
1611 POLYVAL result = 4cbba090f03f7d1188ea55749fa6c7bd
1612 POLYVAL result XOR nonce = 2efed00f41b72ee7056963349fa6c7bd
1613 ... and masked = 2efed00f41b72ee7056963349fa6c73d
1614 Tag = 2d15506c84a9edd65e13e9d24a2a6e70
1615 Initial counter = 2d15506c84a9edd65e13e9d24a2a6ef0
1616 Result (37 bytes) = 391cc328d484a4f46406181bcd62efd9
1617
1618
1619
1620 <span class="grey">Gueron, et al. Informational [Page 29]</span></pre>
1621 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-30" ></span>
1622 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
1623
1624
1625 b3ee197d052d15506c84a9edd65e13e9
1626 d24a2a6e70
1627
1628 <span class="h3"><a class="selflink" id="appendix-C.2" href="#appendix-C.2">C.2</a>. AEAD_AES_256_GCM_SIV</span>
1629
1630 Plaintext (0 bytes) =
1631 AAD (0 bytes) =
1632 Key = 01000000000000000000000000000000
1633 00000000000000000000000000000000
1634 Nonce = 030000000000000000000000
1635 Record authentication key = b5d3c529dfafac43136d2d11be284d7f
1636 Record encryption key = b914f4742be9e1d7a2f84addbf96dec3
1637 456e3c6c05ecc157cdbf0700fedad222
1638 POLYVAL input = 00000000000000000000000000000000
1639 POLYVAL result = 00000000000000000000000000000000
1640 POLYVAL result XOR nonce = 03000000000000000000000000000000
1641 ... and masked = 03000000000000000000000000000000
1642 Tag = 07f5f4169bbf55a8400cd47ea6fd400f
1643 Initial counter = 07f5f4169bbf55a8400cd47ea6fd408f
1644 Result (16 bytes) = 07f5f4169bbf55a8400cd47ea6fd400f
1645
1646
1647 Plaintext (8 bytes) = 0100000000000000
1648 AAD (0 bytes) =
1649 Key = 01000000000000000000000000000000
1650 00000000000000000000000000000000
1651 Nonce = 030000000000000000000000
1652 Record authentication key = b5d3c529dfafac43136d2d11be284d7f
1653 Record encryption key = b914f4742be9e1d7a2f84addbf96dec3
1654 456e3c6c05ecc157cdbf0700fedad222
1655 POLYVAL input = 01000000000000000000000000000000
1656 00000000000000004000000000000000
1657 POLYVAL result = 05230f62f0eac8aa14fe4d646b59cd41
1658 POLYVAL result XOR nonce = 06230f62f0eac8aa14fe4d646b59cd41
1659 ... and masked = 06230f62f0eac8aa14fe4d646b59cd41
1660 Tag = 843122130f7364b761e0b97427e3df28
1661 Initial counter = 843122130f7364b761e0b97427e3dfa8
1662 Result (24 bytes) = c2ef328e5c71c83b843122130f7364b7
1663 61e0b97427e3df28
1664
1665
1666 Plaintext (12 bytes) = 010000000000000000000000
1667 AAD (0 bytes) =
1668 Key = 01000000000000000000000000000000
1669 00000000000000000000000000000000
1670 Nonce = 030000000000000000000000
1671 Record authentication key = b5d3c529dfafac43136d2d11be284d7f
1672 Record encryption key = b914f4742be9e1d7a2f84addbf96dec3
1673
1674
1675
1676 <span class="grey">Gueron, et al. Informational [Page 30]</span></pre>
1677 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-31" ></span>
1678 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
1679
1680
1681 456e3c6c05ecc157cdbf0700fedad222
1682 POLYVAL input = 01000000000000000000000000000000
1683 00000000000000006000000000000000
1684 POLYVAL result = 6d81a24732fd6d03ae5af544720a1c13
1685 POLYVAL result XOR nonce = 6e81a24732fd6d03ae5af544720a1c13
1686 ... and masked = 6e81a24732fd6d03ae5af544720a1c13
1687 Tag = 8ca50da9ae6559e48fd10f6e5c9ca17e
1688 Initial counter = 8ca50da9ae6559e48fd10f6e5c9ca1fe
1689 Result (28 bytes) = 9aab2aeb3faa0a34aea8e2b18ca50da9
1690 ae6559e48fd10f6e5c9ca17e
1691
1692
1693 Plaintext (16 bytes) = 01000000000000000000000000000000
1694 AAD (0 bytes) =
1695 Key = 01000000000000000000000000000000
1696 00000000000000000000000000000000
1697 Nonce = 030000000000000000000000
1698 Record authentication key = b5d3c529dfafac43136d2d11be284d7f
1699 Record encryption key = b914f4742be9e1d7a2f84addbf96dec3
1700 456e3c6c05ecc157cdbf0700fedad222
1701 POLYVAL input = 01000000000000000000000000000000
1702 00000000000000008000000000000000
1703 POLYVAL result = 74eee2bf7c9a165f8b25dea73db32a6d
1704 POLYVAL result XOR nonce = 77eee2bf7c9a165f8b25dea73db32a6d
1705 ... and masked = 77eee2bf7c9a165f8b25dea73db32a6d
1706 Tag = c9eac6fa700942702e90862383c6c366
1707 Initial counter = c9eac6fa700942702e90862383c6c3e6
1708 Result (32 bytes) = 85a01b63025ba19b7fd3ddfc033b3e76
1709 c9eac6fa700942702e90862383c6c366
1710
1711
1712 Plaintext (32 bytes) = 01000000000000000000000000000000
1713 02000000000000000000000000000000
1714 AAD (0 bytes) =
1715 Key = 01000000000000000000000000000000
1716 00000000000000000000000000000000
1717 Nonce = 030000000000000000000000
1718 Record authentication key = b5d3c529dfafac43136d2d11be284d7f
1719 Record encryption key = b914f4742be9e1d7a2f84addbf96dec3
1720 456e3c6c05ecc157cdbf0700fedad222
1721 POLYVAL input = 01000000000000000000000000000000
1722 02000000000000000000000000000000
1723 00000000000000000001000000000000
1724 POLYVAL result = 899b6381b3d46f0def7aa0517ba188f5
1725 POLYVAL result XOR nonce = 8a9b6381b3d46f0def7aa0517ba188f5
1726 ... and masked = 8a9b6381b3d46f0def7aa0517ba18875
1727 Tag = e819e63abcd020b006a976397632eb5d
1728 Initial counter = e819e63abcd020b006a976397632ebdd
1729
1730
1731
1732 <span class="grey">Gueron, et al. Informational [Page 31]</span></pre>
1733 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-32" ></span>
1734 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
1735
1736
1737 Result (48 bytes) = 4a6a9db4c8c6549201b9edb53006cba8
1738 21ec9cf850948a7c86c68ac7539d027f
1739 e819e63abcd020b006a976397632eb5d
1740
1741
1742 Plaintext (48 bytes) = 01000000000000000000000000000000
1743 02000000000000000000000000000000
1744 03000000000000000000000000000000
1745 AAD (0 bytes) =
1746 Key = 01000000000000000000000000000000
1747 00000000000000000000000000000000
1748 Nonce = 030000000000000000000000
1749 Record authentication key = b5d3c529dfafac43136d2d11be284d7f
1750 Record encryption key = b914f4742be9e1d7a2f84addbf96dec3
1751 456e3c6c05ecc157cdbf0700fedad222
1752 POLYVAL input = 01000000000000000000000000000000
1753 02000000000000000000000000000000
1754 03000000000000000000000000000000
1755 00000000000000008001000000000000
1756 POLYVAL result = c1f8593d8fc29b0c290cae1992f71f51
1757 POLYVAL result XOR nonce = c2f8593d8fc29b0c290cae1992f71f51
1758 ... and masked = c2f8593d8fc29b0c290cae1992f71f51
1759 Tag = 790bc96880a99ba804bd12c0e6a22cc4
1760 Initial counter = 790bc96880a99ba804bd12c0e6a22cc4
1761 Result (64 bytes) = c00d121893a9fa603f48ccc1ca3c57ce
1762 7499245ea0046db16c53c7c66fe717e3
1763 9cf6c748837b61f6ee3adcee17534ed5
1764 790bc96880a99ba804bd12c0e6a22cc4
1765
1766
1767 Plaintext (64 bytes) = 01000000000000000000000000000000
1768 02000000000000000000000000000000
1769 03000000000000000000000000000000
1770 04000000000000000000000000000000
1771 AAD (0 bytes) =
1772 Key = 01000000000000000000000000000000
1773 00000000000000000000000000000000
1774 Nonce = 030000000000000000000000
1775 Record authentication key = b5d3c529dfafac43136d2d11be284d7f
1776 Record encryption key = b914f4742be9e1d7a2f84addbf96dec3
1777 456e3c6c05ecc157cdbf0700fedad222
1778 POLYVAL input = 01000000000000000000000000000000
1779 02000000000000000000000000000000
1780 03000000000000000000000000000000
1781 04000000000000000000000000000000
1782 00000000000000000002000000000000
1783 POLYVAL result = 6ef38b06046c7c0e225efaef8e2ec4c4
1784 POLYVAL result XOR nonce = 6df38b06046c7c0e225efaef8e2ec4c4
1785
1786
1787
1788 <span class="grey">Gueron, et al. Informational [Page 32]</span></pre>
1789 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-33" ></span>
1790 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
1791
1792
1793 ... and masked = 6df38b06046c7c0e225efaef8e2ec444
1794 Tag = 112864c269fc0d9d88c61fa47e39aa08
1795 Initial counter = 112864c269fc0d9d88c61fa47e39aa88
1796 Result (80 bytes) = c2d5160a1f8683834910acdafc41fbb1
1797 632d4a353e8b905ec9a5499ac34f96c7
1798 e1049eb080883891a4db8caaa1f99dd0
1799 04d80487540735234e3744512c6f90ce
1800 112864c269fc0d9d88c61fa47e39aa08
1801
1802
1803 Plaintext (8 bytes) = 0200000000000000
1804 AAD (1 bytes) = 01
1805 Key = 01000000000000000000000000000000
1806 00000000000000000000000000000000
1807 Nonce = 030000000000000000000000
1808 Record authentication key = b5d3c529dfafac43136d2d11be284d7f
1809 Record encryption key = b914f4742be9e1d7a2f84addbf96dec3
1810 456e3c6c05ecc157cdbf0700fedad222
1811 POLYVAL input = 01000000000000000000000000000000
1812 02000000000000000000000000000000
1813 08000000000000004000000000000000
1814 POLYVAL result = 34e57bafe011b9b36fc6821b7ffb3354
1815 POLYVAL result XOR nonce = 37e57bafe011b9b36fc6821b7ffb3354
1816 ... and masked = 37e57bafe011b9b36fc6821b7ffb3354
1817 Tag = 91213f267e3b452f02d01ae33e4ec854
1818 Initial counter = 91213f267e3b452f02d01ae33e4ec8d4
1819 Result (24 bytes) = 1de22967237a813291213f267e3b452f
1820 02d01ae33e4ec854
1821
1822
1823 Plaintext (12 bytes) = 020000000000000000000000
1824 AAD (1 bytes) = 01
1825 Key = 01000000000000000000000000000000
1826 00000000000000000000000000000000
1827 Nonce = 030000000000000000000000
1828 Record authentication key = b5d3c529dfafac43136d2d11be284d7f
1829 Record encryption key = b914f4742be9e1d7a2f84addbf96dec3
1830 456e3c6c05ecc157cdbf0700fedad222
1831 POLYVAL input = 01000000000000000000000000000000
1832 02000000000000000000000000000000
1833 08000000000000006000000000000000
1834 POLYVAL result = 5c47d68a22061c1ad5623a3b66a8e206
1835 POLYVAL result XOR nonce = 5f47d68a22061c1ad5623a3b66a8e206
1836 ... and masked = 5f47d68a22061c1ad5623a3b66a8e206
1837 Tag = c1a4a19ae800941ccdc57cc8413c277f
1838 Initial counter = c1a4a19ae800941ccdc57cc8413c27ff
1839 Result (28 bytes) = 163d6f9cc1b346cd453a2e4cc1a4a19a
1840 e800941ccdc57cc8413c277f
1841
1842
1843
1844 <span class="grey">Gueron, et al. Informational [Page 33]</span></pre>
1845 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-34" ></span>
1846 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
1847
1848
1849 Plaintext (16 bytes) = 02000000000000000000000000000000
1850 AAD (1 bytes) = 01
1851 Key = 01000000000000000000000000000000
1852 00000000000000000000000000000000
1853 Nonce = 030000000000000000000000
1854 Record authentication key = b5d3c529dfafac43136d2d11be284d7f
1855 Record encryption key = b914f4742be9e1d7a2f84addbf96dec3
1856 456e3c6c05ecc157cdbf0700fedad222
1857 POLYVAL input = 01000000000000000000000000000000
1858 02000000000000000000000000000000
1859 08000000000000008000000000000000
1860 POLYVAL result = 452896726c616746f01d11d82911d478
1861 POLYVAL result XOR nonce = 462896726c616746f01d11d82911d478
1862 ... and masked = 462896726c616746f01d11d82911d478
1863 Tag = b292d28ff61189e8e49f3875ef91aff7
1864 Initial counter = b292d28ff61189e8e49f3875ef91aff7
1865 Result (32 bytes) = c91545823cc24f17dbb0e9e807d5ec17
1866 b292d28ff61189e8e49f3875ef91aff7
1867
1868
1869 Plaintext (32 bytes) = 02000000000000000000000000000000
1870 03000000000000000000000000000000
1871 AAD (1 bytes) = 01
1872 Key = 01000000000000000000000000000000
1873 00000000000000000000000000000000
1874 Nonce = 030000000000000000000000
1875 Record authentication key = b5d3c529dfafac43136d2d11be284d7f
1876 Record encryption key = b914f4742be9e1d7a2f84addbf96dec3
1877 456e3c6c05ecc157cdbf0700fedad222
1878 POLYVAL input = 01000000000000000000000000000000
1879 02000000000000000000000000000000
1880 03000000000000000000000000000000
1881 08000000000000000001000000000000
1882 POLYVAL result = 4e58c1e341c9bb0ae34eda9509dfc90c
1883 POLYVAL result XOR nonce = 4d58c1e341c9bb0ae34eda9509dfc90c
1884 ... and masked = 4d58c1e341c9bb0ae34eda9509dfc90c
1885 Tag = aea1bad12702e1965604374aab96dbbc
1886 Initial counter = aea1bad12702e1965604374aab96dbbc
1887 Result (48 bytes) = 07dad364bfc2b9da89116d7bef6daaaf
1888 6f255510aa654f920ac81b94e8bad365
1889 aea1bad12702e1965604374aab96dbbc
1890
1891
1892 Plaintext (48 bytes) = 02000000000000000000000000000000
1893 03000000000000000000000000000000
1894 04000000000000000000000000000000
1895 AAD (1 bytes) = 01
1896 Key = 01000000000000000000000000000000
1897
1898
1899
1900 <span class="grey">Gueron, et al. Informational [Page 34]</span></pre>
1901 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-35" ></span>
1902 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
1903
1904
1905 00000000000000000000000000000000
1906 Nonce = 030000000000000000000000
1907 Record authentication key = b5d3c529dfafac43136d2d11be284d7f
1908 Record encryption key = b914f4742be9e1d7a2f84addbf96dec3
1909 456e3c6c05ecc157cdbf0700fedad222
1910 POLYVAL input = 01000000000000000000000000000000
1911 02000000000000000000000000000000
1912 03000000000000000000000000000000
1913 04000000000000000000000000000000
1914 08000000000000008001000000000000
1915 POLYVAL result = 2566a4aff9a525df9772c16d4eaf8d2a
1916 POLYVAL result XOR nonce = 2666a4aff9a525df9772c16d4eaf8d2a
1917 ... and masked = 2666a4aff9a525df9772c16d4eaf8d2a
1918 Tag = 03332742b228c647173616cfd44c54eb
1919 Initial counter = 03332742b228c647173616cfd44c54eb
1920 Result (64 bytes) = c67a1f0f567a5198aa1fcc8e3f213143
1921 36f7f51ca8b1af61feac35a86416fa47
1922 fbca3b5f749cdf564527f2314f42fe25
1923 03332742b228c647173616cfd44c54eb
1924
1925
1926 Plaintext (64 bytes) = 02000000000000000000000000000000
1927 03000000000000000000000000000000
1928 04000000000000000000000000000000
1929 05000000000000000000000000000000
1930 AAD (1 bytes) = 01
1931 Key = 01000000000000000000000000000000
1932 00000000000000000000000000000000
1933 Nonce = 030000000000000000000000
1934 Record authentication key = b5d3c529dfafac43136d2d11be284d7f
1935 Record encryption key = b914f4742be9e1d7a2f84addbf96dec3
1936 456e3c6c05ecc157cdbf0700fedad222
1937 POLYVAL input = 01000000000000000000000000000000
1938 02000000000000000000000000000000
1939 03000000000000000000000000000000
1940 04000000000000000000000000000000
1941 05000000000000000000000000000000
1942 08000000000000000002000000000000
1943 POLYVAL result = da58d2f61b0a9d343b2f37fb0c519733
1944 POLYVAL result XOR nonce = d958d2f61b0a9d343b2f37fb0c519733
1945 ... and masked = d958d2f61b0a9d343b2f37fb0c519733
1946 Tag = 5bde0285037c5de81e5b570a049b62a0
1947 Initial counter = 5bde0285037c5de81e5b570a049b62a0
1948 Result (80 bytes) = 67fd45e126bfb9a79930c43aad2d3696
1949 7d3f0e4d217c1e551f59727870beefc9
1950 8cb933a8fce9de887b1e40799988db1f
1951 c3f91880ed405b2dd298318858467c89
1952 5bde0285037c5de81e5b570a049b62a0
1953
1954
1955
1956 <span class="grey">Gueron, et al. Informational [Page 35]</span></pre>
1957 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-36" ></span>
1958 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
1959
1960
1961 Plaintext (4 bytes) = 02000000
1962 AAD (12 bytes) = 010000000000000000000000
1963 Key = 01000000000000000000000000000000
1964 00000000000000000000000000000000
1965 Nonce = 030000000000000000000000
1966 Record authentication key = b5d3c529dfafac43136d2d11be284d7f
1967 Record encryption key = b914f4742be9e1d7a2f84addbf96dec3
1968 456e3c6c05ecc157cdbf0700fedad222
1969 POLYVAL input = 01000000000000000000000000000000
1970 02000000000000000000000000000000
1971 60000000000000002000000000000000
1972 POLYVAL result = 6dc76ae84b88916e073a303aafde05cf
1973 POLYVAL result XOR nonce = 6ec76ae84b88916e073a303aafde05cf
1974 ... and masked = 6ec76ae84b88916e073a303aafde054f
1975 Tag = 1835e517741dfddccfa07fa4661b74cf
1976 Initial counter = 1835e517741dfddccfa07fa4661b74cf
1977 Result (20 bytes) = 22b3f4cd1835e517741dfddccfa07fa4
1978 661b74cf
1979
1980
1981 Plaintext (20 bytes) = 03000000000000000000000000000000
1982 04000000
1983 AAD (18 bytes) = 01000000000000000000000000000000
1984 0200
1985 Key = 01000000000000000000000000000000
1986 00000000000000000000000000000000
1987 Nonce = 030000000000000000000000
1988 Record authentication key = b5d3c529dfafac43136d2d11be284d7f
1989 Record encryption key = b914f4742be9e1d7a2f84addbf96dec3
1990 456e3c6c05ecc157cdbf0700fedad222
1991 POLYVAL input = 01000000000000000000000000000000
1992 02000000000000000000000000000000
1993 03000000000000000000000000000000
1994 04000000000000000000000000000000
1995 9000000000000000a000000000000000
1996 POLYVAL result = 973ef4fd04bd31d193816ab26f8655ca
1997 POLYVAL result XOR nonce = 943ef4fd04bd31d193816ab26f8655ca
1998 ... and masked = 943ef4fd04bd31d193816ab26f86554a
1999 Tag = b879ad976d8242acc188ab59cabfe307
2000 Initial counter = b879ad976d8242acc188ab59cabfe387
2001 Result (36 bytes) = 43dd0163cdb48f9fe3212bf61b201976
2002 067f342bb879ad976d8242acc188ab59
2003 cabfe307
2004
2005
2006 Plaintext (18 bytes) = 03000000000000000000000000000000
2007 0400
2008 AAD (20 bytes) = 01000000000000000000000000000000
2009
2010
2011
2012 <span class="grey">Gueron, et al. Informational [Page 36]</span></pre>
2013 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-37" ></span>
2014 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
2015
2016
2017 02000000
2018 Key = 01000000000000000000000000000000
2019 00000000000000000000000000000000
2020 Nonce = 030000000000000000000000
2021 Record authentication key = b5d3c529dfafac43136d2d11be284d7f
2022 Record encryption key = b914f4742be9e1d7a2f84addbf96dec3
2023 456e3c6c05ecc157cdbf0700fedad222
2024 POLYVAL input = 01000000000000000000000000000000
2025 02000000000000000000000000000000
2026 03000000000000000000000000000000
2027 04000000000000000000000000000000
2028 a0000000000000009000000000000000
2029 POLYVAL result = 2cbb6b7ab2dbffefb797f825f826870c
2030 POLYVAL result XOR nonce = 2fbb6b7ab2dbffefb797f825f826870c
2031 ... and masked = 2fbb6b7ab2dbffefb797f825f826870c
2032 Tag = cfcdf5042112aa29685c912fc2056543
2033 Initial counter = cfcdf5042112aa29685c912fc20565c3
2034 Result (34 bytes) = 462401724b5ce6588d5a54aae5375513
2035 a075cfcdf5042112aa29685c912fc205
2036 6543
2037
2038 Plaintext (0 bytes) =
2039 AAD (0 bytes) =
2040 Key = e66021d5eb8e4f4066d4adb9c33560e4
2041 f46e44bb3da0015c94f7088736864200
2042 Nonce = e0eaf5284d884a0e77d31646
2043 Record authentication key = e40d26f82774aa27f47b047b608b9585
2044 Record encryption key = 7c7c3d9a542cef53dde0e6de9b580040
2045 0f82e73ec5f7ee41b7ba8dcb9ba078c3
2046 POLYVAL input = 00000000000000000000000000000000
2047 POLYVAL result = 00000000000000000000000000000000
2048 POLYVAL result XOR nonce = e0eaf5284d884a0e77d3164600000000
2049 ... and masked = e0eaf5284d884a0e77d3164600000000
2050 Tag = 169fbb2fbf389a995f6390af22228a62
2051 Initial counter = 169fbb2fbf389a995f6390af22228ae2
2052 Result (16 bytes) = 169fbb2fbf389a995f6390af22228a62
2053
2054
2055 Plaintext (3 bytes) = 671fdd
2056 AAD (5 bytes) = 4fbdc66f14
2057 Key = bae8e37fc83441b16034566b7a806c46
2058 bb91c3c5aedb64a6c590bc84d1a5e269
2059 Nonce = e4b47801afc0577e34699b9e
2060 Record authentication key = b546f5a850d0a90adfe39e95c2510fc6
2061 Record encryption key = b9d1e239d62cbb5c49273ddac8838bdc
2062 c53bca478a770f07087caa4e0a924a55
2063 POLYVAL input = 4fbdc66f140000000000000000000000
2064 671fdd00000000000000000000000000
2065
2066
2067
2068 <span class="grey">Gueron, et al. Informational [Page 37]</span></pre>
2069 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-38" ></span>
2070 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
2071
2072
2073 28000000000000001800000000000000
2074 POLYVAL result = b91f91f96b159a7c611c05035b839e92
2075 POLYVAL result XOR nonce = 5dabe9f8c4d5cd0255759e9d5b839e92
2076 ... and masked = 5dabe9f8c4d5cd0255759e9d5b839e12
2077 Tag = 93da9bb81333aee0c785b240d319719d
2078 Initial counter = 93da9bb81333aee0c785b240d319719d
2079 Result (19 bytes) = 0eaccb93da9bb81333aee0c785b240d3
2080 19719d
2081
2082
2083 Plaintext (6 bytes) = 195495860f04
2084 AAD (10 bytes) = 6787f3ea22c127aaf195
2085 Key = 6545fc880c94a95198874296d5cc1fd1
2086 61320b6920ce07787f86743b275d1ab3
2087 Nonce = 2f6d1f0434d8848c1177441f
2088 Record authentication key = e156e1f9b0b07b780cbe30f259e3c8da
2089 Record encryption key = 6fc1c494519f944aae52fcd8b14e5b17
2090 1b5a9429d3b76e430d49940c0021d612
2091 POLYVAL input = 6787f3ea22c127aaf195000000000000
2092 195495860f0400000000000000000000
2093 50000000000000003000000000000000
2094 POLYVAL result = 2c480ed9d236b1df24c6eec109bd40c1
2095 POLYVAL result XOR nonce = 032511dde6ee355335b1aade09bd40c1
2096 ... and masked = 032511dde6ee355335b1aade09bd4041
2097 Tag = 6b62b84dc40c84636a5ec12020ec8c2c
2098 Initial counter = 6b62b84dc40c84636a5ec12020ec8cac
2099 Result (22 bytes) = a254dad4f3f96b62b84dc40c84636a5e
2100 c12020ec8c2c
2101
2102
2103 Plaintext (9 bytes) = c9882e5386fd9f92ec
2104 AAD (15 bytes) = 489c8fde2be2cf97e74e932d4ed87d
2105 Key = d1894728b3fed1473c528b8426a58299
2106 5929a1499e9ad8780c8d63d0ab4149c0
2107 Nonce = 9f572c614b4745914474e7c7
2108 Record authentication key = 0533fd71f4119257361a3ff1469dd4e5
2109 Record encryption key = 4feba89799be8ac3684fa2bb30ade0ea
2110 51390e6d87dcf3627d2ee44493853abe
2111 POLYVAL input = 489c8fde2be2cf97e74e932d4ed87d00
2112 c9882e5386fd9f92ec00000000000000
2113 78000000000000004800000000000000
2114 POLYVAL result = bf160bc9ded8c63057d2c38aae552fb4
2115 POLYVAL result XOR nonce = 204127a8959f83a113a6244dae552fb4
2116 ... and masked = 204127a8959f83a113a6244dae552f34
2117 Tag = c0fd3dc6628dfe55ebb0b9fb2295c8c2
2118 Initial counter = c0fd3dc6628dfe55ebb0b9fb2295c8c2
2119 Result (25 bytes) = 0df9e308678244c44bc0fd3dc6628dfe
2120 55ebb0b9fb2295c8c2
2121
2122
2123
2124 <span class="grey">Gueron, et al. Informational [Page 38]</span></pre>
2125 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-39" ></span>
2126 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
2127
2128
2129 Plaintext (12 bytes) = 1db2316fd568378da107b52b
2130 AAD (20 bytes) = 0da55210cc1c1b0abde3b2f204d1e9f8
2131 b06bc47f
2132 Key = a44102952ef94b02b805249bac80e6f6
2133 1455bfac8308a2d40d8c845117808235
2134 Nonce = 5c9e940fea2f582950a70d5a
2135 Record authentication key = 64779ab10ee8a280272f14cc8851b727
2136 Record encryption key = 25f40fc63f49d3b9016a8eeeb75846e0
2137 d72ca36ddbd312b6f5ef38ad14bd2651
2138 POLYVAL input = 0da55210cc1c1b0abde3b2f204d1e9f8
2139 b06bc47f000000000000000000000000
2140 1db2316fd568378da107b52b00000000
2141 a0000000000000006000000000000000
2142 POLYVAL result = cc86ee22c861e1fd474c84676b42739c
2143 POLYVAL result XOR nonce = 90187a2d224eb9d417eb893d6b42739c
2144 ... and masked = 90187a2d224eb9d417eb893d6b42731c
2145 Tag = 404099c2587f64979f21826706d497d5
2146 Initial counter = 404099c2587f64979f21826706d497d5
2147 Result (28 bytes) = 8dbeb9f7255bf5769dd56692404099c2
2148 587f64979f21826706d497d5
2149
2150
2151 Plaintext (15 bytes) = 21702de0de18baa9c9596291b08466
2152 AAD (25 bytes) = f37de21c7ff901cfe8a69615a93fdf7a
2153 98cad481796245709f
2154 Key = 9745b3d1ae06556fb6aa7890bebc18fe
2155 6b3db4da3d57aa94842b9803a96e07fb
2156 Nonce = 6de71860f762ebfbd08284e4
2157 Record authentication key = 27c2959ed4daea3b1f52e849478de376
2158 Record encryption key = 307a38a5a6cf231c0a9af3b527f23a62
2159 e9a6ff09aff8ae669f760153e864fc93
2160 POLYVAL input = f37de21c7ff901cfe8a69615a93fdf7a
2161 98cad481796245709f00000000000000
2162 21702de0de18baa9c9596291b0846600
2163 c8000000000000007800000000000000
2164 POLYVAL result = c4fa5e5b713853703bcf8e6424505fa5
2165 POLYVAL result XOR nonce = a91d463b865ab88beb4d0a8024505fa5
2166 ... and masked = a91d463b865ab88beb4d0a8024505f25
2167 Tag = b3080d28f6ebb5d3648ce97bd5ba67fd
2168 Initial counter = b3080d28f6ebb5d3648ce97bd5ba67fd
2169 Result (31 bytes) = 793576dfa5c0f88729a7ed3c2f1bffb3
2170 080d28f6ebb5d3648ce97bd5ba67fd
2171
2172
2173 Plaintext (18 bytes) = b202b370ef9768ec6561c4fe6b7e7296
2174 fa85
2175 AAD (30 bytes) = 9c2159058b1f0fe91433a5bdc20e214e
2176 ab7fecef4454a10ef0657df21ac7
2177
2178
2179
2180 <span class="grey">Gueron, et al. Informational [Page 39]</span></pre>
2181 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-40" ></span>
2182 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
2183
2184
2185 Key = b18853f68d833640e42a3c02c25b6486
2186 9e146d7b233987bddfc240871d7576f7
2187 Nonce = 028ec6eb5ea7e298342a94d4
2188 Record authentication key = 670b98154076ddb59b7a9137d0dcc0f0
2189 Record encryption key = 78116d78507fbe69d4a820c350f55c7c
2190 b36c3c9287df0e9614b142b76a587c3f
2191 POLYVAL input = 9c2159058b1f0fe91433a5bdc20e214e
2192 ab7fecef4454a10ef0657df21ac70000
2193 b202b370ef9768ec6561c4fe6b7e7296
2194 fa850000000000000000000000000000
2195 f0000000000000009000000000000000
2196 POLYVAL result = 4e4108f09f41d797dc9256f8da8d58c7
2197 POLYVAL result XOR nonce = 4ccfce1bc1e6350fe8b8c22cda8d58c7
2198 ... and masked = 4ccfce1bc1e6350fe8b8c22cda8d5847
2199 Tag = 454fc2a154fea91f8363a39fec7d0a49
2200 Initial counter = 454fc2a154fea91f8363a39fec7d0ac9
2201 Result (34 bytes) = 857e16a64915a787637687db4a951963
2202 5cdd454fc2a154fea91f8363a39fec7d
2203 0a49
2204
2205
2206 Plaintext (21 bytes) = ced532ce4159b035277d4dfbb7db6296
2207 8b13cd4eec
2208 AAD (35 bytes) = 734320ccc9d9bbbb19cb81b2af4ecbc3
2209 e72834321f7aa0f70b7282b4f33df23f
2210 167541
2211 Key = 3c535de192eaed3822a2fbbe2ca9dfc8
2212 8255e14a661b8aa82cc54236093bbc23
2213 Nonce = 688089e55540db1872504e1c
2214 Record authentication key = cb8c3aa3f8dbaeb4b28a3e86ff6625f8
2215 Record encryption key = 02426ce1aa3ab31313b0848469a1b5fc
2216 6c9af9602600b195b04ad407026bc06d
2217 POLYVAL input = 734320ccc9d9bbbb19cb81b2af4ecbc3
2218 e72834321f7aa0f70b7282b4f33df23f
2219 16754100000000000000000000000000
2220 ced532ce4159b035277d4dfbb7db6296
2221 8b13cd4eec0000000000000000000000
2222 1801000000000000a800000000000000
2223 POLYVAL result = ffd503c7dd712eb3791b7114b17bb0cf
2224 POLYVAL result XOR nonce = 97558a228831f5ab0b4b3f08b17bb0cf
2225 ... and masked = 97558a228831f5ab0b4b3f08b17bb04f
2226 Tag = 9d6c7029675b89eaf4ba1ded1a286594
2227 Initial counter = 9d6c7029675b89eaf4ba1ded1a286594
2228 Result (37 bytes) = 626660c26ea6612fb17ad91e8e767639
2229 edd6c9faee9d6c7029675b89eaf4ba1d
2230 ed1a286594
2231
2232
2233
2234
2235
2236 <span class="grey">Gueron, et al. Informational [Page 40]</span></pre>
2237 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-41" ></span>
2238 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
2239
2240
2241 <span class="h3"><a class="selflink" id="appendix-C.3" href="#appendix-C.3">C.3</a>. Counter Wrap Tests</span>
2242
2243 The tests in this section use AEAD_AES_256_GCM_SIV and are crafted to
2244 test correct wrapping of the block counter.
2245
2246 Plaintext (32 bytes) = 00000000000000000000000000000000
2247 4db923dc793ee6497c76dcc03a98e108
2248 AAD (0 bytes) =
2249 Key = 00000000000000000000000000000000
2250 00000000000000000000000000000000
2251 Nonce = 000000000000000000000000
2252 Record authentication key = dc95c078a24089895275f3d86b4fb868
2253 Record encryption key = 779b38d15bffb63d39d6e9ae76a9b2f3
2254 75d11b0e3a68c422845c7d4690fa594f
2255 POLYVAL input = 00000000000000000000000000000000
2256 4db923dc793ee6497c76dcc03a98e108
2257 00000000000000000001000000000000
2258 POLYVAL result = 7367cdb411b730128dd56e8edc0eff56
2259 POLYVAL result XOR nonce = 7367cdb411b730128dd56e8edc0eff56
2260 ... and masked = 7367cdb411b730128dd56e8edc0eff56
2261 Tag = ffffffff000000000000000000000000
2262 Initial counter = ffffffff000000000000000000000080
2263 Result (48 bytes) = f3f80f2cf0cb2dd9c5984fcda908456c
2264 c537703b5ba70324a6793a7bf218d3ea
2265 ffffffff000000000000000000000000
2266
2267
2268 Plaintext (24 bytes) = eb3640277c7ffd1303c7a542d02d3e4c
2269 0000000000000000
2270 AAD (0 bytes) =
2271 Key = 00000000000000000000000000000000
2272 00000000000000000000000000000000
2273 Nonce = 000000000000000000000000
2274 Record authentication key = dc95c078a24089895275f3d86b4fb868
2275 Record encryption key = 779b38d15bffb63d39d6e9ae76a9b2f3
2276 75d11b0e3a68c422845c7d4690fa594f
2277 POLYVAL input = eb3640277c7ffd1303c7a542d02d3e4c
2278 00000000000000000000000000000000
2279 0000000000000000c000000000000000
2280 POLYVAL result = 7367cdb411b730128dd56e8edc0eff56
2281 POLYVAL result XOR nonce = 7367cdb411b730128dd56e8edc0eff56
2282 ... and masked = 7367cdb411b730128dd56e8edc0eff56
2283 Tag = ffffffff000000000000000000000000
2284 Initial counter = ffffffff000000000000000000000080
2285 Result (40 bytes) = 18ce4f0b8cb4d0cac65fea8f79257b20
2286 888e53e72299e56dffffffff00000000
2287 0000000000000000
2288
2289
2290
2291
2292 <span class="grey">Gueron, et al. Informational [Page 41]</span></pre>
2293 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-42" ></span>
2294 <span class="grey"><a href="./rfc8452">RFC 8452</a> AES-GCM-SIV April 2019</span>
2295
2296
2297 Acknowledgements
2298
2299 The authors would like to thank Daniel Bleichenbacher, Uri
2300 Blumenthal, Deb Cooley's team at NSA Information Assurance, Scott
2301 Fluhrer, Tetsu Iwata, Tibor Jager, John Mattsson, Ondrej Mosnacek,
2302 Kenny Paterson, Bart Preneel, Yannick Seurin, and Bjoern Tackmann for
2303 their helpful suggestions and review.
2304
2305 Authors' Addresses
2306
2307 Shay Gueron
2308 University of Haifa and Amazon
2309 Abba Khoushy Ave 199
2310 Haifa 3498838
2311 Israel
2312
2313 Email: [email protected]
2314
2315
2316 Adam Langley
2317 Google LLC
2318 345 Spear St
2319 San Francisco, CA 94105
2320 United States of America
2321
2322 Email: [email protected]
2323
2324
2325 Yehuda Lindell
2326 Bar-Ilan University and Unbound Tech
2327 Ramat Gan
2328 5290002
2329 Israel
2330
2331 Email: [email protected]
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348 Gueron, et al. Informational [Page 42]
2349 </pre>