LTE_CryptoFunctions.ttcn: Immediate termination upon failure
Change-Id: I09170c17c5cbb552a8aeef31b4b8fa5c89a00887
diff --git a/mme/LTE_CryptoFunctions.ttcn b/mme/LTE_CryptoFunctions.ttcn
index 687caab..dee0f22 100644
--- a/mme/LTE_CryptoFunctions.ttcn
+++ b/mme/LTE_CryptoFunctions.ttcn
@@ -12,6 +12,7 @@
module LTE_CryptoFunctions {
import from General_Types all;
+import from Misc_Helpers all;
import from S1AP_Types all;
import from S1AP_PDU_Descriptions all;
@@ -53,8 +54,8 @@
return f_snow_3g_f9(k_nas_int, seq_nr, bearer, is_downlink, data);
}
case else {
- setverdict(fail, "Unsupported EIA: ", alg);
- mtc.stop;
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Unsupported EIA: ", alg));
+ return '00000000'O; /* never reached */
}
}
}
@@ -67,8 +68,7 @@
f_snow_3g_f8(k_nas_enc, count, bearer, is_downlink, data);
}
case else {
- setverdict(fail, "Unsupported EEA: ", alg);
- mtc.stop;
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Unsupported EEA: ", alg));
}
}
}
@@ -168,19 +168,19 @@
nus.rx_count := 0;
nus.alg_int := NAS_ALG_IP_EIA1; /* FIXME: from decoded inner message! */
if (not f_nas_check_ip(nus, secp_nas)) {
- mtc.stop;
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "f_nas_check_ip() failed");
}
return dec_PDU_NAS_EPS(secp_nas.nAS_Message);
}
case ('0001'B) { /* IP only */
if (not f_nas_check_ip(nus, secp_nas)) {
- mtc.stop;
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "f_nas_check_ip() failed");
}
return dec_PDU_NAS_EPS(secp_nas.nAS_Message);
}
case ('0010'B) { /* IP + ciphered */
if (not f_nas_check_ip(nus, secp_nas)) {
- mtc.stop;
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "f_nas_check_ip() failed");
}
f_nas_encrypt(nus.alg_enc, nus.k_nas_enc, nus.rx_count, 0,
f_rx_is_downlink(nus), secp_nas.nAS_Message);
@@ -189,7 +189,7 @@
case ('0100'B) { /* IP + ciphered; new EPS security context */
nus.rx_count := 0;
if (not f_nas_check_ip(nus, secp_nas)) {
- mtc.stop;
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "f_nas_check_ip() failed");
}
f_nas_encrypt(nus.alg_enc, nus.k_nas_enc, nus.rx_count, 0,
f_rx_is_downlink(nus), secp_nas.nAS_Message);
@@ -198,8 +198,8 @@
//case ('0101'B) { /* IP + partially ciphered */ }
//case ('1100'B) { /* Service Request Message */ }
case else {
- setverdict(fail, "Implement SecHdrType for ", secp_nas);
- mtc.stop;
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Implement SecHdrType for ", secp_nas));
+ mtc.stop; /* make compiler happy about not returning. */
}
}
}
@@ -218,8 +218,8 @@
} else if (encrypt == true and authenticate == true and new_ctx == false) {
return '0010'B;
} else {
- setverdict(fail, "invalid sec_hdr conditions");
- mtc.stop;
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Invalid sec_hdr conditions");
+ return '0000'B; /* never reached, make compiler happy */
}
}