libmsc: Use RAND_bytes to generate a token

[hfreyther: Add cast to uint8_t to fix compiler warning]
This commit is contained in:
Daniel Willmann 2015-10-08 16:10:26 +02:00 committed by Holger Hans Peter Freyther
parent 62a63f54a6
commit 2aedfbdfe1
1 changed files with 4 additions and 1 deletions

View File

@ -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,