OLD | NEW |
---|---|
(Empty) | |
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 * Use of this source code is governed by a BSD-style license that can be | |
3 * found in the LICENSE file. | |
4 */ | |
5 | |
6 /** | |
7 * The <code>PP_DecryptTrackingInfo</code> struct contains necessary information | |
8 * that can be used to associate the decrypted block with a decrypt request | |
9 * and/or an input block. | |
10 */ | |
11 [assert_size(16)] | |
12 struct PP_DecryptTrackingInfo { | |
13 /** | |
14 * Client-specified identifier for the associated decrypt request. By using | |
15 * this value, the client can associate the decrypted block with a decryption | |
16 * request. | |
17 */ | |
18 uint64_t request_id; | |
19 | |
20 /** | |
21 * Timestamp in microseconds of the associated block. By using this value, | |
22 * the client can associate the decrypted (and decoded) data with an input | |
23 * block. This is needed because buffers may be delivered out of order and | |
24 * not in response to the <code>request_id</code> they were provided with. | |
25 */ | |
26 int64_t timestamp; | |
27 }; | |
28 | |
29 /** | |
30 * The <code>PP_DecryptSubsampleDescription</code> struct contains information | |
31 * to support subsample decryption. | |
32 * | |
33 * An input block can be split into several continuous subsamples. | |
34 * A <code>PP_DecryptSubsampleEntry</code> specifies the number of clear and | |
35 * cipher bytes in each subsample. For example, the following block has three | |
36 * subsamples: | |
37 * | |
38 * |<----- subsample1 ----->|<----- subsample2 ----->|<----- subsample3 ----->| | |
39 * | clear1 | cipher1 | clear2 | cipher2 | clear3 | cipher3 | | |
40 * | |
41 * For decryption, all of the cipher bytes in a block should be treated as a | |
42 * contiguous (in the subsample order) logical stream. The clear bytes should | |
43 * not be considered as part of decryption. | |
44 * | |
45 * Logical stream to decrypt: | cipher1 | cipher2 | cipher3 | | |
46 * Decrypted stream: | decrypted1| decrypted2 | decrypted3 | | |
47 * | |
48 * After decryption, the decrypted bytes should be copied over the position | |
49 * of the corresponding cipher bytes in the original block to form the output | |
50 * block. Following the above example, the decrypted block should be: | |
51 * | |
52 * |<----- subsample1 ----->|<----- subsample2 ----->|<----- subsample3 ----->| | |
53 * | clear1 | decrypted1| clear2 | decrypted2 | clear3 | decrypted3 | | |
54 */ | |
55 [assert_size(8)] | |
56 struct PP_DecryptSubsampleDescription { | |
57 /** | |
58 * Size in bytes of clear data in a subsample entry. | |
59 */ | |
60 uint32_t clear_bytes; | |
61 | |
62 /** | |
63 * Size in bytes of encrypted data in a subsample entry. | |
64 */ | |
65 uint32_t cipher_bytes; | |
66 }; | |
67 | |
68 /** | |
69 * The <code>PP_EncryptedBlockInfo</code> struct contains all information | |
dmichael (off chromium)
2012/08/17 02:24:06
nit: all +the+ information
xhwang
2012/08/17 03:24:53
Done.
| |
70 * needed to decrypt an encrypted block. | |
71 */ | |
72 [assert_size(256)] | |
73 struct PP_EncryptedBlockInfo { | |
74 /** | |
75 * Information needed by the client to track the block to be decrypted. | |
76 */ | |
77 PP_DecryptTrackingInfo tracking_info; | |
78 | |
79 /** | |
80 * Size in bytes of data to be discarded before applying the decryption. | |
81 */ | |
82 uint32_t data_offset; | |
83 | |
84 /** | |
85 * Key ID of the block to be decrypted. | |
86 * | |
87 * TODO(xhwang): For WebM the key ID can be as large as 2048 bytes in theory. | |
88 * But it's not used in current implementations. If we really need to support | |
89 * it, we should move key ID out as a separate parameter, e.g. | |
90 * as a <code>PP_Var</code>, or make the whole | |
91 * <code>PP_EncryptedBlockInfo</code> as a <code>PP_Resource</code>. | |
92 */ | |
93 uint8_t[64] key_id; | |
94 uint32_t key_id_size; | |
95 | |
96 /** | |
97 * Initialization vector of the block to be decrypted. | |
98 */ | |
99 uint8_t[16] iv; | |
100 uint32_t iv_size; | |
101 | |
102 /** | |
103 * Checksum of the block to be decrypted. | |
104 */ | |
105 uint8_t[12] checksum; | |
106 uint32_t checksum_size; | |
107 | |
108 /** | |
109 * Subsample information of the block to be decrypted. | |
110 */ | |
111 PP_DecryptSubsampleDescription[16] subsamples; | |
112 uint32_t num_subsamples; | |
113 }; | |
114 | |
115 /** | |
116 * The <code>PP_DecryptResult</code> enum contains decryption and decoding | |
117 * result constants. | |
118 */ | |
119 [assert_size(4)] | |
120 enum PP_DecryptResult { | |
121 /** The decryption (and/or decoding) operation finished successfully. */ | |
122 PP_DECRYPTRESULT_SUCCESS = 0, | |
123 /** The decryptor did not have the necessary decryption key. */ | |
124 PP_DECRYPTRESULT_DECRYPT_NOKEY = 1, | |
125 /** Unexpected error happened during decryption. */ | |
dmichael (off chromium)
2012/08/17 02:24:06
nit: +An+ unexpected
xhwang
2012/08/17 03:24:53
Done.
| |
126 PP_DECRYPTRESULT_DECRYPT_ERROR = 2, | |
127 /** Unexpected error happened during decocding. */ | |
Tom Finegan
2012/08/17 01:41:55
s/decocding/decoding/
dmichael (off chromium)
2012/08/17 02:24:06
nit: +An+ unexpected
xhwang
2012/08/17 03:24:53
Done.
xhwang
2012/08/17 03:24:53
Done.
| |
128 PP_DECRYPTRESULT_DECODE_ERROR = 3 | |
129 }; | |
130 | |
131 /** | |
132 * The <code>PP_DecryptedBlockInfo</code> struct contains the tracking info and | |
133 * the decryption (and/or decoding) result associated with the decrypted block. | |
134 */ | |
135 [assert_size(24)] | |
136 struct PP_DecryptedBlockInfo { | |
137 /** | |
138 * Information needed by the client to track the block to be decrypted. | |
139 */ | |
140 PP_DecryptTrackingInfo tracking_info; | |
141 | |
142 /** | |
143 * Result of the decryption (and/or decoding) operation. | |
144 */ | |
145 PP_DecryptResult result; | |
146 | |
147 /** | |
148 * 4-byte padding to make the size of <code>PP_DecryptedBlockInfo</code> | |
149 * a multiple of 8 bytes. The value of this field should not be used. | |
150 */ | |
151 uint32_t padding; | |
152 }; | |
OLD | NEW |