[PATCH] openbsc[master]: Migrate from OpenSSL to osmo_rand()

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Tue Jan 3 11:58:20 UTC 2017


Hello Jenkins Builder,

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

    https://gerrit.osmocom.org/1464

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

Migrate from OpenSSL to osmo_rand()

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

Related: OS#1694
Change-Id: I270c33912bf107b3c7c217d199262cc74d56ffdb
---
M debian/control
M openbsc/configure.ac
M openbsc/src/gprs/Makefile.am
M openbsc/src/gprs/gb_proxy.c
M openbsc/src/gprs/gprs_gmm.c
M openbsc/src/gprs/gprs_llc.c
M openbsc/src/gprs/gprs_sgsn.c
M openbsc/src/libiu/Makefile.am
M openbsc/src/libmsc/Makefile.am
M openbsc/src/libmsc/auth.c
M openbsc/src/libmsc/db.c
M openbsc/src/osmo-bsc_nat/Makefile.am
M openbsc/src/osmo-bsc_nat/bsc_nat.c
M openbsc/src/osmo-nitb/Makefile.am
M openbsc/tests/channel/Makefile.am
M openbsc/tests/db/Makefile.am
M openbsc/tests/gbproxy/Makefile.am
M openbsc/tests/gbproxy/gbproxy_test.c
M openbsc/tests/mm_auth/Makefile.am
M openbsc/tests/mm_auth/mm_auth_test.c
M openbsc/tests/sgsn/Makefile.am
M openbsc/tests/sgsn/sgsn_test.c
M openbsc/tests/sndcp_xid/Makefile.am
M openbsc/tests/xid/Makefile.am
24 files changed, 49 insertions(+), 77 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/64/1464/6

diff --git a/debian/control b/debian/control
index 79f18df..fa6d979 100644
--- a/debian/control
+++ b/debian/control
@@ -14,7 +14,6 @@
                libosmo-netif-dev,
                libdbd-sqlite3,
                libpcap-dev,
-               libssl-dev,
                libc-ares-dev,
                libsmpp34-dev
 Standards-Version: 3.9.8
diff --git a/openbsc/configure.ac b/openbsc/configure.ac
index 0753834..17a4f94 100644
--- a/openbsc/configure.ac
+++ b/openbsc/configure.ac
@@ -33,11 +33,10 @@
 PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.9.5)
 PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.3.0)
 PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl)
-PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.9.5)
+PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.9.6)
 PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.2.0)
 PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 0.6.4)
 PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.0.1)
-PKG_CHECK_MODULES(LIBCRYPTO, libcrypto >= 0.9.5)
 
 # Enabke/disable the NAT?
 AC_ARG_ENABLE([nat], [AS_HELP_STRING([--enable-nat], [Build the BSC NAT. Requires SCCP])],
diff --git a/openbsc/src/gprs/Makefile.am b/openbsc/src/gprs/Makefile.am
index cff17dd..8bc0f87 100644
--- a/openbsc/src/gprs/Makefile.am
+++ b/openbsc/src/gprs/Makefile.am
@@ -15,7 +15,6 @@
 	$(LIBOSMOGB_CFLAGS) \
 	$(COVERAGE_CFLAGS) \
 	$(LIBCARES_CFLAGS) \
-	$(LIBCRYPTO_CFLAGS) \
 	$(LIBGTP_CFLAGS) \
 	$(NULL)
 if BUILD_IU
@@ -63,7 +62,6 @@
 osmo_gbproxy_LDADD = \
 	$(top_builddir)/src/libcommon/libcommon.a \
 	$(OSMO_LIBS) \
-	$(LIBCRYPTO_LIBS) \
 	-lrt \
 	$(NULL)
 
@@ -98,7 +96,6 @@
 	$(OSMO_LIBS) \
 	$(LIBOSMOABIS_LIBS) \
 	$(LIBCARES_LIBS) \
-	$(LIBCRYPTO_LIBS) \
 	-lrt \
 	-lgtp \
 	-lm \
diff --git a/openbsc/src/gprs/gb_proxy.c b/openbsc/src/gprs/gb_proxy.c
index d95139f..9c93cfb 100644
--- a/openbsc/src/gprs/gb_proxy.c
+++ b/openbsc/src/gprs/gb_proxy.c
@@ -51,8 +51,6 @@
 #include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
 #include <openbsc/gprs_utils.h>
 
-#include <openssl/rand.h>
-
 static const struct rate_ctr_desc global_ctr_description[] = {
 	{ "inv-bvci",	    "Invalid BVC Identifier          " },
 	{ "inv-lai",	    "Invalid Location Area Identifier" },
@@ -236,7 +234,8 @@
 		bss_ptmsi = sgsn_ptmsi;
 	} else {
 		do {
-			if (RAND_bytes((uint8_t *) &bss_ptmsi, sizeof(bss_ptmsi)) != 1) {
+			if (osmo_rand((uint8_t *) &bss_ptmsi,
+				      sizeof(bss_ptmsi)) < 0) {
 				bss_ptmsi = GSM_RESERVED_TMSI;
 				break;
 			}
@@ -273,7 +272,8 @@
 	} else {
 		do {
 			/* create random TLLI, 0b01111xxx... */
-			if (RAND_bytes((uint8_t *) &sgsn_tlli, sizeof(sgsn_tlli)) != 1) {
+			if (osmo_rand((uint8_t *) &sgsn_tlli,
+				      sizeof(sgsn_tlli)) < 0) {
 				sgsn_tlli = 0;
 				break;
 			}
diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c
index 363b457..c48389f 100644
--- a/openbsc/src/gprs/gprs_gmm.c
+++ b/openbsc/src/gprs/gprs_gmm.c
@@ -31,8 +31,6 @@
 #include <arpa/inet.h>
 #include <netdb.h>
 
-#include <openssl/rand.h>
-
 #include "bscconfig.h"
 
 #include <openbsc/db.h>
@@ -551,9 +549,9 @@
 	/* § 10.5.5.7: */
 	acreq->force_stby = force_standby;
 	/* 3GPP TS 24.008 § 10.5.5.19: */
-	if (RAND_bytes(&rbyte, 1) != 1) {
-		LOGP(DMM, LOGL_NOTICE, "RAND_bytes failed for A&C ref, falling "
-		     "back to rand()\n");
+	if (osmo_rand(&rbyte, 1) < 0) {
+		LOGP(DMM, LOGL_ERROR, "osmo_rand() failed for A&C ref, falling"
+		     " back to rand()\n");
 		acreq->ac_ref_nr = rand();
 	} else
 		acreq->ac_ref_nr = rbyte;
@@ -1195,8 +1193,8 @@
 		};
 		/* XXX: Hack to make 3G auth work with special SIM card */
 		ctx->auth_state = SGSN_AUTH_AUTHENTICATE;
-
-		RAND_bytes(tmp_rand, 16);
+		/* FIXME: check return value and propagate error */
+		osmo_rand(tmp_rand, 16);
 
 		memset(&ctx->auth_triplet.vec, 0, sizeof(ctx->auth_triplet.vec));
 		osmo_auth_gen_vec(&ctx->auth_triplet.vec, &auth, tmp_rand);
diff --git a/openbsc/src/gprs/gprs_llc.c b/openbsc/src/gprs/gprs_llc.c
index 2be663f..951497a 100644
--- a/openbsc/src/gprs/gprs_llc.c
+++ b/openbsc/src/gprs/gprs_llc.c
@@ -23,8 +23,6 @@
 #include <stdint.h>
 #include <stdbool.h>
 
-#include <openssl/rand.h>
-
 #include <osmocom/core/msgb.h>
 #include <osmocom/core/linuxlist.h>
 #include <osmocom/core/timer.h>
@@ -1070,8 +1068,8 @@
 	uint8_t *xid;
 
 	LOGP(DLLC, LOGL_NOTICE, "LLGM Reset\n");
-	if (RAND_bytes((uint8_t *) &llme->iov_ui, 4) != 1) {
-		LOGP(DLLC, LOGL_NOTICE, "RAND_bytes failed for LLC XID reset, "
+	if (osmo_rand((uint8_t *) &llme->iov_ui, 4) < 0) {
+		LOGP(DLLC, LOGL_ERROR, "osmo_rand() failed for LLC XID reset, "
 		     "falling back to rand()\n");
 		llme->iov_ui = rand();
 	}
@@ -1103,8 +1101,8 @@
 	uint8_t *xid;
 
 	LOGP(DLLC, LOGL_NOTICE, "LLGM Reset\n");
-	if (RAND_bytes((uint8_t *) &llme->iov_ui, 4) != 1) {
-		LOGP(DLLC, LOGL_NOTICE, "RAND_bytes failed for LLC XID reset, "
+	if (osmo_rand((uint8_t *) &llme->iov_ui, 4) < 0) {
+		LOGP(DLLC, LOGL_ERROR, "osmo_rand() failed for LLC XID reset, "
 		     "falling back to rand()\n");
 		llme->iov_ui = rand();
 	}
diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c
index e85e1a9..1c0f83a 100644
--- a/openbsc/src/gprs/gprs_sgsn.c
+++ b/openbsc/src/gprs/gprs_sgsn.c
@@ -45,8 +45,6 @@
 
 #include <time.h>
 
-#include <openssl/rand.h>
-
 #define GPRS_LLME_CHECK_TICK 30
 
 extern struct sgsn_instance *sgsn;
@@ -614,7 +612,7 @@
 	int max_retries = 100;
 
 restart:
-	if (RAND_bytes((uint8_t *) &ptmsi, sizeof(ptmsi)) != 1)
+	if (osmo_rand((uint8_t *) &ptmsi, sizeof(ptmsi)) < 0)
 		goto failed;
 
 	/* Enforce that the 2 MSB are set without loosing the distance between
diff --git a/openbsc/src/libiu/Makefile.am b/openbsc/src/libiu/Makefile.am
index e5f9e27..f78b411 100644
--- a/openbsc/src/libiu/Makefile.am
+++ b/openbsc/src/libiu/Makefile.am
@@ -7,7 +7,6 @@
 AM_CFLAGS = \
 	-Wall \
 	$(COVERAGE_CFLAGS) \
-	$(LIBCRYPTO_CFLAGS) \
 	$(LIBASN1C_CFLAGS) \
 	$(LIBOSMOCORE_CFLAGS) \
 	$(LIBOSMOVTY_CFLAGS) \
diff --git a/openbsc/src/libmsc/Makefile.am b/openbsc/src/libmsc/Makefile.am
index 9d966db..38b6e21 100644
--- a/openbsc/src/libmsc/Makefile.am
+++ b/openbsc/src/libmsc/Makefile.am
@@ -10,7 +10,6 @@
 	$(LIBOSMOVTY_CFLAGS) \
 	$(LIBOSMOABIS_CFLAGS) \
 	$(COVERAGE_CFLAGS) \
-	$(LIBCRYPTO_CFLAGS) \
 	$(LIBSMPP34_CFLAGS) \
 	$(NULL)
 
diff --git a/openbsc/src/libmsc/auth.c b/openbsc/src/libmsc/auth.c
index bf62d3c..e51ceed 100644
--- a/openbsc/src/libmsc/auth.c
+++ b/openbsc/src/libmsc/auth.c
@@ -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[] = {
@@ -122,8 +120,9 @@
 	}
 	atuple->use_count = 1;
 
-	if (RAND_bytes(atuple->vec.rand, sizeof(atuple->vec.rand)) != 1) {
-		LOGP(DMM, LOGL_NOTICE, "RAND_bytes failed, can't generate new auth tuple\n");
+	if (osmo_rand(atuple->vec.rand, sizeof(atuple->vec.rand)) < 0) {
+		LOGP(DMM, LOGL_ERROR, "osmo_rand() failed, can't generate new"
+		     " auth tuple\n");
 		return AUTH_ERROR;
 	}
 
diff --git a/openbsc/src/libmsc/db.c b/openbsc/src/libmsc/db.c
index 5cccb32..6eb32b5 100644
--- a/openbsc/src/libmsc/db.c
+++ b/openbsc/src/libmsc/db.c
@@ -40,8 +40,6 @@
 #include <osmocom/core/statistics.h>
 #include <osmocom/core/rate_ctr.h>
 
-#include <openssl/rand.h>
-
 /* Semi-Private-Interface (SPI) for the subscriber code */
 void subscr_direct_free(struct gsm_subscriber *subscr);
 
@@ -1223,8 +1221,9 @@
 	char *tmsi_quoted;
 
 	for (;;) {
-		if (RAND_bytes((uint8_t *) &subscriber->tmsi, sizeof(subscriber->tmsi)) != 1) {
-			LOGP(DDB, LOGL_ERROR, "RAND_bytes failed\n");
+		if (osmo_rand((uint8_t *) &subscriber->tmsi,
+			      sizeof(subscriber->tmsi)) < 0) {
+			LOGP(DDB, LOGL_ERROR, "osmo_rand() failed\n");
 			return 1;
 		}
 		if (subscriber->tmsi == GSM_RESERVED_TMSI)
@@ -1303,8 +1302,8 @@
 	uint32_t try;
 
 	for (;;) {
-		if (RAND_bytes((uint8_t *) &try, sizeof(try)) != 1) {
-			LOGP(DDB, LOGL_ERROR, "RAND_bytes failed\n");
+		if (osmo_rand((uint8_t *) &try, sizeof(try)) < 0) {
+			LOGP(DDB, LOGL_ERROR, "osmo_rand() failed\n");
 			return 1;
 		}
 		if (!try) /* 0 is an invalid token */
diff --git a/openbsc/src/osmo-bsc_nat/Makefile.am b/openbsc/src/osmo-bsc_nat/Makefile.am
index be33d28..e7b78c9 100644
--- a/openbsc/src/osmo-bsc_nat/Makefile.am
+++ b/openbsc/src/osmo-bsc_nat/Makefile.am
@@ -13,7 +13,6 @@
 	$(LIBOSMOSCCP_CFLAGS) \
 	$(LIBOSMOABIS_CFLAGS) \
 	$(LIBOSMONETIF_CFLAGS) \
-	$(LIBCRYPTO_CFLAGS) \
 	$(COVERAGE_CFLAGS) \
 	$(NULL)
 
@@ -53,6 +52,5 @@
 	$(LIBOSMOCTRL_LIBS) \
 	$(LIBOSMOABIS_LIBS) \
 	$(LIBOSMONETIF_LIBS) \
-	$(LIBCRYPTO_LIBS) \
 	-lrt \
 	$(NULL)
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c
index a4dd679..ee7d0c5 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat.c
+++ b/openbsc/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
@@ -223,7 +221,7 @@
 	buf = v_put(buf, 0x23);
 	mrand = bsc->last_rand;
 
-	if (RAND_bytes(mrand, 16) != 1)
+	if (osmo_rand(mrand, 16) < 0)
 		goto failed_random;
 
 	memcpy(buf, mrand, 16);
diff --git a/openbsc/src/osmo-nitb/Makefile.am b/openbsc/src/osmo-nitb/Makefile.am
index f4ef487..ce6cf52 100644
--- a/openbsc/src/osmo-nitb/Makefile.am
+++ b/openbsc/src/osmo-nitb/Makefile.am
@@ -40,6 +40,5 @@
 	$(LIBOSMOCTRL_LIBS) \
 	$(LIBOSMOABIS_LIBS) \
 	$(LIBSMPP34_LIBS) \
-	$(LIBCRYPTO_LIBS) \
 	-ldbi \
 	$(NULL)
diff --git a/openbsc/tests/channel/Makefile.am b/openbsc/tests/channel/Makefile.am
index 5e9583f..aea3b71 100644
--- a/openbsc/tests/channel/Makefile.am
+++ b/openbsc/tests/channel/Makefile.am
@@ -30,6 +30,5 @@
 	$(top_builddir)/src/libcommon/libcommon.a \
 	$(LIBOSMOCORE_LIBS) \
 	$(LIBOSMOGSM_LIBS) \
-	$(LIBCRYPTO_LIBS) \
 	-ldbi \
 	$(NULL)
diff --git a/openbsc/tests/db/Makefile.am b/openbsc/tests/db/Makefile.am
index 0eed5cd..7099645 100644
--- a/openbsc/tests/db/Makefile.am
+++ b/openbsc/tests/db/Makefile.am
@@ -43,6 +43,5 @@
 	$(LIBOSMOGSM_LIBS) \
 	$(LIBSMPP34_LIBS) \
 	$(LIBOSMOVTY_LIBS) \
-	$(LIBCRYPTO_LIBS) \
 	-ldbi \
 	$(NULL)
diff --git a/openbsc/tests/gbproxy/Makefile.am b/openbsc/tests/gbproxy/Makefile.am
index 2dd66df..5027778 100644
--- a/openbsc/tests/gbproxy/Makefile.am
+++ b/openbsc/tests/gbproxy/Makefile.am
@@ -28,7 +28,7 @@
 	$(NULL)
 
 gbproxy_test_LDFLAGS = \
-	-Wl,--wrap=RAND_bytes \
+	-Wl,--wrap=osmo_rand \
 	$(NULL)
 
 gbproxy_test_LDADD = \
@@ -49,6 +49,5 @@
 	$(LIBOSMOVTY_LIBS) \
 	$(LIBOSMOABIS_LIBS) \
 	$(LIBRARY_DL) \
-	$(LIBCRYPTO_LIBS) \
 	-lrt \
 	$(NULL)
diff --git a/openbsc/tests/gbproxy/gbproxy_test.c b/openbsc/tests/gbproxy/gbproxy_test.c
index 577daa9..356837e 100644
--- a/openbsc/tests/gbproxy/gbproxy_test.c
+++ b/openbsc/tests/gbproxy/gbproxy_test.c
@@ -37,8 +37,6 @@
 #include <openbsc/gprs_gb_parse.h>
 #include <openbsc/debug.h>
 
-#include <openssl/rand.h>
-
 #define REMOTE_BSS_ADDR 0x01020304
 #define REMOTE_SGSN_ADDR 0x05060708
 
@@ -53,30 +51,30 @@
 
 struct llist_head *received_messages = NULL;
 
-/* override, requires '-Wl,--wrap=RAND_bytes' */
-int __real_RAND_bytes(unsigned char *buf, int num);
-int mock_RAND_bytes(unsigned char *buf, int num);
-int (*RAND_bytes_cb)(unsigned char *, int) =
-  &mock_RAND_bytes;
+/* override, requires '-Wl,--wrap=osmo_rand' */
+int __real_osmo_rand(uint8_t *data, size_t len);
+int mock_osmo_rand(uint8_t *data, size_t len);
+int (*osmo_rand_cb)(uint8_t *, size_t) =
+  &mock_osmo_rand;
 
-int __wrap_RAND_bytes(unsigned char *buf, int num)
+int __wrap_osmo_rand(uint8_t *data, size_t len)
 {
-	return (*RAND_bytes_cb)(buf, num);
+	return (*osmo_rand_cb)(data, len);
 }
 
 static int rand_seq_num = 0;
-int mock_RAND_bytes(unsigned char *buf, int num)
+int mock_osmo_rand(uint8_t *data, size_t len)
 {
 	uint32_t val;
 
-	OSMO_ASSERT(num == sizeof(val));
-	OSMO_ASSERT(__real_RAND_bytes(buf, num) == 1);
+	OSMO_ASSERT(len == sizeof(val));
+	OSMO_ASSERT(__real_osmo_rand(data, len) == 0);
 
 	val = 0x00dead00 + rand_seq_num;
 
 	rand_seq_num++;
 
-	memcpy(buf, &val, num);
+	memcpy(data, &val, len);
 
 	return 1;
 }
diff --git a/openbsc/tests/mm_auth/Makefile.am b/openbsc/tests/mm_auth/Makefile.am
index cb35198..a591d0a 100644
--- a/openbsc/tests/mm_auth/Makefile.am
+++ b/openbsc/tests/mm_auth/Makefile.am
@@ -8,7 +8,6 @@
 	$(LIBOSMOCORE_CFLAGS) \
 	$(LIBOSMOABIS_CFLAGS) \
 	$(LIBOSMOGSM_CFLAGS) \
-	$(LIBCRYPTO_CFLAGS) \
 	$(NULL)
 
 noinst_PROGRAMS = \
diff --git a/openbsc/tests/mm_auth/mm_auth_test.c b/openbsc/tests/mm_auth/mm_auth_test.c
index b8777a8..2d5df72 100644
--- a/openbsc/tests/mm_auth/mm_auth_test.c
+++ b/openbsc/tests/mm_auth/mm_auth_test.c
@@ -120,8 +120,8 @@
 	return auth_action;
 }
 
-/* override libssl RAND_bytes() to get testable crypto results */
-int RAND_bytes(uint8_t *rand, int len)
+/* override osmo_rand() to get testable crypto results */
+int osmo_rand(uint8_t *rand, size_t len)
 {
 	memset(rand, 23, len);
 	return 1;
diff --git a/openbsc/tests/sgsn/Makefile.am b/openbsc/tests/sgsn/Makefile.am
index f1606cb..ab45bdf 100644
--- a/openbsc/tests/sgsn/Makefile.am
+++ b/openbsc/tests/sgsn/Makefile.am
@@ -32,7 +32,7 @@
 	$(NULL)
 
 sgsn_test_LDFLAGS = \
-	-Wl,--wrap=RAND_bytes \
+	-Wl,--wrap=osmo_rand \
 	-Wl,--wrap=sgsn_update_subscriber_data \
 	-Wl,--wrap=gprs_subscr_request_update_location \
 	-Wl,--wrap=gprs_subscr_request_auth_info \
@@ -66,7 +66,6 @@
 	$(LIBOSMOGSM_LIBS) \
 	$(LIBOSMOGB_LIBS) \
 	$(LIBCARES_LIBS) \
-	$(LIBCRYPTO_LIBS) \
 	$(LIBGTP_LIBS) \
 	-lrt \
 	-lm \
diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c
index b4bcaf6..d8fae1b 100644
--- a/openbsc/tests/sgsn/sgsn_test.c
+++ b/openbsc/tests/sgsn/sgsn_test.c
@@ -99,21 +99,22 @@
 	return 0;
 }
 
-/* override, requires '-Wl,--wrap=RAND_bytes' */
-int __real_RAND_bytes(unsigned char *buf, int num);
-int mock_RAND_bytes(unsigned char *buf, int num);
-int (*RAND_bytes_cb)(unsigned char *, int) =
-  &mock_RAND_bytes;
+/* override, requires '-Wl,--wrap=osmo_rand' */
+int __real_osmo_rand(uint8_t *data, size_t len);
+int mock_osmo_rand(uint8_t *data, size_t len);
+int (*osmo_rand_cb)(uint8_t *, size_t) =
+  &mock_osmo_rand;
 
-int __wrap_RAND_bytes(unsigned char *buf, int num)
+int __wrap_osmo_rand(uint8_t *buf, size_t num)
 {
-	return (*RAND_bytes_cb)(buf, num);
+	return (*osmo_rand_cb)(buf, num);
 }
 /* make results of A&C ref predictable */
-int mock_RAND_bytes(unsigned char *buf, int num)
+int mock_osmo_rand(uint8_t *data, size_t num)
 {
+	uint8_t *buf = (uint8_t *)data;
 	if (num > 1)
-		return __real_RAND_bytes(buf, num);
+		return __real_osmo_rand(data, num);
 	buf[0] = 0;
 	return 1;
 }
diff --git a/openbsc/tests/sndcp_xid/Makefile.am b/openbsc/tests/sndcp_xid/Makefile.am
index 99b9d1a..6f8ffe0 100644
--- a/openbsc/tests/sndcp_xid/Makefile.am
+++ b/openbsc/tests/sndcp_xid/Makefile.am
@@ -14,7 +14,6 @@
 	$(LIBOSMOGSM_LIBS) \
 	$(LIBOSMOGB_LIBS) \
 	$(LIBCARES_LIBS) \
-	$(LIBCRYPTO_LIBS) \
 	-lgtp -lrt -lm
 
 
diff --git a/openbsc/tests/xid/Makefile.am b/openbsc/tests/xid/Makefile.am
index aaf17ed..9956f36 100644
--- a/openbsc/tests/xid/Makefile.am
+++ b/openbsc/tests/xid/Makefile.am
@@ -31,7 +31,6 @@
 	$(LIBOSMOGSM_LIBS) \
 	$(LIBOSMOGB_LIBS) \
 	$(LIBCARES_LIBS) \
-	$(LIBCRYPTO_LIBS) \
 	$(LIBGTP_LIBS) \
 	-lrt \
 	-lm \

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I270c33912bf107b3c7c217d199262cc74d56ffdb
Gerrit-PatchSet: 6
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: tnt <tnt at 246tNt.com>



More information about the gerrit-log mailing list