jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/onomondo-ipa/+/43047?usp=email )
Change subject: V1.2: Add TERMINAL CAPABILITY for IoT support ......................................................................
V1.2: Add TERMINAL CAPABILITY for IoT support
Also enable support for IoT function by setting the TERMINAL CAPABILITY. If not set, eUICC may not support IoT specific functions. With IoT eUICC emulation it is disabled.
Reference: SGP.32 Section 3.8.2
Related: SYS#8101 Change-Id: I1116bee93b31ee4a159125d840d7c5866be6fdb4 --- M src/ipa/libipa/euicc.c 1 file changed, 14 insertions(+), 5 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/onomondo-ipa refs/changes/47/43047/1
diff --git a/src/ipa/libipa/euicc.c b/src/ipa/libipa/euicc.c index d14855a..efda3c7 100644 --- a/src/ipa/libipa/euicc.c +++ b/src/ipa/libipa/euicc.c @@ -358,9 +358,8 @@ }
/* Send terminal capablilities, see also 3gpp TS 102.221 V16.2.0, section 11.1.19.2.4 */ -static int send_termcap(struct ipa_context *ctx) +static int send_termcap(struct ipa_context *ctx, const uint8_t *termcap, size_t termcap_size) { - const uint8_t termcap[] = { 0xA9, 0x03, 0x83, 0x01, 0x07 }; int rc; struct req_apdu req_apdu = { 0 }; struct res_apdu res_apdu = { 0 }; @@ -375,8 +374,8 @@ req_apdu.ins = 0xAA; req_apdu.p1 = 0x00; req_apdu.p2 = 0x00; - req_apdu.lc = sizeof(termcap); - memcpy(req_apdu.data, termcap, sizeof(termcap)); + req_apdu.lc = termcap_size; + memcpy(req_apdu.data, termcap, termcap_size); buf_req = format_req_apdu(&req_apdu);
rc = ipa_scard_transceive(ctx->scard_ctx, buf_res, buf_req); @@ -533,12 +532,22 @@ * \returns 0 on success, negative on error. */ int ipa_euicc_init_es10x(struct ipa_context *ctx) { + const uint8_t termcap_euicc[] = { 0xA9, 0x03, 0x83, 0x01, 0x07 }; + const uint8_t termcap_iot[] = { 0xA9, 0x03, 0x84, 0x01, 0x01 }; int rc;
- rc = send_termcap(ctx); + /* Set capabilites to enable support for eUICC functions. */ + rc = send_termcap(ctx, termcap_euicc, sizeof(termcap_euicc)); if (rc < 0) return rc;
+ /* Set capabilites to enable support for IoT functions. */ + if (!ctx->cfg->iot_euicc_emu_enabled) { + rc = send_termcap(ctx, termcap_iot, sizeof(termcap_iot)); + if (rc < 0) + return rc; + } + rc = manage_channel(ctx, false); if (rc < 0) return rc;