Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 26c4460d authored by Cong Lin's avatar Cong Lin Committed by Automerger Merge Worker
Browse files

Merge "DRM RKP interface to collect BCC signature (UdsCerts) and add to CSR"...

Merge "DRM RKP interface to collect BCC signature (UdsCerts) and add to CSR" into main am: 63d5bbf9 am: 7043b4e6

Original change: https://android-review.googlesource.com/c/platform/frameworks/av/+/3263826



Change-Id: Id8c32f1b8a696a22325f0dbc1b83244c77240fa2
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents f27be372 7043b4e6
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -35,7 +35,8 @@ using ::ndk::ScopedAStatus;
class DrmRemotelyProvisionedComponent : public BnRemotelyProvisionedComponent {
  public:
    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 generateEcdsaP256KeyPair(bool testMode, MacedPublicKey* macedPublicKey,
@@ -60,6 +61,7 @@ class DrmRemotelyProvisionedComponent : public BnRemotelyProvisionedComponent {
    std::string mDrmVendor;
    std::string mDrmDesc;
    std::vector<uint8_t> mBcc;
    std::vector<uint8_t> mBccSignature;
};
}  // namespace android::mediadrm

+15 −9
Original line number Diff line number Diff line
@@ -28,11 +28,13 @@ namespace android::mediadrm {
DrmRemotelyProvisionedComponent::DrmRemotelyProvisionedComponent(std::shared_ptr<IDrmPlugin> drm,
                                                                 std::string drmVendor,
                                                                 std::string drmDesc,
                                                                 std::vector<uint8_t> bcc)
                                                                 std::vector<uint8_t> bcc,
                                                                 std::vector<uint8_t> bcc_signature)
    : mDrm(std::move(drm)),
      mDrmVendor(std::move(drmVendor)),
      mDrmDesc(std::move(drmDesc)),
      mBcc(std::move(bcc)) {}
      mBcc(std::move(bcc)),
      mBccSignature(std::move(bcc_signature)) {}

ScopedAStatus DrmRemotelyProvisionedComponent::getHardwareInfo(RpcHardwareInfo* info) {
    info->versionNumber = 3;
@@ -161,12 +163,16 @@ ScopedAStatus DrmRemotelyProvisionedComponent::generateCertificateRequestV2(
    }

    // assemble AuthenticatedRequest (definition in IRemotelyProvisionedComponent.aidl)
    *out = cppbor::Array()
                   .add(1 /* version */)
                   .add(cppbor::Map() /* UdsCerts */)
                   .add(cppbor::EncodedItem(mBcc))
                   .add(cppbor::EncodedItem(std::move(deviceSignedCsrPayload)))
                   .encode();
    cppbor::Array request_array = cppbor::Array().add(1 /* version */);
    if (!mBccSignature.empty()) {
        request_array.add(cppbor::EncodedItem(mBccSignature) /* UdsCerts */);
    } else {
        request_array.add(cppbor::Map() /* empty UdsCerts */);
    }
    request_array.add(cppbor::EncodedItem(mBcc))
            .add(cppbor::EncodedItem(std::move(deviceSignedCsrPayload)));
    *out = request_array.encode();

    return ScopedAStatus::ok();
}
}  // namespace android::mediadrm
 No newline at end of file
+10 −2
Original line number Diff line number Diff line
@@ -87,13 +87,21 @@ getDrmRemotelyProvisionedComponents() {
                          status.getDescription().c_str());
                    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);
                auto comps = static_cast<
                        std::map<std::string, std::shared_ptr<IRemotelyProvisionedComponent>>*>(
                        context);
                (*comps)[compName] = ::ndk::SharedRefBase::make<DrmRemotelyProvisionedComponent>(
                        mDrm, drmVendor, drmDesc, bcc);
                        mDrm, drmVendor, drmDesc, bcc, bcc_signature);
            });
    return comps;
}