[PATCH] libosmocore[master]: gsup test: add decoding test for UMTS IEs

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Wed Feb 22 01:56:21 UTC 2017


Review at  https://gerrit.osmocom.org/1862

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
---
M tests/gsup/gsup_test.c
M tests/gsup/gsup_test.ok
2 files changed, 61 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/62/1862/1

diff --git a/tests/gsup/gsup_test.c b/tests/gsup/gsup_test.c
index 7af16b7..42e7b81 100644
--- a/tests/gsup/gsup_test.c
+++ b/tests/gsup/gsup_test.c
@@ -114,6 +114,60 @@
 		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 @@
 			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 @@
 					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 1285897..a0b3f35 100644
--- a/tests/gsup/gsup_test.ok
+++ b/tests/gsup/gsup_test.ok
@@ -11,4 +11,6 @@
   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.

-- 
To view, visit https://gerrit.osmocom.org/1862
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6fddf8d7ce97137b0a585d365807bcaf90a319d0
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list