From 2caa832158ecff78593b825d1c1f945bff23159c Mon Sep 17 00:00:00 2001 From: Cong Lin Date: Fri, 9 Jun 2023 14:08:47 -0700 Subject: [PATCH] Fix a few Vts failures in factory_upload_tool 1. Fix getHardwareInfo 2. Allow unused param to be empty 3. Deprecate generateCertificateRequestV1 4. Update Wv IRPC Hal version to 3 Test: run VtsHalRemotelyProvisionedComponentTargetTest Test: vts_treble_vintf_vendor_test.DeviceManifest SingleAidlTest Bug: 285527325 Bug: 285289790 Change-Id: Id4080e8630d01ad5540f49ae0d13b707e541b36a --- ...ware.security.keymint-service.widevine.xml | 1 + .../WidevineRemotelyProvisionedComponent.cpp | 37 ++++++------------- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/libwvdrmengine/factory_upload_tool/android.hardware.security.keymint-service.widevine.xml b/libwvdrmengine/factory_upload_tool/android.hardware.security.keymint-service.widevine.xml index 723026ae..f2803a0b 100644 --- a/libwvdrmengine/factory_upload_tool/android.hardware.security.keymint-service.widevine.xml +++ b/libwvdrmengine/factory_upload_tool/android.hardware.security.keymint-service.widevine.xml @@ -1,6 +1,7 @@ android.hardware.security.keymint + 3 IRemotelyProvisionedComponent/widevine diff --git a/libwvdrmengine/factory_upload_tool/src/WidevineRemotelyProvisionedComponent.cpp b/libwvdrmengine/factory_upload_tool/src/WidevineRemotelyProvisionedComponent.cpp index c722d05a..67fb7dad 100644 --- a/libwvdrmengine/factory_upload_tool/src/WidevineRemotelyProvisionedComponent.cpp +++ b/libwvdrmengine/factory_upload_tool/src/WidevineRemotelyProvisionedComponent.cpp @@ -28,6 +28,8 @@ #include +#include "log.h" + namespace aidl::android::hardware::security::keymint { using ::std::string; @@ -77,7 +79,8 @@ ScopedAStatus WidevineRemotelyProvisionedComponent::getHardwareInfo( RpcHardwareInfo* info) { info->versionNumber = 3; info->rpcAuthorName = "Google"; - info->supportedEekCurve = RpcHardwareInfo::CURVE_25519; + info->supportedEekCurve = RpcHardwareInfo::CURVE_NONE; + info->supportedNumKeysInCsr = RpcHardwareInfo::MIN_SUPPORTED_NUM_KEYS_IN_CSR; info->uniqueId = "Widevine Implementation"; return ScopedAStatus::ok(); } @@ -85,33 +88,17 @@ ScopedAStatus WidevineRemotelyProvisionedComponent::getHardwareInfo( ScopedAStatus WidevineRemotelyProvisionedComponent::generateEcdsaP256KeyPair( bool /* testMode */, MacedPublicKey* /* macedPublicKey */, bytevec* /* privateKeyHandle */) { - return Status("Invalid operation."); + return Status( + "Invalid operation: generateEcdsaP256KeyPair() is not supported."); } ScopedAStatus WidevineRemotelyProvisionedComponent::generateCertificateRequest( - bool testMode, const vector& keysToSign, - const bytevec& endpointEncCertChain, const bytevec& /* challenge */, - DeviceInfo* deviceInfo, ProtectedData* protectedData, + bool /* testMode */, const vector& /* keysToSign */, + const bytevec& /* endpointEncCertChain */, const bytevec& /* challenge */, + DeviceInfo* /* deviceInfo */, ProtectedData* /* protectedData */, bytevec* /* keysToSignMac */) { - if (!keysToSign.empty()) { - return Status("Invalid operation: Keys to sign must be empty."); - } - if (deviceInfo == nullptr) { - return Status("Parameter deviceInfo must not be null."); - } - if (protectedData == nullptr) { - return Status("Parameter protectedData must not be null."); - } - - if (provisioner_ == nullptr) { - provisioner_ = std::make_unique(); - } - if (!provisioner_->GenerateCertificateRequest(testMode, endpointEncCertChain, - deviceInfo->deviceInfo, - protectedData->protectedData)) { - return Status("Failed to generate certificate request."); - } - return ScopedAStatus::ok(); + return Status(IRemotelyProvisionedComponent::STATUS_REMOVED, + "generateCertificateRequestV1 not supported."); } ScopedAStatus @@ -119,7 +106,7 @@ WidevineRemotelyProvisionedComponent::generateCertificateRequestV2( const std::vector& keysToSign, const std::vector& challenge, std::vector* csr) { if (!keysToSign.empty()) { - return Status("Invalid operation: Keys to sign must be empty."); + LOGW("Keys to sign should be empty."); } if (csr == nullptr) { return Status("Parameter csr must not be null.");