jolly has submitted this change. ( 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(+), 6 deletions(-)
Approvals: laforge: Looks good to me, but someone else must approve dexter: Looks good to me, approved Jenkins Builder: Verified
diff --git a/src/ipa/libipa/euicc.c b/src/ipa/libipa/euicc.c index d14855a..cfeda30 100644 --- a/src/ipa/libipa/euicc.c +++ b/src/ipa/libipa/euicc.c @@ -357,10 +357,9 @@ return es10x_res; }
-/* 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) +/* Send terminal capablilities, see also 3gpp TS 102.221 V16.2.0, section 11.1.19 */ +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,9 +532,18 @@ * \returns 0 on success, negative on error. */ int ipa_euicc_init_es10x(struct ipa_context *ctx) { + /* Capabilities according to 3GPP TS 102.221, section 11.1.19.2.4 and GSMA SGP.32, section 3.8.2 */ + uint8_t termcap[] = { 0xA9, 0x06, 0x83, 0x01, 0x07, 0x84, 0x01, 0x01 }; + size_t termcap_size = sizeof(termcap); int rc;
- rc = send_termcap(ctx); + /* Set capabilities to enable support for eUICC and IoT functions. */ + /* A non-IoT eUICC does not have IoT capabilities. */ + if (ctx->cfg->iot_euicc_emu_enabled) { + termcap[1] -= 3; + termcap_size -= 3; + } + rc = send_termcap(ctx, termcap, termcap_size); if (rc < 0) return rc;