Commit a3ea6666 authored by Cedric Roux's avatar Cedric Roux

- Fix UE security capabilities optional fields

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4759 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 309bf361
...@@ -719,7 +719,11 @@ static UInt32_t _nas_message_get_mac(const char* buffer, UInt32_t count, ...@@ -719,7 +719,11 @@ static UInt32_t _nas_message_get_mac(const char* buffer, UInt32_t count,
LOG_FUNC_IN; LOG_FUNC_IN;
/* TODO: run integrity protection algorithm */ /* TODO: run integrity protection algorithm */
/* TODO: Return the message authentication code */ /* TODO: Return the message authentication code */
#if defined(EPC_BUILD)
LOG_FUNC_RETURN (0);
#else
LOG_FUNC_RETURN (0xabababab); LOG_FUNC_RETURN (0xabababab);
#endif
} }
...@@ -28,6 +28,10 @@ Description Defines the security mode control EMM procedure executed by the ...@@ -28,6 +28,10 @@ Description Defines the security mode control EMM procedure executed by the
*****************************************************************************/ *****************************************************************************/
#include <stdlib.h> // malloc, free
#include <string.h> // memcpy
#include <inttypes.h>
#include "emm_proc.h" #include "emm_proc.h"
#include "nas_log.h" #include "nas_log.h"
#include "nas_timer.h" #include "nas_timer.h"
...@@ -37,9 +41,7 @@ Description Defines the security mode control EMM procedure executed by the ...@@ -37,9 +41,7 @@ Description Defines the security mode control EMM procedure executed by the
#include "emm_sap.h" #include "emm_sap.h"
#include "emm_cause.h" #include "emm_cause.h"
#include <stdlib.h> // malloc, free #include "UeSecurityCapability.h"
#include <string.h> // memcpy
#include <inttypes.h>
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
# include "assertions.h" # include "assertions.h"
...@@ -368,17 +370,17 @@ int emm_proc_security_mode_control(unsigned int ueid, int ksi, int eea, int eia, ...@@ -368,17 +370,17 @@ int emm_proc_security_mode_control(unsigned int ueid, int ksi, int eea, int eia,
emm_common_reject_callback_t reject, emm_common_reject_callback_t reject,
emm_common_failure_callback_t failure) emm_common_failure_callback_t failure)
{ {
LOG_FUNC_IN;
int rc = RETURNerror; int rc = RETURNerror;
int security_context_is_new = FALSE; int security_context_is_new = FALSE;
LOG_TRACE(INFO, "EMM-PROC - Initiate security mode control procedure "
"KSI = %d", ksi);
/* Get the UE context */ /* Get the UE context */
emm_data_context_t *emm_ctx = NULL; emm_data_context_t *emm_ctx = NULL;
LOG_FUNC_IN;
LOG_TRACE(INFO, "EMM-PROC - Initiate security mode control procedure "
"KSI = %d", ksi);
#if defined(EPC_BUILD) #if defined(EPC_BUILD)
if (ueid > 0) { if (ueid > 0) {
emm_ctx = emm_data_context_get(&_emm_data, ueid); emm_ctx = emm_data_context_get(&_emm_data, ueid);
......
...@@ -1158,6 +1158,7 @@ int emm_send_security_mode_command(const emm_as_security_t *msg, ...@@ -1158,6 +1158,7 @@ int emm_send_security_mode_command(const emm_as_security_t *msg,
size += UE_SECURITY_CAPABILITY_MAXIMUM_LENGTH; size += UE_SECURITY_CAPABILITY_MAXIMUM_LENGTH;
emm_msg->replayeduesecuritycapabilities.eea = msg->eea; emm_msg->replayeduesecuritycapabilities.eea = msg->eea;
emm_msg->replayeduesecuritycapabilities.eia = msg->eia; emm_msg->replayeduesecuritycapabilities.eia = msg->eia;
emm_msg->replayeduesecuritycapabilities.non_eps_security_present = 0;
emm_msg->replayeduesecuritycapabilities.uea = 0x00; emm_msg->replayeduesecuritycapabilities.uea = 0x00;
emm_msg->replayeduesecuritycapabilities.uia = 0x00; emm_msg->replayeduesecuritycapabilities.uia = 0x00;
emm_msg->replayeduesecuritycapabilities.gea = 0x00; emm_msg->replayeduesecuritycapabilities.gea = 0x00;
......
...@@ -23,12 +23,15 @@ int decode_ue_security_capability(UeSecurityCapability *uesecuritycapability, ui ...@@ -23,12 +23,15 @@ int decode_ue_security_capability(UeSecurityCapability *uesecuritycapability, ui
decoded++; decoded++;
uesecuritycapability->eia = *(buffer + decoded); uesecuritycapability->eia = *(buffer + decoded);
decoded++; decoded++;
uesecuritycapability->uea = *(buffer + decoded); if (len == decoded + 3) {
decoded++; uesecuritycapability->non_eps_security_present = 1;
uesecuritycapability->uia = *(buffer + decoded) & 0x7f; uesecuritycapability->uea = *(buffer + decoded);
decoded++; decoded++;
uesecuritycapability->gea = *(buffer + decoded) & 0x7f; uesecuritycapability->uia = *(buffer + decoded) & 0x7f;
decoded++; decoded++;
uesecuritycapability->gea = *(buffer + decoded) & 0x7f;
decoded++;
}
#if defined (NAS_DEBUG) #if defined (NAS_DEBUG)
dump_ue_security_capability_xml(uesecuritycapability, iei); dump_ue_security_capability_xml(uesecuritycapability, iei);
#endif #endif
...@@ -54,14 +57,16 @@ int encode_ue_security_capability(UeSecurityCapability *uesecuritycapability, ui ...@@ -54,14 +57,16 @@ int encode_ue_security_capability(UeSecurityCapability *uesecuritycapability, ui
encoded++; encoded++;
*(buffer + encoded) = uesecuritycapability->eia; *(buffer + encoded) = uesecuritycapability->eia;
encoded++; encoded++;
*(buffer + encoded) = uesecuritycapability->uea; if (uesecuritycapability->non_eps_security_present == 1) {
encoded++; *(buffer + encoded) = uesecuritycapability->uea;
*(buffer + encoded) = 0x00 | encoded++;
(uesecuritycapability->uia & 0x7f); *(buffer + encoded) = 0x00 |
encoded++; (uesecuritycapability->uia & 0x7f);
*(buffer + encoded) = 0x00 | encoded++;
(uesecuritycapability->gea & 0x7f); *(buffer + encoded) = 0x00 |
encoded++; (uesecuritycapability->gea & 0x7f);
encoded++;
}
*lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0); *lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0);
return encoded; return encoded;
} }
...@@ -74,9 +79,11 @@ void dump_ue_security_capability_xml(UeSecurityCapability *uesecuritycapability, ...@@ -74,9 +79,11 @@ void dump_ue_security_capability_xml(UeSecurityCapability *uesecuritycapability,
printf(" <IEI>0x%X</IEI>\n", iei); printf(" <IEI>0x%X</IEI>\n", iei);
printf(" <EEA>%u</EEA>\n", uesecuritycapability->eea); printf(" <EEA>%u</EEA>\n", uesecuritycapability->eea);
printf(" <EIA>%u</EIA>\n", uesecuritycapability->eia); printf(" <EIA>%u</EIA>\n", uesecuritycapability->eia);
printf(" <UEA>%u</UEA>\n", uesecuritycapability->uea); if (uesecuritycapability->non_eps_security_present == 1) {
printf(" <UIA>%u</UIA>\n", uesecuritycapability->uia); printf(" <UEA>%u</UEA>\n", uesecuritycapability->uea);
printf(" <GEA>%u</GEA>\n", uesecuritycapability->gea); printf(" <UIA>%u</UIA>\n", uesecuritycapability->uia);
printf(" <GEA>%u</GEA>\n", uesecuritycapability->gea);
}
printf("</Ue Security Capability>\n"); printf("</Ue Security Capability>\n");
} }
...@@ -31,6 +31,7 @@ typedef struct UeSecurityCapability_tag { ...@@ -31,6 +31,7 @@ typedef struct UeSecurityCapability_tag {
#define UE_SECURITY_CAPABILITY_EIA6 0b00000010 #define UE_SECURITY_CAPABILITY_EIA6 0b00000010
#define UE_SECURITY_CAPABILITY_EIA7 0b00000001 #define UE_SECURITY_CAPABILITY_EIA7 0b00000001
uint8_t eia; uint8_t eia;
unsigned non_eps_security_present:1;
/* UMTS encryption algorithms supported (octet 5) */ /* UMTS encryption algorithms supported (octet 5) */
#define UE_SECURITY_CAPABILITY_UEA0 0b10000000 #define UE_SECURITY_CAPABILITY_UEA0 0b10000000
#define UE_SECURITY_CAPABILITY_UEA1 0b01000000 #define UE_SECURITY_CAPABILITY_UEA1 0b01000000
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment