kodi
stream_crypto.h
1 /*
2  * Copyright (C) 2017-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #ifndef C_API_ADDONINSTANCE_INPUTSTREAM_STREAMCRYPTO_H
10 #define C_API_ADDONINSTANCE_INPUTSTREAM_STREAMCRYPTO_H
11 
12 #include <stdint.h>
13 #include <string.h>
14 
15 #define STREAMCRYPTO_VERSION_LEVEL 2
16 
17 #ifdef __cplusplus
18 extern "C"
19 {
20 #endif /* __cplusplus */
21 
22  //============================================================================
34  {
37 
40 
43 
46 
49 
52  };
54  //----------------------------------------------------------------------------
55 
56  //============================================================================
67  {
70 
74  };
76  //----------------------------------------------------------------------------
77 
78  //============================================================================
86  {
88  uint16_t numSubSamples;
89 
91  uint16_t flags;
92 
95  uint16_t* clearBytes;
96 
99  uint32_t* cipherBytes;
100 
102  uint8_t iv[16];
103 
105  uint8_t kid[16];
106 
108  uint16_t mode;
109 
111  uint8_t cryptBlocks;
112 
114  uint8_t skipBlocks;
115  };
117  //----------------------------------------------------------------------------
118 
119  // Data to manage stream cryptography
121  {
122  // keysystem for encrypted media, STREAM_CRYPTO_KEY_SYSTEM_NONE for unencrypted
123  // media.
124  //
125  // See STREAM_CRYPTO_KEY_SYSTEM for available options.
126  enum STREAM_CRYPTO_KEY_SYSTEM keySystem;
127 
128  // Flags to use special conditions, see STREAM_CRYPTO_FLAGS for available flags.
129  uint8_t flags;
130 
131  // The crypto session key id.
132  char sessionId[256];
133  };
135  //----------------------------------------------------------------------------
136 
137 #ifdef __cplusplus
138 } /* extern "C" */
139 #endif /* __cplusplus */
140 
141 #endif /* !C_API_ADDONINSTANCE_INPUTSTREAM_STREAMCRYPTO_H */
uint8_t cryptBlocks
Crypt blocks - number of blocks to encrypt in sample encryption pattern.
Definition: stream_crypto.h:111
uint16_t * clearBytes
numSubSamples uint16_t&#39;s which define the size of clear size of a subsample.
Definition: stream_crypto.h:95
uint16_t mode
Encryption mode.
Definition: stream_crypto.h:108
uint8_t kid[16]
Key id.
Definition: stream_crypto.h:105
2 - To use Playready for processing
Definition: stream_crypto.h:42
uint16_t flags
Flags for later use.
Definition: stream_crypto.h:91
uint32_t * cipherBytes
numSubSamples uint32_t&#39;s which define the size of cipher size of a subsample.
Definition: stream_crypto.h:99
Definition: stream_crypto.h:85
1 - To use Widevine for processing
Definition: stream_crypto.h:39
Definition: stream_crypto.h:120
0 - If no path is to be used, this is the default
Definition: stream_crypto.h:36
STREAM_CRYPTO_KEY_SYSTEM
Definition: stream_crypto.h:33
uint8_t skipBlocks
Skip blocks - number of blocks to skip in sample encryption pattern.
Definition: stream_crypto.h:114
5 - The maximum value to use in a list.
Definition: stream_crypto.h:51
uint8_t iv[16]
Initialization vector.
Definition: stream_crypto.h:102
4 - To use ClearKey for processing
Definition: stream_crypto.h:48
0000 0000 - Empty to set if nothing is used.
Definition: stream_crypto.h:69
STREAM_CRYPTO_FLAGS
Definition: stream_crypto.h:66
uint16_t numSubSamples
Number of subsamples.
Definition: stream_crypto.h:88
0000 0001 - Is set in flags if decoding has to be done in trusted execution environment (TEE)...
Definition: stream_crypto.h:73
3 - To use Wiseplay for processing
Definition: stream_crypto.h:45