jolly has uploaded this change for review.

View Change

V1.2: Add size constraints to eimId

The remaining eimId in EuiccPackageResultDataSigned,
EuiccPackageErrorDataSigned, EuiccPackageErrorUnsigned and EimIdInfo
are now limited to 128 characters.

The limit has no impact on the process. Assignments are made from other
eimID of other structures that are also limited to 128.

At some location the eimId is set from 'eim_id' of context structure,
which is received by EimConfigurationData which is also limited to 128.

Reference: SGP.32 Section 2.11.2

Related: SYS#8101
Change-Id: I5a0f52c0aa4851e802909f98d5a5677e596c4d7f
---
M asn1/SGP32Definitions.asn
M src/ipa/libasn/EimIdInfo.c
M src/ipa/libasn/EuiccPackageErrorDataSigned.c
M src/ipa/libasn/EuiccPackageErrorUnsigned.c
M src/ipa/libasn/EuiccPackageResultDataSigned.c
5 files changed, 168 insertions(+), 8 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/onomondo-ipa refs/changes/37/43037/1
diff --git a/asn1/SGP32Definitions.asn b/asn1/SGP32Definitions.asn
index e97b418..bdaedd5 100644
--- a/asn1/SGP32Definitions.asn
+++ b/asn1/SGP32Definitions.asn
@@ -158,7 +158,7 @@
euiccSignEPR [APPLICATION 55] OCTET STRING -- Tag '5F37'
}
EuiccPackageResultDataSigned ::= SEQUENCE { -- #SupportedForPsmoV1.0.0#
- eimId [0] UTF8String,
+ eimId [0] UTF8String (SIZE(1..128)),
counterValue [1] INTEGER,
eimTransactionId[2] TransactionId OPTIONAL,
seqNumber [3] INTEGER,
@@ -191,14 +191,14 @@
euiccSignEPE [APPLICATION 55] OCTET STRING -- Tag '5F37'
}
EuiccPackageErrorDataSigned ::= SEQUENCE {
- eimId [0] UTF8String,
+ eimId [0] UTF8String (SIZE(1..128)),
counterValue [1] INTEGER,
transactionId [2] TransactionId OPTIONAL,
euiccPackageErrorCode EuiccPackageErrorCode
}
EuiccPackageErrorCode ::= INTEGER { invalidEid(3), replayError(4), counterValueOutOfRange(6), sizeOverflow(15), undefinedError(127)}
EuiccPackageErrorUnsigned ::= SEQUENCE {
- eimId [0] UTF8String,
+ eimId [0] UTF8String (SIZE(1..128)),
associationToken [4] INTEGER OPTIONAL
}
ConfigureImmediateEnableResult ::= INTEGER {
@@ -287,7 +287,7 @@
}
}
EimIdInfo ::= SEQUENCE {
- eimId [0] UTF8String,
+ eimId [0] UTF8String (SIZE(1..128)),
eimIdType [4] EimIdType OPTIONAL -- present in case of eimIdTypeOid and eimIdTypeFqdn
}
-- ASN1STOP
diff --git a/src/ipa/libasn/EimIdInfo.c b/src/ipa/libasn/EimIdInfo.c
index d914e95..9dc4d68 100644
--- a/src/ipa/libasn/EimIdInfo.c
+++ b/src/ipa/libasn/EimIdInfo.c
@@ -7,13 +7,53 @@

#include "EimIdInfo.h"

+static int
+memb_eimId_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
+ asn_app_constraint_failed_f *ctfailcb, void *app_key) {
+ const UTF8String_t *st = (const UTF8String_t *)sptr;
+ size_t size;
+
+ if(!sptr) {
+ ASN__CTFAIL(app_key, td, sptr,
+ "%s: value not given (%s:%d)",
+ td->name, __FILE__, __LINE__);
+ return -1;
+ }
+
+ size = UTF8String_length(st);
+ if((ssize_t)size < 0) {
+ ASN__CTFAIL(app_key, td, sptr,
+ "%s: UTF-8: broken encoding (%s:%d)",
+ td->name, __FILE__, __LINE__);
+ return -1;
+ }
+
+ if((size >= 1 && size <= 128)) {
+ /* Constraint check succeeded */
+ return 0;
+ } else {
+ ASN__CTFAIL(app_key, td, sptr,
+ "%s: constraint failed (%s:%d)",
+ td->name, __FILE__, __LINE__);
+ return -1;
+ }
+}
+
+static asn_oer_constraints_t asn_OER_memb_eimId_constr_2 CC_NOTUSED = {
+ { 0, 0 },
+ -1 /* (SIZE(0..MAX)) */};
+static asn_per_constraints_t asn_PER_memb_eimId_constr_2 CC_NOTUSED = {
+ { APC_UNCONSTRAINED, -1, -1, 0, 0 },
+ { APC_UNCONSTRAINED, -1, -1, 0, 0 },
+ 0, 0 /* No PER value map */
+};
asn_TYPE_member_t asn_MBR_EimIdInfo_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct EimIdInfo, eimId),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_UTF8String,
0,
- { 0, 0, 0 },
+ { &asn_OER_memb_eimId_constr_2, &asn_PER_memb_eimId_constr_2, memb_eimId_constraint_1 },
0, 0, /* No default value */
"eimId"
},
diff --git a/src/ipa/libasn/EuiccPackageErrorDataSigned.c b/src/ipa/libasn/EuiccPackageErrorDataSigned.c
index 6f69d84..59a6925 100644
--- a/src/ipa/libasn/EuiccPackageErrorDataSigned.c
+++ b/src/ipa/libasn/EuiccPackageErrorDataSigned.c
@@ -7,13 +7,53 @@

#include "EuiccPackageErrorDataSigned.h"

+static int
+memb_eimId_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
+ asn_app_constraint_failed_f *ctfailcb, void *app_key) {
+ const UTF8String_t *st = (const UTF8String_t *)sptr;
+ size_t size;
+
+ if(!sptr) {
+ ASN__CTFAIL(app_key, td, sptr,
+ "%s: value not given (%s:%d)",
+ td->name, __FILE__, __LINE__);
+ return -1;
+ }
+
+ size = UTF8String_length(st);
+ if((ssize_t)size < 0) {
+ ASN__CTFAIL(app_key, td, sptr,
+ "%s: UTF-8: broken encoding (%s:%d)",
+ td->name, __FILE__, __LINE__);
+ return -1;
+ }
+
+ if((size >= 1 && size <= 128)) {
+ /* Constraint check succeeded */
+ return 0;
+ } else {
+ ASN__CTFAIL(app_key, td, sptr,
+ "%s: constraint failed (%s:%d)",
+ td->name, __FILE__, __LINE__);
+ return -1;
+ }
+}
+
+static asn_oer_constraints_t asn_OER_memb_eimId_constr_2 CC_NOTUSED = {
+ { 0, 0 },
+ -1 /* (SIZE(0..MAX)) */};
+static asn_per_constraints_t asn_PER_memb_eimId_constr_2 CC_NOTUSED = {
+ { APC_UNCONSTRAINED, -1, -1, 0, 0 },
+ { APC_UNCONSTRAINED, -1, -1, 0, 0 },
+ 0, 0 /* No PER value map */
+};
asn_TYPE_member_t asn_MBR_EuiccPackageErrorDataSigned_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct EuiccPackageErrorDataSigned, eimId),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_UTF8String,
0,
- { 0, 0, 0 },
+ { &asn_OER_memb_eimId_constr_2, &asn_PER_memb_eimId_constr_2, memb_eimId_constraint_1 },
0, 0, /* No default value */
"eimId"
},
diff --git a/src/ipa/libasn/EuiccPackageErrorUnsigned.c b/src/ipa/libasn/EuiccPackageErrorUnsigned.c
index e42a5cf..bf168e3 100644
--- a/src/ipa/libasn/EuiccPackageErrorUnsigned.c
+++ b/src/ipa/libasn/EuiccPackageErrorUnsigned.c
@@ -7,13 +7,53 @@

#include "EuiccPackageErrorUnsigned.h"

+static int
+memb_eimId_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
+ asn_app_constraint_failed_f *ctfailcb, void *app_key) {
+ const UTF8String_t *st = (const UTF8String_t *)sptr;
+ size_t size;
+
+ if(!sptr) {
+ ASN__CTFAIL(app_key, td, sptr,
+ "%s: value not given (%s:%d)",
+ td->name, __FILE__, __LINE__);
+ return -1;
+ }
+
+ size = UTF8String_length(st);
+ if((ssize_t)size < 0) {
+ ASN__CTFAIL(app_key, td, sptr,
+ "%s: UTF-8: broken encoding (%s:%d)",
+ td->name, __FILE__, __LINE__);
+ return -1;
+ }
+
+ if((size >= 1 && size <= 128)) {
+ /* Constraint check succeeded */
+ return 0;
+ } else {
+ ASN__CTFAIL(app_key, td, sptr,
+ "%s: constraint failed (%s:%d)",
+ td->name, __FILE__, __LINE__);
+ return -1;
+ }
+}
+
+static asn_oer_constraints_t asn_OER_memb_eimId_constr_2 CC_NOTUSED = {
+ { 0, 0 },
+ -1 /* (SIZE(0..MAX)) */};
+static asn_per_constraints_t asn_PER_memb_eimId_constr_2 CC_NOTUSED = {
+ { APC_UNCONSTRAINED, -1, -1, 0, 0 },
+ { APC_UNCONSTRAINED, -1, -1, 0, 0 },
+ 0, 0 /* No PER value map */
+};
asn_TYPE_member_t asn_MBR_EuiccPackageErrorUnsigned_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct EuiccPackageErrorUnsigned, eimId),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_UTF8String,
0,
- { 0, 0, 0 },
+ { &asn_OER_memb_eimId_constr_2, &asn_PER_memb_eimId_constr_2, memb_eimId_constraint_1 },
0, 0, /* No default value */
"eimId"
},
diff --git a/src/ipa/libasn/EuiccPackageResultDataSigned.c b/src/ipa/libasn/EuiccPackageResultDataSigned.c
index f1e6b3a..b155424 100644
--- a/src/ipa/libasn/EuiccPackageResultDataSigned.c
+++ b/src/ipa/libasn/EuiccPackageResultDataSigned.c
@@ -7,6 +7,46 @@

#include "EuiccPackageResultDataSigned.h"

+static int
+memb_eimId_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
+ asn_app_constraint_failed_f *ctfailcb, void *app_key) {
+ const UTF8String_t *st = (const UTF8String_t *)sptr;
+ size_t size;
+
+ if(!sptr) {
+ ASN__CTFAIL(app_key, td, sptr,
+ "%s: value not given (%s:%d)",
+ td->name, __FILE__, __LINE__);
+ return -1;
+ }
+
+ size = UTF8String_length(st);
+ if((ssize_t)size < 0) {
+ ASN__CTFAIL(app_key, td, sptr,
+ "%s: UTF-8: broken encoding (%s:%d)",
+ td->name, __FILE__, __LINE__);
+ return -1;
+ }
+
+ if((size >= 1 && size <= 128)) {
+ /* Constraint check succeeded */
+ return 0;
+ } else {
+ ASN__CTFAIL(app_key, td, sptr,
+ "%s: constraint failed (%s:%d)",
+ td->name, __FILE__, __LINE__);
+ return -1;
+ }
+}
+
+static asn_oer_constraints_t asn_OER_memb_eimId_constr_2 CC_NOTUSED = {
+ { 0, 0 },
+ -1 /* (SIZE(0..MAX)) */};
+static asn_per_constraints_t asn_PER_memb_eimId_constr_2 CC_NOTUSED = {
+ { APC_UNCONSTRAINED, -1, -1, 0, 0 },
+ { APC_UNCONSTRAINED, -1, -1, 0, 0 },
+ 0, 0 /* No PER value map */
+};
static asn_TYPE_member_t asn_MBR_euiccResult_6[] = {
{ ATF_POINTER, 0, 0,
-1 /* Ambiguous tag (CHOICE?) */,
@@ -49,7 +89,7 @@
-1, /* IMPLICIT tag at current level */
&asn_DEF_UTF8String,
0,
- { 0, 0, 0 },
+ { &asn_OER_memb_eimId_constr_2, &asn_PER_memb_eimId_constr_2, memb_eimId_constraint_1 },
0, 0, /* No default value */
"eimId"
},

To view, visit change 43037. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: onomondo-ipa
Gerrit-Branch: master
Gerrit-Change-Id: I5a0f52c0aa4851e802909f98d5a5677e596c4d7f
Gerrit-Change-Number: 43037
Gerrit-PatchSet: 1
Gerrit-Owner: jolly <andreas@eversberg.eu>