Project

General

Profile

Actions

Bug #6119

open

aram_get_config runs into an exception on a sysmocomSJA2

Added by lynxis 9 months ago. Updated 5 months ago.

Status:
In Progress
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
07/29/2023
Due date:
% Done:

90%

Spec Reference:

Description

  • Use a SysmocomSJA2
  • pysim master / 791f80a44f8110f478a632cd2bcde5944ad4bd96
pySIM-shell (MF)> select ADF.ARA-M

pySIM-shell (MF/ADF.ARA-M)> aram_get_config
EXCEPTION of type 'ValueError' occurred with message: auto_collection_DeviceConfigDO(<class 'pySim.ara_m.DeviceInterfaceVersionDO'>): Unknown TLV Class DeviceInterfaceVersionDO in [{'DeviceInterfaceVersionDO': {'major': 0, 'minor': 0, 'patch': 1}}]; expected dict_keys(['device_interface_version_do'])
To enable full traceback, run the following command: 'set debug true'
pySIM-shell (MF/ADF.ARA-M)> 
pySIM-shell (MF/ADF.ARA-M)> set debug true
debug - was: False
now: True
pySIM-shell (MF/ADF.ARA-M)> aram_get_config
Traceback (most recent call last):
  File "/home/lynxis/.local/share/virtualenvs/pysim-C216Z-pe/lib/python3.11/site-packages/cmd2/cmd2.py", line 2399, in onecmd_plus_hooks
    stop = self.onecmd(statement, add_to_history=add_to_history)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lynxis/.local/share/virtualenvs/pysim-C216Z-pe/lib/python3.11/site-packages/cmd2/cmd2.py", line 2852, in onecmd
    stop = func(statement)
           ^^^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/ara_m.py", line 315, in do_aram_get_config
    res_do = ADF_ARAM.get_config(self._cmd.card._scc._tp)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/ara_m.py", line 298, in get_config
    cmd_do.from_dict([{'DeviceInterfaceVersionDO': {
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/tlv.py", line 161, in from_dict
    self.children = self.nested_collection.from_dict(decoded)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lynxis/projects/osmocom/repos/pysim/pySim/tlv.py", line 406, in from_dict
    raise ValueError('%s: Unknown TLV Class %s in %s; expected %s' %
ValueError: auto_collection_DeviceConfigDO(<class 'pySim.ara_m.DeviceInterfaceVersionDO'>): Unknown TLV Class DeviceInterfaceVersionDO in [{'DeviceInterfaceVersionDO': {'major': 0, 'minor': 0, 'patch': 1}}]; expected dict_keys(['device_interface_version_do'])
EXCEPTION of type 'ValueError' occurred with message: auto_collection_DeviceConfigDO(<class 'pySim.ara_m.DeviceInterfaceVersionDO'>): Unknown TLV Class DeviceInterfaceVersionDO in [{'DeviceInterfaceVersionDO': {'major': 0, 'minor': 0, 'patch': 1}}]; expected dict_keys(['device_interface_version_do'])
pySIM-shell (MF/ADF.ARA-M)> 

pySIM-shell (MF/ADF.ARA-M)> aram_get_all 
[
    {
        "response_all_ref_ar_do": [
            {
                "ref_ar_do": [
                    {
                        "ref_do": [
                            {
                                "aid_ref_do": "ffffffffffff" 
                            },
                            {
                                "dev_app_id_ref_do": "550f1a164ccd48d27a5ea3b765957493cd830171" 
                            }
                        ]
                    },
                    {
                        "ar_do": [
                            {
                                "perm_ar_do": {
                                    "permissions": "0000000000000001" 
                                }
                            }
                        ]
                    }
                ]
            }
        ]
    }
]

Actions #1

Updated by laforge 6 months ago

  • Assignee set to dexter
Actions #2

Updated by laforge 5 months ago

  • Status changed from New to In Progress
  • Assignee changed from dexter to laforge
  • % Done changed from 0 to 30
Actions #3

Updated by laforge 5 months ago

Fixed in https://gerrit.osmocom.org/c/pysim/+/35230 but now we get a new exception, at least on the SJA5-9FV:

pySIM-shell (00:MF/ADF.ARA-M)> aram_get_config 
-> 80cadf2107 e405e603000001
<- 6a86: 
Traceback (most recent call last):
  File "/space/home/laforge/.local/lib/python3.11/site-packages/cmd2/cmd2.py", line 2129, in onecmd_plus_hooks
    stop = self.onecmd(statement, add_to_history=add_to_history)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/space/home/laforge/.local/lib/python3.11/site-packages/cmd2/cmd2.py", line 2559, in onecmd
    stop = func(statement)
           ^^^^^^^^^^^^^^^
  File "/space/home/laforge/projects/git/pysim/pySim/ara_m.py", line 315, in do_aram_get_config
    res_do = ADF_ARAM.get_config(self._cmd.lchan.scc._tp)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/space/home/laforge/projects/git/pysim/pySim/ara_m.py", line 300, in get_config
    return ADF_ARAM.xceive_apdu_tlv(tp, '80cadf21', cmd_do, ResponseAramConfigDO)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/space/home/laforge/projects/git/pysim/pySim/ara_m.py", line 275, in xceive_apdu_tlv
    (data, sw) = tp.send_apdu_checksw(c_apdu, exp_sw)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/space/home/laforge/projects/git/pysim/pySim/transport/__init__.py", line 218, in send_apdu_checksw
    raise SwMatchError(rv[1], sw.lower(), self.sw_interpreter)
pySim.exceptions.SwMatchError: SW match failed! Expected 9000 and got 6a86: ARA-M - Incorrect P1 P2
EXCEPTION of type 'SwMatchError' occurred with message: 'SW match failed! Expected 9000 and got 6a86: ARA-M - Incorrect P1 P2'
Actions #4

Updated by laforge 5 months ago

  • % Done changed from 30 to 90

The P1/P2 of DF21 is explicitly listed in Section 4.1.1 of https://globalplatform.org/wp-content/uploads/2014/10/GPD_SE_Access_Control_v1.1.pdf

Sends the configuration of the device Access Control Enforcer and requests the configuration of the ARA-M

I think it's "just" that the ARA-M applet from Bertrand Martel doesn't support this. And indeed https://github.com/bertrandmartel/aram-applet confirms this. So the new exception regarding status word is not a bug in pysim, but a limitation of the ARA-M applet.

Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)