add flag for unused function arguments in NAS CMakeLists

This commit is contained in:
francescomani
2026-03-27 18:03:11 +01:00
parent 7732c30c1d
commit 2483b68ee4
10 changed files with 25 additions and 28 deletions
+1
View File
@@ -1,5 +1,6 @@
# SPDX-License-Identifier: LicenseRef-CSSL-1.0 # SPDX-License-Identifier: LicenseRef-CSSL-1.0
add_compile_options(-Wunused-parameter)
add_subdirectory(COMMON) add_subdirectory(COMMON)
add_subdirectory(NR_UE) add_subdirectory(NR_UE)
add_subdirectory(UE) add_subdirectory(UE)
@@ -32,7 +32,7 @@ int decode_authentication_response_parameter(AuthenticationResponseParameter *au
decoded += decode_result; decoded += decode_result;
#if defined (NAS_DEBUG) #if defined (NAS_DEBUG)
dump_authentication_response_parameter_xml(authenticationresponseparameter, iei); dump_authentication_response_parameter_xml(authenticationresponseparameter);
#endif #endif
return decoded; return decoded;
} }
@@ -47,7 +47,7 @@ int encode_authentication_response_parameter(const AuthenticationResponseParamet
/* Checking IEI and pointer */ /* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, AUTHENTICATION_RESPONSE_PARAMETER_MINIMUM_LENGTH, len); CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, AUTHENTICATION_RESPONSE_PARAMETER_MINIMUM_LENGTH, len);
#if defined (NAS_DEBUG) #if defined (NAS_DEBUG)
dump_authentication_response_parameter_xml(authenticationresponseparameter, iei); dump_authentication_response_parameter_xml(authenticationresponseparameter);
#endif #endif
if (iei > 0) { if (iei > 0) {
@@ -67,7 +67,7 @@ int encode_authentication_response_parameter(const AuthenticationResponseParamet
return encoded; return encoded;
} }
void dump_authentication_response_parameter_xml(AuthenticationResponseParameter *authenticationresponseparameter, uint8_t iei) void dump_authentication_response_parameter_xml(AuthenticationResponseParameter *authenticationresponseparameter)
{ {
printf("<Authentication Response Parameter>\n"); printf("<Authentication Response Parameter>\n");
dump_octet_string_xml(&authenticationresponseparameter->res); dump_octet_string_xml(&authenticationresponseparameter->res);
@@ -25,7 +25,7 @@ int encode_authentication_response_parameter(const AuthenticationResponseParamet
int decode_authentication_response_parameter(AuthenticationResponseParameter *authenticationresponseparameter, uint8_t iei, uint8_t *buffer, uint32_t len); int decode_authentication_response_parameter(AuthenticationResponseParameter *authenticationresponseparameter, uint8_t iei, uint8_t *buffer, uint32_t len);
void dump_authentication_response_parameter_xml(AuthenticationResponseParameter *authenticationresponseparameter, uint8_t iei); void dump_authentication_response_parameter_xml(AuthenticationResponseParameter *authenticationresponseparameter);
#endif /* AUTHENTICATION RESPONSE PARAMETER_H_ */ #endif /* AUTHENTICATION RESPONSE PARAMETER_H_ */
@@ -17,7 +17,7 @@
#define NO_FOLLOW_ON_REQUEST 0x0 #define NO_FOLLOW_ON_REQUEST 0x0
#define FOLLOW_ON_REQUEST 0x08 #define FOLLOW_ON_REQUEST 0x08
int decode_5gs_registration_type(FGSRegistrationType *fgsregistrationtype, uint8_t iei, uint8_t value, uint32_t len) int decode_5gs_registration_type(FGSRegistrationType *fgsregistrationtype, uint8_t iei, uint8_t value)
{ {
int decoded = 0; int decoded = 0;
uint8_t *buffer = &value; uint8_t *buffer = &value;
@@ -28,6 +28,6 @@ typedef uint8_t FGSRegistrationType;
int encode_5gs_registration_type(const FGSRegistrationType *fgsregistrationtype, bool follow_on_request); int encode_5gs_registration_type(const FGSRegistrationType *fgsregistrationtype, bool follow_on_request);
int decode_5gs_registration_type(FGSRegistrationType *fgsregistrationtype, uint8_t iei, uint8_t value, uint32_t len); int decode_5gs_registration_type(FGSRegistrationType *fgsregistrationtype, uint8_t iei, uint8_t value);
#endif /* FGS_REGISTRATION_TYPE_H_*/ #endif /* FGS_REGISTRATION_TYPE_H_*/
@@ -10,10 +10,7 @@
#include "TLVDecoder.h" #include "TLVDecoder.h"
#include "NrUESecurityCapability.h" #include "NrUESecurityCapability.h"
int encode_nrue_security_capability(const NrUESecurityCapability *nruesecuritycapability, int encode_nrue_security_capability(const NrUESecurityCapability *nruesecuritycapability, uint8_t iei, uint8_t *buffer)
uint8_t iei,
uint8_t *buffer,
uint32_t len)
{ {
int encoded = 0; int encoded = 0;
if (iei) { if (iei) {
@@ -20,9 +20,6 @@ typedef struct {
uint8_t EIA; uint8_t EIA;
} NrUESecurityCapability; } NrUESecurityCapability;
int encode_nrue_security_capability(const NrUESecurityCapability *nruesecuritycapability, int encode_nrue_security_capability(const NrUESecurityCapability *nruesecuritycapability, uint8_t iei, uint8_t *buffer);
uint8_t iei,
uint8_t *buffer,
uint32_t len);
#endif /* NRUE_SECURITY_CAPABILITY_H_ */ #endif /* NRUE_SECURITY_CAPABILITY_H_ */
@@ -23,7 +23,7 @@ int decode_registration_request(registration_request_msg *registration_request,
/* Decoding mandatory fields */ /* Decoding mandatory fields */
if ((decoded_result = if ((decoded_result =
decode_5gs_registration_type(&registration_request->fgsregistrationtype, 0, *(buffer + decoded) & 0x0f, len - decoded)) decode_5gs_registration_type(&registration_request->fgsregistrationtype, 0, *(buffer + decoded) & 0x0f))
< 0) { < 0) {
LOG_FUNC_RETURN(decoded_result); LOG_FUNC_RETURN(decoded_result);
} }
@@ -76,8 +76,7 @@ int encode_registration_request(const registration_request_msg *registration_req
== REGISTRATION_REQUEST_UE_SECURITY_CAPABILITY_PRESENT) { == REGISTRATION_REQUEST_UE_SECURITY_CAPABILITY_PRESENT) {
if ((encode_result = encode_nrue_security_capability(&registration_request->nruesecuritycapability, if ((encode_result = encode_nrue_security_capability(&registration_request->nruesecuritycapability,
REGISTRATION_REQUEST_UE_SECURITY_CAPABILITY_IEI, REGISTRATION_REQUEST_UE_SECURITY_CAPABILITY_IEI,
buffer + encoded, buffer + encoded))
len - encoded))
< 0) < 0)
// Return in case of error // Return in case of error
return encode_result; return encode_result;
+12 -11
View File
@@ -222,11 +222,10 @@ static void nas_security_compute_mac(nr_ue_nas_t *nas,
* @brief: Decrypt the payload of a NAS message. The buffer is modified in place * @brief: Decrypt the payload of a NAS message. The buffer is modified in place
* @param[in] nas The NAS context * @param[in] nas The NAS context
* @param[in] pdu_buffer The buffer containing the full (header + payload) NAS message * @param[in] pdu_buffer The buffer containing the full (header + payload) NAS message
* @param[in] is_uplink True if the message is uplink, false Downlink
* @param[in] is3gpp_access True if the message is 3GPP access, false otherwise * @param[in] is3gpp_access True if the message is 3GPP access, false otherwise
* @param[in] pdu_length The length of the NAS message * @param[in] pdu_length The length of the NAS message
*/ */
static void nas_security_decrypt_payload(nr_ue_nas_t *nas, byte_array_t buffer, const bool is_uplink, const bool is3gpp_access) static void nas_security_decrypt_payload(nr_ue_nas_t *nas, byte_array_t buffer, const bool is3gpp_access)
{ {
Security_header_t sec_hdr; Security_header_t sec_hdr;
@@ -380,7 +379,7 @@ static security_state_t nas_security_rx_process(nr_ue_nas_t *nas, byte_array_t b
return NAS_SECURITY_INTEGRITY_FAILED; return NAS_SECURITY_INTEGRITY_FAILED;
/* decipher */ /* decipher */
nas_security_decrypt_payload(nas, buffer, false, true); nas_security_decrypt_payload(nas, buffer, true);
/* update estimated DL Counter */ /* update estimated DL Counter */
nas->security.nas_count_dl++; nas->security.nas_count_dl++;
@@ -669,7 +668,7 @@ static FGSRegistrationType set_fgs_ksi(nr_ue_nas_t *nas)
* @brief Set contents of 5GMM capability * @brief Set contents of 5GMM capability
* @note Currently hardcoded, sending min length only (1 octet) * @note Currently hardcoded, sending min length only (1 octet)
*/ */
static FGMMCapability set_fgmm_capability(nr_ue_nas_t *nas) static FGMMCapability set_fgmm_capability()
{ {
FGMMCapability cap = {0}; FGMMCapability cap = {0};
cap.iei = REGISTRATION_REQUEST_5GMM_CAPABILITY_IEI; cap.iei = REGISTRATION_REQUEST_5GMM_CAPABILITY_IEI;
@@ -794,7 +793,7 @@ void generateRegistrationRequest(as_nas_info_t *initialNasMsg, nr_ue_nas_t *nas,
if (full_rr->fgsregistrationtype != PERIODIC_REGISTRATION_UPDATING) { if (full_rr->fgsregistrationtype != PERIODIC_REGISTRATION_UPDATING) {
cleartext_only = false; // The UE needs to send non-cleartext IE cleartext_only = false; // The UE needs to send non-cleartext IE
full_rr->presencemask |= REGISTRATION_REQUEST_5GMM_CAPABILITY_PRESENT; full_rr->presencemask |= REGISTRATION_REQUEST_5GMM_CAPABILITY_PRESENT;
full_rr->fgmmcapability = set_fgmm_capability(nas); full_rr->fgmmcapability = set_fgmm_capability();
FGMMCapability *cap = &full_rr->fgmmcapability; FGMMCapability *cap = &full_rr->fgmmcapability;
size_nct += sizeof(cap->length) + sizeof(cap->iei) + cap->length; size_nct += sizeof(cap->length) + sizeof(cap->iei) + cap->length;
} }
@@ -1022,7 +1021,7 @@ static void generateAuthenticationResp(nr_ue_nas_t *nas, as_nas_info_t *initialN
/** @brief Send Authentication Failure message from the UE to the AMF to /** @brief Send Authentication Failure message from the UE to the AMF to
* indicate that authentication of the network has failed */ * indicate that authentication of the network has failed */
static void generateAuthenticationFailure(nr_ue_nas_t *nas, as_nas_info_t *initialNasMsg, cause_id_t cause) static void generateAuthenticationFailure(as_nas_info_t *initialNasMsg, cause_id_t cause)
{ {
int size = sizeof(fgmm_msg_header_t); int size = sizeof(fgmm_msg_header_t);
fgmm_nas_message_plain_t plain = {0}; fgmm_nas_message_plain_t plain = {0};
@@ -1066,7 +1065,7 @@ static void handle_fgmm_authentication_request(nr_ue_nas_t *nas, as_nas_info_t *
/* If the ngKSI value received is already associated with one /* If the ngKSI value received is already associated with one
of the 5G security contexts stored in the UE, send failure message */ of the 5G security contexts stored in the UE, send failure message */
LOG_E(NAS, "Invalid NAS Key Set Identifier: send Authentication Failure\n"); LOG_E(NAS, "Invalid NAS Key Set Identifier: send Authentication Failure\n");
generateAuthenticationFailure(nas, initialNasMsg, ngKSI_already_in_use); generateAuthenticationFailure(initialNasMsg, ngKSI_already_in_use);
return; return;
} }
generateAuthenticationResp(nas, initialNasMsg, buffer->buf); generateAuthenticationResp(nas, initialNasMsg, buffer->buf);
@@ -1078,7 +1077,7 @@ static void handle_fgmm_authentication_request(nr_ue_nas_t *nas, as_nas_info_t *
* @todo The UE shall performs actions as per 5.4.1.3.5 of 3GPP TS 24.501, including * @todo The UE shall performs actions as per 5.4.1.3.5 of 3GPP TS 24.501, including
* (1) Abort any ongoing 5GMM procedure (2) Stop all active timers: T3510, T3516, T3517, * (1) Abort any ongoing 5GMM procedure (2) Stop all active timers: T3510, T3516, T3517,
* T3519, T3520, T3521 (3) Delete stored SUCI. (4) handle EAP-failure message. */ * T3519, T3520, T3521 (3) Delete stored SUCI. (4) handle EAP-failure message. */
static void handle_authentication_reject(nr_ue_nas_t *nas, as_nas_info_t *initialNasMsg, uint8_t *pdu, int pdu_length) static void handle_authentication_reject(nr_ue_nas_t *nas, uint8_t *pdu, int pdu_length)
{ {
LOG_E(NAS, "Received Authentication Reject message from the network\n"); LOG_E(NAS, "Received Authentication Reject message from the network\n");
uint8_t eap_msg[MAX_EAP_CONTENTS_LEN] = {0}; uint8_t eap_msg[MAX_EAP_CONTENTS_LEN] = {0};
@@ -1574,7 +1573,7 @@ void handleDownlinkNASTransport(const nr_ue_nas_t *nas, uint8_t * pdu_buffer, in
} }
} }
static void generateDeregistrationRequest(nr_ue_nas_t *nas, as_nas_info_t *initialNasMsg, const nas_deregistration_req_t *req) static void generateDeregistrationRequest(nr_ue_nas_t *nas, as_nas_info_t *initialNasMsg)
{ {
fgmm_nas_msg_security_protected_t sp_msg = {0}; fgmm_nas_msg_security_protected_t sp_msg = {0};
fgs_nas_message_security_header_t *sp_header = &sp_msg.header; fgs_nas_message_security_header_t *sp_header = &sp_msg.header;
@@ -1802,6 +1801,7 @@ static int get_user_nssai_idx(nssai_t ch_nssai, const nr_nas_msg_snssai_t allowe
void *nas_nrue_task(void *args_p) void *nas_nrue_task(void *args_p)
{ {
UNUSED(args_p);
while (1) { while (1) {
nas_nrue(NULL); nas_nrue(NULL);
} }
@@ -1942,6 +1942,7 @@ static void handle_service_reject(nr_ue_nas_t *nas, const byte_array_t *buffer)
void *nas_nrue(void *args_p) void *nas_nrue(void *args_p)
{ {
UNUSED(args_p);
// Wait for a message or an event // Wait for a message or an event
MessageDef *msg_p; MessageDef *msg_p;
itti_receive_msg(TASK_NAS_NRUE, &msg_p); itti_receive_msg(TASK_NAS_NRUE, &msg_p);
@@ -2072,7 +2073,7 @@ void *nas_nrue(void *args_p)
send_nas_detach_req(nas, true); send_nas_detach_req(nas, true);
} }
as_nas_info_t initialNasMsg = {0}; as_nas_info_t initialNasMsg = {0};
generateDeregistrationRequest(nas, &initialNasMsg, req); generateDeregistrationRequest(nas, &initialNasMsg);
send_nas_uplink_data_req(nas, &initialNasMsg); send_nas_uplink_data_req(nas, &initialNasMsg);
} else { } else {
LOG_W(NAS, "No GUTI, cannot trigger deregistration request.\n"); LOG_W(NAS, "No GUTI, cannot trigger deregistration request.\n");
@@ -2108,7 +2109,7 @@ void *nas_nrue(void *args_p)
handle_fgmm_authentication_request(nas, &initialNasMsg, &buffer); handle_fgmm_authentication_request(nas, &initialNasMsg, &buffer);
break; break;
case FGS_AUTHENTICATION_REJECT: case FGS_AUTHENTICATION_REJECT:
handle_authentication_reject(nas, &initialNasMsg, pdu_buffer, pdu_length); handle_authentication_reject(nas, pdu_buffer, pdu_length);
break; break;
case FGS_SECURITY_MODE_COMMAND: case FGS_SECURITY_MODE_COMMAND:
handle_security_mode_command(nas, &initialNasMsg, pdu_buffer, pdu_length); handle_security_mode_command(nas, &initialNasMsg, pdu_buffer, pdu_length);
+2
View File
@@ -455,6 +455,8 @@ int usim_api_authenticate(usim_data_t *usim_data, const OctetString* rand_pP, co
static int _usim_api_check_sqn(uint32_t seq, uint8_t ind) static int _usim_api_check_sqn(uint32_t seq, uint8_t ind)
{ {
/* TODO */ /* TODO */
UNUSED(seq);
UNUSED(ind);
return (RETURNok); return (RETURNok);
} }