Commit 0188e118 authored by Bilel's avatar Bilel

[OAI-UE] IMEISV fix + PUSCH power tx fix

parent 13aa9ed3
Pipeline #3252 skipped with stage
......@@ -124,6 +124,7 @@ static inline void* malloc16_clear( size_t size )
#include "PHY/TOOLS/defs.h"
#include "platform_types.h"
#define OPENAIR_LTE
#ifdef OPENAIR_LTE
#include "PHY/LTE_TRANSPORT/defs.h"
......@@ -656,7 +657,7 @@ typedef struct {
/// \brief Total gains with bypassed RF gain stage (ExpressMIMO2/Lime)
uint32_t rx_gain_byp[4];
/// \brief Current transmit power
int8_t tx_power_dBm[10];
int16_t tx_power_dBm[10];
/// \brief Total number of REs in current transmission
int tx_total_RE[10];
/// \brief Maximum transmit power
......
......@@ -119,7 +119,7 @@ typedef struct {
Byte_t digit14:4;
Byte_t digit13:4;
#define EVEN_PARITY 0
#define ODD_PARITY 1
#define ODD_PARITY 0xf
Byte_t parity:4;
Byte_t digit15:4;
} num;
......
......@@ -72,6 +72,8 @@ int decode_security_mode_command(security_mode_command_msg *security_mode_comman
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
security_mode_command->presencemask |= SECURITY_MODE_COMMAND_IMEISV_REQUEST_PRESENT;
LOG_I(NAS," SECURITY MODE COMMAND: IMEISV_REQUEST: %d \n",security_mode_command->imeisvrequest);
break;
case SECURITY_MODE_COMMAND_REPLAYED_NONCEUE_IEI:
......
......@@ -76,8 +76,11 @@ int encode_security_mode_complete(security_mode_complete_msg *security_mode_comp
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, SECURITY_MODE_COMPLETE_MINIMUM_LENGTH, len);
LOG_I(NAS,"SECURITY MODE COMMAND COMPLETE: presencemask: %d \n",security_mode_complete->presencemask);
if ((security_mode_complete->presencemask & SECURITY_MODE_COMPLETE_IMEISV_PRESENT)
== SECURITY_MODE_COMPLETE_IMEISV_PRESENT) {
LOG_I(NAS,"SECURITY MODE COMMAND COMPLETE: encode imeisv \n");
if ((encode_result =
encode_mobile_identity(&security_mode_complete->imeisv,
SECURITY_MODE_COMPLETE_IMEISV_IEI, buffer + encoded, len -
......@@ -87,7 +90,7 @@ int encode_security_mode_complete(security_mode_complete_msg *security_mode_comp
else
encoded += encode_result;
}
LOG_I(NAS,"SECURITY MODE COMMAND COMPLETE done !!! \n");
return encoded;
}
......@@ -575,6 +575,8 @@ static int encode_imei_mobile_identity(ImeiMobileIdentity_t *imei, uint8_t *buff
static int encode_imeisv_mobile_identity(ImeisvMobileIdentity_t *imeisv, uint8_t *buffer)
{
uint32_t encoded = 0;
LOG_I(NAS,"SECURITY MODE COMMAND COMPLETE: encode_imeisv_mobile_identity \n");
*(buffer + encoded) = 0x00 | (imeisv->digit1 << 4) | (imeisv->oddeven << 3) |
(imeisv->typeofidentity);
encoded++;
......@@ -590,12 +592,15 @@ static int encode_imeisv_mobile_identity(ImeisvMobileIdentity_t *imeisv, uint8_t
encoded++;
*(buffer + encoded) = 0x00 | (imeisv->digit13 << 4) | imeisv->digit12;
encoded++;
*(buffer + encoded) = 0x00 | (imeisv->digit15 << 4) | imeisv->digit14;
encoded++;
*(buffer + encoded) = 0x00 | (imeisv->parity << 4) | imeisv->digit16;
if (imeisv->oddeven != MOBILE_IDENTITY_EVEN) {
*(buffer + encoded) = 0x00 | (imeisv->digit15 << 4) | imeisv->digit14;
} else {
*(buffer + encoded) = 0xf0 | imeisv->digit14;
}
//if (imeisv->oddeven != MOBILE_IDENTITY_EVEN) {
// *(buffer + encoded) = 0x00 | (imeisv->digit15 << 4) | imeisv->digit14;
//} else {
// *(buffer + encoded) = 0xf0 | imeisv->digit14;
//}
encoded++;
return encoded;
......
......@@ -73,8 +73,63 @@ typedef struct {
uint8_t mbmssessionid;
} TmgiMobileIdentity_t;
typedef struct imeisv_s{
uint8_t digit1:4;
uint8_t oddeven:1;
uint8_t typeofidentity:3;
uint8_t digit2:4;
uint8_t digit3:4;
uint8_t digit4:4;
uint8_t digit5:4;
uint8_t digit6:4;
uint8_t digit7:4;
uint8_t digit8:4;
uint8_t digit9:4;
uint8_t digit10:4;
uint8_t digit11:4;
uint8_t digit12:4;
uint8_t digit13:4;
uint8_t digit14:4;
uint8_t digit15:4;
uint8_t digit16:4;
#define EVEN_PARITY 0
#define ODD_PARITY 1
uint8_t parity:4;
} imeisv_t;
#if 0
typedef struct imeisv_s {
uint8_t length;
union {
struct {
uint8_t tac2:4;
uint8_t tac1:4;
uint8_t tac4:4;
uint8_t tac3:4;
uint8_t tac6:4;
uint8_t tac5:4;
uint8_t tac8:4;
uint8_t tac7:4;
uint8_t snr2:4;
uint8_t snr1:4;
uint8_t snr4:4;
uint8_t snr3:4;
uint8_t snr6:4;
uint8_t snr5:4;
uint8_t svn2:4;
uint8_t svn1:4;
#define EVEN_PARITY 0
#define ODD_PARITY 1
uint8_t parity:4;
} num;
#define IMEISV_BCD8_SIZE 9
uint8_t value[IMEISV_BCD8_SIZE];
} u;
} imeisv_t;
#endif
typedef ImsiMobileIdentity_t ImeiMobileIdentity_t;
typedef ImsiMobileIdentity_t ImeisvMobileIdentity_t;
typedef imeisv_t ImeisvMobileIdentity_t;
typedef ImsiMobileIdentity_t TmsiMobileIdentity_t;
typedef ImsiMobileIdentity_t NoMobileIdentity_t;
......
......@@ -120,6 +120,7 @@ typedef struct emm_as_security_s {
uint8_t ucs2;
uint8_t uia; /* Replayed UMTS integrity algorithms */
uint8_t gea; /* Replayed GPRS encryption algorithms */
uint8_t imeisv_request;
uint8_t umts_present;
uint8_t gprs_present;
......
......@@ -472,13 +472,15 @@ int emm_recv_security_mode_command(security_mode_command_msg *msg,
* Message processing
*/
/* Execute the security mode control procedure initiated by the network */
LOG_I(NAS,"Execute the security mode control procedure initiated by the network: imeisvrequest %d\n",msg->imeisvrequest);
rc = emm_proc_security_mode_command(
msg->naskeysetidentifier.tsc != NAS_KEY_SET_IDENTIFIER_MAPPED,
msg->naskeysetidentifier.naskeysetidentifier,
msg->selectednassecurityalgorithms.typeofcipheringalgorithm,
msg->selectednassecurityalgorithms.typeofintegrityalgorithm,
msg->replayeduesecuritycapabilities.eea,
msg->replayeduesecuritycapabilities.eia);
msg->replayeduesecuritycapabilities.eia,
msg->imeisvrequest & 0x7);
LOG_FUNC_RETURN (rc);
}
......
......@@ -855,6 +855,35 @@ int emm_send_security_mode_complete(const emm_as_security_t *msg,
/* Mandatory - Message type */
emm_msg->messagetype = SECURITY_MODE_COMPLETE;
if(msg->imeisv_request)
{
// configure imeisv param
emm_msg->presencemask |= SECURITY_MODE_COMPLETE_IMEISV_PRESENT;
// 33 85 76 02 05 26 84 01 F1
emm_msg->imeisv.imeisv;
emm_msg->imeisv.imeisv.digit1 = 0x3;
emm_msg->imeisv.imeisv.oddeven = 0x0;
emm_msg->imeisv.imeisv.typeofidentity = 0x3;
emm_msg->imeisv.imeisv.digit2 = 0x5;
emm_msg->imeisv.imeisv.digit3 = 0x7;
emm_msg->imeisv.imeisv.digit4 = 0x4;
emm_msg->imeisv.imeisv.digit5 = 0x7;
emm_msg->imeisv.imeisv.digit6 = 0x3;
emm_msg->imeisv.imeisv.digit7 = 0x0;
emm_msg->imeisv.imeisv.digit8 = 0x4;
emm_msg->imeisv.imeisv.digit9 = 0x0;
emm_msg->imeisv.imeisv.digit10 = 0x0;
emm_msg->imeisv.imeisv.digit11 = 0x7;
emm_msg->imeisv.imeisv.digit12 = 0x0;
emm_msg->imeisv.imeisv.digit13 = 0x5;
emm_msg->imeisv.imeisv.digit14 = 0x3;
emm_msg->imeisv.imeisv.digit15 = 0x0;
emm_msg->imeisv.imeisv.digit16 = 0x0;
emm_msg->imeisv.imeisv.parity = ODD_PARITY;
size += SECURITY_MODE_COMPLETE_MAXIMUM_LENGTH;
}
LOG_FUNC_RETURN (size);
}
......
......@@ -146,7 +146,7 @@ static void _security_release(emm_security_context_t *ctx);
** **
***************************************************************************/
int emm_proc_security_mode_command(int native_ksi, int ksi,
int seea, int seia, int reea, int reia)
int seea, int seia, int reea, int reia, int imeisv_request)
{
LOG_FUNC_IN;
......@@ -329,6 +329,7 @@ int emm_proc_security_mode_command(int native_ksi, int ksi,
emm_sap.u.emm_as.u.security.guti = _emm_data.guti;
emm_sap.u.emm_as.u.security.ueid = 0;
emm_sap.u.emm_as.u.security.msgType = EMM_AS_MSG_TYPE_SMC;
emm_sap.u.emm_as.u.security.imeisv_request = imeisv_request;
emm_sap.u.emm_as.u.security.emm_cause = emm_cause;
/* Setup EPS NAS security data */
emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx,
......
......@@ -174,7 +174,7 @@ int emm_proc_authentication_delete(void);
* --------------------------------------------------------------------------
*/
int emm_proc_security_mode_command(int native_ksi, int ksi, int seea, int seia,
int reea, int reia);
int reea, int reia,int imeisv_request);
/*
*---------------------------------------------------------------------------
......
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