aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrent Cook <bcook@openbsd.org>2014-12-04 22:37:22 -0600
committerBrent Cook <bcook@openbsd.org>2014-12-06 09:13:56 -0600
commitb3270494f043104b7d63d5b30f47464b5bf253db (patch)
tree92ce7ca11ef5f583bb5524e524e5febab08865e3
parentfc5e43c32b886510660c17ebfb7d78b450ceb2a3 (diff)
downloadportable-b3270494f043104b7d63d5b30f47464b5bf253db.tar.gz
portable-b3270494f043104b7d63d5b30f47464b5bf253db.tar.bz2
portable-b3270494f043104b7d63d5b30f47464b5bf253db.zip
add support for building libtls
Use './configure --enable-libtls' to build the library and install the associated manpages. Note that the API and ABI of this library may change still, though feedback is welcome. ok deraadt@ jsing@ tedu@
-rw-r--r--.gitignore4
-rw-r--r--Makefile.am6
-rw-r--r--configure.ac8
-rw-r--r--include/Makefile.am6
-rw-r--r--libtls.pc.in16
-rw-r--r--man/Makefile.am.tpl1
-rw-r--r--man/links30
-rw-r--r--tls/Makefile.am.tpl10
-rwxr-xr-xupdate.sh49
9 files changed, 118 insertions, 12 deletions
diff --git a/.gitignore b/.gitignore
index cbeb21e..28ec955 100644
--- a/.gitignore
+++ b/.gitignore
@@ -87,12 +87,16 @@ INSTALL
87crypto/Makefile.am 87crypto/Makefile.am
88include/openssl/Makefile.am 88include/openssl/Makefile.am
89ssl/Makefile.am 89ssl/Makefile.am
90tls/Makefile.am
90apps/Makefile.am 91apps/Makefile.am
91tests/Makefile.am 92tests/Makefile.am
92 93
93ssl/*.c 94ssl/*.c
94ssl/*.h 95ssl/*.h
96tls/*.c
97tls/*.h
95include/pqueue.h 98include/pqueue.h
99include/tls.h
96include/openssl/*.h 100include/openssl/*.h
97include/openssl/*.he 101include/openssl/*.he
98apps/*.c 102apps/*.c
diff --git a/Makefile.am b/Makefile.am
index 12d8be7..a9cd1ac 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,11 @@
1SUBDIRS = crypto ssl include apps tests man 1SUBDIRS = crypto ssl tls include apps tests man
2ACLOCAL_AMFLAGS = -I m4 2ACLOCAL_AMFLAGS = -I m4
3 3
4pkgconfigdir = $(libdir)/pkgconfig 4pkgconfigdir = $(libdir)/pkgconfig
5pkgconfig_DATA = libcrypto.pc libssl.pc openssl.pc 5pkgconfig_DATA = libcrypto.pc libssl.pc openssl.pc
6 6
7if ENABLE_LIBTLS
8pkgconfig_DATA += libtls.pc
9endif
10
7EXTRA_DIST = VERSION 11EXTRA_DIST = VERSION
diff --git a/configure.ac b/configure.ac
index b434190..491e4b8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -143,14 +143,20 @@ AC_ARG_ENABLE([asm],
143 AS_HELP_STRING([--disable-asm], [Disable assembly])) 143 AS_HELP_STRING([--disable-asm], [Disable assembly]))
144AS_IF([test "x$enable_asm" = "xno"], [CFLAGS="$CFLAGS -DOPENSSL_NO_ASM"]) 144AS_IF([test "x$enable_asm" = "xno"], [CFLAGS="$CFLAGS -DOPENSSL_NO_ASM"])
145 145
146AC_ARG_ENABLE([libtls],
147 AS_HELP_STRING([--enable-libtls], [Enable building the libtls library]))
148AM_CONDITIONAL([ENABLE_LIBTLS], [test "x$enable_libtls" = xyes])
149AM_COND_IF([ENABLE_LIBTLS], [AC_CONFIG_FILES([libtls.pc])])
150
146LT_INIT 151LT_INIT
147 152
148AC_CONFIG_FILES([ 153AC_CONFIG_FILES([
149 Makefile 154 Makefile
150 include/Makefile 155 include/Makefile
151 include/openssl/Makefile 156 include/openssl/Makefile
152 ssl/Makefile
153 crypto/Makefile 157 crypto/Makefile
158 ssl/Makefile
159 tls/Makefile
154 tests/Makefile 160 tests/Makefile
155 apps/Makefile 161 apps/Makefile
156 man/Makefile 162 man/Makefile
diff --git a/include/Makefile.am b/include/Makefile.am
index 543713e..ad06032 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1,3 +1,5 @@
1include $(top_srcdir)/Makefile.am.common
2
1SUBDIRS = openssl 3SUBDIRS = openssl
2 4
3noinst_HEADERS = err.h 5noinst_HEADERS = err.h
@@ -24,3 +26,7 @@ noinst_HEADERS += sys/select.h
24noinst_HEADERS += sys/socket.h 26noinst_HEADERS += sys/socket.h
25noinst_HEADERS += sys/times.h 27noinst_HEADERS += sys/times.h
26noinst_HEADERS += sys/types.h 28noinst_HEADERS += sys/types.h
29
30if ENABLE_LIBTLS
31include_HEADERS = tls.h
32endif
diff --git a/libtls.pc.in b/libtls.pc.in
new file mode 100644
index 0000000..19e6b32
--- /dev/null
+++ b/libtls.pc.in
@@ -0,0 +1,16 @@
1#libtls pkg-config source file
2
3prefix=@prefix@
4exec_prefix=@exec_prefix@
5libdir=@libdir@
6includedir=@includedir@
7
8Name: LibreSSL-libtls
9Description: Secure communications using the TLS socket protocol.
10Version: @VERSION@
11Requires:
12Requires.private: libcrypto libssl
13Conflicts:
14Libs: -L${libdir} -ltls
15Libs.private: @LIBS@ -lcrypto -lssl
16Cflags: -I${includedir}
diff --git a/man/Makefile.am.tpl b/man/Makefile.am.tpl
index 0078a64..4e562a0 100644
--- a/man/Makefile.am.tpl
+++ b/man/Makefile.am.tpl
@@ -1,3 +1,2 @@
1include $(top_srcdir)/Makefile.am.common 1include $(top_srcdir)/Makefile.am.common
2dist_man_MANS= 2dist_man_MANS=
3
diff --git a/man/links b/man/links
index bb48556..92ae1dd 100644
--- a/man/links
+++ b/man/links
@@ -1,4 +1,32 @@
1MLINKS="ASN1_OBJECT_new.3,ASN1_OBJECT_free.3 \ 1TLS_MLINKS="tls_init.3,tls_config_new.3
2 tls_init.3,tls_config_free.3
3 tls_init.3,tls_config_set_ca_file.3
4 tls_init.3,tls_config_set_ca_path.3
5 tls_init.3,tls_config_set_cert_file.3
6 tls_init.3,tls_config_set_cert_mem.3
7 tls_init.3,tls_config_set_ciphers.3
8 tls_init.3,tls_config_set_ecdhcurve.3
9 tls_init.3,tls_config_set_key_file.3
10 tls_init.3,tls_config_set_key_mem.3
11 tls_init.3,tls_config_set_protocols.3
12 tls_init.3,tls_config_set_verify_depth.3
13 tls_init.3,tls_config_clear_keys.3
14 tls_init.3,tls_config_insecure_noverifyhost.3
15 tls_init.3,tls_config_insecure_noverifycert.3
16 tls_init.3,tls_config_verify.3
17 tls_init.3,tls_client.3
18 tls_init.3,tls_server.3
19 tls_init.3,tls_configure.3
20 tls_init.3,tls_error.3
21 tls_init.3,tls_reset.3
22 tls_init.3,tls_free.3
23 tls_init.3,tls_close.3
24 tls_init.3,tls_connect.3
25 tls_init.3,tls_connect_socket.3
26 tls_init.3,tls_read.3
27 tls_init.3,tls_write.3"
28
29SSL_MLINKS="ASN1_OBJECT_new.3,ASN1_OBJECT_free.3 \
2 ASN1_STRING_length.3,ASN1_STRING_cmp.3 \ 30 ASN1_STRING_length.3,ASN1_STRING_cmp.3 \
3 ASN1_STRING_length.3,ASN1_STRING_data.3 \ 31 ASN1_STRING_length.3,ASN1_STRING_data.3 \
4 ASN1_STRING_length.3,ASN1_STRING_dup.3 \ 32 ASN1_STRING_length.3,ASN1_STRING_dup.3 \
diff --git a/tls/Makefile.am.tpl b/tls/Makefile.am.tpl
new file mode 100644
index 0000000..7c4bf5c
--- /dev/null
+++ b/tls/Makefile.am.tpl
@@ -0,0 +1,10 @@
1include $(top_srcdir)/Makefile.am.common
2
3lib_LTLIBRARIES = libtls.la
4
5libtls_la_LDFLAGS = -version-info libtls-version
6
7libtls_la_CFLAGS = $(CFLAGS) $(USER_CFLAGS)
8libtls_la_SOURCES =
9noinst_HEADERS =
10
diff --git a/update.sh b/update.sh
index 14823f5..bb651a4 100755
--- a/update.sh
+++ b/update.sh
@@ -16,21 +16,26 @@ fi
16 git pull --rebase) 16 git pull --rebase)
17 17
18dir=`pwd` 18dir=`pwd`
19libssl_src=$dir/openbsd/src/lib/libssl
20libssl_regress=$dir/openbsd/src/regress/lib/libssl
21libc_src=$dir/openbsd/src/lib/libc 19libc_src=$dir/openbsd/src/lib/libc
22libc_regress=$dir/openbsd/src/regress/lib/libc 20libc_regress=$dir/openbsd/src/regress/lib/libc
23libcrypto_src=$dir/openbsd/src/lib/libcrypto 21libcrypto_src=$dir/openbsd/src/lib/libcrypto
24openssl_cmd_src=$dir/openbsd/src/usr.bin/openssl
25libcrypto_regress=$dir/openbsd/src/regress/lib/libcrypto 22libcrypto_regress=$dir/openbsd/src/regress/lib/libcrypto
23libssl_src=$dir/openbsd/src/lib/libssl
24libssl_regress=$dir/openbsd/src/regress/lib/libssl
25libtls_src=$dir/openbsd/src/lib/libtls
26openssl_cmd_src=$dir/openbsd/src/usr.bin/openssl
27
28source $libcrypto_src/crypto/shlib_version
29libcrypto_version=$major:$minor:0
30echo "libcrypto version $libcrypto_version"
26 31
27source $libssl_src/ssl/shlib_version 32source $libssl_src/ssl/shlib_version
28libssl_version=$major:$minor:0 33libssl_version=$major:$minor:0
29echo libssl version $libssl_version 34echo "libssl version $libssl_version"
30 35
31source $libcrypto_src/crypto/shlib_version 36source $libtls_src/shlib_version
32libcrypto_version=$major:$minor:0 37libtls_version=$major:$minor:0
33echo libcrypto version $libcrypto_version 38echo "libtls version $libtls_version"
34 39
35CP='cp -p' 40CP='cp -p'
36 41
@@ -63,6 +68,7 @@ $CP $libcrypto_src/crypto/arch/amd64/opensslconf.h include/openssl
63$CP $libssl_src/src/crypto/opensslfeatures.h include/openssl 68$CP $libssl_src/src/crypto/opensslfeatures.h include/openssl
64$CP $libssl_src/src/e_os2.h include/openssl 69$CP $libssl_src/src/e_os2.h include/openssl
65$CP $libssl_src/src/ssl/pqueue.h include 70$CP $libssl_src/src/ssl/pqueue.h include
71$CP $libtls_src/tls.h include
66 72
67for i in explicit_bzero.c strlcpy.c strlcat.c strndup.c strnlen.c \ 73for i in explicit_bzero.c strlcpy.c strlcat.c strndup.c strnlen.c \
68 timingsafe_bcmp.c timingsafe_memcmp.c; do 74 timingsafe_bcmp.c timingsafe_memcmp.c; do
@@ -386,6 +392,23 @@ echo "EXTRA_DIST += testssl ca.pem server.pem" >> tests/Makefile.am
386 done 392 done
387) 393)
388 394
395rm -f tls/*.c tls/*.h
396for i in tls_internal.h tls.c tls_server.c tls_client.c tls_util.c \
397 tls_config.c tls_verify.c; do
398 cp $libtls_src/$i tls
399done
400(cd tls
401 sed -e "s/libtls-version/${libtls_version}/" Makefile.am.tpl > Makefile.am
402 echo "if ENABLE_LIBTLS" >> Makefile.am
403 for i in `ls -1 *.c|sort`; do
404 echo "libtls_la_SOURCES += $i" >> Makefile.am
405 done
406 for i in `ls -1 *.h|sort`; do
407 echo "noinst_HEADERS += $i" >> Makefile.am
408 done
409 echo "endif" >> Makefile.am
410)
411
389# do not directly compile C files that are included in other C files 412# do not directly compile C files that are included in other C files
390crypto_excludes=( 413crypto_excludes=(
391 des/ncbc_enc.c 414 des/ncbc_enc.c
@@ -478,6 +501,10 @@ apps_win32_only=(
478 done 501 done
479 $CP $openssl_cmd_src/openssl.1 . 502 $CP $openssl_cmd_src/openssl.1 .
480 echo "dist_man_MANS += openssl.1" >> Makefile.am 503 echo "dist_man_MANS += openssl.1" >> Makefile.am
504 $CP $libtls_src/tls_init.3 .
505 echo "if ENABLE_LIBTLS" >> Makefile.am
506 echo "dist_man_MANS += tls_init.3" >> Makefile.am
507 echo "endif" >> Makefile.am
481 508
482 # convert remaining POD manpages 509 # convert remaining POD manpages
483 for i in `ls -1 $libssl_src/src/doc/crypto/*.pod | sort`; do 510 for i in `ls -1 $libssl_src/src/doc/crypto/*.pod | sort`; do
@@ -494,8 +521,14 @@ apps_win32_only=(
494 521
495 echo "install-data-hook:" >> Makefile.am 522 echo "install-data-hook:" >> Makefile.am
496 source ./links 523 source ./links
497 for i in $MLINKS; do 524 for i in $SSL_MLINKS; do
525 IFS=","; set $i; unset IFS
526 echo " ln -f \$(DESTDIR)\$(mandir)/man3/$1 \$(DESTDIR)\$(mandir)/man3/$2" >> Makefile.am
527 done
528 echo "if ENABLE_LIBTLS" >> Makefile.am
529 for i in $TLS_MLINKS; do
498 IFS=","; set $i; unset IFS 530 IFS=","; set $i; unset IFS
499 echo " ln -f \$(DESTDIR)\$(mandir)/man3/$1 \$(DESTDIR)\$(mandir)/man3/$2" >> Makefile.am 531 echo " ln -f \$(DESTDIR)\$(mandir)/man3/$1 \$(DESTDIR)\$(mandir)/man3/$2" >> Makefile.am
500 done 532 done
533 echo "endif" >> Makefile.am
501) 534)