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
Review at https://gerrit.osmocom.org/1714
libgsm crypt/auth.h: implement c3 function (3GPP TS 33.102)
Declare osmo_c3() in crypt/auth.h, implement in gsm/auth_core.c, all next to
osmo_c4(). Publish in libosmogsm.map for use in VLR and HLR. Will be used for
UMTS auth on GSM networks.
Change-Id: I87855316749b0350774795c8e200fc82604dea59
---
M include/osmocom/crypt/auth.h
M src/gsm/auth_core.c
M src/gsm/libosmogsm.map
3 files changed, 17 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/14/1714/1
diff --git a/include/osmocom/crypt/auth.h b/include/osmocom/crypt/auth.h
index 37b8a8a..58bd71e 100644
--- a/include/osmocom/crypt/auth.h
+++ b/include/osmocom/crypt/auth.h
@@ -91,6 +91,7 @@
int osmo_auth_load(const char *path);
int osmo_auth_supported(enum osmo_auth_algo algo);
+void osmo_c3(uint8_t *kc, const uint8_t *ck, const uint8_t *ik)
void osmo_c4(uint8_t *ck, const uint8_t *kc);
const char *osmo_auth_alg_name(enum osmo_auth_algo alg);
enum osmo_auth_algo osmo_auth_alg_parse(const char *name);
diff --git a/src/gsm/auth_core.c b/src/gsm/auth_core.c
index 3aac069..6cb96ef 100644
--- a/src/gsm/auth_core.c
+++ b/src/gsm/auth_core.c
@@ -105,6 +105,21 @@
ik[i] = ik[i-12];
}
+/*! \brief C3 function to derive GSM Kc from UMTS CK+IK
+ * (as defined in 3GPP TS 33.102 6.8.1.2).
+ * The c3 function converts UMTS key material to GSM keys to be able to use
+ * UMTS authentication on a GSM network. See 3GPP TS 33.102 6.8.1.1.
+ * \param kc[out] 8 byte buffer to return the derived GSM Kc.
+ * \param ck[in] 16 byte buffer holding UMTS CK.
+ * \param ik[in] 16 byte buffer holding UMTS IK.
+ */
+void osmo_c3(uint8_t *kc, const uint8_t *ck, const uint8_t *ik)
+{
+ unsigned int i;
+ for (i = 0; i < 8; i++)
+ kc[i] = ck[i] ^ ck[i + 8] ^ ik[i] ^ ik[i + 8];
+}
+
/* C4 function to derive UMTS CK from GSM Kc */
void osmo_c4(uint8_t *ck, const uint8_t *kc)
{
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index e153d72..8add3ec 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -31,6 +31,7 @@
abis_nm_pcause_type_names;
osmo_sitype_strs;
+osmo_c3;
osmo_c4;
bitvec_add_range1024;
comp128;
--
To view, visit https://gerrit.osmocom.org/1714
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I87855316749b0350774795c8e200fc82604dea59
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>