* Fix strict aliasing error in gcc [ Merge of http://go/wvgerrit/15856 ] This also ensures the alignment of 64-bit memory access in a portable way, without using compiler-specific mechanisms like attributes or platform-specific mechanisms like memalign. (The aliasing error does not show up in clang.) * Return kNotSupported for non-Widevine init data [ Merge of http://go/wvgerrit/15853 ] This also improves logging for the init data parser by including a verbose message for non-Widevine PSSHs and by using a new IsEOF() method to avoid misleading "Unable to read atom size" logs. * Cast RSA_size() to int [ Merge of http://go/wvgerrit/15880 ] It has been suggested that this may be unsigned on some versions of OpenSSL or BoringSSL. * Be strict about warnings for CE CDM [ Merge of http://go/wvgerrit/15831 ] * Enable all warnings and treat warnings as errors in the CE build. * Fix all existing warnings (mostly unused variables, consts, and functions, and one signed/unsigned comparison). * Exclude protobuf warnings rather than maintain a divergent copy. * Fix release build errors [ Merge of http://go/wvgerrit/15855 ] * Level 3 Build With Android Emulator [ Merge of http://go/wvgerrit/15778 ] This CL rebuilds the level 3 libraries with the android emulator sdk_phone_*. This seems to avoid problems with the x86 build using incorrect compiler flags. These libraries work for arm, x86, mips, arm64, and x86_64. The level 3 library is disabled for mips64. Versions: level3/mips/libwvlevel3.a Level3 Library Sep 30 2015 18:29:50 level3/arm/libwvlevel3.a Level3 Library Sep 28 2015 13:18:25 level3/x86/libwvlevel3.a Level3 Library Sep 28 2015 13:08:28 Change-Id: I1e50aa78bdc84ecb905f2e55297d4f48b140341c
293 lines
12 KiB
C++
293 lines
12 KiB
C++
/*******************************************************************************
|
|
*
|
|
* Copyright 2015 Google Inc. All Rights Reserved.
|
|
*
|
|
* Stubs for OEMCrypto Level 3 Fallback APIs. (use when level 3 doesn't compile)
|
|
*
|
|
******************************************************************************/
|
|
|
|
#include "level3.h"
|
|
|
|
namespace wvoec3 {
|
|
OEMCryptoResult Level3_Initialize(void) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_Terminate(void) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_OpenSession(OEMCrypto_SESSION* /*session*/) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_CloseSession(OEMCrypto_SESSION /*session*/) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_GenerateDerivedKeys(OEMCrypto_SESSION /*session*/,
|
|
const uint8_t* /*mac_key_context*/,
|
|
uint32_t /*mac_key_context_length*/,
|
|
const uint8_t* /*enc_key_context*/,
|
|
uint32_t /*enc_key_context_length*/) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_GenerateNonce(OEMCrypto_SESSION /*session*/,
|
|
uint32_t* /*nonce*/) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_GenerateSignature(OEMCrypto_SESSION /*session*/,
|
|
const uint8_t* /*message*/,
|
|
size_t /*message_length*/,
|
|
uint8_t* /*signature*/,
|
|
size_t* /*signature_length*/) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_LoadKeys(OEMCrypto_SESSION /*session*/,
|
|
const uint8_t* /*message*/,
|
|
size_t /*message_length*/,
|
|
const uint8_t* /*signature*/,
|
|
size_t /*signature_length*/,
|
|
const uint8_t* /*enc_mac_key_iv*/,
|
|
const uint8_t* /*enc_mac_key*/,
|
|
size_t /*num_keys*/,
|
|
const OEMCrypto_KeyObject* /*key_array*/,
|
|
const uint8_t* /*pst*/,
|
|
size_t /*pst_length*/) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_RefreshKeys(OEMCrypto_SESSION /*session*/,
|
|
const uint8_t* /*message*/,
|
|
size_t /*message_length*/,
|
|
const uint8_t* /*signature*/,
|
|
size_t /*signature_length*/,
|
|
size_t /*num_keys*/,
|
|
const OEMCrypto_KeyRefreshObject* /*key_array*/) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_QueryKeyControl(OEMCrypto_SESSION /*session*/,
|
|
const uint8_t* /*key_id*/,
|
|
size_t /*key_id_length*/,
|
|
uint8_t* /*key_control_block*/,
|
|
size_t* /*key_control_block_length*/) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_SelectKey(const OEMCrypto_SESSION /*session*/,
|
|
const uint8_t* /*key_id*/,
|
|
size_t /*key_id_length*/) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_DecryptCTR(OEMCrypto_SESSION /*session*/,
|
|
const uint8_t* /*data_addr*/, size_t /*data_length*/,
|
|
bool /*is_encrypted*/, const uint8_t* /*iv*/,
|
|
size_t /*block_offset*/,
|
|
const OEMCrypto_DestBufferDesc* /*out_buffer*/,
|
|
uint8_t /*subsample_flags*/) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_CopyBuffer(const uint8_t */*data_addr*/,
|
|
size_t /*data_length*/,
|
|
OEMCrypto_DestBufferDesc* /*out_buffer*/,
|
|
uint8_t /*subsample_flags*/) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_WrapKeybox(const uint8_t* /*keybox*/,
|
|
size_t /*keyBoxLength*/,
|
|
uint8_t* /*wrappedKeybox*/,
|
|
size_t* /*wrappedKeyBoxLength*/,
|
|
const uint8_t* /*transportKey*/,
|
|
size_t /*transportKeyLength*/) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_InstallKeybox(const uint8_t* /*keybox*/,
|
|
size_t /*keyBoxLength*/) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_LoadTestKeybox() {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_IsKeyboxValid(void) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_GetDeviceID(uint8_t* /*deviceID*/, size_t* /*idLength*/) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_GetKeyData(uint8_t* /*keyData*/,
|
|
size_t* /*keyDataLength*/) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_GetRandom(uint8_t* /*randomData*/, size_t /*dataLength*/) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_RewrapDeviceRSAKey(OEMCrypto_SESSION /*session*/,
|
|
const uint8_t* /*message*/,
|
|
size_t /*message_length*/,
|
|
const uint8_t* /*signature*/,
|
|
size_t /*signature_length*/,
|
|
const uint32_t* /*nonce*/,
|
|
const uint8_t* /*enc_rsa_key*/,
|
|
size_t /*enc_rsa_key_length*/,
|
|
const uint8_t* /*enc_rsa_key_iv*/,
|
|
uint8_t* /*wrapped_rsa_key*/,
|
|
size_t* /*wrapped_rsa_key_length*/) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_LoadDeviceRSAKey(OEMCrypto_SESSION /*session*/,
|
|
const uint8_t* /*wrapped_rsa_key*/,
|
|
size_t /*wrapped_rsa_key_length*/) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_LoadTestRSAKey() {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_GenerateRSASignature(OEMCrypto_SESSION /*session*/,
|
|
const uint8_t* /*message*/,
|
|
size_t /*message_length*/,
|
|
uint8_t* /*signature*/,
|
|
size_t* /*signature_length*/,
|
|
RSA_Padding_Scheme /*padding_scheme*/) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_DeriveKeysFromSessionKey(OEMCrypto_SESSION /*session*/,
|
|
const uint8_t* /*enc_session_key*/,
|
|
size_t /*enc_session_key_length*/,
|
|
const uint8_t* /*mac_key_context*/,
|
|
size_t /*mac_key_context_length*/,
|
|
const uint8_t* /*enc_key_context*/,
|
|
size_t /*enc_key_context_length*/) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
uint32_t Level3_APIVersion() {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
const char* Level3_SecurityLevel() {
|
|
return "L3";
|
|
}
|
|
|
|
OEMCryptoResult Level3_GetHDCPCapability(OEMCrypto_HDCP_Capability */*current*/,
|
|
OEMCrypto_HDCP_Capability */*maximum*/) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
bool Level3_SupportsUsageTable() {
|
|
return false;
|
|
}
|
|
|
|
bool Level3_IsAntiRollbackHwPresent() {
|
|
return false;
|
|
}
|
|
|
|
OEMCryptoResult Level3_GetNumberOfOpenSessions(size_t* /*count*/) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_GetMaxNumberOfSessions(size_t* /*maximum*/) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_Generic_Encrypt(OEMCrypto_SESSION /*session*/,
|
|
const uint8_t* /*in_buffer*/,
|
|
size_t /*buffer_length*/,
|
|
const uint8_t* /*iv*/,
|
|
OEMCrypto_Algorithm /*algorithm*/,
|
|
uint8_t* /*out_buffer*/) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_Generic_Decrypt(OEMCrypto_SESSION /*session*/,
|
|
const uint8_t* /*in_buffer*/,
|
|
size_t /*buffer_length*/,
|
|
const uint8_t* /*iv*/,
|
|
OEMCrypto_Algorithm /*algorithm*/,
|
|
uint8_t* /*out_buffer*/) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_Generic_Sign(OEMCrypto_SESSION /*session*/,
|
|
const uint8_t* /*in_buffer*/,
|
|
size_t /*buffer_length*/,
|
|
OEMCrypto_Algorithm /*algorithm*/,
|
|
uint8_t* /*signature*/,
|
|
size_t* /*signature_length*/) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_Generic_Verify(OEMCrypto_SESSION /*session*/,
|
|
const uint8_t* /*in_buffer*/,
|
|
size_t /*buffer_length*/,
|
|
OEMCrypto_Algorithm /*algorithm*/,
|
|
const uint8_t* /*signature*/,
|
|
size_t /*signature_length*/) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_UpdateUsageTable() {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_DeactivateUsageEntry(const uint8_t */*pst*/,
|
|
size_t /*pst_length*/) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_ReportUsage(OEMCrypto_SESSION /*session*/,
|
|
const uint8_t* /*pst*/, size_t /*pst_length*/,
|
|
OEMCrypto_PST_Report* /*buffer*/,
|
|
size_t* /*buffer_length*/) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_DeleteUsageEntry(OEMCrypto_SESSION /*session*/,
|
|
const uint8_t* /*pst*/,
|
|
size_t /*pst_length*/,
|
|
const uint8_t */*message*/,
|
|
size_t /*message_length*/,
|
|
const uint8_t */*signature*/,
|
|
size_t /*signature_length*/) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_ForceDeleteUsageEntry(const uint8_t* /*pst*/,
|
|
size_t /*pst_length*/) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Level3_DeleteUsageTable() {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Tool_FieldProvision() {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Tool_SaveKeybox() {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
OEMCryptoResult Tool_MakePad(uint8_t* /*preprov*/, uint8_t* /*pad*/) {
|
|
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
} // namespace wvoec3
|