jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/onomondo-ipa/+/43061?usp=email )
Change subject: V1.2: Add AuthenticateResponseOk and EuiccSigned1 ......................................................................
V1.2: Add AuthenticateResponseOk and EuiccSigned1
Both structures are taken from SGP.22 but do not change. The IPA process uses these new structures, because the may be expanded in the future.
Reference: SGP.23 Section 5.14.3
Related: SYS#8101 Change-Id: I501247132de30618a2b1ace44c7c3772ab42eb09 --- M asn1/SGP32Definitions.asn M src/ipa/libasn/CMakeLists.txt A src/ipa/libasn/SGP32-AuthenticateResponseOk.c A src/ipa/libasn/SGP32-AuthenticateResponseOk.h M src/ipa/libasn/SGP32-AuthenticateServerResponse.c M src/ipa/libasn/SGP32-AuthenticateServerResponse.h A src/ipa/libasn/SGP32-EuiccSigned1.c A src/ipa/libasn/SGP32-EuiccSigned1.h M src/ipa/libipa/es10b_auth_serv.c M src/ipa/libipa/es10b_auth_serv.h 10 files changed, 301 insertions(+), 13 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/onomondo-ipa refs/changes/61/43061/1
diff --git a/asn1/SGP32Definitions.asn b/asn1/SGP32Definitions.asn index 83fcf91..0e210f0 100644 --- a/asn1/SGP32Definitions.asn +++ b/asn1/SGP32Definitions.asn @@ -771,8 +771,21 @@
-- Section 5.14.3 -- ASN1START +SGP32-EuiccSigned1 ::= SEQUENCE { + transactionId [0] TransactionId, + serverAddress [3] UTF8String, + serverChallenge [4] Octet16, + euiccInfo2 [34] EUICCInfo2, + ctxParams1 CtxParams1 -- The RSP Server Challenge +} +SGP32-AuthenticateResponseOk ::= SEQUENCE { + euiccSigned1 SGP32-EuiccSigned1, -- Signed information + euiccSignature1 [APPLICATION 55] OCTET STRING, --EUICC_Sign1, tag 5F37 + euiccCertificate Certificate, -- eUICC Certificate (CERT.EUICC.ECDSA) signed by the EUM + eumCertificate Certificate -- EUM Certificate (CERT.EUM.ECDSA) signed by the requested CI +} SGP32-AuthenticateServerResponse ::= [56] CHOICE { -- Tag 'BF38' - authenticateResponseOk AuthenticateResponseOk, + authenticateResponseOk SGP32-AuthenticateResponseOk, authenticateResponseError AuthenticateResponseError, compactAuthenticateResponseOk CompactAuthenticateResponseOk } diff --git a/src/ipa/libasn/CMakeLists.txt b/src/ipa/libasn/CMakeLists.txt index 3ab0559..a767352 100644 --- a/src/ipa/libasn/CMakeLists.txt +++ b/src/ipa/libasn/CMakeLists.txt @@ -840,6 +840,8 @@ SetNicknameResponse.h SGP32-AuthenticateClientRequest.c SGP32-AuthenticateClientRequest.h +SGP32-AuthenticateResponseOk.c +SGP32-AuthenticateResponseOk.h SGP32-AuthenticateServerResponse.c SGP32-AuthenticateServerResponse.h SGP32-CancelSessionOk.c @@ -852,6 +854,8 @@ SGP32-EuiccMemoryResetRequest.h SGP32-EuiccMemoryResetResponse.c SGP32-EuiccMemoryResetResponse.h +SGP32-EuiccSigned1.c +SGP32-EuiccSigned1.h SGP32-PendingNotification.c SGP32-PendingNotification.h SGP32-PrepareDownloadResponse.c diff --git a/src/ipa/libasn/SGP32-AuthenticateResponseOk.c b/src/ipa/libasn/SGP32-AuthenticateResponseOk.c new file mode 100644 index 0000000..abc2eeb --- /dev/null +++ b/src/ipa/libasn/SGP32-AuthenticateResponseOk.c @@ -0,0 +1,80 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "SGP32Definitions" + * found in "../../../asn1/SGP32Definitions.asn" + * `asn1c -fcompound-names -no-gen-example` + */ + +#include "SGP32-AuthenticateResponseOk.h" + +asn_TYPE_member_t asn_MBR_SGP32_AuthenticateResponseOk_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct SGP32_AuthenticateResponseOk, euiccSigned1), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_SGP32_EuiccSigned1, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "euiccSigned1" + }, + { ATF_NOFLAGS, 0, offsetof(struct SGP32_AuthenticateResponseOk, euiccSignature1), + (ASN_TAG_CLASS_APPLICATION | (55 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_OCTET_STRING, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "euiccSignature1" + }, + { ATF_NOFLAGS, 0, offsetof(struct SGP32_AuthenticateResponseOk, euiccCertificate), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_Certificate, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "euiccCertificate" + }, + { ATF_NOFLAGS, 0, offsetof(struct SGP32_AuthenticateResponseOk, eumCertificate), + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), + 0, + &asn_DEF_Certificate, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "eumCertificate" + }, +}; +static const ber_tlv_tag_t asn_DEF_SGP32_AuthenticateResponseOk_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_SGP32_AuthenticateResponseOk_tag2el_1[] = { + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 2 }, /* euiccSigned1 */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 2, -1, 1 }, /* euiccCertificate */ + { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 3, -2, 0 }, /* eumCertificate */ + { (ASN_TAG_CLASS_APPLICATION | (55 << 2)), 1, 0, 0 } /* euiccSignature1 */ +}; +asn_SEQUENCE_specifics_t asn_SPC_SGP32_AuthenticateResponseOk_specs_1 = { + sizeof(struct SGP32_AuthenticateResponseOk), + offsetof(struct SGP32_AuthenticateResponseOk, _asn_ctx), + asn_MAP_SGP32_AuthenticateResponseOk_tag2el_1, + 4, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + 4, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_SGP32_AuthenticateResponseOk = { + "SGP32-AuthenticateResponseOk", + "SGP32-AuthenticateResponseOk", + &asn_OP_SEQUENCE, + asn_DEF_SGP32_AuthenticateResponseOk_tags_1, + sizeof(asn_DEF_SGP32_AuthenticateResponseOk_tags_1) + /sizeof(asn_DEF_SGP32_AuthenticateResponseOk_tags_1[0]), /* 1 */ + asn_DEF_SGP32_AuthenticateResponseOk_tags_1, /* Same as above */ + sizeof(asn_DEF_SGP32_AuthenticateResponseOk_tags_1) + /sizeof(asn_DEF_SGP32_AuthenticateResponseOk_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_SGP32_AuthenticateResponseOk_1, + 4, /* Elements count */ + &asn_SPC_SGP32_AuthenticateResponseOk_specs_1 /* Additional specs */ +}; + diff --git a/src/ipa/libasn/SGP32-AuthenticateResponseOk.h b/src/ipa/libasn/SGP32-AuthenticateResponseOk.h new file mode 100644 index 0000000..a8a4d41 --- /dev/null +++ b/src/ipa/libasn/SGP32-AuthenticateResponseOk.h @@ -0,0 +1,49 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "SGP32Definitions" + * found in "../../../asn1/SGP32Definitions.asn" + * `asn1c -fcompound-names -no-gen-example` + */ + +#ifndef _SGP32_AuthenticateResponseOk_H_ +#define _SGP32_AuthenticateResponseOk_H_ + + +#include <asn_application.h> + +/* Including external dependencies */ +#include "SGP32-EuiccSigned1.h" +#include <OCTET_STRING.h> +#include "Certificate.h" +#include <constr_SEQUENCE.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* SGP32-AuthenticateResponseOk */ +typedef struct SGP32_AuthenticateResponseOk { + SGP32_EuiccSigned1_t euiccSigned1; + OCTET_STRING_t euiccSignature1; + Certificate_t euiccCertificate; + Certificate_t eumCertificate; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SGP32_AuthenticateResponseOk_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SGP32_AuthenticateResponseOk; +extern asn_SEQUENCE_specifics_t asn_SPC_SGP32_AuthenticateResponseOk_specs_1; +extern asn_TYPE_member_t asn_MBR_SGP32_AuthenticateResponseOk_1[4]; + +#ifdef __cplusplus +} +#endif + +#endif /* _SGP32_AuthenticateResponseOk_H_ */ +#include <asn_internal.h> diff --git a/src/ipa/libasn/SGP32-AuthenticateServerResponse.c b/src/ipa/libasn/SGP32-AuthenticateServerResponse.c index 2162c0c..0dccd91 100644 --- a/src/ipa/libasn/SGP32-AuthenticateServerResponse.c +++ b/src/ipa/libasn/SGP32-AuthenticateServerResponse.c @@ -19,7 +19,7 @@ { ATF_NOFLAGS, 0, offsetof(struct SGP32_AuthenticateServerResponse, choice.authenticateResponseOk), (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ - &asn_DEF_AuthenticateResponseOk, + &asn_DEF_SGP32_AuthenticateResponseOk, 0, { 0, 0, 0 }, 0, 0, /* No default value */ diff --git a/src/ipa/libasn/SGP32-AuthenticateServerResponse.h b/src/ipa/libasn/SGP32-AuthenticateServerResponse.h index 7fef589..ffd0ba3 100644 --- a/src/ipa/libasn/SGP32-AuthenticateServerResponse.h +++ b/src/ipa/libasn/SGP32-AuthenticateServerResponse.h @@ -12,7 +12,7 @@ #include <asn_application.h>
/* Including external dependencies */ -#include "AuthenticateResponseOk.h" +#include "SGP32-AuthenticateResponseOk.h" #include "AuthenticateResponseError.h" #include "CompactAuthenticateResponseOk.h" #include <constr_CHOICE.h> @@ -35,7 +35,7 @@ typedef struct SGP32_AuthenticateServerResponse { SGP32_AuthenticateServerResponse_PR present; union SGP32_AuthenticateServerResponse_u { - AuthenticateResponseOk_t authenticateResponseOk; + SGP32_AuthenticateResponseOk_t authenticateResponseOk; AuthenticateResponseError_t authenticateResponseError; CompactAuthenticateResponseOk_t compactAuthenticateResponseOk; /* diff --git a/src/ipa/libasn/SGP32-EuiccSigned1.c b/src/ipa/libasn/SGP32-EuiccSigned1.c new file mode 100644 index 0000000..1f47d61 --- /dev/null +++ b/src/ipa/libasn/SGP32-EuiccSigned1.c @@ -0,0 +1,90 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "SGP32Definitions" + * found in "../../../asn1/SGP32Definitions.asn" + * `asn1c -fcompound-names -no-gen-example` + */ + +#include "SGP32-EuiccSigned1.h" + +asn_TYPE_member_t asn_MBR_SGP32_EuiccSigned1_1[] = { + { ATF_NOFLAGS, 0, offsetof(struct SGP32_EuiccSigned1, transactionId), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_TransactionId, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "transactionId" + }, + { ATF_NOFLAGS, 0, offsetof(struct SGP32_EuiccSigned1, serverAddress), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_UTF8String, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "serverAddress" + }, + { ATF_NOFLAGS, 0, offsetof(struct SGP32_EuiccSigned1, serverChallenge), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_Octet16, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "serverChallenge" + }, + { ATF_NOFLAGS, 0, offsetof(struct SGP32_EuiccSigned1, euiccInfo2), + (ASN_TAG_CLASS_CONTEXT | (34 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_EUICCInfo2, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "euiccInfo2" + }, + { ATF_NOFLAGS, 0, offsetof(struct SGP32_EuiccSigned1, ctxParams1), + -1 /* Ambiguous tag (CHOICE?) */, + 0, + &asn_DEF_CtxParams1, + 0, + { 0, 0, 0 }, + 0, 0, /* No default value */ + "ctxParams1" + }, +}; +static const ber_tlv_tag_t asn_DEF_SGP32_EuiccSigned1_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) +}; +static const asn_TYPE_tag2member_t asn_MAP_SGP32_EuiccSigned1_tag2el_1[] = { + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 1 }, /* transactionId */ + { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 4, -1, 0 }, /* ctxParamsForCommonAuthentication */ + { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 1, 0, 0 }, /* serverAddress */ + { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 2, 0, 0 }, /* serverChallenge */ + { (ASN_TAG_CLASS_CONTEXT | (34 << 2)), 3, 0, 0 } /* euiccInfo2 */ +}; +asn_SEQUENCE_specifics_t asn_SPC_SGP32_EuiccSigned1_specs_1 = { + sizeof(struct SGP32_EuiccSigned1), + offsetof(struct SGP32_EuiccSigned1, _asn_ctx), + asn_MAP_SGP32_EuiccSigned1_tag2el_1, + 5, /* Count of tags in the map */ + 0, 0, 0, /* Optional elements (not needed) */ + 5, /* First extension addition */ +}; +asn_TYPE_descriptor_t asn_DEF_SGP32_EuiccSigned1 = { + "SGP32-EuiccSigned1", + "SGP32-EuiccSigned1", + &asn_OP_SEQUENCE, + asn_DEF_SGP32_EuiccSigned1_tags_1, + sizeof(asn_DEF_SGP32_EuiccSigned1_tags_1) + /sizeof(asn_DEF_SGP32_EuiccSigned1_tags_1[0]), /* 1 */ + asn_DEF_SGP32_EuiccSigned1_tags_1, /* Same as above */ + sizeof(asn_DEF_SGP32_EuiccSigned1_tags_1) + /sizeof(asn_DEF_SGP32_EuiccSigned1_tags_1[0]), /* 1 */ + { 0, 0, SEQUENCE_constraint }, + asn_MBR_SGP32_EuiccSigned1_1, + 5, /* Elements count */ + &asn_SPC_SGP32_EuiccSigned1_specs_1 /* Additional specs */ +}; + diff --git a/src/ipa/libasn/SGP32-EuiccSigned1.h b/src/ipa/libasn/SGP32-EuiccSigned1.h new file mode 100644 index 0000000..0d8f7cb --- /dev/null +++ b/src/ipa/libasn/SGP32-EuiccSigned1.h @@ -0,0 +1,52 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "SGP32Definitions" + * found in "../../../asn1/SGP32Definitions.asn" + * `asn1c -fcompound-names -no-gen-example` + */ + +#ifndef _SGP32_EuiccSigned1_H_ +#define _SGP32_EuiccSigned1_H_ + + +#include <asn_application.h> + +/* Including external dependencies */ +#include "TransactionId.h" +#include <UTF8String.h> +#include "Octet16.h" +#include "EUICCInfo2.h" +#include "CtxParams1.h" +#include <constr_SEQUENCE.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* SGP32-EuiccSigned1 */ +typedef struct SGP32_EuiccSigned1 { + TransactionId_t transactionId; + UTF8String_t serverAddress; + Octet16_t serverChallenge; + EUICCInfo2_t euiccInfo2; + CtxParams1_t ctxParams1; + /* + * This type is extensible, + * possible extensions are below. + */ + + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; +} SGP32_EuiccSigned1_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_SGP32_EuiccSigned1; +extern asn_SEQUENCE_specifics_t asn_SPC_SGP32_EuiccSigned1_specs_1; +extern asn_TYPE_member_t asn_MBR_SGP32_EuiccSigned1_1[5]; + +#ifdef __cplusplus +} +#endif + +#endif /* _SGP32_EuiccSigned1_H_ */ +#include <asn_internal.h> diff --git a/src/ipa/libipa/es10b_auth_serv.c b/src/ipa/libipa/es10b_auth_serv.c index a6d7c77..681f158 100644 --- a/src/ipa/libipa/es10b_auth_serv.c +++ b/src/ipa/libipa/es10b_auth_serv.c @@ -36,17 +36,17 @@
static int dec_auth_serv_res(struct ipa_es10b_auth_serv_res *res, const struct ipa_buf *es10b_res) { - struct AuthenticateServerResponse *asn = NULL; + struct SGP32_AuthenticateServerResponse *asn = NULL;
- asn = ipa_es10x_res_dec(&asn_DEF_AuthenticateServerResponse, es10b_res, "AuthenticateServer"); + asn = ipa_es10x_res_dec(&asn_DEF_SGP32_AuthenticateServerResponse, es10b_res, "AuthenticateServer"); if (!asn) return -EINVAL;
switch (asn->present) { - case AuthenticateServerResponse_PR_authenticateResponseOk: + case SGP32_AuthenticateServerResponse_PR_authenticateResponseOk: res->auth_serv_ok = &asn->choice.authenticateResponseOk; break; - case AuthenticateServerResponse_PR_authenticateResponseError: + case SGP32_AuthenticateServerResponse_PR_authenticateResponseError: res->auth_serv_err = asn->choice.authenticateResponseError.authenticateErrorCode; IPA_LOGP_ES10X("AuthenticateServer", LERROR, "function failed with error code %ld=%s!\n", res->auth_serv_err, ipa_str_from_num(error_code_strings, res->auth_serv_err, @@ -102,5 +102,5 @@ * \param[in] res pointer to function result. */ void ipa_es10b_auth_serv_res_free(struct ipa_es10b_auth_serv_res *res) { - IPA_ES10X_RES_FREE(asn_DEF_AuthenticateServerResponse, res); + IPA_ES10X_RES_FREE(asn_DEF_SGP32_AuthenticateServerResponse, res); } diff --git a/src/ipa/libipa/es10b_auth_serv.h b/src/ipa/libipa/es10b_auth_serv.h index 9e8eef1..2f005e3 100644 --- a/src/ipa/libipa/es10b_auth_serv.h +++ b/src/ipa/libipa/es10b_auth_serv.h @@ -7,8 +7,8 @@ #pragma once
#include <AuthenticateServerRequest.h> -#include <AuthenticateServerResponse.h> -#include <AuthenticateResponseOk.h> +#include <SGP32-AuthenticateServerResponse.h> +#include <SGP32-AuthenticateResponseOk.h> struct ipa_context;
/* GSMA SGP.22, section 5.7.13 */ @@ -17,8 +17,8 @@ };
struct ipa_es10b_auth_serv_res { - struct AuthenticateServerResponse *res; - struct AuthenticateResponseOk *auth_serv_ok; + struct SGP32_AuthenticateServerResponse *res; + struct SGP32_AuthenticateResponseOk *auth_serv_ok; long auth_serv_err; };