Security algorithms selection

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5623 818b1a75-f10b-46b9-bf7c-635c3b92a50f
This commit is contained in:
Lionel Gauthier
2014-07-29 13:55:03 +00:00
parent 56458e72ac
commit 093de6dfe7
6 changed files with 112 additions and 33 deletions
@@ -257,6 +257,9 @@ int mme_api_get_emm_config(mme_api_emm_config_t *config,
int mme_api_get_emm_config(mme_api_emm_config_t *config)
#endif
{
#if defined(EPC_BUILD)
int i;
#endif
LOG_FUNC_IN;
config->gummei.plmn.MCCdigit1 = 2;
@@ -275,6 +278,10 @@ int mme_api_get_emm_config(mme_api_emm_config_t *config)
if (mme_config_p->unauthenticated_imsi_supported != 0) {
config->features |= MME_API_UNAUTHENTICATED_IMSI;
}
for (i = 0 ; i < 8; i++) {
config->prefered_integrity_algorithm[i] = mme_config_p->nas_config.prefered_integrity_algorithm[i];
config->prefered_ciphering_algorithm[i] = mme_config_p->nas_config.prefered_ciphering_algorithm[i];
}
#else
config->features = MME_API_EMERGENCY_ATTACH | MME_API_UNAUTHENTICATED_IMSI;
#endif
@@ -89,6 +89,8 @@ typedef enum mme_api_ip_version_e {
typedef struct mme_api_emm_config_s {
mme_api_feature_t features; /* Supported features */
gummei_t gummei; /* EPS Globally Unique MME Identity */
uint8_t prefered_integrity_algorithm[8];// choice in NAS_SECURITY_ALGORITHMS_EIA0, etc
uint8_t prefered_ciphering_algorithm[8];// choice in NAS_SECURITY_ALGORITHMS_EEA0, etc
} mme_api_emm_config_t;
/*
@@ -382,18 +382,20 @@ int nas_message_decode(
LOG_FUNC_RETURN (TLV_DECODE_BUFFER_TOO_SHORT);
}
else if (size > 1) {
if (emm_security_context) {
#if defined(NAS_MME)
if (emm_security_context->ul_count.seq_num > msg->header.sequence_number) {
emm_security_context->ul_count.overflow += 1;
}
emm_security_context->ul_count.seq_num = msg->header.sequence_number;
if (emm_security_context->ul_count.seq_num > msg->header.sequence_number) {
emm_security_context->ul_count.overflow += 1;
}
emm_security_context->ul_count.seq_num = msg->header.sequence_number;
#else
if (emm_security_context->dl_count.seq_num > msg->header.sequence_number) {
emm_security_context->dl_count.overflow += 1;
}
emm_security_context->dl_count.seq_num = msg->header.sequence_number;
if (emm_security_context->dl_count.seq_num > msg->header.sequence_number) {
emm_security_context->dl_count.overflow += 1;
}
emm_security_context->dl_count.seq_num = msg->header.sequence_number;
#endif
}
/* Compute offset of the sequence number field */
int offset = size - sizeof(UInt8_t);
/* Compute the NAS message authentication code */