diff --git a/.travis.yml b/.travis.yml
index 7d48e343f59331ba9fc8d410c7985cfef63f0349..55cf4d3aaf9e42a224c388fa4b5643aa11d27e6a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,4 +1,8 @@
 language: cpp
+env:
+  matrix:
+    - SSL_LIB=boringssl
+    - SSL_LIB=openssl
 compiler:
   - clang
   - gcc
@@ -29,18 +33,13 @@ before_install:
   - $CC --version
   - cmake --version
 before_script:
-  # First build boringssl
-  - git clone https://boringssl.googlesource.com/boringssl
-  - cd boringssl
-  - mkdir build
-  - cd build
-  - cmake ..
-  - make
-  - cd ../../
-
+  # First build external lib
+  - if [ "$SSL_LIB" = "boringssl" ]; then ./ci/build_boringssl.sh; fi
+  - if [ "$SSL_LIB" = "openssl" ]; then ./ci/build_openssl.sh; fi
   # configure ngtcp2
   - autoreconf -i
-  - ./configure --enable-werror OPENSSL_CFLAGS=-I$PWD/boringssl/include OPENSSL_LIBS="-L$PWD/boringssl/build/ssl -L$PWD/boringssl/build/crypto -lssl -lcrypto -pthread"
+  - if [ "$SSL_LIB" = "boringssl" ]; then ./configure --enable-werror OPENSSL_CFLAGS=-I$PWD/../boringssl/include OPENSSL_LIBS="-L$PWD/../boringssl/build/ssl -L$PWD/../boringssl/build/crypto -lssl -lcrypto -pthread"; fi
+  - if [ "$SSL_LIB" = "openssl" ]; then ./configure --enable-werror PKG_CONFIG_PATH=$PWD/../openssl/build/lib/pkgconfig LDFLAGS="-Wl,-rpath,$PWD/openssl/build/lib"; fi
 script:
   # Now build ngtcp2
   - make check
diff --git a/ci/build_boringssl.sh b/ci/build_boringssl.sh
new file mode 100755
index 0000000000000000000000000000000000000000..64aa5d698256395d3cb12414622d5ce7a068a645
--- /dev/null
+++ b/ci/build_boringssl.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+#build last boringssl master (for Travis)
+
+cd ..
+git clone --depth 1 https://boringssl.googlesource.com/boringssl
+cd boringssl
+mkdir build
+cd build
+cmake ..
+make -j$(nproc)
+cd ../../
diff --git a/ci/build_openssl.sh b/ci/build_openssl.sh
new file mode 100755
index 0000000000000000000000000000000000000000..30888bd0ad8e6835c1ca34e53bc0643055bc82b9
--- /dev/null
+++ b/ci/build_openssl.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+#build last openssl master (for Travis)
+
+cd ..
+git clone --depth 1 https://github.com/openssl/openssl
+cd openssl
+./Configure enable-tls1_3 --prefix=$PWD/build linux-x86_64
+make -j$(nproc)
+make install_sw
+cd ..