Skip to content
Success

Changes

Summary

  1. OmapiCallbackHandlerVpcd: add check to filter shortTPDUs (details)
  2. OmapiCallbackHandlerVpcd: use appropriate status word to reject MANAGE (details)
  3. OmapiCallbackHandlerVpcd: improve log output (details)
  4. OmapiCallbackHandlerVpcd: fix extration of DF-Name (AID) (details)
  5. OmapiCallbackHandlerVpcd: fetch SELECT response from OMAPI (details)
  6. OmapiCallbackHandlerVpcd: pass SELECT parameter P2 to OMAPI (details)
  7. OmapiCallbackHandlerVpcd: simplify/fix SELECT by DF-Name (aid) (details)
Commit f37382319d5702e3ff281b412a87d573918c9fa6 by pmaier@sysmocom.de
OmapiCallbackHandlerVpcd: add check to filter shortTPDUs

Related: OS#6836
Change-Id: I4e76afd7cf4d63c67b1525202fbe74e0796b2ba3
The file was modifiedapp/src/main/java/org/osmocom/androidApduProxy/OmapiCallbackHandlerVpcd.java
Commit 1bf9e5c0a2c7385b6ddd819094ebb622901a1bfb by pmaier@sysmocom.de
OmapiCallbackHandlerVpcd: use appropriate status word to reject MANAGE CHANNEL

ISO/IEC 7816-4 specifies a status word to reject MANAGE CHANNEL instructions
in case the card does not support multiple channels.

Let's also print an error message in the log to simplify debugging for users
who aren't aware of OMAPI's logical channel limitation.

Change-Id: I42529a6ae61378e41f33f1ec34124e346d4805df
Related: OS#6836
The file was modifiedapp/src/main/java/org/osmocom/androidApduProxy/OmapiCallbackHandlerVpcd.java
Commit 4a2db45628bce2b08d2bdee17928378a0bfcf167 by pmaier@sysmocom.de
OmapiCallbackHandlerVpcd: improve log output

When we select the currently selected ADF, we actually select 7fff,
which is an alias for the currently selected ADF. Let's express this
also more clearly in the log output.

Change-Id: I7004bec25f07b1a7498003231070205d2d659717
Related: OS#6836
The file was modifiedapp/src/main/java/org/osmocom/androidApduProxy/OmapiCallbackHandlerVpcd.java
Commit f5fca14a60df93485ac1bee5903bd9e702f12bf8 by pmaier@sysmocom.de
OmapiCallbackHandlerVpcd: fix extration of DF-Name (AID)

When the DF-Name (AID) is extracted from the SELECT TPDU, the length
of the TPDU is not checked properly, which may lead to an exception
in case no DF-Name (AID) is supplied. Let's put proper length checks
in place to filter corner cases and to ensure that the DF-Name (AID)
is properly extracted in case it is supplied.

Related: OS#6836
Change-Id: Idf08d752d046e012680c872552960cc069272777
The file was modifiedapp/src/main/java/org/osmocom/androidApduProxy/OmapiCallbackHandlerVpcd.java
Commit e701a00c9c3ea50d12dfd0d4a4497beae1fc20e2 by pmaier@sysmocom.de
OmapiCallbackHandlerVpcd: fetch SELECT response from OMAPI

At the moment we get the select response by selecting 7FFF, which
is an alias for the currently selected application. This returns a
select response when an ISIM or USIM application is selected. Other
applications may react differently here.

OMAPI has a getSelectResponse method through which we can get the
actual response that was received from the card when the application
was selected when openLogicalChannel was called. This is far more
accurate, so lets use getSelectResponse instead of selecting 7FFF.

Change-Id: Iacbc907ef157f20bed88325fcf6b58717990005a
The file was modifiedapp/src/main/java/org/osmocom/androidApduProxy/Omapi.java
The file was modifiedapp/src/main/java/org/osmocom/androidApduProxy/OmapiCallbackHandlerVpcd.java
Commit 93c60c64bd656e47111dfbc03c17c86e8e000bc7 by pmaier@sysmocom.de
OmapiCallbackHandlerVpcd: pass SELECT parameter P2 to OMAPI

The OMAPI method openLogicalChannel may take an optional parameter p2,
This parameter. Among other function, this paramter in particular
controls how to deal with short DF-Names that match the AIDs of several
applications.

Since we always know this parameter from the TPDU that we receive from
VPCD, let's pass it on to OMAPI when we create a new channel.

Related: OS#6836
Change-Id: Ibab2cc197284e6177a83338007a0b7f77e0ab8b9
The file was modifiedapp/src/main/java/org/osmocom/androidApduProxy/Omapi.java
The file was modifiedapp/src/main/java/org/osmocom/androidApduProxy/OmapiCallbackHandlerVpcd.java
Commit fb3308b64d7d31d993c01fedfc9e54b742c6ce99 by pmaier@sysmocom.de
OmapiCallbackHandlerVpcd: simplify/fix SELECT by DF-Name (aid)

When a TPDU with a SELECT by DF-Name is received from the VPCD end,
it cannot be transparently passed through the OMAPI channel as OMAPI
will block those TDPUs for security reasons. To overcome this, we
close the current OMAPI channel and re-open a new one under the new
DF-Name (AID).

To reduce the likelyhood for unexpected behaviour and possible loss
of state we have replaced the SELECT by DF-Name with a SELECT to
7fff (alias for the currently selected application), in case the
SELECT by DF-Name would target the currently selected application.

This workaround requires preceise tracking of which application is
currently selected. Unfortunately this has proven as difficult and
error prone.

After looking closer at the problem we noticed that we do not even
need the aforementioned workaround. The opening and closing of the
OMAPI channel just opens and closes logical channels on the card.
It does not perform a reset. This in particular means that the ADM
or PIN verification state is retained. (states like the currently
selected file, the current tag and the current record are reset by
SELECT anyway).

So let's remove the workaround and re-open the OMAPI channel each
time a SELECT by DF-Name is received.

Related: OS#6836
Change-Id: Ib4873b18d233e549e075b9384906a536907c6260
The file was modifiedapp/src/main/java/org/osmocom/androidApduProxy/OmapiCallbackHandlerVpcd.java