Compare commits

...

429 Commits
v2.2.7 ... main

Author SHA1 Message Date
Brent Cook
af624440e2 Land #376, adjust MSVC warnings 2018-01-07 16:22:00 -06:00
Brent Cook
c3210983a5 Land #374, hp-ux compatibility
Merge remote-tracking branch 'upstream/pr/374'
2018-01-07 16:21:11 -06:00
Brent Cook
40e04292a0 Land #375, adjust va_end calls to match scope 2018-01-07 16:19:36 -06:00
kinichiro
0ee8aa8eaf Remove unneeded -ULIBRESSL_INTERNAL 2018-01-06 18:51:45 +09:00
kinichiro
b0e9f0a354 Reconsider MSVC warning list
- Remove C4242 and C4820
- Warning explanation from manual
- Sort by warning code
2018-01-06 18:12:50 +09:00
kinichiro
1f4bfb9a4d Call va_end soon after using variable length variable
- This fix MSVC compiler warning C4702 "unreachable code".
2018-01-06 00:28:49 +09:00
kinichiro
861a6ca1db Modify regress tests/tlsexttest.c for 0 sized array
- Windows and hp-ux ANSI compiler can not handle 0 sized array initialization.
2017-12-30 20:15:56 +09:00
Brent Cook
52c39d42ea Land #373, add app_timer_user for Windows 2017-12-28 03:39:59 -06:00
Brent Cook
9a7fb37405 Land #372, Add CLOCK_MONOTONIC and timersub compatibility stubs 2017-12-28 03:38:41 -06:00
kinichiro
82ce59838e Add app_timer_user for Windows build 2017-12-26 22:49:01 +09:00
kinichiro
965a89108e Add CLOCK_MONOTONIC and timersub for the OS that does not have them 2017-12-25 16:30:49 +09:00
kinichiro
f69775d7b2 Add regress configtest 2017-12-22 23:35:48 +09:00
kinichiro
b38d7f0f8a Add regress asn1evp 2017-12-22 23:33:15 +09:00
Brent Cook
7b6953e9a9 add timerspecsub 2017-12-12 03:31:35 -06:00
Brent Cook
6d0192ff17 update for 2.7.0 2017-12-11 06:14:02 -06:00
Brent Cook
426595b267 update links 2017-12-11 05:08:54 -06:00
Brent Cook
0f7609af9a add release notes 2017-12-11 04:58:15 -06:00
Kyle J. McKay
26b40cb773 netcat.c.patch: eliminate syntax error from patch
If the target system does not define IPV6_TCLASS, this part of
the patch handles that with an ENOPROTOOPT error rather than
failing to compile.

Unfortunately it's missing a trailing semicolon leading to
a compilation error.

Add the missing semicolon to fix the problem.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
2017-12-05 15:22:15 -08:00
Evgen Bodunov
aff3a43fa0 Fixed getpagesize detection on Android 2017-11-23 15:28:25 +03:00
Brent Cook
53b5b56f39 Land #359, create correct certs dir with CMake install 2017-11-23 05:43:27 -06:00
Aric Belsito
653ba21752 Create correct directory in CMake install.
Was creating ${CONFDIR}/cert instead of ${CONFDIR}/certs.
2017-11-06 11:52:03 -08:00
Brent Cook
09ca0f7b8b fetch before update to grab new branches 2017-11-05 17:14:55 -06:00
Brent Cook
b32a92bc44 update changelog 2017-11-05 17:11:46 -06:00
Bernard Spil
794f48f1d8 Separate man(5) pages 2017-10-22 16:10:38 +02:00
Brent Cook
cd9f686793 Land #355, update libc checks 2017-09-26 09:21:38 -05:00
kinichiro
9bb3e03722 Fix checking memmem in apps/ocspcheck/CMakeLists.txt
- Issue #352 pointed out by @d3x0r
2017-09-26 22:02:21 +09:00
Brent Cook
07b9f6c371 update release notes 2017-09-25 23:06:21 -05:00
Brent Cook
6054891d43 Land #348, include .5 manpages 2017-09-17 10:08:19 -05:00
Aric Belsito
cbe57bef04 Some CMake Fixes.
pqueue.h was getting installed when it shouldn't.
pkgconfig files were not getting installed or generated.
2017-09-10 11:54:23 -07:00
kinichiro
03502b8d8f Add *.5 manpages in libcrypto/man/ 2017-09-10 12:58:47 +09:00
Brent Cook
8a2a079b6d spelling 2017-09-06 18:37:12 -05:00
Brent Cook
c53c374f83 update VS prerequisites, refer to autogen.sh more 2017-09-04 16:32:43 -05:00
Brent Cook
fa1c469601 Land #344, fix regress tlxexttest for certain C compilers 2017-09-04 16:24:49 -05:00
Brent Cook
7035c7268d be more concise, formatting 2017-09-04 16:24:14 -05:00
Brent Cook
82fda3d410 update changes 2017-09-04 16:18:20 -05:00
Brent Cook
b623db7bfb enhance README warnings, remove pod2man requirement 2017-09-04 16:14:54 -05:00
Brent Cook
3612cbe3a0 update manpage links 2017-09-03 21:52:59 -05:00
Brent Cook
d653deef65 add 2.6.1 changelog 2017-09-03 21:52:18 -05:00
kinichiro
512573f0de Add patch for regress tlsexttest
Some compiler does not support 0 sized array.
This patch changes 0 sized array to have NULL and using variable instead of
sizeof function.
2017-09-03 01:16:36 +09:00
kinichiro
f4d2b810cb Remove rsa/rsa_ssl.c 2017-09-01 23:37:09 +09:00
Brent Cook
7dc68c82bc set SMALL_TIME_T when sizeof time_t == 4 2017-08-14 12:15:00 -05:00
Brent Cook
4916f940c8 use standard initialization for poll loop delay 2017-08-13 16:09:32 -05:00
Brent Cook
9e7fd1fa31 declare struct timezone outside of the function declaration 2017-08-13 16:04:03 -05:00
Brent Cook
e0cffc6b48 disable signed/unsigned mismatch in vs builds 2017-08-13 11:49:04 -05:00
Brent Cook
8f255707f0 Land #338, disable NPN tests 2017-08-13 08:54:38 -05:00
Brent Cook
4c6097c220 bump to latest version of tap driver 2017-08-13 08:54:03 -05:00
kinichiro
23b5d39cfb Remove NPN test coverage for Windows. 2017-08-13 19:10:46 +09:00
Brent Cook
94e4224f5f don't build empty object files 2017-08-12 10:05:30 -05:00
Brent Cook
bdec057318 Land #332, fix shared library dependencies with cmake for libssl/libtls 2017-08-12 09:46:19 -05:00
kinichiro
9be0359cc3 Remove ssl/t1_reneg.c 2017-08-12 01:15:17 +09:00
Masud Rahman
1dd6a52f2d ssl/tls cmake: fix shared library dependencies
Ensure that the 'ssl' depends on 'crypto' and that 'tls' depends on
'ssl' and 'crypto' for all platforms.  Prior to this commit, the
dependency was only specified for the 'WIN32' CMake build.
2017-07-24 15:26:29 -04:00
Brent Cook
5ec2c381e4 rebase patches on latest, remove fuzz 2017-07-17 06:13:21 -05:00
Brent Cook
86434e03e8 update manpage links 2017-07-17 06:06:08 -05:00
Brent Cook
58ba8785fb add tlsext 2017-07-17 05:12:55 -05:00
Brent Cook
e53af8da67 Land #329, modify symbol exports for Darwin with cmake builds 2017-07-17 04:29:39 -05:00
Brent Cook
9887c82768 Land #331, add prototype definitions of asprintf and vasprintf for CYGWIN build 2017-07-17 04:25:21 -05:00
kinichiro
5afc4e3cd8 add prototype definitions of asprintf and vasprintf for CYGWIN build
- define _GNU_SOURCE in case of cygwin

As compilation warning report by @Dravion
2017-07-16 23:59:55 +09:00
kinichiro
f7cf93fd22 Add regression test freenull 2017-07-16 11:49:15 +09:00
Brent Cook
cefd44a86e changelog corrections 2017-07-12 04:08:47 -05:00
Brent Cook
5e6de6ebce remove duplcate changelog entry 2017-07-09 11:00:20 -05:00
Brent Cook
c92119f50a added 2.6.0 Changes 2017-07-09 10:36:22 -05:00
Brent Cook
51e5279c24 Updated changelog 2017-07-09 06:16:59 -05:00
Brent Cook
70ee57c6ad Land #328, generate the crypto export symbol list at build time 2017-07-09 05:12:21 -05:00
Brent Cook
0dbae37735 Land #324, Add option LIBRESSL_SKIP_INSTALL 2017-07-09 05:06:06 -05:00
Brent Cook
e550534203 make it easier to swap grep (Solaris grep doesn't support alpha) 2017-07-08 19:05:35 -05:00
Brent Cook
9b88fa46bb generate the crypto export symbol list at build time
we currently do it at configure time, which makes this a generated
source, but generated sources should be cleaned up, which breaks
'make clean; make'
2017-07-08 17:46:16 -05:00
kinichiro
c18852f650 Set Solaris build default to 64 bit 2017-07-08 01:43:07 +09:00
d3x0r
0e82f22d16 Okay really one more try. 2017-07-07 01:21:16 -07:00
d3x0r
9cad7f785b Okay one more try. 2017-07-07 01:20:21 -07:00
d3x0r
08869b75db use \- to prevent hyphen wrapping 2017-07-07 01:17:48 -07:00
d3x0r
fc4e1b9572 use &#8209; to prevent hyphen wrapping 2017-07-07 01:11:57 -07:00
d3x0r
a8cd9fdbd6 use &#x2011; option hyphen wrapping 2017-07-07 01:07:05 -07:00
d3x0r
3471d20142 Fix formatting for description of openssldir and skip install; add <nobr> to prevent option hyphen wrapping 2017-07-07 01:04:34 -07:00
d3x0r
a61122ef6c Fix formatting for description of openssldir and skip install 2017-07-07 01:01:08 -07:00
d3x0r
360a67cd34 Add documentation about available CMake options. 2017-07-07 00:59:05 -07:00
d3x0r
a4d80ca56a Merge branch 'master' of https://github.com/libressl-portable/portable into SkipInstall
Fix merge conflicts from GNUInstallDirs merge to master.
2017-07-06 23:11:11 -07:00
Brent Cook
334245374a Land #323, use GNUInstallDirs from cmake to specify install paths 2017-07-06 23:58:40 -05:00
Brent Cook
52080abbf7 Land #326, fix tests/tlstest.bat argument order 2017-07-06 23:57:05 -05:00
kinichiro
322b82367d fix tests/tlstest.bat 2017-07-07 01:40:35 +09:00
kinichiro
1f7777169d update netcat patch 2017-07-07 00:46:48 +09:00
d3x0r
2557dd7439 Add option LIBRESSL_SKIP_INSTALL
Internally LIBRESSL_SKIP_INSTALL, if not set becomes ENABLE_LIBRESSL_INSTALL so this by default is enabled.  defining LIBRESSL_SKIP_INSTALL before hand will disable all install() rules.
This is useful if another project includes and links to this statically.
I chose to add a prefix to avoid potential name collision because the options are cached globally.

If the installation is skipped, maybe it should also disable building apps?  I didn't do that.
2017-07-06 02:09:44 -07:00
d3x0r
a2bd5ebaba use GNUInstallDirs from cmake to specify install paths.
Primarily this is to select whether 'lib64' or 'lib' is used on linux type systems.
2017-07-06 01:49:43 -07:00
Brent Cook
728bda1830 Land #318, Fix CMake module include path 2017-07-05 23:17:49 -05:00
Brent Cook
8a658c37b5 Land #316, Remove misleading CFLAGS / LDFLAGS 2017-07-05 23:16:45 -05:00
Masud Rahman
73e51e012f cmake_export_symbol: Darwin compatibility
The Darwin platform prefixes all C symbols with an underscore.  At
link-time of a shared library, libressl generates a list of symbols to
export, but does not prefix each symbol with an underscore.

This commit addresses that issue.
2017-06-25 18:19:20 -04:00
Matt Stancliff
fe79df3c90 Fix CMake module include path
Need to search the current directory, not the overall project root directory
if this is being included as a sub-dependency of another project.
2017-06-15 23:11:13 -04:00
Brent Cook
8b80bcdad8 re-add getpagesize fallback, needed for Android 2017-06-11 11:21:34 -05:00
Paul Graham
b49242fcb0 Remove misleading CFLAGS / LDFLAGS.
These variables were being ignored because libtool doesn't pass -static-libgcc to GCC.
If you want to link libgcc statically, currently the only way to achieve this is to
manually add -static-libgcc to CC variable. See:

http://www.mingw.org/wiki/HOWTO_Sneak_GCC_Switches_Past_Libtool
2017-06-09 13:33:14 +02:00
Brent Cook
0974d6f011 update nc patch 2017-06-03 20:13:25 -05:00
kinichiro
d3f3daec18 defining DEFAULT_CA_FILE only if it is not defined.
indicated by Kyle J. McKay mackyle@gmail.com
2017-06-04 00:56:11 +09:00
Brent Cook
0da71010d6 update tlstest argument ordering 2017-05-18 00:31:20 -05:00
Brent Cook
e7b0c0069b fix hkdftest name 2017-05-18 00:31:07 -05:00
kinichiro
530fbba1ed Add definition of in_addr_t for Windows build 2017-05-14 00:00:10 +09:00
kinichiro
63042e98f8 Add HKDF functionality 2017-05-13 23:59:59 +09:00
Brent Cook
f494c6aaf7 Land #310, make it easier to build from cvs source 2017-05-08 08:32:38 -05:00
kinichiro
6cb87c121a Modify update.sh to change the path of openbsd source tree easily
With this modification, we can build portable with /usr/src easily.
2017-05-07 00:47:32 +09:00
Brent Cook
32ab245f05 remove OPENSSL_ia32cap_P from crypto.sym when generated 2017-05-01 00:20:49 -05:00
Brent Cook
6374bfa401 add 2.5.4 changelog 2017-05-01 00:20:40 -05:00
Brent Cook
7ba183503a include amd64 in the mix 2017-04-29 18:37:18 -05:00
Brent Cook
1f13e7956b only include ia32 syms on i?86/x86_64 targets 2017-04-29 18:36:14 -05:00
Brent Cook
993f5cf6f9 add back copyright notice from OpenBSD malloc.c from which this came. 2017-04-28 00:26:40 -05:00
Brent Cook
53fb56ea87 Land #306, add freezero 2017-04-28 00:22:43 -05:00
kinichiro
048625cf2b Add freezero support 2017-04-22 23:37:20 +09:00
Steven McDonald
7ec0510e33 Fix pkg-config metadata for libcrypto
It looks like this was copied and pasted from libssl.pc.in. This patch
identifies it as libcrypto rather than libssl.
2017-04-18 00:52:32 +10:00
Brent Cook
9d2418ae3a add nc(1) manpage to install if enabled 2017-04-12 08:18:20 -05:00
Brent Cook
922cd9c94e move crypto_portable.sym to builddir 2017-04-10 09:30:29 -05:00
Brent Cook
7ecfed7690 update changelog for stable release 2017-04-06 06:24:12 -05:00
Brent Cook
2c66480f5e tag OpenBSD 6.1 release 2017-04-03 22:55:17 -05:00
Brent Cook
22bda9840b condense and refine changelog a bit 2017-03-25 21:25:58 -05:00
Brent Cook
19cf5c9b01 update changelog for 2.5.2 2017-03-25 17:19:25 -05:00
Brent Cook
570717c488 rebase netcat patch 2017-03-25 12:03:37 -05:00
kinichiro
cb73e4bef6 Add regress tls_prf 2017-03-17 21:33:01 +09:00
kinichiro
350170b6ab Add regress servertest 2017-03-17 21:32:51 +09:00
Brent Cook
ff462f05a2 add getpagesize check for cmake 2017-03-16 20:54:16 -05:00
Brent Cook
764ab1e6a9 remove sysconf fallback for now 2017-03-16 19:25:42 -05:00
Brent Cook
d5b247cc4f Land #297, Add recallocarray 2017-03-16 19:23:36 -05:00
Brent Cook
8f69fe98db Land #287, document steps to enable 64-bit time_t on mingw-w64 toolchain 2017-03-16 18:56:06 -05:00
Brent Cook
8622dc7536 Land #288, update conditions under which getentropy, arc4random* are exported 2017-03-16 18:53:12 -05:00
kinichiro
c61c9821e8 Add support for getpagesize 2017-03-15 22:02:11 +09:00
kinichiro
8877e9bc55 Add recallocarray 2017-03-09 23:00:04 +09:00
kinichiro
27f0879030 Add ssl/t1_hash.c 2017-03-08 00:17:25 +09:00
kinichiro
f2c14deb58 Add crypto/evp/m_md5_sha1.c 2017-03-05 11:17:20 +09:00
kinichiro
5297e9d486 Fix condition of arc4random* and getentropy for Cygwin build
- Fix the condition of exporting getentropy
- Modify the CMake condition of including arc4random_uniform as same as autoconf
2017-02-20 11:50:47 +09:00
Paul Graham
3b4d3d7541 Remove "exit 1" (added by mistake) 2017-02-18 22:17:59 +01:00
Paul Graham
b2b47a7d11 Document 32-bit time_t problem on minw-w64 toolchain and how to avoid it 2017-02-15 23:04:04 +01:00
kinichiro
9d75e5ea97 Add definition of ssize_t to tls.h for Windows 2017-02-13 20:25:49 +09:00
Brent Cook
3ba2699dab ignore mandoc db, compat files 2017-02-07 07:53:52 -06:00
kinichiro
7383bf673b Fix patch for netcat.c 2017-02-07 18:38:03 +09:00
Brent Cook
b67d365454 update Changelog 2017-01-31 20:55:07 -06:00
kinichiro
c957ff63c0 Fix SYSerr and BIOerr in b_win.c 2017-02-01 01:13:09 +09:00
Brent Cook
97fecd593a Land #269, copy more files from libc rather than checking in 2017-01-28 09:31:56 -06:00
kinichiro
58eb645fdb Copy libc compat files rather than adding into the repository
- remove the CP_LIBC files from repo
- move tests/memmem.c to tests/compat/
2017-01-28 03:40:38 +09:00
kinichiro
fb936f89b8 Move S_IRGRP and S_IROTH from fcntl.h to sys/stat.h
- S_IRGRP and S_IROTH should be defined in sys/stat.h rather than fcntl.h
- Old MinGW64 on Ubuntu 14.04 appears not to have S_IRGRP and S_IROTH
- MinGW64 has __WIN32 defined but does not have _MSC_VER defined
2017-01-28 02:49:06 +09:00
Brent Cook
cb57534af8 skip building ocspcheck on MSCV 2017-01-27 07:14:43 -06:00
Brent Cook
b631cafca8 update manpage links 2017-01-27 05:49:17 -06:00
Brent Cook
beffe6b41d update for death of s23* 2017-01-27 05:42:33 -06:00
Brent Cook
63eaeafeec update for improved libtls manpage organization 2017-01-27 05:41:46 -06:00
kinichiro
05cf1ee697 Copy openbsd library file every time rather than statically checking in 2017-01-27 01:21:37 +09:00
kinichiro
f5026b1f3c Add S_IRGRP and S_IROTH to include/compat/fcntl.h for ocspcheck 2017-01-26 17:51:49 +09:00
kinichiro
e57ab149c2 Add STDOUT_FILENO to include/compat/unistd.h 2017-01-26 17:51:49 +09:00
kinichiro
7dd0650d33 Add inet_ntop and memmem for ocspcheck 2017-01-26 17:51:35 +09:00
kinichiro
adb94725ae Add regress rsa_test 2017-01-25 21:31:51 +09:00
kinichiro
91a8bd7914 Move strsep.c to crypto/compat/ and add ocspcheck build to CMake 2017-01-25 21:31:04 +09:00
Brent Cook
93754dc5cf initial ocspcheck integration 2017-01-24 06:06:07 -06:00
Brent Cook
fa149b8c8c updates for new tests and layout 2017-01-22 20:00:52 -06:00
Brent Cook
91f771f981 add missing ecp_nist*.c files 2017-01-18 22:59:09 -06:00
Brent Cook
301d50eaa3 check if EXTRA_EXPORT is set, fix cmake builds on OpenBSD 2017-01-18 22:59:09 -06:00
Brent Cook
e463ba3b22 Land #262, Fix fcntl.h shim for HP-UX 11.31 (ia64) 2017-01-18 21:18:51 -06:00
kinichiro
b249f68e6c Fix fcntl.h shim since HP-UX 11.31 (ia64) does not define O_CLOEXEC 2017-01-19 09:58:21 +09:00
kinichiro
484feaae91 Stop generating .def files by update.sh 2017-01-18 21:05:43 +09:00
kinichiro
3276be122f Add export symbol support to CMake for libcrypto 2017-01-18 21:05:28 +09:00
kinichiro
3b8cf47307 Add export symbol support to CMake 2017-01-18 00:34:20 +09:00
Brent Cook
3b2560feb3 MSVSC fixes 2017-01-16 10:59:24 -06:00
Brent Cook
4cb675e2d9 pass through errors for tlstest and ssltest 2017-01-16 10:59:15 -06:00
Brent Cook
f21bd20c7e add open(2) shim to handle O_BINARY and O_CLOEXEC 2017-01-16 10:59:15 -06:00
Brent Cook
51a53876b6 add fcntl shim 2017-01-16 10:59:15 -06:00
Brent Cook
c53c23c5d8 enable tlstest on win32 2017-01-15 16:00:17 -06:00
Brent Cook
057e7a85b9 add noreturn attribute to compat functions 2017-01-15 16:00:17 -06:00
Brent Cook
69e2a7fb75 handle EBADF, which is returned when a file is passed 2017-01-15 16:00:16 -06:00
Brent Cook
dbd5fb28ec add windows versions of socketpair / pipe 2017-01-15 16:00:16 -06:00
Brent Cook
dfb6b11e5a include pipe2/socketpair compat for macOS 2017-01-15 16:00:16 -06:00
Brent Cook
fa20dae329 start to enable tlstest for portable
Disabled on Windows for now due to pipe2/socketpair support.
2017-01-15 14:52:18 -06:00
kinichiro
1d934cd2d8 Fix to use -export-symbols for libcrypto
- generating platform specific crypto/crypto_portable.sym from crypto.sym
2017-01-15 22:12:39 +09:00
Brent Cook
6db4299941 Land #256, Define CMake library object lists globally 2017-01-13 08:15:26 -06:00
Matt Stancliff
63add73d0b Define CMake library object lists globally
OBJECT collections in CMake don't generate any artifacts so these
are safe to hoist out and define globally.

library OBJECT targets are just a list of filenames.  It can be useful for
other projects to include lists of sources directly regardless of build mode
(shared, static, or library).
2017-01-12 13:46:22 +08:00
Matt Stancliff
5e6c9983dd Use correct CMake base directory offset
CMAKE_SOURCE_DIR is the top-level directory of a project, but if you include
this as a dependency, the file check locations won't exist at the top level
of any parent project.

CMAKE_CURRENT_SOURCE_DIR is the actual directory of the current project()
regardless of compile mode (standalone or included in another project).
2017-01-12 13:46:03 +08:00
Brent Cook
9f9fdc0531 OSCP -> OCSP 2017-01-09 23:09:46 -06:00
Brent Cook
7acb28a3e7 update Changelog 2017-01-09 03:58:26 -06:00
Brent Cook
c691459502 fix static mingw builds, platform LDADD needs to come at the end 2017-01-09 02:22:26 -06:00
Brent Cook
45d35f0dfb update links 2017-01-07 08:36:03 -06:00
kinichiro
5a35108648 Add regression test ssl_versions 2017-01-06 09:05:59 +09:00
Brent Cook
cf056d7d43 update manpage links 2016-12-29 04:03:17 -06:00
Brent Cook
b48d11d8df Land #250, implement support for hiding symbols in libcrypto 2016-12-29 03:51:34 -06:00
kinichiro
7054105fde implement support for hiding symbols in libcrypto
- delete crypto.def and generate it from Symbols.list
- remove BIO_s_log since bss_log.c is not included on Windows
- add Windows specific symbols by crypto/crypto_win.list
2016-12-26 21:53:29 +09:00
Simone Basso
a206997ad9 Sync getentropy() checks with use-builtin-arc4random checks
Without this, we actually fail to build a library that includes the
bultin getentropy when compiling for 10.11 on 10.12.
2016-12-10 20:58:04 +01:00
Simone Basso
6fa2d21ba5 m4/check-libc.m4: improve getentropy check
- according to man.openbsd.org getentropy() is in unistd.h

- according to macOS sierra's man it's in sys/random.h

- since sys/random.h is does not exist for iOS and for linux, do
  not attempt to include it, rather redeclare the prototype

- make sure that `./configure`:

    - uses getentropy() on macOS sierra

    - does not use getentropy() if compiling for 10.11

    - does not use getentropy() if compiling for ios armv7
2016-12-09 14:17:06 +01:00
Simone Basso
f8a9c71e79 configure: fix getentropy() for sierra and ios
This diff changes the logic by which configure detects getentropy() to
ensure that we don't use the system wide getentropy

- with macOS sierra if the deployment target is lower than sierra as
  found by tor developers here

    https://gitweb.torproject.org/tor.git/commit/?id=https://gitweb.torproject.org/tor.git/commit/?id=16fcbd21c963a9a65bf55024680c8323c8b7175d

- with iOS unconditionally because an app linking libressl compiled with
  system wide getentropy has been rejected by the App store as I have
  documented here

    https://github.com/measurement-kit/measurement-kit/pull/994

I think something similar could also affect clock_gettime judging from
tor's patch, but this diff for now doesn't address that.

I do not have macOS < sierra, so I could only verify that configure was
not picking up system wide getentropy by compiling libressl using

    export CFLAGS="-mmacosx-version-min=10.11"

As regards iOS, removing the check for getentropy and recompiling (thus
using libressl builtin getentropy()) was enough to have another iteration
of the app accepted. Otherwise testing should be possible with:

    export LDFLAGS=-arch armv7 -miphoneos-version-min=7.1 -isysroot `xcrun --show-sdk-path --sdk iphoneos`
    export CPPFLAGS=-arch armv7 -isysroot `xcrun --show-sdk-path --sdk iphoneos`
    export CFLAGS=-arch armv7 -miphoneos-version-min=7.1 -isysroot `xcrun --show-sdk-path --sdk iphoneos`

Related ticket: https://github.com/libressl-portable/portable/issues/230
2016-12-09 12:50:56 +01:00
Brent Cook
b5ebbf6b88 adjust mingw package name 2016-11-13 13:10:42 -06:00
Brent Cook
a638d7937d update to trusty distro, remove 3rd-party PPAs for testing 2016-11-13 13:06:28 -06:00
Brent Cook
c4165cc210 fix static test link failures on OS X 2016-11-13 12:57:34 -06:00
Brent Cook
3b0488e870 update manpage links 2016-11-13 12:56:45 -06:00
kinichiro
04150e635c fix cmake to link static crypto library for regression tests 2016-11-07 00:07:51 +09:00
Brent Cook
4e221632b1 link regression tests fully statically 2016-11-06 09:10:25 -06:00
kinichiro
f51c1b3886 Fix for tests on Visual Studio
- always link static ssl library for tests
- copy DLLs for openssl.exe after building tests
- add functions to crypto.def
2016-11-06 22:21:58 +09:00
Brent Cook
7e4ce26c27 use __MINGW_PRINTF_FORMAT for BIO_* print functions if available 2016-11-06 04:32:16 -06:00
Brent Cook
d2f5ab1ee8 prefer builtin arc4random on OS X 10.12+ (using getentropy as the signal) 2016-11-06 03:12:34 -06:00
Brent Cook
d38ab0a39e include vpm_int.h 2016-11-06 02:37:15 -06:00
Brent Cook
f99d89a0fc update patches 2016-11-06 02:27:21 -06:00
kinichiro
5f187770f3 Add curve25519 to portable 2016-11-06 04:57:23 +09:00
Brent Cook
e0a62cf201 remove bad link 2016-11-05 14:00:54 -05:00
Brent Cook
a99a3d7287 add quoting for man links 2016-11-05 12:45:47 -05:00
Brent Cook
42ee57590a update mlinks 2016-11-05 12:31:29 -05:00
Brent Cook
55419a0dde use the new mlinks tool to generate man links 2016-11-05 12:31:29 -05:00
Brent Cook
0241a8d4da update for new manpage layout, pod files are gone 2016-11-05 12:31:29 -05:00
Brent Cook
5842215600 remove duplicate libcrypto static link 2016-11-06 00:24:56 +09:00
Brent Cook
9d14220bdb export ASN1_time_parse 2016-11-06 00:24:47 +09:00
Brent Cook
70805a3e17 remove more KRB5 2016-11-06 00:24:39 +09:00
Brent Cook
c2ec622b89 remove defined symbols 2016-11-06 00:24:30 +09:00
Brent Cook
77a2a9f3ef remove check-in .def and ignore .sym files 2016-11-06 00:24:22 +09:00
Brent Cook
7770e4f2e4 implement support for hiding symbols in libtls / libssl 2016-11-06 00:24:12 +09:00
Brent Cook
348362416d remove krb5 from cmake 2016-11-05 06:24:55 -05:00
Brent Cook
19457d72b0 enable preprocessor on all ASM files with cmake 2016-11-05 06:16:19 -05:00
Brent Cook
03a321e558 disable symbol hiding for now 2016-11-05 06:16:07 -05:00
Brent Cook
659aff9fa7 updates for latest build changes 2016-11-05 19:11:19 +09:00
Brent Cook
a241b876e9 update windows header patches 2016-11-04 11:08:47 -05:00
kinichiro
d3abaf5fe7 Add tls_ocsp.c to Makefile.am and CMakeLists.txt 2016-11-04 22:43:34 +09:00
Brent Cook
cb63e63370 define PATH_MAX in more msvc versions 2016-10-30 23:14:03 -05:00
Brent Cook
2570ad9344 set correct DEFAULT_CA_FILE path 2016-10-30 21:43:28 -05:00
kinichiro
332c2eeaa3 remove unneeded slash after DESTDIR 2016-10-30 21:40:24 -05:00
kinichiro
14905877a0 Enable tests on Visual Studio
- add patch for aeadtest.c to undef IN
- add patch for ocsp_test.c to call BIO_sock_init() before getaddrinfo()
- define STDERR_FILENO in unistd.h to build pkcs7test.c
- add option ENABLE_VSTEST(default OFF) to enable test on Visual Studio
- modify to pass test data file as an argument (aeadtest, evptest)
- add Windows scripts (ocsptest, pq_test, ssltest, testdsa, testenc, testrsa)
- do not build pidwraptest on MSVC
- fix some indentations
2016-10-30 21:40:24 -05:00
kinichiro
b434123987 modify for Intel C++ Compiler
- define _CRT_SUPPRESS_RESTRICT to avoid compilation error
- suppress compilation warnings (suggested by @Johnex)
2016-10-30 21:40:21 -05:00
kinichiro
62f2a73061 export DLLs functions for MSVC with CMake
- Add 3 DEF files to export functions from Windows DLLs
  - Add gettimeofday to crypto/crypto.def (*1)
  - Remove gai_strerrorA from tls/tls.def (*1)
- Fix CMakeLists.txt to use DEF files as PRIVATE
- Change DLL import library file name since it duplicates with static library
- Ignore compiler warning C4267, and Edit CMAKE_C_FLAGS not to overwrite it (*1)
- Add USE_SHARED option to build openssl.exe with shared libraries (*1)

  (*1) recommended by @mcnameej
2016-10-30 21:39:36 -05:00
Brent Cook
e168f3b0bc More changelog updates 2016-09-23 06:21:43 -05:00
Brent Cook
9ba1224ed4 update changelog 2016-09-23 06:13:08 -05:00
Brent Cook
a896814187 Update changelog 2016-09-23 05:41:25 -05:00
Brent Cook
b7ba692f72 ensure that __STRING works 2016-09-14 23:40:31 -05:00
Brent Cook
df20769977 remove cms 2016-09-14 08:49:53 -05:00
Brent Cook
08837a82b6 more cdefs.h removal 2016-09-04 09:04:01 -05:00
Brent Cook
5532f007d3 Land #203, add libtls callback API 2016-09-04 08:58:30 -05:00
Brent Cook
6f24864a73 cdefs.h should not be required anywhere 2016-09-04 07:57:59 -05:00
Brent Cook
6040ff04b0 wire up sys/types.h to pull in sys/cdefs.h 2016-09-04 07:38:16 -05:00
Brent Cook
93be612b5c rebase nc(1) patch 2016-09-04 05:42:23 -05:00
Brent Cook
5bb829d86d Land #219, build Windows DLLs with CMake 2016-09-04 05:00:31 -05:00
Brent Cook
22dcefee4e update for new repository layout 2016-09-02 12:43:30 -05:00
kinichiro
5ea2a55cc7 enable tls_ext_alpn regression test
- add tls_ext_alpn entry for automake and cmake
- add tests/tls_ext_alpn* to .gitignore
2016-08-30 00:57:10 +09:00
Satoshi Yasushima
829b21581f build Windows DLL on CMake
like below.
* libcrypto-38.dll
* libssl-39.dll
* libtls-11.dll
2016-08-25 18:17:27 +09:00
Satoshi Yasushima
971892766d build MinGW on CMake 2016-08-25 18:17:12 +09:00
Brent Cook
8edd509e2c Land #217, Set _PATH_SSL_CA_FILE to the tarball internal path for regression tests 2016-08-13 11:52:06 -05:00
Brent Cook
439de92dc6 Land #216, check for telnet.h before building nc 2016-08-13 11:44:30 -05:00
Brent Cook
fab6e1f251 Land #215, update cmake builds for darwin 2016-08-13 11:43:38 -05:00
Brent Cook
9e25f75800 remove DEFAULT_CA_FILE patch, since libtls handles this by default 2016-08-13 11:42:21 -05:00
kinichiro
fef54aef36 Set _PATH_SSL_CA_FILE to the tarball internal path for regression tests
- let tests to use the cert.pem in the tarball, for both automake and cmake.
- put this definition out of "if(ENABLE_EXTRATESTS)" since this can be shared by all tests.
2016-08-12 16:27:18 +09:00
jacob berkman
83e9741dc6 Disable netcat if arpa/telnet.h is not available (iOS) 2016-08-09 15:04:45 -07:00
Tamer Saadeh
2d987d32e6 compat gentroy() for macs is called gentropy_osx.c 2016-08-07 11:56:14 +02:00
Geoff Beier
36aafbb241 Set _PATH_SSL_CA_FILE to either CMAKE_INSTALL_PREFIX or OPENSSLDIR for the OCSP tests so that OCSP tests can be executed on a system without /etc/ssl/cert.pem 2016-08-01 21:28:53 -04:00
Brent Cook
7a46efa40d update changelog for 2.4.2 2016-07-31 17:56:21 -05:00
Brent Cook
a7f754a663 set link library dependencies with MSVC, fixes #221 2016-07-31 17:11:19 -05:00
Brent Cook
1fde1eaa44 properly enable strnlen checks for MSVC 2016-07-31 17:10:39 -05:00
celan69
1b10e48a1f Fix typo in USE_BUILTIN_ARC4RANDOM check
Solaris 11 recently introduced a builtin arc4random in libc which fails the tests in "make check". Found USE_BUILTIN_ARC4RANDOM, but could not get it to work. Apparently, there is a typo in the configure logic rendering USE_BUILTIN_ARC4RANDOM ineffective.
2016-07-19 12:11:28 +02:00
Brent Cook
a9332ccecf avoid BSWAP assembly for ARM <= v6 2016-07-17 18:12:23 -05:00
Brent Cook
fa435db8df format 64-bit int portably (windows wants %l64d) 2016-07-17 17:37:16 -05:00
Brent Cook
618c32e4a1 don't build nc with MSVC 2016-07-11 03:14:23 -05:00
Brent Cook
b13529f791 Revert "remove DEFAULT_CA_FILE patch, since libtls handles this by default"
This reverts commit 30adf9c06e.
2016-07-09 12:40:22 -05:00
Brent Cook
30adf9c06e remove DEFAULT_CA_FILE patch, since libtls handles this by default 2016-07-07 07:27:39 -05:00
kinichiro
23083e7724 include OCSP test script 2016-07-05 20:33:16 +09:00
Brent Cook
aab671088d add OCSP test 2016-07-04 23:29:39 -05:00
Brent Cook
ccf66c469f update for netcat changes 2016-06-30 20:00:29 -05:00
Brent Cook
ec4c98718d refine netcat patch 2016-06-30 08:18:03 -05:00
Brent Cook
13b7ac8ada update netcat patch 2016-06-30 05:49:38 -05:00
Tobias Pape
a69063be10 Portable code part for callbacks in accept/connect
see https://github.com/libressl-portable/openbsd/pull/64
2016-06-28 03:29:54 +02:00
Brent Cook
ddb22413ed update NetBSD recommendation 2016-06-07 07:10:21 -05:00
Brent Cook
2cbdc049bb Changelog for 2.4.1 2016-06-06 04:57:01 -05:00
Brent Cook
4a9e42808c Land #197, include platform linker flags in the .pc files 2016-06-03 05:14:04 -05:00
Martin Herkt
de4a123930 pc: add platform-specific libs to Libs.private
Fixes compilations including libressl static libraries in MinGW.

Signed-off-by: Ricardo Constantino (:RiCON) <wiiaboo@gmail.com>
2016-05-31 15:24:22 +01:00
Brent Cook
72ce1e1c9f Update changelog 2016-05-30 17:19:22 -05:00
Brent Cook
0c4d1b9cef update changelog 2016-05-30 11:24:10 -05:00
Brent Cook
1f6f1a3527 Update changelog 2016-05-30 11:11:37 -05:00
Brent Cook
7b420734d4 update changelog 2016-05-30 11:11:37 -05:00
Brent Cook
ff021e8abd rebase netcat patch 2016-05-30 11:08:43 -05:00
Brent Cook
40974784c0 add constant_time_locl.h 2016-05-04 08:47:55 -05:00
Brent Cook
552817b77f Land #192, fix fix ld warning "attempted multiple inclusion of file" on Solaris 2016-05-02 02:03:03 -05:00
Brent Cook
5582be55b4 Land #190, Enable cmake on Solaris 2016-05-02 02:00:55 -05:00
Brent Cook
a653a67a1e Land #189, Added extra cmake build options like autotools builds 2016-05-02 01:58:18 -05:00
Brent Cook
466e389d3f check linker flags before checking for functions 2016-04-24 03:29:14 -05:00
kinichiro
02e1cc4df1 fix ld warning "attempted multiple inclusion of file" on Solaris
- To avoid ld warning on Solaris, use abs_top_builddir in Makefile.am
2016-04-21 16:12:47 +09:00
kinichiro
49eabdcb16 organize enabling asm condition in cmake
- add amd64 as same as x86_64
- add solaris(i386)
2016-04-15 14:24:00 +09:00
kinichiro
08089a1b20 fix cmake on Solaris
- add Solaris specific compiler flags and library
- merge message when SMALL_TIME_T is true
- confirmed on SunOS Release 5.11 Version 11.3 64-bit Solaris i386
2016-04-15 01:47:20 +09:00
kinichiro
bda62f7fe4 add cmake build options
- add cmake build options as configure provides
  * -DENABLE_ASM (default ON)
  * -DENABLE_EXTRATESTS (default OFF)
  * -DENABLE_NC (default OFF)
  * -DOPENSSLDIR (default ${CMAKE_INSTALL_PREFIX}/etc/ssl)

- add biotest and pidwraptest if ENABLE_EXTRATESTS is ON

- add compiler flag `-fno-common` if CMAKE_SYSTEM_NAME is Darwin
  to prevent link error Undefined symbols "_OPENSSL_ia32cap_P"
2016-04-14 15:16:52 +09:00
kinichiro
c94670a8cd add cmake uninstall functionality
- add uninstall functionality
  * see https://cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F
2016-04-09 13:37:09 -05:00
Brent Cook
752ad82d33 Land #188, add ASM support for cmake builds 2016-04-09 12:08:26 -05:00
kinichiro
2510a5e6f9 modify cmake to build nc
- modify structure of CMakeLists.txt under apps/
  * move apps/CMakeLists.txt to apps/openssl/ since this is for openssl build
  * create new apps/nc/CMakeLists.txt for nc build
  * modify apps/CMakeLists.txt just add_subdirectory()

- add checking and compile of arc4random_uniform()

- add installing man files, openssl.1 and nc.1
2016-04-09 12:06:40 -05:00
Brent Cook
9a98de6c34 Land #185, fix MINGW and CYGWIN builds with cmake 2016-04-09 11:50:37 -05:00
Brent Cook
34bf322e6e Land #184, execute tests that require srcdir environment variable with cmake 2016-04-09 11:49:53 -05:00
Brent Cook
d9b0838432 Land #183, fix cmake on HP-UX 2016-04-09 11:49:29 -05:00
kinichiro
e1f8a1e160 modify cmake to build ASM
- add functionality compiling ASM with cmake
- to enable ASM, `cmake -DENABLE_ASM=on ..`
2016-04-08 15:09:07 +09:00
kinichiro
177e13159b add condition for setting BUILD_SHARED (cmake)
- add MINGW and CYGWIN for win build
2016-04-05 15:35:21 +09:00
kinichiro
cf45f2bdfd execute tests that require srcdir environment variable with cmake
- uncomment procedures for aeadtest, evptest, pq_test, ssltest, testdsa and testrsa
- add set_tests_properties() for setting environment variable srcdir
- tweak openssl path in ssltest.sh, testdsa.sh, testenc.sh and testrsa.sh
2016-04-05 10:02:35 +09:00
kinichiro
3207606f11 fix cmake on HP-UX
- CMakeLists.txt
  * add OS specific compiler flags and library
  * add checking size of time_t
  * add checking memmem()

- tests/CMakeLists.txt
  * add if(HAVE_MEMMEM) for explicit_bzero
  * add checking SMALL_TIME_T for rfc5280time

- crypto/CMakeLists.txt
  * add getentropy_hpux.c

- tls/CMakeLists.txt
  * fix checking strsep
2016-04-04 14:27:43 +09:00
kinichiro
2997b8577c set project LANGUAGES to C 2016-03-30 16:10:19 +09:00
kinichiro
02b00b5c07 set cmake_minimum_required to 2.8.8
`OBJECT` library type of add_library was introduced by CMake 2.8.8.
2016-03-30 12:52:16 +09:00
Brent Cook
8131b377bf update changelog 2016-03-21 05:01:12 -05:00
Brent Cook
04ceeb2c75 updated changelog 2016-03-21 04:47:24 -05:00
Brent Cook
9a0f8a424b set windows binary OPENSSLDIR to something plausible 2016-03-21 04:37:01 -05:00
kinichiro
14aa5f73ab modify include/compat/netinet/ip.h
- add including <netinet/in_systm.h> for n_long on HP-UX
2016-03-13 19:17:24 +09:00
Brent Cook
05f3422a9b fix check for strlcat
fixes #175
2016-03-12 17:10:03 -06:00
Brent Cook
be3b129221 add install_sw alias for latest nginx
fixes #174
2016-03-12 17:07:28 -06:00
Brent Cook
2c751b1cf9 update man links 2016-02-29 05:20:58 -06:00
Brent Cook
d4d040c171 add things to minimize diffs with OpenNTPD-portable 2016-02-15 13:39:06 -06:00
Brent Cook
9df51efab0 updated changelog 2016-01-27 12:33:34 -06:00
Brent Cook
8c91563f60 add solaris include for getentropy(2) 2016-01-18 09:50:23 -06:00
Brent Cook
d0ff644edc package pidwraptest.sh script 2016-01-03 21:29:35 -06:00
Brent Cook
35e669fd1a whitelist NetBSD 7.0 native arc4random(3) implementation.
NetBSD 7 improves arc4random(3) over earlier versions by adding fork
detection, stronger assertions on seed failure.
2016-01-03 21:24:05 -06:00
Brent Cook
d0009039de enable nc on AIX 2016-01-03 21:20:03 -06:00
Brent Cook
07e541cc2e replace err.h macros with inline functions
Passing NULL for the format is just easier with a function.
2016-01-03 21:20:03 -06:00
Brent Cook
cf86bf8581 prefer gnu patch on AIX 2016-01-03 21:20:02 -06:00
Brent Cook
38c577d758 include strings.h in string.h on AIX as well 2016-01-03 21:19:55 -06:00
Brent Cook
07056b2949 -path isn't really needed for perms fixup, and not supported everywhere 2016-01-03 18:55:04 -06:00
Brent Cook
f5a4ee56be rebase netcat patch 2015-12-28 08:46:59 -06:00
Brent Cook
4a931b58fc add upstream config.guess/config.sub
This adds refreshed OS and CPU detection.
https://www.gnu.org/software/gettext/manual/html_node/config_002eguess.html
2015-12-27 22:33:51 -06:00
Brent Cook
53cd105d6e update check for b64_ntop
typo spotted by Jonas 'Sortie' Termansen
2015-12-27 22:12:35 -06:00
Brent Cook
733d581028 note the removed Verisign certificate 2015-12-15 21:38:35 -06:00
Brent Cook
b95c92c62b update added certs 2015-12-14 19:51:15 -06:00
Brent Cook
3af1387b18 Revert back to GetStdHandle, since it works fine with pipes.
Also include the formerly-missing NULL check, since this can fail in two
ways.
2015-12-11 09:22:12 -06:00
Brent Cook
bd8fe5868f include stdint.h uint*_t 2015-12-11 09:21:43 -06:00
Anthony Novatsis
5727d3274e Replace STDIN_FILENO with _fileno
Replace STDIN_FILENO with _fileno as STDIN_FILENO results in compile
errors with Visual Studio 2015 (using CMake).
2015-12-11 16:32:00 +11:00
Brent Cook
4db1ad6797 installing nc(1) should imply building, even if not whitelisted 2015-12-07 08:24:41 -06:00
Brent Cook
28aaab4323 allow optionally installing nc(1) with '--enable-nc' 2015-12-07 08:14:51 -06:00
Brent Cook
19f58fdb1b rebase windows headers patch 2015-12-07 08:03:44 -06:00
Brent Cook
1988b8f65e fixup cert.pem path override for libtls, add for nc(1)
this also fixes the formatting of help for nc(1)
2015-12-07 07:55:05 -06:00
Brent Cook
905e2a3b80 refresh nc(1) support 2015-12-06 23:32:18 -06:00
Brent Cook
5b49c30cbc override _PATH_SSL_CA_FILE with OPENSSLDIR at build time
fix #160
2015-12-06 20:35:09 -06:00
Brent Cook
fabe122b4e update changelog 2015-12-06 20:34:32 -06:00
Brent Cook
afcc027da7 only set the console mode if stdin is a console (not a pipe)
This allows piping commands and running from a cygwin console.
2015-12-06 16:49:01 -06:00
Brent Cook
75ef5bb160 wrap gets on Windows, replacing '\r\n' with '\n' 2015-12-05 13:58:37 -06:00
Brent Cook
d7317353a9 Update 2.3.2 release notes 2015-12-05 13:29:09 -06:00
Brent Cook
585b57b202 no special workaround needed for MSVC2015 2015-12-02 08:39:22 -06:00
Zhicheng Wei
84f0a9dbda fix libtls-standalone tests for tls_read and tls_write changed api 2015-11-23 02:11:02 -06:00
Brent Cook
7a82b7c0fd build nc on solaris and cygwin 2015-11-23 02:07:23 -06:00
Brent Cook
7109fb3260 ensure we don't pass a negative int to ctypes functions
Some implementations, e.g. cygwin, use a table lookup that can cast
a char to a negative array offset.
2015-11-23 02:06:03 -06:00
Brent Cook
9574b6c8ec do not link libcompatnoopt if it is unneeded/built
from andy-js on github, fix #158
2015-11-22 17:31:51 -06:00
Brent Cook
9c5105eeb1 omit <type> links 2015-11-22 06:37:13 -06:00
Brent Cook
fbe05ec826 update manpage links 2015-11-22 04:56:36 -06:00
Brent Cook
d35e8bbeaf update netcat patch 2015-11-22 04:55:22 -06:00
Brent Cook
1d5dfff695 update patches 2015-11-02 20:22:26 -06:00
Brent Cook
7180bed3bb update changelog for 2.3.1 2015-10-26 05:58:08 -05:00
Brent Cook
24b5a96a7c whitelist nc on other BSDs 2015-10-23 16:19:07 -07:00
Brent Cook
c31b03c1d4 update netcat patch 2015-10-23 16:17:45 -07:00
Brent Cook
9be9055791 remove a_gen/utctm.c for cmake 2015-10-21 22:19:09 -05:00
Brent Cook
3f79a49dd2 check bounds before casting (long long) to time_t 2015-10-21 22:17:13 -05:00
Brent Cook
959241fe88 remove a_gen/utctm.c 2015-10-21 21:39:59 -05:00
Brent Cook
2c168b7127 move rfc5280time to rfc5280time_small
Having the same name as the executable confuses the driver, and it runs
the wrong thing.
2015-10-18 11:18:23 -05:00
Brent Cook
b28e5bedab include tap-driver.sh in the source repo
Newer autotools appears to install it automatically, but not all do.
2015-10-18 10:51:09 -05:00
Brent Cook
0086809a82 update apps.h include 2015-10-18 10:48:17 -05:00
Brent Cook
c8c23ad8e3 make it clear that we skipped 64-bit time_t tests 2015-10-18 10:36:31 -05:00
Brent Cook
0197a58969 Windows compatibility fixes
VS2013 has trouble with relative include paths for apps/openssl, so move
certhash_win/apps_win.c back to apps/openssl.

gmtime_r on mingw64 fails with negative time_t, override

gmtime_s fails all of the time unit tests, override

SHUT_RD/WR are defined in newer mingw64 headers, check before overriding
2015-10-18 09:28:10 -05:00
Brent Cook
c8918dd0be include warnings about small time_t 2015-10-17 23:32:21 -05:00
Brent Cook
a45e38e962 disable some tests with 32-bit time_t systems
Also disable use of _mkgmtime, it does not produce correct results.
2015-10-17 22:57:59 -05:00
Brent Cook
e8c9210073 unconditionally disable pledge for now
suggested by deraadt@ since there is still more coming
2015-10-15 19:34:42 -05:00
Brent Cook
dadeeb0a2e check for timegm in cmake builds 2015-10-15 14:32:16 -05:00
Brent Cook
cac089b5d6 make internal functions static 2015-10-15 14:32:02 -05:00
Brent Cook
c02436645d use timegm from musl 2015-10-15 14:26:24 -05:00
Brent Cook
ea4658b46a update man links 2015-10-15 09:16:38 -05:00
Brent Cook
4298ac9305 include timegm fallback 2015-10-15 09:16:38 -05:00
Brent Cook
1dd79f5d8f add limits.h shim for defining PATH_MAX on HP-UX 2015-10-14 23:54:25 -05:00
Jeremy Huddleston Sequoia
448645d479 Use bundled headers instead of installed headers when building
The build system incorrectly set include directives in AM_CFLAGS which
causes them to be placed after the configured CPPFLAGS.  Thus, if
a user or packaging system sets CPPFLAGS to a location that has
libressl or openssl headers installed, they will be used instead
of the bundled versions.  This corrects that issue by setting up
the variables correctly.

https://github.com/libressl-portable/portable/issues/150

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2015-10-14 16:33:39 -05:00
Jeremy Huddleston Sequoia
9afc452761 nc: Use AM_CPPFLAGS, not CPPFLAGS in Makefile.am
CPPFLAGS should just be set by the user at configure time

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2015-10-14 16:33:25 -05:00
Goichi Hirakawa
9dd9d1757e update netcat.c.patch for osx 10.6 or earlier 2015-10-14 15:53:11 +09:00
Brent Cook
ff52e6f4e3 check for pledge(2) 2015-10-12 15:34:03 -05:00
Brent Cook
41cebd325f resolve tame to 0 2015-10-07 10:59:22 -05:00
Brent Cook
442cc6f1b4 add tame(2) check 2015-10-07 08:55:05 -05:00
Brent Cook
a615d3c6d3 rename _mkgmtime as timegm on win32 2015-10-07 08:22:43 -05:00
Brent Cook
047926e06f updates for ASN.1 time handling 2015-10-06 06:21:17 -05:00
Brent Cook
a7f031ba55 add b64_ntop checking and fallback for nc(1) 2015-10-01 07:40:26 -05:00
Brent Cook
497a47c5fc remove incorrect comment
We actually want to only start extending CFLAGS after calling AC_PROG_CC
so we get the default autoconf value (usually just -O2).
2015-09-30 08:00:49 -05:00
Brent Cook
53f8663976 add asn1time to cmake tests 2015-09-28 17:49:46 -05:00
Brent Cook
9af6ff9a3a add asn1time test 2015-09-28 17:33:58 -05:00
Brent Cook
09e535e41d update path to openssl(1) in testssl wrapper 2015-09-22 08:56:36 -05:00
Brent Cook
0fa826d34f revise how headers are patched for windows, remove sed scripts 2015-09-21 22:08:12 -05:00
Brent Cook
630e7b6040 visual studio path updates 2015-09-18 08:43:57 -05:00
Brent Cook
a2e532ed01 test cmake builds on osx as well 2015-09-17 05:48:09 -05:00
Brent Cook
4ce5342e86 remove SHA-0 from cmake builds 2015-09-17 05:39:55 -05:00
Brent Cook
f05cb999a6 final bit of SHA-0 removal 2015-09-17 05:30:24 -05:00
Brent Cook
9c55d0b851 remove SHA-0 2015-09-17 05:15:23 -05:00
Brent Cook
53eacb360e extend regression tests
run distcheck rather than just dist, cmake tests
2015-09-17 05:05:53 -05:00
kinichiro
9606a6b5e9 add include/compat/readpassphrase.h to Makefile.am
fix for https://github.com/libressl-portable/portable/issues/138
2015-09-17 04:41:45 -05:00
Brent Cook
3b82df010a update changelog for SHA-0 removal 2015-09-16 02:21:20 -05:00
Brent Cook
92a04bc1ea SHA-0 is gone, remove test 2015-09-16 02:13:10 -05:00
Brent Cook
3ac78a5573 normalize amd64 to x86_64
This allows asm to be enabled on platforms that use amd64 in the host
tuple.
2015-09-16 01:45:42 -05:00
Brent Cook
eae0e9d3a4 Call the correct script for pidwraptest.sh.
This optional test was not reporting the correct results, noticed
retesting against FreeBSD 11-current.
2015-09-16 01:43:59 -05:00
Brent Cook
eb604d1d54 update changelog with latest 2015-09-13 19:46:54 -05:00
Brent Cook
c7ae7c0c9d fix a library paths, nc patch 2015-09-13 19:15:34 -05:00
Brent Cook
2cb6d19e10 remove ecdh/ech_ossl.c 2015-09-13 19:08:12 -05:00
Brent Cook
eaa4c1cc8a a few more linux nc build tweaks 2015-09-13 19:06:29 -05:00
Brent Cook
696ba18c6a fixup windows and older linux builds 2015-09-13 18:57:29 -05:00
Brent Cook
8c90be2a29 allow nc to build on linux and os x 2015-09-13 18:42:15 -05:00
Brent Cook
627b0261a8 ignore manpages 2015-09-13 11:33:20 -05:00
Brent Cook
eeb286af5a fix spelling of OPENSSL_cleanse 2015-09-13 09:31:41 -05:00
Brent Cook
cb397a8b28 use CP_LIBC for strtonum 2015-09-13 09:31:41 -05:00
Brent Cook
a896d400a0 move windows file IO mode setup to apps_win.c 2015-09-13 09:31:41 -05:00
Brent Cook
653bbfaabf ding-dong e_os2.h is dead 2015-09-13 09:03:17 -05:00
Brent Cook
4bb70680a0 ech_ossl.h is gone 2015-09-13 09:03:04 -05:00
Brent Cook
02b7539cf5 readd openssl.1, distribute nc.1 2015-09-13 07:23:04 -05:00
Brent Cook
82e96d3565 include new tls headers 2015-09-13 03:48:46 -05:00
Brent Cook
a787f964a1 restrict nc to openbsd builds for now 2015-09-12 10:51:11 -05:00
Brent Cook
dcbaa6b699 correct nc compat path 2015-09-12 10:15:00 -05:00
Brent Cook
a64c42a09d add some backcompat in nc, don't install it 2015-09-12 09:50:44 -05:00
Brent Cook
bcd3b2fde6 more cmake tests 2015-09-12 08:08:25 -05:00
Brent Cook
854f4f69af add 'nc' to the distribution as an example of libtls client and server 2015-09-12 08:08:24 -05:00
Brent Cook
34bfb6ecb5 add new tests 2015-09-12 05:18:47 -05:00
Brent Cook
c84250a4e4 update manpage links, fix typo 2015-09-12 03:17:33 -05:00
Brent Cook
f1b00f4fb8 sudo/doas 2015-09-12 03:17:19 -05:00
Brent Cook
c5eef7f11c remove engine.c from CMake 2015-09-11 18:52:22 -05:00
Brent Cook
b89b470316 remove more deleted files 2015-09-11 18:46:36 -05:00
Brent Cook
105c86f3ed first round of 2.3.0 release notes 2015-09-11 18:18:46 -05:00
Brent Cook
6db3fc7c31 remove engine from openssl(1) 2015-09-11 09:47:40 -05:00
Brent Cook
2af9873259 add -lrt check for linux 2015-09-11 09:11:08 -05:00
Brent Cook
ef01eb71d1 speed up builds without killing os x perhaps 2015-09-11 09:10:57 -05:00
Brent Cook
b5090c5853 add cmake test support 2015-09-11 08:04:28 -05:00
Will Tange
afd031f0ed Small README typo 2015-09-11 03:24:14 -05:00
Brent Cook
384e71614f remove unneeded arc4random patch 2015-09-11 03:20:41 -05:00
Brent Cook
1ea6203cbf add openbsd tag sync script + release verifier
gen-openbsd-tags.sh synchronizes local tags from the portable tree with
the openbsd git mirror. It does this by matching commit timestamps,
which can handle rehashing due to modifications of the git import scope
if we need it later.

check-release.sh generates a release tarball and compares it to an
actual release. This has shown a few mistakes in past release, but we
can use it to ensure are no issues with future releases.
2015-09-10 11:50:16 -05:00
Brent Cook
b6aded059f ensure headers are sanitized before release
When a public header is removed, we need to ensure it gets removed
in the release distribution as well. Also, remove nonexistent *.he
exclude.
2015-09-10 11:50:03 -05:00
Brent Cook
1c2a3f25e2 Remove cmake tests from travis builds for now.
This seemed like it should be easy, but apparently there are a lot of
gotchas that need to be ironed out in a branch first.
2015-09-09 07:45:54 -05:00
Brent Cook
e04dfb2b27 fix a couple of travis build failures 2015-09-09 07:34:37 -05:00
Brent Cook
46c9a8de8b revert some travis shell portability tweaks 2015-09-09 07:13:05 -05:00
Brent Cook
9e090286b5 remove builtin travis cmake because it is too old 2015-09-09 07:01:26 -05:00
Brent Cook
f6999fbe4b try ninja on travis linux again 2015-09-09 07:01:05 -05:00
Brent Cook
c0341ad131 use newer cmake for travis linux builds, revise build script 2015-09-09 06:59:55 -05:00
Brent Cook
2728a86590 travis' cmake does not support ninja, use make 2015-09-09 06:40:05 -05:00
Brent Cook
5de4c4f0eb add travis-ci cmake tests 2015-09-09 06:12:16 -05:00
Brent Cook
5dc6303714 remove support for old MSVC versions, KNF 2015-09-09 06:03:52 -05:00
Brent Cook
adfb2bf722 Do not build lib-objects targets if we are just building static libs.
This confuses some cmake targets.
2015-09-09 06:03:52 -05:00
Brent Cook
5f4e95e7c1 updates for MSVC 2015's degenerate headers
Note that 'perror' moves from stdio.h to stdlib.h, and 'rename' moves
from stdio.h to io.h. Also, standard C includes move from the compiler
to the Windows SDK, which changes the base path for the include files.
2015-09-09 06:02:28 -05:00
Brent Cook
9903a26661 distribute strcasecmp.c 2015-09-07 01:28:29 -05:00
Brent Cook
ca56c332e3 disable shared CMake builds for OS X / Windows for now 2015-09-07 01:05:33 -05:00
Brent Cook
4078416c36 adjust order for ! .gitignore rule precedence 2015-09-07 00:40:20 -05:00
Brent Cook
122acbd659 update messages about Cygwin support 2015-09-07 00:33:55 -05:00
Brent Cook
5ccdd1380b distribute include and man CMakefiles 2015-09-07 00:31:59 -05:00
kinichiro
3057de0d2b use CP_LIBC for copying tests/memmem.c 2015-09-01 19:23:15 +09:00
Brent Cook
afcfb2d504 add CP_LIBC, fix tls compilation 2015-08-31 07:49:50 -05:00
Brent Cook
444749d1d5 remove s3_meth.c from CMake builds 2015-08-31 02:30:50 -05:00
Brent Cook
dbfba1154f remove DEF_WEAK from libc copies 2015-08-31 02:30:25 -05:00
Brent Cook
058df4a234 Delete s3_meth.c since it was only for SSLv3 support. 2015-08-30 22:26:12 -05:00
Brent Cook
4e2763575f update Changelog for 2.2.3 2015-08-30 22:17:55 -05:00
Brent Cook
cc3c1810e2 replace remaining bash-only features in the update script
We used to need more features, but as the Makefile.am's
stopped being dynamically generated, there is less need.
2015-08-28 06:03:33 -05:00
Brent Cook
935d2744aa VERSION is now generated 2015-08-19 19:44:28 -05:00
Brent Cook
3bdb537aae update pc files to use the package version, not library ABI version 2015-08-19 19:18:20 -05:00
Brent Cook
61fe482d46 derive version numbers from VERSION files 2015-08-19 19:18:03 -05:00
Jeff Davey
5461dea7f1 Add install targets and shared libraries to CMake 2015-08-18 13:20:19 -06:00
125 changed files with 10557 additions and 1780 deletions

57
.gitignore vendored
View File

@@ -39,28 +39,42 @@ Makefile.in
*.la *.la
*.def *.def
*.sym
*.pc *.pc
# man pages
*.1
*.3
*.5
# tests # tests
test-driver test-driver
*.log *.log
*.trs *.trs
tests/aes_wrap* tests/aes_wrap*
tests/arc4random_fork* tests/arc4random_fork*
tests/asn1evp*
tests/asn1time*
tests/cipher* tests/cipher*
tests/explicit_bzero* tests/explicit_bzero*
tests/freenull*
tests/gost2814789t* tests/gost2814789t*
tests/mont* tests/mont*
tests/rfc5280time*
tests/ssl_versions*
tests/timingsafe* tests/timingsafe*
tests/tls_ext_alpn*
tests/tls_prf*
tests/*test tests/*test
tests/tests.h tests/tests.h
tests/*test.c tests/*test.c
tests/memmem.c
tests/pbkdf2* tests/pbkdf2*
tests/*.pem tests/*.pem
tests/testssl tests/testssl
tests/*.txt tests/*.txt
tests/compat/*.c
!tests/optionstest.c !tests/optionstest.c
!tests/*.test
# ctags stuff # ctags stuff
TAGS TAGS
@@ -70,8 +84,8 @@ autom4te.cache
# Libtool adds these, at least sometimes # Libtool adds these, at least sometimes
INSTALL INSTALL
/COPYING /COPYING
m4/l*
!m4/check*.m4 !m4/check*.m4
m4/l*
aclocal.m4 aclocal.m4
compile compile
@@ -106,34 +120,49 @@ tls/*.h
include/pqueue.h include/pqueue.h
include/tls.h include/tls.h
include/openssl/*.h include/openssl/*.h
include/openssl/*.he
/apps/*.h /apps/ocspcheck/*.h
/apps/*.c /apps/ocspcheck/*.c
/apps/openssl /apps/ocspcheck/ocspcheck*
/apps/openssl.cnf /apps/ocspcheck/compat/inet_ntop.c
!/apps/apps_win.c /apps/ocspcheck/compat/memmem.c
!/apps/poll_win.c
!/apps/certhash_disabled.c /apps/nc/*.h
/apps/nc/*.c
/apps/nc/nc*
!/apps/nc/readpassphrase.c
/apps/nc/compat/*.c
/apps/openssl/*.h
/apps/openssl/*.c
/apps/openssl/*.cnf
/apps/openssl/*.pem
/apps/openssl/openssl
/apps/openssl/compat/strtonum.c
!/apps/openssl/apps_win.c
!/apps/openssl/certhash_win.c
/crypto
!/crypto/Makefile.am.* !/crypto/Makefile.am.*
!/crypto/compat/arc4random.h !/crypto/compat/arc4random.h
!/crypto/compat/b_win.c !/crypto/compat/b_win.c
!/crypto/compat/explicit_bzero_win.c !/crypto/compat/explicit_bzero_win.c
!/crypto/compat/freezero.c
!/crypto/compat/getpagesize.c
!/crypto/compat/posix_win.c !/crypto/compat/posix_win.c
!/crypto/compat/bsd_asprintf.c !/crypto/compat/bsd_asprintf.c
!/crypto/compat/inet_pton.c !/crypto/compat/inet_pton.c
!/crypto/compat/timegm.c
!/crypto/compat/ui_openssl_win.c !/crypto/compat/ui_openssl_win.c
!/crypto/CMakeLists.txt !/crypto/CMakeLists.txt
/crypto
!/libtls-standalone/compat/Makefile.am
/libtls-standalone/include/*.h /libtls-standalone/include/*.h
/libtls-standalone/src/*.c /libtls-standalone/src/*.c
/libtls-standalone/src/*.h /libtls-standalone/src/*.h
/libtls-standalone/src /libtls-standalone/src
/libtls-standalone/tests/test /libtls-standalone/tests/test
/libtls-standalone/compat /libtls-standalone/compat
!/libtls-standalone/compat/Makefile.am
/libtls-standalone/VERSION /libtls-standalone/VERSION
/libtls-standalone/m4 /libtls-standalone/m4
/libtls-standalone/man /libtls-standalone/man
@@ -141,7 +170,5 @@ include/openssl/*.he
openbsd/ openbsd/
*.tar.gz *.tar.gz
apps/*.1*
man/*.3
man/*.1
man/Makefile.am man/Makefile.am
man/mandoc.db

View File

@@ -10,15 +10,23 @@ matrix:
- compiler: clang - compiler: clang
os: linux os: linux
env: ARCH=native env: ARCH=native
dist: trusty
sudo: required
- compiler: gcc - compiler: gcc
os: linux os: linux
env: ARCH=native env: ARCH=native
dist: trusty
sudo: required
- compiler: gcc - compiler: gcc
os: linux os: linux
env: ARCH=mingw32 env: ARCH=mingw32
dist: trusty
sudo: required
- compiler: gcc - compiler: gcc
os: linux os: linux
env: ARCH=mingw64 env: ARCH=mingw64
dist: trusty
sudo: required
script: script:
"./scripts/travis" "./scripts/travis"

View File

@@ -1,11 +1,50 @@
cmake_minimum_required (VERSION 2.8) cmake_minimum_required (VERSION 2.8.8)
include(CheckFunctionExists) include(CheckFunctionExists)
include(CheckLibraryExists)
include(CheckIncludeFiles) include(CheckIncludeFiles)
include(CheckTypeSize)
project (LibreSSL) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}" ${CMAKE_MODULE_PATH})
include(cmake_export_symbol)
include(GNUInstallDirs)
project (LibreSSL C)
enable_testing() enable_testing()
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/ssl/VERSION SSL_VERSION)
string(STRIP ${SSL_VERSION} SSL_VERSION)
string(REPLACE ":" "." SSL_VERSION ${SSL_VERSION})
string(REGEX REPLACE "\\..*" "" SSL_MAJOR_VERSION ${SSL_VERSION})
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/crypto/VERSION CRYPTO_VERSION)
string(STRIP ${CRYPTO_VERSION} CRYPTO_VERSION)
string(REPLACE ":" "." CRYPTO_VERSION ${CRYPTO_VERSION})
string(REGEX REPLACE "\\..*" "" CRYPTO_MAJOR_VERSION ${CRYPTO_VERSION})
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/tls/VERSION TLS_VERSION)
string(STRIP ${TLS_VERSION} TLS_VERSION)
string(REPLACE ":" "." TLS_VERSION ${TLS_VERSION})
string(REGEX REPLACE "\\..*" "" TLS_MAJOR_VERSION ${TLS_VERSION})
option(LIBRESSL_SKIP_INSTALL "Skip installation" ${LIBRESSL_SKIP_INSTALL})
option(ENABLE_ASM "Enable assembly" ON)
option(ENABLE_EXTRATESTS "Enable extra tests that may be unreliable on some platforms" OFF)
option(ENABLE_NC "Enable installing TLS-enabled nc(1)" OFF)
option(ENABLE_VSTEST "Enable test on Visual Studio" OFF)
set(OPENSSLDIR ${OPENSSLDIR} CACHE PATH "Set the default openssl directory" FORCE)
if(NOT LIBRESSL_SKIP_INSTALL)
set( ENABLE_LIBRESSL_INSTALL ON )
endif(NOT LIBRESSL_SKIP_INSTALL)
set(BUILD_NC true)
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
add_definitions(-fno-common)
endif()
if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD") if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
add_definitions(-DHAVE_ATTRIBUTE__BOUNDED__) add_definitions(-DHAVE_ATTRIBUTE__BOUNDED__)
endif() endif()
@@ -17,40 +56,97 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux")
add_definitions(-D_GNU_SOURCE) add_definitions(-D_GNU_SOURCE)
endif() endif()
if(CMAKE_SYSTEM_NAME MATCHES "MINGW")
set(BUILD_NC false)
endif()
if(WIN32)
set(BUILD_NC false)
endif()
if(CMAKE_SYSTEM_NAME MATCHES "HP-UX")
if(CMAKE_C_COMPILER MATCHES "gcc")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -std=gnu99 -fno-strict-aliasing")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mlp64")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O2 +DD64 +Otype_safety=off")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_XOPEN_SOURCE=600 -D__STRICT_ALIGNMENT")
endif()
if(CMAKE_SYSTEM_NAME MATCHES "SunOS")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -std=gnu99 -fno-strict-aliasing")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__EXTENSIONS__")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_XOPEN_SOURCE=600")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DBSD_COMP")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fpic -m64")
endif()
add_definitions(-DLIBRESSL_INTERNAL) add_definitions(-DLIBRESSL_INTERNAL)
add_definitions(-DOPENSSL_NO_HW_PADLOCK) add_definitions(-DOPENSSL_NO_HW_PADLOCK)
add_definitions(-DOPENSSL_NO_ASM) add_definitions(-D__BEGIN_HIDDEN_DECLS=)
add_definitions(-D__END_HIDDEN_DECLS=)
set(CMAKE_POSITION_INDEPENDENT_CODE true)
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang") if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
add_definitions(-Wno-pointer-sign) add_definitions(-Wno-pointer-sign)
endif() endif()
if(MSVC) if(WIN32)
add_definitions(-Dinline=__inline)
add_definitions(-Drestrict) add_definitions(-Drestrict)
add_definitions(-D_CRT_SECURE_NO_WARNINGS) add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_CRT_DEPRECATED_NO_WARNINGS) add_definitions(-D_CRT_DEPRECATED_NO_WARNINGS)
add_definitions(-D_REENTRANT -D_POSIX_THREAD_SAFE_FUNCTIONS) add_definitions(-D_REENTRANT -D_POSIX_THREAD_SAFE_FUNCTIONS)
add_definitions(-DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0501) add_definitions(-DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0501)
add_definitions(-DCPPFLAGS -DOPENSSL_NO_SPEED -DNO_SYSLOG -DNO_CRYPT) add_definitions(-DCPPFLAGS -DOPENSSL_NO_SPEED -DNO_SYSLOG -DNO_CRYPT)
endif()
if(MSVC)
add_definitions(-Dinline=__inline)
message(STATUS "Using [${CMAKE_C_COMPILER_ID}] compiler")
if(CMAKE_C_COMPILER_ID MATCHES "MSVC")
set(MSVC_DISABLED_WARNINGS_LIST set(MSVC_DISABLED_WARNINGS_LIST
"C4057" # C4057: 'initializing' : 'unsigned char *' differs in "C4018" # 'expression' : signed/unsigned mismatch
# indirection to slightly different base types from 'char [2]' "C4057" # 'operator' : 'identifier1' indirection to
"C4100" # 'exarg' : unreferenced formal parameter # slightly different base types from 'identifier2'
"C4100" # 'identifier' : unreferenced formal parameter
"C4127" # conditional expression is constant "C4127" # conditional expression is constant
"C4242" # 'function' : conversion from 'int' to 'uint8_t', "C4146" # unary minus operator applied to unsigned type,
# result still unsigned
"C4244" # 'argument' : conversion from 'type1' to 'type2',
# possible loss of data # possible loss of data
"C4244" # 'function' : conversion from 'int' to 'uint8_t', "C4245" # 'conversion' : conversion from 'type1' to 'type2',
# signed/unsigned mismatch
"C4267" # 'var' : conversion from 'size_t' to 'type',
# possible loss of data # possible loss of data
"C4389" # 'operator' : signed/unsigned mismatch
"C4706" # assignment within conditional expression "C4706" # assignment within conditional expression
"C4820" # 'bytes' bytes padding added after construct 'member_name' "C4996" # The POSIX name for this item is deprecated.
"C4996" # 'read': The POSIX name for this item is deprecated. Instead, # Instead, use the ISO C and C++ conformant name
# use the ISO C++ conformant name: _read.
) )
elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
add_definitions(-D_CRT_SUPPRESS_RESTRICT)
set(MSVC_DISABLED_WARNINGS_LIST
"C111" # Unreachable statement
"C128" # Unreachable loop
"C167" # Unexplict casting unsigned to signed
"C186" # Pointless comparison of unsigned int with zero
"C188" # Enumerated type mixed with another type
"C344" # Redeclared type
"C556" # Unexplict casting signed to unsigned
"C869" # Unreferenced parameters
"C1786" # Deprecated functions
"C2545" # Empty else statement
"C2557" # Comparing signed to unsigned
"C2722" # List init syntax is c++11 feature
"C3280" # Declaration hides variable
)
endif()
string(REPLACE "C" " -wd" MSVC_DISABLED_WARNINGS_STR string(REPLACE "C" " -wd" MSVC_DISABLED_WARNINGS_STR
${MSVC_DISABLED_WARNINGS_LIST}) ${MSVC_DISABLED_WARNINGS_LIST})
set(CMAKE_C_FLAGS "-MP -W4 ${MSVC_DISABLED_WARNINGS_STR}") string(REGEX REPLACE "[/-]W[1234][ ]?" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -MP -W4 ${MSVC_DISABLED_WARNINGS_STR}")
endif() endif()
check_function_exists(asprintf HAVE_ASPRINTF) check_function_exists(asprintf HAVE_ASPRINTF)
@@ -78,7 +174,7 @@ if(HAVE_STRLCAT)
add_definitions(-DHAVE_STRLCAT) add_definitions(-DHAVE_STRLCAT)
endif() endif()
check_function_exists(strlcat HAVE_STRLCPY) check_function_exists(strlcpy HAVE_STRLCPY)
if(HAVE_STRLCPY) if(HAVE_STRLCPY)
add_definitions(-DHAVE_STRLCPY) add_definitions(-DHAVE_STRLCPY)
endif() endif()
@@ -88,8 +184,8 @@ if(HAVE_STRNDUP)
add_definitions(-DHAVE_STRNDUP) add_definitions(-DHAVE_STRNDUP)
endif() endif()
if(MSVC) if(WIN32)
set(HAVE_STRNLEN) set(HAVE_STRNLEN true)
add_definitions(-DHAVE_STRNLEN) add_definitions(-DHAVE_STRNLEN)
else() else()
check_function_exists(strnlen HAVE_STRNLEN) check_function_exists(strnlen HAVE_STRNLEN)
@@ -103,11 +199,21 @@ if(HAVE_STRSEP)
add_definitions(-DHAVE_STRSEP) add_definitions(-DHAVE_STRSEP)
endif() endif()
check_function_exists(timegm HAVE_TIMEGM)
if(HAVE_TIMEGM)
add_definitions(-DHAVE_TIMEGM)
endif()
check_function_exists(arc4random_buf HAVE_ARC4RANDOM_BUF) check_function_exists(arc4random_buf HAVE_ARC4RANDOM_BUF)
if(HAVE_ARC4RANDOM_BUF) if(HAVE_ARC4RANDOM_BUF)
add_definitions(-DHAVE_ARC4RANDOM_BUF) add_definitions(-DHAVE_ARC4RANDOM_BUF)
endif() endif()
check_function_exists(arc4random_uniform HAVE_ARC4RANDOM_UNIFORM)
if(HAVE_ARC4RANDOM_UNIFORM)
add_definitions(-DHAVE_ARC4RANDOM_UNIFORM)
endif()
check_function_exists(explicit_bzero HAVE_EXPLICIT_BZERO) check_function_exists(explicit_bzero HAVE_EXPLICIT_BZERO)
if(HAVE_EXPLICIT_BZERO) if(HAVE_EXPLICIT_BZERO)
add_definitions(-DHAVE_EXPLICIT_BZERO) add_definitions(-DHAVE_EXPLICIT_BZERO)
@@ -123,6 +229,11 @@ if(HAVE_GETENTROPY)
add_definitions(-DHAVE_GETENTROPY) add_definitions(-DHAVE_GETENTROPY)
endif() endif()
check_function_exists(getpagesize HAVE_GETPAGESIZE)
if(HAVE_GETPAGESIZE)
add_definitions(-DHAVE_GETPAGESIZE)
endif()
check_function_exists(timingsafe_bcmp HAVE_TIMINGSAFE_BCMP) check_function_exists(timingsafe_bcmp HAVE_TIMINGSAFE_BCMP)
if(HAVE_TIMINGSAFE_BCMP) if(HAVE_TIMINGSAFE_BCMP)
add_definitions(-DHAVE_TIMINGSAFE_BCMP) add_definitions(-DHAVE_TIMINGSAFE_BCMP)
@@ -133,20 +244,104 @@ if(HAVE_MEMCMP)
add_definitions(-DHAVE_MEMCMP) add_definitions(-DHAVE_MEMCMP)
endif() endif()
check_function_exists(memmem HAVE_MEMMEM)
if(HAVE_MEMMEM)
add_definitions(-DHAVE_MEMMEM)
endif()
check_include_files(err.h HAVE_ERR_H) check_include_files(err.h HAVE_ERR_H)
if(HAVE_ERR_H) if(HAVE_ERR_H)
add_definitions(-DHAVE_ERR_H) add_definitions(-DHAVE_ERR_H)
endif() endif()
set(OPENSSL_LIBS ssl crypto) if(ENABLE_ASM)
if("${CMAKE_C_COMPILER_ABI}" STREQUAL "ELF")
if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(x86_64|amd64)")
set(HOST_ASM_ELF_X86_64 true)
elseif(CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i386")
set(HOST_ASM_ELF_X86_64 true)
endif()
elseif(APPLE AND "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
set(HOST_ASM_MACOSX_X86_64 true)
endif()
endif()
if(NOT (CMAKE_SYSTEM_NAME MATCHES "(Darwin|CYGWIN)"))
set(BUILD_SHARED true)
endif()
# USE_SHARED builds applications (e.g. openssl) using shared LibreSSL.
# By default, applications use LibreSSL static library to avoid dependencies.
# USE_SHARED isn't set by default; use -DUSE_SHARED=ON with CMake to enable.
# Can be helpful for debugging; don't use for public releases.
if(NOT BUILD_SHARED)
set(USE_SHARED off)
endif()
if(USE_SHARED)
set(OPENSSL_LIBS tls-shared ssl-shared crypto-shared)
else()
set(OPENSSL_LIBS tls ssl crypto)
endif()
if(CMAKE_HOST_WIN32) if(CMAKE_HOST_WIN32)
set(OPENSSL_LIBS ${OPENSSL_LIBS} ws2_32) set(OPENSSL_LIBS ${OPENSSL_LIBS} ws2_32)
endif() endif()
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME)
if (HAVE_CLOCK_GETTIME)
set(OPENSSL_LIBS ${OPENSSL_LIBS} rt)
endif()
endif()
if(CMAKE_SYSTEM_NAME MATCHES "HP-UX")
set(OPENSSL_LIBS ${OPENSSL_LIBS} pthread)
endif()
if(CMAKE_SYSTEM_NAME MATCHES "SunOS")
set(OPENSSL_LIBS ${OPENSSL_LIBS} nsl socket)
endif()
check_type_size(time_t SIZEOF_TIME_T)
if(SIZEOF_TIME_T STREQUAL "4")
set(SMALL_TIME_T true)
add_definitions(-DSMALL_TIME_T)
message(WARNING " ** Warning, this system is unable to represent times past 2038\n"
" ** It will behave incorrectly when handling valid RFC5280 dates")
endif()
add_definitions(-DSIZEOF_TIME_T=${SIZEOF_TIME_T})
add_subdirectory(crypto) add_subdirectory(crypto)
add_subdirectory(ssl) add_subdirectory(ssl)
add_subdirectory(apps) add_subdirectory(apps)
add_subdirectory(tls) add_subdirectory(tls)
add_subdirectory(include)
if(NOT MSVC) if(NOT MSVC)
add_subdirectory(man)
endif()
if(NOT MSVC OR ENABLE_VSTEST)
add_subdirectory(tests) add_subdirectory(tests)
endif() endif()
if(NOT MSVC)
# Create pkgconfig files.
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix \${prefix})
set(libdir \${exec_prefix}/${CMAKE_INSTALL_LIBDIR})
set(includedir \${prefix}/include)
file(STRINGS "VERSION" VERSION LIMIT_COUNT 1)
file(GLOB OPENSSL_PKGCONFIGS "*.pc.in")
foreach(file ${OPENSSL_PKGCONFIGS})
get_filename_component(filename ${file} NAME)
string(REPLACE ".in" "" new_file "${filename}")
configure_file(${filename} pkgconfig/${new_file} @ONLY)
endforeach()
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/pkgconfig
DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)

623
ChangeLog
View File

@@ -28,6 +28,629 @@ history is also available from Git.
LibreSSL Portable Release Notes: LibreSSL Portable Release Notes:
2.7.0 - Bug fixes and improvements
* Merged more DTLS support into the regular TLS code path, removing
duplicated code.
* Converted ssl3_send_client_hello(), ssl3_send_server_hello() to CBB.
* Rewrite ASN1_TYPE_{get,set}_octetstring() using templated ASN.1.
This removes the last remaining use of the old M_ASN1_* macros
(asn1_mac.h) from API that needs to continue to exist.
2.6.4 - Bug fixes
* Make tls_config_parse_protocols() work correctly when passed a NULL
pointer for a protocol string. Issue found by semarie@, who also
provided the diff.
* Correct TLS extensions handling when no extensions are present.
If no TLS extensions are present in a client hello or server hello,
omit the entire extensions block, rather than including it with a
length of zero. Thanks to Eric Elena <eric at voguemerry dot com> for
providing packet captures and testing the fix.
* Fixed portable builds on older Android systems, and systems with out
IPV6_TCLASS support.
2.6.3 - OpenBSD 6.2 Release
* No core changes from LibreSSL 2.6.2
* Minor compatibility fixes in portable version.
2.6.2 - Bug fixes
* Provide a useful error with libtls if there are no OCSP URLs in a
peer certificate.
* Keep track of which keypair is in use by a TLS context, fixing a bug
where a TLS server with SNI would only return the OCSP staple for the
default keypair. Issue reported by William Graeber and confirmed by
Andreas Bartelt.
* Fixed various issues in the OCSP extension parsing code.
The original code incorrectly passes the pointer allocated via
CBS_stow() (using malloc()) to a d2i_*() function and then calls
free() on the now incremented pointer, most likely resulting in a
crash. This issue was reported by Robert Swiecki who found the issue
using honggfuzz.
* If tls_config_parse_protocols() is called with a NULL pointer,
return the default protocols instead of crashing - this makes the
behaviour more useful and mirrors what we already do in
tls_config_set_ciphers() et al.
2.6.1 - Code removal, rewrites
* Added a "-T tlscompat" option to nc(1), which enables the use of all
TLS protocols and "compat" ciphers. This allows for TLS connections
to TLS servers that are using less than ideal cipher suites, without
having to resort to "-T tlsall" which enables all known cipher
suites. Diff from Kyle J. McKay.
* Added a new TLS extension handling framework, somewhat analogous to
BoringSSL, and converted all TLS extensions to use it. Added new TLS
extension regression tests.
* Improved and added many new manpages. Updated *check_private_key
manpages with additional cautions regarding their use.
* Cleaned up the EC key/curve configuration handling.
* Added tls_config_set_ecdhecurves() to libtls, which allows the names
of the eliptical curves that may be used during client and server
key exchange to be specified.
* Converted more code paths to use CBB/CBS.
* Removed support for DSS/DSA, since we removed the cipher suites a
while back.
* Removed NPN support. NPN was never standardised and the last draft
expired in October 2012. ALPN was standardised in July 2014 and has
been supported in LibreSSL since December 2014. NPN has also been
removed from Chromium in May 2016.
* Removed SSL_OP_CRYPTOPRO_TLSEXT_BUG workaround for old/broken
CryptoPro clients.
* Removed support for the TLS padding extension, which was added as a
workaround for an old bug in F5's TLS termination.
* Worked around another bug in F5's TLS termination handling of the
elliptical curves extension. RFC 4492 only defines elliptic_curves
for ClientHello. However, F5 is sending it in ServerHello. We need
to skip over it since our TLS extension parsing code is now more
strict. Thanks to Armin Wolfermann and WJ Liu for reporting.
* Added ability to clamp notafter valies in certificates for systems
with 32-bit time_t. This is necessary to conform to RFC 5280
4.1.2.5.
* Implemented the SSL_CTX_set_min_proto_version(3) API.
* Removed the original (pre-IETF) chacha20-poly1305 cipher suites.
* Reclassified ECDHE-RSA-DES-CBC3-SHA from HIGH to MEDIUM.
2.6.0 - New APIs, bug fixes and improvements
* Added support for providing CRLs to libtls. Once a CRL is provided we
enable CRL checking for the full certificate chain. Based on a diff
from Jack Burton
* Allow non-compliant clients using IP literal addresses with SNI
to connect to a server using libtls.
* Avoid a potential NULL pointer dereference in d2i_ECPrivateKey().
Reported by Robert Swiecki, who found the issue using honggfuzz.
* Added definitions for three OIDs used in EV certificates.
From Kyle J. McKay
* Added tls_peer_cert_chain_pem to libtls, useful in private
certificate validation callbacks such as those in relayd.
* Converted explicit clear/free sequences to use freezero(3).
* Reworked TLS certificate name verification code to more strictly
follow RFC 6125.
* Cleaned up and simplified server key exchange EC point handling.
* Added tls_keypair_clear_key for clearing key material.
* Removed inconsistent IPv6 handling from BIO_get_accept_socket,
simplified BIO_get_host_ip and BIO_accept.
* Fixed the openssl(1) ca command so that is generates certificates
with RFC 5280-conformant time. Problem noticed by Harald Dunkel.
* Added ASN1_TIME_set_tm to set an asn1 from a struct tm *
* Added SSL{,_CTX}_set_{min,max}_proto_version() functions.
* Added HKDF (HMAC Key Derivation Function) from BoringSSL
* Provided a tls_unload_file() function that frees the memory returned
from a tls_load_file() call, ensuring that it the contents become
inaccessible. This is specifically needed on platforms where the
library allocators may be different from the application allocator.
* Perform reference counting for tls_config. This allows
tls_config_free() to be called as soon as it has been passed to the
final tls_configure() call, simplifying lifetime tracking for the
application.
* Moved internal state of SSL and other structures to be opaque.
* Dropped cipher suites with DSS authentication.
* nc(1) improvements, including:
nc -W to terminate nc after receiving a number of packets
nc -Z for saving the peer certificate and chain in a pem file
2.5.5 - Bug fixes
* Distinguish between self-issued certificates and self-signed
certificates. The certificate verification code has special cases
for self-signed certificates and without this change, self-issued
certificates (which it seems are common place with
openvpn/easyrsa) were also being included in this category.
* Added getpagesize fallback, needed for Android bionic libc.
2.5.4 - Security Updates
* Revert a previous change that forced consistency between return
value and error code when specifing a certificate verification
callback, since this breaks the documented API. When a user supplied
callback always returns 1, and later code checks the error code to
potentially abort post verification, this will result in incorrect
successul certificate verification.
* Switched Linux getrandom() usage to non-blocking mode, continuing to
use fallback mechanims if unsuccessful. This works around a design
flaw in Linux getrandom(2) where early boot usage in a library makes
it impossible to recover if getrandom(2) is not yet initialized.
* Fixed a bug caused by the return value being set early to signal
successful DTLS cookie validation. This can mask a later failure and
result in a positive return value being returned from
ssl3_get_client_hello(), when it should return a negative value to
propagate the error.
* Fixed a build error on non-x86/x86_64 systems running Solaris.
2.5.3 - OpenBSD 6.1 Release
* Documentation updates
* Improved ocspcheck(1) error handling
2.5.2 - Security features and bugfixes
* Added the recallocarray(3) memory allocation function, and converted
various places in the library to use it, such as CBB and BUF_MEM_grow.
recallocarray(3) is similar to reallocarray. Newly allocated memory
is cleared similar to calloc(3). Memory that becomes unallocated
while shrinking or moving existing allocations is explicitly
discarded by unmapping or clearing to 0
* Added new root CAs from SECOM Trust Systems / Security Communication
of Japan.
* Added EVP interface for MD5+SHA1 hashes.
* Fixed DTLS client failures when the server sends a certificate
request.
* Correct handling of padding when upgrading an SSLv2 challenge into
an SSLv3/TLS connection.
* Allow protocols and ciphers to be set on a TLS config object in
libtls.
* Improved nc(1) TLS handshake CPU usage and server-side error
reporting.
2.5.1 - Bug and security fixes, new features, documentation updates
* X509_cmp_time() now passes a malformed GeneralizedTime field as an
error. Reported by Theofilos Petsios.
* Detect zero-length encrypted session data early, instead of when
malloc(0) fails or the HMAC check fails. Noted independently by
jsing@ and Kurt Cancemi.
* Check for and handle failure of HMAC_{Update,Final} or
EVP_DecryptUpdate().
* Massive update and normalization of manpages, conversion to
mandoc format. Many pages were rewritten for clarity and accuracy.
Portable doc links are up-to-date with a new conversion tool.
* Curve25519 Key Exchange support.
* Support for alternate chains for certificate verification.
* Code cleanups, CBS conversions, further unification of DTLS/SSL
handshake code, further ASN1 macro expansion and removal.
* Private symbol are now hidden in libssl and libcryto.
* Friendly certificate verification error messages in libtls, peer
verification is now always enabled.
* Added OCSP stapling support to libtls and netcat.
* Added ocspcheck utility to validate a certificate against its OCSP
responder and save the reply for stapling
* Enhanced regression tests and error handling for libtls.
* Added explicit constant and non-constant time BN functions,
defaulting to constant time wherever possible.
* Moved many leaked implementation details in public structs behind
opaque pointers.
* Added ticket support to libtls.
* Added support for setting the supported EC curves via
SSL{_CTX}_set1_groups{_list}() - also provide defines for the previous
SSL{_CTX}_set1_curves{_list} names. This also changes the default
list of curves to be X25519, P-256 and P-384. All other curves must
be manually enabled.
* Added -groups option to openssl(1) s_client for specifying the curves
to be used in a colon-separated list.
* Merged client/server version negotiation code paths into one,
reducing much duplicate code.
* Removed error function codes from libssl and libcrypto.
* Fixed an issue where a truncated packet could crash via an OOB read.
* Added SSL_OP_NO_CLIENT_RENEGOTIATION option that disallows
client-initiated renegotiation. This is the default for libtls
servers.
* Avoid a side-channel cache-timing attack that can leak the ECDSA
private keys when signing. This is due to BN_mod_inverse() being
used without the constant time flag being set. Reported by Cesar
Pereida Garcia and Billy Brumley (Tampere University of Technology).
The fix was developed by Cesar Pereida Garcia.
* iOS and MacOS compatibility updates from Simone Basso and Jacob
Berkman.
2.5.0 - New APIs, bug fixes and improvements
* libtls now supports ALPN and SNI
* libtls adds a new callback interface for integrating custom IO
functions. Thanks to Tobias Pape.
* libtls now handles 4 cipher suite groups:
"secure" (TLSv1.2+AEAD+PFS)
"compat" (HIGH:!aNULL)
"legacy" (HIGH:MEDIUM:!aNULL)
"insecure" (ALL:!aNULL:!eNULL)
This allows for flexibility and finer grained control, rather than
having two extremes (an issue raised by Marko Kreen some time ago).
* Tightened error handling for tls_config_set_ciphers().
* libtls now always loads CA, key and certificate files at the time the
configuration function is called. This simplifies code and results in
a single memory based code path being used to provide data to libssl.
* Add support for OCSP intermediate certificates.
* Added functions used by stunnel and exim from BoringSSL - this
brings in X509_check_host, X509_check_email, X509_check_ip, and
X509_check_ip_asc.
* Added initial support for iOS, thanks to Jacob Berkman.
* Improved behavior of arc4random on Windows when using memory leak
analysis software.
* Correctly handle an EOF that occurs prior to the TLS handshake
completing. Reported by Vasily Kolobkov, based on a diff from Marko
Kreen.
* Limit the support of the "backward compatible" ssl2 handshake to
only be used if TLS 1.0 is enabled.
* Fix incorrect results in certain cases on 64-bit systems when
BN_mod_word() can return incorrect results. BN_mod_word() now can
return an error condition. Thanks to Brian Smith.
* Added constant-time updates to address CVE-2016-0702
* Fixed undefined behavior in BN_GF2m_mod_arr()
* Removed unused Cryptographic Message Support (CMS)
* More conversions of long long idioms to time_t
* Improved compatibility by avoiding printing NULL strings with
printf.
* Reverted change that cleans up the EVP cipher context in
EVP_EncryptFinal() and EVP_DecryptFinal(). Some software relies on the
previous behaviour.
* Avoid unbounded memory growth in libssl, which can be triggered by a
TLS client repeatedly renegotiating and sending OCSP Status Request
TLS extensions.
* Avoid falling back to a weak digest for (EC)DH when using SNI with
libssl.
2.4.2 - Bug fixes and improvements
* Fixed loading default certificate locations with openssl s_client.
* Ensured OCSP only uses and compares GENERALIZEDTIME values as per
RFC6960. Also added fixes for OCSP to work with intermediate
certificates provided in responses.
* Improved behavior of arc4random on Windows to not appear to leak
memory in debug tools, reduced privileges of allocated memory.
* Fixed incorrect results from BN_mod_word() when the modulus is too
large, thanks to Brian Smith from BoringSSL.
* Correctly handle an EOF prior to completing the TLS handshake in
libtls.
* Improved libtls ceritificate loading and cipher string validation.
* Updated libtls cipher group suites into four categories:
"secure" (TLSv1.2+AEAD+PFS)
"compat" (HIGH:!aNULL)
"legacy" (HIGH:MEDIUM:!aNULL)
"insecure" (ALL:!aNULL:!eNULL)
This allows for flexibility and finer grained control, rather than
having two extremes.
* Limited support for 'backward compatible' SSLv2 handshake packets to
when TLS 1.0 is enabled, providing more restricted compatibility
with TLS 1.0 clients.
* openssl(1) and other documentation improvements.
* Removed flags for disabling constant-time operations.
This removes support for DSA_FLAG_NO_EXP_CONSTTIME,
DH_FLAG_NO_EXP_CONSTTIME, and RSA_FLAG_NO_CONSTTIME flags, making
all of these operations unconditionally constant-time.
2.4.1 - Security fix
* Correct a problem that prevents the DSA signing algorithm from
running in constant time even if the flag BN_FLG_CONSTTIME is set.
This issue was reported by Cesar Pereida (Aalto University), Billy
Brumley (Tampere University of Technology), and Yuval Yarom (The
University of Adelaide and NICTA). The fix was developed by Cesar
Pereida.
2.4.0 - Build improvements, new features
* Many improvements to the CMake build infrastructure, including
Solaris, mingw-w64, Cygwin, and HP-UX support. Thanks to Kinichiro
Inoguchi for this work.
* Added missing error handling around bn_wexpand() calls.
* Added explicit_bzero calls for freed ASN.1 objects.
* Fixed X509_*set_object functions to return 0 on allocation failure.
* Implemented the IETF ChaCha20-Poly1305 cipher suites.
* Changed default EVP_aead_chacha20_poly1305() implementation to the
IETF version, which is now the default.
* Fixed password prompts from openssl(1) to properly handle ^C.
* Reworked error handling in libtls so that configuration errors are
visible.
* Deprecated internal use of EVP_[Cipher|Encrypt|Decrypt]_Final.
* Manpage fixes and updates
2.3.5 - Reliability fix
* Fixed an error in libcrypto when parsing some ASN.1 elements > 16k.
2.3.4 - Security Update
* Fix multiple vulnerabilities in libcrypto relating to ASN.1 and encoding.
From OpenSSL.
* Minor build fixes
2.3.3 - OpenBSD 5.9 release branch tagged
* Reworked build scripts to better sync with OpenNTPD-portable
* Fixed broken manpage links
* Fixed an nginx compatibility issue by adding an 'install_sw' make alias
* Fixed HP-UX builds
* Changed the default configuration directory to c:\LibreSSL\ssl on Windows
binary builds
* cert.pem has been reorganized and synced with Mozilla's certificate store
2.3.2 - Compatibility and Reliability fixes
* Changed format of LIBRESSL_VERSION_NUMBER to match that of
OPENSSL_VERSION_NUMBER, see:
https://wiki.openssl.org/index.php/Manual:OPENSSL_VERSION_NUMBER(3)
* Added EVP_aead_chacha20_poly1305_ietf() which matches the AEAD
construction introduced in RFC 7539, which is different than that
already used in TLS with EVP_aead_chacha20_poly1305()
* Avoid a potential undefined C99+ behavior due to shift overflow in
AES_decrypt, reported by Pascal Cuoq <cuoq at trust-in-soft.com>
* More man pages converted from pod to mdoc format
* Added COMODO RSA Certification Authority and QuoVadis
root certificates to cert.pem
* Removed Remove "C=US, O=VeriSign, Inc., OU=Class 3 Public Primary Certification
Authority" (serial 3c:91:31:cb:1f:f6:d0:1b:0e:9a:b8:d0:44:bf:12:be) root
certificate from cert.pem
* Added support for building nc(1) on Solaris
* Fixed GCC 5.x+ preprocessor checks, reported by Ruslan Babayev
* Improved console handling with openssl(1) on Windows
* Ensure the network stack is enabled on Windows when running
tls_init()
* Fixed incorrect TLS certificate loading by nc(1)
* Added support for Solaris 11.3's getentropy(2) system call
* Enabled support for using NetBSD 7.0's arc4random(3) implementation
* Deprecated the SSL_OP_SINGLE_DH_USE flag by disabling its effect
* Fixes from OpenSSL 1.0.1q
- CVE-2015-3194 - NULL pointer dereference in client side certificate
validation.
- CVE-2015-3195 - Memory leak in PKCS7 - not reachable from TLS/SSL
* The following OpenSSL CVEs did not apply to LibreSSL
- CVE-2015-3193 - Carry propagating bug in the x86_64 Montgomery
squaring procedure.
- CVE-2015-3196 - Double free race condition of the identify hint
data.
See https://marc.info/?l=openbsd-announce&m=144925068504102
2.3.1 - ASN.1 and time handling cleanups
* ASN.1 cleanups and RFC5280 compliance fixes.
* Time representations switched from 'unsigned long' to 'time_t'. LibreSSL
now checks if the host OS supports 64-bit time_t.
* Fixed a leak in SSL_new in the error path.
* Support always extracting the peer cipher and version with libtls.
* Added ability to check certificate validity times with libtls,
tls_peer_cert_notbefore and tls_peer_cert_notafter.
* Changed tls_connect_servername to use the first address that resolves with
getaddrinfo().
* Remove broken conditional EVP_CHECK_DES_KEY code (non-functional since
initial commit in 2004).
* Fixed a memory leak and out-of-bounds access in OBJ_obj2txt, reported
by Qualys Security.
* Fixed an up-to 7 byte overflow in RC4 when len is not a multiple of
sizeof(RC4_CHUNK), reported by Pascal Cuoq <cuoq at trust-in-soft.com>.
* Reject too small bits value in BN_generate_prime_ex(), so that it does
not risk becoming negative in probable_prime_dh_safe(), reported by
Franck Denis.
* Enable nc(1) builds on more platforms.
2.3.0 - SSLv3 removed, libtls API changes, portability improvements
* SSLv3 is now permanently removed from the tree.
* The libtls API is changed from the 2.2.x series.
The read/write functions work correctly with external event
libraries. See the tls_init man page for examples of using libtls
correctly in asynchronous mode.
Client-side verification is now supported, with the client supplying
the certificate to the server.
Also, when using tls_connect_fds, tls_connect_socket or
tls_accept_fds, libtls no longer implicitly closes the passed in
sockets. The caller is responsible for closing them in this case.
* When loading a DSA key from an raw (without DH parameters) ASN.1
serialization, perform some consistency checks on its `p' and `q'
values, and return an error if the checks failed.
Thanks for Georgi Guninski (guninski at guninski dot com) for
mentioning the possibility of a weak (non prime) q value and
providing a test case.
See
https://cpunks.org/pipermail/cypherpunks/2015-September/009007.html
for a longer discussion.
* Fixed a bug in ECDH_compute_key that can lead to silent truncation
of the result key without error. A coding error could cause software
to use much shorter keys than intended.
* Removed support for DTLS_BAD_VER. Pre-DTLSv1 implementations are no
longer supported.
* The engine command and parameters are removed from the openssl(1).
Previous releases removed dynamic and builtin engine support
already.
* SHA-0 is removed, which was withdrawn shortly after publication 20
years ago.
* Added Certplus CA root certificate to the default cert.pem file.
* New interface OPENSSL_cpu_caps is provided that does not allow
software to inadvertently modify cpu capability flags.
OPENSSL_ia32cap and OPENSSL_ia32cap_loc are removed.
* The out_len argument of AEAD changed from ssize_t to size_t.
* Deduplicated DTLS code, sharing bugfixes and improvements with
TLS.
* Converted 'nc' to use libtls for client and server operations; it is
included in the libressl-portable distribution as an example of how
to use the library.
2.2.3 - Bug fixes, build enhancements
* LibreSSL 2.2.2 incorrectly handles ClientHello messages that do not
include TLS extensions, resulting in such handshakes being aborted.
This release corrects the handling of such messages. Thanks to
Ligushka from github for reporting the issue.
* Added install target for cmake builds. Thanks to TheNietsnie from
github.
* Updated pkgconfig files to correctly report the release version
number, not the individual library ABI version numbers. Thanks to
Jan Engelhardt for reporting the issue.
2.2.2 - More TLS parser rework, bug fixes, expanded portable build support 2.2.2 - More TLS parser rework, bug fixes, expanded portable build support
* Switched 'openssl dhparam' default from 512 to 2048 bits * Switched 'openssl dhparam' default from 512 to 2048 bits

View File

@@ -5,4 +5,7 @@ pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libcrypto.pc libssl.pc libtls.pc openssl.pc pkgconfig_DATA = libcrypto.pc libssl.pc libtls.pc openssl.pc
EXTRA_DIST = README.md README.windows VERSION config scripts EXTRA_DIST = README.md README.windows VERSION config scripts
EXTRA_DIST += CMakeLists.txt EXTRA_DIST += CMakeLists.txt cmake_export_symbol.cmake cmake_uninstall.cmake.in
.PHONY: install_sw
install_sw: install

View File

@@ -1,2 +1,3 @@
AM_CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/include/compat AM_CFLAGS =
AM_CPPFLAGS = -DLIBRESSL_INTERNAL AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/include/compat -DLIBRESSL_INTERNAL
AM_CPPFLAGS += -D__BEGIN_HIDDEN_DECLS= -D__END_HIDDEN_DECLS=

View File

@@ -13,7 +13,7 @@ LibreSSL is API compatible with OpenSSL 1.0.1, but does not yet include all
new APIs from OpenSSL 1.0.2 and later. LibreSSL also includes APIs not yet new APIs from OpenSSL 1.0.2 and later. LibreSSL also includes APIs not yet
present in OpenSSL. The current common API subset is OpenSSL 1.0.1. present in OpenSSL. The current common API subset is OpenSSL 1.0.1.
LibreSSL it is not ABI compatible with any release of OpenSSL, or necessarily LibreSSL is not ABI compatible with any release of OpenSSL, or necessarily
earlier releases of LibreSSL. You will need to relink your programs to earlier releases of LibreSSL. You will need to relink your programs to
LibreSSL in order to use it, just as in moving between major versions of OpenSSL. LibreSSL in order to use it, just as in moving between major versions of OpenSSL.
LibreSSL's installed library version numbers are incremented to account for LibreSSL's installed library version numbers are incremented to account for
@@ -30,7 +30,7 @@ At the time of this writing, LibreSSL is know to build and work on:
* Linux (kernel 3.17 or later recommended) * Linux (kernel 3.17 or later recommended)
* FreeBSD (tested with 9.2 and later) * FreeBSD (tested with 9.2 and later)
* NetBSD (tested with 6.1.5) * NetBSD (7.0 or later recommended)
* HP-UX (11i) * HP-UX (11i)
* Solaris (11 and later preferred) * Solaris (11 and later preferred)
* Mac OS X (tested with 10.8 and later) * Mac OS X (tested with 10.8 and later)
@@ -56,20 +56,25 @@ or to the github
Severe vulnerabilities or bugs requiring coordination with OpenSSL can be Severe vulnerabilities or bugs requiring coordination with OpenSSL can be
sent to the core team at libressl-security@openbsd.org. sent to the core team at libressl-security@openbsd.org.
## Prerequisites when building from git ## # Building LibreSSL #
If you have checked this source using Git, follow these initial steps to ## Prerequisites when building from a Git checkout ##
prepare the source tree for building:
If you have checked this source using Git, or have downloaded a source tarball
from Github, follow these initial steps to prepare the source tree for
building. _Note: Your build will fail if you do not follow these instructions! If you cannot follow these instructions (e.g. Windows system using CMake) or cannot meet these prerequistes, please download an official release distribution from https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/ instead. Using official releases is strongly advised if you are not a developer._
1. Ensure you have the following packages installed: 1. Ensure you have the following packages installed:
automake, autoconf, bash, git, libtool, perl, pod2man automake, autoconf, git, libtool, perl
2. Run './autogen.sh' to prepare the source tree for building or 2. Run './autogen.sh' to prepare the source tree for building or
run './dist.sh' to prepare a tarball. run './dist.sh' to prepare a tarball.
## Building LibreSSL ## ## Steps that apply to all builds ##
Once you have a source tree from Git or FTP, run these commands to build and Once you have a source tree, either by downloaded using git and having
install the package on most systems: run the autogen.sh script above, or by downloading a release distribution from
an OpenBSD mirror, run these commands to build and install the package on most
systems:
```sh ```sh
./configure # see ./configure --help for configuration options ./configure # see ./configure --help for configuration options
@@ -119,9 +124,9 @@ should work. See README.windows for more information
#### Windows - Visual Studio #### #### Windows - Visual Studio ####
LibreSSL builds using the CMake target "Visual Studio 12 2013", and may build LibreSSL builds using the CMake target "Visual Studio 12 2013" and newer. To
against older/newer targets as well. To generate a Visual Studio project, generate a Visual Studio project, install CMake, enter the LibreSSL source
install CMake, enter the LibreSSL source directory and run: directory and run:
```sh ```sh
mkdir build-vs2013 mkdir build-vs2013
@@ -129,5 +134,18 @@ install CMake, enter the LibreSSL source directory and run:
cmake -G"Visual Studio 12 2013" .. cmake -G"Visual Studio 12 2013" ..
``` ```
This will generate a LibreSSL.sln file that you can incorporate into other Replace "Visual Studion 12 2013" with whatever version of Visual Studio you
projects or build by itself. have installed. This will generate a LibreSSL.sln file that you can incorporate
into other projects or build by itself.
#### Cmake - Additional Options ####
| Option Name | Default | Description
| ------------ | -----: | ------
| LIBRESSL_SKIP_INSTALL | OFF | allows skipping install() rules. Can be specified from command line using <br>```-DLIBRESSL_SKIP_INSTALL=ON``` |
| ENABLE_ASM | ON | builds assembly optimized rules. |
| ENABLE_EXTRATESTS | OFF | Enable extra tests that may be unreliable on some platforms |
| ENABLE_NC | OFF | Enable installing TLS-enabled nc(1) |
| ENABLE_VSTEST | OFF | Enable test on Visual Studio |
| OPENSSLDIR | Blank | Set the default openssl directory. Can be specified from command line using <br>```-DOPENSSLDIR=<dirname>``` |

View File

@@ -6,14 +6,14 @@ GCC or Clang as the compiler. Contrary to its name, mingw-w64 supports both
then LibreSSL should integrate very nicely. Old versions of the mingw-w64 then LibreSSL should integrate very nicely. Old versions of the mingw-w64
toolchain, such as the one packaged with Ubuntu 12.04, may have trouble toolchain, such as the one packaged with Ubuntu 12.04, may have trouble
building LibreSSL. Please try it with a recent toolchain if you encounter building LibreSSL. Please try it with a recent toolchain if you encounter
troubles. If you are building under Cygwin, only builds with the mingw-w64 troubles. Cygwin provides an easy method of installing the latest mingw-w64
compiler are supported, though you can easily use Cygwin to drive the build cross compilers on Windows.
process.
To configure and build LibreSSL for a 32-bit system, use the following To configure and build LibreSSL for a 32-bit system, use the following
build steps: build steps:
CC=i686-w64-mingw32-gcc ./configure --host=i686-w64-mingw32 CC=i686-w64-mingw32-gcc CPPFLAGS=-D__MINGW_USE_VC2005_COMPAT \
./configure --host=i686-w64-mingw32
make make
make check make check
@@ -23,6 +23,25 @@ For 64-bit builds, use these instead:
make make
make check make check
# Why the -D__MINGW_USE_VC2005_COMPAT flag on 32-bit systems?
An ABI change introduced with Microsoft Visual C++ 2005 (also known as
Visual C++ 8.0) switched time_t from 32-bit to 64-bit. It is important to
build LibreSSL with 64-bit time_t whenever possible, because 32-bit time_t
is unable to represent times past 2038 (this is commonly known as the
Y2K38 problem).
If LibreSSL is built with 32-bit time_t, when verifying a certificate whose
expiry date is set past 19 January 2038, it will be unable to tell if the
certificate has expired or not, and thus take the safe stance and reject it.
In order to avoid this, you need to build LibreSSL (and everything that links
with it) with the -D__MINGW_USE_VC2005_COMPAT flag. This tells mingw-w64 to
use the new ABI.
64-bit systems always have a 64-bit time_t and are not affected by this
problem.
# Using Libressl with Visual Studio # Using Libressl with Visual Studio
A script for generating ready-to-use .DLL and static .LIB files is included in A script for generating ready-to-use .DLL and static .LIB files is included in

View File

@@ -1,2 +0,0 @@
2.2.2

View File

@@ -1,79 +1,3 @@
include_directories( add_subdirectory(ocspcheck)
. add_subdirectory(openssl)
../include add_subdirectory(nc)
../include/compat
)
set(
OPENSSL_SRC
apps.c
asn1pars.c
ca.c
ciphers.c
cms.c
crl.c
crl2p7.c
dgst.c
dh.c
dhparam.c
dsa.c
dsaparam.c
ec.c
ecparam.c
enc.c
engine.c
errstr.c
gendh.c
gendsa.c
genpkey.c
genrsa.c
nseq.c
ocsp.c
openssl.c
passwd.c
pkcs12.c
pkcs7.c
pkcs8.c
pkey.c
pkeyparam.c
pkeyutl.c
prime.c
rand.c
req.c
rsa.c
rsautl.c
s_cb.c
s_client.c
s_server.c
s_socket.c
s_time.c
sess_id.c
smime.c
speed.c
spkac.c
ts.c
verify.c
version.c
x509.c
)
if(CMAKE_HOST_UNIX)
set(OPENSSL_SRC ${OPENSSL_SRC} apps_posix.c)
set(OPENSSL_SRC ${OPENSSL_SRC} certhash.c)
endif()
if(CMAKE_HOST_WIN32)
set(OPENSSL_SRC ${OPENSSL_SRC} apps_win.c)
set(OPENSSL_SRC ${OPENSSL_SRC} certhash_disabled.c)
set(OPENSSL_SRC ${OPENSSL_SRC} poll_win.c)
endif()
check_function_exists(strtonum HAVE_STRTONUM)
if(HAVE_STRTONUM)
add_definitions(-DHAVE_STRTONUM)
else()
set(OPENSSL_SRC ${OPENSSL_SRC} strtonum.c)
endif()
add_executable(openssl ${OPENSSL_SRC})
target_link_libraries(openssl ${OPENSSL_LIBS})

View File

@@ -1,118 +1,5 @@
include $(top_srcdir)/Makefile.am.common include $(top_srcdir)/Makefile.am.common
bin_PROGRAMS = openssl SUBDIRS = ocspcheck openssl nc
openssl_LDADD = $(PLATFORM_LDADD) $(PROG_LDADD) EXTRA_DIST = CMakeLists.txt
openssl_LDADD += $(top_builddir)/ssl/libssl.la
openssl_LDADD += $(top_builddir)/crypto/libcrypto.la
openssl_SOURCES = apps.c
openssl_SOURCES += asn1pars.c
openssl_SOURCES += ca.c
openssl_SOURCES += ciphers.c
openssl_SOURCES += cms.c
openssl_SOURCES += crl.c
openssl_SOURCES += crl2p7.c
openssl_SOURCES += dgst.c
openssl_SOURCES += dh.c
openssl_SOURCES += dhparam.c
openssl_SOURCES += dsa.c
openssl_SOURCES += dsaparam.c
openssl_SOURCES += ec.c
openssl_SOURCES += ecparam.c
openssl_SOURCES += enc.c
openssl_SOURCES += engine.c
openssl_SOURCES += errstr.c
openssl_SOURCES += gendh.c
openssl_SOURCES += gendsa.c
openssl_SOURCES += genpkey.c
openssl_SOURCES += genrsa.c
openssl_SOURCES += nseq.c
openssl_SOURCES += ocsp.c
openssl_SOURCES += openssl.c
openssl_SOURCES += passwd.c
openssl_SOURCES += pkcs12.c
openssl_SOURCES += pkcs7.c
openssl_SOURCES += pkcs8.c
openssl_SOURCES += pkey.c
openssl_SOURCES += pkeyparam.c
openssl_SOURCES += pkeyutl.c
openssl_SOURCES += prime.c
openssl_SOURCES += rand.c
openssl_SOURCES += req.c
openssl_SOURCES += rsa.c
openssl_SOURCES += rsautl.c
openssl_SOURCES += s_cb.c
openssl_SOURCES += s_client.c
openssl_SOURCES += s_server.c
openssl_SOURCES += s_socket.c
openssl_SOURCES += s_time.c
openssl_SOURCES += sess_id.c
openssl_SOURCES += smime.c
openssl_SOURCES += speed.c
openssl_SOURCES += spkac.c
openssl_SOURCES += ts.c
openssl_SOURCES += verify.c
openssl_SOURCES += version.c
openssl_SOURCES += x509.c
if BUILD_CERTHASH
openssl_SOURCES += certhash.c
else
openssl_SOURCES += certhash_disabled.c
endif
if HOST_WIN
openssl_SOURCES += apps_win.c
else
openssl_SOURCES += apps_posix.c
endif
if !HAVE_POLL
if HOST_WIN
openssl_SOURCES += poll_win.c
endif
endif
if !HAVE_STRTONUM
openssl_SOURCES += strtonum.c
endif
noinst_HEADERS = apps.h
noinst_HEADERS += progs.h
noinst_HEADERS += s_apps.h
noinst_HEADERS += testdsa.h
noinst_HEADERS += testrsa.h
noinst_HEADERS += timeouts.h
EXTRA_DIST = cert.pem
EXTRA_DIST += openssl.cnf
EXTRA_DIST += x509v3.cnf
EXTRA_DIST += CMakeLists.txt
install-exec-hook:
@if [ "@OPENSSLDIR@x" != "x" ]; then \
OPENSSLDIR="$(DESTDIR)/@OPENSSLDIR@"; \
else \
OPENSSLDIR="$(DESTDIR)/$(sysconfdir)/ssl"; \
fi; \
mkdir -p "$$OPENSSLDIR/certs"; \
for i in cert.pem openssl.cnf x509v3.cnf; do \
if [ ! -f "$$OPENSSLDIR/$i" ]; then \
$(INSTALL) -m 644 "$(srcdir)/$$i" "$$OPENSSLDIR/$$i"; \
else \
echo " $$OPENSSLDIR/$$i already exists, install will not overwrite"; \
fi \
done
uninstall-local:
@if [ "@OPENSSLDIR@x" != "x" ]; then \
OPENSSLDIR="$(DESTDIR)/@OPENSSLDIR@"; \
else \
OPENSSLDIR="$(DESTDIR)/$(sysconfdir)/ssl"; \
fi; \
for i in cert.pem openssl.cnf x509v3.cnf; do \
if cmp -s "$$OPENSSLDIR/$$i" "$(srcdir)/$$i"; then \
rm -f "$$OPENSSLDIR/$$i"; \
fi \
done

View File

@@ -1,29 +0,0 @@
/*
* Public domain
*
* Dongsheng Song <dongsheng.song@gmail.com>
* Brent Cook <bcook@openbsd.org>
*/
#include <windows.h>
#include "apps.h"
double
app_tminterval(int stop, int usertime)
{
static unsigned __int64 tmstart;
union {
unsigned __int64 u64;
FILETIME ft;
} ct, et, kt, ut;
GetProcessTimes(GetCurrentProcess(), &ct.ft, &et.ft, &kt.ft, &ut.ft);
if (stop == TM_START) {
tmstart = ut.u64 + kt.u64;
} else {
return (ut.u64 + kt.u64 - tmstart) / (double) 10000000;
}
return 0;
}

62
apps/nc/CMakeLists.txt Normal file
View File

@@ -0,0 +1,62 @@
if(BUILD_NC)
include_directories(
.
./compat
../../include
../../include/compat
)
set(
NC_SRC
atomicio.c
netcat.c
socks.c
compat/socket.c
)
check_function_exists(b64_ntop HAVE_B64_NTOP)
if(HAVE_B64_NTOP)
add_definitions(-DHAVE_B64_NTOP)
else()
set(NC_SRC ${NC_SRC} compat/base64.c)
endif()
check_function_exists(accept4 HAVE_ACCEPT4)
if(HAVE_ACCEPT4)
add_definitions(-DHAVE_ACCEPT4)
else()
set(NC_SRC ${NC_SRC} compat/accept4.c)
endif()
check_function_exists(readpassphrase HAVE_READPASSPHRASE)
if(HAVE_READPASSPHRASE)
add_definitions(-DHAVE_READPASSPHRASE)
else()
set(NC_SRC ${NC_SRC} compat/readpassphrase.c)
endif()
check_function_exists(strtonum HAVE_STRTONUM)
if(HAVE_STRTONUM)
add_definitions(-DHAVE_STRTONUM)
else()
set(NC_SRC ${NC_SRC} compat/strtonum.c)
endif()
if(NOT "${OPENSSLDIR}" STREQUAL "")
add_definitions(-DDEFAULT_CA_FILE=\"${OPENSSLDIR}/cert.pem\")
else()
add_definitions(-DDEFAULT_CA_FILE=\"${CMAKE_INSTALL_PREFIX}/etc/ssl/cert.pem\")
endif()
add_executable(nc ${NC_SRC})
target_link_libraries(nc tls ${OPENSSL_LIBS})
if(ENABLE_NC)
if(ENABLE_LIBRESSL_INSTALL)
install(TARGETS nc DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES nc.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
endif(ENABLE_LIBRESSL_INSTALL)
endif()
endif()

46
apps/nc/Makefile.am Normal file
View File

@@ -0,0 +1,46 @@
include $(top_srcdir)/Makefile.am.common
if BUILD_NC
if ENABLE_NC
bin_PROGRAMS = nc
dist_man_MANS = nc.1
else
noinst_PROGRAMS = nc
endif
EXTRA_DIST = nc.1
EXTRA_DIST += CMakeLists.txt
nc_LDADD = $(abs_top_builddir)/crypto/libcrypto.la
nc_LDADD += $(abs_top_builddir)/ssl/libssl.la
nc_LDADD += $(abs_top_builddir)/tls/libtls.la
nc_LDADD += $(PLATFORM_LDADD) $(PROG_LDADD)
AM_CPPFLAGS += -I$(top_srcdir)/apps/nc/compat
nc_SOURCES = atomicio.c
nc_SOURCES += netcat.c
nc_SOURCES += socks.c
noinst_HEADERS = atomicio.h
noinst_HEADERS += compat/sys/socket.h
nc_SOURCES += compat/socket.c
if !HAVE_B64_NTOP
nc_SOURCES += compat/base64.c
endif
if !HAVE_ACCEPT4
nc_SOURCES += compat/accept4.c
endif
if !HAVE_READPASSPHRASE
nc_SOURCES += compat/readpassphrase.c
endif
if !HAVE_STRTONUM
nc_SOURCES += compat/strtonum.c
endif
endif

17
apps/nc/compat/accept4.c Normal file
View File

@@ -0,0 +1,17 @@
#include <sys/socket.h>
#include <fcntl.h>
int
accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
{
int rets = accept(s, addr, addrlen);
if (rets == -1)
return s;
if (flags & SOCK_CLOEXEC) {
flags = fcntl(s, F_GETFD);
fcntl(rets, F_SETFD, flags | FD_CLOEXEC);
}
return rets;
}

View File

@@ -0,0 +1,205 @@
/* $OpenBSD: readpassphrase.c,v 1.22 2010/01/13 10:20:54 dtucker Exp $ */
/*
* Copyright (c) 2000-2002, 2007 Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Sponsored in part by the Defense Advanced Research Projects
* Agency (DARPA) and Air Force Research Laboratory, Air Force
* Materiel Command, USAF, under agreement number F39502-99-1-0512.
*/
/* OPENBSD ORIGINAL: lib/libc/gen/readpassphrase.c */
#include <termios.h>
#include <signal.h>
#include <ctype.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <readpassphrase.h>
#ifndef _PATH_TTY
# define _PATH_TTY "/dev/tty"
#endif
#ifdef TCSASOFT
# define _T_FLUSH (TCSAFLUSH|TCSASOFT)
#else
# define _T_FLUSH (TCSAFLUSH)
#endif
/* SunOS 4.x which lacks _POSIX_VDISABLE, but has VDISABLE */
#if !defined(_POSIX_VDISABLE) && defined(VDISABLE)
# define _POSIX_VDISABLE VDISABLE
#endif
#ifndef _NSIG
# ifdef NSIG
# define _NSIG NSIG
# else
# define _NSIG 128
# endif
#endif
static volatile sig_atomic_t signo[_NSIG];
static void handler(int);
char *
readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags)
{
ssize_t bytes_written = 0;
ssize_t nr;
int input, output, save_errno, i, need_restart;
char ch, *p, *end;
struct termios term, oterm;
struct sigaction sa, savealrm, saveint, savehup, savequit, saveterm;
struct sigaction savetstp, savettin, savettou, savepipe;
/* I suppose we could alloc on demand in this case (XXX). */
if (bufsiz == 0) {
errno = EINVAL;
return(NULL);
}
restart:
for (i = 0; i < _NSIG; i++)
signo[i] = 0;
nr = -1;
save_errno = 0;
need_restart = 0;
/*
* Read and write to /dev/tty if available. If not, read from
* stdin and write to stderr unless a tty is required.
*/
if ((flags & RPP_STDIN) ||
(input = output = open(_PATH_TTY, O_RDWR)) == -1) {
if (flags & RPP_REQUIRE_TTY) {
errno = ENOTTY;
return(NULL);
}
input = STDIN_FILENO;
output = STDERR_FILENO;
}
/*
* Catch signals that would otherwise cause the user to end
* up with echo turned off in the shell. Don't worry about
* things like SIGXCPU and SIGVTALRM for now.
*/
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0; /* don't restart system calls */
sa.sa_handler = handler;
(void)sigaction(SIGALRM, &sa, &savealrm);
(void)sigaction(SIGHUP, &sa, &savehup);
(void)sigaction(SIGINT, &sa, &saveint);
(void)sigaction(SIGPIPE, &sa, &savepipe);
(void)sigaction(SIGQUIT, &sa, &savequit);
(void)sigaction(SIGTERM, &sa, &saveterm);
(void)sigaction(SIGTSTP, &sa, &savetstp);
(void)sigaction(SIGTTIN, &sa, &savettin);
(void)sigaction(SIGTTOU, &sa, &savettou);
/* Turn off echo if possible. */
if (input != STDIN_FILENO && tcgetattr(input, &oterm) == 0) {
memcpy(&term, &oterm, sizeof(term));
if (!(flags & RPP_ECHO_ON))
term.c_lflag &= ~(ECHO | ECHONL);
#ifdef VSTATUS
if (term.c_cc[VSTATUS] != _POSIX_VDISABLE)
term.c_cc[VSTATUS] = _POSIX_VDISABLE;
#endif
(void)tcsetattr(input, _T_FLUSH, &term);
} else {
memset(&term, 0, sizeof(term));
term.c_lflag |= ECHO;
memset(&oterm, 0, sizeof(oterm));
oterm.c_lflag |= ECHO;
}
/* No I/O if we are already backgrounded. */
if (signo[SIGTTOU] != 1 && signo[SIGTTIN] != 1) {
if (!(flags & RPP_STDIN))
bytes_written = write(output, prompt, strlen(prompt));
end = buf + bufsiz - 1;
p = buf;
while ((nr = read(input, &ch, 1)) == 1 && ch != '\n' && ch != '\r') {
if (p < end) {
if ((flags & RPP_SEVENBIT))
ch &= 0x7f;
if (isalpha((unsigned char)ch)) {
if ((flags & RPP_FORCELOWER))
ch = (char)tolower((unsigned char)ch);
if ((flags & RPP_FORCEUPPER))
ch = (char)toupper((unsigned char)ch);
}
*p++ = ch;
}
}
*p = '\0';
save_errno = errno;
if (!(term.c_lflag & ECHO))
bytes_written = write(output, "\n", 1);
}
(void) bytes_written;
/* Restore old terminal settings and signals. */
if (memcmp(&term, &oterm, sizeof(term)) != 0) {
while (tcsetattr(input, _T_FLUSH, &oterm) == -1 &&
errno == EINTR)
continue;
}
(void)sigaction(SIGALRM, &savealrm, NULL);
(void)sigaction(SIGHUP, &savehup, NULL);
(void)sigaction(SIGINT, &saveint, NULL);
(void)sigaction(SIGQUIT, &savequit, NULL);
(void)sigaction(SIGPIPE, &savepipe, NULL);
(void)sigaction(SIGTERM, &saveterm, NULL);
(void)sigaction(SIGTSTP, &savetstp, NULL);
(void)sigaction(SIGTTIN, &savettin, NULL);
(void)sigaction(SIGTTOU, &savettou, NULL);
if (input != STDIN_FILENO)
(void)close(input);
/*
* If we were interrupted by a signal, resend it to ourselves
* now that we have restored the signal handlers.
*/
for (i = 0; i < _NSIG; i++) {
if (signo[i]) {
kill(getpid(), i);
switch (i) {
case SIGTSTP:
case SIGTTIN:
case SIGTTOU:
need_restart = 1;
}
}
}
if (need_restart)
goto restart;
if (save_errno)
errno = save_errno;
return(nr == -1 ? NULL : buf);
}
static void handler(int s)
{
signo[s] = 1;
}

29
apps/nc/compat/socket.c Normal file
View File

@@ -0,0 +1,29 @@
#define SOCKET_FLAGS_PRIV
#include <sys/socket.h>
#ifdef NEED_SOCKET_FLAGS
#include <fcntl.h>
int
_socket(int domain, int type, int protocol)
{
int s = socket(domain, type & ~(SOCK_CLOEXEC | SOCK_NONBLOCK), protocol);
int flags;
if (s == -1)
return s;
if (type & SOCK_CLOEXEC) {
flags = fcntl(s, F_GETFD);
fcntl(s, F_SETFD, flags | FD_CLOEXEC);
}
if (type & SOCK_NONBLOCK) {
flags = fcntl(s, F_GETFL);
fcntl(s, F_SETFL, flags | O_NONBLOCK);
}
return s;
}
#endif

View File

@@ -0,0 +1,31 @@
/*
* Public domain
* sys/socket.h compatibility shim
*/
#ifndef _WIN32
#include_next <sys/socket.h>
#if !defined(SOCK_NONBLOCK) || !defined(SOCK_CLOEXEC)
#define NEED_SOCKET_FLAGS
int _socket(int domain, int type, int protocol);
#ifndef SOCKET_FLAGS_PRIV
#define socket(d, t, p) _socket(d, t, p)
#endif
#endif
#ifndef SOCK_NONBLOCK
#define SOCK_NONBLOCK 0x4000 /* set O_NONBLOCK */
#endif
#ifndef SOCK_CLOEXEC
#define SOCK_CLOEXEC 0x8000 /* set FD_CLOEXEC */
#endif
#ifndef HAVE_ACCEPT4
int accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags);
#endif
#else
#include <win32netcompat.h>
#endif

View File

@@ -0,0 +1,45 @@
if(NOT MSVC)
include_directories(
.
./compat
../../include
../../include/compat
)
set(
OCSPCHECK_SRC
http.c
ocspcheck.c
)
check_function_exists(inet_ntop HAVE_INET_NTOP)
if(HAVE_INET_NTOP)
add_definitions(-DHAVE_INET_NTOP)
else()
set(OCSPCHECK_SRC ${OCSPCHECK_SRC} compat/inet_ntop.c)
endif()
check_function_exists(memmem HAVE_MEMMEM)
if(HAVE_MEMMEM)
add_definitions(-DHAVE_MEMMEM)
else()
set(OCSPCHECK_SRC ${OCSPCHECK_SRC} compat/memmem.c)
endif()
if(NOT "${OPENSSLDIR}" STREQUAL "")
add_definitions(-DDEFAULT_CA_FILE=\"${OPENSSLDIR}/cert.pem\")
else()
add_definitions(-DDEFAULT_CA_FILE=\"${CMAKE_INSTALL_PREFIX}/etc/ssl/cert.pem\")
endif()
add_executable(ocspcheck ${OCSPCHECK_SRC})
target_link_libraries(ocspcheck tls ${OPENSSL_LIBS})
if(ENABLE_LIBRESSL_INSTALL)
install(TARGETS ocspcheck DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES ocspcheck.8 DESTINATION ${CMAKE_INSTALL_MANDIR}/man8)
endif(ENABLE_LIBRESSL_INSTALL)
endif()

View File

@@ -0,0 +1,23 @@
include $(top_srcdir)/Makefile.am.common
bin_PROGRAMS = ocspcheck
EXTRA_DIST = ocspcheck.8
EXTRA_DIST += CMakeLists.txt
ocspcheck_LDADD = $(abs_top_builddir)/crypto/libcrypto.la
ocspcheck_LDADD += $(abs_top_builddir)/ssl/libssl.la
ocspcheck_LDADD += $(abs_top_builddir)/tls/libtls.la
ocspcheck_LDADD += $(PLATFORM_LDADD) $(PROG_LDADD)
ocspcheck_SOURCES = http.c
ocspcheck_SOURCES += ocspcheck.c
noinst_HEADERS = http.h
if !HAVE_INET_NTOP
ocspcheck_SOURCES += compat/inet_ntop.c
endif
if !HAVE_MEMMEM
ocspcheck_SOURCES += compat/memmem.c
endif

0
apps/ocspcheck/compat/.gitignore vendored Normal file
View File

View File

@@ -0,0 +1,92 @@
include_directories(
.
../../include
../../include/compat
)
set(
OPENSSL_SRC
apps.c
asn1pars.c
ca.c
ciphers.c
crl.c
crl2p7.c
dgst.c
dh.c
dhparam.c
dsa.c
dsaparam.c
ec.c
ecparam.c
enc.c
errstr.c
gendh.c
gendsa.c
genpkey.c
genrsa.c
nseq.c
ocsp.c
openssl.c
passwd.c
pkcs12.c
pkcs7.c
pkcs8.c
pkey.c
pkeyparam.c
pkeyutl.c
prime.c
rand.c
req.c
rsa.c
rsautl.c
s_cb.c
s_client.c
s_server.c
s_socket.c
s_time.c
sess_id.c
smime.c
speed.c
spkac.c
ts.c
verify.c
version.c
x509.c
)
if(CMAKE_HOST_UNIX)
set(OPENSSL_SRC ${OPENSSL_SRC} apps_posix.c)
set(OPENSSL_SRC ${OPENSSL_SRC} certhash.c)
endif()
if(CMAKE_HOST_WIN32)
set(OPENSSL_SRC ${OPENSSL_SRC} apps_win.c)
set(OPENSSL_SRC ${OPENSSL_SRC} certhash_win.c)
set(OPENSSL_SRC ${OPENSSL_SRC} compat/poll_win.c)
endif()
check_function_exists(strtonum HAVE_STRTONUM)
if(HAVE_STRTONUM)
add_definitions(-DHAVE_STRTONUM)
else()
set(OPENSSL_SRC ${OPENSSL_SRC} compat/strtonum.c)
endif()
add_executable(openssl ${OPENSSL_SRC})
target_link_libraries(openssl ${OPENSSL_LIBS})
if(ENABLE_LIBRESSL_INSTALL)
install(TARGETS openssl DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES openssl.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
endif(ENABLE_LIBRESSL_INSTALL)
if(NOT "${OPENSSLDIR}" STREQUAL "")
set(CONF_DIR "${OPENSSLDIR}")
else()
set(CONF_DIR "${CMAKE_INSTALL_PREFIX}/etc/ssl")
endif()
if(ENABLE_LIBRESSL_INSTALL)
install(FILES cert.pem openssl.cnf x509v3.cnf DESTINATION ${CONF_DIR})
install(DIRECTORY DESTINATION ${CONF_DIR}/certs)
endif(ENABLE_LIBRESSL_INSTALL)

118
apps/openssl/Makefile.am Normal file
View File

@@ -0,0 +1,118 @@
include $(top_srcdir)/Makefile.am.common
bin_PROGRAMS = openssl
dist_man_MANS = openssl.1
openssl_LDADD = $(abs_top_builddir)/ssl/libssl.la
openssl_LDADD += $(abs_top_builddir)/crypto/libcrypto.la
openssl_LDADD += $(PLATFORM_LDADD) $(PROG_LDADD)
openssl_SOURCES = apps.c
openssl_SOURCES += asn1pars.c
openssl_SOURCES += ca.c
openssl_SOURCES += ciphers.c
openssl_SOURCES += crl.c
openssl_SOURCES += crl2p7.c
openssl_SOURCES += dgst.c
openssl_SOURCES += dh.c
openssl_SOURCES += dhparam.c
openssl_SOURCES += dsa.c
openssl_SOURCES += dsaparam.c
openssl_SOURCES += ec.c
openssl_SOURCES += ecparam.c
openssl_SOURCES += enc.c
openssl_SOURCES += errstr.c
openssl_SOURCES += gendh.c
openssl_SOURCES += gendsa.c
openssl_SOURCES += genpkey.c
openssl_SOURCES += genrsa.c
openssl_SOURCES += nseq.c
openssl_SOURCES += ocsp.c
openssl_SOURCES += openssl.c
openssl_SOURCES += passwd.c
openssl_SOURCES += pkcs12.c
openssl_SOURCES += pkcs7.c
openssl_SOURCES += pkcs8.c
openssl_SOURCES += pkey.c
openssl_SOURCES += pkeyparam.c
openssl_SOURCES += pkeyutl.c
openssl_SOURCES += prime.c
openssl_SOURCES += rand.c
openssl_SOURCES += req.c
openssl_SOURCES += rsa.c
openssl_SOURCES += rsautl.c
openssl_SOURCES += s_cb.c
openssl_SOURCES += s_client.c
openssl_SOURCES += s_server.c
openssl_SOURCES += s_socket.c
openssl_SOURCES += s_time.c
openssl_SOURCES += sess_id.c
openssl_SOURCES += smime.c
openssl_SOURCES += speed.c
openssl_SOURCES += spkac.c
openssl_SOURCES += ts.c
openssl_SOURCES += verify.c
openssl_SOURCES += version.c
openssl_SOURCES += x509.c
if BUILD_CERTHASH
openssl_SOURCES += certhash.c
else
openssl_SOURCES += certhash_win.c
endif
if HOST_WIN
openssl_SOURCES += apps_win.c
else
openssl_SOURCES += apps_posix.c
endif
if !HAVE_POLL
if HOST_WIN
openssl_SOURCES += compat/poll_win.c
endif
endif
if !HAVE_STRTONUM
openssl_SOURCES += compat/strtonum.c
endif
noinst_HEADERS = apps.h
noinst_HEADERS += progs.h
noinst_HEADERS += s_apps.h
noinst_HEADERS += testdsa.h
noinst_HEADERS += testrsa.h
noinst_HEADERS += timeouts.h
EXTRA_DIST = cert.pem
EXTRA_DIST += openssl.cnf
EXTRA_DIST += x509v3.cnf
EXTRA_DIST += CMakeLists.txt
install-exec-hook:
@if [ "@OPENSSLDIR@x" != "x" ]; then \
OPENSSLDIR="$(DESTDIR)@OPENSSLDIR@"; \
else \
OPENSSLDIR="$(DESTDIR)$(sysconfdir)/ssl"; \
fi; \
mkdir -p "$$OPENSSLDIR/certs"; \
for i in cert.pem openssl.cnf x509v3.cnf; do \
if [ ! -f "$$OPENSSLDIR/$i" ]; then \
$(INSTALL) -m 644 "$(srcdir)/$$i" "$$OPENSSLDIR/$$i"; \
else \
echo " $$OPENSSLDIR/$$i already exists, install will not overwrite"; \
fi \
done
uninstall-local:
@if [ "@OPENSSLDIR@x" != "x" ]; then \
OPENSSLDIR="$(DESTDIR)@OPENSSLDIR@"; \
else \
OPENSSLDIR="$(DESTDIR)$(sysconfdir)/ssl"; \
fi; \
for i in cert.pem openssl.cnf x509v3.cnf; do \
if cmp -s "$$OPENSSLDIR/$$i" "$(srcdir)/$$i"; then \
rm -f "$$OPENSSLDIR/$$i"; \
fi \
done

58
apps/openssl/apps_win.c Normal file
View File

@@ -0,0 +1,58 @@
/*
* Public domain
*
* Dongsheng Song <dongsheng.song@gmail.com>
* Brent Cook <bcook@openbsd.org>
*/
#include <windows.h>
#include <io.h>
#include <fcntl.h>
#include "apps.h"
double
app_timer_user(int stop)
{
static unsigned __int64 tmstart;
union {
unsigned __int64 u64;
FILETIME ft;
} ct, et, kt, ut;
GetProcessTimes(GetCurrentProcess(), &ct.ft, &et.ft, &kt.ft, &ut.ft);
if (stop)
return (ut.u64 + kt.u64 - tmstart) / (double) 10000000;
tmstart = ut.u64 + kt.u64;
return 0.0;
}
int
setup_ui(void)
{
ui_method = UI_create_method("OpenSSL application user interface");
UI_method_set_opener(ui_method, ui_open);
UI_method_set_reader(ui_method, ui_read);
UI_method_set_writer(ui_method, ui_write);
UI_method_set_closer(ui_method, ui_close);
/*
* Set STDIO to binary
*/
_setmode(_fileno(stdin), _O_BINARY);
_setmode(_fileno(stdout), _O_BINARY);
_setmode(_fileno(stderr), _O_BINARY);
return 0;
}
void
destroy_ui(void)
{
if (ui_method) {
UI_destroy_method(ui_method);
ui_method = NULL;
}
}

View File

@@ -253,7 +253,9 @@ poll(struct pollfd *pfds, nfds_t nfds, int timeout_ms)
looptime_ms = timeout_ms > 100 ? 100 : timeout_ms; looptime_ms = timeout_ms > 100 ? 100 : timeout_ms;
do { do {
struct timeval tv = {0, looptime_ms * 1000}; struct timeval tv;
tv.tv_sec = 0;
tv.tv_usec = looptime_ms * 1000;
int handle_signaled = 0; int handle_signaled = 0;
/* /*

View File

@@ -9,3 +9,7 @@ autoreconf -i -f
sed 's/-fuse-linker-plugin)/-fuse-linker-plugin|-fstack-protector*)/' \ sed 's/-fuse-linker-plugin)/-fuse-linker-plugin|-fstack-protector*)/' \
ltmain.sh > ltmain.sh.fixed ltmain.sh > ltmain.sh.fixed
mv -f ltmain.sh.fixed ltmain.sh mv -f ltmain.sh.fixed ltmain.sh
# Update config scripts and fixup permissions
find . ! -perm -u=w -exec chmod u+w {} \;
cp scripts/config.* .

71
check-release.sh Executable file
View File

@@ -0,0 +1,71 @@
#!/bin/sh
set -e
ver=$1
dir=libressl-$ver
tarball=$dir.tar.gz
tag=v$ver
if [ -z "$LIBRESSL_SSH" ]; then
if ! curl -v 1>/dev/null 2>&1; then
download="curl -O"
elif echo quit | ftp 1>/dev/null 2>&1; then
download=ftp
else
echo "need 'ftp' or 'curl' to verify"
exit
fi
fi
if [ "$ver" = "" ]; then
echo "please specify a version to check, e.g. $0 2.1.2"
exit
fi
if [ ! -e releases/$tarball ]; then
mkdir -p releases
rm -f $tarball
if [ -z "$LIBRESSL_SSH" ]; then
$download http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/$tarball releases/
mv $tarball releases
else
scp $LIBRESSL_SSH/$tarball releases
fi
(cd releases; tar zxvf $tarball)
fi
if [ ! -e gen-releases/$tarball ]; then
rm -fr tests man include ssl crypto libtls-standalone/VERSION INSTALL
git checkout OPENBSD_BRANCH update.sh tests man include ssl crypto
git checkout $tag
echo "libressl-$tag" > OPENBSD_BRANCH
sed -i 's/git pull --rebase//' update.sh
./autogen.sh
./configure --enable-libtls
make dist
mkdir -p gen-releases
mv $tarball gen-releases
git checkout OPENBSD_BRANCH update.sh
git checkout master
fi
(cd gen-releases; rm -fr $dir; tar zxf $tarball)
(cd releases; rm -fr $dir; tar zxf $tarball)
echo "differences between release and regenerated release tag:"
diff -urN \
-x *.3 \
-x *.5 \
-x Makefile.in \
-x aclocal.m4 \
-x compile \
-x config.guess \
-x config.sub \
-x configure \
-x depcomp \
-x install-sh \
-x missing \
-x test-driver \
releases/$dir gen-releases/$dir

50
cmake_export_symbol.cmake Normal file
View File

@@ -0,0 +1,50 @@
macro(export_symbol TARGET FILENAME)
set(FLAG "")
if(WIN32)
string(REPLACE ".sym" ".def" DEF_FILENAME ${FILENAME})
file(WRITE ${DEF_FILENAME} "EXPORTS\n")
file(READ ${FILENAME} SYMBOLS)
file(APPEND ${DEF_FILENAME} "${SYMBOLS}")
target_sources(${TARGET} PRIVATE ${DEF_FILENAME})
elseif(APPLE)
file(READ ${FILENAME} SYMBOLS)
string(REGEX REPLACE "\n$" "" SYMBOLS ${SYMBOLS})
string(REPLACE "\n" "\n_" SYMBOLS ${SYMBOLS})
string(REGEX REPLACE "(.)$" "\\1\\n" SYMBOLS ${SYMBOLS})
string(REPLACE ".sym" ".exp" EXP_FILENAME ${FILENAME})
file(WRITE ${EXP_FILENAME} "_${SYMBOLS}")
set(FLAG "-exported_symbols_list ${EXP_FILENAME}")
set_target_properties(${TARGET} PROPERTIES LINK_FLAGS ${FLAG})
elseif(CMAKE_SYSTEM_NAME MATCHES "HP-UX")
file(READ ${FILENAME} SYMBOLS)
string(REGEX REPLACE "\n$" "" SYMBOLS ${SYMBOLS})
string(REPLACE "\n" "\n+e " SYMBOLS ${SYMBOLS})
string(REPLACE ".sym" ".opt" OPT_FILENAME ${FILENAME})
file(WRITE ${OPT_FILENAME} "+e ${SYMBOLS}")
set(FLAG "-Wl,-c,${OPT_FILENAME}")
set_target_properties(${TARGET} PROPERTIES LINK_FLAGS ${FLAG})
elseif(CMAKE_SYSTEM_NAME MATCHES "SunOS")
file(READ ${FILENAME} SYMBOLS)
string(REPLACE "\n" ";\n" SYMBOLS ${SYMBOLS})
string(REPLACE ".sym" ".ver" VER_FILENAME ${FILENAME})
file(WRITE ${VER_FILENAME}
"{\nglobal:\n${SYMBOLS}\nlocal:\n*;\n};\n")
set(FLAG "-Wl,-M${VER_FILENAME}")
set_target_properties(${TARGET} PROPERTIES LINK_FLAGS ${FLAG})
elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
file(READ ${FILENAME} SYMBOLS)
string(REPLACE "\n" ";\n" SYMBOLS ${SYMBOLS})
string(REPLACE ".sym" ".ver" VER_FILENAME ${FILENAME})
file(WRITE ${VER_FILENAME}
"{\nglobal:\n${SYMBOLS}\nlocal:\n*;\n};\n")
set(FLAG "-Wl,--version-script,\"${VER_FILENAME}\"")
set_target_properties(${TARGET} PROPERTIES LINK_FLAGS ${FLAG})
endif()
endmacro()

21
cmake_uninstall.cmake.in Normal file
View File

@@ -0,0 +1,21 @@
if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files})
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
exec_program(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
endif(NOT "${rm_retval}" STREQUAL 0)
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
endforeach(file)

View File

@@ -49,10 +49,10 @@ AM_CONDITIONAL([BUILD_CERTHASH], [test "x$ac_cv_func_symlink" = xyes])
AC_CHECK_FUNC([funopen]) AC_CHECK_FUNC([funopen])
CHECK_LIBC_COMPAT CHECK_LIBC_COMPAT
CHECK_LIBC_CRYPTO_COMPAT CHECK_SYSCALL_COMPAT
CHECK_CRYPTO_COMPAT
CHECK_VA_COPY CHECK_VA_COPY
CHECK_B64_NTOP
AC_CHECK_HEADERS([err.h])
AC_ARG_WITH([openssldir], AC_ARG_WITH([openssldir],
AS_HELP_STRING([--with-openssldir], AS_HELP_STRING([--with-openssldir],
@@ -78,15 +78,15 @@ AC_TRY_COMPILE([#include "$srcdir/crypto/modes/modes_lcl.h"],
BSWAP4=no) BSWAP4=no)
CFLAGS="$old_cflags" CFLAGS="$old_cflags"
case $host_cpu in AS_CASE([$host_cpu],
*sparc*) [*sparc*], [CPPFLAGS="$CPPFLAGS -D__STRICT_ALIGNMENT"],
CPPFLAGS="$CPPFLAGS -D__STRICT_ALIGNMENT" [*arm*], AS_IF([test "x$BSWAP4" = "xyes"],,
;; CPPFLAGS="$CPPFLAGS -D__STRICT_ALIGNMENT"),
*arm*) [*amd64*], [host_cpu=x86_64, HOSTARCH=intel],
AS_IF([test "x$BSWAP4" = "xyes"],, [i?86], [HOSTARCH=intel],
CPPFLAGS="$CPPFLAGS -D__STRICT_ALIGNMENT") [x86_64], [HOSTARCH=intel]
;; )
esac AM_CONDITIONAL([HOST_CPU_IS_INTEL], [test "x$HOSTARCH" = "xintel"])
AC_MSG_CHECKING([if .gnu.warning accepts long strings]) AC_MSG_CHECKING([if .gnu.warning accepts long strings])
AC_LINK_IFELSE([AC_LANG_SOURCE([[ AC_LINK_IFELSE([AC_LANG_SOURCE([[
@@ -110,6 +110,9 @@ AM_CONDITIONAL([HOST_ASM_ELF_X86_64],
AM_CONDITIONAL([HOST_ASM_MACOSX_X86_64], AM_CONDITIONAL([HOST_ASM_MACOSX_X86_64],
[test "x$HOST_ABI" = "xmacosx" -a "$host_cpu" = "x86_64" -a "x$enable_asm" != "xno"]) [test "x$HOST_ABI" = "xmacosx" -a "$host_cpu" = "x86_64" -a "x$enable_asm" != "xno"])
# Check if time_t is sized correctly
AC_CHECK_SIZEOF([time_t], [time.h])
AC_CONFIG_FILES([ AC_CONFIG_FILES([
Makefile Makefile
include/Makefile include/Makefile
@@ -119,6 +122,9 @@ AC_CONFIG_FILES([
tls/Makefile tls/Makefile
tests/Makefile tests/Makefile
apps/Makefile apps/Makefile
apps/ocspcheck/Makefile
apps/openssl/Makefile
apps/nc/Makefile
man/Makefile man/Makefile
libcrypto.pc libcrypto.pc
libssl.pc libssl.pc
@@ -126,4 +132,19 @@ AC_CONFIG_FILES([
openssl.pc openssl.pc
]) ])
AM_CONDITIONAL([SMALL_TIME_T], [test "$ac_cv_sizeof_time_t" = "4"])
if test "$ac_cv_sizeof_time_t" = "4"; then
AC_DEFINE([SMALL_TIME_T])
echo " ** Warning, this system is unable to represent times past 2038"
echo " ** It will behave incorrectly when handling valid RFC5280 dates"
if test "$host_os" = "mingw32" ; then
echo " **"
echo " ** You can solve this by adjusting the build flags in your"
echo " ** mingw-w64 toolchain. Refer to README.windows for details."
fi
fi
AC_REQUIRE_AUX_FILE([tap-driver.sh])
AC_OUTPUT AC_OUTPUT

View File

@@ -3,14 +3,100 @@ include_directories(
../include ../include
../include/compat ../include/compat
asn1 asn1
bn
dsa dsa
evp evp
modes modes
) )
if(HOST_ASM_ELF_X86_64)
set(
ASM_X86_64_ELF_SRC
aes/aes-elf-x86_64.S
aes/bsaes-elf-x86_64.S
aes/vpaes-elf-x86_64.S
aes/aesni-elf-x86_64.S
aes/aesni-sha1-elf-x86_64.S
bn/modexp512-elf-x86_64.S
bn/mont-elf-x86_64.S
bn/mont5-elf-x86_64.S
bn/gf2m-elf-x86_64.S
camellia/cmll-elf-x86_64.S
md5/md5-elf-x86_64.S
modes/ghash-elf-x86_64.S
rc4/rc4-elf-x86_64.S
rc4/rc4-md5-elf-x86_64.S
sha/sha1-elf-x86_64.S
sha/sha256-elf-x86_64.S
sha/sha512-elf-x86_64.S
whrlpool/wp-elf-x86_64.S
cpuid-elf-x86_64.S
)
add_definitions(-DAES_ASM)
add_definitions(-DBSAES_ASM)
add_definitions(-DVPAES_ASM)
add_definitions(-DOPENSSL_IA32_SSE2)
add_definitions(-DOPENSSL_BN_ASM_MONT)
add_definitions(-DOPENSSL_BN_ASM_MONT5)
add_definitions(-DOPENSSL_BN_ASM_GF2m)
add_definitions(-DMD5_ASM)
add_definitions(-DGHASH_ASM)
add_definitions(-DRSA_ASM)
add_definitions(-DSHA1_ASM)
add_definitions(-DSHA256_ASM)
add_definitions(-DSHA512_ASM)
add_definitions(-DWHIRLPOOL_ASM)
add_definitions(-DOPENSSL_CPUID_OBJ)
set(CRYPTO_SRC ${CRYPTO_SRC} ${ASM_X86_64_ELF_SRC})
set_property(SOURCE ${ASM_X86_64_ELF_SRC} PROPERTY LANGUAGE C)
endif()
if(HOST_ASM_MACOSX_X86_64)
set(
ASM_X86_64_MACOSX_SRC
aes/aes-macosx-x86_64.S
aes/bsaes-macosx-x86_64.S
aes/vpaes-macosx-x86_64.S
aes/aesni-macosx-x86_64.S
aes/aesni-sha1-macosx-x86_64.S
bn/modexp512-macosx-x86_64.S
bn/mont-macosx-x86_64.S
bn/mont5-macosx-x86_64.S
bn/gf2m-macosx-x86_64.S
camellia/cmll-macosx-x86_64.S
md5/md5-macosx-x86_64.S
modes/ghash-macosx-x86_64.S
rc4/rc4-macosx-x86_64.S
rc4/rc4-md5-macosx-x86_64.S
sha/sha1-macosx-x86_64.S
sha/sha256-macosx-x86_64.S
sha/sha512-macosx-x86_64.S
whrlpool/wp-macosx-x86_64.S
cpuid-macosx-x86_64.S
)
add_definitions(-DAES_ASM)
add_definitions(-DBSAES_ASM)
add_definitions(-DVPAES_ASM)
add_definitions(-DOPENSSL_IA32_SSE2)
add_definitions(-DOPENSSL_BN_ASM_MONT)
add_definitions(-DOPENSSL_BN_ASM_MONT5)
add_definitions(-DOPENSSL_BN_ASM_GF2m)
add_definitions(-DMD5_ASM)
add_definitions(-DGHASH_ASM)
add_definitions(-DRSA_ASM)
add_definitions(-DSHA1_ASM)
add_definitions(-DSHA256_ASM)
add_definitions(-DSHA512_ASM)
add_definitions(-DWHIRLPOOL_ASM)
add_definitions(-DOPENSSL_CPUID_OBJ)
set(CRYPTO_SRC ${CRYPTO_SRC} ${ASM_X86_64_MACOSX_SRC})
set_property(SOURCE ${ASM_X86_64_MACOSX_SRC} PROPERTY LANGUAGE C)
endif()
if((NOT HOST_ASM_ELF_X86_64) AND (NOT HOST_ASM_MACOSX_X86_64))
set( set(
CRYPTO_SRC CRYPTO_SRC
${CRYPTO_SRC}
aes/aes_cbc.c aes/aes_cbc.c
aes/aes_core.c aes/aes_core.c
camellia/camellia.c camellia/camellia.c
@@ -18,6 +104,12 @@ set(
rc4/rc4_enc.c rc4/rc4_enc.c
rc4/rc4_skey.c rc4/rc4_skey.c
whrlpool/wp_block.c whrlpool/wp_block.c
)
endif()
set(
CRYPTO_SRC
${CRYPTO_SRC}
cpt_err.c cpt_err.c
cryptlib.c cryptlib.c
cversion.c cversion.c
@@ -42,7 +134,6 @@ set(
asn1/a_digest.c asn1/a_digest.c
asn1/a_dup.c asn1/a_dup.c
asn1/a_enum.c asn1/a_enum.c
asn1/a_gentm.c
asn1/a_i2d_fp.c asn1/a_i2d_fp.c
asn1/a_int.c asn1/a_int.c
asn1/a_mbstr.c asn1/a_mbstr.c
@@ -54,8 +145,8 @@ set(
asn1/a_strex.c asn1/a_strex.c
asn1/a_strnid.c asn1/a_strnid.c
asn1/a_time.c asn1/a_time.c
asn1/a_time_tm.c
asn1/a_type.c asn1/a_type.c
asn1/a_utctm.c
asn1/a_utf8.c asn1/a_utf8.c
asn1/a_verify.c asn1/a_verify.c
asn1/ameth_lib.c asn1/ameth_lib.c
@@ -191,6 +282,8 @@ set(
conf/conf_mall.c conf/conf_mall.c
conf/conf_mod.c conf/conf_mod.c
conf/conf_sap.c conf/conf_sap.c
curve25519/curve25519-generic.c
curve25519/curve25519.c
des/cbc_cksm.c des/cbc_cksm.c
des/cbc_enc.c des/cbc_enc.c
des/cfb64ede.c des/cfb64ede.c
@@ -263,7 +356,6 @@ set(
ecdh/ech_err.c ecdh/ech_err.c
ecdh/ech_key.c ecdh/ech_key.c
ecdh/ech_lib.c ecdh/ech_lib.c
ecdh/ech_ossl.c
ecdsa/ecs_asn1.c ecdsa/ecs_asn1.c
ecdsa/ecs_err.c ecdsa/ecs_err.c
ecdsa/ecs_lib.c ecdsa/ecs_lib.c
@@ -333,9 +425,9 @@ set(
evp/m_gostr341194.c evp/m_gostr341194.c
evp/m_md4.c evp/m_md4.c
evp/m_md5.c evp/m_md5.c
evp/m_md5_sha1.c
evp/m_null.c evp/m_null.c
evp/m_ripemd.c evp/m_ripemd.c
evp/m_sha.c
evp/m_sha1.c evp/m_sha1.c
evp/m_sigver.c evp/m_sigver.c
evp/m_streebog.c evp/m_streebog.c
@@ -367,6 +459,7 @@ set(
gost/gostr341001_pmeth.c gost/gostr341001_pmeth.c
gost/gostr341194.c gost/gostr341194.c
gost/streebog.c gost/streebog.c
hkdf/hkdf.c
hmac/hm_ameth.c hmac/hm_ameth.c
hmac/hm_pmeth.c hmac/hm_pmeth.c
hmac/hmac.c hmac/hmac.c
@@ -375,7 +468,6 @@ set(
idea/i_ecb.c idea/i_ecb.c
idea/i_ofb64.c idea/i_ofb64.c
idea/i_skey.c idea/i_skey.c
krb5/krb5_asn.c
lhash/lh_stats.c lhash/lh_stats.c
lhash/lhash.c lhash/lhash.c
md4/md4_dgst.c md4/md4_dgst.c
@@ -467,14 +559,11 @@ set(
rsa/rsa_pss.c rsa/rsa_pss.c
rsa/rsa_saos.c rsa/rsa_saos.c
rsa/rsa_sign.c rsa/rsa_sign.c
rsa/rsa_ssl.c
rsa/rsa_x931.c rsa/rsa_x931.c
sha/sha1_one.c sha/sha1_one.c
sha/sha1dgst.c sha/sha1dgst.c
sha/sha256.c sha/sha256.c
sha/sha512.c sha/sha512.c
sha/sha_dgst.c
sha/sha_one.c
stack/stack.c stack/stack.c
ts/ts_asn1.c ts/ts_asn1.c
ts/ts_conf.c ts/ts_conf.c
@@ -561,44 +650,91 @@ endif()
if(CMAKE_HOST_WIN32) if(CMAKE_HOST_WIN32)
set(CRYPTO_SRC ${CRYPTO_SRC} bio/b_win.c) set(CRYPTO_SRC ${CRYPTO_SRC} bio/b_win.c)
set(CRYPTO_UNEXPORT ${CRYPTO_UNEXPORT} BIO_s_log)
set(CRYPTO_SRC ${CRYPTO_SRC} ui/ui_openssl_win.c) set(CRYPTO_SRC ${CRYPTO_SRC} ui/ui_openssl_win.c)
endif() endif()
if(CMAKE_HOST_WIN32) if(CMAKE_HOST_WIN32)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/posix_win.c) set(CRYPTO_SRC ${CRYPTO_SRC} compat/posix_win.c)
set(EXTRA_EXPORT ${EXTRA_EXPORT} gettimeofday)
set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_perror)
set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_fopen)
set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_fgets)
set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_open)
set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_rename)
set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_connect)
set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_close)
set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_read)
set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_write)
set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_getsockopt)
set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_setsockopt)
set(EXTRA_EXPORT ${EXTRA_EXPORT} sleep)
endif() endif()
if(NOT HAVE_ASPRINTF) if(NOT HAVE_ASPRINTF)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/bsd-asprintf.c) set(CRYPTO_SRC ${CRYPTO_SRC} compat/bsd-asprintf.c)
set(EXTRA_EXPORT ${EXTRA_EXPORT} asprintf)
set(EXTRA_EXPORT ${EXTRA_EXPORT} vasprintf)
endif()
if(NOT HAVE_FREEZERO)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/freezero.c)
set(EXTRA_EXPORT ${EXTRA_EXPORT} freezero)
endif()
if(NOT HAVE_GETPAGESIZE)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/getpagesize.c)
endif() endif()
if(NOT HAVE_INET_PTON) if(NOT HAVE_INET_PTON)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/inet_pton.c) set(CRYPTO_SRC ${CRYPTO_SRC} compat/inet_pton.c)
set(EXTRA_EXPORT ${EXTRA_EXPORT} inet_pton)
endif() endif()
if(NOT HAVE_REALLOCARRAY) if(NOT HAVE_REALLOCARRAY)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/reallocarray.c) set(CRYPTO_SRC ${CRYPTO_SRC} compat/reallocarray.c)
set(EXTRA_EXPORT ${EXTRA_EXPORT} reallocarray)
endif()
if(NOT HAVE_RECALLOCARRAY)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/recallocarray.c)
set(EXTRA_EXPORT ${EXTRA_EXPORT} recallocarray)
endif() endif()
if(NOT HAVE_STRCASECMP) if(NOT HAVE_STRCASECMP)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/strcasecmp.c) set(CRYPTO_SRC ${CRYPTO_SRC} compat/strcasecmp.c)
set(EXTRA_EXPORT ${EXTRA_EXPORT} strcasecmp)
endif() endif()
if(NOT HAVE_STRLCAT) if(NOT HAVE_STRLCAT)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/strlcat.c) set(CRYPTO_SRC ${CRYPTO_SRC} compat/strlcat.c)
set(EXTRA_EXPORT ${EXTRA_EXPORT} strlcat)
endif() endif()
if(NOT HAVE_STRLCPY) if(NOT HAVE_STRLCPY)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/strlcpy.c) set(CRYPTO_SRC ${CRYPTO_SRC} compat/strlcpy.c)
set(EXTRA_EXPORT ${EXTRA_EXPORT} strlcpy)
endif() endif()
if(NOT HAVE_STRNDUP) if(NOT HAVE_STRNDUP)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/strndup.c) set(CRYPTO_SRC ${CRYPTO_SRC} compat/strndup.c)
set(EXTRA_EXPORT ${EXTRA_EXPORT} strndup)
if(NOT HAVE_STRNLEN) if(NOT HAVE_STRNLEN)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/strnlen.c) set(CRYPTO_SRC ${CRYPTO_SRC} compat/strnlen.c)
set(EXTRA_EXPORT ${EXTRA_EXPORT} strnlen)
endif() endif()
endif() endif()
if(NOT HAVE_STRSEP)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/strsep.c)
set(EXTRA_EXPORT ${EXTRA_EXPORT} strsep)
endif()
if(NOT HAVE_TIMEGM)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/timegm.c)
set(EXTRA_EXPORT ${EXTRA_EXPORT} timegm)
endif()
if(NOT HAVE_EXPLICIT_BZERO) if(NOT HAVE_EXPLICIT_BZERO)
if(CMAKE_HOST_WIN32) if(CMAKE_HOST_WIN32)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/explicit_bzero_win.c) set(CRYPTO_SRC ${CRYPTO_SRC} compat/explicit_bzero_win.c)
@@ -606,10 +742,15 @@ if(NOT HAVE_EXPLICIT_BZERO)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/explicit_bzero.c) set(CRYPTO_SRC ${CRYPTO_SRC} compat/explicit_bzero.c)
set_source_files_properties(compat/explicit_bzero.c PROPERTIES COMPILE_FLAGS -O0) set_source_files_properties(compat/explicit_bzero.c PROPERTIES COMPILE_FLAGS -O0)
endif() endif()
set(EXTRA_EXPORT ${EXTRA_EXPORT} explicit_bzero)
endif() endif()
if(NOT HAVE_ARC4RANDOM_BUF) if(NOT HAVE_ARC4RANDOM_BUF)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/arc4random.c) set(CRYPTO_SRC ${CRYPTO_SRC} compat/arc4random.c)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/arc4random_uniform.c)
set(EXTRA_EXPORT ${EXTRA_EXPORT} arc4random)
set(EXTRA_EXPORT ${EXTRA_EXPORT} arc4random_buf)
set(EXTRA_EXPORT ${EXTRA_EXPORT} arc4random_uniform)
if(NOT HAVE_GETENTROPY) if(NOT HAVE_GETENTROPY)
if(CMAKE_HOST_WIN32) if(CMAKE_HOST_WIN32)
@@ -618,24 +759,78 @@ if(NOT HAVE_ARC4RANDOM_BUF)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_aix.c) set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_aix.c)
elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_freebsd.c) set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_freebsd.c)
elseif(CMAKE_SYSTEM_NAME MATCHES "HP-UX")
set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_hpux.c)
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux") elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_linux.c) set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_linux.c)
elseif(CMAKE_SYSTEM_NAME MATCHES "NetBSD") elseif(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_netbsd.c) set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_netbsd.c)
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin") elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_darwin.c) set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_osx.c)
elseif(CMAKE_SYSTEM_NAME MATCHES "SunOS") elseif(CMAKE_SYSTEM_NAME MATCHES "SunOS")
set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_solaris.c) set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_solaris.c)
endif() endif()
set(EXTRA_EXPORT ${EXTRA_EXPORT} getentropy)
endif() endif()
endif() endif()
if(NOT HAVE_TIMINGSAFE_BCMP) if(NOT HAVE_TIMINGSAFE_BCMP)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/timingsafe_bcmp.c) set(CRYPTO_SRC ${CRYPTO_SRC} compat/timingsafe_bcmp.c)
set(EXTRA_EXPORT ${EXTRA_EXPORT} timingsafe_bcmp)
endif() endif()
if(NOT HAVE_TIMINGSAFE_MEMCMP) if(NOT HAVE_TIMINGSAFE_MEMCMP)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/timingsafe_memcmp.c) set(CRYPTO_SRC ${CRYPTO_SRC} compat/timingsafe_memcmp.c)
set(EXTRA_EXPORT ${EXTRA_EXPORT} timingsafe_memcmp)
endif()
if(NOT ENABLE_ASM)
add_definitions(-DOPENSSL_NO_ASM)
else()
if(CMAKE_HOST_WIN32)
add_definitions(-DOPENSSL_NO_ASM)
endif()
endif()
if(NOT "${OPENSSLDIR}" STREQUAL "")
add_definitions(-DOPENSSLDIR=\"${OPENSSLDIR}\")
else()
add_definitions(-DOPENSSLDIR=\"${CMAKE_INSTALL_PREFIX}/etc/ssl\")
endif()
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/crypto.sym SYMS)
foreach(SYM IN LISTS CRYPTO_UNEXPORT)
string(REPLACE "${SYM}\n" "" SYMS ${SYMS})
endforeach()
file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/crypto_p.sym ${SYMS})
if(EXTRA_EXPORT)
list(SORT EXTRA_EXPORT)
foreach(SYM IN LISTS EXTRA_EXPORT)
file(APPEND ${CMAKE_CURRENT_SOURCE_DIR}/crypto_p.sym "${SYM}\n")
endforeach()
endif()
add_library(crypto-objects OBJECT ${CRYPTO_SRC})
if (BUILD_SHARED)
add_library(crypto STATIC $<TARGET_OBJECTS:crypto-objects>)
add_library(crypto-shared SHARED $<TARGET_OBJECTS:crypto-objects>)
export_symbol(crypto-shared ${CMAKE_CURRENT_SOURCE_DIR}/crypto_p.sym)
if (WIN32)
target_link_libraries(crypto-shared Ws2_32.lib)
set(CRYPTO_POSTFIX -${CRYPTO_MAJOR_VERSION})
endif()
set_target_properties(crypto-shared PROPERTIES
OUTPUT_NAME crypto${CRYPTO_POSTFIX}
ARCHIVE_OUTPUT_NAME crypto${CRYPTO_POSTFIX})
set_target_properties(crypto-shared PROPERTIES VERSION
${CRYPTO_VERSION} SOVERSION ${CRYPTO_MAJOR_VERSION})
if(ENABLE_LIBRESSL_INSTALL)
install(TARGETS crypto crypto-shared DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(ENABLE_LIBRESSL_INSTALL)
else()
add_library(crypto STATIC ${CRYPTO_SRC})
if(ENABLE_LIBRESSL_INSTALL)
install(TARGETS crypto DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(ENABLE_LIBRESSL_INSTALL)
endif() endif()
add_library(crypto ${CRYPTO_SRC})

View File

@@ -1,17 +1,104 @@
include $(top_srcdir)/Makefile.am.common include $(top_srcdir)/Makefile.am.common
AM_CFLAGS += -I$(top_srcdir)/crypto/asn1 AM_CPPFLAGS += -I$(top_srcdir)/crypto/asn1
AM_CFLAGS += -I$(top_srcdir)/crypto/evp AM_CPPFLAGS += -I$(top_srcdir)/crypto/bn
AM_CFLAGS += -I$(top_srcdir)/crypto/modes AM_CPPFLAGS += -I$(top_srcdir)/crypto/evp
AM_CPPFLAGS += -I$(top_srcdir)/crypto/modes
AM_CPPFLAGS += -I$(top_srcdir)/crypto
lib_LTLIBRARIES = libcrypto.la lib_LTLIBRARIES = libcrypto.la
EXTRA_DIST = VERSION EXTRA_DIST = VERSION
EXTRA_DIST += CMakeLists.txt EXTRA_DIST += CMakeLists.txt
EXTRA_DIST += crypto.sym
libcrypto_la_LDFLAGS = -version-info @LIBCRYPTO_VERSION@ -no-undefined # needed for a CMake target
libcrypto_la_LIBADD = libcompat.la libcompatnoopt.la EXTRA_DIST += compat/strcasecmp.c
libcrypto_la_CPPFLAGS = -DLIBRESSL_INTERNAL
BUILT_SOURCES = crypto_portable.sym
CLEANFILES = crypto_portable.sym
crypto_portable.sym:
-echo "generating crypto_portable.sym ..."
-cp $(top_srcdir)/crypto/crypto.sym crypto_portable.sym
-chmod u+w crypto_portable.sym
if !HAVE_ARC4RANDOM_BUF
-echo arc4random >> crypto_portable.sym
-echo arc4random_buf >> crypto_portable.sym
-echo arc4random_uniform >> crypto_portable.sym
if !HAVE_GETENTROPY
-echo getentropy >> crypto_portable.sym
endif
endif
if !HAVE_ASPRINTF
-echo asprintf >> crypto_portable.sym
-echo vasprintf >> crypto_portable.sym
endif
if !HAVE_EXPLICIT_BZERO
-echo explicit_bzero >> crypto_portable.sym
endif
if !HAVE_FREEZERO
-echo freezero >> crypto_portable.sym
endif
if !HAVE_INET_PTON
-echo inet_pton >> crypto_portable.sym
endif
if !HAVE_REALLOCARRAY
-echo reallocarray >> crypto_portable.sym
endif
if !HAVE_RECALLOCARRAY
-echo recallocarray >> crypto_portable.sym
endif
if !HAVE_STRLCAT
-echo strlcat >> crypto_portable.sym
endif
if !HAVE_STRLCPY
-echo strlcpy >> crypto_portable.sym
endif
if !HAVE_STRNDUP
-echo strndup >> crypto_portable.sym
endif
if !HAVE_STRNLEN
-echo strnlen >> crypto_portable.sym
endif
if !HAVE_STRSEP
-echo strsep >> crypto_portable.sym
endif
if !HAVE_TIMEGM
-echo timegm >> crypto_portable.sym
endif
if !HAVE_TIMINGSAFE_BCMP
-echo timingsafe_bcmp >> crypto_portable.sym
endif
if !HAVE_TIMINGSAFE_MEMCMP
-echo timingsafe_memcmp >> crypto_portable.sym
endif
if HOST_CPU_IS_INTEL
-echo OPENSSL_ia32cap_P >> crypto_portable.sym
endif
if HOST_WIN
-echo posix_perror >> crypto_portable.sym
-echo posix_fopen >> crypto_portable.sym
-echo posix_fgets >> crypto_portable.sym
-echo posix_open >> crypto_portable.sym
-echo posix_rename >> crypto_portable.sym
-echo posix_connect >> crypto_portable.sym
-echo posix_close >> crypto_portable.sym
-echo posix_read >> crypto_portable.sym
-echo posix_write >> crypto_portable.sym
-echo posix_getsockopt >> crypto_portable.sym
-echo posix_setsockopt >> crypto_portable.sym
-grep -v BIO_s_log crypto_portable.sym > crypto_portable.sym.tmp
-mv crypto_portable.sym.tmp crypto_portable.sym
endif
libcrypto_la_LDFLAGS = -version-info @LIBCRYPTO_VERSION@ -no-undefined -export-symbols crypto_portable.sym
libcrypto_la_LIBADD = libcompat.la
if !HAVE_EXPLICIT_BZERO
libcrypto_la_LIBADD += libcompatnoopt.la
endif
libcrypto_la_CPPFLAGS = $(AM_CPPFLAGS)
libcrypto_la_CPPFLAGS += -DLIBRESSL_INTERNAL
libcrypto_la_CPPFLAGS += -DOPENSSL_NO_HW_PADLOCK libcrypto_la_CPPFLAGS += -DOPENSSL_NO_HW_PADLOCK
if OPENSSL_NO_ASM if OPENSSL_NO_ASM
libcrypto_la_CPPFLAGS += -DOPENSSL_NO_ASM libcrypto_la_CPPFLAGS += -DOPENSSL_NO_ASM
@@ -27,13 +114,15 @@ else
libcrypto_la_CPPFLAGS += -DOPENSSLDIR=\"$(sysconfdir)/ssl\" libcrypto_la_CPPFLAGS += -DOPENSSLDIR=\"$(sysconfdir)/ssl\"
endif endif
noinst_LTLIBRARIES = libcompat.la libcompatnoopt.la noinst_LTLIBRARIES = libcompat.la
# compatibility functions that need to be built without optimizations # compatibility functions that need to be built without optimizations
if !HAVE_EXPLICIT_BZERO
noinst_LTLIBRARIES += libcompatnoopt.la
libcompatnoopt_la_CFLAGS = -O0 libcompatnoopt_la_CFLAGS = -O0
libcompatnoopt_la_SOURCES = libcompatnoopt_la_SOURCES =
if !HAVE_EXPLICIT_BZERO
if HOST_WIN if HOST_WIN
libcompatnoopt_la_SOURCES += compat/explicit_bzero_win.c libcompatnoopt_la_SOURCES += compat/explicit_bzero_win.c
else else
@@ -61,18 +150,38 @@ libcompat_la_SOURCES += compat/strnlen.c
endif endif
endif endif
if !HAVE_STRSEP
libcompat_la_SOURCES += compat/strsep.c
endif
if !HAVE_ASPRINTF if !HAVE_ASPRINTF
libcompat_la_SOURCES += compat/bsd-asprintf.c libcompat_la_SOURCES += compat/bsd-asprintf.c
endif endif
if !HAVE_FREEZERO
libcompat_la_SOURCES += compat/freezero.c
endif
if !HAVE_GETPAGESIZE
libcompat_la_SOURCES += compat/getpagesize.c
endif
if !HAVE_INET_PTON if !HAVE_INET_PTON
libcompat_la_SOURCES += compat/inet_pton.c libcompat_la_SOURCES += compat/inet_pton.c
endif endif
if !HAVE_TIMEGM
libcompat_la_SOURCES += compat/timegm.c
endif
if !HAVE_REALLOCARRAY if !HAVE_REALLOCARRAY
libcompat_la_SOURCES += compat/reallocarray.c libcompat_la_SOURCES += compat/reallocarray.c
endif endif
if !HAVE_RECALLOCARRAY
libcompat_la_SOURCES += compat/recallocarray.c
endif
if !HAVE_TIMINGSAFE_MEMCMP if !HAVE_TIMINGSAFE_MEMCMP
libcompat_la_SOURCES += compat/timingsafe_memcmp.c libcompat_la_SOURCES += compat/timingsafe_memcmp.c
endif endif
@@ -115,9 +224,11 @@ libcrypto_la_SOURCES += mem_dbg.c
libcrypto_la_SOURCES += o_init.c libcrypto_la_SOURCES += o_init.c
libcrypto_la_SOURCES += o_str.c libcrypto_la_SOURCES += o_str.c
libcrypto_la_SOURCES += o_time.c libcrypto_la_SOURCES += o_time.c
noinst_HEADERS += constant_time_locl.h
noinst_HEADERS += cryptlib.h noinst_HEADERS += cryptlib.h
noinst_HEADERS += md32_common.h noinst_HEADERS += md32_common.h
noinst_HEADERS += o_time.h noinst_HEADERS += o_time.h
noinst_HEADERS += x86_arch.h
# aes # aes
libcrypto_la_SOURCES += aes/aes_cfb.c libcrypto_la_SOURCES += aes/aes_cfb.c
@@ -137,7 +248,6 @@ libcrypto_la_SOURCES += asn1/a_d2i_fp.c
libcrypto_la_SOURCES += asn1/a_digest.c libcrypto_la_SOURCES += asn1/a_digest.c
libcrypto_la_SOURCES += asn1/a_dup.c libcrypto_la_SOURCES += asn1/a_dup.c
libcrypto_la_SOURCES += asn1/a_enum.c libcrypto_la_SOURCES += asn1/a_enum.c
libcrypto_la_SOURCES += asn1/a_gentm.c
libcrypto_la_SOURCES += asn1/a_i2d_fp.c libcrypto_la_SOURCES += asn1/a_i2d_fp.c
libcrypto_la_SOURCES += asn1/a_int.c libcrypto_la_SOURCES += asn1/a_int.c
libcrypto_la_SOURCES += asn1/a_mbstr.c libcrypto_la_SOURCES += asn1/a_mbstr.c
@@ -149,8 +259,8 @@ libcrypto_la_SOURCES += asn1/a_sign.c
libcrypto_la_SOURCES += asn1/a_strex.c libcrypto_la_SOURCES += asn1/a_strex.c
libcrypto_la_SOURCES += asn1/a_strnid.c libcrypto_la_SOURCES += asn1/a_strnid.c
libcrypto_la_SOURCES += asn1/a_time.c libcrypto_la_SOURCES += asn1/a_time.c
libcrypto_la_SOURCES += asn1/a_time_tm.c
libcrypto_la_SOURCES += asn1/a_type.c libcrypto_la_SOURCES += asn1/a_type.c
libcrypto_la_SOURCES += asn1/a_utctm.c
libcrypto_la_SOURCES += asn1/a_utf8.c libcrypto_la_SOURCES += asn1/a_utf8.c
libcrypto_la_SOURCES += asn1/a_verify.c libcrypto_la_SOURCES += asn1/a_verify.c
libcrypto_la_SOURCES += asn1/ameth_lib.c libcrypto_la_SOURCES += asn1/ameth_lib.c
@@ -328,6 +438,12 @@ libcrypto_la_SOURCES += conf/conf_mod.c
libcrypto_la_SOURCES += conf/conf_sap.c libcrypto_la_SOURCES += conf/conf_sap.c
noinst_HEADERS += conf/conf_def.h noinst_HEADERS += conf/conf_def.h
# curve25519
libcrypto_la_SOURCES += curve25519/curve25519-generic.c
libcrypto_la_SOURCES += curve25519/curve25519.c
noinst_HEADERS += curve25519/curve25519_internal.h
# des # des
libcrypto_la_SOURCES += des/cbc_cksm.c libcrypto_la_SOURCES += des/cbc_cksm.c
libcrypto_la_SOURCES += des/cbc_enc.c libcrypto_la_SOURCES += des/cbc_enc.c
@@ -416,7 +532,6 @@ noinst_HEADERS += ec/ec_lcl.h
libcrypto_la_SOURCES += ecdh/ech_err.c libcrypto_la_SOURCES += ecdh/ech_err.c
libcrypto_la_SOURCES += ecdh/ech_key.c libcrypto_la_SOURCES += ecdh/ech_key.c
libcrypto_la_SOURCES += ecdh/ech_lib.c libcrypto_la_SOURCES += ecdh/ech_lib.c
libcrypto_la_SOURCES += ecdh/ech_ossl.c
noinst_HEADERS += ecdh/ech_locl.h noinst_HEADERS += ecdh/ech_locl.h
# ecdsa # ecdsa
@@ -497,9 +612,9 @@ libcrypto_la_SOURCES += evp/m_gost2814789.c
libcrypto_la_SOURCES += evp/m_gostr341194.c libcrypto_la_SOURCES += evp/m_gostr341194.c
libcrypto_la_SOURCES += evp/m_md4.c libcrypto_la_SOURCES += evp/m_md4.c
libcrypto_la_SOURCES += evp/m_md5.c libcrypto_la_SOURCES += evp/m_md5.c
libcrypto_la_SOURCES += evp/m_md5_sha1.c
libcrypto_la_SOURCES += evp/m_null.c libcrypto_la_SOURCES += evp/m_null.c
libcrypto_la_SOURCES += evp/m_ripemd.c libcrypto_la_SOURCES += evp/m_ripemd.c
libcrypto_la_SOURCES += evp/m_sha.c
libcrypto_la_SOURCES += evp/m_sha1.c libcrypto_la_SOURCES += evp/m_sha1.c
libcrypto_la_SOURCES += evp/m_sigver.c libcrypto_la_SOURCES += evp/m_sigver.c
libcrypto_la_SOURCES += evp/m_streebog.c libcrypto_la_SOURCES += evp/m_streebog.c
@@ -538,6 +653,9 @@ noinst_HEADERS += gost/gost.h
noinst_HEADERS += gost/gost_asn1.h noinst_HEADERS += gost/gost_asn1.h
noinst_HEADERS += gost/gost_locl.h noinst_HEADERS += gost/gost_locl.h
# hkdf
libcrypto_la_SOURCES += hkdf/hkdf.c
# hmac # hmac
libcrypto_la_SOURCES += hmac/hm_ameth.c libcrypto_la_SOURCES += hmac/hm_ameth.c
libcrypto_la_SOURCES += hmac/hm_pmeth.c libcrypto_la_SOURCES += hmac/hm_pmeth.c
@@ -551,9 +669,6 @@ libcrypto_la_SOURCES += idea/i_ofb64.c
libcrypto_la_SOURCES += idea/i_skey.c libcrypto_la_SOURCES += idea/i_skey.c
noinst_HEADERS += idea/idea_lcl.h noinst_HEADERS += idea/idea_lcl.h
# krb5
libcrypto_la_SOURCES += krb5/krb5_asn.c
# lhash # lhash
libcrypto_la_SOURCES += lhash/lh_stats.c libcrypto_la_SOURCES += lhash/lh_stats.c
libcrypto_la_SOURCES += lhash/lhash.c libcrypto_la_SOURCES += lhash/lhash.c
@@ -684,7 +799,6 @@ libcrypto_la_SOURCES += rsa/rsa_prn.c
libcrypto_la_SOURCES += rsa/rsa_pss.c libcrypto_la_SOURCES += rsa/rsa_pss.c
libcrypto_la_SOURCES += rsa/rsa_saos.c libcrypto_la_SOURCES += rsa/rsa_saos.c
libcrypto_la_SOURCES += rsa/rsa_sign.c libcrypto_la_SOURCES += rsa/rsa_sign.c
libcrypto_la_SOURCES += rsa/rsa_ssl.c
libcrypto_la_SOURCES += rsa/rsa_x931.c libcrypto_la_SOURCES += rsa/rsa_x931.c
noinst_HEADERS += rsa/rsa_locl.h noinst_HEADERS += rsa/rsa_locl.h
@@ -693,8 +807,6 @@ libcrypto_la_SOURCES += sha/sha1_one.c
libcrypto_la_SOURCES += sha/sha1dgst.c libcrypto_la_SOURCES += sha/sha1dgst.c
libcrypto_la_SOURCES += sha/sha256.c libcrypto_la_SOURCES += sha/sha256.c
libcrypto_la_SOURCES += sha/sha512.c libcrypto_la_SOURCES += sha/sha512.c
libcrypto_la_SOURCES += sha/sha_dgst.c
libcrypto_la_SOURCES += sha/sha_one.c
noinst_HEADERS += sha/sha_locl.h noinst_HEADERS += sha/sha_locl.h
# stack # stack
@@ -759,6 +871,7 @@ libcrypto_la_SOURCES += x509/x509spki.c
libcrypto_la_SOURCES += x509/x509type.c libcrypto_la_SOURCES += x509/x509type.c
libcrypto_la_SOURCES += x509/x_all.c libcrypto_la_SOURCES += x509/x_all.c
noinst_HEADERS += x509/x509_lcl.h noinst_HEADERS += x509/x509_lcl.h
noinst_HEADERS += x509/vpm_int.h
# x509v3 # x509v3
libcrypto_la_SOURCES += x509v3/pcy_cache.c libcrypto_la_SOURCES += x509v3/pcy_cache.c

View File

@@ -1,5 +1,6 @@
if !HAVE_ARC4RANDOM_BUF if !HAVE_ARC4RANDOM_BUF
libcompat_la_SOURCES += compat/arc4random.c libcompat_la_SOURCES += compat/arc4random.c
libcompat_la_SOURCES += compat/arc4random_uniform.c
if !HAVE_GETENTROPY if !HAVE_GETENTROPY
if HOST_AIX if HOST_AIX

View File

@@ -1,22 +1,22 @@
ASM_X86_64_ELF = aes/aes-elf-x86_64.s ASM_X86_64_ELF = aes/aes-elf-x86_64.S
ASM_X86_64_ELF += aes/bsaes-elf-x86_64.s ASM_X86_64_ELF += aes/bsaes-elf-x86_64.S
ASM_X86_64_ELF += aes/vpaes-elf-x86_64.s ASM_X86_64_ELF += aes/vpaes-elf-x86_64.S
ASM_X86_64_ELF += aes/aesni-elf-x86_64.s ASM_X86_64_ELF += aes/aesni-elf-x86_64.S
ASM_X86_64_ELF += aes/aesni-sha1-elf-x86_64.s ASM_X86_64_ELF += aes/aesni-sha1-elf-x86_64.S
ASM_X86_64_ELF += bn/modexp512-elf-x86_64.s ASM_X86_64_ELF += bn/modexp512-elf-x86_64.S
ASM_X86_64_ELF += bn/mont-elf-x86_64.s ASM_X86_64_ELF += bn/mont-elf-x86_64.S
ASM_X86_64_ELF += bn/mont5-elf-x86_64.s ASM_X86_64_ELF += bn/mont5-elf-x86_64.S
ASM_X86_64_ELF += bn/gf2m-elf-x86_64.s ASM_X86_64_ELF += bn/gf2m-elf-x86_64.S
ASM_X86_64_ELF += camellia/cmll-elf-x86_64.s ASM_X86_64_ELF += camellia/cmll-elf-x86_64.S
ASM_X86_64_ELF += md5/md5-elf-x86_64.s ASM_X86_64_ELF += md5/md5-elf-x86_64.S
ASM_X86_64_ELF += modes/ghash-elf-x86_64.s ASM_X86_64_ELF += modes/ghash-elf-x86_64.S
ASM_X86_64_ELF += rc4/rc4-elf-x86_64.s ASM_X86_64_ELF += rc4/rc4-elf-x86_64.S
ASM_X86_64_ELF += rc4/rc4-md5-elf-x86_64.s ASM_X86_64_ELF += rc4/rc4-md5-elf-x86_64.S
ASM_X86_64_ELF += sha/sha1-elf-x86_64.s ASM_X86_64_ELF += sha/sha1-elf-x86_64.S
ASM_X86_64_ELF += sha/sha256-elf-x86_64.S ASM_X86_64_ELF += sha/sha256-elf-x86_64.S
ASM_X86_64_ELF += sha/sha512-elf-x86_64.S ASM_X86_64_ELF += sha/sha512-elf-x86_64.S
ASM_X86_64_ELF += whrlpool/wp-elf-x86_64.s ASM_X86_64_ELF += whrlpool/wp-elf-x86_64.S
ASM_X86_64_ELF += cpuid-elf-x86_64.S ASM_X86_64_ELF += cpuid-elf-x86_64.S
EXTRA_DIST += $(ASM_X86_64_ELF) EXTRA_DIST += $(ASM_X86_64_ELF)

View File

@@ -1,22 +1,22 @@
ASM_X86_64_MACOSX = aes/aes-macosx-x86_64.s ASM_X86_64_MACOSX = aes/aes-macosx-x86_64.S
ASM_X86_64_MACOSX += aes/bsaes-macosx-x86_64.s ASM_X86_64_MACOSX += aes/bsaes-macosx-x86_64.S
ASM_X86_64_MACOSX += aes/vpaes-macosx-x86_64.s ASM_X86_64_MACOSX += aes/vpaes-macosx-x86_64.S
ASM_X86_64_MACOSX += aes/aesni-macosx-x86_64.s ASM_X86_64_MACOSX += aes/aesni-macosx-x86_64.S
ASM_X86_64_MACOSX += aes/aesni-sha1-macosx-x86_64.s ASM_X86_64_MACOSX += aes/aesni-sha1-macosx-x86_64.S
ASM_X86_64_MACOSX += bn/modexp512-macosx-x86_64.s ASM_X86_64_MACOSX += bn/modexp512-macosx-x86_64.S
ASM_X86_64_MACOSX += bn/mont-macosx-x86_64.s ASM_X86_64_MACOSX += bn/mont-macosx-x86_64.S
ASM_X86_64_MACOSX += bn/mont5-macosx-x86_64.s ASM_X86_64_MACOSX += bn/mont5-macosx-x86_64.S
ASM_X86_64_MACOSX += bn/gf2m-macosx-x86_64.s ASM_X86_64_MACOSX += bn/gf2m-macosx-x86_64.S
ASM_X86_64_MACOSX += camellia/cmll-macosx-x86_64.s ASM_X86_64_MACOSX += camellia/cmll-macosx-x86_64.S
ASM_X86_64_MACOSX += md5/md5-macosx-x86_64.s ASM_X86_64_MACOSX += md5/md5-macosx-x86_64.S
ASM_X86_64_MACOSX += modes/ghash-macosx-x86_64.s ASM_X86_64_MACOSX += modes/ghash-macosx-x86_64.S
ASM_X86_64_MACOSX += rc4/rc4-macosx-x86_64.s ASM_X86_64_MACOSX += rc4/rc4-macosx-x86_64.S
ASM_X86_64_MACOSX += rc4/rc4-md5-macosx-x86_64.s ASM_X86_64_MACOSX += rc4/rc4-md5-macosx-x86_64.S
ASM_X86_64_MACOSX += sha/sha1-macosx-x86_64.s ASM_X86_64_MACOSX += sha/sha1-macosx-x86_64.S
ASM_X86_64_MACOSX += sha/sha256-macosx-x86_64.S ASM_X86_64_MACOSX += sha/sha256-macosx-x86_64.S
ASM_X86_64_MACOSX += sha/sha512-macosx-x86_64.S ASM_X86_64_MACOSX += sha/sha512-macosx-x86_64.S
ASM_X86_64_MACOSX += whrlpool/wp-macosx-x86_64.s ASM_X86_64_MACOSX += whrlpool/wp-macosx-x86_64.S
ASM_X86_64_MACOSX += cpuid-macosx-x86_64.S ASM_X86_64_MACOSX += cpuid-macosx-x86_64.S
EXTRA_DIST += $(ASM_X86_64_MACOSX) EXTRA_DIST += $(ASM_X86_64_MACOSX)

View File

@@ -23,8 +23,8 @@ BIO_sock_init(void)
if (!wsa_init_done) { if (!wsa_init_done) {
if (WSAStartup(version_requested, &wsa_state) != 0) { if (WSAStartup(version_requested, &wsa_state) != 0) {
int err = WSAGetLastError(); int err = WSAGetLastError();
SYSerr(SYS_F_WSASTARTUP, err); SYSerror(err);
BIOerr(BIO_F_BIO_SOCK_INIT, BIO_R_WSASTARTUP); BIOerror(BIO_R_WSASTARTUP);
return (-1); return (-1);
} }
wsa_init_done = 1; wsa_init_done = 1;

32
crypto/compat/freezero.c Normal file
View File

@@ -0,0 +1,32 @@
/*
* Copyright (c) 2008, 2010, 2011, 2016 Otto Moerbeek <otto@drijf.net>
* Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org>
* Copyright (c) 2008 Damien Miller <djm@openbsd.org>
* Copyright (c) 2000 Poul-Henning Kamp <phk@FreeBSD.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <string.h>
#include <stdlib.h>
void
freezero(void *ptr, size_t sz)
{
/* This is legal. */
if (ptr == NULL)
return;
explicit_bzero(ptr, sz);
free(ptr);
}

View File

@@ -0,0 +1,18 @@
/* $OpenBSD$ */
#include <unistd.h>
#ifdef _MSC_VER
#include <windows.h>
#endif
int
getpagesize(void) {
#ifdef _MSC_VER
SYSTEM_INFO system_info;
GetSystemInfo(&system_info);
return system_info.dwPageSize;
#else
return sysconf(_SC_PAGESIZE);
#endif
}

View File

@@ -1,212 +0,0 @@
/* $OpenBSD: inet_pton.c,v 1.9 2015/01/16 16:48:51 deraadt Exp $ */
/* Copyright (c) 1996 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>
#include <string.h>
#include <errno.h>
/*
* WARNING: Don't even consider trying to compile this on a system where
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
*/
static int inet_pton4(const char *src, u_char *dst);
static int inet_pton6(const char *src, u_char *dst);
/* int
* inet_pton(af, src, dst)
* convert from presentation format (which usually means ASCII printable)
* to network format (which is usually some kind of binary format).
* return:
* 1 if the address was valid for the specified address family
* 0 if the address wasn't valid (`dst' is untouched in this case)
* -1 if some other error occurred (`dst' is untouched in this case, too)
* author:
* Paul Vixie, 1996.
*/
int
inet_pton(int af, const char *src, void *dst)
{
switch (af) {
case AF_INET:
return (inet_pton4(src, dst));
case AF_INET6:
return (inet_pton6(src, dst));
default:
errno = EAFNOSUPPORT;
return (-1);
}
/* NOTREACHED */
}
/* int
* inet_pton4(src, dst)
* like inet_aton() but without all the hexadecimal and shorthand.
* return:
* 1 if `src' is a valid dotted quad, else 0.
* notice:
* does not touch `dst' unless it's returning 1.
* author:
* Paul Vixie, 1996.
*/
static int
inet_pton4(const char *src, u_char *dst)
{
static const char digits[] = "0123456789";
int saw_digit, octets, ch;
u_char tmp[INADDRSZ], *tp;
saw_digit = 0;
octets = 0;
*(tp = tmp) = 0;
while ((ch = *src++) != '\0') {
const char *pch;
if ((pch = strchr(digits, ch)) != NULL) {
u_int new = *tp * 10 + (pch - digits);
if (new > 255)
return (0);
if (! saw_digit) {
if (++octets > 4)
return (0);
saw_digit = 1;
}
*tp = new;
} else if (ch == '.' && saw_digit) {
if (octets == 4)
return (0);
*++tp = 0;
saw_digit = 0;
} else
return (0);
}
if (octets < 4)
return (0);
memcpy(dst, tmp, INADDRSZ);
return (1);
}
/* int
* inet_pton6(src, dst)
* convert presentation level address to network order binary form.
* return:
* 1 if `src' is a valid [RFC1884 2.2] address, else 0.
* notice:
* does not touch `dst' unless it's returning 1.
* credit:
* inspired by Mark Andrews.
* author:
* Paul Vixie, 1996.
*/
static int
inet_pton6(const char *src, u_char *dst)
{
static const char xdigits_l[] = "0123456789abcdef",
xdigits_u[] = "0123456789ABCDEF";
u_char tmp[IN6ADDRSZ], *tp, *endp, *colonp;
const char *xdigits, *curtok;
int ch, saw_xdigit, count_xdigit;
u_int val;
memset((tp = tmp), '\0', IN6ADDRSZ);
endp = tp + IN6ADDRSZ;
colonp = NULL;
/* Leading :: requires some special handling. */
if (*src == ':')
if (*++src != ':')
return (0);
curtok = src;
saw_xdigit = count_xdigit = 0;
val = 0;
while ((ch = *src++) != '\0') {
const char *pch;
if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL)
pch = strchr((xdigits = xdigits_u), ch);
if (pch != NULL) {
if (count_xdigit >= 4)
return (0);
val <<= 4;
val |= (pch - xdigits);
if (val > 0xffff)
return (0);
saw_xdigit = 1;
count_xdigit++;
continue;
}
if (ch == ':') {
curtok = src;
if (!saw_xdigit) {
if (colonp)
return (0);
colonp = tp;
continue;
} else if (*src == '\0') {
return (0);
}
if (tp + INT16SZ > endp)
return (0);
*tp++ = (u_char) (val >> 8) & 0xff;
*tp++ = (u_char) val & 0xff;
saw_xdigit = 0;
count_xdigit = 0;
val = 0;
continue;
}
if (ch == '.' && ((tp + INADDRSZ) <= endp) &&
inet_pton4(curtok, tp) > 0) {
tp += INADDRSZ;
saw_xdigit = 0;
count_xdigit = 0;
break; /* '\0' was seen by inet_pton4(). */
}
return (0);
}
if (saw_xdigit) {
if (tp + INT16SZ > endp)
return (0);
*tp++ = (u_char) (val >> 8) & 0xff;
*tp++ = (u_char) val & 0xff;
}
if (colonp != NULL) {
/*
* Since some memmove()'s erroneously fail to handle
* overlapping regions, we'll do the shift by hand.
*/
const int n = tp - colonp;
int i;
if (tp == endp)
return (0);
for (i = 1; i <= n; i++) {
endp[- i] = colonp[n - i];
colonp[n - i] = 0;
}
tp = endp;
}
if (tp != endp)
return (0);
memcpy(dst, tmp, IN6ADDRSZ);
return (1);
}

View File

@@ -12,6 +12,8 @@
#include <ws2tcpip.h> #include <ws2tcpip.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@@ -38,6 +40,42 @@ posix_fopen(const char *path, const char *mode)
return fopen(path, mode); return fopen(path, mode);
} }
int
posix_open(const char *path, ...)
{
va_list ap;
int mode = 0;
int flags;
va_start(ap, path);
flags = va_arg(ap, int);
if (flags & O_CREAT)
mode = va_arg(ap, int);
va_end(ap);
flags |= O_BINARY;
if (flags & O_CLOEXEC) {
flags &= ~O_CLOEXEC;
flags |= O_NOINHERIT;
}
flags &= ~O_NONBLOCK;
return open(path, flags, mode);
}
char *
posix_fgets(char *s, int size, FILE *stream)
{
char *ret = fgets(s, size, stream);
if (ret != NULL) {
size_t end = strlen(ret);
if (end >= 2 && ret[end - 2] == '\r' && ret[end - 1] == '\n') {
ret[end - 2] = '\n';
ret[end - 1] = '\0';
}
}
return ret;
}
int int
posix_rename(const char *oldpath, const char *newpath) posix_rename(const char *oldpath, const char *newpath)
{ {
@@ -94,6 +132,9 @@ wsa_errno(int err)
case WSAEAFNOSUPPORT: case WSAEAFNOSUPPORT:
errno = EAFNOSUPPORT; errno = EAFNOSUPPORT;
break; break;
case WSAEBADF:
errno = EBADF;
break;
case WSAENETRESET: case WSAENETRESET:
case WSAENOTCONN: case WSAENOTCONN:
case WSAECONNABORTED: case WSAECONNABORTED:
@@ -120,7 +161,7 @@ posix_close(int fd)
{ {
if (closesocket(fd) == SOCKET_ERROR) { if (closesocket(fd) == SOCKET_ERROR) {
int err = WSAGetLastError(); int err = WSAGetLastError();
return err == WSAENOTSOCK ? return (err == WSAENOTSOCK || err == WSAEBADF) ?
close(fd) : wsa_errno(err); close(fd) : wsa_errno(err);
} }
return 0; return 0;
@@ -132,7 +173,7 @@ posix_read(int fd, void *buf, size_t count)
ssize_t rc = recv(fd, buf, count, 0); ssize_t rc = recv(fd, buf, count, 0);
if (rc == SOCKET_ERROR) { if (rc == SOCKET_ERROR) {
int err = WSAGetLastError(); int err = WSAGetLastError();
return err == WSAENOTSOCK ? return (err == WSAENOTSOCK || err == WSAEBADF) ?
read(fd, buf, count) : wsa_errno(err); read(fd, buf, count) : wsa_errno(err);
} }
return rc; return rc;
@@ -144,7 +185,7 @@ posix_write(int fd, const void *buf, size_t count)
ssize_t rc = send(fd, buf, count, 0); ssize_t rc = send(fd, buf, count, 0);
if (rc == SOCKET_ERROR) { if (rc == SOCKET_ERROR) {
int err = WSAGetLastError(); int err = WSAGetLastError();
return err == WSAENOTSOCK ? return (err == WSAENOTSOCK || err == WSAEBADF) ?
write(fd, buf, count) : wsa_errno(err); write(fd, buf, count) : wsa_errno(err);
} }
return rc; return rc;
@@ -168,6 +209,7 @@ posix_setsockopt(int sockfd, int level, int optname,
} }
#ifdef _MSC_VER #ifdef _MSC_VER
struct timezone;
int gettimeofday(struct timeval * tp, struct timezone * tzp) int gettimeofday(struct timeval * tp, struct timezone * tzp)
{ {
/* /*

220
crypto/compat/timegm.c Normal file
View File

@@ -0,0 +1,220 @@
/*
* ----------------------------------------------------------------------
* Copyright © 2005-2014 Rich Felker, et al.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* ----------------------------------------------------------------------
*/
#include <errno.h>
#include <limits.h>
#include <time.h>
/* 2000-03-01 (mod 400 year, immediately after feb29 */
#define LEAPOCH (946684800LL + 86400*(31+29))
#define DAYS_PER_400Y (365*400 + 97)
#define DAYS_PER_100Y (365*100 + 24)
#define DAYS_PER_4Y (365*4 + 1)
static int __month_to_secs(int month, int is_leap)
{
static const int secs_through_month[] = {
0, 31*86400, 59*86400, 90*86400,
120*86400, 151*86400, 181*86400, 212*86400,
243*86400, 273*86400, 304*86400, 334*86400 };
int t = secs_through_month[month];
if (is_leap && month >= 2) t+=86400;
return t;
}
static long long __year_to_secs(long long year, int *is_leap)
{
if (year-2ULL <= 136) {
int y = year;
int leaps = (y-68)>>2;
if (!((y-68)&3)) {
leaps--;
if (is_leap) *is_leap = 1;
} else if (is_leap) *is_leap = 0;
return 31536000*(y-70) + 86400*leaps;
}
int cycles, centuries, leaps, rem;
if (!is_leap) is_leap = &(int){0};
cycles = (year-100) / 400;
rem = (year-100) % 400;
if (rem < 0) {
cycles--;
rem += 400;
}
if (!rem) {
*is_leap = 1;
centuries = 0;
leaps = 0;
} else {
if (rem >= 200) {
if (rem >= 300) centuries = 3, rem -= 300;
else centuries = 2, rem -= 200;
} else {
if (rem >= 100) centuries = 1, rem -= 100;
else centuries = 0;
}
if (!rem) {
*is_leap = 0;
leaps = 0;
} else {
leaps = rem / 4U;
rem %= 4U;
*is_leap = !rem;
}
}
leaps += 97*cycles + 24*centuries - *is_leap;
return (year-100) * 31536000LL + leaps * 86400LL + 946684800 + 86400;
}
static long long __tm_to_secs(const struct tm *tm)
{
int is_leap;
long long year = tm->tm_year;
int month = tm->tm_mon;
if (month >= 12 || month < 0) {
int adj = month / 12;
month %= 12;
if (month < 0) {
adj--;
month += 12;
}
year += adj;
}
long long t = __year_to_secs(year, &is_leap);
t += __month_to_secs(month, is_leap);
t += 86400LL * (tm->tm_mday-1);
t += 3600LL * tm->tm_hour;
t += 60LL * tm->tm_min;
t += tm->tm_sec;
return t;
}
static int __secs_to_tm(long long t, struct tm *tm)
{
long long days, secs;
int remdays, remsecs, remyears;
int qc_cycles, c_cycles, q_cycles;
int years, months;
int wday, yday, leap;
static const char days_in_month[] = {31,30,31,30,31,31,30,31,30,31,31,29};
/* Reject time_t values whose year would overflow int */
if (t < INT_MIN * 31622400LL || t > INT_MAX * 31622400LL)
return -1;
secs = t - LEAPOCH;
days = secs / 86400;
remsecs = secs % 86400;
if (remsecs < 0) {
remsecs += 86400;
days--;
}
wday = (3+days)%7;
if (wday < 0) wday += 7;
qc_cycles = days / DAYS_PER_400Y;
remdays = days % DAYS_PER_400Y;
if (remdays < 0) {
remdays += DAYS_PER_400Y;
qc_cycles--;
}
c_cycles = remdays / DAYS_PER_100Y;
if (c_cycles == 4) c_cycles--;
remdays -= c_cycles * DAYS_PER_100Y;
q_cycles = remdays / DAYS_PER_4Y;
if (q_cycles == 25) q_cycles--;
remdays -= q_cycles * DAYS_PER_4Y;
remyears = remdays / 365;
if (remyears == 4) remyears--;
remdays -= remyears * 365;
leap = !remyears && (q_cycles || !c_cycles);
yday = remdays + 31 + 28 + leap;
if (yday >= 365+leap) yday -= 365+leap;
years = remyears + 4*q_cycles + 100*c_cycles + 400*qc_cycles;
for (months=0; days_in_month[months] <= remdays; months++)
remdays -= days_in_month[months];
if (years+100 > INT_MAX || years+100 < INT_MIN)
return -1;
tm->tm_year = years + 100;
tm->tm_mon = months + 2;
if (tm->tm_mon >= 12) {
tm->tm_mon -=12;
tm->tm_year++;
}
tm->tm_mday = remdays + 1;
tm->tm_wday = wday;
tm->tm_yday = yday;
tm->tm_hour = remsecs / 3600;
tm->tm_min = remsecs / 60 % 60;
tm->tm_sec = remsecs % 60;
return 0;
}
#ifdef _WIN32
struct tm *__gmtime_r(const time_t *t, struct tm *tm)
{
if (__secs_to_tm(*t, tm) < 0) {
errno = EOVERFLOW;
return 0;
}
tm->tm_isdst = 0;
return tm;
}
#endif
time_t timegm(struct tm *tm)
{
struct tm new;
long long t = __tm_to_secs(tm);
if (__secs_to_tm(t, &new) < 0) {
errno = EOVERFLOW;
return -1;
}
#if SIZEOF_TIME_T != 8
if (t > (long long)INT_MAX || t < (long long)INT_MIN) {
errno = EOVERFLOW;
return -1;
}
#endif
*tm = new;
tm->tm_isdst = 0;
return t;
}

View File

@@ -286,7 +286,7 @@ error:
if (ps >= 1) if (ps >= 1)
popsig(); popsig();
OPENSSL_cleanse(result, BUFSIZ); explicit_bzero(result, BUFSIZ);
return ok; return ok;
} }
@@ -302,8 +302,12 @@ open_console(UI *ui)
tty_out = stderr; tty_out = stderr;
HANDLE handle = GetStdHandle(STD_INPUT_HANDLE); HANDLE handle = GetStdHandle(STD_INPUT_HANDLE);
if (handle != INVALID_HANDLE_VALUE) if (handle != NULL && handle != INVALID_HANDLE_VALUE) {
if (GetFileType(handle) == FILE_TYPE_CHAR)
return GetConsoleMode(handle, &console_mode); return GetConsoleMode(handle, &console_mode);
else
return 1;
}
return 0; return 0;
} }
@@ -311,8 +315,12 @@ static int
noecho_console(UI *ui) noecho_console(UI *ui)
{ {
HANDLE handle = GetStdHandle(STD_INPUT_HANDLE); HANDLE handle = GetStdHandle(STD_INPUT_HANDLE);
if (handle != INVALID_HANDLE_VALUE) if (handle != NULL && handle != INVALID_HANDLE_VALUE) {
if (GetFileType(handle) == FILE_TYPE_CHAR)
return SetConsoleMode(handle, console_mode & ~ENABLE_ECHO_INPUT); return SetConsoleMode(handle, console_mode & ~ENABLE_ECHO_INPUT);
else
return 1;
}
return 0; return 0;
} }
@@ -320,8 +328,12 @@ static int
echo_console(UI *ui) echo_console(UI *ui)
{ {
HANDLE handle = GetStdHandle(STD_INPUT_HANDLE); HANDLE handle = GetStdHandle(STD_INPUT_HANDLE);
if (handle != INVALID_HANDLE_VALUE) if (handle != NULL && handle != INVALID_HANDLE_VALUE) {
if (GetFileType(handle) == FILE_TYPE_CHAR)
return SetConsoleMode(handle, console_mode); return SetConsoleMode(handle, console_mode);
else
return 1;
}
return 0; return 0;
} }

View File

@@ -22,27 +22,18 @@ for ARCH in X86 X64; do
echo Building for $HOST echo Building for $HOST
CC=$HOST-gcc ./configure --host=$HOST CC=$HOST-gcc ./configure --host=$HOST --with-openssldir=c:/libressl/ssl
make clean make clean
PATH=$PATH:/usr/$HOST/sys-root/mingw/bin \ PATH=$PATH:/usr/$HOST/sys-root/mingw/bin \
make -j 4 check make -j 4 check
make -j 4 install DESTDIR=`pwd`/stage-$ARCHDIR make -j 4 install DESTDIR=`pwd`/stage-$ARCHDIR
mkdir -p $DIST/$ARCHDIR mkdir -p $DIST/$ARCHDIR
#cp -a stage-$ARCHDIR/usr/local/lib/* $DIST/$ARCHDIR
if [ ! -e $DIST/include ]; then if [ ! -e $DIST/include ]; then
cp -a stage-$ARCHDIR/usr/local/include $DIST cp -r stage-$ARCHDIR/usr/local/include $DIST
sed -i -e 'N;/\n.*__non/s/"\? *\n/ /;P;D' \
$DIST/include/openssl/*.h $DIST/include/*.h
sed -i -e 'N;/\n.*__attr/s/"\? *\n/ /;P;D' \
$DIST/include/openssl/*.h $DIST/include/*.h
sed -i -e "s/__attr.*;/;/" \
-e "s/sys\/time.h/winsock2.h/" \
$DIST/include/openssl/*.h $DIST/include/*.h
fi fi
cp stage-$ARCHDIR/usr/local/bin/* $DIST/$ARCHDIR cp stage-$ARCHDIR/usr/local/bin/* $DIST/$ARCHDIR
#cp /usr/$HOST/sys-root/mingw/bin/libssp* $DIST/$ARCHDIR
for i in libcrypto libssl libtls; do for i in libcrypto libssl libtls; do
DLL=$(basename `ls -1 $DIST/$ARCHDIR/$i*.dll`|cut -d. -f1) DLL=$(basename `ls -1 $DIST/$ARCHDIR/$i*.dll`|cut -d. -f1)

View File

@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
set -e set -e
rm -f man/*.1 man/*.3 rm -f man/*.[35] include/openssl/*.h
./autogen.sh ./autogen.sh
./configure ./configure
make distcheck make -j2 distcheck

20
gen-openbsd-tags.sh Executable file
View File

@@ -0,0 +1,20 @@
#!/bin/sh
set -e
for tag in `git tag`; do
branch=master
if [[ $tag = v2.0* ]]; then
branch=OPENBSD_5_6
elif [[ $tag = v2.1* ]]; then
branch=OPENBSD_5_7
elif [[ $tag = v2.2* ]]; then
branch=OPENBSD_5_8
elif [[ $tag = v2.3* ]]; then
branch=OPENBSD_5_9
fi
# adjust for 9 hour timezone delta between trees
release_ts=$((`git show -s --format=%ct $tag|tail -n1` + 32400))
commit=`git -C openbsd rev-list -n 1 --before=$release_ts $branch`
git -C openbsd tag -f libressl-$tag $commit
echo Tagged $tag as $commit in openbsd
done

8
include/CMakeLists.txt Normal file
View File

@@ -0,0 +1,8 @@
if(ENABLE_LIBRESSL_INSTALL)
install(DIRECTORY .
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
PATTERN "CMakeLists.txt" EXCLUDE
PATTERN "compat" EXCLUDE
PATTERN "pqueue.h" EXCLUDE
PATTERN "Makefile*" EXCLUDE)
endif(ENABLE_LIBRESSL_INSTALL)

View File

@@ -1,13 +1,19 @@
include $(top_srcdir)/Makefile.am.common include $(top_srcdir)/Makefile.am.common
EXTRA_DIST = CMakeLists.txt
SUBDIRS = openssl SUBDIRS = openssl
noinst_HEADERS = pqueue.h noinst_HEADERS = pqueue.h
noinst_HEADERS += compat/dirent.h noinst_HEADERS += compat/dirent.h
noinst_HEADERS += compat/dirent_msvc.h noinst_HEADERS += compat/dirent_msvc.h
noinst_HEADERS += compat/err.h noinst_HEADERS += compat/err.h
noinst_HEADERS += compat/fcntl.h
noinst_HEADERS += compat/limits.h
noinst_HEADERS += compat/netdb.h noinst_HEADERS += compat/netdb.h
noinst_HEADERS += compat/poll.h noinst_HEADERS += compat/poll.h
noinst_HEADERS += compat/readpassphrase.h
noinst_HEADERS += compat/resolv.h
noinst_HEADERS += compat/stdio.h noinst_HEADERS += compat/stdio.h
noinst_HEADERS += compat/stdlib.h noinst_HEADERS += compat/stdlib.h
noinst_HEADERS += compat/string.h noinst_HEADERS += compat/string.h
@@ -21,15 +27,15 @@ noinst_HEADERS += compat/arpa/nameser.h
noinst_HEADERS += compat/machine/endian.h noinst_HEADERS += compat/machine/endian.h
noinst_HEADERS += compat/netinet/in.h noinst_HEADERS += compat/netinet/in.h
noinst_HEADERS += compat/netinet/ip.h
noinst_HEADERS += compat/netinet/tcp.h noinst_HEADERS += compat/netinet/tcp.h
noinst_HEADERS += compat/sys/cdefs.h
noinst_HEADERS += compat/sys/ioctl.h noinst_HEADERS += compat/sys/ioctl.h
noinst_HEADERS += compat/sys/mman.h noinst_HEADERS += compat/sys/mman.h
noinst_HEADERS += compat/sys/param.h noinst_HEADERS += compat/sys/param.h
noinst_HEADERS += compat/sys/select.h noinst_HEADERS += compat/sys/select.h
noinst_HEADERS += compat/sys/stat.h
noinst_HEADERS += compat/sys/socket.h noinst_HEADERS += compat/sys/socket.h
noinst_HEADERS += compat/sys/stat.h
noinst_HEADERS += compat/sys/time.h noinst_HEADERS += compat/sys/time.h
noinst_HEADERS += compat/sys/types.h noinst_HEADERS += compat/sys/types.h
noinst_HEADERS += compat/sys/uio.h noinst_HEADERS += compat/sys/uio.h

View File

@@ -14,6 +14,10 @@
#endif #endif
#ifndef HAVE_INET_NTOP
const char * inet_ntop(int af, const void *src, char *dst, socklen_t size);
#endif
#ifndef HAVE_INET_PTON #ifndef HAVE_INET_PTON
int inet_pton(int af, const char * src, void * dst); int inet_pton(int af, const char * src, void * dst);
#endif #endif

View File

@@ -29,15 +29,24 @@
#include <windows.h> #include <windows.h>
#if _MSC_VER >= 1900
#include <../ucrt/stdio.h>
#include <../ucrt/wchar.h>
#include <../ucrt/string.h>
#include <../ucrt/stdlib.h>
#include <../ucrt/sys/types.h>
#include <../ucrt/errno.h>
#else
#include <../include/stdio.h> #include <../include/stdio.h>
#include <../include/stdarg.h>
#include <../include/wchar.h> #include <../include/wchar.h>
#include <../include/string.h> #include <../include/string.h>
#include <../include/stdlib.h> #include <../include/stdlib.h>
#include <../include/malloc.h>
#include <../include/sys/types.h> #include <../include/sys/types.h>
#include <sys/stat.h>
#include <../include/errno.h> #include <../include/errno.h>
#endif
#include <stdarg.h>
#include <sys/stat.h>
/* Indicates that d_type field is available in dirent structure */ /* Indicates that d_type field is available in dirent structure */
#define _DIRENT_HAVE_D_TYPE #define _DIRENT_HAVE_D_TYPE
@@ -45,11 +54,6 @@
/* Indicates that d_namlen field is available in dirent structure */ /* Indicates that d_namlen field is available in dirent structure */
#define _DIRENT_HAVE_D_NAMLEN #define _DIRENT_HAVE_D_NAMLEN
/* Entries missing from MSVC 6.0 */
#if !defined(FILE_ATTRIBUTE_DEVICE)
# define FILE_ATTRIBUTE_DEVICE 0x40
#endif
/* Maximum length of file name */ /* Maximum length of file name */
#if !defined(PATH_MAX) #if !defined(PATH_MAX)
# define PATH_MAX MAX_PATH # define PATH_MAX MAX_PATH
@@ -67,12 +71,6 @@
/* Return number of bytes needed to store d_namlen */ /* Return number of bytes needed to store d_namlen */
#define _D_ALLOC_NAMLEN(p)(PATH_MAX) #define _D_ALLOC_NAMLEN(p)(PATH_MAX)
#ifdef __cplusplus
extern "C" {
#endif
/* Wide-character version */ /* Wide-character version */
struct _wdirent { struct _wdirent {
long d_ino; /* Always zero */ long d_ino; /* Always zero */
@@ -97,16 +95,6 @@ static struct _wdirent *_wreaddir (_WDIR *dirp);
static int _wclosedir(_WDIR *dirp); static int _wclosedir(_WDIR *dirp);
static void _wrewinddir(_WDIR* dirp); static void _wrewinddir(_WDIR* dirp);
/* For compatibility with Symbian */
#define wdirent _wdirent
#define WDIR _WDIR
#define wopendir _wopendir
#define wreaddir _wreaddir
#define wclosedir _wclosedir
#define wrewinddir _wrewinddir
/* Multi-byte character versions */ /* Multi-byte character versions */
struct dirent { struct dirent {
long d_ino; /* Always zero */ long d_ino; /* Always zero */
@@ -128,7 +116,6 @@ static struct dirent *readdir (DIR *dirp);
static int closedir(DIR *dirp); static int closedir(DIR *dirp);
static void rewinddir(DIR* dirp); static void rewinddir(DIR* dirp);
/* Internal utility functions */ /* Internal utility functions */
static WIN32_FIND_DATAW *dirent_first(_WDIR *dirp); static WIN32_FIND_DATAW *dirent_first(_WDIR *dirp);
static WIN32_FIND_DATAW *dirent_next(_WDIR *dirp); static WIN32_FIND_DATAW *dirent_next(_WDIR *dirp);
@@ -147,23 +134,20 @@ static int dirent_wcstombs_s(
const wchar_t *wcstr, const wchar_t *wcstr,
size_t count); size_t count);
static void dirent_set_errno (int error);
/* /*
* Open directory stream DIRNAME for read and return a pointer to the * Open directory stream DIRNAME for read and return a pointer to the
* internal working area that is used to retrieve individual directory * internal working area that is used to retrieve individual directory
* entries. * entries.
*/ */
static _WDIR* static _WDIR*
_wopendir( _wopendir(const wchar_t *dirname)
const wchar_t *dirname)
{ {
_WDIR *dirp = NULL; _WDIR *dirp = NULL;
int error; int error;
/* Must have directory name */ /* Must have directory name */
if (dirname == NULL || dirname[0] == '\0') { if (dirname == NULL || dirname[0] == '\0') {
dirent_set_errno (ENOENT); _set_errno(ENOENT);
return NULL; return NULL;
} }
@@ -219,12 +203,12 @@ _wopendir(
} else { } else {
/* Cannot retrieve first entry */ /* Cannot retrieve first entry */
error = 1; error = 1;
dirent_set_errno (ENOENT); _set_errno(ENOENT);
} }
} else { } else {
/* Cannot retrieve full path name */ /* Cannot retrieve full path name */
dirent_set_errno (ENOENT); _set_errno(ENOENT);
error = 1; error = 1;
} }
@@ -254,8 +238,7 @@ _wopendir(
* "." and ".." as well as volume labels, hidden files and system files. * "." and ".." as well as volume labels, hidden files and system files.
*/ */
static struct _wdirent* static struct _wdirent*
_wreaddir( _wreaddir(_WDIR *dirp)
_WDIR *dirp)
{ {
WIN32_FIND_DATAW *datap; WIN32_FIND_DATAW *datap;
struct _wdirent *entp; struct _wdirent *entp;
@@ -314,8 +297,7 @@ _wreaddir(
* _wreaddir(). * _wreaddir().
*/ */
static int static int
_wclosedir( _wclosedir(_WDIR *dirp)
_WDIR *dirp)
{ {
int ok; int ok;
if (dirp) { if (dirp) {
@@ -338,7 +320,7 @@ _wclosedir(
} else { } else {
/* Invalid directory stream */ /* Invalid directory stream */
dirent_set_errno (EBADF); _set_errno(EBADF);
ok = /*failure*/-1; ok = /*failure*/-1;
} }
return ok; return ok;
@@ -349,8 +331,7 @@ _wclosedir(
* file name again. * file name again.
*/ */
static void static void
_wrewinddir( _wrewinddir(_WDIR* dirp)
_WDIR* dirp)
{ {
if (dirp) { if (dirp) {
/* Release existing search handle */ /* Release existing search handle */
@@ -365,8 +346,7 @@ _wrewinddir(
/* Get first directory entry(internal) */ /* Get first directory entry(internal) */
static WIN32_FIND_DATAW* static WIN32_FIND_DATAW*
dirent_first( dirent_first(_WDIR *dirp)
_WDIR *dirp)
{ {
WIN32_FIND_DATAW *datap; WIN32_FIND_DATAW *datap;
@@ -390,8 +370,7 @@ dirent_first(
/* Get next directory entry(internal) */ /* Get next directory entry(internal) */
static WIN32_FIND_DATAW* static WIN32_FIND_DATAW*
dirent_next( dirent_next(_WDIR *dirp)
_WDIR *dirp)
{ {
WIN32_FIND_DATAW *p; WIN32_FIND_DATAW *p;
@@ -429,15 +408,14 @@ dirent_next(
* Open directory stream using plain old C-string. * Open directory stream using plain old C-string.
*/ */
static DIR* static DIR*
opendir( opendir(const char *dirname)
const char *dirname)
{ {
struct DIR *dirp; struct DIR *dirp;
int error; int error;
/* Must have directory name */ /* Must have directory name */
if (dirname == NULL || dirname[0] == '\0') { if (dirname == NULL || dirname[0] == '\0') {
dirent_set_errno (ENOENT); _set_errno(ENOENT);
return NULL; return NULL;
} }
@@ -499,8 +477,7 @@ opendir(
* display correcly. * display correcly.
*/ */
static struct dirent* static struct dirent*
readdir( readdir(DIR *dirp)
DIR *dirp)
{ {
WIN32_FIND_DATAW *datap; WIN32_FIND_DATAW *datap;
struct dirent *entp; struct dirent *entp;
@@ -582,8 +559,7 @@ readdir(
* Close directory stream. * Close directory stream.
*/ */
static int static int
closedir( closedir(DIR *dirp)
DIR *dirp)
{ {
int ok; int ok;
if (dirp) { if (dirp) {
@@ -598,7 +574,7 @@ closedir(
} else { } else {
/* Invalid directory stream */ /* Invalid directory stream */
dirent_set_errno (EBADF); _set_errno(EBADF);
ok = /*failure*/-1; ok = /*failure*/-1;
} }
@@ -609,8 +585,7 @@ closedir(
* Rewind directory stream to beginning. * Rewind directory stream to beginning.
*/ */
static void static void
rewinddir( rewinddir(DIR* dirp)
DIR* dirp)
{ {
/* Rewind wide-character string directory stream */ /* Rewind wide-character string directory stream */
_wrewinddir(dirp->wdirp); _wrewinddir(dirp->wdirp);
@@ -618,131 +593,19 @@ rewinddir(
/* Convert multi-byte string to wide character string */ /* Convert multi-byte string to wide character string */
static int static int
dirent_mbstowcs_s( dirent_mbstowcs_s(size_t *pReturnValue, wchar_t *wcstr,
size_t *pReturnValue, size_t sizeInWords, const char *mbstr, size_t count)
wchar_t *wcstr,
size_t sizeInWords,
const char *mbstr,
size_t count)
{ {
int error; return mbstowcs_s(pReturnValue, wcstr, sizeInWords, mbstr, count);
#if defined(_MSC_VER) && _MSC_VER >= 1400
/* Microsoft Visual Studio 2005 or later */
error = mbstowcs_s (pReturnValue, wcstr, sizeInWords, mbstr, count);
#else
/* Older Visual Studio or non-Microsoft compiler */
size_t n;
/* Convert to wide-character string (or count characters) */
n = mbstowcs (wcstr, mbstr, sizeInWords);
if (!wcstr || n < count) {
/* Zero-terminate output buffer */
if (wcstr && sizeInWords) {
if (n >= sizeInWords) {
n = sizeInWords - 1;
}
wcstr[n] = 0;
}
/* Length of resuting multi-byte string WITH zero terminator */
if (pReturnValue) {
*pReturnValue = n + 1;
}
/* Success */
error = 0;
} else {
/* Could not convert string */
error = 1;
}
#endif
return error;
} }
/* Convert wide-character string to multi-byte string */ /* Convert wide-character string to multi-byte string */
static int static int
dirent_wcstombs_s( dirent_wcstombs_s(size_t *pReturnValue, char *mbstr,
size_t *pReturnValue,
char *mbstr,
size_t sizeInBytes, /* max size of mbstr */ size_t sizeInBytes, /* max size of mbstr */
const wchar_t *wcstr, const wchar_t *wcstr, size_t count)
size_t count)
{ {
int error; return wcstombs_s(pReturnValue, mbstr, sizeInBytes, wcstr, count);
#if defined(_MSC_VER) && _MSC_VER >= 1400
/* Microsoft Visual Studio 2005 or later */
error = wcstombs_s (pReturnValue, mbstr, sizeInBytes, wcstr, count);
#else
/* Older Visual Studio or non-Microsoft compiler */
size_t n;
/* Convert to multi-byte string (or count the number of bytes needed) */
n = wcstombs (mbstr, wcstr, sizeInBytes);
if (!mbstr || n < count) {
/* Zero-terminate output buffer */
if (mbstr && sizeInBytes) {
if (n >= sizeInBytes) {
n = sizeInBytes - 1;
}
mbstr[n] = '\0';
} }
/* Lenght of resulting multi-bytes string WITH zero-terminator */
if (pReturnValue) {
*pReturnValue = n + 1;
}
/* Success */
error = 0;
} else {
/* Cannot convert string */
error = 1;
}
#endif
return error;
}
/* Set errno variable */
static void
dirent_set_errno(
int error)
{
#if defined(_MSC_VER) && _MSC_VER >= 1400
/* Microsoft Visual Studio 2005 and later */
_set_errno (error);
#else
/* Non-Microsoft compiler or older Microsoft compiler */
errno = error;
#endif
}
#ifdef __cplusplus
}
#endif
#endif /*DIRENT_H*/ #endif /*DIRENT_H*/

View File

@@ -13,20 +13,76 @@
#define LIBCRYPTOCOMPAT_ERR_H #define LIBCRYPTOCOMPAT_ERR_H
#include <errno.h> #include <errno.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#define err(exitcode, format, ...) \ #if defined(_MSC_VER)
errx(exitcode, format ": %s", ## __VA_ARGS__, strerror(errno)) __declspec(noreturn)
#else
__attribute__((noreturn))
#endif
static inline void
err(int eval, const char *fmt, ...)
{
int sverrno = errno;
va_list ap;
#define errx(exitcode, format, ...) \ va_start(ap, fmt);
do { warnx(format, ## __VA_ARGS__); exit(exitcode); } while (0) if (fmt != NULL) {
vfprintf(stderr, fmt, ap);
fprintf(stderr, ": ");
}
va_end(ap);
fprintf(stderr, "%s\n", strerror(sverrno));
exit(eval);
}
#define warn(format, ...) \ #if defined(_MSC_VER)
warnx(format ": %s", ## __VA_ARGS__, strerror(errno)) __declspec(noreturn)
#else
__attribute__((noreturn))
#endif
static inline void
errx(int eval, const char *fmt, ...)
{
va_list ap;
#define warnx(format, ...) \ va_start(ap, fmt);
fprintf(stderr, format "\n", ## __VA_ARGS__) if (fmt != NULL)
vfprintf(stderr, fmt, ap);
va_end(ap);
fprintf(stderr, "\n");
exit(eval);
}
static inline void
warn(const char *fmt, ...)
{
int sverrno = errno;
va_list ap;
va_start(ap, fmt);
if (fmt != NULL) {
vfprintf(stderr, fmt, ap);
fprintf(stderr, ": ");
}
va_end(ap);
fprintf(stderr, "%s\n", strerror(sverrno));
}
static inline void
warnx(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
if (fmt != NULL)
vfprintf(stderr, fmt, ap);
va_end(ap);
fprintf(stderr, "\n");
}
#endif #endif

32
include/compat/fcntl.h Normal file
View File

@@ -0,0 +1,32 @@
/*
* Public domain
* fcntl.h compatibility shim
*/
#ifndef _WIN32
#include_next <fcntl.h>
#else
#ifdef _MSC_VER
#if _MSC_VER >= 1900
#include <../ucrt/fcntl.h>
#else
#include <../include/fcntl.h>
#endif
#else
#include_next <fcntl.h>
#endif
#endif
#ifndef O_NONBLOCK
#define O_NONBLOCK 0x100000
#endif
#ifndef O_CLOEXEC
#define O_CLOEXEC 0x200000
#endif
#ifndef FD_CLOEXEC
#define FD_CLOEXEC 1
#endif

25
include/compat/limits.h Normal file
View File

@@ -0,0 +1,25 @@
/*
* Public domain
* limits.h compatibility shim
*/
#ifdef _MSC_VER
#include <../include/limits.h>
#if _MSC_VER >= 1900
#include <../ucrt/stdlib.h>
#else
#include <../include/stdlib.h>
#endif
#ifndef PATH_MAX
#define PATH_MAX _MAX_PATH
#endif
#else
#include_next <limits.h>
#endif
#ifdef __hpux
#include <sys/param.h>
#ifndef PATH_MAX
#define PATH_MAX MAXPATHLEN
#endif
#endif

View File

@@ -0,0 +1,47 @@
/*
* Public domain
* netinet/ip.h compatibility shim
*/
#if defined(__hpux)
#include <netinet/in_systm.h>
#endif
#ifndef _WIN32
#include_next <netinet/ip.h>
#else
#include <win32netcompat.h>
#endif
/*
* Definitions for DiffServ Codepoints as per RFC2474
*/
#ifndef IPTOS_DSCP_CS0
#define IPTOS_DSCP_CS0 0x00
#define IPTOS_DSCP_CS1 0x20
#define IPTOS_DSCP_CS2 0x40
#define IPTOS_DSCP_CS3 0x60
#define IPTOS_DSCP_CS4 0x80
#define IPTOS_DSCP_CS5 0xa0
#define IPTOS_DSCP_CS6 0xc0
#define IPTOS_DSCP_CS7 0xe0
#endif
#ifndef IPTOS_DSCP_AF11
#define IPTOS_DSCP_AF11 0x28
#define IPTOS_DSCP_AF12 0x30
#define IPTOS_DSCP_AF13 0x38
#define IPTOS_DSCP_AF21 0x48
#define IPTOS_DSCP_AF22 0x50
#define IPTOS_DSCP_AF23 0x58
#define IPTOS_DSCP_AF31 0x68
#define IPTOS_DSCP_AF32 0x70
#define IPTOS_DSCP_AF33 0x78
#define IPTOS_DSCP_AF41 0x88
#define IPTOS_DSCP_AF42 0x90
#define IPTOS_DSCP_AF43 0x98
#endif
#ifndef IPTOS_DSCP_EF
#define IPTOS_DSCP_EF 0xb8
#endif

View File

@@ -0,0 +1,44 @@
/* $OpenBSD: readpassphrase.h,v 1.5 2003/06/17 21:56:23 millert Exp $ */
/*
* Copyright (c) 2000, 2002 Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Sponsored in part by the Defense Advanced Research Projects
* Agency (DARPA) and Air Force Research Laboratory, Air Force
* Materiel Command, USAF, under agreement number F39502-99-1-0512.
*/
#ifdef HAVE_READPASSPHRASE_H
#include_next <readpassphrase.h>
#else
#ifndef _READPASSPHRASE_H_
#define _READPASSPHRASE_H_
#define RPP_ECHO_OFF 0x00 /* Turn off echo (default). */
#define RPP_ECHO_ON 0x01 /* Leave echo on. */
#define RPP_REQUIRE_TTY 0x02 /* Fail if there is no tty. */
#define RPP_FORCELOWER 0x04 /* Force input to lower case. */
#define RPP_FORCEUPPER 0x08 /* Force input to upper case. */
#define RPP_SEVENBIT 0x10 /* Strip the high bit from input. */
#define RPP_STDIN 0x20 /* Read from stdin, not /dev/tty */
char * readpassphrase(const char *, char *, size_t, int);
#endif /* !_READPASSPHRASE_H_ */
#endif

24
include/compat/resolv.h Normal file
View File

@@ -0,0 +1,24 @@
/*
* Public domain
* resolv.h compatibility shim
*/
#ifndef LIBCRYPTOCOMPAT_RESOLV_H
#define LIBCRYPTOCOMPAT_RESOLV_H
#ifdef _MSC_VER
#if _MSC_VER >= 1900
#include <../ucrt/resolv.h>
#else
#include <../include/resolv.h>
#endif
#else
#include_next <resolv.h>
#endif
#ifndef HAVE_B64_NTOP
int b64_ntop(unsigned char const *, size_t, char *, size_t);
int b64_pton(char const *, unsigned char *, size_t);
#endif
#endif

View File

@@ -7,7 +7,13 @@
#define LIBCRYPTOCOMPAT_STDIO_H #define LIBCRYPTOCOMPAT_STDIO_H
#ifdef _MSC_VER #ifdef _MSC_VER
#if _MSC_VER >= 1900
#include <../ucrt/stdlib.h>
#include <../ucrt/corecrt_io.h>
#include <../ucrt/stdio.h>
#else
#include <../include/stdio.h> #include <../include/stdio.h>
#endif
#else #else
#include_next <stdio.h> #include_next <stdio.h>
#endif #endif
@@ -20,13 +26,19 @@ int asprintf(char **str, const char *fmt, ...);
#ifdef _WIN32 #ifdef _WIN32
#if defined(_MSC_VER)
#define __func__ __FUNCTION__
#endif
void posix_perror(const char *s); void posix_perror(const char *s);
FILE * posix_fopen(const char *path, const char *mode); FILE * posix_fopen(const char *path, const char *mode);
char * posix_fgets(char *s, int size, FILE *stream);
int posix_rename(const char *oldpath, const char *newpath); int posix_rename(const char *oldpath, const char *newpath);
#ifndef NO_REDEF_POSIX_FUNCTIONS #ifndef NO_REDEF_POSIX_FUNCTIONS
#define perror(errnum) posix_perror(errnum) #define perror(errnum) posix_perror(errnum)
#define fopen(path, mode) posix_fopen(path, mode) #define fopen(path, mode) posix_fopen(path, mode)
#define fgets(s, size, stream) posix_fgets(s, size, stream)
#define rename(oldpath, newpath) posix_rename(oldpath, newpath) #define rename(oldpath, newpath) posix_rename(oldpath, newpath)
#endif #endif

View File

@@ -4,7 +4,11 @@
*/ */
#ifdef _MSC_VER #ifdef _MSC_VER
#if _MSC_VER >= 1900
#include <../ucrt/stdlib.h>
#else
#include <../include/stdlib.h> #include <../include/stdlib.h>
#endif
#else #else
#include_next <stdlib.h> #include_next <stdlib.h>
#endif #endif
@@ -18,12 +22,21 @@
#ifndef HAVE_ARC4RANDOM_BUF #ifndef HAVE_ARC4RANDOM_BUF
uint32_t arc4random(void); uint32_t arc4random(void);
void arc4random_buf(void *_buf, size_t n); void arc4random_buf(void *_buf, size_t n);
uint32_t arc4random_uniform(uint32_t upper_bound);
#endif
#ifndef HAVE_FREEZERO
void freezero(void *ptr, size_t sz);
#endif #endif
#ifndef HAVE_REALLOCARRAY #ifndef HAVE_REALLOCARRAY
void *reallocarray(void *, size_t, size_t); void *reallocarray(void *, size_t, size_t);
#endif #endif
#ifndef HAVE_RECALLOCARRAY
void *recallocarray(void *, size_t, size_t, size_t);
#endif
#ifndef HAVE_STRTONUM #ifndef HAVE_STRTONUM
long long strtonum(const char *nptr, long long minval, long long strtonum(const char *nptr, long long minval,
long long maxval, const char **errstr); long long maxval, const char **errstr);

View File

@@ -7,16 +7,21 @@
#define LIBCRYPTOCOMPAT_STRING_H #define LIBCRYPTOCOMPAT_STRING_H
#ifdef _MSC_VER #ifdef _MSC_VER
#if _MSC_VER >= 1900
#include <../ucrt/string.h>
#else
#include <../include/string.h> #include <../include/string.h>
#endif
#else #else
#include_next <string.h> #include_next <string.h>
#endif #endif
#include <sys/types.h> #include <sys/types.h>
#if defined(__sun) || defined(__hpux) #if defined(__sun) || defined(_AIX) || defined(__hpux)
/* Some functions historically defined in string.h were placed in strings.h by /* Some functions historically defined in string.h were placed in strings.h by
* SUS. Use the same hack as OS X and FreeBSD use to work around on Solaris and HPUX. * SUS. Use the same hack as OS X and FreeBSD use to work around on AIX,
* Solaris, and HPUX.
*/ */
#include <strings.h> #include <strings.h>
#endif #endif

View File

@@ -1,31 +0,0 @@
/*
* Public domain
* sys/cdefs.h compatibility shim
*/
#ifndef LIBCRYPTOCOMPAT_SYS_CDEFS_H
#define LIBCRYPTOCOMPAT_SYS_CDEFS_H
#ifdef _WIN32
#define __warn_references(sym,msg)
#else
#include_next <sys/cdefs.h>
#ifndef __warn_references
#if defined(__GNUC__) && defined (HAS_GNU_WARNING_LONG)
#define __warn_references(sym,msg) \
__asm__(".section .gnu.warning." __STRING(sym) \
" ; .ascii \"" msg "\" ; .text");
#else
#define __warn_references(sym,msg)
#endif
#endif /* __warn_references */
#endif /* _WIN32 */
#endif /* LIBCRYPTOCOMPAT_SYS_CDEFS_H */

View File

@@ -8,3 +8,10 @@
#else #else
#include <win32netcompat.h> #include <win32netcompat.h>
#endif #endif
#if !defined(SOCK_NONBLOCK) || !defined(SOCK_CLOEXEC)
#define SOCK_CLOEXEC 0x8000 /* set FD_CLOEXEC */
#define SOCK_NONBLOCK 0x4000 /* set O_NONBLOCK */
int bsd_socketpair(int domain, int type, int protocol, int socket_vector[2]);
#define socketpair(d,t,p,sv) bsd_socketpair(d,t,p,sv)
#endif

View File

@@ -8,10 +8,23 @@
#ifndef _MSC_VER #ifndef _MSC_VER
#include_next <sys/stat.h> #include_next <sys/stat.h>
/* for old MinGW */
#ifndef S_IRGRP
#define S_IRGRP 0
#endif
#ifndef S_IROTH
#define S_IROTH 0
#endif
#else #else
#include <windows.h> #include <windows.h>
#if _MSC_VER >= 1900
#include <../ucrt/sys/stat.h>
#else
#include <../include/sys/stat.h> #include <../include/sys/stat.h>
#endif
/* File type and permission flags for stat() */ /* File type and permission flags for stat() */
#if !defined(S_IFMT) #if !defined(S_IFMT)

View File

@@ -13,4 +13,20 @@ int gettimeofday(struct timeval *tp, void *tzp);
#include_next <sys/time.h> #include_next <sys/time.h>
#endif #endif
#ifndef CLOCK_MONOTONIC
#define CLOCK_MONOTONIC CLOCK_REALTIME
#endif
#ifndef timersub
#define timersub(tvp, uvp, vvp) \
do { \
(vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
(vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
if ((vvp)->tv_usec < 0) { \
(vvp)->tv_sec--; \
(vvp)->tv_usec += 1000000; \
} \
} while (0)
#endif
#endif #endif

View File

@@ -4,7 +4,11 @@
*/ */
#ifdef _MSC_VER #ifdef _MSC_VER
#if _MSC_VER >= 1900
#include <../ucrt/sys/types.h>
#else
#include <../include/sys/types.h> #include <../include/sys/types.h>
#endif
#else #else
#include_next <sys/types.h> #include_next <sys/types.h>
#endif #endif
@@ -16,12 +20,14 @@
#ifdef __MINGW32__ #ifdef __MINGW32__
#include <_bsd_types.h> #include <_bsd_types.h>
typedef uint32_t in_addr_t;
#endif #endif
#ifdef _MSC_VER #ifdef _MSC_VER
typedef unsigned char u_char; typedef unsigned char u_char;
typedef unsigned short u_short; typedef unsigned short u_short;
typedef unsigned int u_int; typedef unsigned int u_int;
typedef uint32_t in_addr_t;
#include <basetsd.h> #include <basetsd.h>
typedef SSIZE_T ssize_t; typedef SSIZE_T ssize_t;
@@ -40,4 +46,25 @@ typedef SSIZE_T ssize_t;
# define __bounded__(x, y, z) # define __bounded__(x, y, z)
#endif #endif
#ifdef _WIN32
#define __warn_references(sym,msg)
#else
#ifndef __warn_references
#ifndef __STRING
#define __STRING(x) #x
#endif
#if defined(__GNUC__) && defined (HAS_GNU_WARNING_LONG)
#define __warn_references(sym,msg) \
__asm__(".section .gnu.warning." __STRING(sym) \
" ; .ascii \"" msg "\" ; .text");
#else
#define __warn_references(sym,msg)
#endif
#endif /* __warn_references */
#endif /* _WIN32 */
#endif #endif

View File

@@ -4,8 +4,32 @@
*/ */
#ifdef _MSC_VER #ifdef _MSC_VER
#if _MSC_VER >= 1900
#include <../ucrt/time.h>
#else
#include <../include/time.h> #include <../include/time.h>
#define gmtime_r(tp, tm) ((gmtime_s((tm), (tp)) == 0) ? (tm) : NULL) #endif
#else #else
#include_next <time.h> #include_next <time.h>
#endif #endif
#ifdef _WIN32
struct tm *__gmtime_r(const time_t * t, struct tm * tm);
#define gmtime_r(tp, tm) __gmtime_r(tp, tm)
#endif
#ifndef HAVE_TIMEGM
time_t timegm(struct tm *tm);
#endif
#ifndef timespecsub
#define timespecsub(tsp, usp, vsp) \
do { \
(vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec; \
(vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec; \
if ((vsp)->tv_nsec < 0) { \
(vsp)->tv_sec--; \
(vsp)->tv_nsec += 1000000000L; \
} \
} while (0)
#endif

View File

@@ -14,6 +14,9 @@
#include <io.h> #include <io.h>
#include <process.h> #include <process.h>
#define STDOUT_FILENO 1
#define STDERR_FILENO 2
#define R_OK 4 #define R_OK 4
#define W_OK 2 #define W_OK 2
#define X_OK 0 #define X_OK 0
@@ -27,6 +30,23 @@ unsigned int sleep(unsigned int seconds);
#ifndef HAVE_GETENTROPY #ifndef HAVE_GETENTROPY
int getentropy(void *buf, size_t buflen); int getentropy(void *buf, size_t buflen);
#else
/*
* Solaris 11.3 adds getentropy(2), but defines the function in sys/random.h
*/
#if defined(__sun)
#include <sys/random.h>
#endif
#endif
#ifndef HAVE_GETPAGESIZE
int getpagesize(void);
#endif
#define pledge(request, paths) 0
#ifndef HAVE_PIPE2
int pipe2(int fildes[2], int flags);
#endif #endif
#endif #endif

View File

@@ -11,17 +11,25 @@
#ifdef _WIN32 #ifdef _WIN32
#include <ws2tcpip.h> #include <ws2tcpip.h>
#define SHUT_RDWR SD_BOTH
#define SHUT_RD SD_RECEIVE
#define SHUT_WR SD_SEND
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
#ifndef SHUT_RDWR
#define SHUT_RDWR SD_BOTH
#endif
#ifndef SHUT_RD
#define SHUT_RD SD_RECEIVE
#endif
#ifndef SHUT_WR
#define SHUT_WR SD_SEND
#endif
int posix_connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen); int posix_connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
int posix_open(const char *path, ...);
int posix_close(int fd); int posix_close(int fd);
ssize_t posix_read(int fd, void *buf, size_t count); ssize_t posix_read(int fd, void *buf, size_t count);
ssize_t posix_write(int fd, const void *buf, size_t count); ssize_t posix_write(int fd, const void *buf, size_t count);
@@ -34,6 +42,7 @@ int posix_setsockopt(int sockfd, int level, int optname,
#ifndef NO_REDEF_POSIX_FUNCTIONS #ifndef NO_REDEF_POSIX_FUNCTIONS
#define connect(sockfd, addr, addrlen) posix_connect(sockfd, addr, addrlen) #define connect(sockfd, addr, addrlen) posix_connect(sockfd, addr, addrlen)
#define open(path, ...) posix_open(path, __VA_ARGS__)
#define close(fd) posix_close(fd) #define close(fd) posix_close(fd)
#define read(fd, buf, count) posix_read(fd, buf, count) #define read(fd, buf, count) posix_read(fd, buf, count)
#define write(fd, buf, count) posix_write(fd, buf, count) #define write(fd, buf, count) posix_write(fd, buf, count)

View File

@@ -5,11 +5,11 @@ exec_prefix=@exec_prefix@
libdir=@libdir@ libdir=@libdir@
includedir=@includedir@ includedir=@includedir@
Name: LibreSSL-libssl Name: LibreSSL-libcrypto
Description: Secure Sockets Layer and cryptography libraries Description: LibreSSL cryptography library
Version: @LIBCRYPTO_VERSION@ Version: @VERSION@
Requires: Requires:
Conflicts: Conflicts:
Libs: -L${libdir} -lcrypto Libs: -L${libdir} -lcrypto
Libs.private: @LIBS@ Libs.private: @LIBS@ @PLATFORM_LDADD@
Cflags: -I${includedir} Cflags: -I${includedir}

View File

@@ -7,10 +7,10 @@ includedir=@includedir@
Name: LibreSSL-libssl Name: LibreSSL-libssl
Description: Secure Sockets Layer and cryptography libraries Description: Secure Sockets Layer and cryptography libraries
Version: @LIBSSL_VERSION@ Version: @VERSION@
Requires: Requires:
Requires.private: libcrypto Requires.private: libcrypto
Conflicts: Conflicts:
Libs: -L${libdir} -lssl Libs: -L${libdir} -lssl
Libs.private: @LIBS@ -lcrypto Libs.private: @LIBS@ -lcrypto @PLATFORM_LDADD@
Cflags: -I${includedir} Cflags: -I${includedir}

View File

@@ -7,16 +7,21 @@
#define LIBCRYPTOCOMPAT_STRING_H #define LIBCRYPTOCOMPAT_STRING_H
#ifdef _MSC_VER #ifdef _MSC_VER
#if _MSC_VER >= 1900
#include <../ucrt/string.h>
#else
#include <../include/string.h> #include <../include/string.h>
#endif
#else #else
#include_next <string.h> #include_next <string.h>
#endif #endif
#include <sys/types.h> #include <sys/types.h>
#if defined(__sun) || defined(__hpux) #if defined(__sun) || defined(_AIX) || defined(__hpux)
/* Some functions historically defined in string.h were placed in strings.h by /* Some functions historically defined in string.h were placed in strings.h by
* SUS. Use the same hack as OS X and FreeBSD use to work around on Solaris and HPUX. * SUS. Use the same hack as OS X and FreeBSD use to work around on AIX,
* Solaris, and HPUX.
*/ */
#include <strings.h> #include <strings.h>
#endif #endif

View File

@@ -8,6 +8,7 @@ libtls_la_LIBADD += $(top_builddir)/compat/libcompat.la
libtls_la_LIBADD += $(top_builddir)/compat/libcompatnoopt.la libtls_la_LIBADD += $(top_builddir)/compat/libcompatnoopt.la
libtls_la_SOURCES = tls.c libtls_la_SOURCES = tls.c
libtls_la_SOURCES += tls_bio_cb.c
libtls_la_SOURCES += tls_client.c libtls_la_SOURCES += tls_client.c
libtls_la_SOURCES += tls_config.c libtls_la_SOURCES += tls_config.c
libtls_la_SOURCES += tls_server.c libtls_la_SOURCES += tls_server.c

View File

@@ -5,7 +5,7 @@ int main()
{ {
struct tls *tls; struct tls *tls;
struct tls_config *tls_config; struct tls_config *tls_config;
size_t written, read; ssize_t written, read;
char buf[4096]; char buf[4096];
if (tls_init() != 0) { if (tls_init() != 0) {
@@ -31,10 +31,10 @@ int main()
if (tls_connect(tls, "google.com", "443") != 0) if (tls_connect(tls, "google.com", "443") != 0)
goto err; goto err;
if (tls_write(tls, "GET /\r\n", 7, &written) != 0) if ((written = tls_write(tls, "GET /\r\n", 7)) < 0)
goto err; goto err;
if (tls_read(tls, buf, sizeof(buf), &read) != 0) if ((read = tls_read(tls, buf, sizeof(buf))) < 0)
goto err; goto err;
buf[read - 1] = '\0'; buf[read - 1] = '\0';

View File

@@ -7,10 +7,10 @@ includedir=@includedir@
Name: LibreSSL-libtls Name: LibreSSL-libtls
Description: Secure communications using the TLS socket protocol. Description: Secure communications using the TLS socket protocol.
Version: @LIBTLS_VERSION@ Version: @VERSION@
Requires: Requires:
Requires.private: libcrypto libssl Requires.private: libcrypto libssl
Conflicts: Conflicts:
Libs: -L${libdir} -ltls Libs: -L${libdir} -ltls
Libs.private: @LIBS@ -lcrypto -lssl Libs.private: @LIBS@ -lcrypto -lssl @PLATFORM_LDADD@
Cflags: -I${includedir} Cflags: -I${includedir}

View File

@@ -1,25 +1,122 @@
AC_DEFUN([CHECK_LIBC_COMPAT], [ AC_DEFUN([CHECK_LIBC_COMPAT], [
# Check for libc headers
AC_CHECK_HEADERS([err.h readpassphrase.h])
# Check for general libc functions # Check for general libc functions
AC_CHECK_FUNCS([asprintf inet_pton memmem poll reallocarray]) AC_CHECK_FUNCS([asprintf freezero inet_ntop inet_pton memmem])
AC_CHECK_FUNCS([readpassphrase reallocarray recallocarray])
AC_CHECK_FUNCS([strlcat strlcpy strndup strnlen strsep strtonum]) AC_CHECK_FUNCS([strlcat strlcpy strndup strnlen strsep strtonum])
AC_CHECK_FUNCS([timegm _mkgmtime])
AC_CACHE_CHECK([for getpagesize], ac_cv_func_getpagesize, [
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
// Since Android NDK v16 getpagesize is defined as inline inside unistd.h
#ifdef __ANDROID__
# include <unistd.h>
#endif
]], [[
getpagesize();
]])],
[ ac_cv_func_getpagesize="yes" ],
[ ac_cv_func_getpagesize="no"
])
])
AM_CONDITIONAL([HAVE_ASPRINTF], [test "x$ac_cv_func_asprintf" = xyes]) AM_CONDITIONAL([HAVE_ASPRINTF], [test "x$ac_cv_func_asprintf" = xyes])
AM_CONDITIONAL([HAVE_FREEZERO], [test "x$ac_cv_func_freezero" = xyes])
AM_CONDITIONAL([HAVE_GETPAGESIZE], [test "x$ac_cv_func_getpagesize" = xyes])
AM_CONDITIONAL([HAVE_INET_NTOP], [test "x$ac_cv_func_inet_ntop" = xyes])
AM_CONDITIONAL([HAVE_INET_PTON], [test "x$ac_cv_func_inet_pton" = xyes]) AM_CONDITIONAL([HAVE_INET_PTON], [test "x$ac_cv_func_inet_pton" = xyes])
AM_CONDITIONAL([HAVE_MEMMEM], [test "x$ac_cv_func_memmem" = xyes]) AM_CONDITIONAL([HAVE_MEMMEM], [test "x$ac_cv_func_memmem" = xyes])
AM_CONDITIONAL([HAVE_POLL], [test "x$ac_cv_func_poll" = xyes]) AM_CONDITIONAL([HAVE_READPASSPHRASE], [test "x$ac_cv_func_readpassphrase" = xyes])
AM_CONDITIONAL([HAVE_REALLOCARRAY], [test "x$ac_cv_func_reallocarray" = xyes]) AM_CONDITIONAL([HAVE_REALLOCARRAY], [test "x$ac_cv_func_reallocarray" = xyes])
AM_CONDITIONAL([HAVE_RECALLOCARRAY], [test "x$ac_cv_func_recallocarray" = xyes])
AM_CONDITIONAL([HAVE_STRLCAT], [test "x$ac_cv_func_strlcat" = xyes]) AM_CONDITIONAL([HAVE_STRLCAT], [test "x$ac_cv_func_strlcat" = xyes])
AM_CONDITIONAL([HAVE_STRLCPY], [test "x$ac_cv_func_strlcpy" = xyes]) AM_CONDITIONAL([HAVE_STRLCPY], [test "x$ac_cv_func_strlcpy" = xyes])
AM_CONDITIONAL([HAVE_STRNDUP], [test "x$ac_cv_func_strndup" = xyes]) AM_CONDITIONAL([HAVE_STRNDUP], [test "x$ac_cv_func_strndup" = xyes])
AM_CONDITIONAL([HAVE_STRNLEN], [test "x$ac_cv_func_strnlen" = xyes]) AM_CONDITIONAL([HAVE_STRNLEN], [test "x$ac_cv_func_strnlen" = xyes])
AM_CONDITIONAL([HAVE_STRSEP], [test "x$ac_cv_func_strsep" = xyes]) AM_CONDITIONAL([HAVE_STRSEP], [test "x$ac_cv_func_strsep" = xyes])
AM_CONDITIONAL([HAVE_STRTONUM], [test "x$ac_cv_func_strtonum" = xyes]) AM_CONDITIONAL([HAVE_STRTONUM], [test "x$ac_cv_func_strtonum" = xyes])
AM_CONDITIONAL([HAVE_TIMEGM], [test "x$ac_cv_func_timegm" = xyes])
])
AC_DEFUN([CHECK_SYSCALL_COMPAT], [
AC_CHECK_FUNCS([accept4 pipe2 pledge poll socketpair])
AM_CONDITIONAL([HAVE_ACCEPT4], [test "x$ac_cv_func_accept4" = xyes])
AM_CONDITIONAL([HAVE_PIPE2], [test "x$ac_cv_func_pipe2" = xyes])
AM_CONDITIONAL([HAVE_PLEDGE], [test "x$ac_cv_func_pledge" = xyes])
AM_CONDITIONAL([HAVE_POLL], [test "x$ac_cv_func_poll" = xyes])
AM_CONDITIONAL([HAVE_SOCKETPAIR], [test "x$ac_cv_func_socketpair" = xyes])
])
AC_DEFUN([CHECK_B64_NTOP], [
AC_SEARCH_LIBS([b64_ntop],[resolv])
AC_SEARCH_LIBS([__b64_ntop],[resolv])
AC_CACHE_CHECK([for b64_ntop], ac_cv_have_b64_ntop_arg, [
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <resolv.h>
]], [[ b64_ntop(NULL, 0, NULL, 0); ]])],
[ ac_cv_have_b64_ntop_arg="yes" ],
[ ac_cv_have_b64_ntop_arg="no"
])
])
AM_CONDITIONAL([HAVE_B64_NTOP], [test "x$ac_cv_func_b64_ntop_arg" = xyes])
])
AC_DEFUN([CHECK_CRYPTO_COMPAT], [
# Check crypto-related libc functions and syscalls
AC_CHECK_FUNCS([arc4random arc4random_buf arc4random_uniform])
AC_CHECK_FUNCS([explicit_bzero getauxval])
AC_CACHE_CHECK([for getentropy], ac_cv_func_getentropy, [
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <unistd.h>
/*
* Explanation:
*
* - iOS <= 10.1 fails because of missing sys/random.h
*
* - in macOS 10.12 getentropy is not tagged as introduced in
* 10.12 so we cannot use it for target < 10.12
*/
#ifdef __APPLE__
# include <AvailabilityMacros.h>
# include <TargetConditionals.h>
# if (TARGET_OS_IPHONE || TARGET_OS_SIMULATOR)
# include <sys/random.h> /* Not available as of iOS <= 10.1 */
# else
# include <sys/random.h> /* Pre 10.12 systems should die here */
/* Based on: https://gitweb.torproject.org/tor.git/commit/?id=16fcbd21 */
# ifndef MAC_OS_X_VERSION_10_12
# define MAC_OS_X_VERSION_10_12 101200 /* Robustness */
# endif
# if defined(MAC_OS_X_VERSION_MIN_REQUIRED)
# if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12
# error "Targeting on Mac OSX 10.11 or earlier"
# endif
# endif
# endif
#endif /* __APPLE__ */
]], [[
char buffer;
(void)getentropy(&buffer, sizeof (buffer));
]])],
[ ac_cv_func_getentropy="yes" ],
[ ac_cv_func_getentropy="no"
])
]) ])
AC_DEFUN([CHECK_LIBC_CRYPTO_COMPAT], [
# Check crypto-related libc functions
AC_CHECK_FUNCS([arc4random_buf explicit_bzero getauxval getentropy])
AC_CHECK_FUNCS([timingsafe_bcmp timingsafe_memcmp]) AC_CHECK_FUNCS([timingsafe_bcmp timingsafe_memcmp])
AM_CONDITIONAL([HAVE_ARC4RANDOM], [test "x$ac_cv_func_arc4random" = xyes])
AM_CONDITIONAL([HAVE_ARC4RANDOM_BUF], [test "x$ac_cv_func_arc4random_buf" = xyes]) AM_CONDITIONAL([HAVE_ARC4RANDOM_BUF], [test "x$ac_cv_func_arc4random_buf" = xyes])
AM_CONDITIONAL([HAVE_ARC4RANDOM_UNIFORM], [test "x$ac_cv_func_arc4random_uniform" = xyes])
AM_CONDITIONAL([HAVE_EXPLICIT_BZERO], [test "x$ac_cv_func_explicit_bzero" = xyes]) AM_CONDITIONAL([HAVE_EXPLICIT_BZERO], [test "x$ac_cv_func_explicit_bzero" = xyes])
AM_CONDITIONAL([HAVE_GETENTROPY], [test "x$ac_cv_func_getentropy" = xyes]) AM_CONDITIONAL([HAVE_GETENTROPY], [test "x$ac_cv_func_getentropy" = xyes])
AM_CONDITIONAL([HAVE_TIMINGSAFE_BCMP], [test "x$ac_cv_func_timingsafe_bcmp" = xyes]) AM_CONDITIONAL([HAVE_TIMINGSAFE_BCMP], [test "x$ac_cv_func_timingsafe_bcmp" = xyes])
@@ -27,15 +124,15 @@ AM_CONDITIONAL([HAVE_TIMINGSAFE_MEMCMP], [test "x$ac_cv_func_timingsafe_memcmp"
# Override arc4random_buf implementations with known issues # Override arc4random_buf implementations with known issues
AM_CONDITIONAL([HAVE_ARC4RANDOM_BUF], AM_CONDITIONAL([HAVE_ARC4RANDOM_BUF],
[test "x$HOST_OS" != xdarwin \ [test "x$USE_BUILTIN_ARC4RANDOM" != xyes \
-a "x$HOST_OS" != xfreebsd \
-a "x$HOST_OS" != xnetbsd \
-a "x$ac_cv_func_arc4random_buf" = xyes]) -a "x$ac_cv_func_arc4random_buf" = xyes])
# Check for getentropy fallback dependencies # Check for getentropy fallback dependencies
AC_CHECK_FUNC([getauxval]) AC_CHECK_FUNC([getauxval])
AC_CHECK_FUNC([clock_gettime],, [AC_SEARCH_LIBS([clock_gettime],[rt posix4])]) AC_SEARCH_LIBS([clock_gettime],[rt posix4])
AC_CHECK_FUNC([dl_iterate_phdr],, [AC_SEARCH_LIBS([dl_iterate_phdr],[dl])]) AC_CHECK_FUNC([clock_gettime])
AC_SEARCH_LIBS([dl_iterate_phdr],[dl])
AC_CHECK_FUNC([dl_iterate_phdr])
]) ])
AC_DEFUN([CHECK_VA_COPY], [ AC_DEFUN([CHECK_VA_COPY], [

View File

@@ -1,7 +1,7 @@
# This must be called before AC_PROG_CC
AC_DEFUN([CHECK_OS_OPTIONS], [ AC_DEFUN([CHECK_OS_OPTIONS], [
CFLAGS="$CFLAGS -Wall -std=gnu99 -fno-strict-aliasing" CFLAGS="$CFLAGS -Wall -std=gnu99 -fno-strict-aliasing"
BUILD_NC=yes
case $host_os in case $host_os in
*aix*) *aix*)
@@ -13,14 +13,57 @@ case $host_os in
;; ;;
*cygwin*) *cygwin*)
HOST_OS=cygwin HOST_OS=cygwin
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
;; ;;
*darwin*) *darwin*)
HOST_OS=darwin HOST_OS=darwin
HOST_ABI=macosx HOST_ABI=macosx
#
# Don't use arc4random on systems before 10.12 because of
# weak seed on failure to open /dev/random, based on latest
# public source:
# http://www.opensource.apple.com/source/Libc/Libc-997.90.3/gen/FreeBSD/arc4random.c
#
# We use the presence of getentropy() to detect 10.12. The
# following check take into account that:
#
# - iOS <= 10.1 fails because of missing getentropy and
# hence they miss sys/random.h
#
# - in macOS 10.12 getentropy is not tagged as introduced in
# 10.12 so we cannot use it for target < 10.12
#
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <AvailabilityMacros.h>
#include <unistd.h>
#include <sys/random.h> /* Systems without getentropy() should die here */
/* Based on: https://gitweb.torproject.org/tor.git/commit/?id=16fcbd21 */
#ifndef MAC_OS_X_VERSION_10_12
# define MAC_OS_X_VERSION_10_12 101200
#endif
#if defined(MAC_OS_X_VERSION_MIN_REQUIRED)
# if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12
# error "Running on Mac OSX 10.11 or earlier"
# endif
#endif
]], [[
char buf[1]; getentropy(buf, 1);
]])],
[ USE_BUILTIN_ARC4RANDOM=no ],
[ USE_BUILTIN_ARC4RANDOM=yes ]
)
AC_MSG_CHECKING([whether to use builtin arc4random])
AC_MSG_RESULT([$USE_BUILTIN_ARC4RANDOM])
# Not available on iOS
AC_CHECK_HEADER([arpa/telnet.h], [], [BUILD_NC=no])
;; ;;
*freebsd*) *freebsd*)
HOST_OS=freebsd HOST_OS=freebsd
HOST_ABI=elf HOST_ABI=elf
# fork detection missing, weak seed on failure
# https://svnweb.freebsd.org/base/head/lib/libc/gen/arc4random.c?revision=268642&view=markup
USE_BUILTIN_ARC4RANDOM=yes
AC_SUBST([PROG_LDADD], ['-lthr']) AC_SUBST([PROG_LDADD], ['-lthr'])
;; ;;
*hpux*) *hpux*)
@@ -40,31 +83,47 @@ case $host_os in
;; ;;
*netbsd*) *netbsd*)
HOST_OS=netbsd HOST_OS=netbsd
HOST_ABI=elf
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/param.h>
#if __NetBSD_Version__ < 700000001
undefined
#endif
]], [[]])],
[ USE_BUILTIN_ARC4RANDOM=no ],
[ USE_BUILTIN_ARC4RANDOM=yes ]
)
CPPFLAGS="$CPPFLAGS -D_OPENBSD_SOURCE" CPPFLAGS="$CPPFLAGS -D_OPENBSD_SOURCE"
;; ;;
*openbsd* | *bitrig*) *openbsd* | *bitrig*)
HOST_OS=openbsd
HOST_ABI=elf HOST_ABI=elf
AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD gcc has bounded]) AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD gcc has bounded])
;; ;;
*mingw*) *mingw*)
HOST_OS=win HOST_OS=win
BUILD_NC=no
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE -D_POSIX -D_POSIX_SOURCE -D__USE_MINGW_ANSI_STDIO" CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE -D_POSIX -D_POSIX_SOURCE -D__USE_MINGW_ANSI_STDIO"
CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_THREAD_SAFE_FUNCTIONS" CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_THREAD_SAFE_FUNCTIONS"
CPPFLAGS="$CPPFLAGS -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0501" CPPFLAGS="$CPPFLAGS -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0501"
CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_SPEED" CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_SPEED"
CFLAGS="$CFLAGS -static-libgcc"
LDFLAGS="$LDFLAGS -static-libgcc"
AC_SUBST([PLATFORM_LDADD], ['-lws2_32']) AC_SUBST([PLATFORM_LDADD], ['-lws2_32'])
;; ;;
*solaris*) *solaris*)
HOST_OS=solaris HOST_OS=solaris
HOST_ABI=elf HOST_ABI=elf
CFLAGS="$CFLAGS -m64"
CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__ -D_XOPEN_SOURCE=600 -DBSD_COMP" CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__ -D_XOPEN_SOURCE=600 -DBSD_COMP"
AC_SUBST([PLATFORM_LDADD], ['-lnsl -lsocket']) AC_SUBST([PLATFORM_LDADD], ['-lnsl -lsocket'])
;; ;;
*) ;; *) ;;
esac esac
AC_ARG_ENABLE([nc],
AS_HELP_STRING([--enable-nc], [Enable installing TLS-enabled nc(1)]))
AM_CONDITIONAL([ENABLE_NC], [test "x$enable_nc" = xyes])
AM_CONDITIONAL([BUILD_NC], [test x$BUILD_NC = xyes -o "x$enable_nc" = xyes])
AM_CONDITIONAL([HOST_AIX], [test x$HOST_OS = xaix]) AM_CONDITIONAL([HOST_AIX], [test x$HOST_OS = xaix])
AM_CONDITIONAL([HOST_CYGWIN], [test x$HOST_OS = xcygwin]) AM_CONDITIONAL([HOST_CYGWIN], [test x$HOST_OS = xcygwin])
AM_CONDITIONAL([HOST_DARWIN], [test x$HOST_OS = xdarwin]) AM_CONDITIONAL([HOST_DARWIN], [test x$HOST_OS = xdarwin])
@@ -72,6 +131,7 @@ AM_CONDITIONAL([HOST_FREEBSD], [test x$HOST_OS = xfreebsd])
AM_CONDITIONAL([HOST_HPUX], [test x$HOST_OS = xhpux]) AM_CONDITIONAL([HOST_HPUX], [test x$HOST_OS = xhpux])
AM_CONDITIONAL([HOST_LINUX], [test x$HOST_OS = xlinux]) AM_CONDITIONAL([HOST_LINUX], [test x$HOST_OS = xlinux])
AM_CONDITIONAL([HOST_NETBSD], [test x$HOST_OS = xnetbsd]) AM_CONDITIONAL([HOST_NETBSD], [test x$HOST_OS = xnetbsd])
AM_CONDITIONAL([HOST_OPENBSD], [test x$HOST_OS = xopenbsd])
AM_CONDITIONAL([HOST_SOLARIS], [test x$HOST_OS = xsolaris]) AM_CONDITIONAL([HOST_SOLARIS], [test x$HOST_OS = xsolaris])
AM_CONDITIONAL([HOST_WIN], [test x$HOST_OS = xwin]) AM_CONDITIONAL([HOST_WIN], [test x$HOST_OS = xwin])
]) ])

11
man/CMakeLists.txt Normal file
View File

@@ -0,0 +1,11 @@
if(ENABLE_LIBRESSL_INSTALL)
install(DIRECTORY .
DESTINATION ${CMAKE_INSTALL_MANDIR}/man3
FILES_MATCHING PATTERN "*.3"
)
install(DIRECTORY .
DESTINATION ${CMAKE_INSTALL_MANDIR}/man5
FILES_MATCHING PATTERN "*.5"
)
endif(ENABLE_LIBRESSL_INSTALL)

1290
man/links

File diff suppressed because it is too large Load Diff

View File

@@ -1,18 +1,19 @@
#!/bin/sh #!/bin/sh
# Run this periodically to ensure that the manpage links are up to date # Run this periodically to ensure that the manpage links are up to date
(
cd /usr/src/usr.bin/mandoc/
make obj
make cleandir
make depend
make
cd /usr/src/regress/usr.bin/mandoc/db/mlinks/
make obj
make cleandir
make
)
makewhatis -a .
echo "# This is an auto-generated file by $0" > links echo "# This is an auto-generated file by $0" > links
sudo makewhatis /usr/src/regress/usr.bin/mandoc/db/mlinks/obj/mlinks mandoc.db | sort >> links
for i in `ls -1 *.3`; do
name=`echo $i|cut -d. -f1`
links=`sqlite3 /usr/share/man/mandoc.db \
"select names.name from mlinks,names where mlinks.name='$name' and mlinks.pageid=names.pageid;"`
for j in $links; do
a=`echo "x$j" | tr '[:upper:]' '[:lower:]'`
b=`echo "x$name" | tr '[:upper:]' '[:lower:]'`
if [ $a != $b ]; then
echo $name.3,$j.3 >> links
fi
done
done

15
patches/aeadtest.c.patch Normal file
View File

@@ -0,0 +1,15 @@
--- tests/aeadtest.c.orig 2016-10-18 17:03:33.845870889 +0900
+++ tests/aeadtest.c 2016-10-18 17:11:19.880841283 +0900
@@ -75,6 +75,12 @@
#define BUF_MAX 1024
+#ifdef _MSC_VER
+#ifdef IN
+#undef IN
+#endif
+#endif
+
/* These are the different types of line that are found in the input file. */
enum {
AEAD = 0, /* name of the AEAD algorithm. */

View File

@@ -1,15 +0,0 @@
--- crypto/compat/arc4random.c.orig 2015-07-20 07:41:17.000000000 -0600
+++ crypto/compat/arc4random.c 2015-07-20 07:41:58.000000000 -0600
@@ -36,8 +36,11 @@
#define KEYSTREAM_ONLY
#include "chacha_private.h"
+#ifndef min
#define min(a, b) ((a) < (b) ? (a) : (b))
-#ifdef __GNUC__
+#endif
+
+#if defined(__GNUC__) || defined(_MSC_VER)
#define inline __inline
#else /* !__GNUC__ */
#define inline

36
patches/bio.h.patch Normal file
View File

@@ -0,0 +1,36 @@
--- include/openssl/bio.h.orig Mon Oct 3 06:09:28 2016
+++ include/openssl/bio.h Sun Nov 6 04:24:57 2016
@@ -678,8 +678,24 @@
/*long BIO_ghbn_ctrl(int cmd,int iarg,char *parg);*/
+#ifdef __MINGW_PRINTF_FORMAT
int
BIO_printf(BIO *bio, const char *format, ...)
+ __attribute__((__format__(__MINGW_PRINTF_FORMAT, 2, 3), __nonnull__(2)));
+int
+BIO_vprintf(BIO *bio, const char *format, va_list args)
+ __attribute__((__format__(__MINGW_PRINTF_FORMAT, 2, 0), __nonnull__(2)));
+int
+BIO_snprintf(char *buf, size_t n, const char *format, ...)
+ __attribute__((__deprecated__, __format__(__MINGW_PRINTF_FORMAT, 3, 4),
+ __nonnull__(3)));
+int
+BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args)
+ __attribute__((__deprecated__, __format__(__MINGW_PRINTF_FORMAT, 3, 0),
+ __nonnull__(3)));
+#else
+int
+BIO_printf(BIO *bio, const char *format, ...)
__attribute__((__format__(__printf__, 2, 3), __nonnull__(2)));
int
BIO_vprintf(BIO *bio, const char *format, va_list args)
@@ -692,6 +708,8 @@
BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args)
__attribute__((__deprecated__, __format__(__printf__, 3, 0),
__nonnull__(3)));
+#endif
+
/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes

12
patches/http.c.patch Normal file
View File

@@ -0,0 +1,12 @@
--- apps/ocspcheck/http.c.orig Sun Jun 4 00:45:29 2017
+++ apps/ocspcheck/http.c Sun Jun 4 00:45:57 2017
@@ -35,7 +35,9 @@
#include "http.h"
#include <tls.h>
+#ifndef DEFAULT_CA_FILE
#define DEFAULT_CA_FILE "/etc/ssl/cert.pem"
+#endif
/*
* A buffer for transferring HTTP/S data.

21
patches/modes_lcl.h Normal file
View File

@@ -0,0 +1,21 @@
--- openbsd/src/lib/libssl/src/crypto/modes/modes_lcl.h Sat Dec 6 17:15:50 2014
+++ crypto/modes/modes_lcl.h Sun Jul 17 17:45:27 2016
@@ -43,14 +43,16 @@
asm ("bswapl %0" \
: "+r"(ret)); ret; })
# elif (defined(__arm__) || defined(__arm)) && !defined(__STRICT_ALIGNMENT)
-# define BSWAP8(x) ({ u32 lo=(u64)(x)>>32,hi=(x); \
+# if (__ARM_ARCH >= 6)
+# define BSWAP8(x) ({ u32 lo=(u64)(x)>>32,hi=(x); \
asm ("rev %0,%0; rev %1,%1" \
: "+r"(hi),"+r"(lo)); \
(u64)hi<<32|lo; })
-# define BSWAP4(x) ({ u32 ret; \
+# define BSWAP4(x) ({ u32 ret; \
asm ("rev %0,%1" \
: "=r"(ret) : "r"((u32)(x))); \
ret; })
+# endif
# endif
#endif
#endif

189
patches/netcat.c.patch Normal file
View File

@@ -0,0 +1,189 @@
--- apps/nc/netcat.c.orig Mon Jul 17 06:06:51 2017
+++ apps/nc/netcat.c Mon Jul 17 06:11:24 2017
@@ -66,7 +66,9 @@
#define POLL_NETIN 2
#define POLL_STDOUT 3
#define BUFSIZE 16384
+#ifndef DEFAULT_CA_FILE
#define DEFAULT_CA_FILE "/etc/ssl/cert.pem"
+#endif
#define TLS_ALL (1 << 1)
#define TLS_NOVERIFY (1 << 2)
@@ -95,9 +97,13 @@
int Dflag; /* sodebug */
int Iflag; /* TCP receive buffer size */
int Oflag; /* TCP send buffer size */
+#ifdef TCP_MD5SIG
int Sflag; /* TCP MD5 signature option */
+#endif
int Tflag = -1; /* IP Type of Service */
+#ifdef SO_RTABLE
int rtableid = -1;
+#endif
int usetls; /* use TLS */
char *Cflag; /* Public cert file */
@@ -266,12 +272,14 @@
case 'u':
uflag = 1;
break;
+#ifdef SO_RTABLE
case 'V':
rtableid = (int)strtonum(optarg, 0,
RT_TABLEID_MAX, &errstr);
if (errstr)
errx(1, "rtable %s: %s", errstr, optarg);
break;
+#endif
case 'v':
vflag = 1;
break;
@@ -318,9 +326,11 @@
case 'o':
oflag = optarg;
break;
+#ifdef TCP_MD5SIG
case 'S':
Sflag = 1;
break;
+#endif
case 'T':
errstr = NULL;
errno = 0;
@@ -344,9 +354,11 @@
argc -= optind;
argv += optind;
+#ifdef SO_RTABLE
if (rtableid >= 0)
if (setrtable(rtableid) == -1)
err(1, "setrtable");
+#endif
if (family == AF_UNIX) {
if (pledge("stdio rpath wpath cpath tmppath unix", NULL) == -1)
@@ -892,7 +904,10 @@
remote_connect(const char *host, const char *port, struct addrinfo hints)
{
struct addrinfo *res, *res0;
- int s = -1, error, on = 1, save_errno;
+ int s = -1, error, save_errno;
+#ifdef SO_BINDANY
+ int on = 1;
+#endif
if ((error = getaddrinfo(host, port, &hints, &res0)))
errx(1, "getaddrinfo for host \"%s\" port %s: %s", host,
@@ -907,8 +922,10 @@
if (sflag || pflag) {
struct addrinfo ahints, *ares;
+#ifdef SO_BINDANY
/* try SO_BINDANY, but don't insist */
setsockopt(s, SOL_SOCKET, SO_BINDANY, &on, sizeof(on));
+#endif
memset(&ahints, 0, sizeof(struct addrinfo));
ahints.ai_family = res->ai_family;
ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM;
@@ -979,7 +996,10 @@
local_listen(char *host, char *port, struct addrinfo hints)
{
struct addrinfo *res, *res0;
- int s = -1, ret, x = 1, save_errno;
+ int s = -1, save_errno;
+#ifdef SO_REUSEPORT
+ int ret, x = 1;
+#endif
int error;
/* Allow nodename to be null. */
@@ -1000,9 +1020,11 @@
res->ai_protocol)) < 0)
continue;
+#ifdef SO_REUSEPORT
ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x));
if (ret == -1)
err(1, NULL);
+#endif
set_common_sockopts(s, res->ai_family);
@@ -1458,11 +1480,13 @@
{
int x = 1;
+#ifdef TCP_MD5SIG
if (Sflag) {
if (setsockopt(s, IPPROTO_TCP, TCP_MD5SIG,
&x, sizeof(x)) == -1)
err(1, NULL);
}
+#endif
if (Dflag) {
if (setsockopt(s, SOL_SOCKET, SO_DEBUG,
&x, sizeof(x)) == -1)
@@ -1473,9 +1497,16 @@
IP_TOS, &Tflag, sizeof(Tflag)) == -1)
err(1, "set IP ToS");
+#ifdef IPV6_TCLASS
else if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6,
IPV6_TCLASS, &Tflag, sizeof(Tflag)) == -1)
err(1, "set IPv6 traffic class");
+#else
+ else if (af == AF_INET6) {
+ errno = ENOPROTOOPT;
+ err(1, "set IPv6 traffic class not supported");
+ }
+#endif
}
if (Iflag) {
if (setsockopt(s, SOL_SOCKET, SO_RCVBUF,
@@ -1499,13 +1530,17 @@
}
if (minttl != -1) {
+#ifdef IP_MINTTL
if (af == AF_INET && setsockopt(s, IPPROTO_IP,
IP_MINTTL, &minttl, sizeof(minttl)))
err(1, "set IP min TTL");
+#endif
- else if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6,
+#ifdef IPV6_MINHOPCOUNT
+ if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6,
IPV6_MINHOPCOUNT, &minttl, sizeof(minttl)))
err(1, "set IPv6 min hop count");
+#endif
}
}
@@ -1714,14 +1749,22 @@
\t-P proxyuser\tUsername for proxy authentication\n\
\t-p port\t Specify local port for remote connects\n\
\t-R CAfile CA bundle\n\
- \t-r Randomize remote ports\n\
- \t-S Enable the TCP MD5 signature option\n\
+ \t-r Randomize remote ports\n"
+#ifdef TCP_MD5SIG
+ "\
+ \t-S Enable the TCP MD5 signature option\n"
+#endif
+ "\
\t-s source Local source address\n\
\t-T keyword TOS value or TLS options\n\
\t-t Answer TELNET negotiation\n\
\t-U Use UNIX domain socket\n\
- \t-u UDP mode\n\
- \t-V rtable Specify alternate routing table\n\
+ \t-u UDP mode\n"
+#ifdef SO_RTABLE
+ "\
+ \t-V rtable Specify alternate routing table\n"
+#endif
+ "\
\t-v Verbose\n\
\t-W recvlimit Terminate after receiving a number of packets\n\
\t-w timeout Timeout for connects and final net reads\n\

14
patches/ocsp_test.c.patch Normal file
View File

@@ -0,0 +1,14 @@
--- tests/ocsp_test.c.orig 2016-10-18 18:12:39.854607509 +0900
+++ tests/ocsp_test.c 2016-10-18 18:14:29.261600559 +0900
@@ -16,6 +16,11 @@
hints.ai_family = AF_INET;
hints.ai_socktype = SOCK_STREAM;
+#ifdef _MSC_VER
+ if (BIO_sock_init() != 1)
+ exit(-1);
+#endif
+
error = getaddrinfo(host, port, &hints, &res);
if (error != 0) {
perror("getaddrinfo()");

View File

@@ -1,26 +1,6 @@
--- apps/openssl.c.orig 2015-07-20 02:01:42.000000000 -0600 --- apps/openssl/openssl.c.orig Fri Nov 4 09:33:19 2016
+++ apps/openssl.c 2015-07-20 02:02:00.000000000 -0600 +++ apps/openssl/openssl.c Sat Nov 5 15:28:35 2016
@@ -130,6 +130,19 @@ @@ -396,7 +396,9 @@
#include <openssl/engine.h>
#endif
+#ifdef _WIN32
+#include <io.h>
+#include <fcntl.h>
+static void set_stdio_binary(void)
+{
+ _setmode(_fileno(stdin), _O_BINARY);
+ _setmode(_fileno(stdout), _O_BINARY);
+ _setmode(_fileno(stderr), _O_BINARY);
+}
+#else
+static void set_stdio_binary(void) {};
+#endif
+
#include "progs.h"
#include "s_apps.h"
@@ -204,7 +216,9 @@
static void static void
openssl_startup(void) openssl_startup(void)
{ {
@@ -28,13 +8,5 @@
signal(SIGPIPE, SIG_IGN); signal(SIGPIPE, SIG_IGN);
+#endif +#endif
CRYPTO_malloc_init();
OpenSSL_add_all_algorithms(); OpenSSL_add_all_algorithms();
@@ -216,6 +230,7 @@ SSL_library_init();
#endif
setup_ui_method();
+ set_stdio_binary();
}
static void

View File

@@ -1,13 +0,0 @@
--- include/openssl/opensslconf.h.orig 2015-07-19 23:21:47.000000000 -0600
+++ include/openssl/opensslconf.h 2015-07-19 23:21:17.000000000 -0600
@@ -1,6 +1,10 @@
#include <openssl/opensslfeatures.h>
/* crypto/opensslconf.h.in */
+#if defined(_MSC_VER) && !defined(__attribute__)
+#define __attribute__(a)
+#endif
+
/* Generate 80386 code? */
#undef I386_ONLY

View File

@@ -1,25 +0,0 @@
--- include/openssl/ossl_typ.h.orig 2015-07-06 13:21:18.788571423 -0700
+++ include/openssl/ossl_typ.h 2015-07-06 13:24:14.906468003 -0700
@@ -100,6 +100,22 @@
typedef struct ASN1_ITEM_st ASN1_ITEM;
typedef struct asn1_pctx_st ASN1_PCTX;
+#if defined(_WIN32) && defined(__WINCRYPT_H__)
+#ifndef LIBRESSL_INTERNAL
+#ifdef _MSC_VER
+#pragma message("Warning, overriding WinCrypt defines")
+#else
+#warning overriding WinCrypt defines
+#endif
+#endif
+#undef X509_NAME
+#undef X509_CERT_PAIR
+#undef X509_EXTENSIONS
+#undef OCSP_REQUEST
+#undef OCSP_RESPONSE
+#undef PKCS7_ISSUER_AND_SERIAL
+#endif
+
#ifdef BIGNUM
#undef BIGNUM
#endif

View File

@@ -1,21 +0,0 @@
--- include/openssl/pkcs7.h.orig 2015-07-06 13:26:27.369203527 -0700
+++ include/openssl/pkcs7.h 2015-07-06 13:27:37.637051967 -0700
@@ -69,6 +69,18 @@
extern "C" {
#endif
+#if defined(_WIN32) && defined(__WINCRYPT_H__)
+#ifndef LIBRESSL_INTERNAL
+#ifdef _MSC_VER
+#pragma message("Warning, overriding WinCrypt defines")
+#else
+#warning overriding WinCrypt defines
+#endif
+#endif
+#undef PKCS7_ISSUER_AND_SERIAL
+#undef PKCS7_SIGNER_INFO
+#endif
+
/*
Encryption_ID DES-CBC
Digest_ID MD5

82
patches/rfc5280.c.patch Normal file
View File

@@ -0,0 +1,82 @@
--- tests/rfc5280time.c.orig Mon Nov 2 20:00:31 2015
+++ tests/rfc5280time.c Mon Nov 2 20:03:12 2015
@@ -91,6 +91,7 @@
.data = "20150923032700Z",
.time = 1442978820,
},
+#if SIZEOF_TIME_T == 8
{
/* (times before 2050 must be UTCTIME) Per RFC 5280 4.1.2.5 */
.str = "00000101000000Z",
@@ -103,6 +104,7 @@
.data = "20491231235959Z",
.time = 2524607999LL,
},
+#endif
{
/* (times before 2050 must be UTCTIME) Per RFC 5280 4.1.2.5 */
.str = "19500101000000Z",
@@ -112,6 +114,7 @@
};
struct rfc5280_time_test rfc5280_gentime_tests[] = {
+#if SIZEOF_TIME_T == 8
{
/* Biggest RFC 5280 time */
.str = "99991231235959Z",
@@ -129,6 +132,7 @@
.data = "20500101000000Z",
.time = 2524608000LL,
},
+#endif
};
struct rfc5280_time_test rfc5280_utctime_tests[] = {
{
@@ -141,11 +145,13 @@
.data = "540226230640Z",
.time = -500000000,
},
+#if SIZEOF_TIME_T == 8
{
.str = "491231235959Z",
.data = "491231235959Z",
.time = 2524607999LL,
},
+#endif
{
.str = "700101000000Z",
.data = "700101000000Z",
@@ -273,14 +279,14 @@
if ((i = X509_cmp_time(gt, &att->time)) != -1) {
fprintf(stderr, "FAIL: test %i - X509_cmp_time failed - returned %d compared to %lld\n",
- test_no, i, att->time);
+ test_no, i, (long long)att->time);
goto done;
}
att->time--;
if ((i = X509_cmp_time(gt, &att->time)) != 1) {
fprintf(stderr, "FAIL: test %i - X509_cmp_time failed - returned %d compared to %lld\n",
- test_no, i, att->time);
+ test_no, i, (long long)att->time);
goto done;
}
att->time++;
@@ -325,14 +331,14 @@
if ((i = X509_cmp_time(ut, &att->time)) != -1) {
fprintf(stderr, "FAIL: test %i - X509_cmp_time failed - returned %d compared to %lld\n",
- test_no, i, att->time);
+ test_no, i, (long long)att->time);
goto done;
}
att->time--;
if ((i = X509_cmp_time(ut, &att->time)) != 1) {
fprintf(stderr, "FAIL: test %i - X509_cmp_time failed - returned %d compared to %lld\n",
- test_no, i, att->time);
+ test_no, i, (long long)att->time);
goto done;
}
att->time++;

19
patches/ssl_txt.c.patch Normal file
View File

@@ -0,0 +1,19 @@
--- ssl/ssl_txt.orig Sun Jul 17 17:26:59 2016
+++ ssl/ssl_txt.c Sun Jul 17 17:35:44 2016
@@ -82,6 +82,7 @@
* OTHERWISE.
*/
+#include <inttypes.h>
#include <stdio.h>
#include <openssl/buffer.h>
@@ -163,7 +164,7 @@
}
if (x->time != 0) {
- if (BIO_printf(bp, "\n Start Time: %lld", (long long)x->time) <= 0)
+ if (BIO_printf(bp, "\n Start Time: %"PRId64, (int64_t)x->time) <= 0)
goto err;
}
if (x->timeout != 0L) {

32
patches/tls.h.patch Normal file
View File

@@ -0,0 +1,32 @@
--- include/tls.h.orig 2017-02-13 20:19:55.918636579 +0900
+++ include/tls.h 2017-02-13 20:21:18.313073161 +0900
@@ -22,6 +22,13 @@
extern "C" {
#endif
+#ifdef _MSC_VER
+#ifndef LIBRESSL_INTERNAL
+#include <basetsd.h>
+typedef SSIZE_T ssize_t;
+#endif
+#endif
+
#include <sys/types.h>
#include <stddef.h>
--- libtls-standalone/include/tls.h.orig 2017-02-13 20:21:48.297958529 +0900
+++ libtls-standalone/include/tls.h 2017-02-13 20:21:48.296958502 +0900
@@ -22,6 +22,13 @@
extern "C" {
#endif
+#ifdef _MSC_VER
+#ifndef LIBRESSL_INTERNAL
+#include <basetsd.h>
+typedef SSIZE_T ssize_t;
+#endif
+#endif
+
#include <sys/types.h>
#include <stddef.h>

View File

@@ -0,0 +1,12 @@
--- tls/tls_internal.h.orig Sun Jul 9 06:16:17 2017
+++ tls/tls_internal.h Mon Jul 17 06:10:01 2017
@@ -26,7 +26,9 @@
__BEGIN_HIDDEN_DECLS
+#ifndef _PATH_SSL_CA_FILE
#define _PATH_SSL_CA_FILE "/etc/ssl/cert.pem"
+#endif
#define TLS_CIPHERS_DEFAULT "TLSv1.2+AEAD+ECDHE:TLSv1.2+AEAD+DHE"
#define TLS_CIPHERS_COMPAT "HIGH:!aNULL"

111
patches/tlsexttest.c.patch Normal file
View File

@@ -0,0 +1,111 @@
--- tests/tlsexttest.c.orig 2017-12-30 20:03:09.279079726 +0900
+++ tests/tlsexttest.c 2017-12-30 20:07:21.849939140 +0900
@@ -1676,7 +1676,9 @@ static unsigned char tlsext_sni_clienthe
};
static unsigned char tlsext_sni_serverhello[] = {
+ 0x00
};
+const size_t sizeof_tlsext_sni_serverhello = 0;
static int
test_tlsext_sni_clienthello(void)
@@ -1839,9 +1841,9 @@ test_tlsext_sni_serverhello(void)
if (!CBB_finish(&cbb, &data, &dlen))
errx(1, "failed to finish CBB");
- if (dlen != sizeof(tlsext_sni_serverhello)) {
+ if (dlen != sizeof_tlsext_sni_serverhello) {
FAIL("got serverhello SNI with length %zu, "
- "want length %zu\n", dlen, sizeof(tlsext_sni_serverhello));
+ "want length %zu\n", dlen, sizeof_tlsext_sni_serverhello);
goto err;
}
@@ -1850,14 +1852,14 @@ test_tlsext_sni_serverhello(void)
fprintf(stderr, "received:\n");
hexdump(data, dlen);
fprintf(stderr, "test data:\n");
- hexdump(tlsext_sni_serverhello, sizeof(tlsext_sni_serverhello));
+ hexdump(tlsext_sni_serverhello, sizeof_tlsext_sni_serverhello);
goto err;
}
free(ssl->session->tlsext_hostname);
ssl->session->tlsext_hostname = NULL;
- CBS_init(&cbs, tlsext_sni_serverhello, sizeof(tlsext_sni_serverhello));
+ CBS_init(&cbs, tlsext_sni_serverhello, sizeof_tlsext_sni_serverhello);
if (!tlsext_sni_serverhello_parse(ssl, &cbs, &alert)) {
FAIL("failed to parse serverhello SNI\n");
goto err;
@@ -2741,7 +2743,10 @@ unsigned char tlsext_clienthello_default
0x03, 0x01, 0x03, 0x03, 0x02, 0x01, 0x02, 0x03,
};
-unsigned char tlsext_clienthello_disabled[] = {};
+unsigned char tlsext_clienthello_disabled[] = {
+ 0x00
+};
+const size_t sizeof_tlsext_clienthello_disabled = 0;
static int
test_tlsext_clienthello_build(void)
@@ -2806,18 +2811,18 @@ test_tlsext_clienthello_build(void)
if (!CBB_finish(&cbb, &data, &dlen))
errx(1, "failed to finish CBB");
- if (dlen != sizeof(tlsext_clienthello_disabled)) {
+ if (dlen != sizeof_tlsext_clienthello_disabled) {
FAIL("got clienthello extensions with length %zu, "
"want length %zu\n", dlen,
- sizeof(tlsext_clienthello_disabled));
+ sizeof_tlsext_clienthello_disabled);
compare_data(data, dlen, tlsext_clienthello_disabled,
- sizeof(tlsext_clienthello_disabled));
+ sizeof_tlsext_clienthello_disabled);
goto err;
}
if (memcmp(data, tlsext_clienthello_disabled, dlen) != 0) {
FAIL("clienthello extensions differs:\n");
compare_data(data, dlen, tlsext_clienthello_disabled,
- sizeof(tlsext_clienthello_disabled));
+ sizeof_tlsext_clienthello_disabled);
goto err;
}
@@ -2832,7 +2837,10 @@ test_tlsext_clienthello_build(void)
return (failure);
}
-unsigned char tlsext_serverhello_default[] = {};
+unsigned char tlsext_serverhello_default[] = {
+ 0x00
+};
+const size_t sizeof_tlsext_serverhello_default = 0;
unsigned char tlsext_serverhello_enabled[] = {
0x00, 0x13, 0xff, 0x01, 0x00, 0x01, 0x00, 0x00,
@@ -2872,18 +2880,18 @@ test_tlsext_serverhello_build(void)
if (!CBB_finish(&cbb, &data, &dlen))
errx(1, "failed to finish CBB");
- if (dlen != sizeof(tlsext_serverhello_default)) {
+ if (dlen != sizeof_tlsext_serverhello_default) {
FAIL("got serverhello extensions with length %zu, "
"want length %zu\n", dlen,
- sizeof(tlsext_serverhello_default));
+ sizeof_tlsext_serverhello_default);
compare_data(data, dlen, tlsext_serverhello_default,
- sizeof(tlsext_serverhello_default));
+ sizeof_tlsext_serverhello_default);
goto err;
}
if (memcmp(data, tlsext_serverhello_default, dlen) != 0) {
FAIL("serverhello extensions differs:\n");
compare_data(data, dlen, tlsext_serverhello_default,
- sizeof(tlsext_serverhello_default));
+ sizeof_tlsext_serverhello_default);
goto err;
}

View File

@@ -0,0 +1,99 @@
diff -u include/openssl.orig/dtls1.h include/openssl/dtls1.h
--- include/openssl.orig/dtls1.h Mon Dec 7 07:58:32 2015
+++ include/openssl/dtls1.h Mon Dec 7 07:56:14 2015
@@ -60,7 +60,11 @@
#ifndef HEADER_DTLS1_H
#define HEADER_DTLS1_H
+#if defined(_WIN32)
+#include <winsock2.h>
+#else
#include <sys/time.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
--- include/openssl/opensslconf.h.orig Sat Nov 5 08:36:25 2016
+++ include/openssl/opensslconf.h Mon Jul 17 06:06:58 2017
@@ -1,6 +1,10 @@
#include <openssl/opensslfeatures.h>
/* crypto/opensslconf.h.in */
+#if defined(_MSC_VER) && !defined(__attribute__)
+#define __attribute__(a)
+#endif
+
#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
#define OPENSSLDIR "/etc/ssl"
#endif
diff -u include/openssl.orig/ossl_typ.h include/openssl/ossl_typ.h
--- include/openssl.orig/ossl_typ.h Mon Dec 7 07:58:32 2015
+++ include/openssl/ossl_typ.h Mon Dec 7 07:56:14 2015
@@ -80,6 +80,22 @@
typedef struct ASN1_ITEM_st ASN1_ITEM;
typedef struct asn1_pctx_st ASN1_PCTX;
+#if defined(_WIN32) && defined(__WINCRYPT_H__)
+#ifndef LIBRESSL_INTERNAL
+#ifdef _MSC_VER
+#pragma message("Warning, overriding WinCrypt defines")
+#else
+#warning overriding WinCrypt defines
+#endif
+#endif
+#undef X509_NAME
+#undef X509_CERT_PAIR
+#undef X509_EXTENSIONS
+#undef OCSP_REQUEST
+#undef OCSP_RESPONSE
+#undef PKCS7_ISSUER_AND_SERIAL
+#endif
+
#ifdef BIGNUM
#undef BIGNUM
#endif
diff -u include/openssl.orig/pkcs7.h include/openssl/pkcs7.h
--- include/openssl.orig/pkcs7.h Mon Dec 7 07:58:32 2015
+++ include/openssl/pkcs7.h Mon Dec 7 07:56:14 2015
@@ -69,6 +69,18 @@
extern "C" {
#endif
+#if defined(_WIN32) && defined(__WINCRYPT_H__)
+#ifndef LIBRESSL_INTERNAL
+#ifdef _MSC_VER
+#pragma message("Warning, overriding WinCrypt defines")
+#else
+#warning overriding WinCrypt defines
+#endif
+#endif
+#undef PKCS7_ISSUER_AND_SERIAL
+#undef PKCS7_SIGNER_INFO
+#endif
+
/*
Encryption_ID DES-CBC
Digest_ID MD5
diff -u include/openssl.orig/x509.h include/openssl/x509.h
--- include/openssl.orig/x509.h Mon Dec 7 07:58:32 2015
+++ include/openssl/x509.h Mon Dec 7 07:56:14 2015
@@ -112,6 +112,19 @@
extern "C" {
#endif
+#if defined(_WIN32)
+#ifndef LIBRESSL_INTERNAL
+#ifdef _MSC_VER
+#pragma message("Warning, overriding WinCrypt defines")
+#else
+#warning overriding WinCrypt defines
+#endif
+#endif
+#undef X509_NAME
+#undef X509_CERT_PAIR
+#undef X509_EXTENSIONS
+#endif
+
#define X509_FILETYPE_PEM 1
#define X509_FILETYPE_ASN1 2
#define X509_FILETYPE_DEFAULT 3

View File

@@ -1,22 +0,0 @@
--- include/openssl/x509.h.orig 2015-07-06 13:15:15.059306046 -0700
+++ include/openssl/x509.h 2015-07-06 13:16:10.506118278 -0700
@@ -112,6 +112,19 @@
extern "C" {
#endif
+#if defined(_WIN32)
+#ifndef LIBRESSL_INTERNAL
+#ifdef _MSC_VER
+#pragma message("Warning, overriding WinCrypt defines")
+#else
+#warning overriding WinCrypt defines
+#endif
+#endif
+#undef X509_NAME
+#undef X509_CERT_PAIR
+#undef X509_EXTENSIONS
+#endif
+
#define X509_FILETYPE_PEM 1
#define X509_FILETYPE_ASN1 2
#define X509_FILETYPE_DEFAULT 3

1447
scripts/config.guess vendored Normal file

File diff suppressed because it is too large Load Diff

1813
scripts/config.sub vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -4,12 +4,28 @@ set -e
./autogen.sh ./autogen.sh
if [ "x$ARCH" = "xnative" ]; then if [ "x$ARCH" = "xnative" ]; then
# test autotools
./configure ./configure
make -j 4 distcheck
# make distribution
make dist
tar zxvf libressl-*.tar.gz
cd libressl-*
mkdir build
cd build
# test cmake and ninja
if [ `uname` = "Darwin" ]; then if [ `uname` = "Darwin" ]; then
# OS X runs out of resources if we run 'make -j check' cmake ..
make check make
make test
else else
make -j distcheck sudo apt-get update
sudo apt-get install -y cmake ninja-build
cmake -GNinja ..
ninja
ninja test
fi fi
else else
CPU=i686 CPU=i686
@@ -19,12 +35,8 @@ else
export CC=$CPU-w64-mingw32-gcc export CC=$CPU-w64-mingw32-gcc
if [ -z $(which $CC) ]; then if [ -z $(which $CC) ]; then
# Update Ubuntu 12.04 with current mingw toolchain
sudo apt-get update sudo apt-get update
sudo apt-get install -y python-software-properties sudo apt-get install -y mingw-w64 make
sudo apt-add-repository -y ppa:tobydox/mingw-x-precise
sudo apt-get update
sudo apt-get install -y $ARCH-x-gcc make
export PATH=$PATH:/opt/$ARCH/bin export PATH=$PATH:/opt/$ARCH/bin
fi fi

View File

@@ -4,9 +4,8 @@ include_directories(
../include/compat ../include/compat
) )
add_library( set(
ssl SSL_SRC
bio_ssl.c bio_ssl.c
bs_ber.c bs_ber.c
bs_cbb.c bs_cbb.c
@@ -20,34 +19,54 @@ add_library(
d1_srtp.c d1_srtp.c
d1_srvr.c d1_srvr.c
pqueue.c pqueue.c
s23_clnt.c
s23_lib.c
s23_meth.c
s23_pkt.c
s23_srvr.c
s3_both.c
s3_cbc.c s3_cbc.c
s3_clnt.c
s3_enc.c
s3_lib.c s3_lib.c
s3_meth.c
s3_pkt.c
s3_srvr.c
ssl_algs.c ssl_algs.c
ssl_asn1.c ssl_asn1.c
ssl_both.c
ssl_cert.c ssl_cert.c
ssl_ciph.c ssl_ciph.c
ssl_clnt.c
ssl_err.c ssl_err.c
ssl_err2.c
ssl_lib.c ssl_lib.c
ssl_packet.c
ssl_pkt.c
ssl_rsa.c ssl_rsa.c
ssl_sess.c ssl_sess.c
ssl_srvr.c
ssl_stat.c ssl_stat.c
ssl_tlsext.c
ssl_txt.c ssl_txt.c
ssl_versions.c
t1_clnt.c t1_clnt.c
t1_enc.c t1_enc.c
t1_hash.c
t1_lib.c t1_lib.c
t1_meth.c t1_meth.c
t1_reneg.c
t1_srvr.c t1_srvr.c
) )
add_library(ssl-objects OBJECT ${SSL_SRC})
if (BUILD_SHARED)
add_library(ssl STATIC $<TARGET_OBJECTS:ssl-objects>)
add_library(ssl-shared SHARED $<TARGET_OBJECTS:ssl-objects>)
export_symbol(ssl-shared ${CMAKE_CURRENT_SOURCE_DIR}/ssl.sym)
target_link_libraries(ssl-shared crypto-shared)
if (WIN32)
target_link_libraries(ssl-shared Ws2_32.lib)
set(SSL_POSTFIX -${SSL_MAJOR_VERSION})
endif()
set_target_properties(ssl-shared PROPERTIES
OUTPUT_NAME ssl${SSL_POSTFIX}
ARCHIVE_OUTPUT_NAME ssl${SSL_POSTFIX})
set_target_properties(ssl-shared PROPERTIES VERSION ${SSL_VERSION}
SOVERSION ${SSL_MAJOR_VERSION})
if(ENABLE_LIBRESSL_INSTALL)
install(TARGETS ssl ssl-shared DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(ENABLE_LIBRESSL_INSTALL)
else()
add_library(ssl STATIC ${SSL_SRC})
if(ENABLE_LIBRESSL_INSTALL)
install(TARGETS ssl DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(ENABLE_LIBRESSL_INSTALL)
endif()

Some files were not shown because too many files have changed in this diff Show More