ranap_msg_factory: CipheringInformation is optional in SecurityModeCommand

This commit is contained in:
Harald Welte 2015-12-28 13:13:47 +01:00
parent c371a42938
commit 2cf0d8f1eb
1 changed files with 3 additions and 3 deletions

View File

@ -218,8 +218,6 @@ struct msgb *ranap_new_msg_sec_mod_cmd(const uint8_t *ik, const uint8_t *ck)
memset(&ies, 0, sizeof(ies));
memset(&out, 0, sizeof(out));
ies.presenceMask = SECURITYMODECOMMANDIES_RANAP_ENCRYPTIONINFORMATION_PRESENT;
for (i = 0; i < ARRAY_SIZE(ip_alg); i++) {
/* needs to be dynamically allocated, as
* SET_OF_free() will call FREEMEM() on it */
@ -231,6 +229,7 @@ struct msgb *ranap_new_msg_sec_mod_cmd(const uint8_t *ik, const uint8_t *ck)
BIT_STRING_fromBuf(&ies.integrityProtectionInformation.key, ik, 16*8);
if (ck) {
ies.presenceMask = SECURITYMODECOMMANDIES_RANAP_ENCRYPTIONINFORMATION_PRESENT;
for (i = 0; i < ARRAY_SIZE(ip_alg); i++) {
/* needs to be dynamically allocated, as
* SET_OF_free() will call FREEMEM() on it */
@ -248,7 +247,8 @@ struct msgb *ranap_new_msg_sec_mod_cmd(const uint8_t *ik, const uint8_t *ck)
/* release dynamic allocations attached to ies */
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_RANAP_IntegrityProtectionInformation, &ies.integrityProtectionInformation);
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_RANAP_EncryptionInformation, &ies.encryptionInformation);
if (ck)
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_RANAP_EncryptionInformation, &ies.encryptionInformation);
/* out -> msg */
msg = ranap_generate_initiating_message(RANAP_ProcedureCode_id_SecurityModeControl,