From 8fbd1a22fc0a94bf8cc4ad66293135ec0ac01cf8 Mon Sep 17 00:00:00 2001 From: Lionel Gauthier <lionel.gauthier@eurecom.fr> Date: Fri, 10 Apr 2015 11:46:37 +0000 Subject: [PATCH] branch LG_PRE_RELEASE_0.3 reintegration git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7107 818b1a75-f10b-46b9-bf7c-635c3b92a50f --- openair-cn/OPENAIRHSS/auc/auc.h | 16 ++--- openair-cn/OPENAIRHSS/auc/fx.c | 15 +++-- openair-cn/OPENAIRHSS/auc/rijndael.c | 4 +- openair-cn/OPENAIRHSS/conf/hss.conf | 8 --- openair-cn/OPENAIRHSS/conf/hss.local.conf | 10 --- openair-cn/OPENAIRHSS/conf/hss_fd.conf | 68 -------------------- openair-cn/OPENAIRHSS/conf/hss_fd.local.conf | 68 -------------------- openair-cn/OPENAIRHSS/utils/hss_config.c | 18 +++--- 8 files changed, 28 insertions(+), 179 deletions(-) delete mode 100644 openair-cn/OPENAIRHSS/conf/hss.conf delete mode 100644 openair-cn/OPENAIRHSS/conf/hss.local.conf delete mode 100644 openair-cn/OPENAIRHSS/conf/hss_fd.conf delete mode 100644 openair-cn/OPENAIRHSS/conf/hss_fd.local.conf diff --git a/openair-cn/OPENAIRHSS/auc/auc.h b/openair-cn/OPENAIRHSS/auc/auc.h index 5b4454e4a..07aa19908 100644 --- a/openair-cn/OPENAIRHSS/auc/auc.h +++ b/openair-cn/OPENAIRHSS/auc/auc.h @@ -60,8 +60,8 @@ typedef struct { uint8_t kasme[32]; } auc_vector_t; -void RijndaelKeySchedule(u8 key[16]); -void RijndaelEncrypt(u8 in[16], u8 out[16]); +void RijndaelKeySchedule(const u8 const key[16]); +void RijndaelEncrypt(const u8 const in[16], u8 out[16]); /* Sequence number functions */ struct sqn_ue_s; @@ -77,18 +77,18 @@ struct random_state_s; void random_init(void); void generate_random(uint8_t *random, ssize_t length); -void SetOPc(u8 op_c[16]); +void SetOPc(const u8 const op_c[16]); -void f1 ( u8 k[16], u8 rand[16], u8 sqn[6], u8 amf[2], +void f1 ( const u8 const k[16], const u8 const rand[16], const u8 const sqn[6], const u8 const amf[2], u8 mac_a[8] ); -void f1star( u8 k[16], u8 rand[16], u8 sqn[6], u8 amf[2], +void f1star( const u8 const k[16], const u8 const rand[16], const u8 const sqn[6], const u8 const amf[2], u8 mac_s[8] ); -void f2345 ( u8 k[16], u8 rand[16], +void f2345 ( const u8 const k[16], const u8 const rand[16], u8 res[8], u8 ck[16], u8 ik[16], u8 ak[6] ); -void f5star( u8 k[16], u8 rand[16], +void f5star( const u8 const k[16], const u8 const rand[16], u8 ak[6] ); -void generate_autn(u8 sqn[6], u8 ak[6], u8 amf[2], u8 mac_a[8], u8 autn[16]); +void generate_autn(const u8 const sqn[6], const u8 const ak[6], const u8 const amf[2], const u8 const mac_a[8], u8 autn[16]); int generate_vector(uint64_t imsi, uint8_t key[16], uint8_t plmn[3], uint8_t sqn[6], auc_vector_t *vector); diff --git a/openair-cn/OPENAIRHSS/auc/fx.c b/openair-cn/OPENAIRHSS/auc/fx.c index 00d4770b2..41394c444 100644 --- a/openair-cn/OPENAIRHSS/auc/fx.c +++ b/openair-cn/OPENAIRHSS/auc/fx.c @@ -32,12 +32,15 @@ u8 OP[16]= { /*--------------------------- prototypes --------------------------*/ void ComputeOPc( u8 op_c[16] ); -void SetOPc(u8 op_c[16]) +void SetOPc(const u8 const op_c[16]) { memcpy(OP, op_c, 16); + printf("SetOPc: OP : %02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X ", + OP[0],OP[1],OP[2],OP[3],OP[4],OP[5],OP[6],OP[7], + OP[8],OP[9],OP[10],OP[11],OP[12],OP[13],OP[14],OP[15]); } -void generate_autn(u8 sqn[6], u8 ak[6], u8 amf[2], u8 mac_a[8], u8 autn[16]) +void generate_autn(const u8 const sqn[6], const u8 const ak[6], const u8 const amf[2], const u8 const mac_a[8], u8 autn[16]) { int i; @@ -58,7 +61,7 @@ void generate_autn(u8 sqn[6], u8 ak[6], u8 amf[2], u8 mac_a[8], u8 autn[16]) * field AMF. * *-----------------------------------------------------------------*/ -void f1 ( u8 k[16], u8 _rand[16], u8 sqn[6], u8 amf[2], +void f1 ( const u8 const k[16], const u8 const _rand[16], const u8 const sqn[6], const u8 const amf[2], u8 mac_a[8] ) { u8 op_c[16]; @@ -113,7 +116,7 @@ void f1 ( u8 k[16], u8 _rand[16], u8 sqn[6], u8 amf[2], * confidentiality key CK, integrity key IK and anonymity key AK. * *-----------------------------------------------------------------*/ -void f2345 ( u8 k[16], u8 _rand[16], +void f2345 ( const u8 const k[16], const u8 const _rand[16], u8 res[8], u8 ck[16], u8 ik[16], u8 ak[6] ) { u8 op_c[16]; @@ -190,7 +193,7 @@ void f2345 ( u8 k[16], u8 _rand[16], * field AMF. * *-----------------------------------------------------------------*/ -void f1star( u8 k[16], u8 _rand[16], u8 sqn[6], u8 amf[2], +void f1star( const u8 const k[16], const u8 const _rand[16], const u8 const sqn[6], const u8 const amf[2], u8 mac_s[8] ) { u8 op_c[16]; @@ -245,7 +248,7 @@ void f1star( u8 k[16], u8 _rand[16], u8 sqn[6], u8 amf[2], * anonymity key AK. * *-----------------------------------------------------------------*/ -void f5star( u8 k[16], u8 _rand[16], +void f5star( const u8 const k[16], const u8 const _rand[16], u8 ak[6] ) { u8 op_c[16]; diff --git a/openair-cn/OPENAIRHSS/auc/rijndael.c b/openair-cn/OPENAIRHSS/auc/rijndael.c index 1a3acb057..230e3e1f4 100644 --- a/openair-cn/OPENAIRHSS/auc/rijndael.c +++ b/openair-cn/OPENAIRHSS/auc/rijndael.c @@ -79,7 +79,7 @@ u8 Xtime[256] = { * Rijndael key schedule function. Takes 16-byte key and creates * all Rijndael's internal subkeys ready for encryption. *-----------------------------------------------------------------*/ -void RijndaelKeySchedule( u8 key[16] ) +void RijndaelKeySchedule( const u8 const key[16] ) { u8 roundConst; int i, j; @@ -188,7 +188,7 @@ void MixColumn(u8 state[4][4]) * 16-byte output (using round keys already derived from 16-byte * key). *-----------------------------------------------------------------*/ -void RijndaelEncrypt( u8 input[16], u8 output[16] ) +void RijndaelEncrypt( const u8 const input[16], u8 output[16] ) { u8 state[4][4]; int i, r; diff --git a/openair-cn/OPENAIRHSS/conf/hss.conf b/openair-cn/OPENAIRHSS/conf/hss.conf deleted file mode 100644 index a4c1370a2..000000000 --- a/openair-cn/OPENAIRHSS/conf/hss.conf +++ /dev/null @@ -1,8 +0,0 @@ -## MySQL mandatory options -MYSQL_server = "127.0.0.1"; -MYSQL_user = "hssadmin"; -MYSQL_pass = "admin"; -MYSQL_db = "oai_db"; - -## Freediameter options -FD_conf = "../conf/hss_fd.conf"; diff --git a/openair-cn/OPENAIRHSS/conf/hss.local.conf b/openair-cn/OPENAIRHSS/conf/hss.local.conf deleted file mode 100644 index 2dcb766dd..000000000 --- a/openair-cn/OPENAIRHSS/conf/hss.local.conf +++ /dev/null @@ -1,10 +0,0 @@ -## MySQL mandatory options -MYSQL_server = "127.0.0.1"; -##MYSQL_user = "root"; -##MYSQL_pass = "linux"; -MYSQL_user = "hssadmin"; -MYSQL_pass = ""; -MYSQL_db = "oai_db"; - -## Freediameter options -FD_conf = "/etc/openair-hss/hss_fd.local.conf"; diff --git a/openair-cn/OPENAIRHSS/conf/hss_fd.conf b/openair-cn/OPENAIRHSS/conf/hss_fd.conf deleted file mode 100644 index 4b93700fe..000000000 --- a/openair-cn/OPENAIRHSS/conf/hss_fd.conf +++ /dev/null @@ -1,68 +0,0 @@ -# -------- Local --------- - -# Uncomment if the framework cannot resolv it. -Identity = "UBUNTUPC.pft"; - -#ListenOn = "127.0.0.1"; - - -# TLS configuration (see previous section) -TLS_Cred = "/usr/local/etc/freeDiameter/hss.cert.pem", "/usr/local/etc/freeDiameter/hss.key.pem"; -TLS_CA = "/usr/local/etc/freeDiameter/cacert.pem"; - -# Disable use of TCP protocol (only listen and connect in SCTP) -# Default : TCP enabled -No_TCP; -#No_SCTP; - -# Disable use of IPv6 addresses (only IP) -# Default : IPv6 enabled -No_IPv6; - -# Limit the number of SCTP streams -SCTP_streams = 15; - -NoRelay; -TLS_old_method; - -# Core 2 DUO -AppServThreads = 4; - -# -------- Extensions --------- - -# Uncomment (and create rtd.conf) to specify routing table for this peer. -#LoadExtension = "rt_default.fdx" : "rtd.conf"; - -# Uncomment (and create acl.conf) to allow incoming connections from other peers. -#LoadExtension = "acl_wl.fdx" : "/usr/local/src/trunk_co/openair-cn/OPENAIRHSS/conf/acl.conf"; - -# Uncomment to display periodic state information -#LoadExtension = "dbg_monitor.fdx"; - -# Uncomment to enable an interactive Python interpreter session. -# (see doc/dbg_interactive.py.sample for more information) -#LoadExtension = "dbg_interactive.fdx"; - -# Load the RFC4005 dictionary objects -#LoadExtension = "dict_nasreq.fdx"; - -LoadExtension = "dict_nas_mipv6.fdx"; -LoadExtension = "dict_s6a.fdx"; - -# Load RFC4072 dictionary objects -#LoadExtension = "dict_eap.fdx"; - -# Load the Diameter EAP server extension (requires diameap.conf) -#LoadExtension = "app_diameap.fdx" : "diameap.conf"; - -# Load the Accounting Server extension (requires app_acct.conf) -#LoadExtension = "app_acct.fdx" : "app_acct.conf"; - -# -------- Peers --------- - -# The framework will actively attempt to establish and maintain a connection -# with the peers listed here. -# For only accepting incoming connections, see the acl_wl.fx extension. - -#ConnectPeer = "ubuntu.localdomain" { ConnectTo = "127.0.0.1"; No_TLS; }; -#ConnectPeer = "roux.test.fr" { No_TLS; }; diff --git a/openair-cn/OPENAIRHSS/conf/hss_fd.local.conf b/openair-cn/OPENAIRHSS/conf/hss_fd.local.conf deleted file mode 100644 index 2f6227d9f..000000000 --- a/openair-cn/OPENAIRHSS/conf/hss_fd.local.conf +++ /dev/null @@ -1,68 +0,0 @@ -# -------- Local --------- - -# Uncomment if the framework cannot resolv it. -Identity = "oai.eur"; - -#ListenOn = "192.168.13.177"; - - -# TLS configuration (see previous section) -TLS_Cred = "conf/hss.cert.pem","conf/hss.key.pem"; -TLS_CA = "conf/cacert.pem"; - -# Disable use of TCP protocol (only listen and connect in SCTP) -# Default : TCP enabled -No_TCP; -#No_SCTP; - -# Disable use of IPv6 addresses (only IP) -# Default : IPv6 enabled -No_IPv6; - -# Limit the number of SCTP streams -SCTP_streams = 15; - -NoRelay; -TLS_old_method; - -# Core 2 DUO -AppServThreads = 4; - -# -------- Extensions --------- - -# Uncomment (and create rtd.conf) to specify routing table for this peer. -#LoadExtension = "rt_default.fdx" : "rtd.conf"; - -# Uncomment (and create acl.conf) to allow incoming connections from other peers. -#LoadExtension = "acl_wl.fdx" : "/usr/local/src/trunk_co/openair-cn/OPENAIRHSS/conf/acl.conf"; - -# Uncomment to display periodic state information -#LoadExtension = "dbg_monitor.fdx"; - -# Uncomment to enable an interactive Python interpreter session. -# (see doc/dbg_interactive.py.sample for more information) -#LoadExtension = "dbg_interactive.fdx"; - -# Load the RFC4005 dictionary objects -#LoadExtension = "dict_nasreq.fdx"; - -LoadExtension = "dict_nas_mipv6.fdx"; -LoadExtension = "dict_s6a.fdx"; - -# Load RFC4072 dictionary objects -#LoadExtension = "dict_eap.fdx"; - -# Load the Diameter EAP server extension (requires diameap.conf) -#LoadExtension = "app_diameap.fdx" : "diameap.conf"; - -# Load the Accounting Server extension (requires app_acct.conf) -#LoadExtension = "app_acct.fdx" : "app_acct.conf"; - -# -------- Peers --------- - -# The framework will actively attempt to establish and maintain a connection -# with the peers listed here. -# For only accepting incoming connections, see the acl_wl.fx extension. - -#ConnectPeer = "ubuntu.localdomain" { ConnectTo = "127.0.0.1"; No_TLS; }; -#ConnectPeer = "roux.test.fr" { No_TLS; }; diff --git a/openair-cn/OPENAIRHSS/utils/hss_config.c b/openair-cn/OPENAIRHSS/utils/hss_config.c index 7cb7d4ca7..ad3749a85 100644 --- a/openair-cn/OPENAIRHSS/utils/hss_config.c +++ b/openair-cn/OPENAIRHSS/utils/hss_config.c @@ -65,7 +65,7 @@ int fd_g_debug_lvl = 1; /* YACC forward declarations */ extern int yyparse (struct hss_config_s *hss_config_p); -extern uint8_t OP[16]; +extern uint8_t opc[16]; static int config_parse_command_line(int argc, char *argv[], hss_config_t *hss_config_p); static int config_parse_file(hss_config_t *hss_config_p); @@ -107,14 +107,14 @@ int config_init(int argc, char *argv[], hss_config_t *hss_config_p) if (strlen(hss_config_p->operator_key) == 32) { ret = sscanf(hss_config_p->operator_key, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", - (unsigned int*)&OP[0],(unsigned int*)&OP[1], - (unsigned int*)&OP[2],(unsigned int*)&OP[3], - (unsigned int*)&OP[4],(unsigned int*)&OP[5], - (unsigned int*)&OP[6],(unsigned int*)&OP[7], - (unsigned int*)&OP[8],(unsigned int*)&OP[9], - (unsigned int*)&OP[10],(unsigned int*)&OP[11], - (unsigned int*)&OP[12],(unsigned int*)&OP[13], - (unsigned int*)&OP[14],(unsigned int*)&OP[15]); + (unsigned int*)&opc[0],(unsigned int*)&opc[1], + (unsigned int*)&opc[2],(unsigned int*)&opc[3], + (unsigned int*)&opc[4],(unsigned int*)&opc[5], + (unsigned int*)&opc[6],(unsigned int*)&opc[7], + (unsigned int*)&opc[8],(unsigned int*)&opc[9], + (unsigned int*)&opc[10],(unsigned int*)&opc[11], + (unsigned int*)&opc[12],(unsigned int*)&opc[13], + (unsigned int*)&opc[14],(unsigned int*)&opc[15]); if (ret != 16) { fprintf(stderr, -- GitLab