aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bsc_nat
diff options
context:
space:
mode:
Diffstat (limited to 'src/osmo-bsc_nat')
-rw-r--r--src/osmo-bsc_nat/Makefile.am2
-rw-r--r--src/osmo-bsc_nat/bsc_nat.c18
2 files changed, 7 insertions, 13 deletions
diff --git a/src/osmo-bsc_nat/Makefile.am b/src/osmo-bsc_nat/Makefile.am
index 1bee68edf..a941b5869 100644
--- a/src/osmo-bsc_nat/Makefile.am
+++ b/src/osmo-bsc_nat/Makefile.am
@@ -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)
diff --git a/src/osmo-bsc_nat/bsc_nat.c b/src/osmo-bsc_nat/bsc_nat.c
index 1548ea38b..5569d2fc9 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 @@ 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)