Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/3819

to look at the new patch set (#2).

Migrate from OpenSSL to osmo_get_rand_id()

This avoids potential licensing incompatibility and makes integration of
Debian packaging patches easier.

Change-Id: Ia57bf1300525cf3c247284fe966b1c415c2d53e2
Related: OS#1694
---
M configure.ac
M debian/control
M src/osmo-bsc_nat/Makefile.am
M src/osmo-bsc_nat/bsc_nat.c
M tests/channel/Makefile.am
5 files changed, 7 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/19/3819/2

diff --git a/configure.ac b/configure.ac
index 930d1d3..906a5ff 100644
--- a/configure.ac
+++ b/configure.ac
@@ -46,7 +46,6 @@
 PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.2.0)
 PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.0.1)
 PKG_CHECK_MODULES(LIBOSMOSIGTRAN, libosmo-sigtran) # TODO version?
-PKG_CHECK_MODULES(LIBCRYPTO, libcrypto >= 0.9.5)
 PKG_CHECK_MODULES(LIBOSMOLEGACYMGCP, libosmo-legacy-mgcp >= 0.0.1)
 PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 0.0.2)
 
diff --git a/debian/control b/debian/control
index 7b25ecc..f74d892 100644
--- a/debian/control
+++ b/debian/control
@@ -10,7 +10,6 @@
                libtool,
                pkg-config,
                python-minimal,
-               libssl-dev,
                libsctp-dev,
                libtalloc-dev,
                libasn1c-dev,
diff --git a/src/osmo-bsc_nat/Makefile.am b/src/osmo-bsc_nat/Makefile.am
index 1eec7aa..a095a4f 100644
--- a/src/osmo-bsc_nat/Makefile.am
+++ b/src/osmo-bsc_nat/Makefile.am
@@ -14,7 +14,6 @@
        $(LIBOSMOABIS_CFLAGS) \
        $(LIBOSMONETIF_CFLAGS) \
        $(LIBOSMOLEGACYMGCP_CFLAGS) \
-       $(LIBCRYPTO_CFLAGS) \
        $(COVERAGE_CFLAGS) \
        $(NULL)
 
@@ -55,7 +54,6 @@
        $(LIBOSMONETIF_LIBS) \
        $(LIBOSMOSIGTRAN_LIBS) \
        $(LIBOSMOLEGACYMGCP_LIBS) \
-       $(LIBCRYPTO_LIBS) \
        $(LIBRARY_GSM) \
        -lrt \
        $(NULL)
diff --git a/src/osmo-bsc_nat/bsc_nat.c b/src/osmo-bsc_nat/bsc_nat.c
index 1548ea3..5569d2f 100644
--- a/src/osmo-bsc_nat/bsc_nat.c
+++ b/src/osmo-bsc_nat/bsc_nat.c
@@ -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 @@
                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 @@
        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)
diff --git a/tests/channel/Makefile.am b/tests/channel/Makefile.am
index 395daf7..12f18f8 100644
--- a/tests/channel/Makefile.am
+++ b/tests/channel/Makefile.am
@@ -29,5 +29,4 @@
        $(top_builddir)/src/libcommon/libcommon.a \
        $(LIBOSMOCORE_LIBS) \
        $(LIBOSMOGSM_LIBS) \
-       $(LIBCRYPTO_LIBS) \
        $(NULL)

-- 
To view, visit https://gerrit.osmocom.org/3819
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ia57bf1300525cf3c247284fe966b1c415c2d53e2
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Max <[email protected]>
Gerrit-Reviewer: Jenkins Builder

Reply via email to