libosmocore[master]: Add osmo_rand() function

2017-04-27 Thread Harald Welte
Patch Set 2: agreeing with Holger. Let's seed the regular libc rand() with some randomness at program start, and then generate TMSI or other random identiifers from that. The function for that should then verify that the initializtaion was actually performed (so applications cannot forget

libosmocore[master]: Add osmo_rand() function

2017-04-26 Thread Holger Freyther
Patch Set 2: > Sure, that's why getrandom has GRND_NONBLOCK flag and return value > indicating actual number of random bits returned. The consensus (as > I recall it) was to use osmo_rand() for "small" things like tmsi > (with fallback to currently used insecure rand()). The "big" things >

libosmocore[master]: Add osmo_rand() function

2017-04-26 Thread Holger Freyther
Patch Set 2: Sorry to not have been in the room at that time and I thought someone else would raise these points. * OpenSSL/GNUtls take random bits from the kernel and then use something like a KDF to generate new values and only re-seeds if needed (e.g. this explains the OpenSSL/android

libosmocore[master]: Add osmo_rand() function

2017-04-25 Thread Harald Welte
Patch Set 2: Code-Review-1 I think the general concencus at OsmoDevCon 2017 was that we don't want to add a gnutls dependency like this. Rather, we use the glibc function. if it doesn't exist, fall back to issuing the syscall ourselves. And if that fails too, fall back to reading from