Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ec5d8ab9 authored by Robert Shih's avatar Robert Shih
Browse files

drm vts 1.0 refactor

* accept drm scheme as part of test parameter
* extract test cases into separate library

Bug: 142397658
Change-Id: I2f56d4e892b2fe45eabf37b351b5017a67828ee4
parent 3a8eb921
Loading
Loading
Loading
Loading
+41 −4
Original line number Original line Diff line number Diff line
@@ -29,21 +29,58 @@ cc_library_static {
    export_include_dirs: ["include"],
    export_include_dirs: ["include"],
}
}


cc_test {
cc_library_static {
    name: "VtsHalDrmV1_0TargetTest",
    name: "android.hardware.drm@1.0-vts",
    defaults: ["VtsHalTargetTestDefaults"],
    defaults: ["VtsHalTargetTestDefaults"],
    local_include_dirs: [
        "include",
    ],
    srcs: [
    srcs: [
        "drm_hal_clearkey_test.cpp",
        "drm_hal_clearkey_test.cpp",
        "drm_hal_vendor_test.cpp",
        "drm_hal_vendor_test.cpp",
    ],
    ],
    static_libs: [
    shared_libs: [
        "android.hardware.drm@1.0",
        "android.hardware.drm@1.0",
        "android.hidl.allocator@1.0",
        "android.hidl.memory@1.0",
        "libhidlmemory",
        "libnativehelper",
    ],
    static_libs: [
        "android.hardware.drm@1.0-helper",
        "android.hardware.drm@1.0-helper",
        "libcrypto_static",
        "libdrmvtshelper",
    ],
    export_shared_lib_headers: [
        "android.hardware.drm@1.0",
        "android.hidl.allocator@1.0",
        "android.hidl.memory@1.0",
        "libhidlmemory",
        "libnativehelper",
    ],
    export_include_dirs: [
        "include",
    ],
}

cc_test {
    name: "VtsHalDrmV1_0TargetTest",
    defaults: ["VtsHalTargetTestDefaults"],
    srcs: [
        "drm_hal_test_main.cpp",
    ],
    whole_static_libs: [
        "android.hardware.drm@1.0-vts",
    ],
    shared_libs: [
        "android.hardware.drm@1.0",
        "android.hidl.allocator@1.0",
        "android.hidl.allocator@1.0",
        "android.hidl.memory@1.0",
        "android.hidl.memory@1.0",
        "libhidlmemory",
        "libhidlmemory",
        "libnativehelper",
        "libnativehelper",
        "libssl",
    ],
    static_libs: [
        "android.hardware.drm@1.0-helper",
        "libcrypto_static",
        "libcrypto_static",
        "libdrmvtshelper",
        "libdrmvtshelper",
    ],
    ],
+11 −190
Original line number Original line Diff line number Diff line
@@ -16,127 +16,26 @@


#define LOG_TAG "drm_hal_clearkey_test@1.0"
#define LOG_TAG "drm_hal_clearkey_test@1.0"


#include <android/hardware/drm/1.0/ICryptoFactory.h>
#include <android/hardware/drm/1.0/ICryptoPlugin.h>
#include <android/hardware/drm/1.0/IDrmFactory.h>
#include <android/hardware/drm/1.0/IDrmPlugin.h>
#include <android/hardware/drm/1.0/types.h>
#include <android/hidl/allocator/1.0/IAllocator.h>
#include <gtest/gtest.h>
#include <hidl/GtestPrinter.h>
#include <hidl/HidlSupport.h>
#include <hidl/ServiceManagement.h>
#include <hidlmemory/mapping.h>
#include <log/log.h>
#include <openssl/aes.h>
#include <openssl/aes.h>
#include <memory>
#include <random>
#include <random>


using ::android::hardware::drm::V1_0::BufferType;
#include "android/hardware/drm/1.0/vts/drm_hal_clearkey_test.h"
using ::android::hardware::drm::V1_0::DestinationBuffer;
using ::android::hardware::drm::V1_0::ICryptoFactory;
using ::android::hardware::drm::V1_0::ICryptoPlugin;
using ::android::hardware::drm::V1_0::IDrmFactory;
using ::android::hardware::drm::V1_0::IDrmPlugin;
using ::android::hardware::drm::V1_0::KeyedVector;
using ::android::hardware::drm::V1_0::KeyValue;
using ::android::hardware::drm::V1_0::KeyRequestType;
using ::android::hardware::drm::V1_0::KeyType;
using ::android::hardware::drm::V1_0::Mode;
using ::android::hardware::drm::V1_0::Pattern;
using ::android::hardware::drm::V1_0::SecureStop;
using ::android::hardware::drm::V1_0::SecureStopId;
using ::android::hardware::drm::V1_0::SessionId;
using ::android::hardware::drm::V1_0::SharedBuffer;
using ::android::hardware::drm::V1_0::Status;
using ::android::hardware::drm::V1_0::SubSample;

using ::android::hardware::hidl_array;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_memory;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hidl::allocator::V1_0::IAllocator;
using ::android::hidl::memory::V1_0::IMemory;
using ::android::sp;


using std::string;
using std::string;
using std::unique_ptr;
using std::random_device;
using std::random_device;
using std::map;
using std::map;
using std::mt19937;
using std::mt19937;
using std::vector;
using std::vector;


/**
 * These clearkey tests use white box knowledge of the legacy clearkey
 * plugin to verify that the HIDL HAL services and interfaces are working.
 * It is not intended to verify any vendor's HAL implementation. If you
 * are looking for vendor HAL tests, see drm_hal_vendor_test.cpp
 */
#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
#define EXPECT_OK(ret) EXPECT_TRUE(ret.isOk())

static const uint8_t kCommonPsshBoxUUID[16] = {
    0x10, 0x77, 0xEF, 0xEC, 0xC0, 0xB2, 0x4D, 0x02,
    0xAC, 0xE3, 0x3C, 0x1E, 0x52, 0xE2, 0xFB, 0x4B};

// To be used in mpd to specify drm scheme for players
static const uint8_t kClearKeyUUID[16] = {
    0xE2, 0x71, 0x9D, 0x58, 0xA9, 0x85, 0xB3, 0xC9,
    0x78, 0x1A, 0xB0, 0x30, 0xAF, 0x78, 0xD3, 0x0E};

static const uint8_t kInvalidUUID[16] = {
static const uint8_t kInvalidUUID[16] = {
    0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80,
    0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80,
    0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80};
    0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80};


class DrmHalClearkeyFactoryTest : public ::testing::TestWithParam<std::string> {
namespace android {
  public:
namespace hardware {
    void SetUp() override {
namespace drm {
        const ::testing::TestInfo* const test_info =
namespace V1_0 {
                ::testing::UnitTest::GetInstance()->current_test_info();
namespace vts {
        ALOGD("Running test %s.%s", test_info->test_case_name(),
              test_info->name());

        const std::string instanceName = GetParam();
        drmFactory = IDrmFactory::getService(instanceName);
        ASSERT_NE(nullptr, drmFactory.get());
        cryptoFactory = ICryptoFactory::getService(instanceName);
        ASSERT_NE(nullptr, cryptoFactory.get());

        const bool drmClearKey = drmFactory->isCryptoSchemeSupported(kClearKeyUUID);
        const bool cryptoClearKey = cryptoFactory->isCryptoSchemeSupported(kClearKeyUUID);
        EXPECT_EQ(drmClearKey, cryptoClearKey);
        const bool supportsClearKey = drmClearKey && cryptoClearKey;

        const bool drmCommonPsshBox = drmFactory->isCryptoSchemeSupported(kCommonPsshBoxUUID);
        const bool cryptoCommonPsshBox = cryptoFactory->isCryptoSchemeSupported(kCommonPsshBoxUUID);
        EXPECT_EQ(drmCommonPsshBox, cryptoCommonPsshBox);
        const bool supportsCommonPsshBox = drmCommonPsshBox && cryptoCommonPsshBox;

        EXPECT_EQ(supportsClearKey, supportsCommonPsshBox);
        correspondsToThisTest = supportsClearKey && supportsCommonPsshBox;

        if (instanceName == "clearkey") {
            EXPECT_TRUE(correspondsToThisTest);

            // TODO(b/147449315)
            // Only the clearkey plugged into the "default" instance supports
            // this test. Currently the "clearkey" instance fails some tests
            // here.
            GTEST_SKIP() << "Clearkey tests don't work with 'clearkey' instance yet.";
        }

        if (!correspondsToThisTest) {
            GTEST_SKIP() << "Cannot test clearkey features on non-clearkey DRM modules";
        }
    }

   protected:
    sp<IDrmFactory> drmFactory;
    sp<ICryptoFactory> cryptoFactory;

    bool correspondsToThisTest;
};


/**
/**
 * Ensure the factory doesn't support an invalid scheme UUID
 * Ensure the factory doesn't support an invalid scheme UUID
@@ -264,48 +163,6 @@ TEST_P(DrmHalClearkeyFactoryTest, CreateInvalidCryptoPlugin) {
    EXPECT_OK(res);
    EXPECT_OK(res);
}
}


class DrmHalClearkeyPluginTest : public DrmHalClearkeyFactoryTest {
   public:
    virtual void SetUp() override {
        // Create factories
        DrmHalClearkeyFactoryTest::SetUp();

        if (!correspondsToThisTest) {
            GTEST_SKIP() << "Cannot test clearkey features on non-clearkey DRM modules";
        }

        ASSERT_NE(nullptr, drmFactory.get());
        hidl_string packageName("android.hardware.drm.test");
        auto res = drmFactory->createPlugin(
                kClearKeyUUID, packageName,
                [this](Status status, const sp<IDrmPlugin>& plugin) {
                    EXPECT_EQ(Status::OK, status);
                    ASSERT_NE(nullptr, plugin.get());
                    drmPlugin = plugin;
                });
        ASSERT_OK(res);

        hidl_vec<uint8_t> initVec;
        res = cryptoFactory->createPlugin(
                kClearKeyUUID, initVec,
                [this](Status status, const sp<ICryptoPlugin>& plugin) {
                    EXPECT_EQ(Status::OK, status);
                    ASSERT_NE(nullptr, plugin.get());
                    cryptoPlugin = plugin;
                });
        ASSERT_OK(res);
    }

    SessionId openSession();
    void closeSession(const SessionId& sessionId);
    hidl_vec<uint8_t> loadKeys(const SessionId& sessionId, const KeyType& type);
    sp<IMemory> getDecryptMemory(size_t size, size_t index);

   protected:
    sp<IDrmPlugin> drmPlugin;
    sp<ICryptoPlugin> cryptoPlugin;
};

/**
/**
 *  DrmPlugin tests
 *  DrmPlugin tests
 */
 */
@@ -966,30 +823,6 @@ TEST_P(DrmHalClearkeyPluginTest, SetMediaDrmSessionEmptySession) {
 * Decrypt tests
 * Decrypt tests
 */
 */


class DrmHalClearkeyDecryptTest : public DrmHalClearkeyPluginTest {
   public:
     void SetUp() override {
         DrmHalClearkeyPluginTest::SetUp();

         if (!correspondsToThisTest) {
             GTEST_SKIP() << "Cannot test clearkey features on non-clearkey DRM modules";
         }
     }
    void fillRandom(const sp<IMemory>& memory);
    hidl_array<uint8_t, 16> toHidlArray(const vector<uint8_t>& vec) {
        EXPECT_EQ(16u, vec.size());
        return hidl_array<uint8_t, 16>(&vec[0]);
    }
    uint32_t decrypt(Mode mode, uint8_t* iv, const hidl_vec<SubSample>& subSamples,
            const Pattern& pattern, Status status);
    void aes_ctr_decrypt(uint8_t* dest, uint8_t* src, uint8_t* iv,
            const hidl_vec<SubSample>& subSamples, const vector<uint8_t>& key);
    void aes_cbc_decrypt(uint8_t* dest, uint8_t* src, uint8_t* iv,
            const hidl_vec<SubSample>& subSamples, const vector<uint8_t>& key);
    void decryptWithInvalidKeys(hidl_vec<uint8_t>& invalidResponse,
            vector<uint8_t>& iv, const Pattern& noPattern, const vector<SubSample>& subSamples);
};

void DrmHalClearkeyDecryptTest::fillRandom(const sp<IMemory>& memory) {
void DrmHalClearkeyDecryptTest::fillRandom(const sp<IMemory>& memory) {
    random_device rd;
    random_device rd;
    mt19937 rand(rd());
    mt19937 rand(rd());
@@ -1300,20 +1133,8 @@ TEST_P(DrmHalClearkeyDecryptTest, DecryptWithKeyTooLong) {
    decryptWithInvalidKeys(invalidResponse, iv, noPattern, subSamples);
    decryptWithInvalidKeys(invalidResponse, iv, noPattern, subSamples);
}
}


static const std::set<std::string> kAllInstances = [] {
}  // namespace vts
    std::vector<std::string> drmInstances =
}  // namespace V1_0
            android::hardware::getAllHalInstanceNames(IDrmFactory::descriptor);
}  // namespace drm
    std::vector<std::string> cryptoInstances =
}  // namespace hardware
            android::hardware::getAllHalInstanceNames(ICryptoFactory::descriptor);
}  // namespace android
    std::set<std::string> allInstances;
    allInstances.insert(drmInstances.begin(), drmInstances.end());
    allInstances.insert(cryptoInstances.begin(), cryptoInstances.end());
    return allInstances;
}();

INSTANTIATE_TEST_SUITE_P(PerInstance, DrmHalClearkeyFactoryTest, testing::ValuesIn(kAllInstances),
                         android::hardware::PrintInstanceNameToString);
INSTANTIATE_TEST_SUITE_P(PerInstance, DrmHalClearkeyPluginTest, testing::ValuesIn(kAllInstances),
                         android::hardware::PrintInstanceNameToString);
INSTANTIATE_TEST_SUITE_P(PerInstance, DrmHalClearkeyDecryptTest, testing::ValuesIn(kAllInstances),
                         android::hardware::PrintInstanceNameToString);
+71 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#define LOG_TAG "drm_hal_vendor_test@1.0"

#include "vendor_modules.h"
#include "android/hardware/drm/1.0/vts/drm_hal_vendor_test.h"
#include "android/hardware/drm/1.0/vts/drm_hal_clearkey_test.h"

using ::android::hardware::drm::V1_0::ICryptoFactory;
using ::android::hardware::drm::V1_0::IDrmFactory;

using ::android::hardware::drm::V1_0::vts::DrmHalClearkeyFactoryTest;
using ::android::hardware::drm::V1_0::vts::DrmHalClearkeyPluginTest;
using ::android::hardware::drm::V1_0::vts::DrmHalClearkeyDecryptTest;

using ::android::hardware::drm::V1_0::vts::DrmHalVendorFactoryTest;
using ::android::hardware::drm::V1_0::vts::DrmHalVendorPluginTest;
using ::android::hardware::drm::V1_0::vts::DrmHalVendorDecryptTest;

/**
 * Instantiate the set of test cases for each vendor module
 */

static const std::vector<DrmHalTestParam> kAllInstances = [] {
    std::vector<std::string> drmInstances =
            android::hardware::getAllHalInstanceNames(IDrmFactory::descriptor);
    std::vector<std::string> cryptoInstances =
            android::hardware::getAllHalInstanceNames(ICryptoFactory::descriptor);
    std::set<std::string> allInstances;
    allInstances.insert(drmInstances.begin(), drmInstances.end());
    allInstances.insert(cryptoInstances.begin(), cryptoInstances.end());

    std::vector<DrmHalTestParam> allInstanceUuidCombos;
    auto noUUID = [](std::string s) { return DrmHalTestParam(s); };
    std::transform(allInstances.begin(), allInstances.end(),
            std::back_inserter(allInstanceUuidCombos), noUUID);
    return allInstanceUuidCombos;
}();

INSTANTIATE_TEST_CASE_P(DrmHalVendorFactoryTestCases, DrmHalVendorFactoryTest,
                        testing::ValuesIn(kAllInstances),
                        drm_vts::PrintParamInstanceToString);

INSTANTIATE_TEST_CASE_P(DrmHalVendorPluginTestCases, DrmHalVendorPluginTest,
                        testing::ValuesIn(kAllInstances),
                        drm_vts::PrintParamInstanceToString);

INSTANTIATE_TEST_CASE_P(DrmHalVendorDecryptTestCases, DrmHalVendorDecryptTest,
                        testing::ValuesIn(kAllInstances),
                        drm_vts::PrintParamInstanceToString);

INSTANTIATE_TEST_SUITE_P(PerInstance, DrmHalClearkeyFactoryTest, testing::ValuesIn(kAllInstances),
                         drm_vts::PrintParamInstanceToString);
INSTANTIATE_TEST_SUITE_P(PerInstance, DrmHalClearkeyPluginTest, testing::ValuesIn(kAllInstances),
                         drm_vts::PrintParamInstanceToString);
INSTANTIATE_TEST_SUITE_P(PerInstance, DrmHalClearkeyDecryptTest, testing::ValuesIn(kAllInstances),
                         drm_vts::PrintParamInstanceToString);
+1 −234
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef DRM_HAL_VENDOR_MODULE_API_H
#define DRM_HAL_VENDOR_MODULE_API_H

#include <stdint.h>
#include <map>
#include <string>
#include <vector>

/**
 * The DRM and Crypto HALs interact with vendor-provided HAL implementations
 * that have DRM-specific capabilities. Since the VTS tests cannot contain
 * DRM-specific functionality, supporting modules are required to enable VTS
 * to validate HAL implementations in a generic way.  If the vendor-specific
 * VTS module is not provided for a given drm HAL implementation, only very
 * small subset of functionality can be verified.
 *
 * As an example, a DRM HAL implementation interacts with a DRM-specific
 * license server to obtain licenses for decrypting content.  The DRM HAL
 * implementation generates a key request message, delivers it to the server
 * and receives a key response message which is then loaded into the HAL. Once
 * the keys are loaded, the Crypto HAL decryption functionality and performance
 * and other associated APIs can be tested by the common VTS test suite.
 *
 * Vendor-specific VTS modules are shared libraries used by the DRM VTS test.
 * They provide a set of functions to support VTS testing of the DRM HAL module.
 *
 * The modules are placed in a common location on the file system. The VTS test
 * scans through all vendor-provided support libraries and runs the VTS test
 * suite on each library that is found.
 *
 * The vendor-specific module exposes an extern “C” vendorModuleFactory()
 * function that returns a DrmHalVTSVendorModule instance. DrmHalVTSVendorModule
 * instances are versioned, where each version is represented by subclass of
 * DrmHalVTSVendorModule that corresponds to the API version. For example, a
 * vendor-specific module that implements version 1 of the API would return a
 * DrmHalVTSVendorModule_V1 from the vendorModuleFactory() function.
 */

class DrmHalVTSVendorModule;

extern "C" {
/**
 * The factory method for creating DrmHalVTSVendorModule instances. The returned
 * instance will be a subclass of DrmHalVTSVendorModule that corresponds to the
 * supported API version.
 */
DrmHalVTSVendorModule* vendorModuleFactory();
};

class DrmHalVTSVendorModule {
   public:
    DrmHalVTSVendorModule() : installed(true) {}
    virtual ~DrmHalVTSVendorModule() {}

    /**
     * Return the vendor-specific module API version. The version is an integer
     * value with initial version 1. The API version indicates which subclass
     * version DrmHalVTSVendorModule this instance is.
     */
    virtual uint32_t getAPIVersion() const = 0;

    /**
     * Return the UUID for the DRM HAL implementation. Protection System
     * Specific
     * UUID (see http://dashif.org/identifiers/protection/)
     */
    virtual std::vector<uint8_t> getUUID() const = 0;

    /**
     * Return the service name for the DRM HAL implementation. If the hal is a
     * legacy
     * drm plugin, i.e. not running as a HIDL service, return the empty string.
     */
    virtual std::string getServiceName() const = 0;

    /**
     * Set a flag in the vendor module to indicate whether or not the drm
     * scheme corresponding to this module is installed on the device.
     */
    void setInstalled(bool flag) {installed = flag;}
    bool isInstalled() const {return installed;}

   private:
    bool installed;
    DrmHalVTSVendorModule(const DrmHalVTSVendorModule&) = delete;
    void operator=(const DrmHalVTSVendorModule&) = delete;
};

/**
 * API Version 1.  This is the baseline version that supports a minimal set
 * of VTS tests.
 */
class DrmHalVTSVendorModule_V1 : public DrmHalVTSVendorModule {
   public:
    DrmHalVTSVendorModule_V1() {}
    virtual ~DrmHalVTSVendorModule_V1() {}

    virtual uint32_t getAPIVersion() const { return 1; }

    /**
     * Handle a provisioning request. This function will be called if the HAL
     * module's getProvisionRequest returns a provision request.  The vendor
     * module should process the provisioning request, either by sending it
     * to a provisioning server, or generating a mock response.  The resulting
     * provisioning response is returned to the VTS test.
     *
     * @param provisioningRequest the provisioning request recieved from
     * the DRM HAL
     * @param url the default url the HAL implementation provided with the
     * provisioning request
     * @return the generated provisioning response
     */
    virtual std::vector<uint8_t> handleProvisioningRequest(
            const std::vector<uint8_t>& provisioningRequest,
            const std::string& url) = 0;

    /**
     * Content configuration specifies content-specific parameters associated
     * with a key request/response transaction. It allows the VTS test to
     * request keys and use them to perform decryption.
     */
    struct ContentConfiguration {
        /**
         * Assign a name for this configuration that will be referred to
         * in log messages.
         */
        const std::string name;

        /**
         * Server to use when requesting a key response.  This url will be
         * passed as a parameter to the vendor vts module along with the
         * key request to perform the key request transaction.
         */
        const std::string serverUrl;

        /**
         * Initialization data provided to getKeyRequest, e.g. PSSH for CENC
         * content
         */
        const std::vector<uint8_t> initData;

        /**
         *  Mime type provided to getKeyRequest, e.g. "video/mp4", or "cenc"
         */
        const std::string mimeType;

        /**
         * Optional parameters to be associated with the key request
         */
        const std::map<std::string, std::string> optionalParameters;

        /**
         *  Define license policy attributes for the content configuration.
         *  These attributes can affect which tests are able to be applied.
         */
        struct Policy {
            /**
             * Indicate if the license policy allows offline playback.
             * Content configurated with this policy supports KeyType::OFFLINE
             * key requests/responses. A vendor module should provide at least
             * one content configuration where allowOffline is true if the drm
             * scheme supports offline content.
             */
            bool allowOffline;
        } policy;

        /**
         * The keys that will be available once the keys are loaded
         */
        struct Key {
            /**
             * Indicate if the key content is configured to require secure
             * buffers, where the output buffers are protected and cannot be
             * accessed by the non-secure cpu. A vendor module should provide
             * at least one content configurations where isSecure is false, to
             * allow decrypt result verification tests to be run.
             */
            bool isSecure;

            /**
             * A key ID identifies a key to use for decryption
             */
            const std::vector<uint8_t> keyId;

            /**
             * The clear content key is provided to generate expected values for
             * validating decryption.
             */
            const std::vector<uint8_t> clearContentKey;
        };
        std::vector<Key> keys;
    };

    /**
     * Return a list of content configurations that can be exercised by the
     * VTS test.
     */
    virtual std::vector<ContentConfiguration>
            getContentConfigurations() const = 0;

    /**
     * Handle a key request. This function will be called if the HAL
     * module's getKeyRequest returns a key request.  The vendor
     * module should process the key request, either by sending it
     * to a license server, or by generating a mock response.  The resulting
     * key response is returned to the VTS test.
     *
     * @param keyRequest the key request recieved from the DRM HAL
     * @param serverUrl the url of the key server that was supplied
     * by the ContentConfiguration
     * @return the generated key response
     */
    virtual std::vector<uint8_t> handleKeyRequest(
            const std::vector<uint8_t>& keyRequest,
            const std::string& serverUrl) = 0;
};

#endif  // DRM_HAL_VENDOR_MODULE_API_H
+1 −234
Original line number Original line Diff line number Diff line
include/drm_hal_vendor_module_api.h
 No newline at end of file
Loading