aboutsummaryrefslogtreecommitdiffstats
path: root/src/libvlr/vlr.c
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2017-12-21 14:50:44 +0100
committerMax <msuraev@sysmocom.de>2017-12-27 11:11:14 +0000
commit753c15de2f00e24f76ac9b01a20e1e2ff0f86ce2 (patch)
tree1e40251af3eba274251606a02523da21aaa5853d /src/libvlr/vlr.c
parent629c479eddfc8995117eaee56ef330ae705bba5f (diff)
Migrate from OpenSSL to osmo_get_rand_id()
This avoids potential licensing incompatibility and makes integration of Debian packaging patches easier. Related: OS#1694 Change-Id: I71cd631704a4dc155c6c752fee2a42cd6e2fa336
Diffstat (limited to 'src/libvlr/vlr.c')
-rw-r--r--src/libvlr/vlr.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/libvlr/vlr.c b/src/libvlr/vlr.c
index 670ff839d..8c6911a60 100644
--- a/src/libvlr/vlr.c
+++ b/src/libvlr/vlr.c
@@ -31,8 +31,6 @@
#include <osmocom/msc/vlr.h>
#include <osmocom/msc/debug.h>
-#include <openssl/rand.h>
-
#include <netinet/in.h>
#include <arpa/inet.h>
#include <limits.h>
@@ -275,12 +273,13 @@ int vlr_subscr_alloc_tmsi(struct vlr_subscr *vsub)
{
struct vlr_instance *vlr = vsub->vlr;
uint32_t tmsi;
- int tried;
+ int tried, rc;
for (tried = 0; tried < 100; tried++) {
- if (RAND_bytes((uint8_t *) &tmsi, sizeof(tmsi)) != 1) {
- LOGP(DVLR, LOGL_ERROR, "RAND_bytes failed\n");
- return -1;
+ rc = osmo_get_rand_id((uint8_t *) &tmsi, sizeof(tmsi));
+ if (rc < 0) {
+ LOGP(DDB, LOGL_ERROR, "osmo_get_rand_id() failed: %s\n", strerror(-rc));
+ return rc;
}
/* throw the dice again, if the TSMI doesn't fit */
if (tmsi == GSM_RESERVED_TMSI)