LTE_CryptoFunctions.ttcn: Immediate termination upon failure
Change-Id: I09170c17c5cbb552a8aeef31b4b8fa5c89a00887
This commit is contained in:
parent
17953b8347
commit
4976217518
|
@ -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 @@ function f_nas_mac_calc(NAS_ALG_INT alg, octetstring k_nas_int, integer seq_nr,
|
|||
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 @@ function f_nas_encrypt(NAS_ALG_ENC alg, octetstring k_nas_enc, integer count,
|
|||
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 @@ function f_nas_try_decaps(inout NAS_UE_State nus, PDU_NAS_EPS nas) return PDU_NA
|
|||
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 @@ function f_nas_try_decaps(inout NAS_UE_State nus, PDU_NAS_EPS nas) return PDU_NA
|
|||
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 @@ function f_nas_try_decaps(inout NAS_UE_State nus, PDU_NAS_EPS nas) return PDU_NA
|
|||
//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 @@ return BIT4
|
|||
} 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 */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue