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 /* From private/pp_decrypt_config.idl modified Wed Aug 15 19:51:27 2012. */ |
| 7 |
| 8 #ifndef PPAPI_C_PRIVATE_PP_DECRYPT_CONFIG_H_ |
| 9 #define PPAPI_C_PRIVATE_PP_DECRYPT_CONFIG_H_ |
| 10 |
| 11 #include "ppapi/c/pp_macros.h" |
| 12 #include "ppapi/c/pp_stdint.h" |
| 13 |
| 14 /** |
| 15 * @file |
| 16 * The data structure that can be used to associate the decrypted data with a |
| 17 * decrypt request and/or an input buffer. |
| 18 */ |
| 19 |
| 20 |
| 21 /** |
| 22 * @addtogroup Structs |
| 23 * @{ |
| 24 */ |
| 25 struct PP_DecryptTrackingInfo { |
| 26 /** |
| 27 * Client-specified identifier for the associated decrypt request. By using |
| 28 * this value client can associate the decrypted data with a decryption |
| 29 * request. |
| 30 */ |
| 31 uint64_t request_id; |
| 32 /** |
| 33 * Timestamp in milliseconds of the associated buffer. By using this value |
| 34 * client can associate the decrypted (and decoded) data with an input buffer. |
| 35 */ |
| 36 int64_t timestamp; |
| 37 /** |
| 38 * Duration in milliseconds of the associated buffer. |
| 39 */ |
| 40 int64_t duration; |
| 41 }; |
| 42 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DecryptTrackingInfo, 24); |
| 43 |
| 44 /** |
| 45 * The data structure for decryption subsample entry. |
| 46 * |
| 47 * An input buffer 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 buffer 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 buffer should be concatenated |
| 56 * (in the subsample order) into a single logical stream. The clear bytes should |
| 57 * not be considered as part of decryption. |
| 58 * |
| 59 * 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 buffer to form the output |
| 64 * buffer. Following the above example, the decrypted buffer should be: |
| 65 * |
| 66 * |<----- subsample1 ----->|<----- subsample2 ----->|<----- subsample3 ----->| |
| 67 * | clear1 | decrypted1| clear2 | decrypted2 | clear3 | decrypted3 | |
| 68 */ |
| 69 struct PP_DecryptSubsampleEntry { |
| 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_DecryptSubsampleEntry, 8); |
| 80 |
| 81 /** |
| 82 * The data structure that contains all information needed to decrypt a buffer. |
| 83 */ |
| 84 struct PP_DecryptConfig { |
| 85 /** |
| 86 * Information needed by the client to track the buffer to be decrypted. |
| 87 */ |
| 88 struct PP_DecryptTrackingInfo tracking_info; |
| 89 /** |
| 90 * Size of data to be discarded before applying the decryption (in bytes). |
| 91 */ |
| 92 uint32_t data_offset; |
| 93 /** |
| 94 * Key ID of the buffer to be decrypted. |
| 95 */ |
| 96 uint8_t key_id[68]; |
| 97 uint32_t key_id_size; |
| 98 /** |
| 99 * Initialization vector of the buffer to be decrypted. |
| 100 */ |
| 101 uint8_t iv[64]; |
| 102 uint32_t iv_size; |
| 103 /** |
| 104 * Checksum of the buffer to be decrypted. |
| 105 */ |
| 106 uint8_t checksum[64]; |
| 107 uint32_t checksum_size; |
| 108 /** |
| 109 * Subsamples of the buffer to be decrypted. |
| 110 */ |
| 111 struct PP_DecryptSubsampleEntry subsamples[16]; |
| 112 uint32_t num_subsamples; |
| 113 }; |
| 114 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DecryptConfig, 368); |
| 115 /** |
| 116 * @} |
| 117 */ |
| 118 |
| 119 #endif /* PPAPI_C_PRIVATE_PP_DECRYPT_CONFIG_H_ */ |
| 120 |
OLD | NEW |