• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2014 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include <gtest/gtest.h>
18 #include <string.h>
19 
20 #include <utils/String8.h>
21 #include <utils/Vector.h>
22 
23 #include "AesCtrDecryptor.h"
24 
25 namespace clearkeydrm {
26 
27 using namespace android;
28 
29 class AesCtrDecryptorTest : public ::testing::Test {
30   protected:
31     typedef uint8_t Key[kBlockSize];
32 
attemptDecrypt(const Key & key,const Iv & iv,const uint8_t * source,uint8_t * destination,const SubSample * subSamples,size_t numSubSamples,size_t * bytesDecryptedOut)33     status_t attemptDecrypt(const Key& key, const Iv& iv, const uint8_t* source,
34                             uint8_t* destination, const SubSample* subSamples,
35                             size_t numSubSamples, size_t* bytesDecryptedOut) {
36         Vector<uint8_t> keyVector;
37         keyVector.appendArray(key, kBlockSize);
38 
39         AesCtrDecryptor decryptor;
40         return decryptor.decrypt(keyVector, iv, source, destination, subSamples,
41                                  numSubSamples, bytesDecryptedOut);
42     }
43 
44     template <size_t totalSize>
attemptDecryptExpectingSuccess(const Key & key,const Iv & iv,const uint8_t * encrypted,const uint8_t * decrypted,const SubSample * subSamples,size_t numSubSamples)45     void attemptDecryptExpectingSuccess(const Key& key, const Iv& iv,
46                                         const uint8_t* encrypted,
47                                         const uint8_t* decrypted,
48                                         const SubSample* subSamples,
49                                         size_t numSubSamples) {
50         uint8_t outputBuffer[totalSize] = {};
51         size_t bytesDecrypted = 0;
52         ASSERT_EQ(android::OK, attemptDecrypt(key, iv, encrypted, outputBuffer,
53                                               subSamples, numSubSamples,
54                                               &bytesDecrypted));
55         EXPECT_EQ(totalSize, bytesDecrypted);
56         EXPECT_EQ(0, memcmp(outputBuffer, decrypted, totalSize));
57     }
58 };
59 
TEST_F(AesCtrDecryptorTest,DecryptsContiguousEncryptedBlock)60 TEST_F(AesCtrDecryptorTest, DecryptsContiguousEncryptedBlock) {
61     const size_t kTotalSize = 64;
62     const size_t kNumSubsamples = 1;
63 
64     // Test vectors from NIST-800-38A
65     Key key = {
66         0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
67         0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c
68     };
69 
70     Iv iv = {
71         0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
72         0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
73     };
74 
75     uint8_t encrypted[kTotalSize] = {
76         0x87, 0x4d, 0x61, 0x91, 0xb6, 0x20, 0xe3, 0x26,
77         0x1b, 0xef, 0x68, 0x64, 0x99, 0x0d, 0xb6, 0xce,
78         0x98, 0x06, 0xf6, 0x6b, 0x79, 0x70, 0xfd, 0xff,
79         0x86, 0x17, 0x18, 0x7b, 0xb9, 0xff, 0xfd, 0xff,
80         0x5a, 0xe4, 0xdf, 0x3e, 0xdb, 0xd5, 0xd3, 0x5e,
81         0x5b, 0x4f, 0x09, 0x02, 0x0d, 0xb0, 0x3e, 0xab,
82         0x1e, 0x03, 0x1d, 0xda, 0x2f, 0xbe, 0x03, 0xd1,
83         0x79, 0x21, 0x70, 0xa0, 0xf3, 0x00, 0x9c, 0xee
84     };
85 
86     uint8_t decrypted[kTotalSize] = {
87         0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
88         0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
89         0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
90         0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
91         0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
92         0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
93         0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
94         0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10
95     };
96 
97     SubSample subSamples[kNumSubsamples] = {
98         {0, 64}
99     };
100 
101     attemptDecryptExpectingSuccess<kTotalSize>(key, iv, encrypted, decrypted,
102                                                subSamples, kNumSubsamples);
103 }
104 
TEST_F(AesCtrDecryptorTest,DecryptsAlignedBifurcatedEncryptedBlock)105 TEST_F(AesCtrDecryptorTest, DecryptsAlignedBifurcatedEncryptedBlock) {
106     const size_t kTotalSize = 64;
107     const size_t kNumSubsamples = 2;
108 
109     // Test vectors from NIST-800-38A
110     Key key = {
111         0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
112         0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c
113     };
114 
115     Iv iv = {
116         0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
117         0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
118     };
119 
120     uint8_t encrypted[kTotalSize] = {
121         0x87, 0x4d, 0x61, 0x91, 0xb6, 0x20, 0xe3, 0x26,
122         0x1b, 0xef, 0x68, 0x64, 0x99, 0x0d, 0xb6, 0xce,
123         0x98, 0x06, 0xf6, 0x6b, 0x79, 0x70, 0xfd, 0xff,
124         0x86, 0x17, 0x18, 0x7b, 0xb9, 0xff, 0xfd, 0xff,
125         0x5a, 0xe4, 0xdf, 0x3e, 0xdb, 0xd5, 0xd3, 0x5e,
126         0x5b, 0x4f, 0x09, 0x02, 0x0d, 0xb0, 0x3e, 0xab,
127         0x1e, 0x03, 0x1d, 0xda, 0x2f, 0xbe, 0x03, 0xd1,
128         0x79, 0x21, 0x70, 0xa0, 0xf3, 0x00, 0x9c, 0xee
129     };
130 
131     uint8_t decrypted[kTotalSize] = {
132         0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
133         0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
134         0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
135         0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
136         0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
137         0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
138         0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
139         0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10
140     };
141 
142     SubSample subSamples[kNumSubsamples] = {
143         {0, 32},
144         {0, 32}
145     };
146 
147     attemptDecryptExpectingSuccess<kTotalSize>(key, iv, encrypted, decrypted,
148                                                subSamples, kNumSubsamples);
149 }
150 
TEST_F(AesCtrDecryptorTest,DecryptsUnalignedBifurcatedEncryptedBlock)151 TEST_F(AesCtrDecryptorTest, DecryptsUnalignedBifurcatedEncryptedBlock) {
152     const size_t kTotalSize = 64;
153     const size_t kNumSubsamples = 2;
154 
155     // Test vectors from NIST-800-38A
156     Key key = {
157         0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
158         0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c
159     };
160 
161     Iv iv = {
162         0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
163         0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
164     };
165 
166     uint8_t encrypted[kTotalSize] = {
167         0x87, 0x4d, 0x61, 0x91, 0xb6, 0x20, 0xe3, 0x26,
168         0x1b, 0xef, 0x68, 0x64, 0x99, 0x0d, 0xb6, 0xce,
169         0x98, 0x06, 0xf6, 0x6b, 0x79, 0x70, 0xfd, 0xff,
170         0x86, 0x17, 0x18, 0x7b, 0xb9, 0xff, 0xfd, 0xff,
171         0x5a, 0xe4, 0xdf, 0x3e, 0xdb, 0xd5, 0xd3, 0x5e,
172         0x5b, 0x4f, 0x09, 0x02, 0x0d, 0xb0, 0x3e, 0xab,
173         0x1e, 0x03, 0x1d, 0xda, 0x2f, 0xbe, 0x03, 0xd1,
174         0x79, 0x21, 0x70, 0xa0, 0xf3, 0x00, 0x9c, 0xee
175     };
176 
177     uint8_t decrypted[kTotalSize] = {
178         0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
179         0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
180         0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
181         0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
182         0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
183         0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
184         0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
185         0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10
186     };
187 
188     SubSample subSamples[kNumSubsamples] = {
189         {0, 29},
190         {0, 35}
191     };
192 
193     attemptDecryptExpectingSuccess<kTotalSize>(key, iv, encrypted, decrypted,
194                                                subSamples, kNumSubsamples);
195 }
196 
TEST_F(AesCtrDecryptorTest,DecryptsOneMixedSubSample)197 TEST_F(AesCtrDecryptorTest, DecryptsOneMixedSubSample) {
198     const size_t kTotalSize = 72;
199     const size_t kNumSubsamples = 1;
200 
201     // Based on test vectors from NIST-800-38A
202     Key key = {
203         0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
204         0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c
205     };
206 
207     Iv iv = {
208         0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
209         0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
210     };
211 
212     uint8_t encrypted[kTotalSize] = {
213         // 8 clear bytes
214         0xf0, 0x13, 0xca, 0xc7, 0x00, 0x64, 0x0b, 0xbb,
215         // 64 encrypted bytes
216         0x87, 0x4d, 0x61, 0x91, 0xb6, 0x20, 0xe3, 0x26,
217         0x1b, 0xef, 0x68, 0x64, 0x99, 0x0d, 0xb6, 0xce,
218         0x98, 0x06, 0xf6, 0x6b, 0x79, 0x70, 0xfd, 0xff,
219         0x86, 0x17, 0x18, 0x7b, 0xb9, 0xff, 0xfd, 0xff,
220         0x5a, 0xe4, 0xdf, 0x3e, 0xdb, 0xd5, 0xd3, 0x5e,
221         0x5b, 0x4f, 0x09, 0x02, 0x0d, 0xb0, 0x3e, 0xab,
222         0x1e, 0x03, 0x1d, 0xda, 0x2f, 0xbe, 0x03, 0xd1,
223         0x79, 0x21, 0x70, 0xa0, 0xf3, 0x00, 0x9c, 0xee
224     };
225 
226     uint8_t decrypted[kTotalSize] = {
227         0xf0, 0x13, 0xca, 0xc7, 0x00, 0x64, 0x0b, 0xbb,
228         0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
229         0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
230         0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
231         0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
232         0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
233         0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
234         0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
235         0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10
236     };
237 
238     SubSample subSamples[kNumSubsamples] = {
239         {8, 64}
240     };
241 
242     attemptDecryptExpectingSuccess<kTotalSize>(key, iv, encrypted, decrypted,
243                                                subSamples, kNumSubsamples);
244 }
245 
TEST_F(AesCtrDecryptorTest,DecryptsAlignedMixedSubSamples)246 TEST_F(AesCtrDecryptorTest, DecryptsAlignedMixedSubSamples) {
247     const size_t kTotalSize = 80;
248     const size_t kNumSubsamples = 2;
249 
250     // Based on test vectors from NIST-800-38A
251     Key key = {
252         0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
253         0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c
254     };
255 
256     Iv iv = {
257         0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
258         0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
259     };
260 
261     uint8_t encrypted[kTotalSize] = {
262         // 8 clear bytes
263         0xf0, 0x13, 0xca, 0xc7, 0x00, 0x64, 0x0b, 0xbb,
264         // 32 encrypted bytes
265         0x87, 0x4d, 0x61, 0x91, 0xb6, 0x20, 0xe3, 0x26,
266         0x1b, 0xef, 0x68, 0x64, 0x99, 0x0d, 0xb6, 0xce,
267         0x98, 0x06, 0xf6, 0x6b, 0x79, 0x70, 0xfd, 0xff,
268         0x86, 0x17, 0x18, 0x7b, 0xb9, 0xff, 0xfd, 0xff,
269         // 8 clear bytes
270         0x94, 0xba, 0x88, 0x2e, 0x0e, 0x12, 0x11, 0x55,
271         // 32 encrypted bytes
272         0x5a, 0xe4, 0xdf, 0x3e, 0xdb, 0xd5, 0xd3, 0x5e,
273         0x5b, 0x4f, 0x09, 0x02, 0x0d, 0xb0, 0x3e, 0xab,
274         0x1e, 0x03, 0x1d, 0xda, 0x2f, 0xbe, 0x03, 0xd1,
275         0x79, 0x21, 0x70, 0xa0, 0xf3, 0x00, 0x9c, 0xee
276     };
277 
278     uint8_t decrypted[kTotalSize] = {
279         0xf0, 0x13, 0xca, 0xc7, 0x00, 0x64, 0x0b, 0xbb,
280         0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
281         0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
282         0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
283         0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
284         0x94, 0xba, 0x88, 0x2e, 0x0e, 0x12, 0x11, 0x55,
285         0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
286         0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
287         0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
288         0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10
289     };
290 
291     SubSample subSamples[kNumSubsamples] = {
292         {8, 32},
293         {8, 32}
294     };
295 
296     attemptDecryptExpectingSuccess<kTotalSize>(key, iv, encrypted, decrypted,
297                                                subSamples, kNumSubsamples);
298 }
299 
TEST_F(AesCtrDecryptorTest,DecryptsUnalignedMixedSubSamples)300 TEST_F(AesCtrDecryptorTest, DecryptsUnalignedMixedSubSamples) {
301     const size_t kTotalSize = 80;
302     const size_t kNumSubsamples = 2;
303 
304     // Based on test vectors from NIST-800-38A
305     Key key = {
306         0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
307         0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c
308     };
309 
310     Iv iv = {
311         0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
312         0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
313     };
314 
315     uint8_t encrypted[kTotalSize] = {
316         // 8 clear bytes
317         0xf0, 0x13, 0xca, 0xc7, 0x00, 0x64, 0x0b, 0xbb,
318         // 30 encrypted bytes
319         0x87, 0x4d, 0x61, 0x91, 0xb6, 0x20, 0xe3, 0x26,
320         0x1b, 0xef, 0x68, 0x64, 0x99, 0x0d, 0xb6, 0xce,
321         0x98, 0x06, 0xf6, 0x6b, 0x79, 0x70, 0xfd, 0xff,
322         0x86, 0x17, 0x18, 0x7b, 0xb9, 0xff,
323         // 8 clear bytes
324         0x94, 0xba, 0x88, 0x2e, 0x0e, 0x12, 0x11, 0x55,
325         // 34 encrypted bytes
326         0xfd, 0xff, 0x5a, 0xe4, 0xdf, 0x3e, 0xdb, 0xd5,
327         0xd3, 0x5e, 0x5b, 0x4f, 0x09, 0x02, 0x0d, 0xb0,
328         0x3e, 0xab, 0x1e, 0x03, 0x1d, 0xda, 0x2f, 0xbe,
329         0x03, 0xd1, 0x79, 0x21, 0x70, 0xa0, 0xf3, 0x00,
330         0x9c, 0xee
331     };
332 
333     uint8_t decrypted[kTotalSize] = {
334         0xf0, 0x13, 0xca, 0xc7, 0x00, 0x64, 0x0b, 0xbb,
335         0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
336         0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
337         0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
338         0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x94, 0xba,
339         0x88, 0x2e, 0x0e, 0x12, 0x11, 0x55, 0x8e, 0x51,
340         0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
341         0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
342         0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
343         0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10
344     };
345 
346     SubSample subSamples[kNumSubsamples] = {
347         {8, 30},
348         {8, 34}
349     };
350 
351     attemptDecryptExpectingSuccess<kTotalSize>(key, iv, encrypted, decrypted,
352                                                subSamples, kNumSubsamples);
353 }
354 
TEST_F(AesCtrDecryptorTest,DecryptsComplexMixedSubSamples)355 TEST_F(AesCtrDecryptorTest, DecryptsComplexMixedSubSamples) {
356     const size_t kTotalSize = 72;
357     const size_t kNumSubsamples = 6;
358 
359     // Based on test vectors from NIST-800-38A
360     Key key = {
361         0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
362         0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c
363     };
364 
365     Iv iv = {
366         0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
367         0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
368     };
369 
370     uint8_t encrypted[kTotalSize] = {
371         // 4 clear bytes
372         0xf0, 0x13, 0xca, 0xc7,
373         // 1 encrypted bytes
374         0x87,
375         // 9 encrypted bytes
376         0x4d, 0x61, 0x91, 0xb6, 0x20, 0xe3, 0x26, 0x1b,
377         0xef,
378         // 11 clear bytes
379         0x81, 0x4f, 0x24, 0x87, 0x0e, 0xde, 0xba, 0xad,
380         0x11, 0x9b, 0x46,
381         // 20 encrypted bytes
382         0x68, 0x64, 0x99, 0x0d, 0xb6, 0xce,
383         0x98, 0x06, 0xf6, 0x6b, 0x79, 0x70, 0xfd, 0xff,
384         0x86, 0x17, 0x18, 0x7b, 0xb9, 0xff,
385         // 8 clear bytes
386         0x94, 0xba, 0x88, 0x2e, 0x0e, 0x12, 0x11, 0x55,
387         // 3 clear bytes
388         0x10, 0xf5, 0x22,
389         // 14 encrypted bytes
390         0xfd, 0xff, 0x5a, 0xe4, 0xdf, 0x3e, 0xdb, 0xd5,
391         0xd3, 0x5e, 0x5b, 0x4f, 0x09, 0x02,
392         // 2 clear bytes
393         0x02, 0x01
394     };
395 
396     uint8_t decrypted[kTotalSize] = {
397         0xf0, 0x13, 0xca, 0xc7, 0x6b, 0xc1, 0xbe, 0xe2,
398         0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x81, 0x4f,
399         0x24, 0x87, 0x0e, 0xde, 0xba, 0xad, 0x11, 0x9b,
400         0x46, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, 0xae,
401         0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, 0x9e,
402         0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x94, 0xba, 0x88,
403         0x2e, 0x0e, 0x12, 0x11, 0x55, 0x10, 0xf5, 0x22,
404         0x8e, 0x51, 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c,
405         0xe4, 0x11, 0xe5, 0xfb, 0xc1, 0x19, 0x02, 0x01
406     };
407 
408     SubSample subSamples[kNumSubsamples] = {
409         {4, 1},
410         {0, 9},
411         {11, 20},
412         {8, 0},
413         {3, 14},
414         {2, 0}
415     };
416 
417     attemptDecryptExpectingSuccess<kTotalSize>(key, iv, encrypted, decrypted,
418                                                subSamples, kNumSubsamples);
419 }
420 
421 }  // namespace clearkeydrm
422