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,
LOG_FUNC_IN;
/* TODO: run integrity protection algorithm */
/* TODO: Return the message authentication code */
#if defined(EPC_BUILD)
LOG_FUNC_RETURN (0);
#else
LOG_FUNC_RETURN (0xabababab);
#endif
}
......@@ -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 "nas_log.h"
#include "nas_timer.h"
......@@ -37,9 +41,7 @@ Description Defines the security mode control EMM procedure executed by the
#include "emm_sap.h"
#include "emm_cause.h"
#include <stdlib.h> // malloc, free
#include <string.h> // memcpy
#include <inttypes.h>
#include "UeSecurityCapability.h"
#if defined(ENABLE_ITTI)
# include "assertions.h"
......@@ -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_failure_callback_t failure)
{
LOG_FUNC_IN;
int rc = RETURNerror;
int security_context_is_new = FALSE;
LOG_TRACE(INFO, "EMM-PROC - Initiate security mode control procedure "
"KSI = %d", ksi);
/* Get the UE context */
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 (ueid > 0) {
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,
size += UE_SECURITY_CAPABILITY_MAXIMUM_LENGTH;
emm_msg->replayeduesecuritycapabilities.eea = msg->eea;
emm_msg->replayeduesecuritycapabilities.eia = msg->eia;
emm_msg->replayeduesecuritycapabilities.non_eps_security_present = 0;
emm_msg->replayeduesecuritycapabilities.uea = 0x00;
emm_msg->replayeduesecuritycapabilities.uia = 0x00;
emm_msg->replayeduesecuritycapabilities.gea = 0x00;
......
......@@ -23,12 +23,15 @@ int decode_ue_security_capability(UeSecurityCapability *uesecuritycapability, ui
decoded++;
uesecuritycapability->eia = *(buffer + decoded);
decoded++;
uesecuritycapability->uea = *(buffer + decoded);
decoded++;
uesecuritycapability->uia = *(buffer + decoded) & 0x7f;
decoded++;
uesecuritycapability->gea = *(buffer + decoded) & 0x7f;
decoded++;
if (len == decoded + 3) {
uesecuritycapability->non_eps_security_present = 1;
uesecuritycapability->uea = *(buffer + decoded);
decoded++;
uesecuritycapability->uia = *(buffer + decoded) & 0x7f;
decoded++;
uesecuritycapability->gea = *(buffer + decoded) & 0x7f;
decoded++;
}
#if defined (NAS_DEBUG)
dump_ue_security_capability_xml(uesecuritycapability, iei);
#endif
......@@ -54,14 +57,16 @@ int encode_ue_security_capability(UeSecurityCapability *uesecuritycapability, ui
encoded++;
*(buffer + encoded) = uesecuritycapability->eia;
encoded++;
*(buffer + encoded) = uesecuritycapability->uea;
encoded++;
*(buffer + encoded) = 0x00 |
(uesecuritycapability->uia & 0x7f);
encoded++;
*(buffer + encoded) = 0x00 |
(uesecuritycapability->gea & 0x7f);
encoded++;
if (uesecuritycapability->non_eps_security_present == 1) {
*(buffer + encoded) = uesecuritycapability->uea;
encoded++;
*(buffer + encoded) = 0x00 |
(uesecuritycapability->uia & 0x7f);
encoded++;
*(buffer + encoded) = 0x00 |
(uesecuritycapability->gea & 0x7f);
encoded++;
}
*lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0);
return encoded;
}
......@@ -74,9 +79,11 @@ void dump_ue_security_capability_xml(UeSecurityCapability *uesecuritycapability,
printf(" <IEI>0x%X</IEI>\n", iei);
printf(" <EEA>%u</EEA>\n", uesecuritycapability->eea);
printf(" <EIA>%u</EIA>\n", uesecuritycapability->eia);
printf(" <UEA>%u</UEA>\n", uesecuritycapability->uea);
printf(" <UIA>%u</UIA>\n", uesecuritycapability->uia);
printf(" <GEA>%u</GEA>\n", uesecuritycapability->gea);
if (uesecuritycapability->non_eps_security_present == 1) {
printf(" <UEA>%u</UEA>\n", uesecuritycapability->uea);
printf(" <UIA>%u</UIA>\n", uesecuritycapability->uia);
printf(" <GEA>%u</GEA>\n", uesecuritycapability->gea);
}
printf("</Ue Security Capability>\n");
}
......@@ -31,6 +31,7 @@ typedef struct UeSecurityCapability_tag {
#define UE_SECURITY_CAPABILITY_EIA6 0b00000010
#define UE_SECURITY_CAPABILITY_EIA7 0b00000001
uint8_t eia;
unsigned non_eps_security_present:1;
/* UMTS encryption algorithms supported (octet 5) */
#define UE_SECURITY_CAPABILITY_UEA0 0b10000000
#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