summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2015-10-08 16:10:26 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-10-12 09:07:45 +0200
commit2aedfbdfe1dfb4df84418af4bb39c40ca1cc5128 (patch)
treee6d24b1e7c6a9f409b61497c539d6f21c95bdb9a
parent62a63f54a6c6e565df7ca5efadf5430123a5cc5e (diff)
libmsc: Use RAND_bytes to generate a token
[hfreyther: Add cast to uint8_t to fix compiler warning]
-rw-r--r--openbsc/src/libmsc/db.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/openbsc/src/libmsc/db.c b/openbsc/src/libmsc/db.c
index 4061fc102..9f265901c 100644
--- a/openbsc/src/libmsc/db.c
+++ b/openbsc/src/libmsc/db.c
@@ -1275,7 +1275,10 @@ int db_subscriber_alloc_token(struct gsm_subscriber *subscriber, uint32_t *token
uint32_t try;
for (;;) {
- try = rand();
+ if (RAND_bytes((uint8_t *) &try, sizeof(try)) != 1) {
+ LOGP(DDB, LOGL_ERROR, "RAND_bytes failed\n");
+ return 1;
+ }
if (!try) /* 0 is an invalid token */
continue;
result = dbi_conn_queryf(conn,