From 3a3307242d5a3b1427a0e9df56c02c3b857e3308 Mon Sep 17 00:00:00 2001 From: Fred Gylys-Colwell Date: Sun, 18 Nov 2018 14:00:28 -0800 Subject: [PATCH] Fix for off by one error and correct comments Merge from Widevine repo of http://go/wvgerrit/66711 This addresses review comments for the OEMCrypto v15 CLs, as documented in b/119685652. Test: unit tests Bug: 119685652 Change-Id: I0e7ce13dd80335eb1a12240df5c1df2c34ba4298 --- libwvdrmengine/cdm/core/src/oemcrypto_adapter_dynamic.cpp | 4 ++-- libwvdrmengine/oemcrypto/test/oec_device_features.cpp | 2 +- libwvdrmengine/oemcrypto/test/oec_test_data.h | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libwvdrmengine/cdm/core/src/oemcrypto_adapter_dynamic.cpp b/libwvdrmengine/cdm/core/src/oemcrypto_adapter_dynamic.cpp index 650bf248..251138c1 100644 --- a/libwvdrmengine/cdm/core/src/oemcrypto_adapter_dynamic.cpp +++ b/libwvdrmengine/cdm/core/src/oemcrypto_adapter_dynamic.cpp @@ -1144,7 +1144,7 @@ uint32_t OEMCrypto_ResourceRatingTier(SecurityLevel level) { if (!gAdapter.get()) return 0; const FunctionPointers* fcn = gAdapter->GetFunctionPointers(level); if (!fcn) return 0; - if (fcn->version < 14) return 0; + if (fcn->version <= 14) return 0; if (fcn->ResourceRatingTier == NULL) return 0; return fcn->ResourceRatingTier(); } @@ -1153,7 +1153,7 @@ uint32_t OEMCrypto_SupportsDecryptHash(SecurityLevel level) { if (!gAdapter.get()) return OEMCrypto_Hash_Not_Supported; const FunctionPointers* fcn = gAdapter->GetFunctionPointers(level); if (!fcn) return OEMCrypto_Hash_Not_Supported; - if (fcn->version < 14) return OEMCrypto_Hash_Not_Supported; + if (fcn->version < 15) return OEMCrypto_Hash_Not_Supported; if (fcn->BuildInformation == NULL) return OEMCrypto_Hash_Not_Supported; return fcn->SupportsDecryptHash(); } diff --git a/libwvdrmengine/oemcrypto/test/oec_device_features.cpp b/libwvdrmengine/oemcrypto/test/oec_device_features.cpp index 35c27e0f..fdc5164e 100644 --- a/libwvdrmengine/oemcrypto/test/oec_device_features.cpp +++ b/libwvdrmengine/oemcrypto/test/oec_device_features.cpp @@ -96,7 +96,7 @@ void DeviceFeatures::Initialize(bool is_cast_receiver, } printf("cast_receiver = %s.\n", cast_receiver ? "true" : "false"); resource_rating = OEMCrypto_ResourceRatingTier(); - printf("resource_rating = %d, security leve %s.\n", resource_rating, + printf("resource_rating = %d, security level %s.\n", resource_rating, OEMCrypto_SecurityLevel()); uint32_t decrypt_hash_type = OEMCrypto_SupportsDecryptHash(); supports_crc = (decrypt_hash_type == OEMCrypto_CRC_Clear_Buffer); diff --git a/libwvdrmengine/oemcrypto/test/oec_test_data.h b/libwvdrmengine/oemcrypto/test/oec_test_data.h index 390e81a1..97391446 100644 --- a/libwvdrmengine/oemcrypto/test/oec_test_data.h +++ b/libwvdrmengine/oemcrypto/test/oec_test_data.h @@ -50,9 +50,9 @@ static const WidevineKeybox kTestKeyboxForV13 = { } }; -// This is a test keybox. They will not be accepted by production systems. -// By using known keyboxes for these tests, the results for a given set of -// inputs to a test are predictable and can be compared to the actual results. +// This is a test keybox. It will not be accepted by production systems. By +// using a known keybox for these tests, the results for a given set of inputs +// to a test are predictable and can be compared to the actual results. static const WidevineKeybox kTestKeybox = { // Sample keybox used for test vectors {