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

Commit 666b2717 authored by Hasini Gunasinghe's avatar Hasini Gunasinghe
Browse files

Fix VtsRemotelyProvisionedComponentTests for IRPC V3

This updates the test: supportsValidCurve, for IRPC implementations
that supports only V3+.

Bug: 239476788
Test: atest VtsRemotelyProvisionedComponentTests with IRPC V3
implementation

Change-Id: Ic0f1223b30e31dc537155e19e800b3001ce0fc01
parent 45135098
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -223,6 +223,20 @@ TEST_P(GetHardwareInfoTests, supportsValidCurve) {
    ASSERT_TRUE(provisionable_->getHardwareInfo(&hwInfo).isOk());

    const std::set<int> validCurves = {RpcHardwareInfo::CURVE_P256, RpcHardwareInfo::CURVE_25519};
    // First check for the implementations that supports only IRPC V3+.
    if (rpcHardwareInfo.versionNumber >= VERSION_WITHOUT_TEST_MODE) {
        bytevec keysToSignMac;
        DeviceInfo deviceInfo;
        ProtectedData protectedData;
        auto status = provisionable_->generateCertificateRequest(false, {}, {}, {}, &deviceInfo,
                                                                 &protectedData, &keysToSignMac);
        if (!status.isOk() &&
            (status.getServiceSpecificError() == BnRemotelyProvisionedComponent::STATUS_REMOVED)) {
            ASSERT_EQ(hwInfo.supportedEekCurve, RpcHardwareInfo::CURVE_NONE)
                    << "Invalid curve: " << hwInfo.supportedEekCurve;
            return;
        }
    }
    ASSERT_EQ(validCurves.count(hwInfo.supportedEekCurve), 1)
            << "Invalid curve: " << hwInfo.supportedEekCurve;
}