summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-02-21 15:53:20 +0100
committerHarald Welte <laforge@gnumonks.org>2017-02-22 07:29:46 +0000
commitabb23698d6363e9be368a24c034f5cfa7015a829 (patch)
treeb4b30457dd49f94db9688b5d30850b52df44b296 /tests
parent3b8cb39e7cf4b49ada8fd8135bed9d5f1a8e405a (diff)
gsup test: add decoding test for UMTS IEs
This would have caught the wrong expectation of AUTS' length fixed recently (3a5ca647c531b7761dc6c555e5e0cabc972bd3ac). Besides AUTS, add AUTN, RES, CK, IK which were also not tested yet. Change-Id: I6fddf8d7ce97137b0a585d365807bcaf90a319d0 Related: OS#1593
Diffstat (limited to 'tests')
-rw-r--r--tests/gsup/gsup_test.c60
-rw-r--r--tests/gsup/gsup_test.ok2
2 files changed, 61 insertions, 1 deletions
diff --git a/tests/gsup/gsup_test.c b/tests/gsup/gsup_test.c
index 7af16b76..42e7b81e 100644
--- a/tests/gsup/gsup_test.c
+++ b/tests/gsup/gsup_test.c
@@ -114,6 +114,60 @@ static void test_gsup_messages_dec_enc(void)
0x07, 0x00,
};
+ static const uint8_t send_auth_info_res_umts[] = {
+ 0x0a,
+ TEST_IMSI_IE,
+ 0x03, 0x62, /* Auth tuple */
+ 0x20, 0x10, /* rand */
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
+ 0x21, 0x04, /* sres */
+ 0x21, 0x22, 0x23, 0x24,
+ 0x22, 0x08, /* kc */
+ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
+ 0x23, 0x10, /* IK (UMTS) */
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
+ 0x24, 0x10, /* CK (UMTS) */
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
+ 0x25, 0x10, /* AUTN (UMTS) */
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
+ 0x25, 0x08, /* RES (UMTS) */
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x03, 0x22, /* Auth tuple */
+ 0x20, 0x10, /* rand */
+ 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8,
+ 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0x10,
+ 0x21, 0x04, /* sres */
+ 0xb1, 0xb2, 0xb3, 0xb4,
+ 0x22, 0x08, /* kc */
+ 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8,
+ 0x23, 0x10, /* IK (UMTS) */
+ 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8,
+ 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xd0,
+ 0x24, 0x10, /* CK (UMTS) */
+ 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8,
+ 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xe0,
+ 0x25, 0x10, /* AUTN (UMTS) */
+ 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
+ 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, 0xf0,
+ 0x25, 0x08, /* RES (UMTS) */
+ 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
+ };
+
+ static const uint8_t send_auth_info_req_auts[] = {
+ 0x08,
+ TEST_IMSI_IE,
+ 0x26, 0x0e,
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
+ 0x20, 0x10,
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
+ };
+
static const struct test {
char *name;
const uint8_t *data;
@@ -143,6 +197,10 @@ static void test_gsup_messages_dec_enc(void)
purge_ms_err, sizeof(purge_ms_err)},
{"Purge MS Result",
purge_ms_res, sizeof(purge_ms_res)},
+ {"Send Authentication Info Result with IK, CK, AUTN and RES (UMTS)",
+ send_auth_info_req_auts, sizeof(send_auth_info_req_auts)},
+ {"Send Authentication Info Request with AUTS and RAND (UMTS)",
+ send_auth_info_req_auts, sizeof(send_auth_info_req_auts)},
};
printf("Test GSUP message decoding/encoding\n");
@@ -192,7 +250,7 @@ static void test_gsup_messages_dec_enc(void)
osmo_hexdump(t->data + j, ie_end - j));
OSMO_ASSERT(j <= ie_end - 2);
- OSMO_ASSERT(t->data[j+0] <= OSMO_GSUP_KC_IE);
+ OSMO_ASSERT(t->data[j+0] <= OSMO_GSUP_CN_DOMAIN_IE);
OSMO_ASSERT(t->data[j+1] <= ie_end - j - 2);
ie_end = j;
diff --git a/tests/gsup/gsup_test.ok b/tests/gsup/gsup_test.ok
index 1285897c..a0b3f354 100644
--- a/tests/gsup/gsup_test.ok
+++ b/tests/gsup/gsup_test.ok
@@ -11,4 +11,6 @@ Test GSUP message decoding/encoding
Testing Purge MS Request
Testing Purge MS Error
Testing Purge MS Result
+ Testing Send Authentication Info Result with IK, CK, AUTN and RES (UMTS)
+ Testing Send Authentication Info Request with AUTS and RAND (UMTS)
Done.