Files
android/libwvdrmengine/include/mapErrors-inl.h
Rahul Frias aac1439dea Merges to android Pi release (part 12)
These are a set of CLs merged from the wv cdm repo to the android repo.

* Correct error logging

  Author: Rahul Frias <rfrias@google.com>

  [ Merge of http://go/wvgerrit/40000 ]

  In tests, we set the cipher list to avoid using insecure
  ciphers when connecting to the provisioning/license service.
  The result of setting the cipher list was being incorrectly
  validated.

  Bug: 64847919

* Move mips cache headers to clear_cache_function.h

  Author: Srujan Gaddam <srujzs@google.com>

  [ Merge of http://go/wvgerrit/39700 ]

  Since the clear_cache function has been moved away from the dynamic
  adapter, we need these conditional includes to be migrated as well for
  MIPS.

* Comment out Level 3 debug call until merge

  Author: Srujan Gaddam <srujzs@google.com>

  [ Merge of http://go/wvgerrit/39761 ]

  This call was introduced in go/wvgerrit/34260/. Since the haystack tool
  in google3 still needs this merge, this should be commented out so the
  tool can still build until the merge has finished.

* Add logging for MAC keys to mock

  Author: Srujan Gaddam <srujzs@google.com>

  [ Merge of http://go/wvgerrit/39740 ]

  Bug: 70637842

* Move external interfaces into level3.h + refactor

  Author: Srujan Gaddam <srujzs@google.com>

  [ Merge of http://go/wvgerrit/39673 ]

  As part of b/70523618, this CL moves interfaces that partners are
  responsible for in Level 3 to level3.h so they can be visible as
  part of the CDM release process. It also cleans up some of the
  names of the files and adds documentation.

* Corrected close session logging level

  Author: Rahul Frias <rfrias@google.com>

  [ Merge of http://go/wvgerrit/39676 ]

  Bug: 69460963

* Remove Security Level Path Backward Compatibility Support

  Author: Rahul Frias <rfrias@google.com>

  [ Merge of http://go/wvgerrit/39505 ]

  From the android K release onwards certificates were stored in
  security level specific directories. If upgrading from
  previous releases persistent information needed to be moved
  to those directories.

  Since no device is likely to upgrade from J to Pi, comptibility
  support can be removed.

  Bug: 70160032

* Rename privacy_crypto_openssl To privacy_crypto_boringssl

  Author: John W. Bruce <juce@google.com>

  [ Merge of http://go/wvgerrit/37122 ]

  Now that we no longer support OpenSSL in the Shared Source CDM, the name
  of this file can be updated.

  Bug: 67907873
  Test: build.py x86-64
  Test: wv_ce_cdm_unittest
  Test: jenkins/linux_unit_tests

* Remove Conditional Compilation from OpenSSL/BoringSSL

  Author: John W. Bruce <juce@google.com>

  [ Merge of http://go/wvgerrit/39460 ]

  This change removes the usages of conditional compilation to support
  both BoringSSL and OpenSSL, as well as to support multiple versions of
  the OpenSSL API. All code is now compiled against one of the two
  versions of BoringSSL in third_party/.

  Note that in some cases, the kit/ and legacy_kit/ versions of BoringSSL
  had different APIs, so when removing the OpenSSL version compatibility
  conditional compilation, sometimes the older branch was kept and
  sometimes the newer branch was kept.

  Bug: 67907873
  Test: build.py x86-64
  Test: wv_ce_cdm_unittest
  Test: jenkins/linux_unit_tests

* Build CE & Jenkins CDMs With BoringSSL from third_party/

  Author: John W. Bruce <juce@google.com>

  [ Merge of http://go/wvgerrit/37120 ]

  Up until now, integrators have been responsible for providing a
  compatible crypto library for use by the CE CDM. (either OpenSSL or
  BoringSSL) After this change, this decision will no longer be in their
  hands. The CE CDM build will always use the copy of BoringSSL in
  third_party/, which will be statically linked with our library with
  hidden visibility. This allows us to better control what crypto library
  we use and will prevent continuing problems with trying to support both
  OpenSSL and BoringSSL.

  Unfortunately, BoringSSL began using C++11 in mid-2017, and we can't
  support C++11 right now. Until we can, we need to use a C++11-free
  version of BoringSSL for libssl. The CDM itself will continue to use a
  recent BoringSSL, as it only needs libcrypto. But the unit tests that
  need libssl have to use the legacy version.

  Bug: 67907873
  Test: build.py x86-64
  Test: wv_ce_cdm_unittest
  Test: jenkins/linux_unit_tests

* Modified RNG for Level3 to use more entropy

  Author: Srujan Gaddam <srujzs@google.com>

  [ Merge of http://go/wvgerrit/39220 ]

  Bug: 65165076

  Modified seed generation to use an xor of clock_gettime and
  client-implemented code to supply random seeds to the RNG. Modified the RNG
  as well to use xoroshiro128+ instead of xorshift, since it uses more
  than one seed/state (which are 64-bit) and has higher "statistical quality".
  The default implementations for the seed generation use /dev/urandom.

* Configure base path for Level3FileSystem

  Author: Srujan Gaddam <srujzs@google.com>

  [ Merge of http://go/wvgerrit/39506 ]

  This is in response to b/70354006. This change makes the
  Android Level3FileSystem use the existing properties method
  GetDevicesFilesBasePath for binderization. The same is done for the
  Linux implementation.

* Add legacy_kit/ to BoringSSL Directory

  Author: John W. Bruce <juce@google.com>

  [ Merge of http://go/wvgerrit/38861 ]

  This adds a second copy of BoringSSL to the third_party/boringssl/
  directory. This second copy is pinned to the last revision of BoringSSL
  not to require C++11 and is not updated by the UPDATE_BORINGSSL.sh
  script. This second copy will be used to provide libssl to the tests on
  devices that do not support C++11.

  Once we support C++11 in the CDM again, this weight should be removed
  and all targets should use the copy of BoringSSL in the kit/ directory.

  Bug: 67907873

* Use Shared Libraries for Unit Tests

  Author: John W. Bruce <juce@google.com>

  [ Merge of http://go/wvgerrit/38860 ]

  Some unit tests were using a statically-linked CDM instead of a
  dynamically-linked one. (Or, in one case, trying to link both ways into
  the same binary.) For now, we need to only link dynamically, so that the
  unit tests and the CDM can use different versions of BoringSSL.

  Long-term, we would like to test both kinds of linkage. (See b/69548115
  for that.)

  Some unit tests were also using a dynamicaly-linked CDM that was named
  such that it appeared to be statically-linked. This patch renames some
  targets to make the linkage clearer.

  Bug: 67907873

* Change CDM_Backwards_Compatiblity_Tests to dedicated brances

  Author: Fred Gylys-Colwell <fredgc@google.com>

  [ Merge of http://go/wvgerrit/39003 ]

  The build scripts used by CDM_Backwards_Compatiblity_Tests now pull
  old versions of oemcrypto from the dedicated branches oemcrypto-v*,
  which [will eventually] contain old oemcrypto versions, that build
  with the current build system with a current boringssl version.

  bug: 67907873

* Fix spacing on level3 header

  Author: Srujan Gaddam <srujzs@google.com>

  [ Merge of http://go/wvgerrit/38760 ]

* Correct Query status calls

  Author: Rahul Frias <rfrias@google.com>

  [ Merge of http://go/wvgerrit/38640 ]

  Bug: 70160032

* Refactoring to allow encryption of client ID

  Author: Rahul Frias <rfrias@google.com>

  [ Merge of http://go/wvgerrit/37460 ]

  The code has been restructured to allow encryption of client
  identification in provisioning requests. This will be enabled
  when server side changes have been made (b/69427217).

  * Additional information is included in the Client Identification
    portion of the provisioning request.
  * Client identification will be encrypted with a service
    certificate provided by the app/client. Platform changes
    to enable passing this to core are needed. If a service certificate
    is not provided, a default one associated with the production Keysmith
    will be used.
  * Switched APIs in CdmEngine to take a service certificate for
    provisioning rather than licensing. Service certificates for
    licensing are session based and passed as properties from platform
    code.

  Bug: 30737060

* Allow some CDM errors to be reported from multiple locations

  Author: Rahul Frias <rfrias@google.com>

  [ Merge of http://go/wvgerrit/38360 ]

  This creates some CdmResponseType errors which may be reused
  PARAMETER_NULL, NOT_INITIALIZED_ERROR, REINIT_ERROR.

  I have made changes to a few classes to report these errors.
  Will work on additional classes in a separate CL.

  Bug: 69864404

BUG: 71650075
Test: WV Unit/integration tests
Change-Id: Icc048770d424ac537d11ff327cda2cb142da802d
2018-01-16 19:34:30 -08:00

516 lines
20 KiB
C++

//
// Copyright 2013 Google Inc. All Rights Reserved.
//
#ifndef WV_MAP_ERRORS_H_
#define WV_MAP_ERRORS_H_
#include "media/stagefright/MediaErrors.h"
#include "utils/Errors.h"
#include "wv_cdm_types.h"
#include "WVErrors.h"
namespace wvdrm {
static android::status_t mapCdmResponseType(wvcdm::CdmResponseType res) {
switch (res) {
case wvcdm::NO_ERROR:
case wvcdm::KEY_ADDED:
case wvcdm::KEY_MESSAGE:
case wvcdm::KEY_CANCELED:
// KEY_ADDED, KEY_MESSAGE, and KEY_CANCELLED are all alternative
// success messages for certain CDM methods instead of NO_ERROR.
return android::OK;
case wvcdm::NEED_KEY:
case wvcdm::DECRYPT_NOT_READY:
case wvcdm::KEY_NOT_FOUND_IN_SESSION:
return android::ERROR_DRM_NO_LICENSE;
case wvcdm::NEED_PROVISIONING:
return android::ERROR_DRM_NOT_PROVISIONED;
case wvcdm::DEVICE_REVOKED:
return android::ERROR_DRM_DEVICE_REVOKED;
case wvcdm::INSUFFICIENT_CRYPTO_RESOURCES:
return android::ERROR_DRM_RESOURCE_BUSY;
case wvcdm::ADD_KEY_ERROR:
return kAddKeyError;
case wvcdm::CERT_PROVISIONING_GET_KEYBOX_ERROR_1:
return kCertProvisioningGetKeyboxError1;
case wvcdm::CERT_PROVISIONING_GET_KEYBOX_ERROR_2:
return kCertProvisioningGetKeyboxError2;
case wvcdm::CERT_PROVISIONING_INVALID_CERT_TYPE:
return kCertProvisioningInvalidCertType;
case wvcdm::CERT_PROVISIONING_REQUEST_ERROR_1:
return kCertProvisioningRequestError1;
case wvcdm::CERT_PROVISIONING_NONCE_GENERATION_ERROR:
return kCertProvisioningRequestNonceGenerationError;
case wvcdm::CERT_PROVISIONING_REQUEST_ERROR_3:
return kCertProvisioningRequestError3;
case wvcdm::CERT_PROVISIONING_REQUEST_ERROR_4:
return kCertProvisioningRequestError4;
case wvcdm::CERT_PROVISIONING_RESPONSE_ERROR_1:
return kCertProvisioningResponseError1;
case wvcdm::CERT_PROVISIONING_RESPONSE_ERROR_2:
return kCertProvisioningResponseError2;
case wvcdm::CERT_PROVISIONING_RESPONSE_ERROR_3:
return kCertProvisioningResponseError3;
case wvcdm::CERT_PROVISIONING_RESPONSE_ERROR_4:
return kCertProvisioningResponseError4;
case wvcdm::CERT_PROVISIONING_RESPONSE_ERROR_5:
return kCertProvisioningResponseError5;
case wvcdm::CERT_PROVISIONING_RESPONSE_ERROR_6:
return kCertProvisioningResponseError6;
case wvcdm::CERT_PROVISIONING_RESPONSE_ERROR_7:
return kCertProvisioningResponseError7;
case wvcdm::CERT_PROVISIONING_RESPONSE_ERROR_8:
return kCertProvisioningResponseError8;
case wvcdm::DEVICE_CERTIFICATE_ERROR_1:
return kDeviceCertificateError1;
case wvcdm::DEVICE_CERTIFICATE_ERROR_2:
return kDeviceCertificateError2;
case wvcdm::DEVICE_CERTIFICATE_ERROR_3:
return kDeviceCertificateError3;
case wvcdm::DEVICE_CERTIFICATE_ERROR_4:
return kDeviceCertificateError4;
case wvcdm::EMPTY_KEY_DATA_1:
return kEmptyKeyData1;
case wvcdm::EMPTY_KEY_DATA_2:
return kEmptyKeyData2;
case wvcdm::EMPTY_KEYSET_ID:
return kEmptyKeySetId;
case wvcdm::EMPTY_KEYSET_ID_ENG_1:
return kEmptyKeySetIdEng1;
case wvcdm::EMPTY_KEYSET_ID_ENG_2:
return kEmptyKeySetIdEng2;
case wvcdm::EMPTY_KEYSET_ID_ENG_3:
return kEmptyKeySetIdEng3;
case wvcdm::EMPTY_KEYSET_ID_ENG_4:
return kEmptyKeySetIdEng4;
case wvcdm::EMPTY_LICENSE_RENEWAL:
return kEmptyLicenseRenewal;
case wvcdm::EMPTY_LICENSE_RESPONSE_1:
return kEmptyLicenseResponse1;
case wvcdm::EMPTY_LICENSE_RESPONSE_2:
return kEmptyLicenseResponse2;
case wvcdm::EMPTY_PROVISIONING_CERTIFICATE_1:
return kEmptyProvisioningCertificate1;
case wvcdm::EMPTY_PROVISIONING_RESPONSE:
return kEmptyProvisioningResponse;
case wvcdm::EMPTY_SESSION_ID:
return kEmptySessionId;
case wvcdm::GENERATE_DERIVED_KEYS_ERROR:
return kGenerateDerivedKeysError;
case wvcdm::LICENSE_RENEWAL_NONCE_GENERATION_ERROR:
return kLicenseRenewalNonceGenerationError;
case wvcdm::GENERATE_USAGE_REPORT_ERROR:
return kGenerateUsageReportError;
case wvcdm::GET_LICENSE_ERROR:
return kGetLicenseError;
case wvcdm::GET_RELEASED_LICENSE_ERROR:
return kGetReleasedLicenseError;
case wvcdm::GET_USAGE_INFO_ERROR_1:
return kGetUsageInfoError1;
case wvcdm::GET_USAGE_INFO_ERROR_2:
return kGetUsageInfoError2;
case wvcdm::GET_USAGE_INFO_ERROR_3:
return kGetUsageInfoError3;
case wvcdm::GET_USAGE_INFO_ERROR_4:
return kGetUsageInfoError4;
case wvcdm::INIT_DATA_NOT_FOUND:
return kInitDataNotFound;
case wvcdm::INVALID_DECRYPT_PARAMETERS_ENG_1:
return kInvalidDecryptParametersEng1;
case wvcdm::INVALID_DECRYPT_PARAMETERS_ENG_2:
return kInvalidDecryptParametersEng2;
case wvcdm::INVALID_DECRYPT_PARAMETERS_ENG_3:
return kInvalidDecryptParametersEng3;
case wvcdm::INVALID_DECRYPT_PARAMETERS_ENG_4:
return kInvalidDecryptParametersEng4;
case wvcdm::SESSION_NOT_FOUND_FOR_DECRYPT:
return android::ERROR_DRM_SESSION_NOT_OPENED;
case wvcdm::INVALID_DEVICE_CERTIFICATE_TYPE:
return kInvalidDeviceCertificateType;
case wvcdm::INVALID_KEY_SYSTEM:
return kInvalidKeySystem;
case wvcdm::INVALID_LICENSE_RESPONSE:
return kInvalidLicenseResponse;
case wvcdm::INVALID_LICENSE_TYPE:
return kInvalidLicenseType;
case wvcdm::PARAMETER_NULL:
return kParameterNull;
case wvcdm::INVALID_PARAMETERS_ENG_5:
return kInvalidParametersEng5;
case wvcdm::INVALID_PARAMETERS_LIC_1:
return kInvalidParametersLic1;
case wvcdm::INVALID_PARAMETERS_LIC_2:
return kInvalidParametersLic2;
case wvcdm::INVALID_PROVISIONING_PARAMETERS_1:
return kInvalidProvisioningParam1;
case wvcdm::INVALID_PROVISIONING_PARAMETERS_2:
return kInvalidProvisioningParam2;
case wvcdm::INVALID_PROVISIONING_REQUEST_PARAM_1:
return kInvalidProvisioningReqParam1;
case wvcdm::INVALID_PROVISIONING_REQUEST_PARAM_2:
return kInvalidProvisioningReqParam2;
case wvcdm::INVALID_QUERY_KEY:
return kInvalidQueryKey;
case wvcdm::INVALID_SESSION_ID:
return kInvalidSessionId;
case wvcdm::KEY_REQUEST_ERROR_1:
return kKeyRequestError1;
case wvcdm::KEY_SIZE_ERROR:
return kKeySizeError;
case wvcdm::KEYSET_ID_NOT_FOUND_1:
return kKeySetIdNotFound1;
case wvcdm::KEYSET_ID_NOT_FOUND_2:
return kKeySetIdNotFound2;
case wvcdm::KEYSET_ID_NOT_FOUND_3:
return kKeySetIdNotFound3;
case wvcdm::LICENSE_ID_NOT_FOUND:
return kLicenseIdNotFound;
case wvcdm::LICENSE_PARSER_INIT_ERROR:
return kLicenseParserInitError;
case wvcdm::LICENSE_PARSER_NOT_INITIALIZED_1:
return kLicenseParserNotInitialized1;
case wvcdm::LICENSE_PARSER_NOT_INITIALIZED_2:
return kLicenseParserNotInitialized2;
case wvcdm::LICENSE_PARSER_NOT_INITIALIZED_3:
return kLicenseParserNotInitialized3;
case wvcdm::LICENSE_RESPONSE_NOT_SIGNED:
return kLicenseResponseNotSigned;
case wvcdm::LICENSE_RESPONSE_PARSE_ERROR_1:
return kLicenseResponseParseError1;
case wvcdm::LICENSE_RESPONSE_PARSE_ERROR_2:
return kLicenseResponseParseError2;
case wvcdm::LICENSE_RESPONSE_PARSE_ERROR_3:
return kLicenseResponseParseError3;
case wvcdm::LOAD_KEY_ERROR:
return kLoadKeyError;
case wvcdm::NO_CONTENT_KEY:
return kNoContentKey;
case wvcdm::REFRESH_KEYS_ERROR:
return kRefreshKeysError;
case wvcdm::RELEASE_ALL_USAGE_INFO_ERROR_1:
return kReleaseAllUsageInfoError1;
case wvcdm::RELEASE_ALL_USAGE_INFO_ERROR_2:
return kReleaseAllUsageInfoError2;
case wvcdm::RELEASE_KEY_ERROR:
return kReleaseKeyError;
case wvcdm::RELEASE_KEY_REQUEST_ERROR:
return kReleaseKeyRequestError;
case wvcdm::RELEASE_LICENSE_ERROR_1:
return kReleaseLicenseError1;
case wvcdm::RELEASE_LICENSE_ERROR_2:
return kReleaseLicenseError2;
case wvcdm::RELEASE_USAGE_INFO_ERROR:
return android::ERROR_DRM_TAMPER_DETECTED;
case wvcdm::RENEW_KEY_ERROR_1:
return kRenewKeyError1;
case wvcdm::RENEW_KEY_ERROR_2:
return kRenewKeyError2;
case wvcdm::LICENSE_RENEWAL_SIGNING_ERROR:
return kLicenseRenewalSigningError;
case wvcdm::RESTORE_OFFLINE_LICENSE_ERROR_2:
return kRestoreOfflineLicenseError2;
case wvcdm::NOT_INITIALIZED_ERROR:
return kNotInitializedError;
case wvcdm::REINIT_ERROR:
return kReinitError;
case wvcdm::SESSION_NOT_FOUND_1:
case wvcdm::SESSION_NOT_FOUND_2:
case wvcdm::SESSION_NOT_FOUND_3:
case wvcdm::SESSION_NOT_FOUND_4:
case wvcdm::SESSION_NOT_FOUND_5:
case wvcdm::SESSION_NOT_FOUND_6:
case wvcdm::SESSION_NOT_FOUND_7:
case wvcdm::SESSION_NOT_FOUND_8:
case wvcdm::SESSION_NOT_FOUND_9:
case wvcdm::SESSION_NOT_FOUND_10:
return android::ERROR_DRM_SESSION_NOT_OPENED;
case wvcdm::SESSION_KEYS_NOT_FOUND:
return kSessionKeysNotFound;
case wvcdm::SIGNATURE_NOT_FOUND:
return kSignatureNotFound;
case wvcdm::STORE_LICENSE_ERROR_1:
return kStoreLicenseError1;
case wvcdm::STORE_LICENSE_ERROR_2:
return kStoreLicenseError2;
case wvcdm::STORE_USAGE_INFO_ERROR:
return kStoreUsageInfoError;
case wvcdm::UNPROVISION_ERROR_1:
return kUnprovisioningError1;
case wvcdm::UNPROVISION_ERROR_2:
return kUnprovisioningError2;
case wvcdm::UNPROVISION_ERROR_3:
return kUnprovisioningError3;
case wvcdm::UNPROVISION_ERROR_4:
return kUnprovisioningError4;
case wvcdm::UNSUPPORTED_INIT_DATA:
return kUnsupportedInitData;
case wvcdm::USAGE_INFO_NOT_FOUND:
return kUsageInfoNotFound;
case wvcdm::PARSE_SERVICE_CERTIFICATE_ERROR:
return kParseServiceCertificateError;
case wvcdm::CLIENT_ID_GENERATE_RANDOM_ERROR:
return kClientIdGenerateRandomError;
case wvcdm::CLIENT_ID_AES_INIT_ERROR:
return kClientIdAesInitError;
case wvcdm::CLIENT_ID_AES_ENCRYPT_ERROR:
return kClientIdAesEncryptError;
case wvcdm::CLIENT_ID_RSA_INIT_ERROR:
return kClientIdRsaInitError;
case wvcdm::CLIENT_ID_RSA_ENCRYPT_ERROR:
return kClientIdRsaEncryptError;
case wvcdm::KEY_ERROR:
// KEY_ERROR is used by the CDM to mean just about any kind of error, not
// just license errors, so it is mapped to the generic response.
return kErrorCDMGeneric;
case wvcdm::INVALID_QUERY_STATUS:
return kInvalidQueryStatus;
case wvcdm::EMPTY_PROVISIONING_CERTIFICATE_2:
return kEmptyProvisioningCertificate2;
case wvcdm::LICENSE_PARSER_NOT_INITIALIZED_4:
return kLicenseParserNotInitialized4;
case wvcdm::INVALID_PARAMETERS_LIC_3:
return kInvalidParametersLic3;
case wvcdm::INVALID_PARAMETERS_LIC_4:
return kInvalidParametersLic4;
case wvcdm::INVALID_PARAMETERS_LIC_6:
return kInvalidParametersLic6;
case wvcdm::INVALID_PARAMETERS_LIC_7:
return kInvalidParametersLic7;
case wvcdm::LICENSE_REQUEST_SERVICE_CERTIFICATE_GENERATION_ERROR:
return kLicenseRequestServiceCertificateGenerationError;
case wvcdm::CENC_INIT_DATA_UNAVAILABLE:
return kCencInitDataUnavailable;
case wvcdm::PREPARE_CENC_CONTENT_ID_FAILED:
return kPrepareCencContentIdFailed;
case wvcdm::WEBM_INIT_DATA_UNAVAILABLE:
return kWebmInitDataUnavailable;
case wvcdm::PREPARE_WEBM_CONTENT_ID_FAILED:
return kPrepareWebmContentIdFailed;
case wvcdm::UNSUPPORTED_INIT_DATA_FORMAT:
return kUnsupportedInitDataFormat;
case wvcdm::LICENSE_REQUEST_NONCE_GENERATION_ERROR:
return kLicenseRequestNonceGenerationError;
case wvcdm::LICENSE_REQUEST_SIGNING_ERROR:
return kLicenseRequestSigningError;
case wvcdm::EMPTY_LICENSE_REQUEST:
return kEmptyLicenseRequest;
case wvcdm::DUPLICATE_SESSION_ID_SPECIFIED:
return kDuplicateSessionIdSpecified;
case wvcdm::LICENSE_RENEWAL_PROHIBITED:
return kLicenseRenewalProhibited;
case wvcdm::OFFLINE_LICENSE_PROHIBITED:
return kOfflineLicenseProhibited;
case wvcdm::STORAGE_PROHIBITED:
return kStorageProhibited;
case wvcdm::EMPTY_KEYSET_ID_ENG_5:
return kEmptyKeySetIdEng5;
case wvcdm::SESSION_NOT_FOUND_11:
return kSessionNotFound11;
case wvcdm::LOAD_USAGE_INFO_FILE_ERROR:
return kLoadUsageInfoFileError;
case wvcdm::LOAD_USAGE_INFO_MISSING:
return kLoadUsageInfoMissing;
case wvcdm::SESSION_FILE_HANDLE_INIT_ERROR:
return kSessionFileHandleInitError;
case wvcdm::INCORRECT_CRYPTO_MODE:
return kIncorrectCryptoMode;
case wvcdm::UNKNOWN_ERROR:
return android::ERROR_DRM_UNKNOWN;
case wvcdm::SECURE_BUFFER_REQUIRED:
case wvcdm::DECRYPT_ERROR:
return android::ERROR_DRM_CANNOT_HANDLE;
case wvcdm::INSUFFICIENT_OUTPUT_PROTECTION:
case wvcdm::ANALOG_OUTPUT_ERROR:
case wvcdm::KEY_PROHIBITED_FOR_SECURITY_LEVEL:
return android::ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION;
case wvcdm::SESSION_NOT_FOUND_12:
return kSessionNotFound12;
case wvcdm::KEY_NOT_FOUND_1:
return kKeyNotFound1;
case wvcdm::KEY_NOT_FOUND_2:
return kKeyNotFound2;
case wvcdm::KEY_CONFLICT_1:
return kKeyConflict1;
case wvcdm::SESSION_NOT_FOUND_13:
return kSessionNotFound13;
case wvcdm::SESSION_NOT_FOUND_14:
return kSessionNotFound14;
case wvcdm::SESSION_NOT_FOUND_15:
return kSessionNotFound15;
case wvcdm::SESSION_NOT_FOUND_16:
return kSessionNotFound16;
case wvcdm::KEY_NOT_FOUND_3:
return kKeyNotFound3;
case wvcdm::KEY_NOT_FOUND_4:
return kKeyNotFound4;
case wvcdm::KEY_NOT_FOUND_5:
return kKeyNotFound5;
case wvcdm::KEY_NOT_FOUND_6:
return kKeyNotFound6;
case wvcdm::INVALID_SESSION_1:
return kInvalidSession1;
case wvcdm::NO_DEVICE_KEY_1:
return kNoDeviceKey1;
case wvcdm::NO_CONTENT_KEY_2:
return kNoContentKey2;
case wvcdm::INSUFFICIENT_CRYPTO_RESOURCES_2:
return kInsufficientCryptoResources2;
case wvcdm::INVALID_PARAMETERS_ENG_13:
return kInvalidParametersEng13;
case wvcdm::INVALID_PARAMETERS_ENG_14:
return kInvalidParametersEng14;
case wvcdm::INVALID_PARAMETERS_ENG_15:
return kInvalidParametersEng15;
case wvcdm::INVALID_PARAMETERS_ENG_16:
return kInvalidParametersEng16;
case wvcdm::INVALID_PARAMETERS_ENG_17:
return kInvalidParametersEng17;
case wvcdm::INVALID_PARAMETERS_ENG_18:
return kInvalidParametersEng18;
case wvcdm::INVALID_PARAMETERS_ENG_19:
return kInvalidParametersEng19;
case wvcdm::CLIENT_IDENTIFICATION_TOKEN_ERROR_1:
return kClientIdentificationTokenError1;
case wvcdm::CLIENT_IDENTIFICATION_TOKEN_ERROR_2:
return kClientIdentificationTokenError2;
case wvcdm::UNKNOWN_SELECT_KEY_ERROR_1:
return kUnknownSelectKeyError1;
case wvcdm::UNKNOWN_SELECT_KEY_ERROR_2:
return kUnknownSelectKeyError2;
case wvcdm::CREATE_USAGE_TABLE_ERROR:
return kCreateUsageTableError;
case wvcdm::LOAD_USAGE_HEADER_GENERATION_SKEW:
return kLoadUsageHeaderGenerationSkew;
case wvcdm::LOAD_USAGE_HEADER_SIGNATURE_FAILURE:
return kLoadUsageHeaderSignatureFailure;
case wvcdm::LOAD_USAGE_HEADER_BAD_MAGIC:
return kLoadUsageHeaderBadMagic;
case wvcdm::LOAD_USAGE_HEADER_UNKNOWN_ERROR:
return kLoadUsageHeaderUnknownError;
case wvcdm::INSUFFICIENT_CRYPTO_RESOURCES_3:
return kInsufficientCryptoResources3;
case wvcdm::CREATE_USAGE_ENTRY_UNKNOWN_ERROR:
return kCreateUsageEntryUnknownError;
case wvcdm::LOAD_USAGE_ENTRY_GENERATION_SKEW:
return kLoadUsageEntryGenerationSkew;
case wvcdm::LOAD_USAGE_ENTRY_SIGNATURE_FAILURE:
return kLoadUsageEntrySignatureFailure;
case wvcdm::LOAD_USAGE_ENTRY_UNKNOWN_ERROR:
return kLoadUsageEntryUnknownError;
case wvcdm::INVALID_PARAMETERS_ENG_20:
return kInvalidParametersEng20;
case wvcdm::UPDATE_USAGE_ENTRY_UNKNOWN_ERROR:
return kUpdateUsageEntryUnknownError;
case wvcdm::INVALID_PARAMETERS_ENG_21:
return kInvalidParametersEng21;
case wvcdm::INVALID_PARAMETERS_ENG_22:
return kInvalidParametersEng22;
case wvcdm::SHRINK_USAGE_TABLER_HEADER_UNKNOWN_ERROR:
return kShrinkUsageTablerHeaderUnknownError;
case wvcdm::MOVE_USAGE_ENTRY_UNKNOWN_ERROR:
return kMoveUsageEntryUnknownError;
case wvcdm::COPY_OLD_USAGE_ENTRY_UNKNOWN_ERROR:
return kCopyOldUsageEntryUnknownError;
case wvcdm::INVALID_PARAMETERS_ENG_23:
return kInvalidParametersEng23;
case wvcdm::INVALID_PARAMETERS_ENG_24:
return kInvalidParametersEng24;
case wvcdm::USAGE_INFORMATION_SUPPORT_FAILED:
return kUsageInformationSupportFailed;
case wvcdm::USAGE_SUPPORT_GET_API_FAILED:
return kUsageSupportGetApiFailed;
case wvcdm::UNEXPECTED_EMPTY_USAGE_ENTRY:
return kUnexpectedEmptyUsageEntry;
case wvcdm::INVALID_USAGE_ENTRY_NUMBER_MODIFICATION:
return kInvalidUsageEntryNumberModification;
case wvcdm::USAGE_INVALID_NEW_ENTRY:
return kUsageInvalidNewEntry;
case wvcdm::USAGE_INVALID_PARAMETERS_1:
return kUsageInvalidParameters1;
case wvcdm::USAGE_GET_ENTRY_RETRIEVE_LICENSE_FAILED:
return kUsageGetEntryRetrieveLicenseFailed;
case wvcdm::USAGE_GET_ENTRY_RETRIEVE_USAGE_INFO_FAILED:
return kUsageGetEntryRetrieveUsageInfoFailed;
case wvcdm::USAGE_GET_ENTRY_RETRIEVE_INVALID_STORAGE_TYPE:
return kUsageGetEntryRetrieveInvalidStorageType;
case wvcdm::USAGE_ENTRY_NUMBER_MISMATCH:
return kUsageEntryNumberMismatch;
case wvcdm::USAGE_STORE_LICENSE_FAILED:
return kUsageStoreLicenseFailed;
case wvcdm::USAGE_STORE_USAGE_INFO_FAILED:
return kUsageStoreUsageInfoFailed;
case wvcdm::USAGE_INVALID_LOAD_ENTRY:
return kUsageInvalidLoadEntry;
case wvcdm::RELEASE_USAGE_INFO_FAILED:
return android::ERROR_DRM_TAMPER_DETECTED;
case wvcdm::INCORRECT_USAGE_SUPPORT_TYPE_1:
return kIncorrectUsageSupportType1;
case wvcdm::INCORRECT_USAGE_SUPPORT_TYPE_2:
return kIncorrectUsageSupportType2;
case wvcdm::RELEASE_ALL_USAGE_INFO_ERROR_4:
return kReleaseAllUsageInfoError4;
case wvcdm::RELEASE_ALL_USAGE_INFO_ERROR_5:
return kReleaseAllUsageInfoError5;
case wvcdm::NO_USAGE_ENTRIES:
return kNoUsageEntries;
case wvcdm::LIST_LICENSE_ERROR_1:
return kListLicenseError1;
case wvcdm::LIST_LICENSE_ERROR_2:
return kListLicenseError2;
case wvcdm::LIST_USAGE_ERROR_1:
return kListUsageError1;
case wvcdm::LIST_USAGE_ERROR_2:
return kListUsageError2;
case wvcdm::DELETE_USAGE_ERROR_1:
return kDeleteUsageError1;
case wvcdm::DELETE_USAGE_ERROR_2:
return kDeleteUsageError2;
case wvcdm::DELETE_USAGE_ERROR_3:
return kDeleteUsageError3;
case wvcdm::PRIVACY_MODE_ERROR_1:
return kPrivacyModeError1;
case wvcdm::PRIVACY_MODE_ERROR_2:
return kPrivacyModeError2;
case wvcdm::PRIVACY_MODE_ERROR_3:
return kPrivacyModeError3;
case wvcdm::EMPTY_RESPONSE_ERROR_1:
return kEmptyResponseError1;
case wvcdm::PARSE_RESPONSE_ERROR_1:
return kParseResponseError1;
case wvcdm::PARSE_RESPONSE_ERROR_2:
return kParseResponseError2;
case wvcdm::PARSE_RESPONSE_ERROR_3:
return kParseResponseError3;
case wvcdm::PARSE_RESPONSE_ERROR_4:
return kParseResponseError4;
case wvcdm::USAGE_STORE_ENTRY_RETRIEVE_LICENSE_FAILED:
return kUsageStoreEntryRetrieveLicenseFailed;
case wvcdm::USAGE_STORE_ENTRY_RETRIEVE_USAGE_INFO_FAILED:
return kUsageStoreEntryRetrieveUsageInfoFailed;
case wvcdm::USAGE_STORE_ENTRY_RETRIEVE_INVALID_STORAGE_TYPE:
return kUsageStoreEntryRetrieveInvalidStorageType;
case wvcdm::RELEASE_ALL_USAGE_INFO_ERROR_6:
return kReleaseAllUsageInfoError6;
case wvcdm::RELEASE_ALL_USAGE_INFO_ERROR_7:
return kReleaseAllUsageInfoError7;
case wvcdm::LICENSE_REQUEST_INVALID_SUBLICENSE:
return kLicenseRequestInvalidSublicense;
case wvcdm::CERT_PROVISIONING_EMPTY_SERVICE_CERTIFICATE:
return kCertProvisioningEmptyServiceCertificate;
}
// Return here instead of as a default case so that the compiler will warn
// us if we forget to include an enum member in the switch statement.
return android::UNKNOWN_ERROR;
}
static inline bool isCdmResponseTypeSuccess(wvcdm::CdmResponseType res) {
return mapCdmResponseType(res) == android::OK;
}
} // namespace wvdrm
#endif // WV_MAP_ERRORS_H_