From 504b05492b1a1651b16e47ba84734a6c7ace6531 Mon Sep 17 00:00:00 2001 From: Fred Gylys-Colwell Date: Fri, 9 Apr 2021 18:19:16 -0700 Subject: [PATCH] Use either spelling of AllocateSecureBuffer in dynamic adapter Merge from Widevine repo of http://go/wvgerrit/121883 There was a problem in the v16.3 header that did not rename OEMCrypto_AllocateSecureBuffer to _oecc109 or OEMCrypto_FreeSecureBuffer to _oecc110. These functions are only used in testing. This changes the dynamic adapter to accept either name for those functions. Bug: 171121061 Change-Id: I30121c7524e8db580ba85f3e686a7a7c429d80a9 --- .../cdm/core/src/oemcrypto_adapter_dynamic.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libwvdrmengine/cdm/core/src/oemcrypto_adapter_dynamic.cpp b/libwvdrmengine/cdm/core/src/oemcrypto_adapter_dynamic.cpp index e3633a2c..194b2ee6 100644 --- a/libwvdrmengine/cdm/core/src/oemcrypto_adapter_dynamic.cpp +++ b/libwvdrmengine/cdm/core/src/oemcrypto_adapter_dynamic.cpp @@ -885,6 +885,16 @@ class Adapter { LOOKUP_ALL(16, MinorAPIVersion, OEMCrypto_MinorAPIVersion); // clang-format on + // There was a mistake in version 16.3 of the header that did not rename + // OEMCrypto_AllocateSecureBuffer or OEMCrypto_FreeSecureBuffer + if (level1_.AllocateSecureBuffer == NULL || + level1_.FreeSecureBuffer == NULL) { + level1_.AllocateSecureBuffer = (L1_AllocateSecureBuffer_t)dlsym( + level1_library_, "OEMCrypto_AllocateSecureBuffer"); + level1_.FreeSecureBuffer = (L1_FreeSecureBuffer_t)dlsym( + level1_library_, "OEMCrypto_FreeSecureBuffer"); + } + // TODO(119830252): make the code below available to a static adapter. // Check if the keybox or oem certificate is valid, if so, we are finished // with initialization.