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/baseband-devel@lists.osmocom.org/.
Tim Ehlers osmocom at ehlers.infoHi, today I seached for a possibility to read the temporary session key "Kc" from my phone in osmocombb. I did not find a function. So I used the function, which writes SMS into sms.txt to write the Kc. Since I never used the Kc to decode something I would like to ask if I did it correct this way: --- old/host/layer23/src/mobile/subscriber.c 2012-01-10 17:06:40.000000000 +0100 +++ new/host/layer23/src/mobile/subscriber.c 2012-01-19 23:52:36.000000000 +0100 @@ -60,6 +60,39 @@ return NULL; } +static int gsm_kc(struct osmocom_ms *ms, uint8_t *kc) +{ + const char osmocomkc[] = ".osmocom/bb/kc.txt"; + int len; + const char *home; + char *kc_file; + FILE *fp; + + home = getenv("HOME"); + if (!home) { +fail: + fprintf(stderr, "Can't deliver SMS, be sure to create '%s' in " + "your home directory.\n", osmocomkc); + return NULL; + } + len = strlen(home) + 1 + sizeof(osmocomkc); + kc_file = talloc_size(l23_ctx, len); + if (!kc_file) + goto fail; + snprintf(kc_file, len, "%s/%s", home, osmocomkc); + + fp = fopen(kc_file, "a"); + if (!fp) + goto fail; + fprintf(fp, "%s %02X%02X%02X%02X%02X%02X%02X%02X\n", ms->name, kc[0], kc[1], kc[2], kc[3], kc[4], kc[5], kc[6], kc[7], kc[8]); + fclose(fp); + + talloc_free(kc_file); + + return 0; +} + + static char *sim_decode_bcd(uint8_t *data, uint8_t length) { int i, j = 0; @@ -377,6 +410,7 @@ subscr->key_seq = data[8] & 0x07; LOGP(DMM, LOGL_INFO, "received KEY from SIM\n"); + gsm_kc(subscr->ms, subscr->key); return 0; } Maybe it would be a better way to implement a function in VTY. BTW, am I wrong or why did nobody do that until present? Thanks Tim