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.orgMax has uploaded this change for review. ( https://gerrit.osmocom.org/12381 Change subject: Use define for key buffers ...................................................................... Use define for key buffers Add corresponding spec. references and comments where appropriate. Change-Id: If5e2aad86eaecd8eada667b3488ba415d81c6312 --- M include/osmocom/crypt/auth.h M src/gsm/auth_core.c M tests/auth/milenage_test.c 3 files changed, 9 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/81/12381/1 diff --git a/include/osmocom/crypt/auth.h b/include/osmocom/crypt/auth.h index e544126..c653b61 100644 --- a/include/osmocom/crypt/auth.h +++ b/include/osmocom/crypt/auth.h @@ -42,7 +42,7 @@ union { struct { uint8_t opc[16]; /*!< operator invariant value */ - uint8_t k[16]; /*!< secret key of the subscriber */ + uint8_t k[OSMO_A5_MAX_KEY_LEN_BYTES]; /*!< secret key of the subscriber */ uint8_t amf[2]; uint64_t sqn; /*!< sequence number (in: prev sqn; out: used sqn) */ int opc_is_op; /*!< is the OPC field OPC (0) or OP (1) ? */ @@ -60,8 +60,8 @@ struct osmo_auth_vector { uint8_t rand[16]; /*!< random challenge */ uint8_t autn[16]; /*!< authentication nonce */ - uint8_t ck[16]; /*!< ciphering key */ - uint8_t ik[16]; /*!< integrity key */ + uint8_t ck[OSMO_A5_MAX_KEY_LEN_BYTES]; /*!< ciphering key */ + uint8_t ik[OSMO_A5_MAX_KEY_LEN_BYTES]; /*!< integrity key */ uint8_t res[16]; /*!< authentication result */ uint8_t res_len; /*!< length (in bytes) of res */ uint8_t kc[8]; /*!< Kc for GSM encryption (A5) */ diff --git a/src/gsm/auth_core.c b/src/gsm/auth_core.c index f171ed4..9e750a0 100644 --- a/src/gsm/auth_core.c +++ b/src/gsm/auth_core.c @@ -98,7 +98,7 @@ return 0; } -/* C5 function to derive UMTS IK from GSM Kc */ +/* 3GPP TS 33.102 §6.8.2.3 C5 function to derive UMTS IK from GSM Kc */ static inline void c5_function(uint8_t *ik, const uint8_t *kc) { unsigned int i; @@ -110,7 +110,7 @@ ik[i] = ik[i-12]; } -/* C4 function to derive UMTS CK from GSM Kc */ +/* 3GPP TS 33.102 §6.8.2.3 C4 function to derive UMTS CK from GSM Kc */ void osmo_c4(uint8_t *ck, const uint8_t *kc) { memcpy(ck, kc, 8); diff --git a/tests/auth/milenage_test.c b/tests/auth/milenage_test.c index 2bd3cf2..8b058e5 100644 --- a/tests/auth/milenage_test.c +++ b/tests/auth/milenage_test.c @@ -23,7 +23,10 @@ if (vec->auth_types & OSMO_AUTH_TYPE_GSM) { printf("SRES:\t%s\n", osmo_hexdump(vec->sres, sizeof(vec->sres))); - printf("Kc:\t%s\n", osmo_hexdump(vec->kc, sizeof(vec->kc))); + /* According to 3GPP TS 55.205 Sec. 4 the GSM-MILENAGE output is limited to 64 bits. + According to 3GPP TS 33.102 Annex. B5 in UMTS security context Kc can be 128 bits. + Here we test the former, so make sure we only print interesting Kc bits. */ + printf("Kc:\t%s\n", osmo_hexdump(vec->kc, OSMO_A5_MAX_KEY_LEN_BYTES/2)); } } -- To view, visit https://gerrit.osmocom.org/12381 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: If5e2aad86eaecd8eada667b3488ba415d81c6312 Gerrit-Change-Number: 12381 Gerrit-PatchSet: 1 Gerrit-Owner: Max <msuraev at sysmocom.de> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181219/c9b415f8/attachment.htm>