gprs/gb_proxy: Use RAND_bytes for gbproxy TLLI/TMSI allocation
This change has some implications for the test case. It manipulated
bss_ptmsi_state and sgsn_tlli_state variables to make the output of
rand_r() and thus the TLLI/TMSI used predictable.
This possibility is gone when using RAND_bytes() so instead it is
overridden by a function that returns a deterministic sequence of values
(0x00dead00, 0x00dead01, ...). The test cases are adapted to expect
these values instead of the pseudo random values before.
The gbproxy_test stdout file changes as well, but only where the
TLLI/TMSI is displayed (in the hex dumps as well as the TLLI cache
entries). All other output is the same.
diff --git a/openbsc/tests/gbproxy/Makefile.am b/openbsc/tests/gbproxy/Makefile.am
index 4577e3a..18d77a8 100644
--- a/openbsc/tests/gbproxy/Makefile.am
+++ b/openbsc/tests/gbproxy/Makefile.am
@@ -7,6 +7,8 @@
noinst_PROGRAMS = gbproxy_test
gbproxy_test_SOURCES = gbproxy_test.c
+gbproxy_test_LDFLAGS = \
+ -Wl,--wrap=RAND_bytes
gbproxy_test_LDADD = \
$(top_builddir)/src/gprs/gb_proxy.o \
$(top_builddir)/src/gprs/gb_proxy_patch.o \
@@ -22,4 +24,4 @@
$(LIBOSMOCORE_LIBS) $(LIBOSMOGB_LIBS) \
$(LIBOSMOGSM_LIBS) $(LIBOSMOVTY_LIBS) \
$(LIBOSMOABIS_LIBS) $(LIBRARY_DL) \
- -lrt
+ $(LIBCRYPTO_LIBS) -lrt