diff options
author | Brent Cook <bcook@openbsd.org> | 2014-12-04 22:37:22 -0600 |
---|---|---|
committer | Brent Cook <bcook@openbsd.org> | 2014-12-06 09:13:56 -0600 |
commit | b3270494f043104b7d63d5b30f47464b5bf253db (patch) | |
tree | 92ce7ca11ef5f583bb5524e524e5febab08865e3 | |
parent | fc5e43c32b886510660c17ebfb7d78b450ceb2a3 (diff) | |
download | portable-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-- | .gitignore | 4 | ||||
-rw-r--r-- | Makefile.am | 6 | ||||
-rw-r--r-- | configure.ac | 8 | ||||
-rw-r--r-- | include/Makefile.am | 6 | ||||
-rw-r--r-- | libtls.pc.in | 16 | ||||
-rw-r--r-- | man/Makefile.am.tpl | 1 | ||||
-rw-r--r-- | man/links | 30 | ||||
-rw-r--r-- | tls/Makefile.am.tpl | 10 | ||||
-rwxr-xr-x | update.sh | 49 |
9 files changed, 118 insertions, 12 deletions
@@ -87,12 +87,16 @@ INSTALL | |||
87 | crypto/Makefile.am | 87 | crypto/Makefile.am |
88 | include/openssl/Makefile.am | 88 | include/openssl/Makefile.am |
89 | ssl/Makefile.am | 89 | ssl/Makefile.am |
90 | tls/Makefile.am | ||
90 | apps/Makefile.am | 91 | apps/Makefile.am |
91 | tests/Makefile.am | 92 | tests/Makefile.am |
92 | 93 | ||
93 | ssl/*.c | 94 | ssl/*.c |
94 | ssl/*.h | 95 | ssl/*.h |
96 | tls/*.c | ||
97 | tls/*.h | ||
95 | include/pqueue.h | 98 | include/pqueue.h |
99 | include/tls.h | ||
96 | include/openssl/*.h | 100 | include/openssl/*.h |
97 | include/openssl/*.he | 101 | include/openssl/*.he |
98 | apps/*.c | 102 | apps/*.c |
diff --git a/Makefile.am b/Makefile.am index 12d8be7..a9cd1ac 100644 --- a/Makefile.am +++ b/Makefile.am | |||
@@ -1,7 +1,11 @@ | |||
1 | SUBDIRS = crypto ssl include apps tests man | 1 | SUBDIRS = crypto ssl tls include apps tests man |
2 | ACLOCAL_AMFLAGS = -I m4 | 2 | ACLOCAL_AMFLAGS = -I m4 |
3 | 3 | ||
4 | pkgconfigdir = $(libdir)/pkgconfig | 4 | pkgconfigdir = $(libdir)/pkgconfig |
5 | pkgconfig_DATA = libcrypto.pc libssl.pc openssl.pc | 5 | pkgconfig_DATA = libcrypto.pc libssl.pc openssl.pc |
6 | 6 | ||
7 | if ENABLE_LIBTLS | ||
8 | pkgconfig_DATA += libtls.pc | ||
9 | endif | ||
10 | |||
7 | EXTRA_DIST = VERSION | 11 | EXTRA_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])) |
144 | AS_IF([test "x$enable_asm" = "xno"], [CFLAGS="$CFLAGS -DOPENSSL_NO_ASM"]) | 144 | AS_IF([test "x$enable_asm" = "xno"], [CFLAGS="$CFLAGS -DOPENSSL_NO_ASM"]) |
145 | 145 | ||
146 | AC_ARG_ENABLE([libtls], | ||
147 | AS_HELP_STRING([--enable-libtls], [Enable building the libtls library])) | ||
148 | AM_CONDITIONAL([ENABLE_LIBTLS], [test "x$enable_libtls" = xyes]) | ||
149 | AM_COND_IF([ENABLE_LIBTLS], [AC_CONFIG_FILES([libtls.pc])]) | ||
150 | |||
146 | LT_INIT | 151 | LT_INIT |
147 | 152 | ||
148 | AC_CONFIG_FILES([ | 153 | AC_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 @@ | |||
1 | include $(top_srcdir)/Makefile.am.common | ||
2 | |||
1 | SUBDIRS = openssl | 3 | SUBDIRS = openssl |
2 | 4 | ||
3 | noinst_HEADERS = err.h | 5 | noinst_HEADERS = err.h |
@@ -24,3 +26,7 @@ noinst_HEADERS += sys/select.h | |||
24 | noinst_HEADERS += sys/socket.h | 26 | noinst_HEADERS += sys/socket.h |
25 | noinst_HEADERS += sys/times.h | 27 | noinst_HEADERS += sys/times.h |
26 | noinst_HEADERS += sys/types.h | 28 | noinst_HEADERS += sys/types.h |
29 | |||
30 | if ENABLE_LIBTLS | ||
31 | include_HEADERS = tls.h | ||
32 | endif | ||
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 | |||
3 | prefix=@prefix@ | ||
4 | exec_prefix=@exec_prefix@ | ||
5 | libdir=@libdir@ | ||
6 | includedir=@includedir@ | ||
7 | |||
8 | Name: LibreSSL-libtls | ||
9 | Description: Secure communications using the TLS socket protocol. | ||
10 | Version: @VERSION@ | ||
11 | Requires: | ||
12 | Requires.private: libcrypto libssl | ||
13 | Conflicts: | ||
14 | Libs: -L${libdir} -ltls | ||
15 | Libs.private: @LIBS@ -lcrypto -lssl | ||
16 | Cflags: -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 @@ | |||
1 | include $(top_srcdir)/Makefile.am.common | 1 | include $(top_srcdir)/Makefile.am.common |
2 | dist_man_MANS= | 2 | dist_man_MANS= |
3 | |||
@@ -1,4 +1,32 @@ | |||
1 | MLINKS="ASN1_OBJECT_new.3,ASN1_OBJECT_free.3 \ | 1 | TLS_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 | |||
29 | SSL_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 @@ | |||
1 | include $(top_srcdir)/Makefile.am.common | ||
2 | |||
3 | lib_LTLIBRARIES = libtls.la | ||
4 | |||
5 | libtls_la_LDFLAGS = -version-info libtls-version | ||
6 | |||
7 | libtls_la_CFLAGS = $(CFLAGS) $(USER_CFLAGS) | ||
8 | libtls_la_SOURCES = | ||
9 | noinst_HEADERS = | ||
10 | |||
@@ -16,21 +16,26 @@ fi | |||
16 | git pull --rebase) | 16 | git pull --rebase) |
17 | 17 | ||
18 | dir=`pwd` | 18 | dir=`pwd` |
19 | libssl_src=$dir/openbsd/src/lib/libssl | ||
20 | libssl_regress=$dir/openbsd/src/regress/lib/libssl | ||
21 | libc_src=$dir/openbsd/src/lib/libc | 19 | libc_src=$dir/openbsd/src/lib/libc |
22 | libc_regress=$dir/openbsd/src/regress/lib/libc | 20 | libc_regress=$dir/openbsd/src/regress/lib/libc |
23 | libcrypto_src=$dir/openbsd/src/lib/libcrypto | 21 | libcrypto_src=$dir/openbsd/src/lib/libcrypto |
24 | openssl_cmd_src=$dir/openbsd/src/usr.bin/openssl | ||
25 | libcrypto_regress=$dir/openbsd/src/regress/lib/libcrypto | 22 | libcrypto_regress=$dir/openbsd/src/regress/lib/libcrypto |
23 | libssl_src=$dir/openbsd/src/lib/libssl | ||
24 | libssl_regress=$dir/openbsd/src/regress/lib/libssl | ||
25 | libtls_src=$dir/openbsd/src/lib/libtls | ||
26 | openssl_cmd_src=$dir/openbsd/src/usr.bin/openssl | ||
27 | |||
28 | source $libcrypto_src/crypto/shlib_version | ||
29 | libcrypto_version=$major:$minor:0 | ||
30 | echo "libcrypto version $libcrypto_version" | ||
26 | 31 | ||
27 | source $libssl_src/ssl/shlib_version | 32 | source $libssl_src/ssl/shlib_version |
28 | libssl_version=$major:$minor:0 | 33 | libssl_version=$major:$minor:0 |
29 | echo libssl version $libssl_version | 34 | echo "libssl version $libssl_version" |
30 | 35 | ||
31 | source $libcrypto_src/crypto/shlib_version | 36 | source $libtls_src/shlib_version |
32 | libcrypto_version=$major:$minor:0 | 37 | libtls_version=$major:$minor:0 |
33 | echo libcrypto version $libcrypto_version | 38 | echo "libtls version $libtls_version" |
34 | 39 | ||
35 | CP='cp -p' | 40 | CP='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 | ||
67 | for i in explicit_bzero.c strlcpy.c strlcat.c strndup.c strnlen.c \ | 73 | for 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 | ||
395 | rm -f tls/*.c tls/*.h | ||
396 | for 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 | ||
399 | done | ||
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 |
390 | crypto_excludes=( | 413 | crypto_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 | ) |