bd0f5ce75152976f13734f95ee7da9bcfd4fe9bb
[openssl.git] / test / recipes / 30-test_evp_data / evpciph_aes_cts.txt
1 #
2 # Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
3 #
4 # Licensed under the Apache License 2.0 (the "License").  You may not use
5 # this file except in compliance with the License.  You can obtain a copy
6 # in the file LICENSE in the source distribution or at
7 # https://www.openssl.org/source/license.html
8
9 # Original test vectors were taken from https://www.ietf.org/rfc/rfc3962.txt for CS3
10 # These have an IV of all zeros, for a 128 bit AES key.
11
12 Title = AES CBC Test vectors
13
14 #------------------------------------------------------
15 # AES_CBC results for aligned block lengths. (Result should be the same as 32 byte CTS1 & CTS2)
16
17 # 32 bytes input
18 Cipher = AES-128-CBC
19 Key = 636869636b656e207465726979616b69
20 IV = 00000000000000000000000000000000
21 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c2047617527732043
22 Ciphertext = 97687268d6ecccc0c07b25e25ecfe58439312523a78662d5be7fcbcc98ebf5a8
23
24 # 48 bytes input
25 Cipher = AES-128-CBC
26 Key = 636869636b656e207465726979616b69
27 IV = 00000000000000000000000000000000
28 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c20
29 Ciphertext = 97687268d6ecccc0c07b25e25ecfe58439312523a78662d5be7fcbcc98ebf5a89dad8bbb96c4cdc03bc103e1a194bbd8
30
31 # 64 bytes input
32 Cipher = AES-128-CBC
33 Key = 636869636b656e207465726979616b69
34 IV = 00000000000000000000000000000000
35 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c20616e6420776f6e746f6e20736f75702e
36 Ciphertext = 97687268d6ecccc0c07b25e25ecfe58439312523a78662d5be7fcbcc98ebf5a89dad8bbb96c4cdc03bc103e1a194bbd84807efe836ee89a526730dbc2f7bc840
37
38 Title = AES CBC CTS1 Test vectors
39
40 #------------------------------------------------------
41 # Manually edited using the same inputs to also produce CS1 ciphertext
42 # where aligned blocks are the same as CBC mode, and partial lengths
43 # have the last 2 blocks swapped compared to CS3.
44
45 # 17 bytes Input((Default is CS1 if CTSMode is not specified)
46 Cipher = AES-128-CBC-CTS
47 Key = 636869636b656e207465726979616b69
48 IV = 00000000000000000000000000000000
49 Plaintext = 4920776f756c64206c696b652074686520
50 Ciphertext = 97c6353568f2bf8cb4d8a580362da7ff7f
51
52 # 31 bytes input
53 Cipher = AES-128-CBC-CTS
54 CTSMode = CS1
55 Key = 636869636b656e207465726979616b69
56 IV = 00000000000000000000000000000000
57 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320
58 Ciphertext = 97687268d6ecccc0c07b25e25ecfe5fc00783e0efdb2c1d445d4c8eff7ed22
59
60 # 32 bytes input
61 Cipher = AES-128-CBC-CTS
62 CTSMode = CS1
63 Key = 636869636b656e207465726979616b69
64 IV = 00000000000000000000000000000000
65 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c2047617527732043
66 Ciphertext = 97687268d6ecccc0c07b25e25ecfe58439312523a78662d5be7fcbcc98ebf5a8
67
68 # 47 bytes input
69 Cipher = AES-128-CBC-CTS
70 Key = 636869636b656e207465726979616b69
71 IV = 00000000000000000000000000000000
72 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c
73 Ciphertext = 97687268d6ecccc0c07b25e25ecfe58439312523a78662d5be7fcbcc98ebf5b3fffd940c16a18c1b5549d2f838029e
74
75 # 64 bytes input (CS1 is equivalent to CBC when the last block in full)
76 Cipher = AES-128-CBC-CTS
77 CTSMode = CS1
78 Key = 636869636b656e207465726979616b69
79 IV = 00000000000000000000000000000000
80 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c20616e6420776f6e746f6e20736f75702e
81 Ciphertext = 97687268d6ecccc0c07b25e25ecfe58439312523a78662d5be7fcbcc98ebf5a89dad8bbb96c4cdc03bc103e1a194bbd84807efe836ee89a526730dbc2f7bc840
82
83 #-------------------------------------------------------------------------------
84 # Generated test values using an IV.
85
86 # 47 bytes input
87 Cipher = AES-128-CBC-CTS
88 CTSMode = CS1
89 Key = 636869636b656e207465726979616b69
90 IV =000102030405060708090A0B0C0D0E0F
91 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c
92 Ciphertext = 5432a630742dee7beb70f9f1400ee6a0b557cfb581949a4bdf3bb67dedd472426da5c54a9990f5ae0b7825f51f0060
93
94 # 127 bytes
95 Cipher = AES-128-CBC-CTS
96 CTSMode = CS1
97 Key = 636869636b656e207465726979616b69
98 IV = 000102030405060708090A0B0C0D0E0F
99 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c20616e6420776f6e746f6e20736f75702e4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c20616e6420776f6e746f6e20736f7570
100 Ciphertext = 5432a630742dee7beb70f9f1400ee6a0b557cfb581949a4bdf3bb67dedd472b9fc50e4e7dacf9e3d94b6cc031f9997a22d2fea7e6ef4aba2b717b0fa3f150e5e86e46b9e51c6ea5091a92aa791ce826b2e4fbaaf0e0314939625434b9530ce56f299891a48d26bdc287f54b230340d652a4721bf0f082ede80b6399800a92f
101
102 # 129 bytes
103 Cipher = AES-128-CBC-CTS
104 CTSMode = CS1
105 Key = 636869636b656e207465726979616b69
106 IV = 000102030405060708090A0B0C0D0E0F
107 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c20616e6420776f6e746f6e20736f75702e4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c20616e6420776f6e746f6e20736f75702e49
108 Ciphertext = 5432a630742dee7beb70f9f1400ee6a0b557cfb581949a4bdf3bb67dedd472b9fc50e4e7dacf9e3d94b6cc031f9997a22d2fea7e6ef4aba2b717b0fa3f150e5e86e46b9e51c6ea5091a92aa791ce826b2e4fbaaf0e0314939625434b9530ce56f299891a48d26bdc287f54b230340d14fde9fd1098b9b1db788b5868a8d009eeef
109
110 # 17 Bytes
111 Cipher = AES-192-CBC-CTS
112 CTSMode = CS1
113 Key = 636869636b656e207465726979616b69636869636b656e20
114 IV = 000102030405060708090A0B0C0D0E0F
115 Plaintext = 4920776f756c64206c696b652074686520
116 Ciphertext = e9de1b402de8f79f947cc6b5880588d9b6
117
118 # 31 Bytes
119 Cipher = AES-192-CBC-CTS
120 CTSMode = CS1
121 Key = 636869636b656e207465726979616b69636869636b656e20
122 IV = 000102030405060708090A0B0C0D0E0F
123 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320
124 Ciphertext = e9de17d6248fb492bdea1fb2e09c8edea2b610546f3b1e1d231821e283e153
125
126 # 32 Bytes
127 Cipher = AES-192-CBC-CTS
128 CTSMode = CS1
129 Key = 636869636b656e207465726979616b69636869636b656e20
130 IV = 000102030405060708090A0B0C0D0E0F
131 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c2047617527732043
132 Ciphertext = e9de17d6248fb492bdea1fb2e09c8e8e31d005cc9fea948fed1ba6308dad9dd1
133
134 #------------------------------------------------------------------------------
135 # Failure test
136
137 # 15 bytes should fail for CS1
138 Cipher = AES-128-CBC-CTS
139 CTSMode = CS1
140 Key = 636869636b656e207465726979616b69
141 IV = 00000000000000000000000000000000
142 Plaintext = 0102030405060708090A0B0C0D0E0F
143 Result = CIPHERUPDATE_ERROR
144
145 # Original test vectors were taken from https://www.ietf.org/rfc/rfc3962.txt for CS3
146 # These have an IV of all zeros, for a 128 bit AES key.
147
148 Title = AES CBC CTS2 Test vectors
149
150 #------------------------------------------------------
151 # Manually edited using the same inputs to also produce CS2 ciphertext
152 # where aligned blocks are the same as CBC mode, and partial lengths
153 # are the same as CS3.
154
155 # 17 bytes Input (For partial blocks the output should match CS3)
156 Cipher = AES-128-CBC-CTS
157 CTSMode = CS2
158 Key = 636869636b656e207465726979616b69
159 IV = 00000000000000000000000000000000
160 Plaintext = 4920776f756c64206c696b652074686520
161 Ciphertext = c6353568f2bf8cb4d8a580362da7ff7f97
162
163 # 31 bytes input (For partial blocks the output should match CS3)
164 Cipher = AES-128-CBC-CTS
165 CTSMode = CS2
166 Key = 636869636b656e207465726979616b69
167 IV = 00000000000000000000000000000000
168 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320
169 Ciphertext = fc00783e0efdb2c1d445d4c8eff7ed2297687268d6ecccc0c07b25e25ecfe5
170
171 # 32 bytes input (Aligned blocks should match normal CBC mode)
172 Cipher = AES-128-CBC-CTS
173 CTSMode = CS2
174 Key = 636869636b656e207465726979616b69
175 IV = 00000000000000000000000000000000
176 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c2047617527732043
177 Ciphertext = 97687268d6ecccc0c07b25e25ecfe58439312523a78662d5be7fcbcc98ebf5a8
178
179 # 47 bytes input
180 Cipher = AES-128-CBC-CTS
181 CTSMode = CS2
182 Key = 636869636b656e207465726979616b69
183 IV = 00000000000000000000000000000000
184 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c
185 Ciphertext = 97687268d6ecccc0c07b25e25ecfe584b3fffd940c16a18c1b5549d2f838029e39312523a78662d5be7fcbcc98ebf5
186
187 # 64 bytes input (CS2 is equivalent to CBC when the last block in full)
188 Cipher = AES-128-CBC-CTS
189 CTSMode = CS2
190 Key = 636869636b656e207465726979616b69
191 IV = 00000000000000000000000000000000
192 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c20616e6420776f6e746f6e20736f75702e
193 Ciphertext = 97687268d6ecccc0c07b25e25ecfe58439312523a78662d5be7fcbcc98ebf5a89dad8bbb96c4cdc03bc103e1a194bbd84807efe836ee89a526730dbc2f7bc840
194
195 # Generated test values using an IV.
196
197 # 17 Bytes
198 Cipher = AES-192-CBC-CTS
199 CTSMode = CS2
200 Key = 636869636b656e207465726979616b69636869636b656e20
201 IV = 000102030405060708090A0B0C0D0E0F
202 Plaintext = 4920776f756c64206c696b652074686520
203 Ciphertext = de1b402de8f79f947cc6b5880588d9b6e9
204
205 # 31 Bytes
206 Cipher = AES-192-CBC-CTS
207 CTSMode = CS2
208 Key = 636869636b656e207465726979616b69636869636b656e20
209 IV = 000102030405060708090A0B0C0D0E0F
210 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320
211 Ciphertext = dea2b610546f3b1e1d231821e283e153e9de17d6248fb492bdea1fb2e09c8e
212
213 # 32 Bytes
214 Cipher = AES-192-CBC-CTS
215 CTSMode = CS2
216 Key = 636869636b656e207465726979616b69636869636b656e20
217 IV = 000102030405060708090A0B0C0D0E0F
218 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c2047617527732043
219 Ciphertext = e9de17d6248fb492bdea1fb2e09c8e8e31d005cc9fea948fed1ba6308dad9dd1
220
221 # Failure test - 15 bytes should fail for CS2
222 Cipher = AES-128-CBC-CTS
223 CTSMode = CS2
224 Key = 636869636b656e207465726979616b69
225 IV = 00000000000000000000000000000000
226 Plaintext = 0102030405060708090A0B0C0D0E0F
227 Result = CIPHERUPDATE_ERROR
228
229
230 Title = AES CBC CTS3 Test vectors
231
232 # 17 bytes Input
233 Cipher = AES-128-CBC-CTS
234 CTSMode = CS3
235 Key = 636869636b656e207465726979616b69
236 IV = 00000000000000000000000000000000
237 Plaintext = 4920776f756c64206c696b652074686520
238 Ciphertext = c6353568f2bf8cb4d8a580362da7ff7f97
239
240 # 31 bytes input
241 Cipher = AES-128-CBC-CTS
242 CTSMode = CS3
243 Key = 636869636b656e207465726979616b69
244 IV = 00000000000000000000000000000000
245 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320
246 Ciphertext = fc00783e0efdb2c1d445d4c8eff7ed2297687268d6ecccc0c07b25e25ecfe5
247
248 # 32 bytes input (CS3 always swaps the last 2 byte blocks - so it is not equivalent to CBC for a full block)
249 Cipher = AES-128-CBC-CTS
250 CTSMode = CS3
251 Key = 636869636b656e207465726979616b69
252 IV = 00000000000000000000000000000000
253 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c2047617527732043
254 Ciphertext = 39312523a78662d5be7fcbcc98ebf5a897687268d6ecccc0c07b25e25ecfe584
255
256 # 47 bytes input
257 Cipher = AES-128-CBC-CTS
258 CTSMode = CS3
259 Key = 636869636b656e207465726979616b69
260 IV = 00000000000000000000000000000000
261 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c
262 Ciphertext = 97687268d6ecccc0c07b25e25ecfe584b3fffd940c16a18c1b5549d2f838029e39312523a78662d5be7fcbcc98ebf5
263
264 # 48 bytes input
265 Cipher = AES-128-CBC-CTS
266 CTSMode = CS3
267 Key = 636869636b656e207465726979616b69
268 IV = 00000000000000000000000000000000
269 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c20
270 Ciphertext = 97687268d6ecccc0c07b25e25ecfe5849dad8bbb96c4cdc03bc103e1a194bbd839312523a78662d5be7fcbcc98ebf5a8
271
272 # 64 bytes input (CS3 always swaps the last 2 byte blocks - so it is not equivalent to CBC for a full block)
273 Cipher = AES-128-CBC-CTS
274 CTSMode = CS3
275 Key = 636869636b656e207465726979616b69
276 IV = 00000000000000000000000000000000
277 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c20616e6420776f6e746f6e20736f75702e
278 Ciphertext = 97687268d6ecccc0c07b25e25ecfe58439312523a78662d5be7fcbcc98ebf5a84807efe836ee89a526730dbc2f7bc8409dad8bbb96c4cdc03bc103e1a194bbd8
279
280
281 # Generated test values using an IV.
282 # 47 bytes input
283 Cipher = AES-128-CBC-CTS
284 CTSMode = CS3
285 Key = 636869636b656e207465726979616b69
286 IV = 000102030405060708090A0B0C0D0E0F
287 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c
288 Ciphertext = 5432a630742dee7beb70f9f1400ee6a0426da5c54a9990f5ae0b7825f51f0060b557cfb581949a4bdf3bb67dedd472
289
290 # 17 Bytes
291 Cipher = AES-192-CBC-CTS
292 CTSMode = CS3
293 Key = 636869636b656e207465726979616b69636869636b656e20
294 IV =000102030405060708090A0B0C0D0E0F
295 Plaintext = 4920776f756c64206c696b652074686520
296 Ciphertext = de1b402de8f79f947cc6b5880588d9b6e9
297
298 # 31 Bytes
299 Cipher = AES-192-CBC-CTS
300 CTSMode = CS3
301 Key = 636869636b656e207465726979616b69636869636b656e20
302 IV = 000102030405060708090A0B0C0D0E0F
303 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320
304 Ciphertext = dea2b610546f3b1e1d231821e283e153e9de17d6248fb492bdea1fb2e09c8e
305
306 # 32 Bytes
307 Cipher = AES-192-CBC-CTS
308 CTSMode = CS3
309 Key = 636869636b656e207465726979616b69636869636b656e20
310 IV = 000102030405060708090A0B0C0D0E0F
311 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c2047617527732043
312 Ciphertext = 31d005cc9fea948fed1ba6308dad9dd1e9de17d6248fb492bdea1fb2e09c8e8e
313
314 # 17 Bytes
315 Cipher = AES-256-CBC-CTS
316 CTSMode = CS3
317 Key = 636869636b656e207465726979616b69636869636b656e207465726979616b69
318 IV = 000102030405060708090A0B0C0D0E0F
319 Plaintext = 4920776f756c64206c696b652074686520
320 Ciphertext = 6b5f5abc21c4d04156c73850da3bba29e9
321
322 # 31 Bytes
323 Cipher = AES-256-CBC-CTS
324 CTSMode = CS3
325 Key = 636869636b656e207465726979616b69636869636b656e207465726979616b69
326 IV = 000102030405060708090A0B0C0D0E0F
327 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320
328 Ciphertext = f22553af78ee4f468f02fbe6f0f2168ee954e79fae9310dc75b6070e1d6253
329
330 # 32 Bytes
331 Cipher = AES-256-CBC-CTS
332 CTSMode = CS3
333 Key = 636869636b656e207465726979616b69636869636b656e207465726979616b69
334 IV = 000102030405060708090A0B0C0D0E0F
335 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c2047617527732043
336 Ciphertext = 2c0463982174df10baa9d8f782c5a5b3e954e79fae9310dc75b6070e1d625346
337
338 # Failure tests
339 # 15 bytes should fail for CS3
340 Cipher = AES-128-CBC-CTS
341 CTSMode = CS3
342 Key = 636869636b656e207465726979616b69
343 IV = 00000000000000000000000000000000
344 Plaintext = 0102030405060708090A0B0C0D0E0F
345 Result = CIPHERUPDATE_ERROR
346
347 # 16 bytes input
348 Cipher = AES-128-CBC
349 Key = 636869636b656e207465726979616b69
350 IV = 00000000000000000000000000000000
351 Plaintext = 0102030405060708090A0B0C0D0E0F00
352 Ciphertext = 011ca8de3bd20ebc2f8701d56dcf768e
353
354 # 16 bytes with CS3 should return the same as plain CBC mode.
355 Cipher = AES-128-CBC-CTS
356 CTSMode = CS1
357 Key = 636869636b656e207465726979616b69
358 IV = 00000000000000000000000000000000
359 Plaintext = 0102030405060708090A0B0C0D0E0F00
360 Ciphertext = 011ca8de3bd20ebc2f8701d56dcf768e
361
362 Cipher = AES-128-CBC-CTS
363 CTSMode = CS2
364 Key = 636869636b656e207465726979616b69
365 IV = 00000000000000000000000000000000
366 Plaintext = 0102030405060708090A0B0C0D0E0F00
367 Ciphertext = 011ca8de3bd20ebc2f8701d56dcf768e
368
369 Cipher = AES-128-CBC-CTS
370 CTSMode = CS3
371 Key = 636869636b656e207465726979616b69
372 IV = 00000000000000000000000000000000
373 Plaintext = 0102030405060708090A0B0C0D0E0F00
374 Ciphertext = 011ca8de3bd20ebc2f8701d56dcf768e
375