Commit Graph

23 Commits

Author SHA1 Message Date
Philipp Maier e82fed7520 sysmo_isim_sja2: add full TUAK support and unit-tests
we do not have full TUAK support yet. All we can do so far is to set the
algorithm to TUAK, but we can not set configuration parameters and keys.
This patch adds features to modify the TUAK configuration byte. The key
and the TOP/TOPc is modified using the existing key and OP/OPC
commandline otions.

This patch also addes tests to verify sysmo-isim-tool.sja5.py. This also
includes TUAK. The tests are not activated for automatic testing yet
since the test fixture does not yet have a sysmo-isim-sja5 installed.

Related: SYS#6473
2023-06-23 14:05:44 +02:00
Philipp Maier 6702e0e5e8 sysmo_isim_sja2: fix OP/OPc display for 4g5g
When the OP/OPc for 4g5g should be displayed, then actually 3g key is displayed,
which is wrong.

Related: SYS#6473
2023-06-23 13:54:58 +02:00
Philipp Maier de8db1c189 sysmo_isim_sja2: improve class model
In the current form we assume that the files that store the key material
and the related configuration parameters have the same layout for all
algorithms. This assumption makes sense since for the currently
supported algorithms (not TUAK) this is indeed true.

(With the exception that there may be RFU bits still set to 1, even
though the spec clearly state those bits should be 0. However, this does
not matter in practice)

With the advent of TUAK longer keys were introduced. This made a new file
layout necessary. Unfortunately this also means that we can not rely on
the coincidence described above. This means we have to be more specific
when reading and writing the files.

This patch adds classes to model the file layout for each algorithm.

We also print the key (and OP/OPc) for each location individually
(2g,3g,4g5g). Even though the programmed key should be the same in all
locations, this allows better diagnosis. Also with the advent of TUAK we
may have different key material in 4g5g location.

Related: SYS#6473
2023-06-23 12:36:43 +02:00
Philipp Maier b8c465a72d sysmo-isim-tool: allow selection of 4g5g auth algo individually
At the moment we set the algorithm type for 4g5g to the same algorithm
type we use for 3g. There is no way to select the algorithm type for
4g5g individually.

With the Advent of TUAK users might need to set the 4g5g algorithm to
TUAK and the Algorithm used for 3g to something else (e.g. Milenage). So
let's allow to select the algorithm for 4g5g individually, but only if
the user explicitly defines it.

Related: SYS#6473
2023-06-23 11:28:43 +02:00
Philipp Maier fb9d5f7591 sysmo_isim_sja2: convert #comments to python comments where possible
Related: SYS#6473
2023-06-23 10:07:43 +02:00
Philipp Maier a97d2a2858 sysmo_isim_sja2: rename classes SYSMO_ISIMSJA2_ to SYSMO_ISIMSJAX_
The classes that model the file layout are applicable on both card
models, so lets replace the 2 with an X
2023-06-23 10:07:26 +02:00
Philipp Maier 12ce2512be sysmo_isim_sja2: Add comments to explain sysmo_isimsjax_algorithms
Related: OS#6473
2023-06-23 09:56:29 +02:00
Philipp Maier 0a2aa28f4e sysmo_isim_sja2: define return types for __str__ and encode methods
Related: OS#6473
2023-06-23 09:56:16 +02:00
Philipp Maier e3d250b805 sysmo_isim_sja2: fix file naming in comment
Related: SYS#6473
2023-06-23 09:55:52 +02:00
Philipp Maier 93facf5eda sysmo_isim_sja2: update copyright header
Related: SYS#6473
2023-06-23 09:55:35 +02:00
Philipp Maier 359d8ef645 sysmo_isim_sja2: cosmetic: remove unnecessary new lines
Related: SYS#6473
2023-06-23 09:55:24 +02:00
Philipp Maier 4e196ceaf4 cosmetic: rename Ki to Key
sysmo-isim-sja2 and sysmo-isim-sjs1 support multiple different
authentication algorithms. The commandline options and the log output
always speaks of "Ki", this is only correct when COMP128 is used. So
lets be more generic and call it "Key" rather then "Ki".

Related: OS#6473
2023-06-22 21:46:24 +02:00
Harald Welte 9c73667324 initial support for sysmoISIM-SJA5
We inherit 99% of sysmoISIM-SJA2, but expand the algorithm definitions
2023-05-26 16:13:04 +02:00
Harald Welte caa06046be sja2: fix cosmetic copy+paste and copyright statement errors 2023-05-26 16:13:04 +02:00
Harald Welte 379a0fe771 sja2: Avoid mixed tab/space indentation
This file is tab-indented, but had very few lines that were space
indented.  This is bad python style, let's convert everything to tab
for consistency.
2023-05-26 16:11:17 +02:00
Harald Welte 82a785d27f sysmo_isim_sja2.py: Fix COMP128v3 support (copy+paste mistake) 2023-05-26 16:08:26 +02:00
canghaiwuhen 0e73184c17 python3 support 2022-04-13 10:50:58 +02:00
Harald Welte 76c74c93d5 Fix many python3 compatibility problems
It's 2020, and I'm actually rather shocked to find that this code
was not python3 compatbile a long time ago...
2020-08-31 14:22:27 +02:00
Philipp Maier 77d68b84b3 sysmo_isim_sja2: reset SQN configuration to the current profile
The profile of sysmo_isim_sja2 has changed the content of the SQN
confugrantion file. Lets update the .out files of the tests and the
default values inside the program as well.
2020-03-17 14:26:57 +01:00
Philipp Maier 00241b4423 sysmoUSIM-SJA2: detect installed applications (ISIM/USIM)
Depending on the card profile the sysmoUSIM-SJA2 may come with an USIM
application or with an USIM and an ISIM application installed. If the
ISIM application is not present the related application must not get
selected and the related files must not accessed. At the moment the
presence of the ISIM application is detected by checking the ATR,
however the ATR only identifies a certain OS version or type, not an
application. Lets look at the EF.DIR first and dtermine the presence of
the applications by looking for the related AID.

Related: SYS#4817
2020-03-17 11:13:52 +01:00
Philipp Maier 7dde66efb3 sysmo-isim-sja2: reset SQN parameters completele
The commandline option -S states that the SQN parameters are reset to
default. Actually only the SQN counters are reset. Lets also reset the
related configuration parameters as well.

Change-Id: Ia1f298a00b0c4f0399afd60fefb8b3c8f3a514ba
2020-02-18 15:30:18 +01:00
Harald Welte 149da081c1 sysmo_isim_sja2: Add support for sysmoTSIM-SJA2 variant
sysmoTSIM is a 3GPP Test SIM as per TS 34.108. It doesn't have an ISIM
application, and hence we must only program the SIM + USIM part of it.
2020-02-09 16:52:43 +01:00
Philipp Maier 8dd52e04ac sja2: Add support for new simcard model
Adding support for the new SJA2 simcard type requires comprensive
refactoring of sysmo-usim-tool. We resolve the commonalities of
both simcard models in a class based approach so that code duplication
is reduced to a minium.

- Refactor sysmo-usim-tool into a class based model
- Add support for SJA2 simcard models
- Add tests for SJA2 simcard models

Change-Id: I0feab71bdaab079b35737bb4e0e2a417c4a1f96b
Related: SYS#4466
2020-01-06 11:09:21 +01:00