1/*
2 * Copyright (C) 2016 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 */
16package android.hardware.drm@1.0;
17
18import ICryptoPlugin;
19
20/**
21 * Ref: frameworks/native/include/media/hardware/CryptoAPI.h:CryptoFactory
22 *
23 * ICryptoFactory is the main entry point for interacting with a vendor's
24 * crypto HAL to create crypto plugins. Crypto plugins create crypto sessions
25 * which are used by a codec to decrypt protected video content.
26 */
27interface ICryptoFactory {
28    /**
29     * Determine if a crypto scheme is supported by this HAL
30     *
31     * @param uuid identifies the crypto scheme in question
32     * @return isSupported must be true only if the scheme is supported
33     */
34    isCryptoSchemeSupported(uint8_t[16] uuid) generates(bool isSupported);
35
36    /**
37     * Create a crypto plugin for the specified uuid and scheme-specific
38     * initialization data.
39     *
40     * @param uuid uniquely identifies the drm scheme. See
41     * http://dashif.org/identifiers/protection for uuid assignments
42     * @param initData scheme-specific init data.
43     * @return status the status of the call. The HAL implementation must return
44     * OK if the plugin is created and ERROR_DRM_CANNOT_HANDLE if the plugin
45     * cannot be created.
46     * @return cryptoPlugin the created ICryptoPlugin
47     */
48    createPlugin(uint8_t[16] uuid, vec<uint8_t> initData)
49        generates (Status status, ICryptoPlugin cryptoPlugin);
50};
51