Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Side by Side Diff: ppapi/c/private/pp_content_decryptor.h

Issue 10857027: Add content decryptor related structs and update PP{P|B}_ContentDecryptor_Private. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename to pp_content_decryptor.idl Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 /* From private/pp_content_decryptor.idl modified Thu Aug 16 20:21:00 2012. */
7
8 #ifndef PPAPI_C_PRIVATE_PP_CONTENT_DECRYPTOR_H_
9 #define PPAPI_C_PRIVATE_PP_CONTENT_DECRYPTOR_H_
10
11 #include "ppapi/c/pp_macros.h"
12 #include "ppapi/c/pp_stdint.h"
13
14 /**
15 * @file
16 * The <code>PP_DecryptTrackingInfo</code> struct contains necessary information
17 * that can be used to associate the decrypted block with a decrypt request
18 * and/or an input block.
19 */
20
21
22 /**
23 * @addtogroup Structs
24 * @{
25 */
26 struct PP_DecryptTrackingInfo {
27 /**
28 * Client-specified identifier for the associated decrypt request. By using
29 * this value, the client can associate the decrypted block with a decryption
30 * request.
31 */
32 uint64_t request_id;
33 /**
34 * Timestamp in microseconds of the associated block. By using this value,
35 * the client can associate the decrypted (and decoded) data with an input
36 * block. This is needed because buffers may be delivered out of order and
37 * not in response to the <code>request_id</code> they were provided with.
38 */
39 int64_t timestamp;
40 };
41 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DecryptTrackingInfo, 16);
42
43 /**
44 * The <code>PP_DecryptSubsampleDescription</code> struct contains information
45 * to support subsample decryption.
46 *
47 * An input block can be split into several continuous subsamples.
48 * A <code>PP_DecryptSubsampleEntry</code> specifies the number of clear and
49 * cipher bytes in each subsample. For example, the following block has three
50 * subsamples:
51 *
52 * |<----- subsample1 ----->|<----- subsample2 ----->|<----- subsample3 ----->|
53 * | clear1 | cipher1 | clear2 | cipher2 | clear3 | cipher3 |
54 *
55 * For decryption, all of the cipher bytes in a block should be treated as a
56 * contiguous (in the subsample order) logical stream. The clear bytes should
57 * not be considered as part of decryption.
58 *
59 * Logical stream to decrypt: | cipher1 | cipher2 | cipher3 |
60 * Decrypted stream: | decrypted1| decrypted2 | decrypted3 |
61 *
62 * After decryption, the decrypted bytes should be copied over the position
63 * of the corresponding cipher bytes in the original block to form the output
64 * block. Following the above example, the decrypted block should be:
65 *
66 * |<----- subsample1 ----->|<----- subsample2 ----->|<----- subsample3 ----->|
67 * | clear1 | decrypted1| clear2 | decrypted2 | clear3 | decrypted3 |
68 */
69 struct PP_DecryptSubsampleDescription {
70 /**
71 * Size in bytes of clear data in a subsample entry.
72 */
73 uint32_t clear_bytes;
74 /**
75 * Size in bytes of encrypted data in a subsample entry.
76 */
77 uint32_t cipher_bytes;
78 };
79 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DecryptSubsampleDescription, 8);
80
81 /**
82 * The <code>PP_EncryptedBlockInfo</code> struct contains all the information
83 * needed to decrypt an encrypted block.
84 */
85 struct PP_EncryptedBlockInfo {
86 /**
87 * Information needed by the client to track the block to be decrypted.
88 */
89 struct PP_DecryptTrackingInfo tracking_info;
90 /**
91 * Size in bytes of data to be discarded before applying the decryption.
92 */
93 uint32_t data_offset;
94 /**
95 * Key ID of the block to be decrypted.
96 *
97 * TODO(xhwang): For WebM the key ID can be as large as 2048 bytes in theory.
98 * But it's not used in current implementations. If we really need to support
99 * it, we should move key ID out as a separate parameter, e.g.
100 * as a <code>PP_Var</code>, or make the whole
101 * <code>PP_EncryptedBlockInfo</code> as a <code>PP_Resource</code>.
102 */
103 uint8_t key_id[64];
104 uint32_t key_id_size;
105 /**
106 * Initialization vector of the block to be decrypted.
107 */
108 uint8_t iv[16];
109 uint32_t iv_size;
110 /**
111 * Checksum of the block to be decrypted.
112 */
113 uint8_t checksum[12];
114 uint32_t checksum_size;
115 /**
116 * Subsample information of the block to be decrypted.
117 */
118 struct PP_DecryptSubsampleDescription subsamples[16];
119 uint32_t num_subsamples;
120 };
121 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_EncryptedBlockInfo, 256);
122 /**
123 * @}
124 */
125
126 /**
127 * @addtogroup Enums
128 * @{
129 */
130 /**
131 * The <code>PP_DecryptResult</code> enum contains decryption and decoding
132 * result constants.
133 */
134 typedef enum {
135 /** The decryption (and/or decoding) operation finished successfully. */
136 PP_DECRYPTRESULT_SUCCESS = 0,
137 /** The decryptor did not have the necessary decryption key. */
138 PP_DECRYPTRESULT_DECRYPT_NOKEY = 1,
139 /** An unexpected error happened during decryption. */
140 PP_DECRYPTRESULT_DECRYPT_ERROR = 2,
141 /** An unexpected error happened during decoding. */
142 PP_DECRYPTRESULT_DECODE_ERROR = 3
143 } PP_DecryptResult;
144 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_DecryptResult, 4);
145 /**
146 * @}
147 */
148
149 /**
150 * @addtogroup Structs
151 * @{
152 */
153 /**
154 * The <code>PP_DecryptedBlockInfo</code> struct contains the tracking info and
155 * the decryption (and/or decoding) result associated with the decrypted block.
156 */
157 struct PP_DecryptedBlockInfo {
158 /**
159 * Information needed by the client to track the block to be decrypted.
160 */
161 struct PP_DecryptTrackingInfo tracking_info;
162 /**
163 * Result of the decryption (and/or decoding) operation.
164 */
165 PP_DecryptResult result;
166 /**
167 * 4-byte padding to make the size of <code>PP_DecryptedBlockInfo</code>
168 * a multiple of 8 bytes. The value of this field should not be used.
169 */
170 uint32_t padding;
171 };
172 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DecryptedBlockInfo, 24);
173 /**
174 * @}
175 */
176
177 #endif /* PPAPI_C_PRIVATE_PP_CONTENT_DECRYPTOR_H_ */
178
OLDNEW
« no previous file with comments | « ppapi/api/private/ppp_content_decryptor_private.idl ('k') | ppapi/c/private/ppb_content_decryptor_private.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698