This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHarald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/13950 )
Change subject: finish implementing sim-iccid
......................................................................
finish implementing sim-iccid
Change-Id: I71b5832703a60c0c967fa2c6bc0eec56883962c5
---
M sysmoOCTSIM/main.c
1 file changed, 38 insertions(+), 4 deletions(-)
Approvals:
Jenkins Builder: Verified
Harald Welte: Looks good to me, approved
diff --git a/sysmoOCTSIM/main.c b/sysmoOCTSIM/main.c
index 327ac6d..6ab8bc8 100644
--- a/sysmoOCTSIM/main.c
+++ b/sysmoOCTSIM/main.c
@@ -658,13 +658,47 @@
// select MF
printf("(%d) SELECT MF\r\n", slotnr);
- // write SELECT MF APDU
- const uint8_t select_mf_header[] = {0xa0, 0xa4, 0x00, 0x00, 0x02};
- const uint8_t select_mf_data[] = {0x3f, 0x00};
- int rc = slot_tpdu_xfer(slotnr, select_mf_header, (uint8_t*)select_mf_data, ARRAY_SIZE(select_mf_data), true); // transfer TPDU
+ const uint8_t select_header[] = {0xa0, 0xa4, 0x00, 0x00, 0x02}; // see TS 102.221 sec. 11.1.1
+ const uint8_t select_data_mf[] = {0x3f, 0x00}; // see TS 102.221 sec. 13.1
+ int rc = slot_tpdu_xfer(slotnr, select_header, (uint8_t*)select_data_mf, ARRAY_SIZE(select_data_mf), true); // transfer TPDU
if (ERR_NONE != rc) {
printf("error while SELECT MF (errno = %d)\r\n", rc);
}
+ // ignore response data
+
+ // select EF_ICCID
+ printf("(%d) SELECT EF_ICCID\r\n", slotnr);
+ const uint8_t select_data_ef_iccid[] = {0x2f, 0xe2}; // see TS 102.221 sec. 13.2
+ rc = slot_tpdu_xfer(slotnr, select_header, (uint8_t*)select_data_ef_iccid, ARRAY_SIZE(select_data_ef_iccid), true); // transfer TPDU
+ if (ERR_NONE != rc) {
+ printf("error while SELECT EF_ICCID (errno = %d)\r\n", rc);
+ }
+ // ignore response data
+
+ // read EF_ICCID
+ printf("(%d) READ EF_ICCID\r\n", slotnr);
+ uint8_t iccid[10];
+ uint8_t read_binary[] = {0xa0, 0xb0, 0x00, 0x00, ARRAY_SIZE(iccid)}; // see TS 102.221 sec. 11.1.3
+ rc = slot_tpdu_xfer(slotnr, read_binary, iccid, ARRAY_SIZE(iccid), false); // transfer TPDU
+ if (ERR_NONE != rc) {
+ printf("error while READ ICCID (errno = %d)\r\n", rc);
+ }
+ // ignore response data
+
+ printf("(%d) ICCID: ", slotnr);
+ for (uint8_t i = 0; i < ARRAY_SIZE(iccid); i++) {
+ uint8_t nibble = iccid[i] & 0xf;
+ if (0xf == nibble) {
+ break;
+ }
+ printf("%x", nibble);
+ nibble = iccid[i] >> 4;
+ if (0xf == nibble) {
+ break;
+ }
+ printf("%x", nibble);
+ }
+ printf("\r\n");
// disable LED
settings.led = false;
--
To view, visit https://gerrit.osmocom.org/13950
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I71b5832703a60c0c967fa2c6bc0eec56883962c5
Gerrit-Change-Number: 13950
Gerrit-PatchSet: 1
Gerrit-Owner: Kévin Redon <kredon at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190510/fcdc892e/attachment.htm>