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 CTS2 Test vectors
14 #------------------------------------------------------
15 # Manually edited using the same inputs to also produce CS2 ciphertext
16 # where aligned blocks are the same as CBC mode, and partial lengths
17 # are the same as CS3.
19 # 17 bytes Input (For partial blocks the output should match CS3)
20 Cipher = AES-128-CBC-CTS
22 Key = 636869636b656e207465726979616b69
23 IV = 00000000000000000000000000000000
24 Plaintext = 4920776f756c64206c696b652074686520
25 Ciphertext = c6353568f2bf8cb4d8a580362da7ff7f97
27 # 31 bytes input (For partial blocks the output should match CS3)
28 Cipher = AES-128-CBC-CTS
30 Key = 636869636b656e207465726979616b69
31 IV = 00000000000000000000000000000000
32 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320
33 Ciphertext = fc00783e0efdb2c1d445d4c8eff7ed2297687268d6ecccc0c07b25e25ecfe5
35 # 32 bytes input (Aligned blocks should match normal CBC mode)
36 Cipher = AES-128-CBC-CTS
38 Key = 636869636b656e207465726979616b69
39 IV = 00000000000000000000000000000000
40 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c2047617527732043
41 Ciphertext = 97687268d6ecccc0c07b25e25ecfe58439312523a78662d5be7fcbcc98ebf5a8
44 Cipher = AES-128-CBC-CTS
46 Key = 636869636b656e207465726979616b69
47 IV = 00000000000000000000000000000000
48 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c
49 Ciphertext = 97687268d6ecccc0c07b25e25ecfe584b3fffd940c16a18c1b5549d2f838029e39312523a78662d5be7fcbcc98ebf5
51 # 64 bytes input (CS2 is equivalent to CBC when the last block in full)
52 Cipher = AES-128-CBC-CTS
54 Key = 636869636b656e207465726979616b69
55 IV = 00000000000000000000000000000000
56 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c20616e6420776f6e746f6e20736f75702e
57 Ciphertext = 97687268d6ecccc0c07b25e25ecfe58439312523a78662d5be7fcbcc98ebf5a89dad8bbb96c4cdc03bc103e1a194bbd84807efe836ee89a526730dbc2f7bc840
59 # Generated test values using an IV.
62 Cipher = AES-192-CBC-CTS
64 Key = 636869636b656e207465726979616b69636869636b656e20
65 IV = 000102030405060708090A0B0C0D0E0F
66 Plaintext = 4920776f756c64206c696b652074686520
67 Ciphertext = de1b402de8f79f947cc6b5880588d9b6e9
70 Cipher = AES-192-CBC-CTS
72 Key = 636869636b656e207465726979616b69636869636b656e20
73 IV = 000102030405060708090A0B0C0D0E0F
74 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320
75 Ciphertext = dea2b610546f3b1e1d231821e283e153e9de17d6248fb492bdea1fb2e09c8e
78 Cipher = AES-192-CBC-CTS
80 Key = 636869636b656e207465726979616b69636869636b656e20
81 IV = 000102030405060708090A0B0C0D0E0F
82 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c2047617527732043
83 Ciphertext = e9de17d6248fb492bdea1fb2e09c8e8e31d005cc9fea948fed1ba6308dad9dd1
85 # Failure test - 15 bytes should fail for CS2
86 Cipher = AES-128-CBC-CTS
88 Key = 636869636b656e207465726979616b69
89 IV = 00000000000000000000000000000000
90 Plaintext = 0102030405060708090A0B0C0D0E0F
91 Result = CIPHERUPDATE_ERROR
95 Title = AES CBC CTS3 Test vectors
98 Cipher = AES-128-CBC-CTS
100 Key = 636869636b656e207465726979616b69
101 IV = 00000000000000000000000000000000
102 Plaintext = 4920776f756c64206c696b652074686520
103 Ciphertext = c6353568f2bf8cb4d8a580362da7ff7f97
106 Cipher = AES-128-CBC-CTS
108 Key = 636869636b656e207465726979616b69
109 IV = 00000000000000000000000000000000
110 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320
111 Ciphertext = fc00783e0efdb2c1d445d4c8eff7ed2297687268d6ecccc0c07b25e25ecfe5
113 # 32 bytes input (CS3 always swaps the last 2 byte blocks - so it is not equivalent to CBC for a full block)
114 Cipher = AES-128-CBC-CTS
116 Key = 636869636b656e207465726979616b69
117 IV = 00000000000000000000000000000000
118 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c2047617527732043
119 Ciphertext = 39312523a78662d5be7fcbcc98ebf5a897687268d6ecccc0c07b25e25ecfe584
122 Cipher = AES-128-CBC-CTS
124 Key = 636869636b656e207465726979616b69
125 IV = 00000000000000000000000000000000
126 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c
127 Ciphertext = 97687268d6ecccc0c07b25e25ecfe584b3fffd940c16a18c1b5549d2f838029e39312523a78662d5be7fcbcc98ebf5
130 Cipher = AES-128-CBC-CTS
132 Key = 636869636b656e207465726979616b69
133 IV = 00000000000000000000000000000000
134 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c20
135 Ciphertext = 97687268d6ecccc0c07b25e25ecfe5849dad8bbb96c4cdc03bc103e1a194bbd839312523a78662d5be7fcbcc98ebf5a8
137 # 64 bytes input (CS3 always swaps the last 2 byte blocks - so it is not equivalent to CBC for a full block)
138 Cipher = AES-128-CBC-CTS
140 Key = 636869636b656e207465726979616b69
141 IV = 00000000000000000000000000000000
142 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c20616e6420776f6e746f6e20736f75702e
143 Ciphertext = 97687268d6ecccc0c07b25e25ecfe58439312523a78662d5be7fcbcc98ebf5a84807efe836ee89a526730dbc2f7bc8409dad8bbb96c4cdc03bc103e1a194bbd8
146 # Generated test values using an IV.
148 Cipher = AES-128-CBC-CTS
150 Key = 636869636b656e207465726979616b69
151 IV = 000102030405060708090A0B0C0D0E0F
152 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c
153 Ciphertext = 5432a630742dee7beb70f9f1400ee6a0426da5c54a9990f5ae0b7825f51f0060b557cfb581949a4bdf3bb67dedd472
156 Cipher = AES-192-CBC-CTS
158 Key = 636869636b656e207465726979616b69636869636b656e20
159 IV =000102030405060708090A0B0C0D0E0F
160 Plaintext = 4920776f756c64206c696b652074686520
161 Ciphertext = de1b402de8f79f947cc6b5880588d9b6e9
164 Cipher = AES-192-CBC-CTS
166 Key = 636869636b656e207465726979616b69636869636b656e20
167 IV = 000102030405060708090A0B0C0D0E0F
168 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320
169 Ciphertext = dea2b610546f3b1e1d231821e283e153e9de17d6248fb492bdea1fb2e09c8e
172 Cipher = AES-192-CBC-CTS
174 Key = 636869636b656e207465726979616b69636869636b656e20
175 IV = 000102030405060708090A0B0C0D0E0F
176 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c2047617527732043
177 Ciphertext = 31d005cc9fea948fed1ba6308dad9dd1e9de17d6248fb492bdea1fb2e09c8e8e
180 Cipher = AES-256-CBC-CTS
182 Key = 636869636b656e207465726979616b69636869636b656e207465726979616b69
183 IV = 000102030405060708090A0B0C0D0E0F
184 Plaintext = 4920776f756c64206c696b652074686520
185 Ciphertext = 6b5f5abc21c4d04156c73850da3bba29e9
188 Cipher = AES-256-CBC-CTS
190 Key = 636869636b656e207465726979616b69636869636b656e207465726979616b69
191 IV = 000102030405060708090A0B0C0D0E0F
192 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c20476175277320
193 Ciphertext = f22553af78ee4f468f02fbe6f0f2168ee954e79fae9310dc75b6070e1d6253
196 Cipher = AES-256-CBC-CTS
198 Key = 636869636b656e207465726979616b69636869636b656e207465726979616b69
199 IV = 000102030405060708090A0B0C0D0E0F
200 Plaintext = 4920776f756c64206c696b65207468652047656e6572616c2047617527732043
201 Ciphertext = 2c0463982174df10baa9d8f782c5a5b3e954e79fae9310dc75b6070e1d625346
204 # 15 bytes should fail for CS3
205 Cipher = AES-128-CBC-CTS
207 Key = 636869636b656e207465726979616b69
208 IV = 00000000000000000000000000000000
209 Plaintext = 0102030405060708090A0B0C0D0E0F
210 Result = CIPHERUPDATE_ERROR
212 # 16 bytes should fail for CS3 (since it always needs 2 blocks).
213 Cipher = AES-128-CBC-CTS
215 Key = 636869636b656e207465726979616b69
216 IV = 00000000000000000000000000000000
217 Plaintext = 0102030405060708090A0B0C0D0E0F00
218 Result = CIPHERUPDATE_ERROR