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

Commit b28af91f authored by Hunter Knepshield's avatar Hunter Knepshield
Browse files

Fix EuiccCard#authenticateServer error checking.

We were originally inspecting the wrong tag (TAG_CTX_1), when we should
have been checking TAG_CTX_COMP_1 -> TAG_UNI_2. This was always the case
per SGP.22.

This fix is targeted for Q, and we should offer this as a patch to OEMs
if necessary before then.

Bug: 116056281
Change-Id: Ia78f6f67e433a207b9a5cbe88281365695feef3d
Fix: 116056281
Test: atest FrameworksTelephonyTests
parent ea2bba4e
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -660,9 +660,15 @@ public class EuiccCard extends UiccCard {
                            .addChild(ctxParams1Builder)
                            .build().toHex());
                }),
                (byte[] response) ->
                        parseResponseAndCheckSimpleError(response,
                                EuiccCardErrorException.OPERATION_AUTHENTICATE_SERVER).toBytes(),
                (byte[] response) -> {
                    Asn1Node root = parseResponse(response);
                    if (root.hasChild(Tags.TAG_CTX_COMP_1, Tags.TAG_UNI_2)) {
                        throw new EuiccCardErrorException(
                                EuiccCardErrorException.OPERATION_AUTHENTICATE_SERVER,
                                root.getChild(Tags.TAG_CTX_COMP_1, Tags.TAG_UNI_2).asInteger());
                    }
                    return root.toBytes();
                },
                callback, handler);
    }

+1 −1
Original line number Diff line number Diff line
@@ -564,7 +564,7 @@ public class EuiccCardTest extends TelephonyTest {
                com.android.internal.R.array.config_telephonyEuiccDeviceCapabilities))
                .thenReturn(new String[] {});

        int channel = mockLogicalChannelResponses("BF38038101039000");
        int channel = mockLogicalChannelResponses("BF3805A1030201039000");

        ResultCaptor<byte[]> resultCaptor = new ResultCaptor<>();
        mEuiccCard.authenticateServer("A1B2C3-X4Y5Z6", // Matching id