ranap_msg_factory: CipheringInformation is optional in SecurityModeCommand
diff --git a/src/ranap_msg_factory.c b/src/ranap_msg_factory.c
index 41c4fbe..143c956 100644
--- a/src/ranap_msg_factory.c
+++ b/src/ranap_msg_factory.c
@@ -218,8 +218,6 @@
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 @@
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 @@
/* 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,