jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/onomondo-ipa/+/43029?usp=email )
Change subject: V1.2: Add EimConfigurationData.indirectProfileDownload ......................................................................
V1.2: Add EimConfigurationData.indirectProfileDownload
The flag indicates, if eIM supports indirect download. As the current version of IPA only supports indirect download, this flag is checked. If it is not supported, profile download is rejected.
get_euicc_ci_pkid() is renamed to get_euicc_ci_pkid_ipd(), to indicate that it also gets this flag.
This also requires an update of contrib/sample_eim_cfg.ber, which is a BER encoded EimConfigurationData.
Reference: SGP.32 Section 2.11.1.1.1
Related: SYS#8101 Change-Id: Ic40111531e6f35d5ea7f3789de6cae0f1c0d5ba7 --- M asn1/SGP32Definitions.asn M contrib/sample_eim_cfg.ber M src/ipa/libasn/EimConfigurationData.c M src/ipa/libasn/EimConfigurationData.h M src/ipa/libipa/proc_eim_pkg_retr.c 5 files changed, 42 insertions(+), 18 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/onomondo-ipa refs/changes/29/43029/1
diff --git a/asn1/SGP32Definitions.asn b/asn1/SGP32Definitions.asn index a9d18b4..3b91400 100644 --- a/asn1/SGP32Definitions.asn +++ b/asn1/SGP32Definitions.asn @@ -60,7 +60,8 @@ trustedCertificateTls Certificate -- either the certificate of eIM, used for (D)TLS, or the certificate of the CA, where the encoding follows X.509 standard } OPTIONAL, eimSupportedProtocol [7] EimSupportedProtocol OPTIONAL, - euiccCiPKId [8] SubjectKeyIdentifier OPTIONAL -- CI Public Key Identifier supported on the eUICC for signature creation + euiccCiPKId [8] SubjectKeyIdentifier OPTIONAL, -- CI Public Key Identifier supported on the eUICC for signature creation + indirectProfileDownload[9] NULL OPTIONAL -- support of Indirect Profile download with indicated EimSupportedProtocol } EimIdType ::= INTEGER { eimIdTypeOid(1), diff --git a/contrib/sample_eim_cfg.ber b/contrib/sample_eim_cfg.ber index ba48514..0c0d00f 100644 --- a/contrib/sample_eim_cfg.ber +++ b/contrib/sample_eim_cfg.ber Binary files differ diff --git a/src/ipa/libasn/EimConfigurationData.c b/src/ipa/libasn/EimConfigurationData.c index 2ca5ed5..90bb101 100644 --- a/src/ipa/libasn/EimConfigurationData.c +++ b/src/ipa/libasn/EimConfigurationData.c @@ -171,7 +171,7 @@ 0, 0, /* No default value */ "eimId" }, - { ATF_POINTER, 8, offsetof(struct EimConfigurationData, eimFqdn), + { ATF_POINTER, 9, offsetof(struct EimConfigurationData, eimFqdn), (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ &asn_DEF_UTF8String, @@ -180,7 +180,7 @@ 0, 0, /* No default value */ "eimFqdn" }, - { ATF_POINTER, 7, offsetof(struct EimConfigurationData, eimIdType), + { ATF_POINTER, 8, offsetof(struct EimConfigurationData, eimIdType), (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ &asn_DEF_EimIdType, @@ -189,7 +189,7 @@ 0, 0, /* No default value */ "eimIdType" }, - { ATF_POINTER, 6, offsetof(struct EimConfigurationData, counterValue), + { ATF_POINTER, 7, offsetof(struct EimConfigurationData, counterValue), (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ &asn_DEF_NativeInteger, @@ -198,7 +198,7 @@ 0, 0, /* No default value */ "counterValue" }, - { ATF_POINTER, 5, offsetof(struct EimConfigurationData, associationToken), + { ATF_POINTER, 6, offsetof(struct EimConfigurationData, associationToken), (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ &asn_DEF_NativeInteger, @@ -207,7 +207,7 @@ 0, 0, /* No default value */ "associationToken" }, - { ATF_POINTER, 4, offsetof(struct EimConfigurationData, eimPublicKeyData), + { ATF_POINTER, 5, offsetof(struct EimConfigurationData, eimPublicKeyData), (ASN_TAG_CLASS_CONTEXT | (5 << 2)), +1, /* EXPLICIT tag at current level */ &asn_DEF_eimPublicKeyData_7, @@ -216,7 +216,7 @@ 0, 0, /* No default value */ "eimPublicKeyData" }, - { ATF_POINTER, 3, offsetof(struct EimConfigurationData, trustedPublicKeyDataTls), + { ATF_POINTER, 4, offsetof(struct EimConfigurationData, trustedPublicKeyDataTls), (ASN_TAG_CLASS_CONTEXT | (6 << 2)), +1, /* EXPLICIT tag at current level */ &asn_DEF_trustedPublicKeyDataTls_11, @@ -225,7 +225,7 @@ 0, 0, /* No default value */ "trustedPublicKeyDataTls" }, - { ATF_POINTER, 2, offsetof(struct EimConfigurationData, eimSupportedProtocol), + { ATF_POINTER, 3, offsetof(struct EimConfigurationData, eimSupportedProtocol), (ASN_TAG_CLASS_CONTEXT | (7 << 2)), -1, /* IMPLICIT tag at current level */ &asn_DEF_EimSupportedProtocol, @@ -234,7 +234,7 @@ 0, 0, /* No default value */ "eimSupportedProtocol" }, - { ATF_POINTER, 1, offsetof(struct EimConfigurationData, euiccCiPKId), + { ATF_POINTER, 2, offsetof(struct EimConfigurationData, euiccCiPKId), (ASN_TAG_CLASS_CONTEXT | (8 << 2)), -1, /* IMPLICIT tag at current level */ &asn_DEF_SubjectKeyIdentifier, @@ -243,8 +243,17 @@ 0, 0, /* No default value */ "euiccCiPKId" }, + { ATF_POINTER, 1, offsetof(struct EimConfigurationData, indirectProfileDownload), + (ASN_TAG_CLASS_CONTEXT | (9 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "indirectProfileDownload" + }, }; -static const int asn_MAP_EimConfigurationData_oms_1[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; +static const int asn_MAP_EimConfigurationData_oms_1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; static const ber_tlv_tag_t asn_DEF_EimConfigurationData_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; @@ -257,16 +266,17 @@ { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* eimPublicKeyData */ { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* trustedPublicKeyDataTls */ { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* eimSupportedProtocol */ - { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 } /* euiccCiPKId */ + { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 }, /* euiccCiPKId */ + { (ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0 } /* indirectProfileDownload */ }; asn_SEQUENCE_specifics_t asn_SPC_EimConfigurationData_specs_1 = { sizeof(struct EimConfigurationData), offsetof(struct EimConfigurationData, _asn_ctx), asn_MAP_EimConfigurationData_tag2el_1, - 9, /* Count of tags in the map */ + 10, /* Count of tags in the map */ asn_MAP_EimConfigurationData_oms_1, /* Optional members */ - 8, 0, /* Root/Additions */ - 9, /* First extension addition */ + 9, 0, /* Root/Additions */ + 10, /* First extension addition */ }; asn_TYPE_descriptor_t asn_DEF_EimConfigurationData = { "EimConfigurationData", @@ -280,7 +290,7 @@ /sizeof(asn_DEF_EimConfigurationData_tags_1[0]), /* 1 */ { 0, 0, SEQUENCE_constraint }, asn_MBR_EimConfigurationData_1, - 9, /* Elements count */ + 10, /* Elements count */ &asn_SPC_EimConfigurationData_specs_1 /* Additional specs */ };
diff --git a/src/ipa/libasn/EimConfigurationData.h b/src/ipa/libasn/EimConfigurationData.h index a5ffc79..73f7218 100644 --- a/src/ipa/libasn/EimConfigurationData.h +++ b/src/ipa/libasn/EimConfigurationData.h @@ -17,6 +17,7 @@ #include <NativeInteger.h> #include "EimSupportedProtocol.h" #include "SubjectKeyIdentifier.h" +#include <NULL.h> #include "SubjectPublicKeyInfo.h" #include "Certificate.h" #include <constr_CHOICE.h> @@ -79,6 +80,7 @@ } *trustedPublicKeyDataTls; EimSupportedProtocol_t *eimSupportedProtocol /* OPTIONAL */; SubjectKeyIdentifier_t *euiccCiPKId /* OPTIONAL */; + NULL_t *indirectProfileDownload /* OPTIONAL */; /* * This type is extensible, * possible extensions are below. @@ -91,7 +93,7 @@ /* Implementation */ extern asn_TYPE_descriptor_t asn_DEF_EimConfigurationData; extern asn_SEQUENCE_specifics_t asn_SPC_EimConfigurationData_specs_1; -extern asn_TYPE_member_t asn_MBR_EimConfigurationData_1[9]; +extern asn_TYPE_member_t asn_MBR_EimConfigurationData_1[10];
#ifdef __cplusplus } diff --git a/src/ipa/libipa/proc_eim_pkg_retr.c b/src/ipa/libipa/proc_eim_pkg_retr.c index 3fe289c..59b6f99 100644 --- a/src/ipa/libipa/proc_eim_pkg_retr.c +++ b/src/ipa/libipa/proc_eim_pkg_retr.c @@ -28,7 +28,7 @@ #include "proc_euicc_data_req.h" #include "proc_eim_pkg_retr.h"
-static int get_euicc_ci_pkid(struct ipa_context *ctx, struct ipa_buf **pkid) +static int get_euicc_ci_pkid_ipd(struct ipa_context *ctx, struct ipa_buf **pkid, bool *idp) { struct ipa_es10b_eim_cfg_data *eim_cfg_data = NULL; struct EimConfigurationData *eim_cfg_data_item = NULL; @@ -50,6 +50,9 @@ if (eim_cfg_data_item->euiccCiPKId) *pkid = IPA_BUF_FROM_ASN(eim_cfg_data_item->euiccCiPKId);
+ if (eim_cfg_data_item->indirectProfileDownload) + *idp = true; + ipa_es10b_get_eim_cfg_data_free(eim_cfg_data); return 0; error: @@ -62,6 +65,7 @@ int eim_pkg_exec(struct ipa_context *ctx, const struct ipa_esipa_get_eim_pkg_res *get_eim_pkg_res) { struct ipa_buf *allowed_ca_pkid = NULL; + bool indirect_profile_download = false; int rc;
if (get_eim_pkg_res->euicc_package_request) { @@ -107,12 +111,19 @@ goto error; }
- rc = get_euicc_ci_pkid(ctx, &allowed_ca_pkid); + rc = get_euicc_ci_pkid_ipd(ctx, &allowed_ca_pkid, &indirect_profile_download); if (rc < 0) { rc = -EINVAL; goto error; }
+ if (!indirect_profile_download) { + IPA_LOGP(SIPA, LERROR, + "Indirect profile download is not suppoted by eIM, we don't support direct profile download, -- cannot continue!\n"); + rc = -ENOTSUP; + goto error; + } + indirect_prfle_dwnlod_pars.allowed_ca = allowed_ca_pkid; indirect_prfle_dwnlod_pars.tac = ctx->cfg->tac; indirect_prfle_dwnlod_pars.ac =