pespin submitted this change.

View Change

Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve fixeria: Looks good to me, approved
NG_NAS: Rename security_Protected_Nas_Message templates to differentiate UL and DL

Change-Id: Idaf92f7d462ea27deb552ea7c726120180f57a93
---
M 5gc/ConnHdlr.ttcn
M library/NGAP_Emulation.ttcn
M library/NG_CryptoFunctions.ttcn
M library/NG_NAS_Osmo_Templates.ttcn
4 files changed, 56 insertions(+), 23 deletions(-)

diff --git a/5gc/ConnHdlr.ttcn b/5gc/ConnHdlr.ttcn
index 7f986bd..fd38cd6 100644
--- a/5gc/ConnHdlr.ttcn
+++ b/5gc/ConnHdlr.ttcn
@@ -893,11 +893,11 @@
nus.tx_count,
bit2int(tsc_NG_RegResult_3GPP),
false, seq_nr & nas_pdu);
- nas_out := valueof(cs_NG_SECURITY_PROTECTED_NAS_MESSAGE(tsc_EPD_GMM,
- sec_hdr_t,
- mac,
- seq_nr,
- nas_pdu));
+ nas_out := valueof(cs_NG_SECURITY_PROTECTED_NAS_MESSAGE_UL(tsc_EPD_GMM,
+ sec_hdr_t,
+ mac,
+ seq_nr,
+ nas_pdu));
nas_pdu := enc_NG_NAS_UL_Message_Type(valueof(nas_out));

f_ngap_set_nus(g_pars.ue_pars.ran_id, nus);
diff --git a/library/NGAP_Emulation.ttcn b/library/NGAP_Emulation.ttcn
index ba2b7d2..7c9f861 100644
--- a/library/NGAP_Emulation.ttcn
+++ b/library/NGAP_Emulation.ttcn
@@ -654,7 +654,7 @@
if (isvalue(nas_enc)) {
if (g_pars.role == NG_NAS_ROLE_UE) {
var NG_NAS_DL_Message_Type dl_nas := dec_NG_NAS_DL_Message_Type(valueof(nas_enc));
- if (match(dl_nas, cr_NG_SECURITY_PROTECTED_NAS_MESSAGE)) {
+ if (match(dl_nas, cr_NG_SECURITY_PROTECTED_NAS_MESSAGE_DL)) {
dl_nas := f_NG_NAS_try_decaps_dl(NGapAssociationTable[assoc_id].nus, dl_nas);
}
/* DL/UlNasTransport are not interesting, don't send them */
diff --git a/library/NG_CryptoFunctions.ttcn b/library/NG_CryptoFunctions.ttcn
index 840ed91..0df784e 100644
--- a/library/NG_CryptoFunctions.ttcn
+++ b/library/NG_CryptoFunctions.ttcn
@@ -224,7 +224,7 @@
var NG_SECURITY_PROTECTED_NAS_MESSAGE secp_nas;

/* transparently pass through any non-protected NAS */
- if (not match(nas, cr_NG_SECURITY_PROTECTED_NAS_MESSAGE)) {
+ if (not match(nas, cr_NG_SECURITY_PROTECTED_NAS_MESSAGE_DL)) {
return nas;
}

@@ -335,11 +335,11 @@
mac := f_NG_NAS_mac_calc(nus.alg_int, nus.k_nas_int, nus.tx_count,
bit2int(tsc_NG_RegResult_3GPP),
f_tx_is_downlink(nus), seq_nr & nas_enc);
- nas_out := valueof(cs_NG_SECURITY_PROTECTED_NAS_MESSAGE(tsc_EPD_GMM,
- sec_hdr_t,
- mac,
- seq_nr,
- nas_enc));
+ nas_out := valueof(cs_NG_SECURITY_PROTECTED_NAS_MESSAGE_UL(tsc_EPD_GMM,
+ sec_hdr_t,
+ mac,
+ seq_nr,
+ nas_enc));

return nas_out;
}
diff --git a/library/NG_NAS_Osmo_Templates.ttcn b/library/NG_NAS_Osmo_Templates.ttcn
index f7a481e..ecc90ff 100644
--- a/library/NG_NAS_Osmo_Templates.ttcn
+++ b/library/NG_NAS_Osmo_Templates.ttcn
@@ -694,12 +694,29 @@

/* 24.501 cl. 8.2.28 */
template (present) NG_NAS_DL_Message_Type
-cr_NG_SECURITY_PROTECTED_NAS_MESSAGE(template (present) ExtdProtocolDiscriminator p_protocolDiscriminator := ?,
- template (present) SpareHalfOctet p_spareHalfOctet := ?,
- template (present) SecurityHeaderType p_securityHeaderType := ?,
- template (present) MessageAuthenticationCode p_messageAuthenticationCode := ?,
- template (present) NAS_SequenceNumber p_sequenceNumber := ?,
- template (present) NG_NAS_Message p_plainNASMessage := ?) :=
+cr_NG_SECURITY_PROTECTED_NAS_MESSAGE_DL(template (present) ExtdProtocolDiscriminator p_protocolDiscriminator := ?,
+ template (present) SpareHalfOctet p_spareHalfOctet := ?,
+ template (present) SecurityHeaderType p_securityHeaderType := ?,
+ template (present) MessageAuthenticationCode p_messageAuthenticationCode := ?,
+ template (present) NAS_SequenceNumber p_sequenceNumber := ?,
+ template (present) NG_NAS_Message p_plainNASMessage := ?) :=
+{
+ security_Protected_Nas_Message := {
+ protocolDiscriminator := p_protocolDiscriminator, /* cl. 9.2 M V 1 */
+ spareHalfOctet := p_spareHalfOctet, /* cl. 9.5 M V 1/2 */
+ securityHeaderType := p_securityHeaderType, /* cl. 9.3 M V 1/2 */
+ messageAuthenticationCode := p_messageAuthenticationCode, /* cl. 9.8 M V 4 */
+ sequenceNumber := p_sequenceNumber, /* cl. 9.10 M V 1 */
+ plainNASMessage := p_plainNASMessage /* cl. 9.9 M V 3-n */
+ }
+}
+template (value) NG_NAS_DL_Message_Type
+cs_NG_SECURITY_PROTECTED_NAS_MESSAGE_DL(template (value) ExtdProtocolDiscriminator p_protocolDiscriminator,
+ template (value) SpareHalfOctet p_spareHalfOctet,
+ template (value) SecurityHeaderType p_securityHeaderType,
+ template (value) MessageAuthenticationCode p_messageAuthenticationCode,
+ template (value) NAS_SequenceNumber p_sequenceNumber,
+ template (value) NG_NAS_Message p_plainNASMessage) :=
{
security_Protected_Nas_Message := {
protocolDiscriminator := p_protocolDiscriminator, /* cl. 9.2 M V 1 */
@@ -712,12 +729,28 @@
}

/* 24.501 cl. 8.2.28 */
+template (present) NG_NAS_UL_Message_Type
+cr_NG_SECURITY_PROTECTED_NAS_MESSAGE_UL(template (present) ExtdProtocolDiscriminator p_protocolDiscriminator := ?,
+ template (present) SecurityHeaderType p_securityHeaderType := ?,
+ template (present) MessageAuthenticationCode p_messageAuthenticationCode := ?,
+ template (present) NAS_SequenceNumber p_sequenceNumber := ?,
+ template (present) NG_NAS_Message p_plainNASMessage := ?) :=
+{
+ security_Protected_Nas_Message := {
+ protocolDiscriminator := p_protocolDiscriminator, /* cl. 9.2 M V 1 */
+ spareHalfOctet := '0'H, /* cl. 9.5 M V 1/2 */
+ securityHeaderType := p_securityHeaderType, /* cl. 9.3 M V 1/2 */
+ messageAuthenticationCode := p_messageAuthenticationCode, /* cl. 9.8 M V 4 */
+ sequenceNumber := p_sequenceNumber, /* cl. 9.10 M V 1 */
+ plainNASMessage := p_plainNASMessage /* cl. 9.9 M V 3-n */
+ }
+}
template (value) NG_NAS_UL_Message_Type
-cs_NG_SECURITY_PROTECTED_NAS_MESSAGE(template (value) ExtdProtocolDiscriminator p_protocolDiscriminator,
- template (value) SecurityHeaderType p_securityHeaderType,
- template (value) MessageAuthenticationCode p_messageAuthenticationCode,
- template (value) NAS_SequenceNumber p_sequenceNumber,
- template (value) NG_NAS_Message p_plainNASMessage) :=
+cs_NG_SECURITY_PROTECTED_NAS_MESSAGE_UL(template (value) ExtdProtocolDiscriminator p_protocolDiscriminator,
+ template (value) SecurityHeaderType p_securityHeaderType,
+ template (value) MessageAuthenticationCode p_messageAuthenticationCode,
+ template (value) NAS_SequenceNumber p_sequenceNumber,
+ template (value) NG_NAS_Message p_plainNASMessage) :=
{
security_Protected_Nas_Message := {
protocolDiscriminator := p_protocolDiscriminator, /* cl. 9.2 M V 1 */

To view, visit change 44238. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Idaf92f7d462ea27deb552ea7c726120180f57a93
Gerrit-Change-Number: 44238
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>