|
|
|
@ -42,12 +42,10 @@
|
|
|
|
|
DEFINES
|
|
|
|
|
*******************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
|
TYPEDEFS
|
|
|
|
|
*******************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
|
DECLARATIONS
|
|
|
|
|
*******************************************************************************/
|
|
|
|
@ -59,9 +57,7 @@
|
|
|
|
|
|
|
|
|
|
Document Reference: 35.206 v10.0.0 Annex 3
|
|
|
|
|
*********************************************************************/
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_compute_opc(uint8 *k,
|
|
|
|
|
uint8 *op,
|
|
|
|
|
uint8 *op_c);
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_compute_opc(uint8* k, uint8* op, uint8* op_c);
|
|
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
|
Name: liblte_security_generate_k_asme
|
|
|
|
@ -74,13 +70,8 @@ LIBLTE_ERROR_ENUM liblte_compute_opc(uint8 *k,
|
|
|
|
|
// Enums
|
|
|
|
|
// Structs
|
|
|
|
|
// Functions
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_generate_k_asme(uint8 *ck,
|
|
|
|
|
uint8 *ik,
|
|
|
|
|
uint8 *ak,
|
|
|
|
|
uint8 *sqn,
|
|
|
|
|
uint16 mcc,
|
|
|
|
|
uint16 mnc,
|
|
|
|
|
uint8 *k_asme);
|
|
|
|
|
LIBLTE_ERROR_ENUM
|
|
|
|
|
liblte_security_generate_k_asme(uint8* ck, uint8* ik, uint8* ak, uint8* sqn, uint16 mcc, uint16 mnc, uint8* k_asme);
|
|
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
|
Name: liblte_security_generate_k_enb
|
|
|
|
@ -93,18 +84,11 @@ LIBLTE_ERROR_ENUM liblte_security_generate_k_asme(uint8 *ck,
|
|
|
|
|
// Enums
|
|
|
|
|
// Structs
|
|
|
|
|
// Functions
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_generate_k_enb(uint8 *k_asme,
|
|
|
|
|
uint32 nas_count,
|
|
|
|
|
uint8 *k_enb);
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_generate_k_enb(uint8* k_asme, uint32 nas_count, uint8* k_enb);
|
|
|
|
|
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_generate_k_enb_star(uint8 *k_enb,
|
|
|
|
|
uint32 pci,
|
|
|
|
|
uint32_t earfcn,
|
|
|
|
|
uint8 *k_enb_star);
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_generate_k_enb_star(uint8* k_enb, uint32 pci, uint32_t earfcn, uint8* k_enb_star);
|
|
|
|
|
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_generate_nh( uint8_t *k_asme,
|
|
|
|
|
uint8_t *sync,
|
|
|
|
|
uint8_t *nh);
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_generate_nh(uint8_t* k_asme, uint8_t* sync, uint8_t* nh);
|
|
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
|
Name: liblte_security_generate_k_nas
|
|
|
|
@ -115,33 +99,29 @@ LIBLTE_ERROR_ENUM liblte_security_generate_nh( uint8_t *k_asme,
|
|
|
|
|
*********************************************************************/
|
|
|
|
|
// Defines
|
|
|
|
|
// Enums
|
|
|
|
|
typedef enum{
|
|
|
|
|
LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_EEA0 = 0,
|
|
|
|
|
LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_128_EEA1,
|
|
|
|
|
LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_128_EEA2,
|
|
|
|
|
LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_N_ITEMS,
|
|
|
|
|
}LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_ENUM;
|
|
|
|
|
static const char liblte_security_ciphering_algorithm_id_text[LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_N_ITEMS][20] = {"EEA0",
|
|
|
|
|
"128-EEA1",
|
|
|
|
|
"128-EEA2"};
|
|
|
|
|
typedef enum{
|
|
|
|
|
LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_EIA0 = 0,
|
|
|
|
|
LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_128_EIA1,
|
|
|
|
|
LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_128_EIA2,
|
|
|
|
|
LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_N_ITEMS,
|
|
|
|
|
}LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_ENUM;
|
|
|
|
|
static const char liblte_security_integrity_algorithm_id_text[LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_N_ITEMS][20] = {"EIA0",
|
|
|
|
|
"128-EIA1",
|
|
|
|
|
"128-EIA2"};
|
|
|
|
|
typedef enum {
|
|
|
|
|
LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_EEA0 = 0,
|
|
|
|
|
LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_128_EEA1,
|
|
|
|
|
LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_128_EEA2,
|
|
|
|
|
LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_N_ITEMS,
|
|
|
|
|
} LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_ENUM;
|
|
|
|
|
static const char liblte_security_ciphering_algorithm_id_text[LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_N_ITEMS][20] = {
|
|
|
|
|
"EEA0", "128-EEA1", "128-EEA2"};
|
|
|
|
|
typedef enum {
|
|
|
|
|
LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_EIA0 = 0,
|
|
|
|
|
LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_128_EIA1,
|
|
|
|
|
LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_128_EIA2,
|
|
|
|
|
LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_N_ITEMS,
|
|
|
|
|
} LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_ENUM;
|
|
|
|
|
static const char liblte_security_integrity_algorithm_id_text[LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_N_ITEMS][20] = {
|
|
|
|
|
"EIA0", "128-EIA1", "128-EIA2"};
|
|
|
|
|
// Structs
|
|
|
|
|
// Functions
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_generate_k_nas(uint8 *k_asme,
|
|
|
|
|
LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_ENUM enc_alg_id,
|
|
|
|
|
LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_ENUM int_alg_id,
|
|
|
|
|
uint8 *k_nas_enc,
|
|
|
|
|
uint8 *k_nas_int);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_generate_k_nas(uint8* k_asme,
|
|
|
|
|
LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_ENUM enc_alg_id,
|
|
|
|
|
LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_ENUM int_alg_id,
|
|
|
|
|
uint8* k_nas_enc,
|
|
|
|
|
uint8* k_nas_int);
|
|
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
|
Name: liblte_security_generate_k_rrc
|
|
|
|
@ -154,11 +134,11 @@ LIBLTE_ERROR_ENUM liblte_security_generate_k_nas(uint8
|
|
|
|
|
// Enums
|
|
|
|
|
// Structs
|
|
|
|
|
// Functions
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_generate_k_rrc(uint8 *k_enb,
|
|
|
|
|
LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_ENUM enc_alg_id,
|
|
|
|
|
LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_ENUM int_alg_id,
|
|
|
|
|
uint8 *k_rrc_enc,
|
|
|
|
|
uint8 *k_rrc_int);
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_generate_k_rrc(uint8* k_enb,
|
|
|
|
|
LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_ENUM enc_alg_id,
|
|
|
|
|
LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_ENUM int_alg_id,
|
|
|
|
|
uint8* k_rrc_enc,
|
|
|
|
|
uint8* k_rrc_int);
|
|
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
|
Name: liblte_security_generate_k_up
|
|
|
|
@ -172,11 +152,11 @@ LIBLTE_ERROR_ENUM liblte_security_generate_k_rrc(uint8
|
|
|
|
|
// Enums
|
|
|
|
|
// Structs
|
|
|
|
|
// Functions
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_generate_k_up(uint8 *k_enb,
|
|
|
|
|
LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_ENUM enc_alg_id,
|
|
|
|
|
LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_ENUM int_alg_id,
|
|
|
|
|
uint8 *k_up_enc,
|
|
|
|
|
uint8 *k_up_int);
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_generate_k_up(uint8* k_enb,
|
|
|
|
|
LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_ENUM enc_alg_id,
|
|
|
|
|
LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_ENUM int_alg_id,
|
|
|
|
|
uint8* k_up_enc,
|
|
|
|
|
uint8* k_up_int);
|
|
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
|
Name: liblte_security_128_eia2
|
|
|
|
@ -188,24 +168,15 @@ LIBLTE_ERROR_ENUM liblte_security_generate_k_up(uint8
|
|
|
|
|
RFC4493
|
|
|
|
|
*********************************************************************/
|
|
|
|
|
// Defines
|
|
|
|
|
#define LIBLTE_SECURITY_DIRECTION_UPLINK 0
|
|
|
|
|
#define LIBLTE_SECURITY_DIRECTION_UPLINK 0
|
|
|
|
|
#define LIBLTE_SECURITY_DIRECTION_DOWNLINK 1
|
|
|
|
|
// Enums
|
|
|
|
|
// Structs
|
|
|
|
|
// Functions
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_128_eia2(uint8 *key,
|
|
|
|
|
uint32 count,
|
|
|
|
|
uint8 bearer,
|
|
|
|
|
uint8 direction,
|
|
|
|
|
uint8 *msg,
|
|
|
|
|
uint32 msg_len,
|
|
|
|
|
uint8 *mac);
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_128_eia2(uint8 *key,
|
|
|
|
|
uint32 count,
|
|
|
|
|
uint8 bearer,
|
|
|
|
|
uint8 direction,
|
|
|
|
|
LIBLTE_BIT_MSG_STRUCT *msg,
|
|
|
|
|
uint8 *mac);
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_128_eia2(
|
|
|
|
|
uint8* key, uint32 count, uint8 bearer, uint8 direction, uint8* msg, uint32 msg_len, uint8* mac);
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_128_eia2(
|
|
|
|
|
uint8* key, uint32 count, uint8 bearer, uint8 direction, LIBLTE_BIT_MSG_STRUCT* msg, uint8* mac);
|
|
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
|
Name: liblte_security_encryption_eea1
|
|
|
|
@ -217,13 +188,8 @@ LIBLTE_ERROR_ENUM liblte_security_128_eia2(uint8 *key,
|
|
|
|
|
Specification of the 3GPP Confidentiality and
|
|
|
|
|
Integrity Algorithms UEA2 & UIA2 D1 v2.1
|
|
|
|
|
*********************************************************************/
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_encryption_eea1(uint8 *key,
|
|
|
|
|
uint32 count,
|
|
|
|
|
uint8 bearer,
|
|
|
|
|
uint8 direction,
|
|
|
|
|
uint8 *msg,
|
|
|
|
|
uint32 msg_len,
|
|
|
|
|
uint8 *out);
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_encryption_eea1(
|
|
|
|
|
uint8* key, uint32 count, uint8 bearer, uint8 direction, uint8* msg, uint32 msg_len, uint8* out);
|
|
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
|
Name: liblte_security_decryption_eea1
|
|
|
|
@ -235,13 +201,8 @@ LIBLTE_ERROR_ENUM liblte_security_encryption_eea1(uint8 *key,
|
|
|
|
|
Specification of the 3GPP Confidentiality and
|
|
|
|
|
Integrity Algorithms UEA2 & UIA2 D1 v2.1
|
|
|
|
|
*********************************************************************/
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_decryption_eea1(uint8 *key,
|
|
|
|
|
uint32 count,
|
|
|
|
|
uint8 bearer,
|
|
|
|
|
uint8 direction,
|
|
|
|
|
uint8 *ct,
|
|
|
|
|
uint32 ct_len,
|
|
|
|
|
uint8 *out);
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_decryption_eea1(
|
|
|
|
|
uint8* key, uint32 count, uint8 bearer, uint8 direction, uint8* ct, uint32 ct_len, uint8* out);
|
|
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
|
Name: liblte_security_encryption_eea2
|
|
|
|
@ -250,13 +211,8 @@ LIBLTE_ERROR_ENUM liblte_security_decryption_eea1(uint8 *key,
|
|
|
|
|
|
|
|
|
|
Document Reference: 33.401 v13.1.0 Annex B.1.3
|
|
|
|
|
*********************************************************************/
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_encryption_eea2(uint8 *key,
|
|
|
|
|
uint32 count,
|
|
|
|
|
uint8 bearer,
|
|
|
|
|
uint8 direction,
|
|
|
|
|
uint8 *msg,
|
|
|
|
|
uint32 msg_len,
|
|
|
|
|
uint8 *out);
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_encryption_eea2(
|
|
|
|
|
uint8* key, uint32 count, uint8 bearer, uint8 direction, uint8* msg, uint32 msg_len, uint8* out);
|
|
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
|
Name: liblte_security_decryption_eea2
|
|
|
|
@ -265,14 +221,8 @@ LIBLTE_ERROR_ENUM liblte_security_encryption_eea2(uint8 *key,
|
|
|
|
|
|
|
|
|
|
Document Reference: 33.401 v13.1.0 Annex B.1.3
|
|
|
|
|
*********************************************************************/
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_decryption_eea2(uint8 *key,
|
|
|
|
|
uint32 count,
|
|
|
|
|
uint8 bearer,
|
|
|
|
|
uint8 direction,
|
|
|
|
|
uint8 *ct,
|
|
|
|
|
uint32 ct_len,
|
|
|
|
|
uint8 *out);
|
|
|
|
|
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_decryption_eea2(
|
|
|
|
|
uint8* key, uint32 count, uint8 bearer, uint8 direction, uint8* ct, uint32 ct_len, uint8* out);
|
|
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
|
Name: liblte_security_milenage_f1
|
|
|
|
@ -288,12 +238,7 @@ LIBLTE_ERROR_ENUM liblte_security_decryption_eea2(uint8 *key,
|
|
|
|
|
// Enums
|
|
|
|
|
// Structs
|
|
|
|
|
// Functions
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_milenage_f1(uint8 *k,
|
|
|
|
|
uint8 *op,
|
|
|
|
|
uint8 *rand,
|
|
|
|
|
uint8 *sqn,
|
|
|
|
|
uint8 *amf,
|
|
|
|
|
uint8 *mac_a);
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_milenage_f1(uint8* k, uint8* op, uint8* rand, uint8* sqn, uint8* amf, uint8* mac_a);
|
|
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
|
Name: liblte_security_milenage_f1_star
|
|
|
|
@ -309,12 +254,8 @@ LIBLTE_ERROR_ENUM liblte_security_milenage_f1(uint8 *k,
|
|
|
|
|
// Enums
|
|
|
|
|
// Structs
|
|
|
|
|
// Functions
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_milenage_f1_star(uint8 *k,
|
|
|
|
|
uint8 *op,
|
|
|
|
|
uint8 *rand,
|
|
|
|
|
uint8 *sqn,
|
|
|
|
|
uint8 *amf,
|
|
|
|
|
uint8 *mac_s);
|
|
|
|
|
LIBLTE_ERROR_ENUM
|
|
|
|
|
liblte_security_milenage_f1_star(uint8* k, uint8* op, uint8* rand, uint8* sqn, uint8* amf, uint8* mac_s);
|
|
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
|
Name: liblte_security_milenage_f2345
|
|
|
|
@ -330,13 +271,8 @@ LIBLTE_ERROR_ENUM liblte_security_milenage_f1_star(uint8 *k,
|
|
|
|
|
// Enums
|
|
|
|
|
// Structs
|
|
|
|
|
// Functions
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_milenage_f2345(uint8 *k,
|
|
|
|
|
uint8 *op,
|
|
|
|
|
uint8 *rand,
|
|
|
|
|
uint8 *res,
|
|
|
|
|
uint8 *ck,
|
|
|
|
|
uint8 *ik,
|
|
|
|
|
uint8 *ak);
|
|
|
|
|
LIBLTE_ERROR_ENUM
|
|
|
|
|
liblte_security_milenage_f2345(uint8* k, uint8* op, uint8* rand, uint8* res, uint8* ck, uint8* ik, uint8* ak);
|
|
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
|
Name: liblte_security_milenage_f5_star
|
|
|
|
@ -351,9 +287,6 @@ LIBLTE_ERROR_ENUM liblte_security_milenage_f2345(uint8 *k,
|
|
|
|
|
// Enums
|
|
|
|
|
// Structs
|
|
|
|
|
// Functions
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_milenage_f5_star(uint8 *k,
|
|
|
|
|
uint8 *op,
|
|
|
|
|
uint8 *rand,
|
|
|
|
|
uint8 *ak);
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_milenage_f5_star(uint8* k, uint8* op, uint8* rand, uint8* ak);
|
|
|
|
|
|
|
|
|
|
#endif // SRSLTE_LIBLTE_SECURITY_H
|
|
|
|
|