Loading drm/libmediadrmrkp/include/DrmRemotelyProvisionedComponent.h +3 −1 Original line number Original line Diff line number Diff line Loading @@ -35,7 +35,8 @@ using ::ndk::ScopedAStatus; class DrmRemotelyProvisionedComponent : public BnRemotelyProvisionedComponent { class DrmRemotelyProvisionedComponent : public BnRemotelyProvisionedComponent { public: public: DrmRemotelyProvisionedComponent(std::shared_ptr<IDrmPlugin> drm, std::string drmVendor, DrmRemotelyProvisionedComponent(std::shared_ptr<IDrmPlugin> drm, std::string drmVendor, std::string drmDesc, std::vector<uint8_t> bcc); std::string drmDesc, std::vector<uint8_t> bcc, std::vector<uint8_t> bcc_signature); ScopedAStatus getHardwareInfo(RpcHardwareInfo* info) override; ScopedAStatus getHardwareInfo(RpcHardwareInfo* info) override; ScopedAStatus generateEcdsaP256KeyPair(bool testMode, MacedPublicKey* macedPublicKey, ScopedAStatus generateEcdsaP256KeyPair(bool testMode, MacedPublicKey* macedPublicKey, Loading @@ -60,6 +61,7 @@ class DrmRemotelyProvisionedComponent : public BnRemotelyProvisionedComponent { std::string mDrmVendor; std::string mDrmVendor; std::string mDrmDesc; std::string mDrmDesc; std::vector<uint8_t> mBcc; std::vector<uint8_t> mBcc; std::vector<uint8_t> mBccSignature; }; }; } // namespace android::mediadrm } // namespace android::mediadrm Loading drm/libmediadrmrkp/src/DrmRemotelyProvisionedComponent.cpp +15 −9 Original line number Original line Diff line number Diff line Loading @@ -28,11 +28,13 @@ namespace android::mediadrm { DrmRemotelyProvisionedComponent::DrmRemotelyProvisionedComponent(std::shared_ptr<IDrmPlugin> drm, DrmRemotelyProvisionedComponent::DrmRemotelyProvisionedComponent(std::shared_ptr<IDrmPlugin> drm, std::string drmVendor, std::string drmVendor, std::string drmDesc, std::string drmDesc, std::vector<uint8_t> bcc) std::vector<uint8_t> bcc, std::vector<uint8_t> bcc_signature) : mDrm(std::move(drm)), : mDrm(std::move(drm)), mDrmVendor(std::move(drmVendor)), mDrmVendor(std::move(drmVendor)), mDrmDesc(std::move(drmDesc)), mDrmDesc(std::move(drmDesc)), mBcc(std::move(bcc)) {} mBcc(std::move(bcc)), mBccSignature(std::move(bcc_signature)) {} ScopedAStatus DrmRemotelyProvisionedComponent::getHardwareInfo(RpcHardwareInfo* info) { ScopedAStatus DrmRemotelyProvisionedComponent::getHardwareInfo(RpcHardwareInfo* info) { info->versionNumber = 3; info->versionNumber = 3; Loading Loading @@ -161,12 +163,16 @@ ScopedAStatus DrmRemotelyProvisionedComponent::generateCertificateRequestV2( } } // assemble AuthenticatedRequest (definition in IRemotelyProvisionedComponent.aidl) // assemble AuthenticatedRequest (definition in IRemotelyProvisionedComponent.aidl) *out = cppbor::Array() cppbor::Array request_array = cppbor::Array().add(1 /* version */); .add(1 /* version */) if (!mBccSignature.empty()) { .add(cppbor::Map() /* UdsCerts */) request_array.add(cppbor::EncodedItem(mBccSignature) /* UdsCerts */); .add(cppbor::EncodedItem(mBcc)) } else { .add(cppbor::EncodedItem(std::move(deviceSignedCsrPayload))) request_array.add(cppbor::Map() /* empty UdsCerts */); .encode(); } request_array.add(cppbor::EncodedItem(mBcc)) .add(cppbor::EncodedItem(std::move(deviceSignedCsrPayload))); *out = request_array.encode(); return ScopedAStatus::ok(); return ScopedAStatus::ok(); } } } // namespace android::mediadrm } // namespace android::mediadrm No newline at end of file drm/libmediadrmrkp/src/DrmRkpAdapter.cpp +10 −2 Original line number Original line Diff line number Diff line Loading @@ -87,13 +87,21 @@ getDrmRemotelyProvisionedComponents() { status.getDescription().c_str()); status.getDescription().c_str()); return; return; } } std::vector<uint8_t> bcc_signature; status = mDrm->getPropertyByteArray("bootCertificateChainSignature", &bcc_signature); if (!status.isOk()) { ALOGW("mDrm->getPropertyByteArray(\"bootCertificateChainSignature\") failed." "Detail: [%s].", status.getDescription().c_str()); // bcc signature is optional, no need to return when it is unavailable. } std::string compName(instance); std::string compName(instance); auto comps = static_cast< auto comps = static_cast< std::map<std::string, std::shared_ptr<IRemotelyProvisionedComponent>>*>( std::map<std::string, std::shared_ptr<IRemotelyProvisionedComponent>>*>( context); context); (*comps)[compName] = ::ndk::SharedRefBase::make<DrmRemotelyProvisionedComponent>( (*comps)[compName] = ::ndk::SharedRefBase::make<DrmRemotelyProvisionedComponent>( mDrm, drmVendor, drmDesc, bcc); mDrm, drmVendor, drmDesc, bcc, bcc_signature); }); }); return comps; return comps; } } Loading Loading
drm/libmediadrmrkp/include/DrmRemotelyProvisionedComponent.h +3 −1 Original line number Original line Diff line number Diff line Loading @@ -35,7 +35,8 @@ using ::ndk::ScopedAStatus; class DrmRemotelyProvisionedComponent : public BnRemotelyProvisionedComponent { class DrmRemotelyProvisionedComponent : public BnRemotelyProvisionedComponent { public: public: DrmRemotelyProvisionedComponent(std::shared_ptr<IDrmPlugin> drm, std::string drmVendor, DrmRemotelyProvisionedComponent(std::shared_ptr<IDrmPlugin> drm, std::string drmVendor, std::string drmDesc, std::vector<uint8_t> bcc); std::string drmDesc, std::vector<uint8_t> bcc, std::vector<uint8_t> bcc_signature); ScopedAStatus getHardwareInfo(RpcHardwareInfo* info) override; ScopedAStatus getHardwareInfo(RpcHardwareInfo* info) override; ScopedAStatus generateEcdsaP256KeyPair(bool testMode, MacedPublicKey* macedPublicKey, ScopedAStatus generateEcdsaP256KeyPair(bool testMode, MacedPublicKey* macedPublicKey, Loading @@ -60,6 +61,7 @@ class DrmRemotelyProvisionedComponent : public BnRemotelyProvisionedComponent { std::string mDrmVendor; std::string mDrmVendor; std::string mDrmDesc; std::string mDrmDesc; std::vector<uint8_t> mBcc; std::vector<uint8_t> mBcc; std::vector<uint8_t> mBccSignature; }; }; } // namespace android::mediadrm } // namespace android::mediadrm Loading
drm/libmediadrmrkp/src/DrmRemotelyProvisionedComponent.cpp +15 −9 Original line number Original line Diff line number Diff line Loading @@ -28,11 +28,13 @@ namespace android::mediadrm { DrmRemotelyProvisionedComponent::DrmRemotelyProvisionedComponent(std::shared_ptr<IDrmPlugin> drm, DrmRemotelyProvisionedComponent::DrmRemotelyProvisionedComponent(std::shared_ptr<IDrmPlugin> drm, std::string drmVendor, std::string drmVendor, std::string drmDesc, std::string drmDesc, std::vector<uint8_t> bcc) std::vector<uint8_t> bcc, std::vector<uint8_t> bcc_signature) : mDrm(std::move(drm)), : mDrm(std::move(drm)), mDrmVendor(std::move(drmVendor)), mDrmVendor(std::move(drmVendor)), mDrmDesc(std::move(drmDesc)), mDrmDesc(std::move(drmDesc)), mBcc(std::move(bcc)) {} mBcc(std::move(bcc)), mBccSignature(std::move(bcc_signature)) {} ScopedAStatus DrmRemotelyProvisionedComponent::getHardwareInfo(RpcHardwareInfo* info) { ScopedAStatus DrmRemotelyProvisionedComponent::getHardwareInfo(RpcHardwareInfo* info) { info->versionNumber = 3; info->versionNumber = 3; Loading Loading @@ -161,12 +163,16 @@ ScopedAStatus DrmRemotelyProvisionedComponent::generateCertificateRequestV2( } } // assemble AuthenticatedRequest (definition in IRemotelyProvisionedComponent.aidl) // assemble AuthenticatedRequest (definition in IRemotelyProvisionedComponent.aidl) *out = cppbor::Array() cppbor::Array request_array = cppbor::Array().add(1 /* version */); .add(1 /* version */) if (!mBccSignature.empty()) { .add(cppbor::Map() /* UdsCerts */) request_array.add(cppbor::EncodedItem(mBccSignature) /* UdsCerts */); .add(cppbor::EncodedItem(mBcc)) } else { .add(cppbor::EncodedItem(std::move(deviceSignedCsrPayload))) request_array.add(cppbor::Map() /* empty UdsCerts */); .encode(); } request_array.add(cppbor::EncodedItem(mBcc)) .add(cppbor::EncodedItem(std::move(deviceSignedCsrPayload))); *out = request_array.encode(); return ScopedAStatus::ok(); return ScopedAStatus::ok(); } } } // namespace android::mediadrm } // namespace android::mediadrm No newline at end of file
drm/libmediadrmrkp/src/DrmRkpAdapter.cpp +10 −2 Original line number Original line Diff line number Diff line Loading @@ -87,13 +87,21 @@ getDrmRemotelyProvisionedComponents() { status.getDescription().c_str()); status.getDescription().c_str()); return; return; } } std::vector<uint8_t> bcc_signature; status = mDrm->getPropertyByteArray("bootCertificateChainSignature", &bcc_signature); if (!status.isOk()) { ALOGW("mDrm->getPropertyByteArray(\"bootCertificateChainSignature\") failed." "Detail: [%s].", status.getDescription().c_str()); // bcc signature is optional, no need to return when it is unavailable. } std::string compName(instance); std::string compName(instance); auto comps = static_cast< auto comps = static_cast< std::map<std::string, std::shared_ptr<IRemotelyProvisionedComponent>>*>( std::map<std::string, std::shared_ptr<IRemotelyProvisionedComponent>>*>( context); context); (*comps)[compName] = ::ndk::SharedRefBase::make<DrmRemotelyProvisionedComponent>( (*comps)[compName] = ::ndk::SharedRefBase::make<DrmRemotelyProvisionedComponent>( mDrm, drmVendor, drmDesc, bcc); mDrm, drmVendor, drmDesc, bcc, bcc_signature); }); }); return comps; return comps; } } Loading