gbproxy_test.c: fix mobile identity test data

Fix the final nibble of all IMSI BCD digits to 0xf, since it is a filler digit.

The encoded IMSI has an even amount of digits (14) and must contain a 0xf
filler nibble at the end. The test data looked correct due to repeated '1'
digits.

wrong hex: 11 12 13 14 15 16 17 18
correct:   11 12 13 14 15 16 17 f8
order:     1T 32 54 76 98 ba dc Xe  T = type, X = filler, 1..e = 14 digits

This error was found when applying the new osmo_mobile_identity API.

Change-Id: Ia006a3da6779ad1984f642e8ea29790a4daeb8b9
This commit is contained in:
Neels Hofmeyr 2020-05-29 17:05:40 +02:00 committed by laforge
parent 6a32db9460
commit 17d6134a3c
2 changed files with 271 additions and 271 deletions

View File

@ -260,7 +260,7 @@ static const unsigned char dtap_attach_req3[] = {
static const unsigned char dtap_attach_req4[] = {
0x08, 0x01, 0x02, 0xf5, 0xe0, 0x21, 0x08, 0x02,
0x08, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x11, 0x22, 0x33, 0x40, 0x50, 0x60, 0x19,
0xf8, 0x11, 0x22, 0x33, 0x40, 0x50, 0x60, 0x19,
0x18, 0xb3, 0x43, 0x2b, 0x25, 0x96, 0x62, 0x00,
0x60, 0x80, 0x9a, 0xc2, 0xc6, 0x62, 0x00, 0x60,
0x80, 0xba, 0xc8, 0xc6, 0x62, 0x00, 0x60, 0x80,
@ -275,19 +275,19 @@ static const unsigned char dtap_identity_req[] = {
/* DTAP - Identity Response */
static const unsigned char dtap_identity_resp[] = {
0x08, 0x16, 0x08, 0x11, 0x12, 0x13, 0x14, 0x15,
0x16, 0x17, 0x18
0x16, 0x17, 0xf8
};
/* DTAP - Identity Response, IMSI 2 */
static const unsigned char dtap_identity2_resp[] = {
0x08, 0x16, 0x08, 0x11, 0x12, 0x99, 0x99, 0x99,
0x16, 0x17, 0x18
0x16, 0x17, 0xf8
};
/* DTAP - Identity Response, IMSI 3 */
static const unsigned char dtap_identity3_resp[] = {
0x08, 0x16, 0x08, 0x11, 0x12, 0x99, 0x99, 0x99,
0x26, 0x27, 0x28
0x26, 0x27, 0xf8
};
/* DTAP - Attach Accept */
@ -1650,7 +1650,7 @@ static void test_gbproxy_ra_patching()
const uint32_t local_tlli = 0xefe2b700;
const uint32_t foreign_tlli = 0xbbc54679;
const uint32_t foreign_tlli2 = 0xbb00beef;
const uint8_t imsi[] = {0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18};
const uint8_t imsi[] = {0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0xf8};
const char *patch_re = "^9898|^121314";
struct gbproxy_link_info *link_info;
struct gbproxy_peer *peer;
@ -1992,8 +1992,8 @@ static void test_gbproxy_ptmsi_assignment()
const uint32_t foreign_tlli1 = 0x8000dead;
const uint32_t foreign_tlli2 = 0x8000beef;
const uint8_t imsi1[] = {0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18};
const uint8_t imsi2[] = {0x11, 0x12, 0x99, 0x99, 0x99, 0x16, 0x17, 0x18};
const uint8_t imsi1[] = {0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0xf8};
const uint8_t imsi2[] = {0x11, 0x12, 0x99, 0x99, 0x99, 0x16, 0x17, 0xf8};
struct gbproxy_link_info *link_info, *link_info2;
struct gbproxy_peer *peer;
@ -2224,7 +2224,7 @@ static void test_gbproxy_ptmsi_patching()
const uint32_t foreign_bss_tlli = 0x8000dead;
const uint8_t imsi[] = {0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18};
const uint8_t imsi[] = {0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0xf8};
struct gbproxy_link_info *link_info;
struct gbproxy_peer *peer;
unsigned bss_nu = 0;
@ -2550,7 +2550,7 @@ static void test_gbproxy_ptmsi_patching_bad_cases()
const uint32_t foreign_bss_tlli = 0x8000dead;
const uint8_t imsi[] = {0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18};
const uint8_t imsi[] = {0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0xf8};
struct gbproxy_link_info *link_info;
struct gbproxy_peer *peer;
unsigned bss_nu = 0;
@ -2737,7 +2737,7 @@ static void test_gbproxy_imsi_acquisition()
const uint32_t foreign_bss_tlli = 0x8000dead;
const uint32_t other_bss_tlli = 0x8000beef;
const uint8_t imsi[] = {0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18};
const uint8_t imsi[] = {0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0xf8};
struct gbproxy_link_info *link_info;
struct gbproxy_peer *peer;
unsigned bss_nu = 0;
@ -3058,9 +3058,9 @@ static void test_gbproxy_secondary_sgsn()
const uint32_t local_bss_tlli3 = 0xc0dead05;
const uint32_t foreign_bss_tlli3 = 0x8000feed;
const uint8_t imsi1[] = {0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18};
const uint8_t imsi2[] = {0x11, 0x12, 0x99, 0x99, 0x99, 0x16, 0x17, 0x18};
const uint8_t imsi3[] = {0x11, 0x12, 0x99, 0x99, 0x99, 0x26, 0x27, 0x28};
const uint8_t imsi1[] = {0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0xf8};
const uint8_t imsi2[] = {0x11, 0x12, 0x99, 0x99, 0x99, 0x16, 0x17, 0xf8};
const uint8_t imsi3[] = {0x11, 0x12, 0x99, 0x99, 0x99, 0x26, 0x27, 0xf8};
struct gbproxy_link_info *link_info;
struct gbproxy_link_info *other_info;
struct gbproxy_peer *peer;
@ -3542,7 +3542,7 @@ static void test_gbproxy_keep_info()
const uint32_t local_tlli = 0xefe2b700;
const uint32_t foreign_tlli = 0xafe2b700;
const uint8_t imsi[] = {0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18};
const uint8_t imsi[] = {0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0xf8};
struct gbproxy_link_info *link_info, *link_info2;
struct gbproxy_peer *peer;
unsigned bss_nu = 0;
@ -4532,8 +4532,8 @@ static void test_gbproxy_tlli_expire(void)
struct gbproxy_config cfg = {0};
struct gbproxy_peer *peer;
const char *err_msg = NULL;
const uint8_t imsi1[] = { GSM_MI_TYPE_IMSI, 0x23, 0x24, 0x25, 0x26 };
const uint8_t imsi2[] = { GSM_MI_TYPE_IMSI, 0x26, 0x27, 0x28, 0x29 };
const uint8_t imsi1[] = { GSM_MI_TYPE_IMSI, 0x23, 0x24, 0x25, 0xf6 };
const uint8_t imsi2[] = { GSM_MI_TYPE_IMSI, 0x26, 0x27, 0x28, 0xf9 };
const uint8_t imsi3[] = { GSM_MI_TYPE_IMSI | 0x10, 0x32, 0x54, 0x76, 0xf8 };
const uint32_t tlli1 = 1234 | 0xc0000000;
const uint32_t tlli2 = 5678 | 0xc0000000;

File diff suppressed because it is too large Load Diff