[S] Change in osmo-ttcn3-hacks[master]: SGP23_Constants: use a reasonable default for sm_dp_oid
dexter has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43930?usp=email ) Change subject: SGP23_Constants: use a reasonable default for sm_dp_oid ...................................................................... SGP23_Constants: use a reasonable default for sm_dp_oid The function f_SGP23_ACTIVATION_CODE_2 takes a paramter sm_dp_oid, which currently has no reasonable default value. Let's use the default as defined in SGP.23. Since the Activation Code requires the SM-DP+ OID in its human readable form, this patch also adds a converter function that converts an objid into a charstring. Change-Id: Iadf45954f18685c96d46b7df37c103eac3654332 Related: SYS#8203 --- M library/Osmocom_Types.ttcn M library/euicc/SGP23_Constants.ttcn 2 files changed, 22 insertions(+), 1 deletion(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved jolly: Looks good to me, but someone else must approve diff --git a/library/Osmocom_Types.ttcn b/library/Osmocom_Types.ttcn index 6fbcb39..cbeed02 100644 --- a/library/Osmocom_Types.ttcn +++ b/library/Osmocom_Types.ttcn @@ -11,6 +11,8 @@ module Osmocom_Types { import from General_Types all; +import from TCCConversion_Functions all; //f_strstr() +import from Misc_Helpers all; //f_str_replace() type integer uint8_t (0..255) with { variant "unsigned 8 bit" }; type integer uint16_t (0..65535) with { variant "unsigned 16 bit" }; @@ -460,4 +462,21 @@ return bits; } +/* Convert an ASN.1 object identifier to a printable string (e.g. "2.999.10") */ +function f_objid2str(objid oid) return charstring { + var charstring oid_str := log2str(oid); + var integer left := f_strstr(oid_str, "{ ", 0); + var integer right := f_strstr(oid_str, " }", 0); + if (left < 0) { + setverdict(fail, "invalid OID"); + return ""; + } + if (right < 0) { + setverdict(fail, "invalid OID"); + return ""; + } + left := left + 2; + return f_str_replace(substr(oid_str, left, right - left), " ", "."); +} + } with { encode "RAW"; variant "FIELDORDER(msb)" } diff --git a/library/euicc/SGP23_Constants.ttcn b/library/euicc/SGP23_Constants.ttcn index a1695ad..480f122 100644 --- a/library/euicc/SGP23_Constants.ttcn +++ b/library/euicc/SGP23_Constants.ttcn @@ -17,6 +17,8 @@ module SGP23_Constants { +import from Osmocom_Types all; + /* Generic Constants (see also: SGP.23, annex A, section A1) */ const octetstring SGP23_EID1 := '89049032123451234512345678901235'O; const octetstring SGP23_EID2 := '89049032112341234012345678901375'O; @@ -30,7 +32,7 @@ } function f_SGP23_ACTIVATION_CODE_2(charstring test_dp_address := SGP23_TEST_DP_ADDRESS1, charstring matching_id := SGP23_MATCHING_ID_2, - charstring sm_dp_oid := "foo") return charstring { + charstring sm_dp_oid := f_objid2str(SGP23_S_SM_DPp_OID)) return charstring { return "1$" & test_dp_address & "$" & matching_id & "$" & sm_dp_oid; } function f_SGP23_ACTIVATION_CODE_3(charstring test_dp_address := SGP23_TEST_DP_ADDRESS1, -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43930?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: Iadf45954f18685c96d46b7df37c103eac3654332 Gerrit-Change-Number: 43930 Gerrit-PatchSet: 5 Gerrit-Owner: dexter <pmaier@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier@sysmocom.de> Gerrit-Reviewer: jolly <andreas@eversberg.eu> Gerrit-Reviewer: laforge <laforge@osmocom.org> Gerrit-Reviewer: pespin <pespin@sysmocom.de>
participants (1)
-
dexter