// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This defines the mojo interface used between Chrome and the Chrome OS for
// remoting of the Widevine CE CDM and the underlying OEMCrypto implementation.
// This CdmFactoryDaemon interface is bootstrapped over D-Bus and then methods
// can be invoked on it to create a factory and then CDM instance, that same
// interface can also be used to connect directly to the OEMCrypto
// implementation for ARC.
// Next MinVersion: 10
module chromeos.cdm.mojom;
[EnableIf=is_chromeos_ash]
import "ash/components/arc/mojom/oemcrypto.mojom";
[EnableIf=is_chromeos_ash]
import "ash/components/arc/mojom/protected_buffer_manager.mojom";
import "chromeos/components/cdm_factory_daemon/mojom/cdm_storage.mojom";
import "chromeos/components/cdm_factory_daemon/mojom/content_decryption_module.mojom";
import "chromeos/components/cdm_factory_daemon/mojom/output_protection.mojom";
// Next Method ID: 2
[Stable, Uuid="732a934d-8e2a-4305-b637-ccbe74ee8b88"]
interface CdmFactory {
// Deprecated, do not use.
[MinVersion=1]
DEPRECATED_1@1(
pending_associated_remote<ContentDecryptionModuleClient> client,
pending_associated_remote<CdmStorage> storage,
pending_associated_receiver<ContentDecryptionModule> cdm,
pending_remote<OutputProtection> output_protection);
// Deprecated, do not use.
[MinVersion=3]
CreateCdmDeprecated@2(
pending_associated_remote<ContentDecryptionModuleClient> client,
pending_associated_remote<CdmStorage> storage,
pending_remote<OutputProtection> output_protection,
string host,
pending_associated_receiver<ContentDecryptionModule> cdm);
[Stable, Extensible]
enum CreateCdmStatus {
[Default] kSuccess,
kNoMoreInstances,
kInsufficientGpuResources,
};
// Creates a new ContentDecryptionModule instance for a |host| with the
// corresponding |client|, remote |storage| implementation and
// |output_protection|. Use an associated interface to ensure ordering and
// that all become invalidated at the same time.
[MinVersion=9]
CreateCdm@3(pending_associated_remote<ContentDecryptionModuleClient> client,
pending_associated_remote<CdmStorage> storage,
pending_remote<OutputProtection> output_protection,
string host,
pending_associated_receiver<ContentDecryptionModule> cdm) =>
(CreateCdmStatus result);
};
// Next Method ID: 10
// Used for bootstrapping the connection between ash-chrome browser and the
// cdm-oemcrypto ChromeOS daemon, then methods can be invoked to obtain
// interfaces to perform CDM or OEMCrypto operations. For the OEMCrypto
// operations, those are essentially a passthrough from ARC. The CDM operations
// are essentially a passthrough from JS EME or the video decoder/decryptor
// itself.
[Stable, Uuid="4871bea8-6cf0-479f-86ed-61b3a5acd9b7", EnableIf=is_chromeos_ash]
interface CdmFactoryDaemon {
// Used to create CdmFactory interfaces which are then used to create a CDM
// interface. |key_system| should specify what key system we are using,
// currently only com.widevine.alpha is supported. Returns null if we can't
// get the interface from the daemon.
CreateFactory@0(string key_system) => (pending_remote<CdmFactory>? factory);
// Deprecated, do not use.
RemovedMethod1@1();
// Used to establish a connection to the OEMCrypto implementation to provide
// that service to ARC.
[MinVersion=1]
ConnectOemCrypto@2(
pending_receiver<arc.mojom.OemCryptoService> oemcryptor,
pending_remote<arc.mojom.ProtectedBufferManager>
protected_buffer_manager,
pending_remote<OutputProtection> output_protection);
// Deprecated, do not use.
[MinVersion=1]
RemovedMethod3@3();
// Returns binary configuration data used for setting up HW decrypt+decode. If
// successful, |success| will be true and |config_data| will be valid.
// Otherwise |success| will be false and |config_data| should not be used.
[MinVersion=2]
GetHwConfigData@4() => (bool success, array<uint8> config_data);
// Deprecated, do not use.
[MinVersion=4]
RemovedMethod5@5();
// Returns the provisioned HDCP Key back to Chrome. If successful, it will
// return the full key. If not, it will return an empty string.
[MinVersion=5]
GetHdcp14Key@6() => (string hdcp_key_base64);
// Returns the wrapped key for injecting into the video decoder when doing ARC
// playback. This mirrors the ContentDecryptionModule::GetHwKeyData call as
// they serve the same purpose (Chrome will invoke this one for Android
// playback and ContentDecryptionModule::GetHwKeyData for Chrome playback).
[MinVersion=6]
GetAndroidHwKeyData@7(array<uint8> key_id, array<uint8> hw_identifier) =>
(DecryptStatus status, array<uint8> key_data);
// Allocates a secure buffer in TrustZone on ARM platforms. The lifetime of
// this buffer is managed by the returned fd. This should be resolved to a
// secure handle through V4L2; the resulting secure handle can then be used
// for the target of decryption. If the allocation fails, a null handle is
// returned.
[MinVersion=7]
AllocateSecureBuffer@8(uint32 size) => (handle<platform>? fd);
// Parses the data in the secure buffer referenced by |secure_handle| at
// |offset| bytes into it as an H264 slice header. |stream_data| should
// contain the required SPS/PPS structure defined in Chrome and the TA.
// Returns a bool for success/fail and on success the array will be populated
// with the slice header structure.
// NOTE: We do not establish the structures in Mojo because we are not using
// Mojo in the end-to-end communication.
[MinVersion=8]
ParseEncryptedSliceHeader@9(uint64 secure_handle, uint32 offset,
array<uint8> stream_data) =>
(bool success, array<uint8> slice_header);
};