Attention is currently required from: laforge, fixeria.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/libosmocore/+/31452
to look at the new patch set (#3).
Change subject: New unit test for XOR-2G authentication
......................................................................
New unit test for XOR-2G authentication
Let's test if the XOR-2G algorithm does what it's supposed to do.
Change-Id: I7014258751624ff18c51912b6348c3cd876bb23f
---
M tests/Makefile.am
A tests/auth/xor2g_test.c
A tests/auth/xor2g_test.ok
M tests/testsuite.at
4 files changed, 105 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/52/31452/3
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/31452
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I7014258751624ff18c51912b6348c3cd876bb23f
Gerrit-Change-Number: 31452
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newpatchset
Attention is currently required from: fixeria.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/31452 )
Change subject: New unit test for XOR-2G authentication
......................................................................
Patch Set 2:
(1 comment)
File tests/Makefile.am:
https://gerrit.osmocom.org/c/libosmocore/+/31452/comment/7df3bee3_410ee109
PS1, Line 360: EXTRA_DIST
> You need to add 'auth/xor2g_test.ok' here.
Done
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/31452
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I7014258751624ff18c51912b6348c3cd876bb23f
Gerrit-Change-Number: 31452
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 22 Feb 2023 08:16:06 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: comment
Attention is currently required from: laforge.
Jenkins Builder has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/31452 )
Change subject: New unit test for XOR-2G authentication
......................................................................
Patch Set 2:
(1 comment)
File tests/auth/xor2g_test.c:
Robot Comment from checkpatch (run ID jenkins-gerrit-lint-3896):
https://gerrit.osmocom.org/c/libosmocore/+/31452/comment/21ccb37f_93ae48be
PS2, Line 66: for (int i = 0; i < sizeof(_rand); i++) {
braces {} are not necessary for single statement blocks
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/31452
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I7014258751624ff18c51912b6348c3cd876bb23f
Gerrit-Change-Number: 31452
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Wed, 22 Feb 2023 08:15:55 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: laforge.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/libosmocore/+/31452
to look at the new patch set (#2).
Change subject: New unit test for XOR-2G authentication
......................................................................
New unit test for XOR-2G authentication
Let's test if the XOR-2G algorithm does what it's supposed to do.
Change-Id: I7014258751624ff18c51912b6348c3cd876bb23f
---
M tests/Makefile.am
A tests/auth/xor2g_test.c
A tests/auth/xor2g_test.ok
M tests/testsuite.at
4 files changed, 106 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/52/31452/2
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/31452
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I7014258751624ff18c51912b6348c3cd876bb23f
Gerrit-Change-Number: 31452
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newpatchset
Attention is currently required from: laforge.
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/31452 )
Change subject: New unit test for XOR-2G authentication
......................................................................
Patch Set 1:
(1 comment)
File tests/Makefile.am:
https://gerrit.osmocom.org/c/libosmocore/+/31452/comment/9cb94f4b_81ef4459
PS1, Line 360: EXTRA_DIST
You need to add 'auth/xor2g_test.ok' here.
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/31452
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I7014258751624ff18c51912b6348c3cd876bb23f
Gerrit-Change-Number: 31452
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Wed, 22 Feb 2023 08:03:22 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: laforge, pespin.
neels has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/31431 )
Change subject: context map: introduce RUA and SCCP FSMs to fix leaks
......................................................................
Patch Set 5:
(2 comments)
File include/osmocom/hnbgw/context_map.h:
https://gerrit.osmocom.org/c/osmo-hnbgw/+/31431/comment/9590d2bc_29e51994
PS5, Line 22: enum map_rua_fsm_event {
> not critical, but this is where the ISO/OSI style request/indication naming could be useful to clear […]
(hold on, the PLEASE_DISCONNECT should not be there anymore. Leftover from an intermediate patch state. will fix.)
RUA_EV_RX_ means a RUA PDU has arrived from HNB.
SCCP_EV_RX_ means an SCCP PDU has arrived from CN.
the _EV_TX_ means that one FSM asks the other to forward a RANAP PDU to the remote peer.
I am not entirely clear how to apply the OSI terms to the FSM event names.
So in the SCCP code,
- the SCCP N_DATA towards CN is always sent as an N-Data.Request prim to osmo_sccp_user_sap_down().
- From the CN, we always receive an N-Data.Indication
In the RUA API, these terms apparently are not used. At least I don't see them in the code.
Would this be correct?
RUA HNBGW SCCP CN
| --MAP_SCCP_EV_TX_REQUEST----> | --N-Data.Request-> |
| <--MAP_RUA_EV_TX_INDICATION-- | <-N-Data.Ind------ |
(I want the "RX" name to be reserved for PDUs from a remote peer, and "TX" for PDU forwarding between internal FSMs.)
File src/osmo-hnbgw/hnbgw_rua.c:
https://gerrit.osmocom.org/c/osmo-hnbgw/+/31431/comment/bce704c5_aec1ff88
PS5, Line 183: { RUA_ProcedureCode_id_Connect, "id-Connect" },
> No, the procdures are not called "id-Connect", but "CONNECT". See the section headlines of 25.468 9. […]
ah ok, was not aware of that!
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/31431
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: I6ff7e36532ff57c6f2d3e7e419dd22ef27dafd19
Gerrit-Change-Number: 31431
Gerrit-PatchSet: 5
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 21 Feb 2023 22:07:55 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: neels <nhofmeyr(a)sysmocom.de>
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: comment
Jenkins Builder has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/31452 )
Change subject: New unit test for XOR-2G authentication
......................................................................
Patch Set 1:
(1 comment)
File tests/auth/xor2g_test.c:
Robot Comment from checkpatch (run ID jenkins-gerrit-lint-3894):
https://gerrit.osmocom.org/c/libosmocore/+/31452/comment/e57fbd25_a119215c
PS1, Line 66: for (int i = 0; i < sizeof(_rand); i++) {
braces {} are not necessary for single statement blocks
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/31452
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I7014258751624ff18c51912b6348c3cd876bb23f
Gerrit-Change-Number: 31452
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-CC: Jenkins Builder
Gerrit-Comment-Date: Tue, 21 Feb 2023 21:36:36 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/31451 )
Change subject: Implement the XOR-2G authentication algorithm
......................................................................
Implement the XOR-2G authentication algorithm
We've so far only been supporting XOR-3G algorithm as specified
in TS 34.108 (in both 3G and 2G-derivation mode).
However, XOR-3G used for 2G auth is different from the XOR-2G algorithm
as defined in Annex A of TS 51.010-1. Let's add support for that one,
too.
Change-Id: I0ee0565382c1e4515d44ff9b1752685c0a66ae39
---
M include/osmocom/crypt/auth.h
M src/gsm/Makefile.am
M src/gsm/auth_core.c
A src/gsm/auth_xor_2g.c
4 files changed, 98 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/51/31451/1
diff --git a/include/osmocom/crypt/auth.h b/include/osmocom/crypt/auth.h
index c653b61..4af8ca8 100644
--- a/include/osmocom/crypt/auth.h
+++ b/include/osmocom/crypt/auth.h
@@ -32,6 +32,7 @@
OSMO_AUTH_ALG_COMP128v3,
OSMO_AUTH_ALG_XOR,
OSMO_AUTH_ALG_MILENAGE,
+ OSMO_AUTH_ALG_XOR_2G,
_OSMO_AUTH_ALG_NUM,
};
diff --git a/src/gsm/Makefile.am b/src/gsm/Makefile.am
index 798f11a..cff089b 100644
--- a/src/gsm/Makefile.am
+++ b/src/gsm/Makefile.am
@@ -26,7 +26,7 @@
gprs_cipher_core.c gprs_rlc.c gsm0480.c abis_nm.c gsm0502.c \
gsm0411_utils.c gsm0411_smc.c gsm0411_smr.c gsm0414.c \
lapdm.c kasumi.c gsm29205.c gsm_04_08_gprs.c \
- auth_core.c auth_comp128v1.c auth_comp128v23.c auth_xor.c \
+ auth_core.c auth_comp128v1.c auth_comp128v23.c auth_xor.c auth_xor_2g.c \
auth_milenage.c milenage/aes-encblock.c gea.c \
milenage/aes-internal.c milenage/aes-internal-enc.c \
milenage/milenage.c gan.c ipa.c gsm0341.c apn.c \
diff --git a/src/gsm/auth_core.c b/src/gsm/auth_core.c
index f450850..af03ace 100644
--- a/src/gsm/auth_core.c
+++ b/src/gsm/auth_core.c
@@ -210,6 +210,7 @@
{ OSMO_AUTH_ALG_COMP128v3, "COMP128v3" },
{ OSMO_AUTH_ALG_XOR, "XOR" },
{ OSMO_AUTH_ALG_MILENAGE, "MILENAGE" },
+ { OSMO_AUTH_ALG_XOR_2G, "XOR-2G" },
{ 0, NULL }
};
diff --git a/src/gsm/auth_xor_2g.c b/src/gsm/auth_xor_2g.c
new file mode 100644
index 0000000..9efe5cc
--- /dev/null
+++ b/src/gsm/auth_xor_2g.c
@@ -0,0 +1,79 @@
+/*! \file auth_xor.c
+ * GSM XOR-2G algorithm as specified in Annex 4 (A.4.1.2) of 3GPP TS 51.010-1.
+ * This is implemented by typical GSM MS tester */
+
+/*
+ * (C) 2023 by Harald Welte <laforge(a)gnumonks.org>
+ *
+ * All Rights Reserved
+ *
+ * Author: Daniel Willmann <dwillmann(a)sysmocom.de>
+ *
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <string.h>
+#include <stdint.h>
+#include <errno.h>
+
+#include <osmocom/crypt/auth.h>
+
+/*! \addtogroup auth
+ * @{
+ */
+
+static void xor(uint8_t *out, const uint8_t *a, const uint8_t *b, size_t len)
+{
+ size_t i;
+
+ for (i = 0; i < len; i++)
+ out[i] = a[i] ^ b[i];
+}
+
+/* GSM XOR-2G algorithm as specified in Annex 4 (A.4.1.2) of 3GPP TS 51.010-1. */
+static int xor2g_gen_vec(struct osmo_auth_vector *vec,
+ struct osmo_sub_auth_data *aud,
+ const uint8_t *_rand)
+{
+ uint8_t res1[16];
+
+ if (aud->type != OSMO_AUTH_TYPE_GSM)
+ return -ENOTSUP;
+
+ /* Step 1: XOR to the challenge RAND, a predefined number Ki, having the same bit length (128 bits) as
+ * RAND. */
+ xor(res1, aud->u.gsm.ki, _rand, sizeof(res1));
+
+ /* Step 2: The most significant 32 bits of RES1 form SRES. */
+ memcpy(vec->sres, res1, 4);
+ /* The next 64 bits of RES1 form Kc */
+ memcpy(vec->kc, res1+4, 8);
+
+ vec->auth_types = OSMO_AUTH_TYPE_GSM;
+ return 0;
+}
+
+static struct osmo_auth_impl xor2g_alg = {
+ .algo = OSMO_AUTH_ALG_XOR_2G,
+ .name = "XOR-2G (libosmogsm built-in)",
+ .priority = 1000,
+ .gen_vec = &xor2g_gen_vec,
+};
+
+static __attribute__((constructor)) void on_dso_load_xor(void)
+{
+ osmo_auth_register(&xor2g_alg);
+}
+
+/*! @} */
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/31451
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I0ee0565382c1e4515d44ff9b1752685c0a66ae39
Gerrit-Change-Number: 31451
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newchange