2 # Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
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
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.
12 Title = AES CBC Test vectors
14 #------------------------------------------------------
15 # AES_CBC results for aligned block lengths. (Result should be the same as 32 byte CTS1 & CTS2)
19 Key = 636869636b656e207465726979616b69
20 IV = 00000000000000000000000000000000
21 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c2047617527732043
22 Ciphertext = 97687268d6ecccc0c07b25e25ecfe58439312523a78662d5be7fcbcc98ebf5a8
26 Key = 636869636b656e207465726979616b69
27 IV = 00000000000000000000000000000000
28 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c20
29 Ciphertext = 97687268d6ecccc0c07b25e25ecfe58439312523a78662d5be7fcbcc98ebf5a89dad8bbb96c4cdc03bc103e1a194bbd8
33 Key = 636869636b656e207465726979616b69
34 IV = 00000000000000000000000000000000
35 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c20616e6420776f6e746f6e20736f75702e
36 Ciphertext = 97687268d6ecccc0c07b25e25ecfe58439312523a78662d5be7fcbcc98ebf5a89dad8bbb96c4cdc03bc103e1a194bbd84807efe836ee89a526730dbc2f7bc840
38 Title = AES CBC CTS1 Test vectors
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.
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
53 Cipher = AES-128-CBC-CTS
55 Key = 636869636b656e207465726979616b69
56 IV = 00000000000000000000000000000000
57 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320
58 Ciphertext = 97687268d6ecccc0c07b25e25ecfe5fc00783e0efdb2c1d445d4c8eff7ed22
61 Cipher = AES-128-CBC-CTS
63 Key = 636869636b656e207465726979616b69
64 IV = 00000000000000000000000000000000
65 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c2047617527732043
66 Ciphertext = 97687268d6ecccc0c07b25e25ecfe58439312523a78662d5be7fcbcc98ebf5a8
69 Cipher = AES-128-CBC-CTS
70 Key = 636869636b656e207465726979616b69
71 IV = 00000000000000000000000000000000
72 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c
73 Ciphertext = 97687268d6ecccc0c07b25e25ecfe58439312523a78662d5be7fcbcc98ebf5b3fffd940c16a18c1b5549d2f838029e
75 # 64 bytes input (CS1 is equivalent to CBC when the last block in full)
76 Cipher = AES-128-CBC-CTS
78 Key = 636869636b656e207465726979616b69
79 IV = 00000000000000000000000000000000
80 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c20616e6420776f6e746f6e20736f75702e
81 Ciphertext = 97687268d6ecccc0c07b25e25ecfe58439312523a78662d5be7fcbcc98ebf5a89dad8bbb96c4cdc03bc103e1a194bbd84807efe836ee89a526730dbc2f7bc840
83 #-------------------------------------------------------------------------------
84 # Generated test values using an IV.
87 Cipher = AES-128-CBC-CTS
89 Key = 636869636b656e207465726979616b69
90 IV =000102030405060708090A0B0C0D0E0F
91 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c
92 Ciphertext = 5432a630742dee7beb70f9f1400ee6a0b557cfb581949a4bdf3bb67dedd472426da5c54a9990f5ae0b7825f51f0060
95 Cipher = AES-128-CBC-CTS
97 Key = 636869636b656e207465726979616b69
98 IV = 000102030405060708090A0B0C0D0E0F
99 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c20616e6420776f6e746f6e20736f75702e4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c20616e6420776f6e746f6e20736f7570
100 Ciphertext = 5432a630742dee7beb70f9f1400ee6a0b557cfb581949a4bdf3bb67dedd472b9fc50e4e7dacf9e3d94b6cc031f9997a22d2fea7e6ef4aba2b717b0fa3f150e5e86e46b9e51c6ea5091a92aa791ce826b2e4fbaaf0e0314939625434b9530ce56f299891a48d26bdc287f54b230340d652a4721bf0f082ede80b6399800a92f
103 Cipher = AES-128-CBC-CTS
105 Key = 636869636b656e207465726979616b69
106 IV = 000102030405060708090A0B0C0D0E0F
107 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c20616e6420776f6e746f6e20736f75702e4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c20616e6420776f6e746f6e20736f75702e49
108 Ciphertext = 5432a630742dee7beb70f9f1400ee6a0b557cfb581949a4bdf3bb67dedd472b9fc50e4e7dacf9e3d94b6cc031f9997a22d2fea7e6ef4aba2b717b0fa3f150e5e86e46b9e51c6ea5091a92aa791ce826b2e4fbaaf0e0314939625434b9530ce56f299891a48d26bdc287f54b230340d14fde9fd1098b9b1db788b5868a8d009eeef
111 Cipher = AES-192-CBC-CTS
113 Key = 636869636b656e207465726979616b69636869636b656e20
114 IV = 000102030405060708090A0B0C0D0E0F
115 Plaintext = 4920776f756c64206c696b652074686520
116 Ciphertext = e9de1b402de8f79f947cc6b5880588d9b6
119 Cipher = AES-192-CBC-CTS
121 Key = 636869636b656e207465726979616b69636869636b656e20
122 IV = 000102030405060708090A0B0C0D0E0F
123 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320
124 Ciphertext = e9de17d6248fb492bdea1fb2e09c8edea2b610546f3b1e1d231821e283e153
127 Cipher = AES-192-CBC-CTS
129 Key = 636869636b656e207465726979616b69636869636b656e20
130 IV = 000102030405060708090A0B0C0D0E0F
131 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c2047617527732043
132 Ciphertext = e9de17d6248fb492bdea1fb2e09c8e8e31d005cc9fea948fed1ba6308dad9dd1
134 #------------------------------------------------------------------------------
137 # 15 bytes should fail for CS1
138 Cipher = AES-128-CBC-CTS
140 Key = 636869636b656e207465726979616b69
141 IV = 00000000000000000000000000000000
142 Plaintext = 0102030405060708090A0B0C0D0E0F
143 Result = CIPHERUPDATE_ERROR
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.
148 Title = AES CBC CTS2 Test vectors
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.
155 # 17 bytes Input (For partial blocks the output should match CS3)
156 Cipher = AES-128-CBC-CTS
158 Key = 636869636b656e207465726979616b69
159 IV = 00000000000000000000000000000000
160 Plaintext = 4920776f756c64206c696b652074686520
161 Ciphertext = c6353568f2bf8cb4d8a580362da7ff7f97
163 # 31 bytes input (For partial blocks the output should match CS3)
164 Cipher = AES-128-CBC-CTS
166 Key = 636869636b656e207465726979616b69
167 IV = 00000000000000000000000000000000
168 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320
169 Ciphertext = fc00783e0efdb2c1d445d4c8eff7ed2297687268d6ecccc0c07b25e25ecfe5
171 # 32 bytes input (Aligned blocks should match normal CBC mode)
172 Cipher = AES-128-CBC-CTS
174 Key = 636869636b656e207465726979616b69
175 IV = 00000000000000000000000000000000
176 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c2047617527732043
177 Ciphertext = 97687268d6ecccc0c07b25e25ecfe58439312523a78662d5be7fcbcc98ebf5a8
180 Cipher = AES-128-CBC-CTS
182 Key = 636869636b656e207465726979616b69
183 IV = 00000000000000000000000000000000
184 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c
185 Ciphertext = 97687268d6ecccc0c07b25e25ecfe584b3fffd940c16a18c1b5549d2f838029e39312523a78662d5be7fcbcc98ebf5
187 # 64 bytes input (CS2 is equivalent to CBC when the last block in full)
188 Cipher = AES-128-CBC-CTS
190 Key = 636869636b656e207465726979616b69
191 IV = 00000000000000000000000000000000
192 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c20616e6420776f6e746f6e20736f75702e
193 Ciphertext = 97687268d6ecccc0c07b25e25ecfe58439312523a78662d5be7fcbcc98ebf5a89dad8bbb96c4cdc03bc103e1a194bbd84807efe836ee89a526730dbc2f7bc840
195 # Generated test values using an IV.
198 Cipher = AES-192-CBC-CTS
200 Key = 636869636b656e207465726979616b69636869636b656e20
201 IV = 000102030405060708090A0B0C0D0E0F
202 Plaintext = 4920776f756c64206c696b652074686520
203 Ciphertext = de1b402de8f79f947cc6b5880588d9b6e9
206 Cipher = AES-192-CBC-CTS
208 Key = 636869636b656e207465726979616b69636869636b656e20
209 IV = 000102030405060708090A0B0C0D0E0F
210 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320
211 Ciphertext = dea2b610546f3b1e1d231821e283e153e9de17d6248fb492bdea1fb2e09c8e
214 Cipher = AES-192-CBC-CTS
216 Key = 636869636b656e207465726979616b69636869636b656e20
217 IV = 000102030405060708090A0B0C0D0E0F
218 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c2047617527732043
219 Ciphertext = e9de17d6248fb492bdea1fb2e09c8e8e31d005cc9fea948fed1ba6308dad9dd1
221 # Failure test - 15 bytes should fail for CS2
222 Cipher = AES-128-CBC-CTS
224 Key = 636869636b656e207465726979616b69
225 IV = 00000000000000000000000000000000
226 Plaintext = 0102030405060708090A0B0C0D0E0F
227 Result = CIPHERUPDATE_ERROR
230 Title = AES CBC CTS3 Test vectors
233 Cipher = AES-128-CBC-CTS
235 Key = 636869636b656e207465726979616b69
236 IV = 00000000000000000000000000000000
237 Plaintext = 4920776f756c64206c696b652074686520
238 Ciphertext = c6353568f2bf8cb4d8a580362da7ff7f97
241 Cipher = AES-128-CBC-CTS
243 Key = 636869636b656e207465726979616b69
244 IV = 00000000000000000000000000000000
245 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320
246 Ciphertext = fc00783e0efdb2c1d445d4c8eff7ed2297687268d6ecccc0c07b25e25ecfe5
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
251 Key = 636869636b656e207465726979616b69
252 IV = 00000000000000000000000000000000
253 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c2047617527732043
254 Ciphertext = 39312523a78662d5be7fcbcc98ebf5a897687268d6ecccc0c07b25e25ecfe584
257 Cipher = AES-128-CBC-CTS
259 Key = 636869636b656e207465726979616b69
260 IV = 00000000000000000000000000000000
261 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c
262 Ciphertext = 97687268d6ecccc0c07b25e25ecfe584b3fffd940c16a18c1b5549d2f838029e39312523a78662d5be7fcbcc98ebf5
265 Cipher = AES-128-CBC-CTS
267 Key = 636869636b656e207465726979616b69
268 IV = 00000000000000000000000000000000
269 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c20
270 Ciphertext = 97687268d6ecccc0c07b25e25ecfe5849dad8bbb96c4cdc03bc103e1a194bbd839312523a78662d5be7fcbcc98ebf5a8
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
275 Key = 636869636b656e207465726979616b69
276 IV = 00000000000000000000000000000000
277 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c20616e6420776f6e746f6e20736f75702e
278 Ciphertext = 97687268d6ecccc0c07b25e25ecfe58439312523a78662d5be7fcbcc98ebf5a84807efe836ee89a526730dbc2f7bc8409dad8bbb96c4cdc03bc103e1a194bbd8
281 # Generated test values using an IV.
283 Cipher = AES-128-CBC-CTS
285 Key = 636869636b656e207465726979616b69
286 IV = 000102030405060708090A0B0C0D0E0F
287 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c
288 Ciphertext = 5432a630742dee7beb70f9f1400ee6a0426da5c54a9990f5ae0b7825f51f0060b557cfb581949a4bdf3bb67dedd472
291 Cipher = AES-192-CBC-CTS
293 Key = 636869636b656e207465726979616b69636869636b656e20
294 IV =000102030405060708090A0B0C0D0E0F
295 Plaintext = 4920776f756c64206c696b652074686520
296 Ciphertext = de1b402de8f79f947cc6b5880588d9b6e9
299 Cipher = AES-192-CBC-CTS
301 Key = 636869636b656e207465726979616b69636869636b656e20
302 IV = 000102030405060708090A0B0C0D0E0F
303 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320
304 Ciphertext = dea2b610546f3b1e1d231821e283e153e9de17d6248fb492bdea1fb2e09c8e
307 Cipher = AES-192-CBC-CTS
309 Key = 636869636b656e207465726979616b69636869636b656e20
310 IV = 000102030405060708090A0B0C0D0E0F
311 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c2047617527732043
312 Ciphertext = 31d005cc9fea948fed1ba6308dad9dd1e9de17d6248fb492bdea1fb2e09c8e8e
315 Cipher = AES-256-CBC-CTS
317 Key = 636869636b656e207465726979616b69636869636b656e207465726979616b69
318 IV = 000102030405060708090A0B0C0D0E0F
319 Plaintext = 4920776f756c64206c696b652074686520
320 Ciphertext = 6b5f5abc21c4d04156c73850da3bba29e9
323 Cipher = AES-256-CBC-CTS
325 Key = 636869636b656e207465726979616b69636869636b656e207465726979616b69
326 IV = 000102030405060708090A0B0C0D0E0F
327 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320
328 Ciphertext = f22553af78ee4f468f02fbe6f0f2168ee954e79fae9310dc75b6070e1d6253
331 Cipher = AES-256-CBC-CTS
333 Key = 636869636b656e207465726979616b69636869636b656e207465726979616b69
334 IV = 000102030405060708090A0B0C0D0E0F
335 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c2047617527732043
336 Ciphertext = 2c0463982174df10baa9d8f782c5a5b3e954e79fae9310dc75b6070e1d625346
339 # 15 bytes should fail for CS3
340 Cipher = AES-128-CBC-CTS
342 Key = 636869636b656e207465726979616b69
343 IV = 00000000000000000000000000000000
344 Plaintext = 0102030405060708090A0B0C0D0E0F
345 Result = CIPHERUPDATE_ERROR
347 # 16 bytes should fail for CS3 (since it always needs 2 blocks).
348 Cipher = AES-128-CBC-CTS
350 Key = 636869636b656e207465726979616b69
351 IV = 00000000000000000000000000000000
352 Plaintext = 0102030405060708090A0B0C0D0E0F00
353 Result = CIPHERUPDATE_ERROR