From gerardfly9 at gmail.com Sat Jun 17 23:28:57 2017 From: gerardfly9 at gmail.com (Gerard Lawrence Pinto) Date: Sat, 17 Jun 2017 16:28:57 -0700 Subject: Feature #1724: Extend wireshark dissector for SIM/USIM traces Message-ID: Greetings, I have been working with wireshark and SIMtrace. And decided to extended the dissector for 'GET RESPONSE' (mf/df/ef) and 'STATUS' - according to the ETSI 11.11 Section 9.2.1 Page 39 - 41 and Page 46 (Definitions and Codings for response params) Keeping update with latest wireshark commits. I would like to commit to their gerrit. Please could you let me know here - if the output is as expected. Let me know your views/comments on the output so I can change it before commit. Also code can be viewed here 'https://github.com/GerardPinto/wireshark' (properly forked and synced with upstream) or reviewed by wireshark gerrit (Once I get your views on the output). (1) Get Response MF/DF: GSM SIM 11.11 1010 .... = Class Coding: ISO/IEC 7816-4 unless stated otherwise (0xa) .... 00.. = Secure Messaging Indication: No SM used between terminal and card (0x0) .... ..00 = Logical Channel number: 0 Instruction: GET RESPONSE (0xc0) Length of Expected Response Data: 32 RFU: 0x00 Total amt of memory not allocated to any of the DFs or EFs under the selected dir: 0x00 File ID: DF.GSM (0x7f20) Type of File: DF (0x02) RFU: 0000000000 Length of following data: 19 GSM Specific Data File Characteristics: 0xb3, Clock Stopping Indication: Not Allowed - unless at low level, Frequency Required for ENVELOPE cmd /AUTH algo, CHV1 Status .... 00.1 = Clock Stopping Indication: Not Allowed - unless at low level (0x1) .... ..1. = Frequency Required for ENVELOPE cmd /AUTH algo: 13/4 Mhz .011 .... = RFU: 0x3 1... .... = CHV1 Status: Enabled DFs in Current Directory: 0 EFs in Current Directory: 41 Number of CHVs, UNBLOCK CHVs and administrative codes: 4 RFU: 0x00 CHV1 status: 0x83, Secret Code initialized .... 0011 = False presentations remaining ('0' means blocked): 3 .000 .... = RFU: 0x0 1... .... = Secret Code initialized: Yes UNBLOCK CHV1 Status: 0x8a, Secret Code initialized .... 1010 = False presentations remaining ('0' means blocked): 10 .000 .... = RFU: 0x0 1... .... = Secret Code initialized: Yes CHV2 Status: 0x8a, Secret Code initialized .... 1010 = False presentations remaining ('0' means blocked): 10 .000 .... = RFU: 0x0 1... .... = Secret Code initialized: Yes UNBLOCK CHV2 Status: 0x8a, Secret Code initialized .... 1010 = False presentations remaining ('0' means blocked): 10 .000 .... = RFU: 0x0 1... .... = Secret Code initialized: Yes RFU: 0x00 Reserved for the Administrative Management: 030000bbda00000000 Status Word: 9000 Normal ending of the command (2) Get Response EF: GSM SIM 11.11 1010 .... = Class Coding: ISO/IEC 7816-4 unless stated otherwise (0xa) .... 00.. = Secure Messaging Indication: No SM used between terminal and card (0x0) .... ..00 = Logical Channel number: 0 Instruction: GET RESPONSE (0xc0) Length of Expected Response Data: 15 RFU: 0x00 File Size: 11 File ID: EF.LOCI (0x6f7e) Type of File: EF (0x04) EF response Byte 8: RFU: 00 Access Condition Byte 9: 0x00, UPDATE: Always (ALW), READ/SEEK: Always (ALW) .... 0000 = UPDATE: Always (ALW) (0x0) 0000 .... = READ/SEEK: Always (ALW) (0x0) Access Condition Byte 10: 0x14, INCREASE: Administrative Authority (ADM), RFU: Card Holder Verification1 (CHV1) .... 0100 = INCREASE: Administrative Authority (ADM) (0x4) 0001 .... = RFU: Card Holder Verification1 (CHV1) (0x1) Access Condition Byte 11: 0x01, INVALIDATE: Card Holder Verification1 (CHV1), REHABILITATE: Always (ALW) .... 0001 = INVALIDATE: Card Holder Verification1 (CHV1) (0x1) 0000 .... = REHABILITATE: Always (ALW) (0x0) File Status: 0x01, Validation Status .... ...1 = Validation Status: Not invalidated .... ..0. = RFU: 0x0 .... .0.. = Read Update Status: Not readable or updatable when invalidated 0000 0... = RFU: 0x00 Length of following data: 2 File Structure: Transparent (0x00) Length of a record: 0 Status Word: 9000 Normal ending of the command (3) STATUS ( ETSI 11.11 Section 9.2.2) says - The response parameters/data are identical to the response parameters/data of the SELECT command in case of an MF or DF. Thanks, Gerard -------------- next part -------------- An HTML attachment was scrubbed... URL: From pch at packetconsulting.pl Mon Jun 26 19:57:28 2017 From: pch at packetconsulting.pl (Piotr Chytla) Date: Mon, 26 Jun 2017 21:57:28 +0200 Subject: simtrace/openpcd build problem Message-ID: <20170626195727.GA10572@packetconsulting.pl> Hi, I've tried to build lastest HEAD of openpcd and building are failing on unkown uint8_t/16_t/32_t types ( on GCC 4.8.4) . Makefile/Makefile.dfu ggives the same errors. I've already tried to build this on debian 7.11 - gcc 4.5.2, and debian jessie 8.7 / gcc 4.8.4 ( arm-none-eabi) and it seems same . Reverting commit 373c172ab858102e1818c8476ab1a2b290685cda fixes problem . [..] GCC 4.5.2 -------- begin (mode: RUN_FROM_ROM) -------- arm-elf-gcc (GCC) 4.5.2 Copyright (C) 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. scripts/mkcompile_h > include/compile.h Compiling C (ARM-only): src/start/Cstartup_SAM7.c arm-elf-gcc -c -mcpu=arm7tdmi -I. -gdwarf-2 -DBOARD=SIMTRACE -DRUN_FROM_ROM -D__MS_types__ -D__LIBRFID__ -DSIMTRACE -D__AT91SAM7S128__ -Isrc/simtrace -Iinclude -Isrc -Os -Wall -Wextra -Wcast-align -Wimplicit -Wunused -Wpointer-arith -Wswitch -Wredundant-decls -Wreturn-type -Wshadow -Wbad-function-cast -Wsign-compare -Waggregate-return -Wa,-adhlns=src/start/Cstartup_SAM7.lst -MD -MP -MF .dep/Cstartup_SAM7.o.d -Wnested-externs -std=gnu99 src/start/Cstartup_SAM7.c -o src/start/Cstartup_SAM7.o Compiling C (ARM-only): lib/lib_AT91SAM7.c arm-elf-gcc -c -mcpu=arm7tdmi -I. -gdwarf-2 -DBOARD=SIMTRACE -DRUN_FROM_ROM -D__MS_types__ -D__LIBRFID__ -DSIMTRACE -D__AT91SAM7S128__ -Isrc/simtrace -Iinclude -Isrc -Os -Wall -Wextra -Wcast-align -Wimplicit -Wunused -Wpointer-arith -Wswitch -Wredundant-decls -Wreturn-type -Wshadow -Wbad-function-cast -Wsign-compare -Waggregate-return -Wa,-adhlns=lib/lib_AT91SAM7.lst -MD -MP -MF .dep/lib_AT91SAM7.o.d -Wnested-externs -std=gnu99 lib/lib_AT91SAM7.c -o lib/lib_AT91SAM7.o Compiling C (ARM-only): src/dfu/dfu.c arm-elf-gcc -c -mcpu=arm7tdmi -I. -gdwarf-2 -DBOARD=SIMTRACE -DRUN_FROM_ROM -D__MS_types__ -D__LIBRFID__ -DSIMTRACE -D__AT91SAM7S128__ -Isrc/simtrace -Iinclude -Isrc -Os -Wall -Wextra -Wcast-align -Wimplicit -Wunused -Wpointer-arith -Wswitch -Wredundant-decls -Wreturn-type -Wshadow -Wbad-function-cast -Wsign-compare -Waggregate-return -Wa,-adhlns=src/dfu/dfu.lst -MD -MP -MF .dep/dfu.o.d -Wnested-externs -std=gnu99 src/dfu/dfu.c -o src/dfu/dfu.o In file included from src/dfu/dfu.c:24:0: include/usb_ch9.h:122:2: error: expected specifier-qualifier-list before ?uint8_t? include/usb_ch9.h:172:2: error: expected specifier-qualifier-list before ?uint8_t? include/usb_ch9.h:181:2: error: expected specifier-qualifier-list before ?uint8_t? include/usb_ch9.h:234:2: error: expected specifier-qualifier-list before ?uint8_t? include/usb_ch9.h:257:2: error: expected specifier-qualifier-list before ?uint8_t? include/usb_ch9.h:271:2: error: expected specifier-qualifier-list before ?uint8_t? include/usb_ch9.h:289:2: error: expected specifier-qualifier-list before ?uint8_t? include/usb_ch9.h:320:2: error: expected specifier-qualifier-list before ?uint8_t? include/usb_ch9.h:337:2: error: expected specifier-qualifier-list before ?uint8_t? include/usb_ch9.h:351:2: error: expected specifier-qualifier-list before ?uint8_t? include/usb_ch9.h:363:2: error: expected specifier-qualifier-list before ?uint8_t? include/usb_ch9.h:381:2: error: expected specifier-qualifier-list before ?uint8_t? include/usb_ch9.h:394:2: error: expected specifier-qualifier-list before ?uint8_t? include/usb_ch9.h:406:2: error: expected specifier-qualifier-list before ?uint8_t? include/usb_ch9.h:423:2: error: expected specifier-qualifier-list before ?uint8_t? include/usb_ch9.h:434:2: error: expected specifier-qualifier-list before ?uint8_t? include/usb_ch9.h:442:2: error: expected specifier-qualifier-list before ?uint8_t? include/usb_ch9.h:473:2: error: expected specifier-qualifier-list before ?uint8_t? include/usb_ch9.h:495:2: error: expected specifier-qualifier-list before ?uint8_t? include/usb_ch9.h:511:2: error: expected specifier-qualifier-list before ?uint8_t? In file included from src/dfu/dfu.c:25:0: include/usb_dfu.h:18:2: error: expected specifier-qualifier-list before ?uint8_t? include/usb_dfu.h:44:2: error: expected specifier-qualifier-list before ?uint8_t? In file included from src/dfu/dfu.c:29:0: src/simtrace/usb_strings_dfu.h:11:2: error: expected specifier-qualifier-list before ?uint16_t? src/simtrace/usb_strings_dfu.h:14:3: error: unknown field ?bLength? specified in initializer src/simtrace/usb_strings_dfu.h:14:64: error: ?uint16_t? undeclared here (not in a function) [..] [..] GCC 4.8.4 -------- begin (mode: RUN_FROM_ROM) -------- arm-elf-gcc (4.8.4-1+11-1) 4.8.4 20141219 (release) Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. scripts/mkcompile_h > include/compile.h gcc scripts/usbstring.c -o scripts/usbstring cat src/picc/usb_strings_dfu.txt | ./scripts/usbstring > src/picc/usb_strings_dfu.h cat src/pcd/usb_strings_dfu.txt | ./scripts/usbstring > src/pcd/usb_strings_dfu.h cat src/simtrace/usb_strings_dfu.txt | ./scripts/usbstring > src/simtrace/usb_strings_dfu.h Compiling C (ARM-only): src/start/Cstartup_SAM7.c arm-elf-gcc -c -mcpu=arm7tdmi -I. -gdwarf-2 -DBOARD=SIMTRACE -DRUN_FROM_ROM -D__MS_types__ -D__LIBRFID__ -DSIMTRACE -D__AT91SAM7S128__ -Isrc/simtrace -Iinclude -Isrc -Os -Wall -Wextra -Wcast-align -Wimplicit -Wunused -Wpointer-arith -Wswitch -Wredundant-decls -Wreturn-type -Wshadow -Wbad-function-cast -Wsign-compare -Waggregate-return -Wa,-adhlns=src/start/Cstartup_SAM7.lst -MD -MP -MF .dep/Cstartup_SAM7.o.d -Wnested-externs -std=gnu99 src/start/Cstartup_SAM7.c -o src/start/Cstartup_SAM7.o Compiling C (ARM-only): lib/lib_AT91SAM7.c arm-elf-gcc -c -mcpu=arm7tdmi -I. -gdwarf-2 -DBOARD=SIMTRACE -DRUN_FROM_ROM -D__MS_types__ -D__LIBRFID__ -DSIMTRACE -D__AT91SAM7S128__ -Isrc/simtrace -Iinclude -Isrc -Os -Wall -Wextra -Wcast-align -Wimplicit -Wunused -Wpointer-arith -Wswitch -Wredundant-decls -Wreturn-type -Wshadow -Wbad-function-cast -Wsign-compare -Waggregate-return -Wa,-adhlns=lib/lib_AT91SAM7.lst -MD -MP -MF .dep/lib_AT91SAM7.o.d -Wnested-externs -std=gnu99 lib/lib_AT91SAM7.c -o lib/lib_AT91SAM7.o Compiling C (ARM-only): src/dfu/dfu.c arm-elf-gcc -c -mcpu=arm7tdmi -I. -gdwarf-2 -DBOARD=SIMTRACE -DRUN_FROM_ROM -D__MS_types__ -D__LIBRFID__ -DSIMTRACE -D__AT91SAM7S128__ -Isrc/simtrace -Iinclude -Isrc -Os -Wall -Wextra -Wcast-align -Wimplicit -Wunused -Wpointer-arith -Wswitch -Wredundant-decls -Wreturn-type -Wshadow -Wbad-function-cast -Wsign-compare -Waggregate-return -Wa,-adhlns=src/dfu/dfu.lst -MD -MP -MF .dep/dfu.o.d -Wnested-externs -std=gnu99 src/dfu/dfu.c -o src/dfu/dfu.o In file included from src/dfu/dfu.c:24:0: include/usb_ch9.h:122:2: error: unknown type name 'uint8_t' uint8_t bRequestType; ^ include/usb_ch9.h:123:2: error: unknown type name 'uint8_t' uint8_t bRequest; ^ include/usb_ch9.h:124:2: error: unknown type name 'uint16_t' uint16_t wValue; ^ include/usb_ch9.h:125:2: error: unknown type name 'uint16_t' uint16_t wIndex; ^ include/usb_ch9.h:126:2: error: unknown type name 'uint16_t' uint16_t wLength; ^ include/usb_ch9.h:172:2: error: unknown type name 'uint8_t' uint8_t bLength; ^ include/usb_ch9.h:173:2: error: unknown type name 'uint8_t' uint8_t bDescriptorType; ^ include/usb_ch9.h:181:2: error: unknown type name 'uint8_t' uint8_t bLength; ^ include/usb_ch9.h:182:2: error: unknown type name 'uint8_t' uint8_t bDescriptorType; ^ include/usb_ch9.h:184:2: error: unknown type name 'uint16_t' uint16_t bcdUSB; ^ include/usb_ch9.h:185:2: error: unknown type name 'uint8_t' uint8_t bDeviceClass; ^ include/usb_ch9.h:186:2: error: unknown type name 'uint8_t' uint8_t bDeviceSubClass; ^ include/usb_ch9.h:187:2: error: unknown type name 'uint8_t' uint8_t bDeviceProtocol; ^ include/usb_ch9.h:188:2: error: unknown type name 'uint8_t' uint8_t bMaxPacketSize0; ^ include/usb_ch9.h:189:2: error: unknown type name 'uint16_t' uint16_t idVendor; ^ include/usb_ch9.h:190:2: error: unknown type name 'uint16_t' uint16_t idProduct; ^ include/usb_ch9.h:191:2: error: unknown type name 'uint16_t' uint16_t bcdDevice; ^ include/usb_ch9.h:192:2: error: unknown type name 'uint8_t' uint8_t iManufacturer; ^ include/usb_ch9.h:193:2: error: unknown type name 'uint8_t' uint8_t iProduct; ^ include/usb_ch9.h:194:2: error: unknown type name 'uint8_t' uint8_t iSerialNumber; ^ include/usb_ch9.h:195:2: error: unknown type name 'uint8_t' uint8_t bNumConfigurations; ^ include/usb_ch9.h:234:2: error: unknown type name 'uint8_t' uint8_t bLength; ^ include/usb_ch9.h:235:2: error: unknown type name 'uint8_t' uint8_t bDescriptorType; ^ include/usb_ch9.h:237:2: error: unknown type name 'uint16_t' uint16_t wTotalLength; ^ include/usb_ch9.h:238:2: error: unknown type name 'uint8_t' uint8_t bNumInterfaces; ^ include/usb_ch9.h:239:2: error: unknown type name 'uint8_t' uint8_t bConfigurationValue; ^ include/usb_ch9.h:240:2: error: unknown type name 'uint8_t' uint8_t iConfiguration; ^ include/usb_ch9.h:241:2: error: unknown type name 'uint8_t' uint8_t bmAttributes; ^ include/usb_ch9.h:242:2: error: unknown type name 'uint8_t' uint8_t bMaxPower; ^ include/usb_ch9.h:257:2: error: unknown type name 'uint8_t' uint8_t bLength; ^ include/usb_ch9.h:258:2: error: unknown type name 'uint8_t' uint8_t bDescriptorType; ^ include/usb_ch9.h:260:2: error: unknown type name 'uint16_t' uint16_t wData[0]; /* UTF-16LE encoded */ ^ include/usb_ch9.h:271:2: error: unknown type name 'uint8_t' uint8_t bLength; ^ include/usb_ch9.h:272:2: error: unknown type name 'uint8_t' uint8_t bDescriptorType; ^ include/usb_ch9.h:274:2: error: unknown type name 'uint8_t' uint8_t bInterfaceNumber; ^ include/usb_ch9.h:275:2: error: unknown type name 'uint8_t' uint8_t bAlternateSetting; ^ include/usb_ch9.h:276:2: error: unknown type name 'uint8_t' uint8_t bNumEndpoints; ^ include/usb_ch9.h:277:2: error: unknown type name 'uint8_t' uint8_t bInterfaceClass; ^ include/usb_ch9.h:278:2: error: unknown type name 'uint8_t' uint8_t bInterfaceSubClass; ^ include/usb_ch9.h:279:2: error: unknown type name 'uint8_t' uint8_t bInterfaceProtocol; ^ include/usb_ch9.h:280:2: error: unknown type name 'uint8_t' uint8_t iInterface; ^ include/usb_ch9.h:289:2: error: unknown type name 'uint8_t' uint8_t bLength; ^ include/usb_ch9.h:290:2: error: unknown type name 'uint8_t' uint8_t bDescriptorType; ^ include/usb_ch9.h:292:2: error: unknown type name 'uint8_t' uint8_t bEndpointAddress; ^ include/usb_ch9.h:293:2: error: unknown type name 'uint8_t' uint8_t bmAttributes; ^ include/usb_ch9.h:294:2: error: unknown type name 'uint16_t' uint16_t wMaxPacketSize; ^ include/usb_ch9.h:295:2: error: unknown type name 'uint8_t' uint8_t bInterval; ^ include/usb_ch9.h:320:2: error: unknown type name 'uint8_t' uint8_t bLength; ^ include/usb_ch9.h:321:2: error: unknown type name 'uint8_t' uint8_t bDescriptorType; ^ include/usb_ch9.h:323:2: error: unknown type name 'uint16_t' uint16_t bcdUSB; ^ include/usb_ch9.h:324:2: error: unknown type name 'uint8_t' uint8_t bDeviceClass; ^ include/usb_ch9.h:325:2: error: unknown type name 'uint8_t' uint8_t bDeviceSubClass; ^ include/usb_ch9.h:326:2: error: unknown type name 'uint8_t' uint8_t bDeviceProtocol; ^ include/usb_ch9.h:327:2: error: unknown type name 'uint8_t' uint8_t bMaxPacketSize0; ^ include/usb_ch9.h:328:2: error: unknown type name 'uint8_t' uint8_t bNumConfigurations; ^ include/usb_ch9.h:329:2: error: unknown type name 'uint8_t' uint8_t bRESERVED; ^ include/usb_ch9.h:337:2: error: unknown type name 'uint8_t' /pch -- Piotr Chytla From Vishal.Vaidhyanathan at privoro.com Fri Jun 2 22:08:37 2017 From: Vishal.Vaidhyanathan at privoro.com (Vishal Vaidhyanathan) Date: Fri, 02 Jun 2017 22:08:37 -0000 Subject: Simtrace Message-ID: <3ED0BBE6-A9E7-464A-8E22-065B7F4D439D@privoro.com> Hi, We purchased the Simtrace HW kit from you guys and I tried to sniff the communication between the sim and an iPhone 6. After installing the firmware and running simtrace, I was able to view the results on Wireshark. Looking into the results, all the field?s like EF.ICCID, EF.IMSI and EF.Keys had the same number (APDU Payload). I got the numbers like ICCID and IMSI and it didn?t match them. Do you have any idea where the issue might be? Please let me know Regards, Vishal -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: Message signed with OpenPGP URL: