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.

Change-Id: Ia57bf1300525cf3c247284fe966b1c415c2d53e2
Related: OS#1694
changes/19/3819/7
Maxim Suraev 5 years ago
parent 77a9d4e6ce
commit ad1e3cdd6c
  1. 1
      configure.ac
  2. 2
      contrib/jenkins.sh
  3. 1
      debian/control
  4. 2
      src/osmo-bsc_nat/Makefile.am
  5. 18
      src/osmo-bsc_nat/bsc_nat.c
  6. 1
      tests/channel/Makefile.am

@ -46,7 +46,6 @@ PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.10.0)
PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.3.2)
PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.1.0)
PKG_CHECK_MODULES(LIBOSMOSIGTRAN, libosmo-sigtran >= 0.8.0)
PKG_CHECK_MODULES(LIBCRYPTO, libcrypto >= 0.9.5)
PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 0.0.2)
PKG_CHECK_MODULES(LIBOSMOMGCPCLIENT, libosmo-mgcp-client >= 1.2.0)
PKG_CHECK_MODULES(LIBOSMOLEGACYMGCP, libosmo-legacy-mgcp >= 1.0.0)

@ -18,7 +18,7 @@ osmo-clean-workspace.sh
mkdir "$deps" || true
osmo-build-dep.sh libosmocore "" ac_cv_path_DOXYGEN=false
osmo-build-dep.sh libosmocore "" '--disable-doxygen --enable-gnutls'
verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]")

1
debian/control vendored

@ -10,7 +10,6 @@ Build-Depends: debhelper (>=9),
libtool,
pkg-config,
python-minimal,
libssl-dev (>= 0.9.5),
libtalloc-dev,
libosmocore-dev (>= 0.10.0),
libosmo-sccp-dev (>= 0.0.2),

@ -12,7 +12,6 @@ AM_CFLAGS = \
$(LIBOSMOCTRL_CFLAGS) \
$(LIBOSMOSCCP_CFLAGS) \
$(LIBOSMOLEGACYMGCP_CFLAGS) \
$(LIBCRYPTO_CFLAGS) \
$(COVERAGE_CFLAGS) \
$(NULL)
@ -49,7 +48,6 @@ osmo_bsc_nat_LDADD = \
$(LIBOSMOVTY_LIBS) \
$(LIBOSMOCTRL_LIBS) \
$(LIBOSMOSIGTRAN_LIBS) \
$(LIBCRYPTO_LIBS) \
$(LIBRARY_GSM) \
-lrt \
$(NULL)

@ -74,8 +74,6 @@
#include <osmocom/abis/ipa.h>
#include <openssl/rand.h>
#include "../../bscconfig.h"
#define SCCP_CLOSE_TIME 20
@ -208,7 +206,7 @@ static void send_id_req(struct bsc_nat *nat, struct bsc_connection *bsc)
0x01, IPAC_IDTAG_UNITNAME,
0x01, IPAC_IDTAG_SERNR,
};
int rc;
uint8_t *mrand;
uint8_t id_req[sizeof(s_id_req) + (2+16)];
uint8_t *buf = &id_req[sizeof(s_id_req)];
@ -221,19 +219,17 @@ static void send_id_req(struct bsc_nat *nat, struct bsc_connection *bsc)
buf = v_put(buf, 0x23);
mrand = bsc->last_rand;
if (RAND_bytes(mrand, 16) != 1)
goto failed_random;
rc = osmo_get_rand_id(mrand, 16);
if (rc < 0) {
/* the timeout will trigger and close this connection */
LOGP(DNAT, LOGL_ERROR, "osmo_get_rand_id() failed: %s\n", strerror(-rc));
return;
}
memcpy(buf, mrand, 16);
buf += 16;
bsc_send_data(bsc, id_req, sizeof(id_req), IPAC_PROTO_IPACCESS);
return;
failed_random:
/* the timeout will trigger and close this connection */
LOGP(DNAT, LOGL_ERROR, "Failed to read from urandom.\n");
return;
}
static struct msgb *nat_create_rlsd(struct nat_sccp_connection *conn)

@ -29,5 +29,4 @@ channel_test_LDADD = \
$(top_builddir)/src/libcommon/libcommon.a \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGSM_LIBS) \
$(LIBCRYPTO_LIBS) \
$(NULL)

Loading…
Cancel
Save