Attention is currently required from: dexter.
laforge has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/pysim/+/37917?usp=email )
Change subject: filesystem: add command to delete all contents from a BER-TLV EF
......................................................................
Patch Set 2: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/37917?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I5d6bcfe865df7cb8fa6dd0052cab3b364d929f94
Gerrit-Change-Number: 37917
Gerrit-PatchSet: 2
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 27 Aug 2024 14:11:57 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
laforge has uploaded a new patch set (#2). ( https://gerrit.osmocom.org/c/simtrace2/+/37934?usp=email )
Change subject: README.md: Add note to avoid using a VM
......................................................................
README.md: Add note to avoid using a VM
Change-Id: I59602e6a05600fa3e100e17c10e48977391361e3
---
M README.md
1 file changed, 11 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/34/37934/2
--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/37934?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: I59602e6a05600fa3e100e17c10e48977391361e3
Gerrit-Change-Number: 37934
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-CC: Jenkins Builder
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/simtrace2/+/37934?usp=email )
Change subject: README.md: Add note to avoid using a VM
......................................................................
README.md: Add note to avoid using a VM
Change-Id: I59602e6a05600fa3e100e17c10e48977391361e3
---
M README.md
1 file changed, 11 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/34/37934/1
diff --git a/README.md b/README.md
index d24effc..81948f9 100644
--- a/README.md
+++ b/README.md
@@ -41,3 +41,14 @@
* simtrace2-list - list any USB-attached devices running simtrace2 firmware
* simtrace2-sniff - interface the 'trace' firmware to obtain card protocol traces
* simtrace2-cardem-pcsc - interface the 'cardem' fimrware to use a SIM in a PC/SC reader
+
+
+Do not expect SIMtrace2 to work in VMs
+--------------------------------------
+
+We only support running SIMtrace2 together with a Linux system running
+"bare iron" on actual hardware (x86, x86_64, arm, ...). **using VMs
+with USB pass-through for things with critical timing like SIMtrace2 is
+calling for trouble** and we will not accept related bug reports or
+support you if you do. If you still want ot use VMs: Feel free to do
+so, but understand that it's unsupported and you are on your own.
--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/37934?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: I59602e6a05600fa3e100e17c10e48977391361e3
Gerrit-Change-Number: 37934
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
dexter has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/37930?usp=email )
Change subject: pySim-shell: fix sourcecode formatting
......................................................................
pySim-shell: fix sourcecode formatting
Change-Id: I7133e93366eaacca5ace301172a08ae84e211c0e
---
M pySim-shell.py
1 file changed, 1 insertion(+), 2 deletions(-)
Approvals:
dexter: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/pySim-shell.py b/pySim-shell.py
index 78d20e6..d166008 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -1084,8 +1084,7 @@
traceback.print_exc()
print("---------------------8<---------------------")
print("(you may still try to recover from this manually by using the 'equip' command.)")
- print(
- " it should also be noted that some readers may behave strangely when no card")
+ print(" it should also be noted that some readers may behave strangely when no card")
print(" is inserted.)")
print("")
if opts.script:
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/37930?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I7133e93366eaacca5ace301172a08ae84e211c0e
Gerrit-Change-Number: 37930
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/37931?usp=email )
Change subject: scp: fix key length in dek_encrypt and dek_decrypt
......................................................................
scp: fix key length in dek_encrypt and dek_decrypt
When creating the DES cipher object with DES.new, we use the property
card_keys.dek. This property may hold a 16 byte key, but DES uses
an 8 byte key. Pycryptodome does not automatically ignore excess key
bytes. Instead it throws an exception. This means we need to make sure
to supply only the first 8 bytes of card_keys.dek
Related: OS#6531
Change-Id: I92e0dc6a6196b532bd8b53fca7b9e78070d6903f
---
M pySim/global_platform/scp.py
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/31/37931/1
diff --git a/pySim/global_platform/scp.py b/pySim/global_platform/scp.py
index f68bcf9..17463ff 100644
--- a/pySim/global_platform/scp.py
+++ b/pySim/global_platform/scp.py
@@ -230,11 +230,11 @@
super().__init__(*args, **kwargs)
def dek_encrypt(self, plaintext:bytes) -> bytes:
- cipher = DES.new(self.card_keys.dek, DES.MODE_ECB)
+ cipher = DES.new(self.card_keys.dek[:8], DES.MODE_ECB)
return cipher.encrypt(plaintext)
def dek_decrypt(self, ciphertext:bytes) -> bytes:
- cipher = DES.new(self.card_keys.dek, DES.MODE_ECB)
+ cipher = DES.new(self.card_keys.dek[:8], DES.MODE_ECB)
return cipher.decrypt(ciphertext)
def _compute_cryptograms(self, card_challenge: bytes, host_challenge: bytes):
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/37931?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I92e0dc6a6196b532bd8b53fca7b9e78070d6903f
Gerrit-Change-Number: 37931
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/37932?usp=email )
Change subject: pySim-shell: rework startup procedure and introduce headless mode
......................................................................
pySim-shell: rework startup procedure and introduce headless mode
When pySim-shell is used in a scripted environment, we may easily get trapped in
the pySim-shell prompt. This may happen in particular in case the script file
is not executed due to problem with the reader initialization. In such a case
pySim-shell will not exit automatically and the shellscript that was calling
pySim-shell will stall indefinetly.
To make the use of pySim-shell more reliable in scripted environments, let's
add a --headless option that ensures the interactive mode is never entered.
Let's also exit with an appropriate return code in case of initialization
errors, so that the calling script can know that something went wrong.
Related: OS#6531
Change-Id: I07ecb27b37e2573629981a0d032cc95cd156be7e
---
M pySim-shell.py
1 file changed, 36 insertions(+), 19 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/32/37932/1
diff --git a/pySim-shell.py b/pySim-shell.py
index 0ba8a25..565d569 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -1026,6 +1026,8 @@
help='per-CSV-column AES transport key')
global_group.add_argument("--card_handler", dest="card_handler_config", metavar="FILE",
help="Use automatic card handling machine")
+global_group.add_argument("--headless", help="Run in non interactive mode",
+ action='store_true', default=False)
adm_group = global_group.add_mutually_exclusive_group()
adm_group.add_argument('-a', '--pin-adm', metavar='PIN_ADM1', dest='pin_adm', default=None,
@@ -1041,22 +1043,15 @@
if __name__ == '__main__':
- # Parse options
+ startup_errors = False
opts = option_parser.parse_args()
- # If a script file is specified, be sure that it actually exists
- if opts.script:
- if not os.access(opts.script, os.R_OK):
- print("Invalid script file!")
- sys.exit(2)
-
+ # Register csv-file as card data provider, either from specified CSV
+ # or from CSV file in home directory
csv_column_keys = {}
for par in opts.csv_column_key:
name, key = par.split(':')
csv_column_keys[name] = key
-
- # Register csv-file as card data provider, either from specified CSV
- # or from CSV file in home directory
csv_default = str(Path.home()) + "/.osmocom/pysim/card_data.csv"
if opts.csv:
card_key_provider_register(CardKeyProviderCsv(opts.csv, csv_column_keys))
@@ -1077,18 +1072,18 @@
# able to tolerate and recover from that.
try:
rs, card = init_card(sl)
- app = PysimApp(card, rs, sl, ch, opts.script)
+ app = PysimApp(card, rs, sl, ch)
except:
+ startup_errors = True
print("Card initialization (%s) failed with an exception:" % str(sl))
print("---------------------8<---------------------")
traceback.print_exc()
print("---------------------8<---------------------")
- print("(you may still try to recover from this manually by using the 'equip' command.)")
- print(" it should also be noted that some readers may behave strangely when no card")
- print(" is inserted.)")
- print("")
- if opts.script:
- print("will not execute startup script due to card initialization errors!")
+ if not opts.headless:
+ print("(you may still try to recover from this manually by using the 'equip' command.)")
+ print(" it should also be noted that some readers may behave strangely when no card")
+ print(" is inserted.)")
+ print("")
app = PysimApp(None, None, sl, ch)
# If the user supplies an ADM PIN at via commandline args authenticate
@@ -1100,9 +1095,31 @@
try:
card._scc.verify_chv(card._adm_chv_num, h2b(pin_adm))
except Exception as e:
+ startup_errors = True
+ print("ADM verification (%s) failed with an exception:" % str(pin_adm))
+ print("---------------------8<---------------------")
print(e)
+ print("---------------------8<---------------------")
+ # Run optional command
if opts.command:
- app.onecmd_plus_hooks('{} {}'.format(opts.command, ' '.join(opts.command_args)))
- else:
+ if not startup_errors:
+ app.onecmd_plus_hooks('{} {}'.format(opts.command, ' '.join(opts.command_args)))
+ else:
+ print("Errors during startup, refusing to execute command (%s)" % opts.command)
+
+ # Run optional script file
+ if opts.script:
+ if not startup_errors:
+ if not os.access(opts.script, os.R_OK):
+ print("Error: script file (%s) not readable!" % opts.script)
+ startup_errors = True
+ else:
+ app.onecmd_plus_hooks('{} {}'.format('run_script', opts.script), add_to_history = False)
+ else:
+ print("Errors during startup, refusing to execute script (%s)" % opts.script)
+
+ if not opts.headless:
app.cmdloop()
+ elif startup_errors:
+ sys.exit(2)
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/37932?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I07ecb27b37e2573629981a0d032cc95cd156be7e
Gerrit-Change-Number: 37932
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/37930?usp=email )
Change subject: pySim-shell: fix sourcecode formatting
......................................................................
pySim-shell: fix sourcecode formatting
Change-Id: I7133e93366eaacca5ace301172a08ae84e211c0e
---
M pySim-shell.py
1 file changed, 1 insertion(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/30/37930/1
diff --git a/pySim-shell.py b/pySim-shell.py
index 78d20e6..d166008 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -1084,8 +1084,7 @@
traceback.print_exc()
print("---------------------8<---------------------")
print("(you may still try to recover from this manually by using the 'equip' command.)")
- print(
- " it should also be noted that some readers may behave strangely when no card")
+ print(" it should also be noted that some readers may behave strangely when no card")
print(" is inserted.)")
print("")
if opts.script:
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/37930?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I7133e93366eaacca5ace301172a08ae84e211c0e
Gerrit-Change-Number: 37930
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>