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

Commit 6c9d2c6a authored by Tyler Wear's avatar Tyler Wear Committed by Jack Yu
Browse files

IRadio 1.6: Public Key Type For IMSI Encryption

 - Add public key type for IMSI encryption.
 - Add VTS test case for setCarrierInfoForImsiEncryption_1_6

Test: Manual
Bug: 142333634
Merged-In: Id11055354b32e492e24f43b348bdf2745d63529c
Change-Id: Id11055354b32e492e24f43b348bdf2745d63529c
(cherry picked from commit 10ca7b1d)
parent 0ace84a1
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -496,4 +496,20 @@ interface IRadio extends @1.5::IRadio {
     * Response function is IRadioResponse.getCurrentCallsResponse_1_6()
     */
    oneway getCurrentCalls_1_6(int32_t serial);

    /**
     * Provide Carrier specific information to the modem that must be used to
     * encrypt the IMSI and IMPI. Sent by the framework during boot, carrier
     * switch and everytime the framework receives a new certificate.
     *
     * @param serial Serial number of request.
     * @param imsiEncryptionInfo ImsiEncryptionInfo as defined in types.hal.
     *
     * Response callback is
     * IRadioResponse.setCarrierInfoForImsiEncryptionResponse()
     *
     * Note this API is the same as the 1.1 version except using the 1.6 ImsiEncryptionInfo
     * as the input param.
     */
    oneway setCarrierInfoForImsiEncryption_1_6(int32_t serial, @1.6::ImsiEncryptionInfo imsiEncryptionInfo);
};
+18 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import @1.1::EutranBands;
import @1.1::GeranBands;
import @1.1::ScanStatus;
import @1.1::UtranBands;
import @1.1::ImsiEncryptionInfo;
import @1.2::Call;
import @1.2::CellInfoCdma;
import @1.2::CellConnectionStatus;
@@ -895,3 +896,20 @@ enum DataCallFailCause : @1.4::DataCallFailCause {
     */
    SLICE_REJECTED = 0x8CC,
};

/**
 * Public key type from carrier certificate.
 */
enum PublicKeyType : int32_t {
    EPDG    = 1,                   // Key type to be used for ePDG
    WLAN    = 2,                   // Key type to be used for WLAN
};

/**
 * Carrier specific Information sent by the carrier,
 * which will be used to encrypt the IMSI and IMPI.
 */
struct ImsiEncryptionInfo {
    @1.1::ImsiEncryptionInfo base;
    PublicKeyType keyType;         // Public key type
};
+26 −0
Original line number Diff line number Diff line
@@ -583,3 +583,29 @@ TEST_P(RadioHidlTest_v1_6, getCurrentCalls_1_6) {
    EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial);
    EXPECT_EQ(::android::hardware::radio::V1_6::RadioError::NONE, radioRsp_v1_6->rspInfo.error);
}

/*
 * Test IRadio.setCarrierInfoForImsiEncryption_1_6() for the response returned.
 */
TEST_P(RadioHidlTest_v1_6, setCarrierInfoForImsiEncryption_1_6) {
    serial = GetRandomSerialNumber();
    ::android::hardware::radio::V1_6::ImsiEncryptionInfo imsiInfo;
    imsiInfo.base.mcc = "310";
    imsiInfo.base.mnc = "004";
    imsiInfo.base.carrierKey = (std::vector<uint8_t>){1, 2, 3, 4, 5, 6};
    imsiInfo.base.keyIdentifier = "Test";
    imsiInfo.base.expirationTime = 20180101;
    imsiInfo.keyType = PublicKeyType::EPDG;

    radio_v1_6->setCarrierInfoForImsiEncryption_1_6(serial, imsiInfo);
    EXPECT_EQ(std::cv_status::no_timeout, wait());
    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type);
    EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial);

    if (cardStatus.base.base.base.cardState == CardState::ABSENT) {
        ASSERT_TRUE(CheckAnyOfErrors(
                radioRsp_v1_6->rspInfo.error,
                {::android::hardware::radio::V1_6::RadioError::NONE,
                 ::android::hardware::radio::V1_6::RadioError::REQUEST_NOT_SUPPORTED}));
    }
}