1/*
2 * Copyright (C) 2022 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
18
19package android.media.drm;
20
21// Please see MediaDrm.ErrorCodes for definitions.
22//
23// Extended from
24//   frameworks/base/media/java/android/media/MediaDrm.java
25enum Status {
26    ERROR_UNKNOWN = 0;
27    ERROR_NO_KEY = 1;
28    ERROR_KEY_EXPIRED = 2;
29    ERROR_RESOURCE_BUSY = 3;
30    ERROR_INSUFFICIENT_OUTPUT_PROTECTION = 4;
31    ERROR_SESSION_NOT_OPENED = 5;
32    ERROR_UNSUPPORTED_OPERATION = 6;
33    ERROR_INSUFFICIENT_SECURITY = 7;
34    ERROR_FRAME_TOO_LARGE = 8;
35    ERROR_LOST_STATE = 9;
36    ERROR_CERTIFICATE_MALFORMED = 10;
37    ERROR_CERTIFICATE_MISSING = 11;
38    ERROR_CRYPTO_LIBRARY = 12;
39    ERROR_GENERIC_OEM = 13;
40    ERROR_GENERIC_PLUGIN = 14;
41    ERROR_INIT_DATA = 15;
42    ERROR_KEY_NOT_LOADED = 16;
43    ERROR_LICENSE_PARSE = 17;
44    ERROR_LICENSE_POLICY = 18;
45    ERROR_LICENSE_RELEASE = 19;
46    ERROR_LICENSE_REQUEST_REJECTED = 20;
47    ERROR_LICENSE_RESTORE = 21;
48    ERROR_LICENSE_STATE = 22;
49    ERROR_MEDIA_FRAMEWORK = 23;
50    ERROR_PROVISIONING_CERTIFICATE = 24;
51    ERROR_PROVISIONING_CONFIG = 25;
52    ERROR_PROVISIONING_PARSE = 26;
53    ERROR_PROVISIONING_REQUEST_REJECTED = 27;
54    ERROR_PROVISIONING_RETRY = 28;
55    ERROR_RESOURCE_CONTENTION = 29;
56    ERROR_SECURE_STOP_RELEASE = 30;
57    ERROR_STORAGE_READ = 31;
58    ERROR_STORAGE_WRITE = 32;
59    ERROR_ZERO_SUBSAMPLES = 33;
60    ERROR_INVALID_STATE = 34;
61    ERROR_BAD_VALUE = 35;
62    ERROR_NOT_PROVISIONED = 36;
63    ERROR_DEVICE_REVOKED = 37;
64    ERROR_DECRYPT = 38;
65    ERROR_DEAD_OBJECT = 39;
66}
67
68// Security level represents the robustness of the DRM implementation.
69//
70// From
71//   frameworks/base/media/java/android/media/MediaDrm.java
72enum SecurityLevel {
73    /**
74     * The DRM plugin did not report a security level, or an error occurred
75     * accessing it
76     */
77    SECURITY_LEVEL_UNKNOWN = 0;
78
79    /**
80     * DRM key management uses software-based whitebox crypto.
81     */
82    SECURITY_LEVEL_SW_SECURE_CRYPTO = 1;
83
84    /**
85     * DRM key management and decoding use software-based whitebox crypto.
86     */
87    SECURITY_LEVEL_SW_SECURE_DECODE = 2;
88
89    /**
90     * DRM key management and crypto operations are performed within a hardware
91     * backed trusted execution environment.
92     */
93    SECURITY_LEVEL_HW_SECURE_CRYPTO = 3;
94
95    /**
96     * DRM key management, crypto operations and decoding of content are
97     * performed within a hardware backed trusted execution environment.
98     */
99    SECURITY_LEVEL_HW_SECURE_DECODE = 4;
100
101    /**
102     * DRM key management, crypto operations, decoding of content and all
103     * handling of the media (compressed and uncompressed) is handled within a
104     * hardware backed trusted execution environment.
105     */
106    SECURITY_LEVEL_HW_SECURE_ALL = 5;
107
108    /**
109     * Indicates that the maximum security level supported by the device should
110     * be used when opening a session. This is the default security level
111     * selected when a session is opened.
112     */
113    SECURITY_LEVEL_MAX = 6;
114}
115
116// DrmApi represents methods of the IDrm interface.
117//
118// From
119//   frameworks/av/drm/libmediadrm/include/mediadrm/IDrm.h
120enum DrmApi {
121    DRM_API_UNKNOWN = 0;
122    DRM_API_INIT_CHECK = 1;
123    DRM_API_IS_CRYPTO_SCHEME_SUPPORTED = 2;
124    DRM_API_CREATE_PLUGIN = 3;
125    DRM_API_DESTROY_PLUGIN = 4;
126    DRM_API_OPEN_SESSION = 5;
127    DRM_API_CLOSE_SESSION = 6;
128    DRM_API_GET_KEY_REQUEST = 7;
129    DRM_API_PROVIDE_KEY_RESPONSE = 8;
130    DRM_API_REMOVE_KEYS = 9;
131    DRM_API_RESTORE_KEYS = 10;
132    DRM_API_QUERY_KEY_STATUS = 11;
133    DRM_API_GET_PROVISION_REQUEST = 12;
134    DRM_API_PROVIDE_PROVISION_RESPONSE = 13;
135    DRM_API_GET_SECURE_STOPS = 14;
136    DRM_API_GET_SECURE_STOP_IDS = 15;
137    DRM_API_GET_SECURE_STOP = 16;
138    DRM_API_RELEASE_SECURE_STOPS = 17;
139    DRM_API_REMOVE_SECURE_STOP = 18;
140    DRM_API_REMOVE_ALL_SECURE_STOPS = 19;
141    DRM_API_GET_HDCP_LEVELS = 20;
142    DRM_API_GET_NUMBER_OF_SESSIONS = 21;
143    DRM_API_GET_SECURITY_LEVEL = 22;
144    DRM_API_GET_OFFLINE_LICENSE_KEY_SET_IDS = 23;
145    DRM_API_REMOVE_OFFLINE_LICENSE = 24;
146    DRM_API_GET_OFFLINE_LICENSE_STATE = 25;
147    DRM_API_GET_PROPERTY_STRING = 26;
148    DRM_API_GET_PROPERTY_BYTE_ARRAY = 27;
149    DRM_API_SET_PROPERTY_STRING = 28;
150    DRM_API_SET_PROPERTY_BYTE_ARRAY = 29;
151    DRM_API_GET_METRICS = 30;
152    DRM_API_SET_CIPHER_ALGORITHM = 31;
153    DRM_API_SET_MAC_ALGORITHM = 32;
154    DRM_API_GENERIC_ENCRYPT = 33;
155    DRM_API_GENERIC_DECRYPT = 34;
156    DRM_API_GENERIC_SIGN = 35;
157    DRM_API_GENERIC_VERIFY = 36;
158    DRM_API_SIGN_RSA = 37;
159    DRM_API_SET_LISTENER = 38;
160    DRM_API_REQUIRES_SECURE_DECODER = 39;
161    DRM_API_REQUIRES_SECURE_DECODER_LEVEL = 40;
162    DRM_API_SET_PLAYBACK_ID = 41;
163    DRM_API_GET_LOG_MESSAGES = 42;
164    DRM_API_GET_SUPPORTED_SCHEMES = 43;
165}
166
167// Which library was used to access DRM features.
168//
169// From
170//   frameworks/av/drm/libmediadrm/include/mediadrm/IDrm.h
171enum IDrmFrontend {
172    IDRM_UNKNOWN = 0;
173    IDRM_JNI = 1;      // MediaDrm
174    IDRM_NDK = 2;      // NdkMediaDrm
175    IDRM_NUPLAYER = 3; // MediaPlayer
176}
177
178// Content protection scheme.
179//
180// From https://dashif.org/identifiers/content_protection/
181enum DrmScheme {
182    DRM_SCHEME_OTHER = -1;
183    DRM_SCHEME_UNKNOWN = 0;
184    ABV_MODRM = 1;
185    ADOBE_PRIMETIME = 2;
186    ALTICAST = 3;
187    APPLE_FAIRPLAY = 4;
188    ARRIS_TITANIUM = 5;
189    CHINADRM = 6;
190    CLEAR_KEY_AES_128 = 7;
191    CLEAR_KEY_SAMPLE_AES = 8;
192    CLEAR_KEY_DASH_IF = 9;
193    CMLA_OMA = 10;
194    COMMSCOPE_TITANIUM = 11;
195    CORECRYPT = 12;
196    DIGICAP_SMARTXESS = 13;
197    DIVX = 14;
198    IRDETO = 15;
199    MARLIN = 16;
200    MICROSOFT_PLAYREADY = 17;
201    MOBITV = 18;
202    NAGRA_MEDIAACCESS = 19;
203    SECUREMEDIA = 20;
204    SECUREMEDIA_STEELKNOT = 21;
205    SYNAMEDIA_VIDEOGUARD = 22;
206    UNITEND_UDRM = 23;
207    VERIMATRIX_VCAS = 24;
208    VIACCESS_ORCA = 25;
209    VISIONCRYPT = 26;
210    W3C_COMMON = 27;
211    WIDEVINE = 28;
212}
213