In LDADD, put OPENSSL_LIBS first
diff --git a/Makefile.am b/Makefile.am
index 8c688ba..1f0302b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -61,12 +61,12 @@
   ndn-cpp/c/transport/socket-transport.h ndn-cpp/c/transport/udp-transport.h ndn-cpp/transport/udp-transport.cpp ndn-cpp/transport/udp-transport.hpp
 
 bin_test_encode_decode_interest_SOURCES = tests/test-encode-decode-interest.cpp
-bin_test_encode_decode_interest_LDADD = libndn-cpp.la libndn-c.la
+bin_test_encode_decode_interest_LDADD = $(OPENSSL_LIBS) libndn-cpp.la libndn-c.la
 
 bin_test_encode_decode_data_SOURCES = tests/test-encode-decode-data.cpp
-bin_test_encode_decode_data_LDADD = libndn-cpp.la libndn-c.la $(OPENSSL_LIBS)
+bin_test_encode_decode_data_LDADD = $(OPENSSL_LIBS) libndn-cpp.la libndn-c.la
 
 bin_test_get_async_SOURCES = tests/test-get-async.cpp
-bin_test_get_async_LDADD = libndn-cpp.la libndn-c.la
+bin_test_get_async_LDADD = $(OPENSSL_LIBS) libndn-cpp.la libndn-c.la
 
 dist_noinst_SCRIPTS = autogen.sh
diff --git a/Makefile.in b/Makefile.in
index 1c6e2fc..5c9df2a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -167,17 +167,18 @@
 bin_test_encode_decode_data_OBJECTS =  \
 	$(am_bin_test_encode_decode_data_OBJECTS)
 am__DEPENDENCIES_1 =
-bin_test_encode_decode_data_DEPENDENCIES = libndn-cpp.la libndn-c.la \
-	$(am__DEPENDENCIES_1)
+bin_test_encode_decode_data_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	libndn-cpp.la libndn-c.la
 am_bin_test_encode_decode_interest_OBJECTS =  \
 	tests/test-encode-decode-interest.$(OBJEXT)
 bin_test_encode_decode_interest_OBJECTS =  \
 	$(am_bin_test_encode_decode_interest_OBJECTS)
-bin_test_encode_decode_interest_DEPENDENCIES = libndn-cpp.la \
-	libndn-c.la
+bin_test_encode_decode_interest_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	libndn-cpp.la libndn-c.la
 am_bin_test_get_async_OBJECTS = tests/test-get-async.$(OBJEXT)
 bin_test_get_async_OBJECTS = $(am_bin_test_get_async_OBJECTS)
-bin_test_get_async_DEPENDENCIES = libndn-cpp.la libndn-c.la
+bin_test_get_async_DEPENDENCIES = $(am__DEPENDENCIES_1) libndn-cpp.la \
+	libndn-c.la
 SCRIPTS = $(dist_noinst_SCRIPTS)
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
@@ -507,11 +508,11 @@
   ndn-cpp/c/transport/socket-transport.h ndn-cpp/c/transport/udp-transport.h ndn-cpp/transport/udp-transport.cpp ndn-cpp/transport/udp-transport.hpp
 
 bin_test_encode_decode_interest_SOURCES = tests/test-encode-decode-interest.cpp
-bin_test_encode_decode_interest_LDADD = libndn-cpp.la libndn-c.la
+bin_test_encode_decode_interest_LDADD = $(OPENSSL_LIBS) libndn-cpp.la libndn-c.la
 bin_test_encode_decode_data_SOURCES = tests/test-encode-decode-data.cpp
-bin_test_encode_decode_data_LDADD = libndn-cpp.la libndn-c.la $(OPENSSL_LIBS)
+bin_test_encode_decode_data_LDADD = $(OPENSSL_LIBS) libndn-cpp.la libndn-c.la
 bin_test_get_async_SOURCES = tests/test-get-async.cpp
-bin_test_get_async_LDADD = libndn-cpp.la libndn-c.la
+bin_test_get_async_LDADD = $(OPENSSL_LIBS) libndn-cpp.la libndn-c.la
 dist_noinst_SCRIPTS = autogen.sh
 all: config.h
 	$(MAKE) $(AM_MAKEFLAGS) all-am