1 /*
2  * Copyright (c) 2011 Trusted Logic S.A.
3  * All Rights Reserved.
4  *
5  * This software is the confidential and proprietary information of
6  * Trusted Logic S.A. ("Confidential Information"). You shall not
7  * disclose such Confidential Information and shall use it only in
8  * accordance with the terms of the license agreement you entered
9  * into with Trusted Logic S.A.
10  *
11  * TRUSTED LOGIC S.A. MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE
12  * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING
13  * BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
14  * FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. TRUSTED LOGIC S.A. SHALL
15  * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING,
16  * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
17  */
18 #ifndef   __WVDRM_PROTOCOL_H__
19 #define   __WVDRM_PROTOCOL_H__
20 
21 #include <common_secure_driver_protocol.h>
22 
23 /* 45544DF9-B1DF-9BEE-D0B9-0C98CE3B41F6 */
24 #define WVDRM_UUID {0x45544DF9, 0xB1DF, 0x9BEE, {0xD0, 0xB9, 0x0C, 0x98, 0xCE, 0x3B, 0x41, 0xF6}}
25 
26 /*
27  * Persistently install the DRM "key box" previously wrapped
28  * with WRAP_KEYBOX
29  *
30  * Param #0: MEMREF_INPUT:
31  *    The encrypted keybox
32  */
33 #define WVDRM_INSTALL_KEYBOX 0x00001000
34 
35 /*
36  * Test if a keybox is provisioned and optionnally get its key data
37  *
38  * #0:
39  *   - NONE: for testing if the keybox is valid (returns S_ERROR_ITEM_NOT_FOUND if not)
40  *   - MEMREF_OUTPUT: to actually get the key data
41  */
42 #define WVDRM_GET_KEY_DATA 0x00001001
43 
44 /*
45  * Generate random data
46  *
47  * #0:
48  *   - MEMREF_OUTPUT: buffer to fill with random data
49  */
50 #define WVDRM_GET_RANDOM 0x00001002
51 
52 /*
53  * Get the device ID
54  *
55  * #0: MEMREF_OUTPUT: filled with the device ID
56  */
57 #define WVDRM_GET_DEVICE_ID 0x00001003
58 
59 /*
60  * Optionnally decrypt a keybox with a transport key
61  * and wrap it with a device specific key. The result
62  * can be later passed to INSTALL_KEYBOX
63  *
64  * #0: MEMREF_INPUT: the input keybox
65  *      - either in cleartext if param #2 is NONE
66  *      - or encrypted with the key in param #2
67  * #1: MEMREF_OUTPUT: the resulting wrapped key box
68  * #2:
69  *     - NONE: param#0 is the clear-text keybox
70  *     - MEMREF_INPUT: a transport key, in which case
71  *       param#0 is the encryption with AES-CBC-128 of the
72  *       keybox with an IV filled with zeros
73  */
74 #define WVDRM_WRAP_KEYBOX 0x00001004
75 
76 /*
77  * Unwrap an asset key. The asset key is stored in transient memory
78  * but available globally to all sessons. There can be only one asset key
79  * at a time.
80  *
81  * #0: MEMREF_INPUT
82  */
83 #define WVDRM_SET_ENTITLEMENT_KEY 0x00002000
84 
85 /*
86  * Decrypt the ECM (Entitlement Control Message = content key) using the asset key.
87  * Store the flags associated with the ECM. These flags will be later used, e.g.,
88  * to activate HDCP protection. Also returns the flags.
89  *
90  * #0: MEMREF_INPUT
91  * #1: VALUE_OUTPUT: a=flags
92  *
93  */
94 #define WVDRM_DERIVE_CONTROL_WORD 0x00002001
95 
96 /*
97  * Decrypt a chunk of content from a non-secure buffer into
98  * a secure buffer opaquely referred to as an offset within
99  * the Decrypted-Encoded-Buffer part of the carveout.
100  *
101  * #0: MEMREF_INPUT: the encrypted content
102  * #1: VALUE_INPUT:
103  *     [in]  a=physical address of the ION handle, b=size of the handle
104  * #2: MEMREF_INOUT: the IV
105  * #3: VALUE_INOUT:
106  *     [in]  a=offset from the physical address of the ION handle, b=max size
107  *     [out] b=actual size or required size
108  */
109 #define WVDRM_DECRYPT_VIDEO 0x00002002
110 
111 /*
112  * Decrypt a chunk of content into a non-secure buffer. This
113  * must be used only for audio content.
114  *
115  * #0: MEMREF_INPUT: the encrypted content
116  * #1: MEMREF_OUTPUT: the decrypted content
117  * #2: MEMREF_INOUT: the IV
118  */
119 #define WVDRM_DECRYPT_AUDIO 0x00002003
120 
121 /*
122  * Enter in secure playback.
123  */
124 #define WVDRM_ENTER_SECURE_PLAYBACK COMMON_SECURE_DRIVER_ENTER_SECURE_PLAYBACK
125 
126 /*
127  * Exit in secure playback.
128  */
129 #define WVDRM_EXIT_SECURE_PLAYBACK COMMON_SECURE_DRIVER_EXIT_SECURE_PLAYBACK
130 
131 #endif /* __WVDRM_PROTOCOL_H__ */
132