From 3b6332f6dc1fa14dea6d1577a162b84bb304d4ef Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 1 Nov 2017 13:28:38 +0100 Subject: Migrate from OpenSSL to osmo_get_rand_id() This avoids potential licensing incompatibility and makes integration of Debian packaging patches easier. The libosmocore version requirements are fine already but for jenkins tests to pass we have to have Ic77866ce65acf524b768882c751a4f9c0635740b merged into libosmocore master. Related: OS#1694 Change-Id: I2b687b7f07ef05bbd861b8479cad5a958a3dde92 --- src/gprs/gprs_sgsn.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/gprs/gprs_sgsn.c') diff --git a/src/gprs/gprs_sgsn.c b/src/gprs/gprs_sgsn.c index c4321f91c..688eaed18 100644 --- a/src/gprs/gprs_sgsn.c +++ b/src/gprs/gprs_sgsn.c @@ -46,8 +46,6 @@ #include -#include - #include "../../bscconfig.h" #if BUILD_IU @@ -643,10 +641,11 @@ uint32_t sgsn_alloc_ptmsi(void) { struct sgsn_mm_ctx *mm; uint32_t ptmsi = 0xdeadbeef; - int max_retries = 100; + int max_retries = 100, rc = 0; restart: - if (RAND_bytes((uint8_t *) &ptmsi, sizeof(ptmsi)) != 1) + rc = osmo_get_rand_id((uint8_t *) &ptmsi, sizeof(ptmsi)); + if (rc < 0) goto failed; /* Enforce that the 2 MSB are set without loosing the distance between @@ -684,7 +683,7 @@ restart: return ptmsi; failed: - LOGP(DGPRS, LOGL_ERROR, "Failed to allocate a P-TMSI\n"); + LOGP(DGPRS, LOGL_ERROR, "Failed to allocate a P-TMSI: %d (%s)\n", rc, strerror(-rc)); return GSM_RESERVED_TMSI; } -- cgit v1.2.3