Attention is currently required from: dexter, fixeria, laforge.
Hello Jenkins Builder, dexter, fixeria,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/pysim/+/35462?usp=email
to look at the new patch set (#10).
The following approvals got outdated and were removed:
Verified-1 by Jenkins Builder
Change subject: Introduce GlobalPlatform SCP02 implementation
......................................................................
Introduce GlobalPlatform SCP02 implementation
This implementation of GlobalPlatform SCP02 currently only supports
C-MAC and C-ENC, but no R-MAC or R-ENC yet.
The patch also introduces the notion of having a SCP instance associated
with a SimCardCommands instance. It also adds the establish_scp0w and
release_scp shell commands to all GlobalPlatform Security Domains.
Change-Id: I56020382b9dfe8ba0f7c1c9f71eb1a9746bc5a27
---
M docs/shell.rst
M pySim-shell.py
M pySim/commands.py
M pySim/global_platform/__init__.py
A pySim/global_platform/scp02.py
A pySim/secure_channel.py
A tests/test_globalplatform.py
7 files changed, 453 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/62/35462/10
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/35462?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I56020382b9dfe8ba0f7c1c9f71eb1a9746bc5a27
Gerrit-Change-Number: 35462
Gerrit-PatchSet: 10
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Gerrit-MessageType: newpatchset
Attention is currently required from: dexter, fixeria, laforge.
Hello Jenkins Builder, dexter, fixeria,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/pysim/+/35462?usp=email
to look at the new patch set (#9).
The following approvals got outdated and were removed:
Verified+1 by Jenkins Builder
Change subject: Introduce GlobalPlatform SCP02 implementation
......................................................................
Introduce GlobalPlatform SCP02 implementation
This implementation of GlobalPlatform SCP02 currently only supports
C-MAC and C-ENC, but no R-MAC or R-ENC yet.
The patch also introduces the notion of having a SCP instance associated
with a SimCardCommands instance. No code is using this yet, it will be
introduced in a separate patch.
Change-Id: I56020382b9dfe8ba0f7c1c9f71eb1a9746bc5a27
---
M pySim/commands.py
M pySim/global_platform/__init__.py
A pySim/global_platform/scp02.py
A pySim/secure_channel.py
A tests/test_globalplatform.py
5 files changed, 335 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/62/35462/9
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/35462?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I56020382b9dfe8ba0f7c1c9f71eb1a9746bc5a27
Gerrit-Change-Number: 35462
Gerrit-PatchSet: 9
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Gerrit-MessageType: newpatchset
Attention is currently required from: laforge.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/pysim/+/35769?usp=email
to look at the new patch set (#6).
The following approvals got outdated and were removed:
Verified-1 by Jenkins Builder
Change subject: SCP02: Only C-MAC/C-ENCRYPT APDUs whose CLA byte indicates GlobalPlatform
......................................................................
SCP02: Only C-MAC/C-ENCRYPT APDUs whose CLA byte indicates GlobalPlatform
I'm not entirely sure if this is the right thing to do. For sure I do
have cards which don't like SELECT with C-MAC appended... and
GlobalPlatform clearly states SELECT is coded with CLA value that has
the MSB not set (i.e. not a GlobalPlatform command).
Change-Id: Ieda75c865a6ff2725fc3c8772bb274d96b8a5a43
---
M pySim/global_platform/scp02.py
M tests/test_globalplatform.py
2 files changed, 47 insertions(+), 18 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/69/35769/6
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/35769?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ieda75c865a6ff2725fc3c8772bb274d96b8a5a43
Gerrit-Change-Number: 35769
Gerrit-PatchSet: 6
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newpatchset
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/35799?usp=email )
Change subject: Contstrain argparse integers to permitted range
......................................................................
Contstrain argparse integers to permitted range
In many casese we used type=int permitting any integer value, positive
or negative without a constratint in size. However, in reality often
we're constrained to unsigned 8 or 16 bit ranges. Let's use the
auto_uint{8,16} functions to enforce this within argparse before
we even try to encode something that won't work.
Change-Id: I35c81230bc18e2174ec1930aa81463f03bcd69c8
---
M pySim/filesystem.py
M pySim/ts_102_222.py
M pySim/utils.py
3 files changed, 35 insertions(+), 17 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/99/35799/1
diff --git a/pySim/filesystem.py b/pySim/filesystem.py
index 2bc5f01..47bdb57 100644
--- a/pySim/filesystem.py
+++ b/pySim/filesystem.py
@@ -38,7 +38,7 @@
from smartcard.util import toBytes
-from pySim.utils import sw_match, h2b, b2h, i2h, is_hex, auto_int, Hexstr, is_hexstr
+from pySim.utils import sw_match, h2b, b2h, i2h, is_hex, auto_int, auto_uint8, auto_uint16, Hexstr, is_hexstr
from pySim.construct import filter_dict, parse_construct, build_construct
from pySim.exceptions import *
from pySim.jsonpath import js_path_find, js_path_modify
@@ -589,9 +589,9 @@
read_bin_parser = argparse.ArgumentParser()
read_bin_parser.add_argument(
- '--offset', type=int, default=0, help='Byte offset for start of read')
+ '--offset', type=auto_uint16, default=0, help='Byte offset for start of read')
read_bin_parser.add_argument(
- '--length', type=int, help='Number of bytes to read')
+ '--length', type=auto_uint16, help='Number of bytes to read')
@cmd2.with_argparser(read_bin_parser)
def do_read_binary(self, opts):
@@ -611,7 +611,7 @@
upd_bin_parser = argparse.ArgumentParser()
upd_bin_parser.add_argument(
- '--offset', type=int, default=0, help='Byte offset for start of read')
+ '--offset', type=auto_uint16, default=0, help='Byte offset for start of read')
upd_bin_parser.add_argument('data', type=is_hexstr, help='Data bytes (hex format) to write')
@cmd2.with_argparser(upd_bin_parser)
@@ -810,9 +810,9 @@
read_rec_parser = argparse.ArgumentParser()
read_rec_parser.add_argument(
- 'record_nr', type=int, help='Number of record to be read')
+ 'record_nr', type=auto_uint8, help='Number of record to be read')
read_rec_parser.add_argument(
- '--count', type=int, default=1, help='Number of records to be read, beginning at record_nr')
+ '--count', type=auto_uint8, default=1, help='Number of records to be read, beginning at record_nr')
@cmd2.with_argparser(read_rec_parser)
def do_read_record(self, opts):
@@ -828,7 +828,7 @@
read_rec_dec_parser = argparse.ArgumentParser()
read_rec_dec_parser.add_argument(
- 'record_nr', type=int, help='Number of record to be read')
+ 'record_nr', type=auto_uint8, help='Number of record to be read')
read_rec_dec_parser.add_argument('--oneline', action='store_true',
help='No JSON pretty-printing, dump as a single line')
@@ -869,7 +869,7 @@
upd_rec_parser = argparse.ArgumentParser()
upd_rec_parser.add_argument(
- 'record_nr', type=int, help='Number of record to be read')
+ 'record_nr', type=auto_uint8, help='Number of record to be read')
upd_rec_parser.add_argument('data', type=is_hexstr, help='Data bytes (hex format) to write')
@cmd2.with_argparser(upd_rec_parser)
@@ -881,7 +881,7 @@
upd_rec_dec_parser = argparse.ArgumentParser()
upd_rec_dec_parser.add_argument(
- 'record_nr', type=int, help='Number of record to be read')
+ 'record_nr', type=auto_uint8, help='Number of record to be read')
upd_rec_dec_parser.add_argument('data', help='Abstract data (JSON format) to write')
upd_rec_dec_parser.add_argument('--json-path', type=str,
help='JSON path to modify specific element of record only')
@@ -902,7 +902,7 @@
edit_rec_dec_parser = argparse.ArgumentParser()
edit_rec_dec_parser.add_argument(
- 'record_nr', type=int, help='Number of record to be edited')
+ 'record_nr', type=auto_uint8, help='Number of record to be edited')
@cmd2.with_argparser(edit_rec_dec_parser)
def do_edit_record_decoded(self, opts):
diff --git a/pySim/ts_102_222.py b/pySim/ts_102_222.py
index bf5e29f..ef6f69d 100644
--- a/pySim/ts_102_222.py
+++ b/pySim/ts_102_222.py
@@ -24,7 +24,7 @@
import argparse
from pySim.exceptions import *
-from pySim.utils import h2b, swap_nibbles, b2h, JsonEncoder
+from pySim.utils import h2b, swap_nibbles, b2h, JsonEncoder, auto_uint8, auto_uint16
from pySim.ts_102_221 import *
@@ -112,13 +112,13 @@
create_required = create_parser.add_argument_group('required arguments')
create_optional = create_parser.add_argument_group('optional arguments')
create_required.add_argument('--ef-arr-file-id', required=True, type=str, help='Referenced Security: File Identifier of EF.ARR')
- create_required.add_argument('--ef-arr-record-nr', required=True, type=int, help='Referenced Security: Record Number within EF.ARR')
- create_required.add_argument('--file-size', required=True, type=int, help='Size of file in octets')
+ create_required.add_argument('--ef-arr-record-nr', required=True, type=auto_uint8, help='Referenced Security: Record Number within EF.ARR')
+ create_required.add_argument('--file-size', required=True, type=auto_uint16, help='Size of file in octets')
create_required.add_argument('--structure', required=True, type=str, choices=['transparent', 'linear_fixed', 'ber_tlv'],
help='Structure of the to-be-created EF')
create_optional.add_argument('--short-file-id', type=str, help='Short File Identifier as 2-digit hex string')
create_optional.add_argument('--shareable', action='store_true', help='Should the file be shareable?')
- create_optional.add_argument('--record-length', type=int, help='Length of each record in octets')
+ create_optional.add_argument('--record-length', type=auto_uint16, help='Length of each record in octets')
@cmd2.with_argparser(create_parser)
def do_create_ef(self, opts):
@@ -160,11 +160,11 @@
createdf_optional = createdf_parser.add_argument_group('optional arguments')
createdf_sja_optional = createdf_parser.add_argument_group('sysmoISIM-SJA optional arguments')
createdf_required.add_argument('--ef-arr-file-id', required=True, type=str, help='Referenced Security: File Identifier of EF.ARR')
- createdf_required.add_argument('--ef-arr-record-nr', required=True, type=int, help='Referenced Security: Record Number within EF.ARR')
+ createdf_required.add_argument('--ef-arr-record-nr', required=True, type=auto_uint8, help='Referenced Security: Record Number within EF.ARR')
createdf_optional.add_argument('--shareable', action='store_true', help='Should the file be shareable?')
createdf_optional.add_argument('--aid', type=is_hexstr, help='Application ID (creates an ADF, instead of a DF)')
# mandatory by spec, but ignored by several OS, so don't force the user
- createdf_optional.add_argument('--total-file-size', type=int, help='Physical memory allocated for DF/ADi in octets')
+ createdf_optional.add_argument('--total-file-size', type=auto_uint16, help='Physical memory allocated for DF/ADi in octets')
createdf_sja_optional.add_argument('--permit-rfm-create', action='store_true')
createdf_sja_optional.add_argument('--permit-rfm-delete-terminate', action='store_true')
createdf_sja_optional.add_argument('--permit-other-applet-create', action='store_true')
@@ -208,7 +208,7 @@
resize_ef_parser.add_argument('NAME', type=str, help='Name or FID of file to be resized')
resize_ef_parser._action_groups.pop()
resize_ef_required = resize_ef_parser.add_argument_group('required arguments')
- resize_ef_required.add_argument('--file-size', required=True, type=int, help='Size of file in octets')
+ resize_ef_required.add_argument('--file-size', required=True, type=auto_uint16, help='Size of file in octets')
@cmd2.with_argparser(resize_ef_parser)
def do_resize_ef(self, opts):
diff --git a/pySim/utils.py b/pySim/utils.py
index a31fbe0..73e5040 100644
--- a/pySim/utils.py
+++ b/pySim/utils.py
@@ -927,6 +927,9 @@
def auto_uint8(x):
return _auto_uint(x, 255)
+def auto_uint16(x):
+ return _auto_uint(x, 65535)
+
def expand_hex(hexstring, length):
"""Expand a given hexstring to a specified length by replacing "." or ".."
with a filler that is derived from the neighboring nibbles respective
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/35799?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I35c81230bc18e2174ec1930aa81463f03bcd69c8
Gerrit-Change-Number: 35799
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newchange