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
changes/20/3820/8
Maxim Suraev 5 years ago
parent 629c479edd
commit 753c15de2f
  1. 1
      configure.ac
  2. 1
      debian/control
  3. 1
      src/libmsc/Makefile.am
  4. 2
      src/libmsc/auth.c
  5. 2
      src/libmsc/db.c
  6. 1
      src/libmsc/gsm_04_08.c
  7. 1
      src/libvlr/Makefile.am
  8. 11
      src/libvlr/vlr.c
  9. 2
      src/osmo-msc/Makefile.am
  10. 1
      tests/db/Makefile.am
  11. 4
      tests/msc_vlr/Makefile.am
  12. 8
      tests/msc_vlr/msc_vlr_tests.c
  13. 2
      tests/sms_queue/Makefile.am

@ -47,7 +47,6 @@ PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.2.0)
PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.1.0)
PKG_CHECK_MODULES(LIBOSMOSIGTRAN, libosmo-sigtran >= 0.8.0)
PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp)
PKG_CHECK_MODULES(LIBCRYPTO, libcrypto >= 0.9.5)
PKG_CHECK_MODULES(LIBOSMOMGCPCLIENT, libosmo-mgcp-client >= 1.1.0)
PKG_CHECK_MODULES(LIBSMPP34, libsmpp34 >= 1.12.0)

1
debian/control vendored

@ -11,7 +11,6 @@ Build-Depends: debhelper (>=9),
pkg-config,
libdbi-dev,
libtalloc-dev,
libssl-dev (>= 0.9.5),
libsmpp34-dev (>= 1.12),
libasn1c-dev (>= 0.9.28),
libosmocore-dev (>= 0.10.0),

@ -10,7 +10,6 @@ AM_CFLAGS = \
$(LIBOSMOVTY_CFLAGS) \
$(LIBOSMOABIS_CFLAGS) \
$(COVERAGE_CFLAGS) \
$(LIBCRYPTO_CFLAGS) \
$(LIBSMPP34_CFLAGS) \
$(LIBASN1C_CFLAGS) \
$(LIBOSMOSIGTRAN_CFLAGS) \

@ -28,8 +28,6 @@
#include <osmocom/gsm/comp128.h>
#include <osmocom/core/utils.h>
#include <openssl/rand.h>
#include <stdlib.h>
const struct value_string auth_action_names[] = {

@ -42,8 +42,6 @@
#include <osmocom/core/rate_ctr.h>
#include <osmocom/core/utils.h>
#include <openssl/rand.h>
static char *db_basename = NULL;
static char *db_dirname = NULL;
static dbi_conn conn;

@ -31,7 +31,6 @@
#include <netinet/in.h>
#include <regex.h>
#include <sys/types.h>
#include <openssl/rand.h>
#include "bscconfig.h"

@ -7,7 +7,6 @@ AM_CFLAGS= \
$(LIBOSMOMGCPCLIENT_CFLAGS) \
$(LIBOSMOABIS_CFLAGS) \
$(COVERAGE_CFLAGS) \
$(LIBCRYPTO_CFLAGS) \
$(NULL)
noinst_HEADERS = \

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

@ -13,7 +13,6 @@ AM_CFLAGS = \
$(LIBOSMOCTRL_CFLAGS) \
$(LIBOSMOABIS_CFLAGS) \
$(LIBSMPP34_CFLAGS) \
$(LIBCRYPTO_CFLAGS) \
$(LIBOSMORANAP_CFLAGS) \
$(LIBASN1C_CFLAGS) \
$(LIBOSMOSIGTRAN_CFLAGS) \
@ -43,7 +42,6 @@ osmo_msc_LDADD = \
$(LIBOSMOCTRL_LIBS) \
$(LIBOSMOABIS_LIBS) \
$(LIBSMPP34_LIBS) \
$(LIBCRYPTO_LIBS) \
$(LIBOSMOSIGTRAN_LIBS) \
$(LIBOSMOMGCPCLIENT_LIBS) \
-ldbi \

@ -42,6 +42,5 @@ db_test_LDADD = \
$(LIBOSMOGSM_LIBS) \
$(LIBSMPP34_LIBS) \
$(LIBOSMOVTY_LIBS) \
$(LIBCRYPTO_LIBS) \
-ldbi \
$(NULL)

@ -9,7 +9,6 @@ AM_CFLAGS = \
$(LIBOSMOCORE_CFLAGS) \
$(LIBOSMOGSM_CFLAGS) \
$(LIBSMPP34_CFLAGS) \
$(LIBCRYPTO_CFLAGS) \
$(LIBOSMOVTY_CFLAGS) \
$(LIBOSMOABIS_CFLAGS) \
$(LIBOSMOSIGTRAN_CFLAGS) \
@ -30,7 +29,7 @@ AM_LDFLAGS = \
-Wl,--wrap=ranap_iu_page_cs \
-Wl,--wrap=msc_stop_paging \
-Wl,--wrap=gsm340_gen_scts \
-Wl,--wrap=RAND_bytes \
-Wl,--wrap=osmo_get_rand_id \
-Wl,--wrap=msc_call_assignment \
-Wl,--wrap=msc_call_release \
$(NULL)
@ -43,7 +42,6 @@ LDADD = \
$(LIBSMPP34_LIBS) \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGSM_LIBS) \
$(LIBCRYPTO_LIBS) \
$(LIBOSMOVTY_LIBS) \
$(LIBOSMOABIS_LIBS) \
$(LIBOSMOSIGTRAN_LIBS) \

@ -257,11 +257,11 @@ void send_sms(struct vlr_subscr *receiver,
}
unsigned char next_rand_byte = 0;
/* override, requires '-Wl,--wrap=RAND_bytes' */
int __real_RAND_bytes(unsigned char *buf, int num);
int __wrap_RAND_bytes(unsigned char *buf, int num)
/* override, requires '-Wl,--wrap=osmo_get_rand_id' */
int __real_osmo_get_rand_id(uint8_t *buf, size_t num);
int __wrap_osmo_get_rand_id(uint8_t *buf, size_t num)
{
int i;
size_t i;
for (i = 0; i < num; i++)
buf[i] = next_rand_byte++;
return 1;

@ -8,7 +8,6 @@ AM_CFLAGS = \
-ggdb3 \
$(LIBOSMOCORE_CFLAGS) \
$(LIBOSMOGSM_CFLAGS) \
$(LIBCRYPTO_CFLAGS) \
$(LIBOSMOVTY_CFLAGS) \
$(LIBOSMOABIS_CFLAGS) \
$(LIBOSMOSIGTRAN_CFLAGS) \
@ -38,7 +37,6 @@ sms_queue_test_LDADD = \
$(LIBSMPP34_LIBS) \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGSM_LIBS) \
$(LIBCRYPTO_LIBS) \
$(LIBOSMOVTY_LIBS) \
$(LIBOSMOABIS_LIBS) \
$(LIBOSMOSIGTRAN_LIBS) \

Loading…
Cancel
Save