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/.
Max gerrit-no-reply at lists.osmocom.orgReview at https://gerrit.osmocom.org/424 Make C4 function globally available This function perform 64 -> 128 bit key expansion which useful for converting between UMTS CK and GSM Kc, A5/3 and A5/4, GEA3 and GEA4 keys. Change-Id: I5a6c6deef6027cd6af144c9062d4c9166be26904 Related: OS#1582 --- M include/osmocom/crypt/auth.h M src/gsm/a5.c M src/gsm/auth_core.c 3 files changed, 5 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/24/424/1 diff --git a/include/osmocom/crypt/auth.h b/include/osmocom/crypt/auth.h index bed48e7..37b8a8a 100644 --- a/include/osmocom/crypt/auth.h +++ b/include/osmocom/crypt/auth.h @@ -91,7 +91,7 @@ int osmo_auth_load(const char *path); int osmo_auth_supported(enum osmo_auth_algo algo); - +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/a5.c b/src/gsm/a5.c index f1fd697..dbba0f2 100644 --- a/src/gsm/a5.c +++ b/src/gsm/a5.c @@ -40,6 +40,7 @@ #include <osmocom/gsm/a5.h> #include <osmocom/gsm/kasumi.h> +#include <osmocom/crypt/auth.h> /* Somme OS (like Nuttx) don't have ENOTSUP */ #ifndef ENOTSUP @@ -95,8 +96,7 @@ _a5_3(const uint8_t *key, uint32_t fn, ubit_t *dl, ubit_t *ul, bool fn_correct) { uint8_t ck[16]; - memcpy(ck, key, 8); - memcpy(ck + 8, key, 8); + osmo_c4(ck, key); /* internal function require 128 bit key so we expand by concatenating supplied 64 bit key */ _a5_4(ck, fn, dl, ul, fn_correct); } diff --git a/src/gsm/auth_core.c b/src/gsm/auth_core.c index f1ec2ed..3aac069 100644 --- a/src/gsm/auth_core.c +++ b/src/gsm/auth_core.c @@ -106,7 +106,7 @@ } /* C4 function to derive UMTS CK from GSM Kc */ -static inline void c4_function(uint8_t *ck, const uint8_t *kc) +void osmo_c4(uint8_t *ck, const uint8_t *kc) { memcpy(ck, kc, 8); memcpy(ck+8, kc, 8); @@ -125,7 +125,7 @@ if ((vec->auth_types & OSMO_AUTH_TYPE_GSM) && !(vec->auth_types & OSMO_AUTH_TYPE_UMTS)) { c5_function(vec->ik, vec->kc); - c4_function(vec->ck, vec->kc); + osmo_c4(vec->ck, vec->kc); /* We cannot actually set OSMO_AUTH_TYPE_UMTS as we have no * AUTN and no RES, and thus can only perform GSM * authentication with this tuple. -- To view, visit https://gerrit.osmocom.org/424 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5a6c6deef6027cd6af144c9062d4c9166be26904 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max <msuraev at sysmocom.de>