8 /* From NIST spec 800-38a on AES modes,
10 * http://csrc.nist.gov/CryptoToolkit/modes/800-38_Series_Publications/SP800-38A.pdf
12 * F.5 CTR Example Vectors
15 /* Zero-length data. Exposes bug reported by Tim Kosse, where
16 ctr_crypt increment the ctr when it shouldn't. */
17 test_cipher_ctr(&nettle_aes128
,
18 SHEX("2b7e151628aed2a6abf7158809cf4f3c"),
20 SHEX("f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"));
22 /* F.5.1 CTR-AES128.Encrypt */
23 test_cipher_ctr(&nettle_aes128
,
24 SHEX("2b7e151628aed2a6abf7158809cf4f3c"),
25 SHEX("6bc1bee22e409f96e93d7e117393172a"
26 "ae2d8a571e03ac9c9eb76fac45af8e51"
27 "30c81c46a35ce411e5fbc1191a0a52ef"
28 "f69f2445df4f9b17ad2b417be66c3710"),
29 SHEX("874d6191b620e3261bef6864990db6ce"
30 "9806f66b7970fdff8617187bb9fffdff"
31 "5ae4df3edbd5d35e5b4f09020db03eab"
32 "1e031dda2fbe03d1792170a0f3009cee"),
33 SHEX("f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"));
35 /* F.5.3 CTR-AES192.Encrypt */
36 test_cipher_ctr(&nettle_aes192
,
37 SHEX("8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b"),
38 SHEX("6bc1bee22e409f96e93d7e117393172a"
39 "ae2d8a571e03ac9c9eb76fac45af8e51"
40 "30c81c46a35ce411e5fbc1191a0a52ef"
41 "f69f2445df4f9b17ad2b417be66c3710"),
42 SHEX("1abc932417521ca24f2b0459fe7e6e0b"
43 "090339ec0aa6faefd5ccc2c6f4ce8e94"
44 "1e36b26bd1ebc670d1bd1d665620abf7"
45 "4f78a7f6d29809585a97daec58c6b050"),
46 SHEX("f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"));
48 /* F.5.5 CTR-AES256.Encrypt */
49 test_cipher_ctr(&nettle_aes256
,
50 SHEX("603deb1015ca71be2b73aef0857d7781"
51 "1f352c073b6108d72d9810a30914dff4"),
52 SHEX("6bc1bee22e409f96e93d7e117393172a"
53 "ae2d8a571e03ac9c9eb76fac45af8e51"
54 "30c81c46a35ce411e5fbc1191a0a52ef"
55 "f69f2445df4f9b17ad2b417be66c3710"),
56 SHEX("601ec313775789a5b7a7f504bbf3d228"
57 "f443e3ca4d62b59aca84e990cacaf5c5"
58 "2b0930daa23de94ce87017ba2d84988d"
59 "dfc9c58db67aada613c2dd08457941a6"),
60 SHEX("f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"));
64 F.5.1 CTR-AES128.Encrypt
65 Key 2b7e151628aed2a6abf7158809cf4f3c
66 Init. Counter f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
68 Input Block f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
69 Output Block ec8cdf7398607cb0f2d21675ea9ea1e4
70 Plaintext 6bc1bee22e409f96e93d7e117393172a
71 Ciphertext 874d6191b620e3261bef6864990db6ce
73 Input Block f0f1f2f3f4f5f6f7f8f9fafbfcfdff00
74 Output Block 362b7c3c6773516318a077d7fc5073ae
75 Plaintext ae2d8a571e03ac9c9eb76fac45af8e51
76 Ciphertext 9806f66b7970fdff8617187bb9fffdff
78 Input Block f0f1f2f3f4f5f6f7f8f9fafbfcfdff01
79 Output Block 6a2cc3787889374fbeb4c81b17ba6c44
80 Plaintext 30c81c46a35ce411e5fbc1191a0a52ef
81 Ciphertext 5ae4df3edbd5d35e5b4f09020db03eab
83 Input Block f0f1f2f3f4f5f6f7f8f9fafbfcfdff02
84 Output Block e89c399ff0f198c6d40a31db156cabfe
85 Plaintext f69f2445df4f9b17ad2b417be66c3710
86 Ciphertext 1e031dda2fbe03d1792170a0f3009cee
88 F.5.2 CTR-AES128.Decrypt
89 Key 2b7e151628aed2a6abf7158809cf4f3c
90 Init. Counter f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
92 Input Block f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
93 Output Block ec8cdf7398607cb0f2d21675ea9ea1e4
94 Ciphertext 874d6191b620e3261bef6864990db6ce
95 Plaintext 6bc1bee22e409f96e93d7e117393172a
97 Input Block f0f1f2f3f4f5f6f7f8f9fafbfcfdff00
98 Output Block 362b7c3c6773516318a077d7fc5073ae
99 Ciphertext 9806f66b7970fdff8617187bb9fffdff
100 Plaintext ae2d8a571e03ac9c9eb76fac45af8e51
102 Input Block f0f1f2f3f4f5f6f7f8f9fafbfcfdff01
103 Output Block 6a2cc3787889374fbeb4c81b17ba6c44
104 Ciphertext 5ae4df3edbd5d35e5b4f09020db03eab
105 Plaintext 30c81c46a35ce411e5fbc1191a0a52ef
107 Input Block f0f1f2f3f4f5f6f7f8f9fafbfcfdff02
108 Output Block e89c399ff0f198c6d40a31db156cabfe
109 Ciphertext 1e031dda2fbe03d1792170a0f3009cee
110 Plaintext f69f2445df4f9b17ad2b417be66c3710
112 F.5.3 CTR-AES192.Encrypt
113 Key 8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b
114 Init. Counter f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
116 Input Block f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
117 Output Block 717d2dc639128334a6167a488ded7921
118 Plaintext 6bc1bee22e409f96e93d7e117393172a
119 Ciphertext 1abc932417521ca24f2b0459fe7e6e0b
121 Input Block f0f1f2f3f4f5f6f7f8f9fafbfcfdff00
122 Output Block a72eb3bb14a556734b7bad6ab16100c5
123 Plaintext ae2d8a571e03ac9c9eb76fac45af8e51
124 Ciphertext 090339ec0aa6faefd5ccc2c6f4ce8e94
126 Input Block f0f1f2f3f4f5f6f7f8f9fafbfcfdff01
127 Output Block 2efeae2d72b722613446dc7f4c2af918
128 Plaintext 30c81c46a35ce411e5fbc1191a0a52ef
129 Ciphertext 1e36b26bd1ebc670d1bd1d665620abf7
131 Input Block f0f1f2f3f4f5f6f7f8f9fafbfcfdff02
132 Output Block b9e783b30dd7924ff7bc9b97beaa8740
133 Plaintext f69f2445df4f9b17ad2b417be66c3710
134 Ciphertext 4f78a7f6d29809585a97daec58c6b050
136 F.5.4 CTR-AES192.Decrypt
137 Key 8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b
138 Init. Counter f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
140 Input Block f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
141 Output Block 717d2dc639128334a6167a488ded7921
142 Ciphertext 1abc932417521ca24f2b0459fe7e6e0b
143 Plaintext 6bc1bee22e409f96e93d7e117393172a
145 Input Block f0f1f2f3f4f5f6f7f8f9fafbfcfdff00
146 Output Block a72eb3bb14a556734b7bad6ab16100c5
147 Ciphertext 090339ec0aa6faefd5ccc2c6f4ce8e94
148 Plaintext ae2d8a571e03ac9c9eb76fac45af8e51
150 Input Block f0f1f2f3f4f5f6f7f8f9fafbfcfdff01
151 Output Block 2efeae2d72b722613446dc7f4c2af918
152 Ciphertext 1e36b26bd1ebc670d1bd1d665620abf7
153 Plaintext 30c81c46a35ce411e5fbc1191a0a52ef
155 Input Block f0f1f2f3f4f5f6f7f8f9fafbfcfdff02
156 Output Block b9e783b30dd7924ff7bc9b97beaa8740
157 Ciphertext 4f78a7f6d29809585a97daec58c6b050
158 Plaintext f69f2445df4f9b17ad2b417be66c3710
160 F.5.5 CTR-AES256.Encrypt
161 Key 603deb1015ca71be2b73aef0857d7781
162 1f352c073b6108d72d9810a30914dff4
163 Init. Counter f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
165 Input Block f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
166 Output Block 0bdf7df1591716335e9a8b15c860c502
167 Plaintext 6bc1bee22e409f96e93d7e117393172a
168 Ciphertext 601ec313775789a5b7a7f504bbf3d228
170 Input Block f0f1f2f3f4f5f6f7f8f9fafbfcfdff00
171 Output Block 5a6e699d536119065433863c8f657b94
172 Plaintext ae2d8a571e03ac9c9eb76fac45af8e51
173 Ciphertext f443e3ca4d62b59aca84e990cacaf5c5
175 Input Block f0f1f2f3f4f5f6f7f8f9fafbfcfdff01
176 Output Block 1bc12c9c01610d5d0d8bd6a3378eca62
177 Plaintext 30c81c46a35ce411e5fbc1191a0a52ef
178 Ciphertext 2b0930daa23de94ce87017ba2d84988d
180 Input Block f0f1f2f3f4f5f6f7f8f9fafbfcfdff02
181 Output Block 2956e1c8693536b1bee99c73a31576b6
182 Plaintext f69f2445df4f9b17ad2b417be66c3710
183 Ciphertext dfc9c58db67aada613c2dd08457941a6
185 F.5.6 CTR-AES256.Decrypt
186 Key 603deb1015ca71be2b73aef0857d7781
187 1f352c073b6108d72d9810a30914dff4
188 Init. Counter f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
190 Input Block f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
191 Output Block 0bdf7df1591716335e9a8b15c860c502
192 Ciphertext 601ec313775789a5b7a7f504bbf3d228
193 Plaintext 6bc1bee22e409f96e93d7e117393172a
195 Input Block f0f1f2f3f4f5f6f7f8f9fafbfcfdff00
196 Output Block 5a6e699d536119065433863c8f657b94
197 Ciphertext f443e3ca4d62b59aca84e990cacaf5c5
198 Plaintext ae2d8a571e03ac9c9eb76fac45af8e51
200 Input Block f0f1f2f3f4f5f6f7f8f9fafbfcfdff01
201 Output Block 1bc12c9c01610d5d0d8bd6a3378eca62
202 Ciphertext 2b0930daa23de94ce87017ba2d84988d
203 Plaintext 30c81c46a35ce411e5fbc1191a0a52ef
205 Input Block f0f1f2f3f4f5f6f7f8f9fafbfcfdff02
206 Output Block 2956e1c8693536b1bee99c73a31576b6
207 Ciphertext dfc9c58db67aada613c2dd08457941a6
208 Plaintext f69f2445df4f9b17ad2b417be66c3710