Compare commits

...

395 Commits

Author SHA1 Message Date
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
kinichiro
9aa4e1d960 disable strict aliasing on HP-UX C/aC++ compiler
to disable strict aliasing on HP-UX C/aC++, `+Otype_safety=off` is right.
`+Otype_safety=strong` forces ANSI aliasing.
2015-08-04 19:08:42 +09:00
Brent Cook
03ba7b70b9 rebuild manpages on opensslv.h changes 2015-08-03 07:39:21 -05:00
Brent Cook
13d910c11e disable explicit_bzero optimizations with CMake builds 2015-08-03 07:37:24 -05:00
Brent Cook
3465c5105b update build information 2015-08-03 07:19:25 -05:00
Brent Cook
75b90b157c MSVC is not yet ready to build all of the tests 2015-08-03 07:05:40 -05:00
Brent Cook
c66d80a438 add win32-specific explicit_bzero implementation 2015-08-03 06:56:59 -05:00
Brent Cook
058e3ebe77 expand changelog, fix typo 2015-08-03 05:23:54 -05:00
Brent Cook
a6d5b32276 update release notes for 2.2.2 2015-08-02 23:42:48 -05:00
Brent Cook
6527c32039 initial Linux cmake suppport
tested on Ubuntu 14.04
2015-08-01 05:33:19 -05:00
Brent Cook
b521a76a46 disable current broken cmake tests 2015-07-22 11:42:34 -05:00
Brent Cook
dd0704b176 s/CMakeFiles/CMakeLists/, start porting test scripts 2015-07-22 11:40:16 -05:00
Brent Cook
a9b16c2d66 correct fallback err.h macro behavior 2015-07-22 09:00:38 -05:00
Brent Cook
a9122f74e0 add cmake tests 2015-07-21 22:21:14 -05:00
Brent Cook
3614acd62e tests aren't ready for cmake, skip for now 2015-07-21 20:01:00 -05:00
Brent Cook
1828bcb9bf don't build eng_rsax.c anymore 2015-07-21 20:00:42 -05:00
Brent Cook
9d5eb631e3 move sleep shim to posix_win.c 2015-07-21 12:52:29 -06:00
Brent Cook
63161e85dc add initial build for arc4random/getentropy fallbacks 2015-07-21 12:52:14 -06:00
Brent Cook
cbdc8ca820 tighten up compat include paths, fix glibc compatibility 2015-07-21 12:04:07 -06:00
Brent Cook
5d8a1cf715 add initial CMake and Visual Studio build support
This moves the compatibility include files from include to
include/compat so we can use the awful MS C compiler
<../include/> trick to emulate the GNU #include_next extension.

This also removes a few old compat files we do not need anymore.
2015-07-21 12:08:18 -05:00
Brent Cook
7a4a37cf59 remove generated version file 2015-07-20 01:09:00 -05:00
Brent Cook
792a5acb67 eng_rsax is gone 2015-07-20 01:08:01 -05:00
Brent Cook
998cdebf36 update man links 2015-07-19 10:41:00 -05:00
Brent Cook
a1a0f2c6e2 implement compatibility shim for __warn_references
This will allow us to warn about deprecated function references at link-time.
2015-07-17 16:54:23 -05:00
Brent Cook
fafc3e47f2 derive VERSION from opensslv.h from upstream 2015-07-16 17:52:50 -05:00
Scott Parker
0bab46dde2 patch headers to avoid redefinitions on windows 2015-07-16 13:09:42 -05:00
Brent Cook
b9291face3 disable strict aliasing on AIX xlc and HP-UX aC++ compilers 2015-07-16 11:34:07 -05:00
Brent Cook
ddeb740426 win32 openssl CLI: preserve original echo state
Mirror the patch to ui_openssl.c, also fix the broken conditional that
made it not actually turn off echo in the first place.

ok guenther@
2015-07-16 10:27:57 -05:00
Brent Cook
c1a162d83b disable strict aliasing by default, noticed by miod@ 2015-07-15 20:24:05 -05:00
Brent Cook
db974c34e9 fixup how OPENSSLDIR is derived and expanded
As per
http://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Installation-Directory-Variables.html
we should not try to expand variables like sysconfdir in the
configure script, but rather derive the correct value in the Makefiles
instead. This fixes missing expansions as the preprocessor define.
2015-07-15 20:02:38 -05:00
Brent Cook
4cffda193b build libcrypto with -DLIBRESSL_INTERNAL
Since libcrypto defines its own CPPFLAGS, we need to set this for
libcrypto specifically.
2015-07-15 19:17:27 -05:00
Brent Cook
c136688ad7 Land #107, improve default OPENSSLDIR install behavior 2015-07-12 22:15:04 -05:00
Brent Cook
e2903fcefc Land #105, fix changelog typo 2015-07-12 22:13:33 -05:00
Brent Cook
f1f3147aff bump version to 2.2.2 2015-07-12 22:12:55 -05:00
Brent Cook
bda20bd13f Improve automatic handling of OPENSSLDIR
Install a default cert.pem, openssl.cnf, x509v3.cnf in OPENSSLDIR, which
is derived by default from sysconfdir and the prefix setting.
2015-07-12 22:10:48 -05:00
vanderhoorn
1ff2f4bc7d Fix typo in the ChangeLog
Embeded -> Embedded
2015-07-09 17:50:53 +02:00
Brent Cook
83d07710b5 remove unused --with-enginesdir configuration parameter 2015-07-08 09:02:12 -05:00
Brent Cook
5d916a25d2 update and clarify windows versions 2015-07-08 08:56:01 -05:00
Brent Cook
c194be1009 release note update for 2.2.1 2015-07-02 17:49:51 -05:00
Brent Cook
8c6ed379eb add compatible version of arpa/nameser.h for Windows 2015-07-02 17:49:03 -05:00
Brent Cook
545454277a add check for inet_pton, nudge minimum win32 compat to 0x0501 2015-07-02 00:19:53 -05:00
Brent Cook
8414df69bc added 2.2.1 changes 2015-07-01 03:19:21 -05:00
Brent Cook
45a7a43997 ignore more imported test files 2015-06-29 23:05:09 -05:00
Brent Cook
b7f699ab34 add cipher_list test 2015-06-29 22:49:37 -05:00
Brent Cook
89880c2e3a link build status 2015-06-23 06:39:28 -05:00
Brent Cook
d83bdd41e7 include build status link 2015-06-23 06:38:00 -05:00
Brent Cook
b9f1b83a79 update for mdc2 removal 2015-06-20 10:40:04 -05:00
Brent Cook
b67c9460ba remove unneeded local tls.h patch 2015-06-19 02:09:27 -05:00
Brent Cook
9764453937 package README.md 2015-06-14 06:06:55 -05:00
Doug Hogan
7dcb02169a Rename to README.md and add markdown
Since it's now a foreign project in automake, we can use github markdown
in the README.
2015-06-13 23:11:08 -07:00
Brent Cook
407c7cd1f5 set 'foreign' flag in automake
Avoid warnings about following GNU standards, since this is not a GNU
project. Thanks to Doug Hogan for pointing this out.
2015-06-13 22:31:26 -05:00
Brent Cook
b091d23685 fix libtool 2.4.2 stack-protector flag handling
Teach libtool 2.4.2 how to pass -fstack-protector* to the linker so
libssp is properly linked in on some toolchains. See upstream patch:
https://github.com/instantinfrastructure/poky-daisy/blob/master/meta/recipes-devtools/libtool/libtool/respect-fstack-protector.patch

Thanks to kinichiro inoguchi
2015-06-13 22:26:58 -05:00
Brent Cook
bc7b93470f add a missing header and fix typo in windows posix layer 2015-06-13 21:43:55 -05:00
Brent Cook
06d034ceb0 bump version 2015-06-12 22:01:04 -05:00
Brent Cook
351b51613b add security update notes 2015-06-11 09:02:54 -05:00
Brent Cook
04a8eca5d3 always check if ssp needs to be linked 2015-06-11 08:47:12 -05:00
Brent Cook
cf0bcbd599 add OS-specific build notes 2015-06-11 06:26:20 -05:00
Brent Cook
aed0eee768 add libtls-standalone COPYING file 2015-06-05 22:35:29 -05:00
Brent Cook
88acad37ce return 1 on failure 2015-06-05 22:16:02 -05:00
Brent Cook
df703ada9f update changelog 2015-06-05 05:56:18 -05:00
Brent Cook
a224727702 update readme with supported OSes 2015-06-05 05:37:59 -05:00
Brent Cook
b4a6a61513 refactor win32 shims into posix_win.c
this also adds a rename shim that allows overwrites
2015-06-05 04:50:18 -05:00
Brent Cook
1d27b22e82 set stdin/out/err to binary mode on Windows 2015-06-05 04:50:18 -05:00
Brent Cook
b239fc25fc all file IO should be binary, auto-append the flag 2015-06-05 04:50:17 -05:00
Brent Cook
8eec2f485a use correct binary on native windows builds 2015-06-05 04:50:17 -05:00
Brent Cook
d5a09e199a update man links 2015-05-25 22:59:14 -05:00
Brent Cook
bc70c1c2c1 patch in std headers and C++ support for tls.h 2015-05-23 19:27:57 -05:00
Brent Cook
901ea927ce flesh out libtls test program a bit, move to tests 2015-05-23 19:27:57 -05:00
Brent Cook
1a369f0fd7 ship manpages with libtls-standalone 2015-05-23 19:27:57 -05:00
Brent Cook
edfc569005 fix definition of DISABLE_AS_EXECUTABLE_STACK 2015-05-23 19:27:57 -05:00
Brent Cook
d2faf2ed63 set the shared library version number 2015-05-23 19:27:57 -05:00
Brent Cook
189cdf7103 revert changes to libtls-standalone Makefile.am that ended up in tls 2015-05-23 19:27:57 -05:00
Brent Cook
8dedbb4b2b add Makefile.am.arc4random 2015-05-23 19:27:57 -05:00
Brent Cook
769d58e494 further refactoring, working libtls-standalone 2015-05-23 19:27:57 -05:00
Brent Cook
d3771a41cb refactor configure into separate m4 macros
this allows for some reusability with libtls
2015-05-23 19:27:57 -05:00
Brent Cook
28353c1df1 stub in initial libtls standalone tree 2015-05-23 19:26:51 -05:00
Dave Huseby
7de7605b95 adding support for bitrig 2015-05-14 15:32:27 -07:00
Brent Cook
134f323923 add branch coverage, skip coverage check of tests themselves 2015-05-07 07:56:19 -05:00
Brent Cook
abd0688b18 distcheck fixes 2015-05-06 22:53:28 -05:00
Brent Cook
51bfd4921a add app tests from regress/usr.bin/openssl
These are added directly rather than imported by update.sh since they
require local modifications and its not worth breaking everyone's git
forks yet to import them through cvs2git.
2015-05-06 22:39:32 -05:00
Brent Cook
91f01629b9 use the same gcc test for AIX as HP-UX 2015-04-27 08:26:22 -05:00
kinichiro
97c910ecfd modify for HP-UX build, choose correct CFLAGS for gcc. 2015-04-27 21:20:20 +09:00
Brent Cook
b0565945e4 use soft links for related man pages.
This matches the behavior of OpenSSL's installer and prevents
hitting the max hard link limit on some file systems.
2015-04-26 23:19:58 -05:00
Brent Cook
7dbc4ed363 remove unneeded check for sys/sysctl.h 2015-04-19 15:14:52 -05:00
Brent Cook
dcb97d12a4 use alternate cflags on AIX and HP-UX vendor compilers 2015-04-19 14:55:25 -05:00
Brent Cook
2753f5ca87 Revert configure-time checks for -Wall/-std=gnu99
There is a problem with these on some compilers, revert while a solution
is found.
2015-04-14 22:12:52 -05:00
Brent Cook
5cf05de18c make compiler checks for -Wall and -std=gnu99
Yes, there are compilers that do not understand or need these.
2015-04-14 08:45:47 -05:00
Brent Cook
3096ab0e45 remove issetuigid wrappers, now that all getenv calls are gone.
From deraadt@ upstream:

Remove all getenv() calls, especially those wrapped by issetugid().
getenv()'s wrapped by issetugid() are safe, but issetugid() is ...
difficult to impliment on many operating systems.  By accident, a grand
experiment was run over the last year, where issetugid() returned 1 (the
safe value) on a few operating systems.  Noone noticed & complained that
certain environment variables were not working.......
2015-04-14 07:55:23 -05:00
Brent Cook
fe3f7fc636 Add experimental AIX support.
This includes a WIP failsafe issetugid for now, while research continues
on the proper way to do this in a race-free fashion in AIX.
2015-03-31 09:25:21 -05:00
Brent Cook
20101fd6b3 avoid install failures on case-insensitive file systems 2015-03-31 08:36:21 -05:00
Brent Cook
273bd7bd61 Use mandoc database to get man links.
Previously, we semi-manually grabbed the MLINKS from the libressl
Makefiles. The better way is to extract this information from the mandoc
link database files directly, allowing for MLINKS to eventually go away
upstream.
2015-03-27 06:42:45 -05:00
Brent Cook
34bf96ce4b move define to CPPFLAGS 2015-03-22 08:14:27 -05:00
Brent Cook
569177eabd Merged support for using _OPENBSD_SOURCE on NetBSD 8.x 2015-03-22 08:11:53 -05:00
Brent Cook
cc3bdea44a copy remaining test harness dependencies 2015-03-22 08:03:02 -05:00
Brent Cook
a34d319f8d copy memmem.c on update 2015-03-22 07:53:18 -05:00
Brent Cook
ad2a38ab4a rework CFLAGS/CPPFLAGS settings during configuration
Move define adjustments to CPPFLAGS.
Adjust user CFLAGS directly, do not override during configuration.
USER_CFLAGS is not necessary to build libcompat_noopt correctly.
2015-03-22 07:43:55 -05:00
Brent Cook
809fcf4ea7 move clang flags adjustment next to the check, fix typo 2015-03-22 06:06:40 -05:00
Brent Cook
4106a08da9 check for build tools earlier in configuration 2015-03-22 06:06:40 -05:00
Brent Cook
989bc3e3ac the BIO_sock_init() patch is upstream. 2015-03-22 06:06:32 -05:00
Brent Cook
dcf31221ef Merge native cygwin support 2015-03-21 19:08:04 -05:00
Brent Cook
45065de1ba rework tests Makefile.am
There are so many test exceptions that need handling that it is easier
to simply edit it directly rather than doing autogeneration anymore.

This also puts biotest and pidwraptest behind a new --enable-extratests
option, so they are easy to run but are not enabled by default.
2015-03-21 19:04:54 -05:00
Brent Cook
4d122c0be6 set version to 2.2.0 on master 2015-03-19 10:28:54 -05:00
Brent Cook
df0c0cd146 update changelog for 2.1.6 2015-03-19 09:27:31 -05:00
Brent Cook
dd646a3302 enable libtls by default
The API/ABI for the LibreSSL 2.1.x series is now fixed, so we can safely
enable libtls it by default. This is useful for new OpenNTPD and
OpenSMTPD releases as well.

ok deraadt@ beck@ sthen@
2015-03-19 00:39:50 -05:00
Brent Cook
1d62b3be37 expand on changelog 2015-03-09 07:23:21 -05:00
Brent Cook
f5389343d6 use correct patch level 2015-03-09 07:23:21 -05:00
Brent Cook
14c53cd02c clarify 2.1.5 release note
Specify that we are rejecting server ephemeral DH keys < 1024 bits.
2015-03-08 22:37:04 -05:00
Brent Cook
ab0dea2321 update changelog for 2.1.5 2015-03-08 22:02:54 -05:00
Brent Cook
8dbe1d6257 bump version to 2.1.5 2015-03-08 22:02:54 -05:00
Brent Cook
73329d4311 update __STRICT_ALIGNMENT check 2015-03-08 22:02:54 -05:00
Brent Cook
f7e4e4a266 initialize winsock earlier in openssl(1)
This allows commands like ocsp to work properly since we no longer
initialize Winsock as a side-effect of doing a BIO_gethostbyname.
2015-03-08 22:02:54 -05:00
Brent Cook
031f0aaa8f specify -static-libgcc for mingw builds
Avoid external external dependencies on 32-bit windows builds.
2015-03-08 22:02:19 -05:00
Brent Cook
148aebdbb1 fix hangs reading stdin on Windows 2015-03-08 20:47:03 -05:00
Kamil Rytarowski
bbf021e11c Reuse _OPENBSD_SOURCE namespace on NetBSD (>=8.x) 2015-03-08 01:35:20 +00:00
Brent Cook
213eb9465e avoid doubling user-specified cflags 2015-03-07 12:02:57 -06:00
Corinna Vinschen
e38dc152d6 Allow to disable tests easily
- Introduce the tests_disabled array, add biotest, explicit_bzero and
  pidwraptest.
- Add preceeding comment to explain why every test is skipped
- Rearrange loops generating Makefile.am dependencies to look for tests
  in tests_disabled first and skip them.

Signed-off-by: Corinna Vinschen <github@cygwin.de>
2015-03-04 11:55:50 +01:00
Corinna Vinschen
9cad5993a2 Drop test for adding -lssp again, not required with latest libtool
Signed-off-by: Corinna Vinschen <github@cygwin.de>
2015-03-03 18:39:31 +01:00
Corinna Vinschen
98902539a4 Add preliminary Cygwin support
Signed-off-by: Corinna Vinschen <github@cygwin.de>
2015-03-03 16:37:23 +01:00
Brent Cook
d193b171b6 Add '-windows' to windows binary archive. 2015-03-02 23:17:48 -06:00
Brent Cook
79492b46f6 add windows README, package README files with distribution 2015-03-02 23:14:35 -06:00
Brent Cook
e0855bdb1d point out where to report bugs, update links. 2015-03-02 21:12:47 -06:00
Brent Cook
3b3a290b73 update changelog with security updates 2015-03-02 20:47:26 -06:00
Brent Cook
3cb34ee99f add a simple code coverage generation script
The lcov tools (http://ltp.sourceforge.net/coverage/lcov.php) are
required to generate reports.

Original idea from this PR, thanks to Jim Barlow for doing the initial
integration work.

https://github.com/libressl-portable/portable/pull/58
2015-03-01 17:37:12 -06:00
Brent Cook
701aa50e77 ignore temp windows library build files 2015-03-01 17:16:00 -06:00
Brent Cook
933820a0f5 separate the BSWAP check from the action
checks need to be unconditional with autoconf
2015-03-01 16:30:23 -06:00
Brent Cook
8695b50688 check if the BSWAP assembly for ARM works before building 2015-03-01 15:57:21 -06:00
Brent Cook
557df7eed8 refine building windows binaries, enable shared 2015-03-01 05:34:43 -06:00
Brent Cook
f94d3d671c update windows binary build script
This puts the 32 and 64-bit binaries in the same zip file, adds debug
files that are compatible with Visual Studio/windbg, and updates for the
new configure options.
2015-02-24 19:42:26 -06:00
Brent Cook
ab0d3e54a2 add windows-specific hardening options
This enables DEP and ALSR capabilities. Stack protection is enabled
optionally, there are some extra linking steps required that make it
difficult to enable by default.
2015-02-24 19:39:16 -06:00
Brent Cook
347c03d3a0 remove openat requirement for building certhash 2015-02-23 09:48:04 -06:00
Brent Cook
9da890ffb9 update libtls mlinks 2015-02-23 09:25:53 -06:00
Brent Cook
f54d0d4f38 remove unneeded continuation characters in ssl/crypto mlinks list 2015-02-23 09:25:53 -06:00
Brent Cook
2c5ac47db4 Update initial changelog for 2.1.4 2015-02-22 18:06:46 -06:00
Brent Cook
329df39a13 enable Windows NX / ALSR / stack protector
I will update my toolchain and try --high-entropy-va and
stack-protector-strong later. We will probably need to ship libssp-0.dll
as well. Thanks to jsg for hints.
2015-02-19 23:05:51 -06:00
Brent Cook
7ba784891d add script for building windows binary distribution packages 2015-02-19 21:23:31 -06:00
Brent Cook
49d80f0e89 add missing line continuation 2015-02-19 21:16:55 -06:00
Brent Cook
a859b93ff5 disable system issetugid on OS X since it is not fork-safe
Noticed while testing similar code for AIX.
ok beck@
2015-02-17 18:15:17 -06:00
Brent Cook
adc416e922 remove getuid/getgid fallbacks from hp-ux issetugid emulation
Fail closed if we cannot obtain the process flags. Noticed while looking
at a similar function for AIX.
2015-02-16 22:30:27 -06:00
Brent Cook
ad7ac48d03 add strsep fallback for libtls 2015-02-14 20:03:39 -06:00
Brent Cook
28311d4355 conditionally build certhash into openssl(1)
For now, look for openat and symlink. We may switch to just needing
symlink later.
2015-02-14 18:54:43 -06:00
Brent Cook
2286578fd4 update for new manpage conversions, add links 2015-02-14 18:15:15 -06:00
Brent Cook
5e96c047f7 add the new openssl(1) certhash command 2015-02-11 20:50:10 -06:00
Brent Cook
687a5083f4 rc5 is removed 2015-02-10 11:10:04 -06:00
Brent Cook
9de5b8a963 c_all* have merged into c_all.c 2015-02-08 19:40:03 -06:00
Brent Cook
c386ab2149 disable biotest 2015-02-06 20:41:07 -06:00
Brent Cook
be5d0cca13 update with latest, add more tests
this adds the new bytestring apis and new regression tests
2015-02-06 20:17:31 -06:00
Brent Cook
a323f52a3f be even nicer to OS X's fork 2015-01-31 22:42:08 -06:00
Brent Cook
fc7ba46906 be nicer to travis OS X machines, remove unneeded 'make clean' 2015-01-31 22:35:52 -06:00
Brent Cook
100625e317 only use the specific build matrix
use sudo to install mingw toolchains
2015-01-31 22:24:31 -06:00
Brent Cook
5ea47a8fa2 fix whitespace in yml 2015-01-31 22:17:39 -06:00
Brent Cook
dd7ed132ee update travis-ci build to check mingw32/64 targets 2015-01-31 22:13:19 -06:00
Brent Cook
9909bd7aa5 include 'struct iovec' for Windows
this is used for in-memory cert loading
2015-01-31 21:52:20 -06:00
Brent Cook
6c46e80871 bump version 2015-01-26 10:30:17 -06:00
Brent Cook
d88e90def9 add by_mem.c for X509_STORE_load_mem 2015-01-26 10:20:26 -06:00
Brent Cook
20e329e272 add 2.1.3 notes 2015-01-21 08:04:11 -06:00
Brent Cook
a223365127 add NetBSD shims for arc4random
The current NetBSD release, 6.1.5, fails to reseed arc4random fork. Work
around it by providing arc4random/getentropy shims. Revisit when NetBSD
7 is available.
2015-01-21 06:14:24 -06:00
Brent Cook
ec81c28219 catch GCC versions that only warn on unused flags
Noticed while building with GCC 4.2 with HP-UX. Switching the ERROR to a
WARN for a first release while we continue to survey the field.
2015-01-06 17:47:16 -06:00
Brent Cook
f2d68c7d21 remove bash-style comparisons from tests 2015-01-06 17:47:16 -06:00
kinichiro
0308b63cbf Add support for HP-UX
tested on: HP-UX 11.31 ia64,
               gcc 4.7.1(HP AllianceOne version)
               gcc 4.2.3(http://hpux.connect.org.uk)
	       HP C/aC++

HP-UX defaults to use LP32 and it treats long as 32 bit (= 4 bytes).
This build forces LP64 for treating long as 64 bit.
2015-01-06 17:47:16 -06:00
Brent Cook
4b7e78153c quoting and ensure old_*flags are restored before the 'else' 2015-01-05 21:22:36 -06:00
Brent Cook
872ecfd856 preserve CFLAGS between hardening checks, enable mingw
Allow hardening CFLAGS for mingw that do not cause link-time failures.
Add proper quoting on flags for commas
Check LDFLAGS for linker-only flags.
2015-01-05 20:59:53 -06:00
Brent Cook
303b972d55 simplify hardening check logic, disable for mingw
Rather than doing separate linker/compiler checks, just build a
non-empty program with each so that the compiler will actually try to
use the hardening features. Reduce redundancy in the macro calls by just
setting the flag that was just tested.

Also, disable hardening for mingw, since its trying to use a
libssp-0.dll file that I can't find right now. The detected hardening
flags break mingw builds currently.
2015-01-05 20:23:48 -06:00
Brent Cook
5be407a424 move public domain to top, help automatic tools 2015-01-02 07:42:15 -06:00
Jim Barlow
813e7bdac1 Change comments to remark on script not being needed for clang >= 5.1 2015-01-01 15:03:03 -08:00
Jim Barlow
750cc5306d Fix build failure of "make distcheck" (new scripts/ folder missing) 2014-12-31 07:17:47 -08:00
Jim Barlow
701204bf34 Fix typo causing output of clang test to read "CLANG" instead of yes/no 2014-12-31 07:06:49 -08:00
Jim Barlow
2dc0a6ac3c Merge recent upstream changes with compiler hardening
Conflicts:
	configure.ac
2014-12-30 15:13:19 -08:00
Brent Cook
9adc6d6458 Revert "do not double-link libcrypto"
This reverts commit c83d468cfd.
It wasn't as superfluous as I thought on all platforms.
2014-12-27 16:52:25 -06:00
Brent Cook
c83d468cfd do not double-link libcrypto
libssl already has LIBFLAGS for libcrypto, so adding -lcrypto is superfluous.
2014-12-27 16:34:48 -06:00
Brent Cook
23c90228ac enable __STRICT_ALIGNMENT on sparc 2014-12-27 16:34:02 -06:00
Jim Barlow
c0a8ddc163 configure.ac: use executable hardening where available
Where available, enable stack smashing protection, fortify source,
no-strict-overflow, and read only relocations.

Many Linux distributions automatically enable most of these options.
They are no brainers. The difference introduced here is in asking for a
few more aggressive options. An option to disable the more aggressive
options is provided (--disable-hardening). When set, configure will fall
back to the default CFLAGS on the system - in many cases that will still
be hardened. There is no point in going further than that.

Options enabled are:

-fstack-protector-strong is a relatively new GCC-4.9 feature that is
supposed to give a better balance between performance and protection.
-all is considered too aggressive, but was used in Chromium and other
security critical systems until -strong became available. Follow their
lead and use -strong when possible. clang 6.0 supports -all but not
-strong.

_FORTIFY_SOURCE replaces certain unsafe C str* and mem* functions with
more robust equivalents when the compiler can determine the length of
the buffers involved.

-fno-strict-overflow instructs GCC to not make optimizations based on
the assumption that signed arithmetic will wrap around on overflow (e.g.
(short)0x7FFF + 1 == 0). This prevents the optimizer from doing some
unexpected things. Further improvements should trap signed overflows and
reduce the use of signed to refer to naturally unsigned quantities.

I did not set -fPIE (position independent executables). The critical
function of Open/LibreSSL is as a library, not an executable.

Tested on Ubuntu Linux 14.04.1 LTS, OS X 10.10.1 with "make check".

The code added to m4/ is GPLv3 but con

Signed-off-by: Jim Barlow <jim@purplerock.ca>
2014-12-23 21:47:03 -08:00
Jim Barlow
a6c072343a configure.ac: use executable hardening where available
Where available, enable stack smashing protection, fortify source,
no-strict-overflow, and read only relocations.

Many Linux distributions automatically enable most of these options.
They are no brainers. The difference introduced here is in asking for a
few more aggressive options. An option to disable the more aggressive
options is provided (--disable-hardening). When set, configure will fall
back to the default CFLAGS on the system - in many cases that will still
be hardened. There is no point in going further than that.

Options enabled are:

-fstack-protector-strong is a relatively new GCC-4.9 feature that is
supposed to give a better balance between performance and protection.
-all is considered too aggressive, but was used in Chromium and other
security critical systems until -strong became available. Follow their
lead and use -strong when possible. clang 6.0 supports -all but not
-strong.

_FORTIFY_SOURCE replaces certain unsafe C str* and mem* functions with
more robust equivalents when the compiler can determine the length of
the buffers involved.

-fno-strict-overflow instructs GCC to not make optimizations based on
the assumption that signed arithmetic will wrap around on overflow (e.g.
(short)0x7FFF + 1 == 0). This prevents the optimizer from doing some
unexpected things. Further improvements should trap signed overflows and
reduce the use of signed to refer to naturally unsigned quantities.

I did not set -fPIE (position independent executables). The critical
function of Open/LibreSSL is as a library, not an executable.

Tested on Ubuntu Linux 14.04.1 LTS, OS X 10.10.1 with "make check".

Signed-off-by: Jim Barlow <jim@purplerock.ca>
2014-12-23 05:24:24 -08:00
Jim Barlow
164f684eb8 configure.ac: Modify clang check to save result to a variable
...and leave a note that -Qunused-arguments is being applied to CFLAGS
not LDFLAGS, probably in error.
2014-12-23 04:38:43 -08:00
Brent Cook
04158cd40e do not mark GNU_STACK WX in ELFs generated from assembly
When generating ELF objects from assembly, gcc and clang mark the
GNU_STACK program headers as RWX by default. This is a security issue,
so we make sure it is marked only RW.

This modifies Anthony G. Basile's original patch for Linux to set
.note.GNU-stack whenever the assembler supports it. It is surprising
that any modern toolchain would enable an executable stack without an
explicit request. The number of programs that need an executable stack
is surely much smaller than the number of programs that include assembly.
2014-12-22 23:04:47 -06:00
Technion
8c6c07c5ba Add wrapper file "config" to distribution. 2014-12-15 07:43:17 +00:00
Brent Cook
56f7523337 enable OS X and Linux CI builds 2014-12-14 21:03:38 -06:00
Brent Cook
733c252857 add Travis CI configuration 2014-12-14 20:46:14 -06:00
Brent Cook
c2dccc1418 add all LIBADD dependencies for tls
The libtool transitive dependency magic does not seem to work for
cross-compilation, so explicitly specify them here.
2014-12-14 20:38:02 -06:00
Brent Cook
a29b174e31 bump version
append portable version number to the version string
2014-12-14 17:12:50 -06:00
Brent Cook
d2342f36bc allow Windows DLLs to be built
based on a patch from Jan Engelhardt
2014-12-14 16:59:35 -06:00
Brent Cook
09e5a841cd add LIBADD library dependencies to libssl/libtls
From Jan Engelhardt
2014-12-14 16:59:35 -06:00
Brent Cook
2669771c7e Use the individual library versions in LibreSSL pc files
Previously, they were all using the portable package version, rather
than the individual library versions. openssl(1)'s pc file represents
the LibreSSL-portable release however.

$ pkg-config --modversion libtls
1:0:0
$ pkg-config --modversion openssl
2.1.2
$ pkg-config --modversion libssl
30:0:0
$ pkg-config --modversion libcrypto
30:3:0

ok beck@ deraadt@
2014-12-14 16:59:26 -06:00
Brent Cook
cfa0445115 don't hardcode a fixed # of jobs for make 2014-12-08 18:35:22 -06:00
Brent Cook
722b48f044 update libtls URL
thanks to gschutijser from github for pointing it out
2014-12-08 18:34:06 -06:00
Brent Cook
cfbc62e686 update and rework changelog for readability 2014-12-07 22:24:03 -06:00
Brent Cook
6f6ca9dcf0 use the new $MV macro to generate assembly files
Avoid spurious rebuilds running update.sh by generating a temp file and
comparing the result to the existing one.
2014-12-07 18:50:58 -06:00
Brent Cook
5109e657df use 'make distcheck' for the release build script 2014-12-07 18:16:16 -06:00
Dmitry Eremin-Solenikov
a270e6a90b tests/Makefile.am.tpl: remove generated files on distclean
Add pidwraptest.txt to DISTCLEANFILES to let it be removed on distclean.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
2014-12-07 18:07:53 -06:00
Dmitry Eremin-Solenikov
afcd515b99 update.sh: remove linked manpages on uninstall
Add additional code to remove linked manpages on uninstall. Since we do
linking manually, automake will not remove them for us.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
2014-12-07 18:07:53 -06:00
Dmitry Eremin-Solenikov
9d70cdc60d update.sh: add MV-like function preserving file timestamps
Add a do_mv()/$MV wrappers to be called instead of just mv. This
function will preserve the target file if it does not differ from the
source file. This helps to remove unnecessary compilator calls after
calling update.sh w/o source changes.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
2014-12-07 18:07:53 -06:00
Dmitry Eremin-Solenikov
5390bbea3e update.sh: call $CP instead of cp to ease rebuilds
In several additional places call $CP instead of just cp to ease and
speed up rebuilds after update.sh execution.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
2014-12-07 18:07:52 -06:00
Dmitry Eremin-Solenikov
a40fccc73b Update .gitignore
Add gost test suite and camellia cipher dir to .gitignore.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
2014-12-07 18:07:52 -06:00
Dmitry Eremin-Solenikov
7842cda3c8 update.sh: include gost test suite
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
2014-12-07 18:07:52 -06:00
Brent Cook
9c685415ab disable inline assembly on Windows for now
There are issues building with inline assembly on Windows 64-bit.
2014-12-07 18:02:06 -06:00
Brent Cook
03cd45e2c7 Enable optimized crypto operations for x86_64
This adds initial support for assembly crypto acceleration on x86_64 for
ELF (Linux, *BSD, Solaris) and Mach-O (OS-X) systems.

The build method is a little different than OpenSSL and OpenBSD.  All
the .s files are generated ahead of time when the tarball is generated,
so there are no complicated makefile rules at configure/build time. This
also means the builds are faster and perl is not required on the build
system.

Thanks to Wouter Clarie for providing the initial cleanup and patch
that this is based on.
2014-12-07 16:26:28 -06:00
Brent Cook
e57d5d8be3 sync man links from upstream
I really need write something to automate this.
2014-12-07 13:12:41 -06:00
Brent Cook
976f64d932 read all library versions directly from files
This makes building and testing easier because the library Makefile.am
files are use directly rather than as templates. Thanks to Wouter Clarie
for the idea.
2014-12-06 18:59:25 -06:00
Brent Cook
14f4175b67 split long manpage makefile lines. 2014-12-06 17:48:03 -06:00
Brent Cook
29804a73cc simplify packaging for libcrypto.
Remove a lot of complex shell code. Upstream churn has slowed down, so
it is now easier to maintain this directly as automake files. This is
also needed to start integrating CPU-specific acceleration support.

Since we are deriving the copy list from the Makefile.am files, we can
now get rid of copy_src/copy_crypto.
2014-12-06 17:48:03 -06:00
Brent Cook
605acdcef2 remove obsolete define 2014-12-06 17:47:44 -06:00
Brent Cook
d643bcf4b5 simplify packaging for libssl.
Follow libtls and derive the file list from the Makefile.am
template itself.
2014-12-06 17:47:30 -06:00
Brent Cook
13035fa666 simplify building the apps Makefile
Remove extra machinery in favor of a plain-old Makefile.am.
Tighten up what files are copied on build, package a simple openssl.cnf.
2014-12-06 11:20:56 -06:00
Brent Cook
33ff088a60 simplify packaging for libtls.
Derive the file list from the Makefile.am template itself (DRY), ensure
manpage is packaged with the final tarball.
2014-12-06 10:21:23 -06:00
Brent Cook
d3ea95b9f5 update changelog for libtls 2014-12-06 09:29:22 -06:00
Brent Cook
b3270494f0 add support for building libtls
Use './configure --enable-libtls' to build the library and install the
associated manpages. Note that the API and ABI of this library may
change still, though feedback is welcome.

ok deraadt@ jsing@ tedu@
2014-12-06 09:13:56 -06:00
Brent Cook
fc5e43c32b update changelog for 2.1.2 2014-12-03 23:11:08 -06:00
Brent Cook
a19dd0e61b better cleanup biotest.c 2014-12-03 22:58:24 -06:00
Brent Cook
e83c30c158 monkey patch more POSIX-like behavior out of winsock 2
Windows sockets functions look on the outside like they behave similarly
to POSIX functions, but there are many subtle and glaring differences,
including errors reported via WSAGetLastError, read, write, and close do
not work on sockets, setsockopt takes a (char *) rather than (void *),
etc.

This header implements wrappers that coerce more POSIX-like behavior
from these functions, making portable code easier to develop.

BENEFITS:
One does not necessarily need to sprinkle #ifdefs around code to handle
the Windows and non-Windows behavior when porting code.

CAVEATS:
There may be performance implications with the 'mother-may-I'
approach to determining if a descriptor is a socket or a file.

The errno mappings are not 100% what one might expect compared to POSIX
since there were not always good 1:1 equivalents from the WSA errors.
2014-12-03 17:07:17 -06:00
Brent Cook
cccdd689e3 add minimal winsock->BSD networking header shims
also add license header to existing shims
2014-12-03 17:07:17 -06:00
Brent Cook
1bbde19a7c add minimal poll(2) implementation for Windows
This provides sufficient functionality to run openssl(1) from a Windows
console. This is based on the original select-based version from from
songdongsheng@live.cn. Changes:

 * use nfds_t directly for iterating the fds.
 * add WSAGetLastError -> errno mappings
 * handle POLLHUP and the OOB data cases for revents
 * handle sparse arrays of fds correctly
 * KNF style updates
 * teach poll how to handle file handles as well as sockets

This handles the socket/non-socket issue  by alternating a loop between
WaitForMultipleObjects for non-sockets and and select for sockets. One
would think this would be terrible for performance, but as of this
writing, poll consumes about 6% of the time doing a bulk transfer
between a Linux box and 'openssl.exe s_server'.

I tried to implement this all in terms of WaitForMultipleObjects with a
select 'poll' at the end to get extra specific socket status. However,
the cost of setting up an event handle for each socket, setting the
WSAEventSelect attributes, and cleaning them up reliably was pretty
high. Since the event handle associated with a socket is also global,
creating a new one cancels the previous one or can be disabled
externally.

In addition, the 'FD_WRITE' status of a socket event handle does not
behave in an expected fashion, being triggered by an edge on a write
event rather than being level triggered.

Another fun horror story is how stdin in windows might be a console, it
might be a pipe, it might be something else. If these all worked in the
same way, it would be great. But, since a console-stdin can also signal
on a mouse or window event, it means we can easily get stuck in a
blocking read (you can't make stdin non-blocking) if the non-character
events are not filtered out. So, poll does that too.

See here for various additional horror stories:

http://www.postgresql.org/message-id/4351.1336927207@sss.pgh.pa.us
2014-12-03 17:03:47 -06:00
Brent Cook
96bf8be098 update and mask unit tests when running on win32
Update pq_test to ignore changes in whitespace.
Update for new testssl params, specify absolute paths to test binaries.
Fork-based tests do not make sense on Windows.
Disable building biotest, since it is too specific to OpenBSD's behavior
to be useful on other platforms.
2014-12-03 17:02:29 -06:00
Brent Cook
58fcd3c39c Add conditional compilation for windows and posix functions.
This adds a Windows-specific versions of several symbols from libcrypto
and openssl(1).
2014-12-03 17:02:29 -06:00
Brent Cook
7f0646f612 Update win32 build defines 2014-12-03 17:02:29 -06:00
Brent Cook
43e041a533 don't ignore a non-existent file 2014-12-03 17:02:23 -06:00
Brent Cook
2103690cbf improve readability of generated Makefile.am files 2014-11-23 08:33:56 -06:00
Brent Cook
1bd0c2fb2e ignore gost and camellia dirs 2014-11-18 08:04:18 -06:00
Brent Cook
29f8d827f2 Enable GOST in libcrypto and libssl, contributed by Dmitry Eremin-Solenikov
Ensure the public camellia.h header is installed along with gost.h
2014-11-18 08:02:32 -06:00
宋冬生
648e913627 Use _WIN32 instead of __WIN32.
ok bcook@
2014-11-18 07:41:08 -06:00
Brent Cook
f223e6f14d Add the Cammelia cipher to libcrypto.
from miod@:

There used to be a strong reluctance to provide this cipher in LibreSSL in the
past, because the licence terms under which Cammelia was released by NTT were
free-but-not-in-the-corners, by restricting the right to modify the source
code, as well retaining the right to enforce their patents against anyone
in the future.

However, as stated in http://www.ntt.co.jp/news/news06e/0604/060413a.html ,
NTT changed its mind and made this code truly free. We only wish there had
been more visibility of this, for we could have had enabled Cammelia
earlier (-:

Licence change noticed by deraadt@. General agreement from the usual LibreSSL
suspects.

Crank libcrypto.so minor version due to the added symbols.
2014-11-17 17:48:46 -06:00
Brent Cook
d84aa5cbc1 Quiet clang warnings about unused arguments in general.
Check if we are using clang, rather than simply if we are on OS X.
Note: recent LLVM releases do not seem to need this anyway.
2014-11-03 21:06:40 -06:00
Brent Cook
94ec2b6b1c make 'autoreconf' work from dist tarball
We need to include VERSION for it to run.
2014-11-03 21:05:47 -06:00
Brent Cook
0aeb93b9fc override native arc4random_buf on FreeBSD
The FreeBSD-native arc4random_buf implementation falls back to weak
sources of entropy if the sysctl fails. Remove these dangerous fallbacks
by overriding locally.

Unfortunately, pthread_atfork() is broken on FreeBSD (at least 9 and 10)
if a program does not link to -lthr. Callbacks registered with
pthread_atfork() simply fail silently. So, it is not always possible to
detect a PID wraparound. I wish we could do better.

This improves arc4random_buf's safety compared to the native FreeBSD
implementation. Tested on FreeBSD 9 and 10.

ok beck@ deraadt@
2014-11-03 01:19:36 -06:00
Brent Cook
8abf8e1e15 override native arc4random_buf on OS X
While the native OS X implementation is fork-safe, it does not seed
safely, as of the latest released OS X libc sources, version 997.90.3.
It only uses weak sources of entropy if accessing /dev/urandom fails.

ok beck@ deraadt@
2014-11-03 01:19:36 -06:00
Brent Cook
e864776f0b update README to reflect current porting approach
ok beck@ deraadt@
2014-11-03 01:18:32 -06:00
Brent Cook
1c5591947a Add an OpenSSL compatible ./config wrapper
This allows sofware expecting OpenSSL's config script, to a limited
extent, to continue building without changes.

Thanks to technion for pointing this out and providing the initial
patch.
2014-10-31 07:35:06 -05:00
Brent Cook
a2373f7007 wrap arc4random header
ok @doug
2014-10-30 19:15:20 -05:00
Brent Cook
a4cc953911 Improve and simplify function and header detection logic.
Simplify autoconf checks by using AC_CHECK_FUNCS/HEADERS.
Clarify some ambiguous dependencies around strnlen/strndup.
Unconditionally enable pidwraptest for all arc4random implementations.
Remove HAVE_VASPRINTF conditional, since asprintf requires vasprintf.

ok @doug
2014-10-30 19:15:11 -05:00
Brent Cook
727bccd093 use the correct HOST_OS for the Windows build
ok doug@
2014-10-30 10:55:30 -05:00
Brent Cook
72c1e56b38 enable -lcrypto -lssl with all test programs directly.
This removes the need to specify each one individually.

ok doug@
2014-10-30 10:55:30 -05:00
Brent Cook
ccaf9cdd9c remove duplicate (and overlapping) .1 manpages
openssl.1 contains all of the information from the other application
manpages, and is the only one packaged in OpenBSD. So, remove the other
obsolete .1 manpages (and avoid overlapping system pages like passwd.1)
2014-10-26 09:23:03 -05:00
Brent Cook
8b695e534b set various glibc flags that also are useful with mingw
for example, asprintf/vasprintf are unmasked with _GNU_SOURCE in mingw
2014-10-22 19:12:18 -05:00
Brent Cook
eb26e56ba8 undef LIBRESSL_INTERNAL for the pidwrap test. 2014-10-22 13:06:36 -05:00
kinichiro
a91d1013cf update string.h for include strings.h for HPUX environment 2014-10-22 12:45:01 -05:00
Brent Cook
54259e50a5 include a proper check for memmem when configuring unit tests
This allows the proper compatibility header definition to be exposed.
2014-10-22 12:37:06 -05:00
Brent Cook
48520cf629 bump version 2014-10-22 11:16:39 -05:00
Brent Cook
04bb7a665d update with 2.1.1 changes
ok beck@
2014-10-15 22:28:34 -05:00
Brent Cook
a007fb9d53 LibreSSL portable README update
Add more info on how to build from source, where to download it from.
2014-10-15 16:36:08 -05:00
Brent Cook
2408253191 add extended ChangeLog file
help people more easily find the code and changes
2014-10-14 22:25:16 -05:00
Brent Cook
6b729df5d8 update gitignore to see changelog 2014-10-14 22:23:16 -05:00
Brent Cook
9c8cf59362 add missing commas from man links 2014-10-14 21:54:37 -05:00
Brent Cook
67ec615a35 update man links 2014-10-14 20:55:04 -05:00
Brent Cook
3d3c24670a don't fail to make dist on a clean repo 2014-10-14 20:54:42 -05:00
Brent Cook
cf1c1f350c crank version 2014-10-14 20:44:55 -05:00
Brent Cook
0534fffefa update to new converted SSL manpages 2014-10-14 20:43:30 -05:00
Brent Cook
5c23f25103 clear local manpage cache before generating a release tarball
Remove the possibility of having any bad or old manpages in releases
while still being able to cache for quick development tarballs.
2014-09-26 16:12:53 -05:00
Brent Cook
3f944e83ff update for upstream move of the openssl app 2014-08-27 21:46:43 -05:00
Brent Cook
e7edc4a76f ensure compatibility with posix shell
remove bash comparison, thanks kinichiro
2014-08-18 21:55:37 -05:00
Brent Cook
01726893f5 add --disable-asm flag for disabling inline asm
Surprisingly (or not), a lot of OpenSSL's inline assembly actually makes
things slower with a relatively modern compiler (read, gcc >= 4.x).
2014-08-17 07:58:32 -05:00
Brent Cook
2cef68f3ed allow inline asm
use default of -std=gnu99 for it to be recognized
2014-08-16 14:16:01 -05:00
Brent Cook
2d719eb3d7 set _DEFAULT_SOURCE on linux hosts
this is the replacement for _BSD_SOURCE on newer glibc's
2014-08-16 08:17:32 -05:00
inoguchi
6dccbae663 update stdio.h for including stdarg.h
it seems that including stdarg.h is needed for defining va_list
environment is hpux 11.31(ia64) with gcc 4.7.1.

without stdarg.h, I got compilation error like this.
  "error: 'va_list' undeclared (first use in this function)"

I checked with gcc -E, then I noticed that __va_list is defined but va_list is not.
  "typedef __gnuc_va_list __va_list;"

with including stdarg.h, va_list is defined.
  "typedef __gnuc_va_list va_list;"
2014-08-12 21:18:27 -05:00
Brent Cook
46b6df7cb0 remove configure.am.tpl, pull in VERSION directly
from wouter@
2014-08-12 21:17:41 -05:00
Brent Cook
d6a485d1a1 rebase on pull when updating the openbsd branch
this avoids inadvertent local merges
2014-08-08 07:32:38 -05:00
Brent Cook
00b51d5c25 conditionally build strnlen if needed.
it is only used by strndup

prodded by Sortie@
2014-08-02 21:59:36 -05:00
Brent Cook
c95574be92 tie master libressl branch to openbsd master
Added OPENBSD_BRANCH to set what branch update.sh should checkout.
2014-07-31 22:08:30 -05:00
140 changed files with 14914 additions and 2070 deletions

198
.gitignore vendored
View File

@@ -9,6 +9,10 @@
# C stuff
*.o
# Assembly stuff
*.S
*.s
# Windows stuff
*.obj
*.exe
@@ -34,153 +38,119 @@ Makefile.in
*.lo
*.la
*.def
*.pc
# man pages
*.1
*.3
# tests
test-driver
*.log
*.trs
tests/aes_wrap*
tests/arc4random_fork*
tests/asn1time*
tests/cipher*
tests/explicit_bzero*
tests/gost2814789t*
tests/mont*
tests/rfc5280time*
tests/timingsafe*
tests/*test
tests/tests.h
tests/*test.c
tests/memmem.c
tests/pbkdf2*
tests/*.pem
tests/testssl
tests/*.txt
!tests/optionstest.c
!tests/*.test
# ctags stuff
TAGS
## The initial / makes these files only get ignored in particular directories.
/autom4te.cache
autom4te.cache
# Libtool adds these, at least sometimes
INSTALL
/m4/libtool.m4
/m4/ltoptions.m4
/m4/ltsugar.m4
/m4/ltversion.m4
/m4/lt~obsolete.m4
/COPYING
!m4/check*.m4
m4/l*
/aclocal.m4
/compile
/doxygen
/config.guess
/config.log
/config.status
/config.sub
/configure
/configure.ac
/depcomp
/config.h
/config.h.in
/install-sh
/libtool
/ltmain.sh
/missing
/stamp-h1
/stamp-h2
aclocal.m4
compile
doxygen
config.guess
config.log
config.status
config.sub
configure
depcomp
config.h
config.h.in
install-sh
libtool
ltmain.sh
missing
stamp-h1
stamp-h2
crypto/Makefile.am
include/openssl/Makefile.am
ssl/Makefile.am
apps/Makefile.am
tests/Makefile.am
VERSION
crypto/VERSION
ssl/VERSION
tls/VERSION
libtls-standalone/VERSION
ssl/*.c
ssl/*.h
tls/*.c
tls/*.h
include/pqueue.h
include/tls.h
include/openssl/*.h
include/openssl/*.he
apps/*.c
apps/*.h
apps/*.cnf
apps/openssl
crypto/compat/arc4random.c
crypto/compat/chacha_private.h
crypto/compat/explicit_bzero.c
crypto/compat/getentropy_*.c
crypto/compat/reallocarray.c
crypto/compat/strlcat.c
crypto/compat/strlcpy.c
crypto/compat/strndup.c
crypto/compat/strnlen.c
crypto/compat/strtonum.c
crypto/compat/timingsafe_bcmp.c
crypto/compat/timingsafe_memcmp.c
crypto/compat/arc4random_*.h
/apps/nc/*.h
/apps/nc/*.c
/apps/nc/nc*
!/apps/nc/readpassphrase.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/Makefile.am.*
!/crypto/compat/arc4random.h
!/crypto/compat/b_win.c
!/crypto/compat/explicit_bzero_win.c
!/crypto/compat/posix_win.c
!/crypto/compat/bsd_asprintf.c
!/crypto/compat/inet_pton.c
!/crypto/compat/timegm.c
!/crypto/compat/ui_openssl_win.c
!/crypto/CMakeLists.txt
/crypto
!/libtls-standalone/compat/Makefile.am
/libtls-standalone/include/*.h
/libtls-standalone/src/*.c
/libtls-standalone/src/*.h
/libtls-standalone/src
/libtls-standalone/tests/test
/libtls-standalone/compat
/libtls-standalone/VERSION
/libtls-standalone/m4
/libtls-standalone/man
crypto/aes/
crypto/asn1/
crypto/bf/
crypto/bio/
crypto/bn/
crypto/buffer/
crypto/cast/
crypto/chacha/
crypto/cmac/
crypto/comp/
crypto/conf/
crypto/cpt_err.c
crypto/cryptlib.c
crypto/cryptlib.h
crypto/cversion.c
crypto/des/
crypto/dh/
crypto/dsa/
crypto/dso/
crypto/ec/
crypto/ecdh/
crypto/ecdsa/
crypto/engine/
crypto/err/
crypto/evp/
crypto/ex_data.c
crypto/hmac/
crypto/idea/
crypto/krb5/
crypto/lhash/
crypto/malloc-wrapper.c
crypto/md32_common.h
crypto/md4/
crypto/md5/
crypto/mdc2/
crypto/mem_clr.c
crypto/mem_dbg.c
crypto/modes/
crypto/o_init.c
crypto/o_str.c
crypto/o_time.c
crypto/o_time.h
crypto/objects
crypto/ocsp/
crypto/pem/
crypto/pkcs12/
crypto/pkcs7/
crypto/poly1305/
crypto/pqueue/
crypto/rand/
crypto/rc2/
crypto/rc4/
crypto/ripemd/
crypto/rsa/
crypto/sha/
crypto/stack/
crypto/ts/
crypto/txt_db/
crypto/ui/
crypto/whrlpool/
crypto/x509/
crypto/x509v3/
openbsd/
man/*.3
man/*.1
*.tar.gz
man/Makefile.am
.gitmodules
ChangeLog
COPYING

24
.travis.yml Normal file
View File

@@ -0,0 +1,24 @@
language: c
matrix:
include:
- compiler: clang
os: osx
env: ARCH=native
- compiler: gcc
os: osx
env: ARCH=native
- compiler: clang
os: linux
env: ARCH=native
- compiler: gcc
os: linux
env: ARCH=native
- compiler: gcc
os: linux
env: ARCH=mingw32
- compiler: gcc
os: linux
env: ARCH=mingw64
script:
"./scripts/travis"

187
CMakeLists.txt Normal file
View File

@@ -0,0 +1,187 @@
cmake_minimum_required (VERSION 2.8)
include(CheckFunctionExists)
include(CheckLibraryExists)
include(CheckIncludeFiles)
project (LibreSSL)
enable_testing()
file(READ ${CMAKE_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_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_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})
if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
add_definitions(-DHAVE_ATTRIBUTE__BOUNDED__)
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
add_definitions(-D_DEFAULT_SOURCE)
add_definitions(-D_BSD_SOURCE)
add_definitions(-D_POSIX_SOURCE)
add_definitions(-D_GNU_SOURCE)
endif()
add_definitions(-DLIBRESSL_INTERNAL)
add_definitions(-DOPENSSL_NO_HW_PADLOCK)
add_definitions(-DOPENSSL_NO_ASM)
set(CMAKE_POSITION_INDEPENDENT_CODE true)
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
add_definitions(-Wno-pointer-sign)
endif()
if(MSVC)
add_definitions(-Dinline=__inline)
add_definitions(-Drestrict)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_CRT_DEPRECATED_NO_WARNINGS)
add_definitions(-D_REENTRANT -D_POSIX_THREAD_SAFE_FUNCTIONS)
add_definitions(-DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0501)
add_definitions(-DCPPFLAGS -DOPENSSL_NO_SPEED -DNO_SYSLOG -DNO_CRYPT)
set(MSVC_DISABLED_WARNINGS_LIST
"C4057" # C4057: 'initializing' : 'unsigned char *' differs in
# indirection to slightly different base types from 'char [2]'
"C4100" # 'exarg' : unreferenced formal parameter
"C4127" # conditional expression is constant
"C4242" # 'function' : conversion from 'int' to 'uint8_t',
# possible loss of data
"C4244" # 'function' : conversion from 'int' to 'uint8_t',
# possible loss of data
"C4706" # assignment within conditional expression
"C4820" # 'bytes' bytes padding added after construct 'member_name'
"C4996" # 'read': The POSIX name for this item is deprecated. Instead,
# use the ISO C++ conformant name: _read.
)
string(REPLACE "C" " -wd" MSVC_DISABLED_WARNINGS_STR
${MSVC_DISABLED_WARNINGS_LIST})
set(CMAKE_C_FLAGS "-MP -W4 ${MSVC_DISABLED_WARNINGS_STR}")
endif()
check_function_exists(asprintf HAVE_ASPRINTF)
if(HAVE_ASPRINTF)
add_definitions(-DHAVE_ASPRINTF)
endif()
check_function_exists(inet_pton HAVE_INET_PTON)
if(HAVE_INET_PTON)
add_definitions(-DHAVE_INET_PTON)
endif()
check_function_exists(reallocarray HAVE_REALLOCARRAY)
if(HAVE_REALLOCARRAY)
add_definitions(-DHAVE_REALLOCARRAY)
endif()
check_function_exists(strcasecmp HAVE_STRCASECMP)
if(HAVE_STRCASECMP)
add_definitions(-DHAVE_STRCASECMP)
endif()
check_function_exists(strlcat HAVE_STRLCAT)
if(HAVE_STRLCAT)
add_definitions(-DHAVE_STRLCAT)
endif()
check_function_exists(strlcat HAVE_STRLCPY)
if(HAVE_STRLCPY)
add_definitions(-DHAVE_STRLCPY)
endif()
check_function_exists(strndup HAVE_STRNDUP)
if(HAVE_STRNDUP)
add_definitions(-DHAVE_STRNDUP)
endif()
if(MSVC)
set(HAVE_STRNLEN)
add_definitions(-DHAVE_STRNLEN)
else()
check_function_exists(strnlen HAVE_STRNLEN)
if(HAVE_STRNLEN)
add_definitions(-DHAVE_STRNLEN)
endif()
endif()
check_function_exists(strsep HAVE_STRSEP)
if(HAVE_STRSEP)
add_definitions(-DHAVE_STRSEP)
endif()
check_function_exists(timegm HAVE_TIMEGM)
if(HAVE_TIMEGM)
add_definitions(-DHAVE_TIMEGM)
endif()
check_function_exists(arc4random_buf HAVE_ARC4RANDOM_BUF)
if(HAVE_ARC4RANDOM_BUF)
add_definitions(-DHAVE_ARC4RANDOM_BUF)
endif()
check_function_exists(explicit_bzero HAVE_EXPLICIT_BZERO)
if(HAVE_EXPLICIT_BZERO)
add_definitions(-DHAVE_EXPLICIT_BZERO)
endif()
check_function_exists(getauxval HAVE_GETAUXVAL)
if(HAVE_GETAUXVAL)
add_definitions(-DHAVE_GETAUXVAL)
endif()
check_function_exists(getentropy HAVE_GETENTROPY)
if(HAVE_GETENTROPY)
add_definitions(-DHAVE_GETENTROPY)
endif()
check_function_exists(timingsafe_bcmp HAVE_TIMINGSAFE_BCMP)
if(HAVE_TIMINGSAFE_BCMP)
add_definitions(-DHAVE_TIMINGSAFE_BCMP)
endif()
check_function_exists(timingsafe_memcmp HAVE_TIMINGSAFE_MEMCMP)
if(HAVE_MEMCMP)
add_definitions(-DHAVE_MEMCMP)
endif()
check_include_files(err.h HAVE_ERR_H)
if(HAVE_ERR_H)
add_definitions(-DHAVE_ERR_H)
endif()
set(OPENSSL_LIBS ssl crypto)
if(CMAKE_HOST_WIN32)
set(OPENSSL_LIBS ${OPENSSL_LIBS} ws2_32)
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(NOT (CMAKE_SYSTEM_NAME MATCHES "Darwin" OR MSVC))
set(BUILD_SHARED true)
endif()
add_subdirectory(crypto)
add_subdirectory(ssl)
add_subdirectory(apps)
add_subdirectory(tls)
add_subdirectory(include)
if(NOT MSVC)
add_subdirectory(man)
add_subdirectory(tests)
endif()

494
ChangeLog Normal file
View File

@@ -0,0 +1,494 @@
Because this project is maintained both in the OpenBSD tree using CVS and in
Git, it can be confusing following all of the changes.
Most of the libssl and libcrypto source code is is here in OpenBSD CVS:
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libssl/
Some of the libcrypto and OS-compatibility files for entropy and random number
generation are here:
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libcrypto/
A simplified TLS wrapper library is here:
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libtls/
The LibreSSL Portable project copies these portions of the OpenBSD tree, along
with relevant portions of the C library, to a Git repository. This makes it
easier to follow all of the relevant changes to the upstream project in a
single place:
https://github.com/libressl-portable/openbsd
The portable bits of the project are largely maintained out-of-tree, and their
history is also available from Git.
https://github.com/libressl-portable/portable
LibreSSL Portable Release Notes:
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
* Switched 'openssl dhparam' default from 512 to 2048 bits
* Reworked openssl(1) option handling
* More CRYPTO ByteString (CBC) packet parsing conversions
* Fixed 'openssl pkeyutl -verify' to exit with a 0 on success
* Fixed dozens of Coverity issues including dead code, memory leaks,
logic errors and more.
* Ensure that openssl(1) restores terminal echo state after reading a
password.
* Incorporated fix for OpenSSL Issue #3683
* LibreSSL version define LIBRESSL_VERSION_NUMBER will now be bumped
for each portable release.
* Removed workarounds for TLS client padding bugs.
* No longer disable ECDHE-ECDSA on OS X
* Removed SSLv3 support from openssl(1)
* Removed IE 6 SSLv3 workarounds.
* Modified tls_write in libtls to allow partial writes, clarified with
examples in the documentation.
* Removed RSAX engine
* Tested SSLv3 removal with the OpenBSD ports tree and found several
applications that were not ready to build without SSLv3 yet. For
now, building a program that intentionally uses SSLv3 will result in
a linker warning.
* Added TLS_method, TLS_client_method and TLS_server_method as a
replacement for the SSLv23_*method calls.
* Added initial cmake build support, including support for building with
Visual Studio, currently tested with Visual Studio 2013 Community
Edition.
* --with-enginesdir is removed as a configuration parameter
* Default cert.pem, openssl.cnf, and x509v3.cnf files are now
installed under $sysconfdir/ssl or the directory specified by
--with-openssldir. Previous versions of LibreSSL left these empty.
2.2.1 - Build fixes, feature added, features removed
* Assorted build fixes for musl, HP-UX, Mingw, Solaris.
* Initial support for Windows Embedded 2009, Server 2003, XP
* Protocol parsing conversions to BoringSSL's CRYPTO ByteString (CBS) API
* Added EC_curve_nid2nist and EC_curve_nist2nid from OpenSSL
* Removed Dynamic Engine support
* Removed unused and obsolete MDC-2DES cipher
* Removed workarounds for obsolete SSL implementations
2.2.0 - Build cleanups and new OS support, Security Updates
* AIX Support - thanks to Michael Felt
* Cygwin Support - thanks to Corinna Vinschen
* Refactored build macros, support packaging libtls independently.
There are more pieces required to support building and using OpenSSL
with libtls, but this is an initial start at providing an
independent package for people to start hacking on.
* Removal of OPENSSL_issetugid and all library getenv calls.
Applications can and should no longer rely on environment variables
for changing library behavior. OPENSSL_CONF/SSLEAY_CONF is still
supported with the openssl(1) command.
* libtls API and documentation additions
* Various bug fixes and simplifications to libssl and libcrypto
* Fixes for the following issues are integrated into LibreSSL 2.2.0:
- CVE-2015-1788 - Malformed ECParameters causes infinite loop
- CVE-2015-1789 - Exploitable out-of-bounds read in X509_cmp_time
- CVE-2015-1792 - CMS verify infinite loop with unknown hash function
* The following CVEs did not apply to LibreSSL or were fixed in
earlier releases:
- CVE-2015-4000 - DHE man-in-the-middle protection (Logjam)
- CVE-2015-1790 - PKCS7 crash with missing EnvelopedContent
- CVE-2014-8176 - Invalid free in DTLS
* Fixes for the following CVEs are still in review for LibreSSL
- CVE-2015-1791 - Race condition handling NewSessionTicket
2.1.6 - Security update
* Fixes for the following issues are integrated into LibreSSL 2.1.6:
- CVE-2015-0209 - Use After Free following d2i_ECPrivatekey error
- CVE-2015-0286 - Segmentation fault in ASN1_TYPE_cmp
- CVE-2015-0287 - ASN.1 structure reuse memory corruption
- CVE-2015-0288 - X509_to_X509_REQ NULL pointer deref
- CVE-2015-0289 - PKCS7 NULL pointer dereferences
* The fix for CVE-2015-0207 - Segmentation fault in DTLSv1_listen
is integrated for safety, but LibreSSL is not vulnerable.
* Libtls is now built by default. The --enable-libtls
configuration option is no longer required.
The libtls API is now stable for the 2.1.x series.
2.1.5 - Bug fixes and a security update
* Fix incorrect comparison function in openssl(1) certhash command.
Thanks to Christian Neukirchen / Void Linux.
* Windows port improvements and bug fixes.
- Removed a dependency on libgcc in 32-bit dynamic libraries.
- Correct a hang in openssl(1) reading from stdin on an connection.
- Initialize winsock in openssl(1) earlier, allow 'openssl ocsp' and
any other network-related commands to function properly.
* Reject all server DH keys smaller than 1024 bits.
2.1.4 - Security and feature updates
* Improvements to libtls:
- a new API for loading CA chains directly from memory instead of a
file, allowing verification with privilege separation in a chroot
without direct access to CA certificate files.
- Ciphers default to TLSv1.2 with AEAD and PFS.
- Improved error handling and message generation
- New APIs and improved documentation
* Added X509_STORE_load_mem API for loading certificates from memory.
This facilitates accessing certificates from a chrooted environment.
* New AEAD "MAC alias" allows configuring TLSv1.2 AEAD ciphers by
using 'TLSv1.2+AEAD' as the cipher selection string.
* Dead and disabled code removal including MD5, Netscape workarounds,
non-POSIX IO, SCTP, RFC 3779 support, many #if 0 sections, and more.
* ASN1 macro maze expanded to aid reading and searching the code.
* NULL pointer asserts removed in favor of letting the OS/signal
handler catch them.
* Refactored argument handling in openssl(1) for consistency and
maintainability.
* New openssl(1) command 'certhash' replaces the c_rehash script.
* Support for building with OPENSSL_NO_DEPRECATED
* Server-side support for TLS_FALLBACK_SCSV for compatibility with
various auditor and vulnerability scanners.
* Dozens of issues found with the Coverity scanner fixed.
* Security Updates:
- Fix a minor information leak that was introduced in t1_lib.c
r1.71, whereby an additional 28 bytes of .rodata (or .data) is
provided to the network. In most cases this is a non-issue since
the memory content is already public. Issue found and reported by
Felix Groebert of the Google Security Team.
- Fixes for the following low-severity issues were integrated into
LibreSSL from OpenSSL 1.0.1k:
CVE-2015-0205 - DH client certificates accepted without
verification
CVE-2014-3570 - Bignum squaring may produce incorrect results
CVE-2014-8275 - Certificate fingerprints can be modified
CVE-2014-3572 - ECDHE silently downgrades to ECDH [Client]
Reported by Karthikeyan Bhargavan of the PROSECCO team at INRIA.
The following CVEs were fixed in earlier LibreSSL releases:
CVE-2015-0206 - Memory leak handling repeated DLTS records
CVE-2014-3510 - Flaw handling DTLS anonymous EC(DH) ciphersuites.
The following CVEs did not apply to LibreSSL:
CVE-2014-3571 - DTLS segmentation fault in dtls1_get_record
CVE-2014-3569 - no-ssl3 configuration sets method to NULL
CVE-2015-0204 - RSA silently downgrades to EXPORT_RSA
2.1.3 - Security update and OS support improvements
* Fixed various memory leaks in DTLS, including fixes for
CVE-2015-0206.
* Added Application-Layer Protocol Negotiation (ALPN) support.
* Removed GOST R 34.10-94 signature authentication.
* Removed nonfunctional Netscape browser-hang workaround code.
* Simplfied and refactored SSL/DTLS handshake code.
* Added SHA256 Camellia cipher suites for TLS 1.2 from RFC 5932.
* Hide timing info about padding errors during handshakes.
* Improved libtls support for non-blocking sockets, added randomized
session ID contexts. Work is ongoing with this library - feedback
and potential use-cases are welcome.
* Support building Windows DLLs.
Thanks to Jan Engelhard.
* Packaged config wrapper for better compatibility with OpenSSL-based
build systems.
Thanks to @technion from github
* Ensure the stack is marked non-executable for assembly sections.
Thanks to Anthony G. Bastile.
* Enable extra compiler hardening flags by default, where applicable.
The default set of hardening features can vary by OS to OS, so
feedback is welcome on this. To disable the default hardening flags,
specify '--disable-hardening' during configure.
Thanks to Jim Barlow
* Initial HP-UX support, tested with HP-UX 11.31 ia64
Thanks to Kinichiro Inoguchi
* Initial NetBSD support, tested with NetBSD 6.1.5 x86_64
Imported from OpenNTPD, thanks to @gitisihara from github
2.1.2 - Many new features and improvements
* Added reworked GOST cipher suite support
thanks to Dmitry Eremin-Solenikov
* Enabled Camellia ciphers due to improved patent situation
* Use builtin arc4random implementation on OS X and FreeBSD
this addresses some deficiencies in the native implementations of
these operating systems, see commit logs for more information
* Added initial Windows mingw-w64 support (32 and 64-bit)
thanks to Song Dongsheng and others for code and feedback
* Enabled assembly optimizations on x86_64 CPUs
supports Linux, *BSD, Solaris and OS X operating systems
thanks to Wouter Clarie for the initial implementation
* Added no_ssl3/no_tls1_1/no_tls1_2 options to openssl(1)
* Improved build infrastructure, 'make distcheck' now passes
this simplifies and speeds developer efficiency
thanks to Dmitry Eremin-Solenikov and Wouter Clarie
* Allow conditional building of the libtls library
expect the API and ABI of the library to change
feedback is welcome
* Fixes for more memory leaks, cleanups, etc.
2.1.1 - Security update
* Address POODLE attack by disabling SSLv3 by default
* Fix Eliptical Curve cipher selection bug
(https://github.com/libressl-portable/portable/issues/35)
2.1.0 - First release from the OpenBSD 5.7 tree
* Added support for automatic ephemeral EC keys
* Fixes for many memory leaks and overflows in error handlers
* The TLS padding extension (that works around bugs in F5 terminators) is
off by default
* support for getrandom(2) on Linux 3.17
* the NO_ASM macro is no longer being set, providing the first bits toward
enabling other assembly offloads.
2.0.5 - Fixes for CVEs from OpenSSL 1.0.1i
* CVE-2014-3506
* CVE-2014-3507
* CVE-2014-3508 (partially vulnerable)he
* CVE-2014-3509
* CVE-2014-3510
* CVE-2014-3511
* Synced LibreSSL Portable with the release version of OpenBSD 5.6
2.0.4 - Portability fixes, deleted unused SRP code
2.0.3 - Portability fixes, improvements to fork detection
2.0.2 - Address arc4random fork PID wraparound issues with pthread_atfork
2.0.1 - Portability fixes:
* Removed -Werror and and other non-portable compiler flags
* Allow setting OPENSSLDIR and ENGINSDIR
2.0.0 - First release from the OpenBSD 5.6 tree
* Removal of many obsolete features and coding conventions from the OpenSSL
1.0.1h source

View File

@@ -1,5 +1,8 @@
SUBDIRS = crypto ssl include apps tests man
SUBDIRS = crypto ssl tls include apps tests man
ACLOCAL_AMFLAGS = -I m4
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libcrypto.pc libssl.pc openssl.pc
pkgconfig_DATA = libcrypto.pc libssl.pc libtls.pc openssl.pc
EXTRA_DIST = README.md README.windows VERSION config scripts
EXTRA_DIST += CMakeLists.txt

View File

@@ -1,4 +1,2 @@
AM_CPPFLAGS = -I$(top_srcdir)/include
AM_CPPFLAGS += -DOPENSSL_NO_ASM
AM_CPPFLAGS += -DHAVE_CRYPTODEV
AM_CPPFLAGS += -DLIBRESSL_INTERNAL
AM_CFLAGS =
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/include/compat -DLIBRESSL_INTERNAL

1
OPENBSD_BRANCH Normal file
View File

@@ -0,0 +1 @@
master

34
README
View File

@@ -1,34 +0,0 @@
This package is the official portable version of LibreSSL
(http://www.libressl.org).
LibreSSL is a fork of OpenSSL developed by the OpenBSD project
(http://www.openbsd.org). LibreSSL is developed on OpenBSD. This
package then adds portability shims for other operating systems.
Official release tarballs are available at your friendly neighborhood
OpenBSD mirror in directory LibreSSL, e.g.:
http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/
although it is suggested you use a mirror.
Development is done in the upstream OpenBSD codebase. A github clone
of the official repositories is kept at:
https://github.com/libressl-portable
We update this repository from the OpenBSD respositories
semi-frequently, so changes may not show up in GitHub immediately.
The GitHub repository should be used for informational purposes
only.
./configure && make check && make install
See crypto/compat for the bulk of the local compatibility code.
It will likely build on any reasonably modern version of Linux, Solaris,
or OSX with a sane compiler and C library.
Note: Our policy is generally to use your system provided intrinsics.
If your system provides security sensitive functions (such as
arc4random(), issetugid(), calloc(), getentropy(), and others) we will
assume they are implemented correctly and securely. If they are
not please contact your OS provider.

133
README.md Normal file
View File

@@ -0,0 +1,133 @@
![LibreSSL image](http://www.libressl.org/images/libressl.jpg)
## Official portable version of [LibreSSL](http://www.libressl.org) ##
[![Build Status](https://travis-ci.org/libressl-portable/portable.svg?branch=master)](https://travis-ci.org/libressl-portable/portable)
LibreSSL is a fork of [OpenSSL](https://www.openssl.org) 1.0.1g developed by the
[OpenBSD](http://www.openbsd.org) project. Our goal is to modernize the codebase,
improve security, and apply best practice development processes from OpenBSD.
## Compatibility with OpenSSL: ##
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
present in OpenSSL. The current common API subset is OpenSSL 1.0.1.
LibreSSL is not ABI compatible with any release of OpenSSL, or necessarily
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's installed library version numbers are incremented to account for
ABI and API changes.
## Compatibility with other operating systems: ##
While primarily developed on and taking advantage of APIs available on OpenBSD,
the LibreSSL portable project attempts to provide working alternatives for
other operating systems, and assists with improving OS-native implementations
where possible.
At the time of this writing, LibreSSL is know to build and work on:
* Linux (kernel 3.17 or later recommended)
* FreeBSD (tested with 9.2 and later)
* NetBSD (tested with 6.1.5)
* HP-UX (11i)
* Solaris (11 and later preferred)
* Mac OS X (tested with 10.8 and later)
* AIX (5.3 and later)
LibreSSL also supports the following Windows environments:
* Microsoft Windows (XP or higher, x86 and x64)
* Wine (32-bit and 64-bit)
* Builds with Mingw-w64, Cygwin, and Visual Studio
Official release tarballs are available at your friendly neighborhood
OpenBSD mirror in directory
[LibreSSL](http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/),
although we suggest that you use a [mirror](http://www.openbsd.org/ftp.html).
The LibreSSL portable build framework is also
[mirrored](https://github.com/libressl-portable/portable) in Github.
Please report bugs either to the public libressl@openbsd.org mailing list,
or to the github
[issue tracker](https://github.com/libressl-portable/portable/issues)
Severe vulnerabilities or bugs requiring coordination with OpenSSL can be
sent to the core team at libressl-security@openbsd.org.
## Prerequisites when building from git ##
If you have checked this source using Git, follow these initial steps to
prepare the source tree for building:
1. Ensure you have the following packages installed:
automake, autoconf, git, libtool, perl, pod2man
2. Run './autogen.sh' to prepare the source tree for building or
run './dist.sh' to prepare a tarball.
## Building LibreSSL ##
Once you have a source tree from Git or FTP, run these commands to build and
install the package on most systems:
```sh
./configure # see ./configure --help for configuration options
make check # runs builtin unit tests
make install # set DESTDIR= to install to an alternate location
```
If you wish to use the CMake build system, use these commands:
```sh
mkdir build
cd build
cmake ..
make
make test
```
For faster builds, you can use Ninja as well:
```sh
mkdir build-ninja
cd build-ninja
cmake -G"Ninja" ..
ninja
ninja test
```
### OS specific build information: ###
#### HP-UX (11i) ####
Set the UNIX_STD environment variable to '2003' before running 'configure'
in order to build with the HP C/aC++ compiler. See the "standards(5)" man
page for more details.
```sh
export UNIX_STD=2003
./configure
make
```
#### Windows - Mingw-w64 ####
LibreSSL builds against relatively recent versions of Mingw-w64, not to be
confused with the original mingw.org project. Mingw-w64 3.2 or later
should work. See README.windows for more information
#### Windows - Visual Studio ####
LibreSSL builds using the CMake target "Visual Studio 12 2013", and may build
against older/newer targets as well. To generate a Visual Studio project,
install CMake, enter the LibreSSL source directory and run:
```sh
mkdir build-vs2013
cd build-vs2013
cmake -G"Visual Studio 12 2013" ..
```
This will generate a LibreSSL.sln file that you can incorporate into other
projects or build by itself.

45
README.windows Normal file
View File

@@ -0,0 +1,45 @@
# Building
For Windows systems, LibreSSL supports the mingw-w64 toolchain, which can use
GCC or Clang as the compiler. Contrary to its name, mingw-w64 supports both
32-bit and 64-bit build environments. If your project already uses 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
building LibreSSL. Please try it with a recent toolchain if you encounter
troubles. Cygwin provides an easy method of installing the latest mingw-w64
cross compilers on Windows.
To configure and build LibreSSL for a 32-bit system, use the following
build steps:
CC=i686-w64-mingw32-gcc ./configure --host=i686-w64-mingw32
make
make check
For 64-bit builds, use these instead:
CC=x86_64-w64-mingw32-gcc ./configure --host=x86_64-w64-mingw32
make
make check
# Using Libressl with Visual Studio
A script for generating ready-to-use .DLL and static .LIB files is included in
the source repository at
https://github.com/libressl-portable/portable/blob/master/dist-win.sh
This script uses mingw-w64 to build LibreSSL and then uses Visual Studio tools
to generate compatible library import files ready-to-use with Visual
Studio projects. Static and dynamic libraries are included. The script uses
cv2pdb to generate Visual Studio and windbg compatible debug files. cv2pdb is a
tool developed for the D language and can be found here:
https://github.com/rainers/cv2pdb
Pre-built Windows binaries are available with LibreSSL releases if you do not
have a mingw-w64 build environment. Mingw-w64 code is largely, but not 100%,
compatible with code built from Visual Studio. Notably, FILE * pointers cannot
be shared between code built for Mingw-w64 and Visual Studio.
As of LibreSSL 2.2.2, Visual Studio Native builds can be produced using CMake.
This produces ABI-compatible libraries for linking with native code generated
by Visual Studio.

View File

@@ -1 +0,0 @@
2.1.0

80
apps/CMakeLists.txt Normal file
View File

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

5
apps/Makefile.am Normal file
View File

@@ -0,0 +1,5 @@
include $(top_srcdir)/Makefile.am.common
SUBDIRS = openssl nc
EXTRA_DIST = CMakeLists.txt

View File

@@ -1,15 +0,0 @@
include $(top_srcdir)/Makefile.am.common
bin_PROGRAMS = openssl
openssl_CFLAGS = $(USER_CFLAGS)
openssl_LDADD = $(PLATFORM_LDADD)
openssl_LDADD += $(top_builddir)/ssl/libssl.la
openssl_LDADD += $(top_builddir)/crypto/libcrypto.la
openssl_SOURCES =
noinst_HEADERS =
if NO_STRTONUM
openssl_SOURCES += strtonum.c
endif

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

@@ -0,0 +1,49 @@
include $(top_srcdir)/Makefile.am.common
if BUILD_NC
if ENABLE_NC
bin_PROGRAMS = nc
else
noinst_PROGRAMS = nc
endif
EXTRA_DIST = nc.1
nc_LDADD = $(PLATFORM_LDADD) $(PROG_LDADD)
nc_LDADD += $(top_builddir)/crypto/libcrypto.la
nc_LDADD += $(top_builddir)/ssl/libssl.la
nc_LDADD += $(top_builddir)/tls/libtls.la
AM_CPPFLAGS += -I$(top_srcdir)/apps/nc/compat
if OPENSSLDIR_DEFINED
AM_CPPFLAGS += -DDEFAULT_CA_FILE=\"@OPENSSLDIR@/cert.pem\"
else
AM_CPPFLAGS += -DDEFAULT_CA_FILE=\"$(sysconfdir)/ssl/cert.pem\"
endif
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;
}

315
apps/nc/compat/base64.c Normal file
View File

@@ -0,0 +1,315 @@
/* $OpenBSD: base64.c,v 1.8 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.
*/
/*
* Portions Copyright (c) 1995 by International Business Machines, Inc.
*
* International Business Machines, Inc. (hereinafter called IBM) grants
* permission under its copyrights to use, copy, modify, and distribute this
* Software with or without fee, provided that the above copyright notice and
* all paragraphs of this notice appear in all copies, and that the name of IBM
* not be used in connection with the marketing of any product incorporating
* the Software or modifications thereof, without specific, written prior
* permission.
*
* To the extent it has a right to do so, IBM grants an immunity from suit
* under its patents, if any, for the use, sale or manufacture of products to
* the extent that such products are used for performing Domain Name System
* dynamic updates in TCP/IP networks by means of the Software. No immunity is
* granted for any product per se or for any other function of any product.
*
* THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
* DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
* IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>
#include <ctype.h>
#include <resolv.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static const char Base64[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
static const char Pad64 = '=';
/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt)
The following encoding technique is taken from RFC 1521 by Borenstein
and Freed. It is reproduced here in a slightly edited form for
convenience.
A 65-character subset of US-ASCII is used, enabling 6 bits to be
represented per printable character. (The extra 65th character, "=",
is used to signify a special processing function.)
The encoding process represents 24-bit groups of input bits as output
strings of 4 encoded characters. Proceeding from left to right, a
24-bit input group is formed by concatenating 3 8-bit input groups.
These 24 bits are then treated as 4 concatenated 6-bit groups, each
of which is translated into a single digit in the base64 alphabet.
Each 6-bit group is used as an index into an array of 64 printable
characters. The character referenced by the index is placed in the
output string.
Table 1: The Base64 Alphabet
Value Encoding Value Encoding Value Encoding Value Encoding
0 A 17 R 34 i 51 z
1 B 18 S 35 j 52 0
2 C 19 T 36 k 53 1
3 D 20 U 37 l 54 2
4 E 21 V 38 m 55 3
5 F 22 W 39 n 56 4
6 G 23 X 40 o 57 5
7 H 24 Y 41 p 58 6
8 I 25 Z 42 q 59 7
9 J 26 a 43 r 60 8
10 K 27 b 44 s 61 9
11 L 28 c 45 t 62 +
12 M 29 d 46 u 63 /
13 N 30 e 47 v
14 O 31 f 48 w (pad) =
15 P 32 g 49 x
16 Q 33 h 50 y
Special processing is performed if fewer than 24 bits are available
at the end of the data being encoded. A full encoding quantum is
always completed at the end of a quantity. When fewer than 24 input
bits are available in an input group, zero bits are added (on the
right) to form an integral number of 6-bit groups. Padding at the
end of the data is performed using the '=' character.
Since all base64 input is an integral number of octets, only the
-------------------------------------------------
following cases can arise:
(1) the final quantum of encoding input is an integral
multiple of 24 bits; here, the final unit of encoded
output will be an integral multiple of 4 characters
with no "=" padding,
(2) the final quantum of encoding input is exactly 8 bits;
here, the final unit of encoded output will be two
characters followed by two "=" padding characters, or
(3) the final quantum of encoding input is exactly 16 bits;
here, the final unit of encoded output will be three
characters followed by one "=" padding character.
*/
int
b64_ntop(src, srclength, target, targsize)
u_char const *src;
size_t srclength;
char *target;
size_t targsize;
{
size_t datalength = 0;
u_char input[3];
u_char output[4];
int i;
while (2 < srclength) {
input[0] = *src++;
input[1] = *src++;
input[2] = *src++;
srclength -= 3;
output[0] = input[0] >> 2;
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
output[3] = input[2] & 0x3f;
if (datalength + 4 > targsize)
return (-1);
target[datalength++] = Base64[output[0]];
target[datalength++] = Base64[output[1]];
target[datalength++] = Base64[output[2]];
target[datalength++] = Base64[output[3]];
}
/* Now we worry about padding. */
if (0 != srclength) {
/* Get what's left. */
input[0] = input[1] = input[2] = '\0';
for (i = 0; i < srclength; i++)
input[i] = *src++;
output[0] = input[0] >> 2;
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
if (datalength + 4 > targsize)
return (-1);
target[datalength++] = Base64[output[0]];
target[datalength++] = Base64[output[1]];
if (srclength == 1)
target[datalength++] = Pad64;
else
target[datalength++] = Base64[output[2]];
target[datalength++] = Pad64;
}
if (datalength >= targsize)
return (-1);
target[datalength] = '\0'; /* Returned value doesn't count \0. */
return (datalength);
}
/* skips all whitespace anywhere.
converts characters, four at a time, starting at (or after)
src from base - 64 numbers into three 8 bit bytes in the target area.
it returns the number of data bytes stored at the target, or -1 on error.
*/
int
b64_pton(src, target, targsize)
char const *src;
u_char *target;
size_t targsize;
{
int tarindex, state, ch;
u_char nextbyte;
char *pos;
state = 0;
tarindex = 0;
while ((ch = (unsigned char)*src++) != '\0') {
if (isspace(ch)) /* Skip whitespace anywhere. */
continue;
if (ch == Pad64)
break;
pos = strchr(Base64, ch);
if (pos == 0) /* A non-base64 character. */
return (-1);
switch (state) {
case 0:
if (target) {
if (tarindex >= targsize)
return (-1);
target[tarindex] = (pos - Base64) << 2;
}
state = 1;
break;
case 1:
if (target) {
if (tarindex >= targsize)
return (-1);
target[tarindex] |= (pos - Base64) >> 4;
nextbyte = ((pos - Base64) & 0x0f) << 4;
if (tarindex + 1 < targsize)
target[tarindex+1] = nextbyte;
else if (nextbyte)
return (-1);
}
tarindex++;
state = 2;
break;
case 2:
if (target) {
if (tarindex >= targsize)
return (-1);
target[tarindex] |= (pos - Base64) >> 2;
nextbyte = ((pos - Base64) & 0x03) << 6;
if (tarindex + 1 < targsize)
target[tarindex+1] = nextbyte;
else if (nextbyte)
return (-1);
}
tarindex++;
state = 3;
break;
case 3:
if (target) {
if (tarindex >= targsize)
return (-1);
target[tarindex] |= (pos - Base64);
}
tarindex++;
state = 0;
break;
}
}
/*
* We are done decoding Base-64 chars. Let's see if we ended
* on a byte boundary, and/or with erroneous trailing characters.
*/
if (ch == Pad64) { /* We got a pad char. */
ch = (unsigned char)*src++; /* Skip it, get next. */
switch (state) {
case 0: /* Invalid = in first position */
case 1: /* Invalid = in second position */
return (-1);
case 2: /* Valid, means one byte of info */
/* Skip any number of spaces. */
for (; ch != '\0'; ch = (unsigned char)*src++)
if (!isspace(ch))
break;
/* Make sure there is another trailing = sign. */
if (ch != Pad64)
return (-1);
ch = (unsigned char)*src++; /* Skip the = */
/* Fall through to "single trailing =" case. */
/* FALLTHROUGH */
case 3: /* Valid, means two bytes of info */
/*
* We know this char is an =. Is there anything but
* whitespace after it?
*/
for (; ch != '\0'; ch = (unsigned char)*src++)
if (!isspace(ch))
return (-1);
/*
* Now make sure for cases 2 and 3 that the "extra"
* bits that slopped past the last full byte were
* zeros. If we don't check them, they become a
* subliminal channel.
*/
if (target && tarindex < targsize &&
target[tarindex] != 0)
return (-1);
}
} else {
/*
* We ended by seeing the end of the string. Make sure we
* have no partial bytes lying around.
*/
if (state != 0)
return (-1);
}
return (tarindex);
}

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

65
apps/nc/compat/strtonum.c Normal file
View File

@@ -0,0 +1,65 @@
/* $OpenBSD: strtonum.c,v 1.7 2013/04/17 18:40:58 tedu Exp $ */
/*
* Copyright (c) 2004 Ted Unangst and Todd Miller
* All rights reserved.
*
* 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 <errno.h>
#include <limits.h>
#include <stdlib.h>
#define INVALID 1
#define TOOSMALL 2
#define TOOLARGE 3
long long
strtonum(const char *numstr, long long minval, long long maxval,
const char **errstrp)
{
long long ll = 0;
int error = 0;
char *ep;
struct errval {
const char *errstr;
int err;
} ev[4] = {
{ NULL, 0 },
{ "invalid", EINVAL },
{ "too small", ERANGE },
{ "too large", ERANGE },
};
ev[0].err = errno;
errno = 0;
if (minval > maxval) {
error = INVALID;
} else {
ll = strtoll(numstr, &ep, 10);
if (numstr == ep || *ep != '\0')
error = INVALID;
else if ((ll == LLONG_MIN && errno == ERANGE) || ll < minval)
error = TOOSMALL;
else if ((ll == LLONG_MAX && errno == ERANGE) || ll > maxval)
error = TOOLARGE;
}
if (errstrp != NULL)
*errstrp = ev[error].errstr;
errno = ev[error].err;
if (error)
ll = 0;
return (ll);
}

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

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 = $(PLATFORM_LDADD) $(PROG_LDADD)
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 += 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
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

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

@@ -0,0 +1,60 @@
/*
* 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_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;
}
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

@@ -0,0 +1,13 @@
/*
* Public domain
* certhash dummy implementation for platforms without symlinks
*/
#include "apps.h"
int
certhash_main(int argc, char **argv)
{
fprintf(stderr, "certhash is not enabled on this platform\n");
return (1);
}

View File

@@ -0,0 +1,327 @@
/*
* Public domain
*
* poll(2) emulation for Windows
*
* This emulates just-enough poll functionality on Windows to work in the
* context of the openssl(1) program. This is not a replacement for
* POSIX.1-2001 poll(2), though it may come closer than I care to admit.
*
* Dongsheng Song <dongsheng.song@gmail.com>
* Brent Cook <bcook@openbsd.org>
*/
#include <conio.h>
#include <errno.h>
#include <io.h>
#include <poll.h>
#include <ws2tcpip.h>
static int
conn_is_closed(int fd)
{
char buf[1];
int ret = recv(fd, buf, 1, MSG_PEEK);
if (ret == -1) {
switch (WSAGetLastError()) {
case WSAECONNABORTED:
case WSAECONNRESET:
case WSAENETRESET:
case WSAESHUTDOWN:
return 1;
}
}
return 0;
}
static int
conn_has_oob_data(int fd)
{
char buf[1];
return (recv(fd, buf, 1, MSG_PEEK | MSG_OOB) == 1);
}
static int
is_socket(int fd)
{
if (fd < 3)
return 0;
WSANETWORKEVENTS events;
return (WSAEnumNetworkEvents((SOCKET)fd, NULL, &events) == 0);
}
static int
compute_select_revents(int fd, short events,
fd_set *rfds, fd_set *wfds, fd_set *efds)
{
int rc = 0;
if ((events & (POLLIN | POLLRDNORM | POLLRDBAND)) &&
FD_ISSET(fd, rfds)) {
if (conn_is_closed(fd))
rc |= POLLHUP;
else
rc |= POLLIN | POLLRDNORM;
}
if ((events & (POLLOUT | POLLWRNORM | POLLWRBAND)) &&
FD_ISSET(fd, wfds))
rc |= POLLOUT;
if (FD_ISSET(fd, efds)) {
if (conn_is_closed(fd))
rc |= POLLHUP;
else if (conn_has_oob_data(fd))
rc |= POLLRDBAND | POLLPRI;
}
return rc;
}
static int
compute_wait_revents(HANDLE h, short events, int object, int wait_rc)
{
int rc = 0;
INPUT_RECORD record;
DWORD num_read;
/*
* Assume we can always write to file handles (probably a bad
* assumption but works for now, at least it doesn't block).
*/
if (events & (POLLOUT | POLLWRNORM))
rc |= POLLOUT;
/*
* Check if this handle was signaled by WaitForMultipleObjects
*/
if (wait_rc >= WAIT_OBJECT_0 && (object == (wait_rc - WAIT_OBJECT_0))
&& (events & (POLLIN | POLLRDNORM))) {
/*
* Check if this file is stdin, and if so, if it is a console.
*/
if (h == GetStdHandle(STD_INPUT_HANDLE) &&
PeekConsoleInput(h, &record, 1, &num_read) == 1) {
/*
* Handle the input console buffer differently,
* since it can signal on other events like
* window and mouse, but read can still block.
*/
if (record.EventType == KEY_EVENT &&
record.Event.KeyEvent.bKeyDown) {
rc |= POLLIN;
} else {
/*
* Flush non-character events from the
* console buffer.
*/
ReadConsoleInput(h, &record, 1, &num_read);
}
} else {
rc |= POLLIN;
}
}
return rc;
}
static int
wsa_select_errno(int err)
{
switch (err) {
case WSAEINTR:
case WSAEINPROGRESS:
errno = EINTR;
break;
case WSAEFAULT:
/*
* Windows uses WSAEFAULT for both resource allocation failures
* and arguments not being contained in the user's address
* space. So, we have to choose EFAULT or ENOMEM.
*/
errno = EFAULT;
break;
case WSAEINVAL:
errno = EINVAL;
break;
case WSANOTINITIALISED:
errno = EPERM;
break;
case WSAENETDOWN:
errno = ENOMEM;
break;
}
return -1;
}
int
poll(struct pollfd *pfds, nfds_t nfds, int timeout_ms)
{
nfds_t i;
int timespent_ms, looptime_ms;
/*
* select machinery
*/
fd_set rfds, wfds, efds;
int rc;
int num_sockets;
/*
* wait machinery
*/
DWORD wait_rc;
HANDLE handles[FD_SETSIZE];
int num_handles;
if (pfds == NULL) {
errno = EINVAL;
return -1;
}
if (nfds <= 0) {
return 0;
}
FD_ZERO(&rfds);
FD_ZERO(&wfds);
FD_ZERO(&efds);
num_sockets = 0;
num_handles = 0;
for (i = 0; i < nfds; i++) {
if ((int)pfds[i].fd < 0)
continue;
if (is_socket(pfds[i].fd)) {
if (num_sockets >= FD_SETSIZE) {
errno = EINVAL;
return -1;
}
FD_SET(pfds[i].fd, &efds);
if (pfds[i].events &
(POLLIN | POLLRDNORM | POLLRDBAND)) {
FD_SET(pfds[i].fd, &rfds);
}
if (pfds[i].events &
(POLLOUT | POLLWRNORM | POLLWRBAND)) {
FD_SET(pfds[i].fd, &wfds);
}
num_sockets++;
} else {
if (num_handles >= FD_SETSIZE) {
errno = EINVAL;
return -1;
}
handles[num_handles++] =
(HANDLE)_get_osfhandle(pfds[i].fd);
}
}
/*
* Determine if the files, pipes, sockets, consoles, etc. have signaled.
*
* Do this by alternating a loop between WaitForMultipleObjects for
* non-sockets and and select for sockets.
*
* I tried to implement this all in terms of WaitForMultipleObjects
* with a select-based 'poll' of the sockets at the end to get extra
* specific socket status.
*
* However, the cost of setting up an event handle for each socket and
* cleaning them up reliably was pretty high. Since the event handle
* associated with a socket is also global, creating a new one here
* cancels one that may exist externally to this function.
*
* At any rate, even if global socket event handles were not an issue,
* the 'FD_WRITE' status of a socket event handle does not behave in an
* expected fashion, being triggered by an edge on a write buffer rather
* than simply triggering if there is space available.
*/
timespent_ms = 0;
wait_rc = WAIT_FAILED;
if (timeout_ms < 0)
timeout_ms = INFINITE;
looptime_ms = timeout_ms > 100 ? 100 : timeout_ms;
do {
struct timeval tv = {0, looptime_ms * 1000};
int handle_signaled = 0;
/*
* Check if any file handles have signaled
*/
if (num_handles) {
wait_rc = WaitForMultipleObjects(num_handles, handles,
FALSE, 0);
if (wait_rc == WAIT_FAILED) {
/*
* The documentation for WaitForMultipleObjects
* does not specify what values GetLastError
* may return here. Rather than enumerate
* badness like for wsa_select_errno, assume a
* general errno value.
*/
errno = ENOMEM;
return 0;
}
}
/*
* If we signaled on a file handle, don't wait on the sockets.
*/
if (wait_rc >= WAIT_OBJECT_0 &&
(wait_rc <= WAIT_OBJECT_0 + num_handles - 1)) {
tv.tv_usec = 0;
handle_signaled = 1;
}
/*
* Check if any sockets have signaled
*/
rc = select(0, &rfds, &wfds, &efds, &tv);
if (!handle_signaled && rc == SOCKET_ERROR)
return wsa_select_errno(WSAGetLastError());
if (handle_signaled || (num_sockets && rc > 0))
break;
timespent_ms += looptime_ms;
} while (timespent_ms < timeout_ms);
rc = 0;
num_handles = 0;
for (i = 0; i < nfds; i++) {
pfds[i].revents = 0;
if ((int)pfds[i].fd < 0)
continue;
if (is_socket(pfds[i].fd)) {
pfds[i].revents = compute_select_revents(pfds[i].fd,
pfds[i].events, &rfds, &wfds, &efds);
} else {
pfds[i].revents = compute_wait_revents(
handles[num_handles], pfds[i].events, num_handles,
wait_rc);
num_handles++;
}
if (pfds[i].revents)
rc++;
}
return rc;
}

View File

@@ -4,3 +4,12 @@ set -e
./update.sh
mkdir -p m4
autoreconf -i -f
# Patch libtool 2.4.2 to pass -fstack-protector as a linker argument
sed 's/-fuse-linker-plugin)/-fuse-linker-plugin|-fstack-protector*)/' \
ltmain.sh > ltmain.sh.fixed
mv -f ltmain.sh.fixed ltmain.sh
# Update config scripts and fixup permissions
find . ! -perm -u=w -exec chmod u+w {} \;
cp scripts/config.* .

70
check-release.sh Executable file
View File

@@ -0,0 +1,70 @@
#!/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 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

17
config Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/sh
# This file exists for backwards-compatibility with build systems that expect a
# config script similar to OpenSSL's.
# New software should prefer the native configure script over this one.
ARGS=""
for var in "$@"; do
case $var in
no-shared ) ARGS="$ARGS --disable-shared";;
no-asm ) ARGS="$ARGS --disable-asm";;
--prefix* ) ARGS="$ARGS $var";;
esac
done
./configure $ARGS

146
configure.ac Normal file
View File

@@ -0,0 +1,146 @@
# Copyright (c) 2014-2015 Brent Cook
#
# 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.
AC_INIT([libressl], m4_esyscmd([tr -d '\n' < VERSION]))
AC_SUBST([LIBCRYPTO_VERSION], m4_esyscmd([tr -d '\n' < crypto/VERSION]))
AC_SUBST([LIBSSL_VERSION], m4_esyscmd([tr -d '\n' < ssl/VERSION]))
AC_SUBST([LIBTLS_VERSION], m4_esyscmd([tr -d '\n' < tls/VERSION]))
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([subdir-objects foreign])
AC_CONFIG_MACRO_DIR([m4])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
# This must be saved before AC_PROG_CC
USER_CFLAGS="$CFLAGS"
AC_PROG_CC
AC_PROG_CC_STDC
AM_PROG_CC_C_O
AC_PROG_LIBTOOL
LT_INIT
CHECK_OS_OPTIONS
CHECK_C_HARDENING_OPTIONS
DISABLE_AS_EXECUTABLE_STACK
AM_PROG_AS
DISABLE_COMPILER_WARNINGS
# Check if the certhash command should be built
AC_CHECK_FUNCS([symlink])
AM_CONDITIONAL([BUILD_CERTHASH], [test "x$ac_cv_func_symlink" = xyes])
# Check if funopen exists
AC_CHECK_FUNC([funopen])
CHECK_LIBC_COMPAT
CHECK_SYSCALL_COMPAT
CHECK_CRYPTO_COMPAT
CHECK_VA_COPY
CHECK_B64_NTOP
AC_ARG_WITH([openssldir],
AS_HELP_STRING([--with-openssldir],
[Set the default openssl directory]),
OPENSSLDIR="$withval"
AC_SUBST(OPENSSLDIR)
)
AM_CONDITIONAL([OPENSSLDIR_DEFINED], [test x$with_openssldir != x])
AC_ARG_ENABLE([extratests],
AS_HELP_STRING([--enable-extratests], [Enable extra tests that may be unreliable on some platforms]))
AM_CONDITIONAL([ENABLE_EXTRATESTS], [test "x$enable_extratests" = xyes])
# Add CPU-specific alignment flags
old_cflags=$CFLAGS
CFLAGS="$CFLAGS -I$srcdir/include"
AC_MSG_CHECKING([if BSWAP4 builds without __STRICT_ALIGNMENT])
AC_TRY_COMPILE([#include "$srcdir/crypto/modes/modes_lcl.h"],
[int a = 0; BSWAP4(a);],
AC_MSG_RESULT([yes])
BSWAP4=yes,
AC_MSG_RESULT([no])
BSWAP4=no)
CFLAGS="$old_cflags"
case $host_cpu in
*sparc*)
CPPFLAGS="$CPPFLAGS -D__STRICT_ALIGNMENT"
;;
*arm*)
AS_IF([test "x$BSWAP4" = "xyes"],,
CPPFLAGS="$CPPFLAGS -D__STRICT_ALIGNMENT")
;;
*amd64*)
host_cpu=x86_64
;;
esac
AC_MSG_CHECKING([if .gnu.warning accepts long strings])
AC_LINK_IFELSE([AC_LANG_SOURCE([[
extern void SSLv3_method();
__asm__(".section .gnu.warning.SSLv3_method; .ascii \"SSLv3_method is insecure\" ; .text");
int main() {return 0;}
]])], [
AC_DEFINE(HAS_GNU_WARNING_LONG, 1, [Define if .gnu.warning accepts long strings.])
AC_MSG_RESULT(yes)
], [
AC_MSG_RESULT(no)
])
AC_ARG_ENABLE([asm],
AS_HELP_STRING([--disable-asm], [Disable assembly]))
AM_CONDITIONAL([OPENSSL_NO_ASM], [test "x$enable_asm" = "xno"])
# Conditionally enable assembly by default
AM_CONDITIONAL([HOST_ASM_ELF_X86_64],
[test "x$HOST_ABI" = "xelf" -a "$host_cpu" = "x86_64" -a "x$enable_asm" != "xno"])
AM_CONDITIONAL([HOST_ASM_MACOSX_X86_64],
[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([
Makefile
include/Makefile
include/openssl/Makefile
crypto/Makefile
ssl/Makefile
tls/Makefile
tests/Makefile
apps/Makefile
apps/openssl/Makefile
apps/nc/Makefile
man/Makefile
libcrypto.pc
libssl.pc
libtls.pc
openssl.pc
])
AM_CONDITIONAL([SMALL_TIME_T], [test "$ac_cv_sizeof_time_t" = "4"])
if test "$ac_cv_sizeof_time_t" = "4"; then
echo " ** Warning, this system is unable to represent times past 2038"
echo " ** It will behave incorrectly when handling valid RFC5280 dates"
fi
AC_REQUIRE_AUX_FILE([tap-driver.sh])
AC_OUTPUT

View File

@@ -1,179 +0,0 @@
AC_INIT([libressl], [VERSION])
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([subdir-objects])
AC_CONFIG_MACRO_DIR([m4])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_SUBST([USER_CFLAGS], "-O2 $CFLAGS")
CFLAGS="$CFLAGS -Wall -std=c99 -g"
case $host_os in
*darwin*)
HOST_OS=darwin;
LDFLAGS="$LDFLAGS -Qunused-arguments"
;;
*linux*)
HOST_OS=linux;
CFLAGS="$CFLAGS -D_BSD_SOURCE -D_POSIX_SOURCE -D_GNU_SOURCE"
;;
*solaris*)
HOST_OS=solaris;
CFLAGS="$CFLAGS -D__EXTENSIONS__ -D_XOPEN_SOURCE=600 -DBSD_COMP"
AC_SUBST([PLATFORM_LDADD], ['-lnsl -lsocket'])
;;
*openbsd*)
AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD gcc has bounded])
;;
*mingw*)
HOST_OS=win32
;;
*) ;;
esac
AM_CONDITIONAL(HOST_DARWIN, test x$HOST_OS = xdarwin)
AM_CONDITIONAL(HOST_LINUX, test x$HOST_OS = xlinux)
AM_CONDITIONAL(HOST_SOLARIS, test x$HOST_OS = xsolaris)
AM_CONDITIONAL(HOST_WIN, test x$HOST_OS = xwin)
AC_CHECK_FUNC([clock_gettime],,
[AC_SEARCH_LIBS([clock_gettime],[rt posix4])])
AC_CHECK_FUNC([dl_iterate_phdr],,
[AC_SEARCH_LIBS([dl_iterate_phdr],[dl])])
AC_PROG_CC
AC_PROG_LIBTOOL
AC_PROG_CC_STDC
AM_PROG_CC_C_O
save_cflags="$CFLAGS"
CFLAGS=-Wno-pointer-sign
AC_MSG_CHECKING([whether CC supports -Wno-pointer-sign])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])]
[AM_CFLAGS=-Wno-pointer-sign],
[AC_MSG_RESULT([no])]
)
CFLAGS="$save_cflags $AM_CFLAGS"
AC_CHECK_FUNC(strlcpy,
AM_CONDITIONAL(NO_STRLCPY, false),
AC_DEFINE(NO_STRLCPY)
AM_CONDITIONAL(NO_STRLCPY, true))
AC_CHECK_FUNC(strlcat,
AM_CONDITIONAL(NO_STRLCAT, false),
AC_DEFINE(NO_STRLCAT)
AM_CONDITIONAL(NO_STRLCAT, true))
AC_CHECK_FUNC(strndup,
AM_CONDITIONAL(NO_STRNDUP, false),
AC_DEFINE(NO_STRNDUP)
AM_CONDITIONAL(NO_STRNDUP, true))
AC_CHECK_FUNC(asprintf,
AM_CONDITIONAL(NO_ASPRINTF, false),
AC_DEFINE(NO_ASPRINTF)
AM_CONDITIONAL(NO_ASPRINTF, true))
AC_CHECK_FUNC(reallocarray,
AM_CONDITIONAL(NO_REALLOCARRAY, false),
AC_DEFINE(NO_REALLOCARRAY)
AM_CONDITIONAL(NO_REALLOCARRAY, true))
AC_CHECK_FUNC(timingsafe_bcmp,
AM_CONDITIONAL(NO_TIMINGSAFE_BCMP, false),
AC_DEFINE(NO_TIMINGSAFE_BCMP)
AM_CONDITIONAL(NO_TIMINGSAFE_BCMP, true))
AC_CHECK_FUNC(timingsafe_memcmp,
AM_CONDITIONAL(NO_TIMINGSAFE_MEMCMP, false),
AC_DEFINE(NO_TIMINGSAFE_MEMCMP)
AM_CONDITIONAL(NO_TIMINGSAFE_MEMCMP, true))
AC_CHECK_FUNC(arc4random_buf,
AM_CONDITIONAL(NO_ARC4RANDOM_BUF, false),
AC_DEFINE(NO_ARC4RANDOM_BUF)
AM_CONDITIONAL(NO_ARC4RANDOM_BUF, true))
AC_CHECK_FUNC(getentropy,
AM_CONDITIONAL(NO_GETENTROPY, false),
AC_DEFINE(NO_GETENTROPY)
AM_CONDITIONAL(NO_GETENTROPY, true))
AC_CHECK_FUNC(issetugid,
AM_CONDITIONAL(NO_ISSETUGID, false),
AC_DEFINE(NO_ISSETUGID)
AM_CONDITIONAL(NO_ISSETUGID, true))
AC_CHECK_FUNC(strtonum,
AM_CONDITIONAL(NO_STRTONUM, false),
AC_DEFINE(NO_STRTONUM)
AM_CONDITIONAL(NO_STRTONUM, true))
AC_CHECK_FUNC(explicit_bzero,
AM_CONDITIONAL(NO_EXPLICIT_BZERO, false),
AC_DEFINE(NO_EXPLICIT_BZERO)
AM_CONDITIONAL(NO_EXPLICIT_BZERO, true))
AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <stdarg.h>
va_list x,y;
]], [[ va_copy(x,y); ]])],
[ ac_cv_have_va_copy="yes" ],
[ ac_cv_have_va_copy="no"
])
])
if test "x$ac_cv_have_va_copy" = "xyes" ; then
AC_DEFINE([HAVE_VA_COPY], [1], [Define if va_copy exists])
fi
AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <stdarg.h>
va_list x,y;
]], [[ __va_copy(x,y); ]])],
[ ac_cv_have___va_copy="yes" ], [ ac_cv_have___va_copy="no"
])
])
if test "x$ac_cv_have___va_copy" = "xyes" ; then
AC_DEFINE([HAVE___VA_COPY], [1], [Define if __va_copy exists])
fi
AC_CHECK_FUNC(getauxval, AC_DEFINE(HAVE_GETAUXVAL))
AC_CHECK_FUNC(funopen, AC_DEFINE(HAVE_FUNOPEN))
AC_CHECK_HEADER(sys/sysctl.h, AC_DEFINE(HAVE_SYS_SYSCTL_H))
AC_CHECK_HEADER(err.h, AC_DEFINE(HAVE_ERR_H))
AC_ARG_WITH([openssldir],
AS_HELP_STRING([--with-openssldir], [Set the default openssl directory]),
AC_DEFINE_UNQUOTED(OPENSSLDIR, "$withval")
)
AC_ARG_WITH([enginesdir],
AS_HELP_STRING([--with-enginesdir], [Set the default engines directory (use with openssldir)]),
AC_DEFINE_UNQUOTED(ENGINESDIR, "$withval")
)
LT_INIT
AC_CONFIG_FILES([
Makefile
include/Makefile
include/openssl/Makefile
ssl/Makefile
crypto/Makefile
tests/Makefile
apps/Makefile
man/Makefile
libcrypto.pc
libssl.pc
openssl.pc
])
AC_OUTPUT

652
crypto/CMakeLists.txt Normal file
View File

@@ -0,0 +1,652 @@
include_directories(
.
../include
../include/compat
asn1
dsa
evp
modes
)
set(
CRYPTO_SRC
aes/aes_cbc.c
aes/aes_core.c
camellia/camellia.c
camellia/cmll_cbc.c
rc4/rc4_enc.c
rc4/rc4_skey.c
whrlpool/wp_block.c
cpt_err.c
cryptlib.c
cversion.c
ex_data.c
malloc-wrapper.c
mem_clr.c
mem_dbg.c
o_init.c
o_str.c
o_time.c
aes/aes_cfb.c
aes/aes_ctr.c
aes/aes_ecb.c
aes/aes_ige.c
aes/aes_misc.c
aes/aes_ofb.c
aes/aes_wrap.c
asn1/a_bitstr.c
asn1/a_bool.c
asn1/a_bytes.c
asn1/a_d2i_fp.c
asn1/a_digest.c
asn1/a_dup.c
asn1/a_enum.c
asn1/a_i2d_fp.c
asn1/a_int.c
asn1/a_mbstr.c
asn1/a_object.c
asn1/a_octet.c
asn1/a_print.c
asn1/a_set.c
asn1/a_sign.c
asn1/a_strex.c
asn1/a_strnid.c
asn1/a_time.c
asn1/a_time_tm.c
asn1/a_type.c
asn1/a_utf8.c
asn1/a_verify.c
asn1/ameth_lib.c
asn1/asn1_err.c
asn1/asn1_gen.c
asn1/asn1_lib.c
asn1/asn1_par.c
asn1/asn_mime.c
asn1/asn_moid.c
asn1/asn_pack.c
asn1/bio_asn1.c
asn1/bio_ndef.c
asn1/d2i_pr.c
asn1/d2i_pu.c
asn1/evp_asn1.c
asn1/f_enum.c
asn1/f_int.c
asn1/f_string.c
asn1/i2d_pr.c
asn1/i2d_pu.c
asn1/n_pkey.c
asn1/nsseq.c
asn1/p5_pbe.c
asn1/p5_pbev2.c
asn1/p8_pkey.c
asn1/t_bitst.c
asn1/t_crl.c
asn1/t_pkey.c
asn1/t_req.c
asn1/t_spki.c
asn1/t_x509.c
asn1/t_x509a.c
asn1/tasn_dec.c
asn1/tasn_enc.c
asn1/tasn_fre.c
asn1/tasn_new.c
asn1/tasn_prn.c
asn1/tasn_typ.c
asn1/tasn_utl.c
asn1/x_algor.c
asn1/x_attrib.c
asn1/x_bignum.c
asn1/x_crl.c
asn1/x_exten.c
asn1/x_info.c
asn1/x_long.c
asn1/x_name.c
asn1/x_nx509.c
asn1/x_pkey.c
asn1/x_pubkey.c
asn1/x_req.c
asn1/x_sig.c
asn1/x_spki.c
asn1/x_val.c
asn1/x_x509.c
asn1/x_x509a.c
bf/bf_cfb64.c
bf/bf_ecb.c
bf/bf_enc.c
bf/bf_ofb64.c
bf/bf_skey.c
bio/b_dump.c
bio/b_print.c
bio/b_sock.c
bio/bf_buff.c
bio/bf_nbio.c
bio/bf_null.c
bio/bio_cb.c
bio/bio_err.c
bio/bio_lib.c
bio/bss_acpt.c
bio/bss_bio.c
bio/bss_conn.c
bio/bss_dgram.c
bio/bss_fd.c
bio/bss_file.c
bio/bss_mem.c
bio/bss_null.c
bio/bss_sock.c
bn/bn_add.c
bn/bn_asm.c
bn/bn_blind.c
bn/bn_const.c
bn/bn_ctx.c
bn/bn_depr.c
bn/bn_div.c
bn/bn_err.c
bn/bn_exp.c
bn/bn_exp2.c
bn/bn_gcd.c
bn/bn_gf2m.c
bn/bn_kron.c
bn/bn_lib.c
bn/bn_mod.c
bn/bn_mont.c
bn/bn_mpi.c
bn/bn_mul.c
bn/bn_nist.c
bn/bn_prime.c
bn/bn_print.c
bn/bn_rand.c
bn/bn_recp.c
bn/bn_shift.c
bn/bn_sqr.c
bn/bn_sqrt.c
bn/bn_word.c
bn/bn_x931p.c
buffer/buf_err.c
buffer/buf_str.c
buffer/buffer.c
camellia/cmll_cfb.c
camellia/cmll_ctr.c
camellia/cmll_ecb.c
camellia/cmll_misc.c
camellia/cmll_ofb.c
cast/c_cfb64.c
cast/c_ecb.c
cast/c_enc.c
cast/c_ofb64.c
cast/c_skey.c
chacha/chacha.c
cmac/cm_ameth.c
cmac/cm_pmeth.c
cmac/cmac.c
comp/c_rle.c
comp/c_zlib.c
comp/comp_err.c
comp/comp_lib.c
conf/conf_api.c
conf/conf_def.c
conf/conf_err.c
conf/conf_lib.c
conf/conf_mall.c
conf/conf_mod.c
conf/conf_sap.c
des/cbc_cksm.c
des/cbc_enc.c
des/cfb64ede.c
des/cfb64enc.c
des/cfb_enc.c
des/des_enc.c
des/ecb3_enc.c
des/ecb_enc.c
des/ede_cbcm_enc.c
des/enc_read.c
des/enc_writ.c
des/fcrypt.c
des/fcrypt_b.c
des/ofb64ede.c
des/ofb64enc.c
des/ofb_enc.c
des/pcbc_enc.c
des/qud_cksm.c
des/rand_key.c
des/set_key.c
des/str2key.c
des/xcbc_enc.c
dh/dh_ameth.c
dh/dh_asn1.c
dh/dh_check.c
dh/dh_depr.c
dh/dh_err.c
dh/dh_gen.c
dh/dh_key.c
dh/dh_lib.c
dh/dh_pmeth.c
dh/dh_prn.c
dsa/dsa_ameth.c
dsa/dsa_asn1.c
dsa/dsa_depr.c
dsa/dsa_err.c
dsa/dsa_gen.c
dsa/dsa_key.c
dsa/dsa_lib.c
dsa/dsa_ossl.c
dsa/dsa_pmeth.c
dsa/dsa_prn.c
dsa/dsa_sign.c
dsa/dsa_vrf.c
dso/dso_dlfcn.c
dso/dso_err.c
dso/dso_lib.c
dso/dso_null.c
dso/dso_openssl.c
ec/ec2_mult.c
ec/ec2_oct.c
ec/ec2_smpl.c
ec/ec_ameth.c
ec/ec_asn1.c
ec/ec_check.c
ec/ec_curve.c
ec/ec_cvt.c
ec/ec_err.c
ec/ec_key.c
ec/ec_lib.c
ec/ec_mult.c
ec/ec_oct.c
ec/ec_pmeth.c
ec/ec_print.c
ec/eck_prn.c
ec/ecp_mont.c
ec/ecp_nist.c
ec/ecp_oct.c
ec/ecp_smpl.c
ecdh/ech_err.c
ecdh/ech_key.c
ecdh/ech_lib.c
ecdsa/ecs_asn1.c
ecdsa/ecs_err.c
ecdsa/ecs_lib.c
ecdsa/ecs_ossl.c
ecdsa/ecs_sign.c
ecdsa/ecs_vrf.c
engine/eng_all.c
engine/eng_cnf.c
engine/eng_ctrl.c
engine/eng_dyn.c
engine/eng_err.c
engine/eng_fat.c
engine/eng_init.c
engine/eng_lib.c
engine/eng_list.c
engine/eng_openssl.c
engine/eng_pkey.c
engine/eng_table.c
engine/tb_asnmth.c
engine/tb_cipher.c
engine/tb_dh.c
engine/tb_digest.c
engine/tb_dsa.c
engine/tb_ecdh.c
engine/tb_ecdsa.c
engine/tb_pkmeth.c
engine/tb_rand.c
engine/tb_rsa.c
engine/tb_store.c
err/err.c
err/err_all.c
err/err_prn.c
evp/bio_b64.c
evp/bio_enc.c
evp/bio_md.c
evp/c_all.c
evp/digest.c
evp/e_aes.c
evp/e_aes_cbc_hmac_sha1.c
evp/e_bf.c
evp/e_camellia.c
evp/e_cast.c
evp/e_chacha.c
evp/e_chacha20poly1305.c
evp/e_des.c
evp/e_des3.c
evp/e_gost2814789.c
evp/e_idea.c
evp/e_null.c
evp/e_old.c
evp/e_rc2.c
evp/e_rc4.c
evp/e_rc4_hmac_md5.c
evp/e_xcbc_d.c
evp/encode.c
evp/evp_aead.c
evp/evp_enc.c
evp/evp_err.c
evp/evp_key.c
evp/evp_lib.c
evp/evp_pbe.c
evp/evp_pkey.c
evp/m_dss.c
evp/m_dss1.c
evp/m_ecdsa.c
evp/m_gost2814789.c
evp/m_gostr341194.c
evp/m_md4.c
evp/m_md5.c
evp/m_null.c
evp/m_ripemd.c
evp/m_sha1.c
evp/m_sigver.c
evp/m_streebog.c
evp/m_wp.c
evp/names.c
evp/p5_crpt.c
evp/p5_crpt2.c
evp/p_dec.c
evp/p_enc.c
evp/p_lib.c
evp/p_open.c
evp/p_seal.c
evp/p_sign.c
evp/p_verify.c
evp/pmeth_fn.c
evp/pmeth_gn.c
evp/pmeth_lib.c
gost/gost2814789.c
gost/gost89_keywrap.c
gost/gost89_params.c
gost/gost89imit_ameth.c
gost/gost89imit_pmeth.c
gost/gost_asn1.c
gost/gost_err.c
gost/gostr341001.c
gost/gostr341001_ameth.c
gost/gostr341001_key.c
gost/gostr341001_params.c
gost/gostr341001_pmeth.c
gost/gostr341194.c
gost/streebog.c
hmac/hm_ameth.c
hmac/hm_pmeth.c
hmac/hmac.c
idea/i_cbc.c
idea/i_cfb64.c
idea/i_ecb.c
idea/i_ofb64.c
idea/i_skey.c
krb5/krb5_asn.c
lhash/lh_stats.c
lhash/lhash.c
md4/md4_dgst.c
md4/md4_one.c
md5/md5_dgst.c
md5/md5_one.c
modes/cbc128.c
modes/ccm128.c
modes/cfb128.c
modes/ctr128.c
modes/cts128.c
modes/gcm128.c
modes/ofb128.c
modes/xts128.c
objects/o_names.c
objects/obj_dat.c
objects/obj_err.c
objects/obj_lib.c
objects/obj_xref.c
ocsp/ocsp_asn.c
ocsp/ocsp_cl.c
ocsp/ocsp_err.c
ocsp/ocsp_ext.c
ocsp/ocsp_ht.c
ocsp/ocsp_lib.c
ocsp/ocsp_prn.c
ocsp/ocsp_srv.c
ocsp/ocsp_vfy.c
pem/pem_all.c
pem/pem_err.c
pem/pem_info.c
pem/pem_lib.c
pem/pem_oth.c
pem/pem_pk8.c
pem/pem_pkey.c
pem/pem_seal.c
pem/pem_sign.c
pem/pem_x509.c
pem/pem_xaux.c
pem/pvkfmt.c
pkcs12/p12_add.c
pkcs12/p12_asn.c
pkcs12/p12_attr.c
pkcs12/p12_crpt.c
pkcs12/p12_crt.c
pkcs12/p12_decr.c
pkcs12/p12_init.c
pkcs12/p12_key.c
pkcs12/p12_kiss.c
pkcs12/p12_mutl.c
pkcs12/p12_npas.c
pkcs12/p12_p8d.c
pkcs12/p12_p8e.c
pkcs12/p12_utl.c
pkcs12/pk12err.c
pkcs7/bio_pk7.c
pkcs7/pk7_asn1.c
pkcs7/pk7_attr.c
pkcs7/pk7_doit.c
pkcs7/pk7_lib.c
pkcs7/pk7_mime.c
pkcs7/pk7_smime.c
pkcs7/pkcs7err.c
poly1305/poly1305.c
rand/rand_err.c
rand/rand_lib.c
rand/randfile.c
rc2/rc2_cbc.c
rc2/rc2_ecb.c
rc2/rc2_skey.c
rc2/rc2cfb64.c
rc2/rc2ofb64.c
ripemd/rmd_dgst.c
ripemd/rmd_one.c
rsa/rsa_ameth.c
rsa/rsa_asn1.c
rsa/rsa_chk.c
rsa/rsa_crpt.c
rsa/rsa_depr.c
rsa/rsa_eay.c
rsa/rsa_err.c
rsa/rsa_gen.c
rsa/rsa_lib.c
rsa/rsa_none.c
rsa/rsa_oaep.c
rsa/rsa_pk1.c
rsa/rsa_pmeth.c
rsa/rsa_prn.c
rsa/rsa_pss.c
rsa/rsa_saos.c
rsa/rsa_sign.c
rsa/rsa_ssl.c
rsa/rsa_x931.c
sha/sha1_one.c
sha/sha1dgst.c
sha/sha256.c
sha/sha512.c
stack/stack.c
ts/ts_asn1.c
ts/ts_conf.c
ts/ts_err.c
ts/ts_lib.c
ts/ts_req_print.c
ts/ts_req_utils.c
ts/ts_rsp_print.c
ts/ts_rsp_sign.c
ts/ts_rsp_utils.c
ts/ts_rsp_verify.c
ts/ts_verify_ctx.c
txt_db/txt_db.c
ui/ui_err.c
ui/ui_lib.c
ui/ui_util.c
whrlpool/wp_dgst.c
x509/by_dir.c
x509/by_file.c
x509/by_mem.c
x509/x509_att.c
x509/x509_cmp.c
x509/x509_d2.c
x509/x509_def.c
x509/x509_err.c
x509/x509_ext.c
x509/x509_lu.c
x509/x509_obj.c
x509/x509_r2x.c
x509/x509_req.c
x509/x509_set.c
x509/x509_trs.c
x509/x509_txt.c
x509/x509_v3.c
x509/x509_vfy.c
x509/x509_vpm.c
x509/x509cset.c
x509/x509name.c
x509/x509rset.c
x509/x509spki.c
x509/x509type.c
x509/x_all.c
x509v3/pcy_cache.c
x509v3/pcy_data.c
x509v3/pcy_lib.c
x509v3/pcy_map.c
x509v3/pcy_node.c
x509v3/pcy_tree.c
x509v3/v3_akey.c
x509v3/v3_akeya.c
x509v3/v3_alt.c
x509v3/v3_bcons.c
x509v3/v3_bitst.c
x509v3/v3_conf.c
x509v3/v3_cpols.c
x509v3/v3_crld.c
x509v3/v3_enum.c
x509v3/v3_extku.c
x509v3/v3_genn.c
x509v3/v3_ia5.c
x509v3/v3_info.c
x509v3/v3_int.c
x509v3/v3_lib.c
x509v3/v3_ncons.c
x509v3/v3_ocsp.c
x509v3/v3_pci.c
x509v3/v3_pcia.c
x509v3/v3_pcons.c
x509v3/v3_pku.c
x509v3/v3_pmaps.c
x509v3/v3_prn.c
x509v3/v3_purp.c
x509v3/v3_skey.c
x509v3/v3_sxnet.c
x509v3/v3_utl.c
x509v3/v3err.c
)
if(CMAKE_HOST_UNIX)
set(CRYPTO_SRC ${CRYPTO_SRC} bio/b_posix.c)
set(CRYPTO_SRC ${CRYPTO_SRC} bio/bss_log.c)
set(CRYPTO_SRC ${CRYPTO_SRC} ui/ui_openssl.c)
endif()
if(CMAKE_HOST_WIN32)
set(CRYPTO_SRC ${CRYPTO_SRC} bio/b_win.c)
set(CRYPTO_SRC ${CRYPTO_SRC} ui/ui_openssl_win.c)
endif()
if(CMAKE_HOST_WIN32)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/posix_win.c)
endif()
if(NOT HAVE_ASPRINTF)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/bsd-asprintf.c)
endif()
if(NOT HAVE_INET_PTON)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/inet_pton.c)
endif()
if(NOT HAVE_REALLOCARRAY)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/reallocarray.c)
endif()
if(NOT HAVE_STRCASECMP)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/strcasecmp.c)
endif()
if(NOT HAVE_STRLCAT)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/strlcat.c)
endif()
if(NOT HAVE_STRLCPY)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/strlcpy.c)
endif()
if(NOT HAVE_STRNDUP)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/strndup.c)
if(NOT HAVE_STRNLEN)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/strnlen.c)
endif()
endif()
if(NOT HAVE_TIMEGM)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/timegm.c)
endif()
if(NOT HAVE_EXPLICIT_BZERO)
if(CMAKE_HOST_WIN32)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/explicit_bzero_win.c)
else()
set(CRYPTO_SRC ${CRYPTO_SRC} compat/explicit_bzero.c)
set_source_files_properties(compat/explicit_bzero.c PROPERTIES COMPILE_FLAGS -O0)
endif()
endif()
if(NOT HAVE_ARC4RANDOM_BUF)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/arc4random.c)
if(NOT HAVE_GETENTROPY)
if(CMAKE_HOST_WIN32)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_win.c)
elseif(CMAKE_SYSTEM_NAME MATCHES "AIX")
set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_aix.c)
elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_freebsd.c)
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_linux.c)
elseif(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_netbsd.c)
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_darwin.c)
elseif(CMAKE_SYSTEM_NAME MATCHES "SunOS")
set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_solaris.c)
endif()
endif()
endif()
if(NOT HAVE_TIMINGSAFE_BCMP)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/timingsafe_bcmp.c)
endif()
if(NOT HAVE_TIMINGSAFE_MEMCMP)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/timingsafe_memcmp.c)
endif()
if (BUILD_SHARED)
add_library(crypto-objects OBJECT ${CRYPTO_SRC})
add_library(crypto STATIC $<TARGET_OBJECTS:crypto-objects>)
add_library(crypto-shared SHARED $<TARGET_OBJECTS:crypto-objects>)
set_target_properties(crypto-shared PROPERTIES OUTPUT_NAME crypto)
set_target_properties(crypto-shared PROPERTIES VERSION
${CRYPTO_VERSION} SOVERSION ${CRYPTO_MAJOR_VERSION})
install(TARGETS crypto crypto-shared DESTINATION lib)
else()
add_library(crypto STATIC ${CRYPTO_SRC})
install(TARGETS crypto DESTINATION lib)
endif()

807
crypto/Makefile.am Normal file
View File

@@ -0,0 +1,807 @@
include $(top_srcdir)/Makefile.am.common
AM_CPPFLAGS += -I$(top_srcdir)/crypto/asn1
AM_CPPFLAGS += -I$(top_srcdir)/crypto/evp
AM_CPPFLAGS += -I$(top_srcdir)/crypto/modes
lib_LTLIBRARIES = libcrypto.la
EXTRA_DIST = VERSION
EXTRA_DIST += CMakeLists.txt
# needed for a CMake target
EXTRA_DIST += compat/strcasecmp.c
libcrypto_la_LDFLAGS = -version-info @LIBCRYPTO_VERSION@ -no-undefined
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
if OPENSSL_NO_ASM
libcrypto_la_CPPFLAGS += -DOPENSSL_NO_ASM
else
if HOST_WIN
libcrypto_la_CPPFLAGS += -DOPENSSL_NO_ASM
endif
endif
if OPENSSLDIR_DEFINED
libcrypto_la_CPPFLAGS += -DOPENSSLDIR=\"@OPENSSLDIR@\"
else
libcrypto_la_CPPFLAGS += -DOPENSSLDIR=\"$(sysconfdir)/ssl\"
endif
noinst_LTLIBRARIES = libcompat.la
# compatibility functions that need to be built without optimizations
if !HAVE_EXPLICIT_BZERO
noinst_LTLIBRARIES += libcompatnoopt.la
libcompatnoopt_la_CFLAGS = -O0
libcompatnoopt_la_SOURCES =
if HOST_WIN
libcompatnoopt_la_SOURCES += compat/explicit_bzero_win.c
else
libcompatnoopt_la_SOURCES += compat/explicit_bzero.c
endif
endif
# other compatibility functions
libcompat_la_SOURCES =
libcompat_la_LIBADD = $(PLATFORM_LDADD)
if !HAVE_STRLCAT
libcompat_la_SOURCES += compat/strlcat.c
endif
if !HAVE_STRLCPY
libcompat_la_SOURCES += compat/strlcpy.c
endif
if !HAVE_STRNDUP
libcompat_la_SOURCES += compat/strndup.c
# the only user of strnlen is strndup, so only build it if needed
if !HAVE_STRNLEN
libcompat_la_SOURCES += compat/strnlen.c
endif
endif
if !HAVE_ASPRINTF
libcompat_la_SOURCES += compat/bsd-asprintf.c
endif
if !HAVE_INET_PTON
libcompat_la_SOURCES += compat/inet_pton.c
endif
if !HAVE_TIMEGM
libcompat_la_SOURCES += compat/timegm.c
endif
if !HAVE_REALLOCARRAY
libcompat_la_SOURCES += compat/reallocarray.c
endif
if !HAVE_TIMINGSAFE_MEMCMP
libcompat_la_SOURCES += compat/timingsafe_memcmp.c
endif
if !HAVE_TIMINGSAFE_BCMP
libcompat_la_SOURCES += compat/timingsafe_bcmp.c
endif
if HOST_WIN
libcompat_la_SOURCES += compat/posix_win.c
endif
include Makefile.am.arc4random
libcrypto_la_SOURCES =
EXTRA_libcrypto_la_SOURCES =
include Makefile.am.elf-x86_64
include Makefile.am.macosx-x86_64
if !HOST_ASM_ELF_X86_64
if !HOST_ASM_MACOSX_X86_64
libcrypto_la_SOURCES += aes/aes_cbc.c
libcrypto_la_SOURCES += aes/aes_core.c
libcrypto_la_SOURCES += camellia/camellia.c
libcrypto_la_SOURCES += camellia/cmll_cbc.c
libcrypto_la_SOURCES += rc4/rc4_enc.c
libcrypto_la_SOURCES += rc4/rc4_skey.c
libcrypto_la_SOURCES += whrlpool/wp_block.c
endif
endif
libcrypto_la_SOURCES += cpt_err.c
libcrypto_la_SOURCES += cryptlib.c
libcrypto_la_SOURCES += cversion.c
libcrypto_la_SOURCES += ex_data.c
libcrypto_la_SOURCES += malloc-wrapper.c
libcrypto_la_SOURCES += mem_clr.c
libcrypto_la_SOURCES += mem_dbg.c
libcrypto_la_SOURCES += o_init.c
libcrypto_la_SOURCES += o_str.c
libcrypto_la_SOURCES += o_time.c
noinst_HEADERS += cryptlib.h
noinst_HEADERS += md32_common.h
noinst_HEADERS += o_time.h
# aes
libcrypto_la_SOURCES += aes/aes_cfb.c
libcrypto_la_SOURCES += aes/aes_ctr.c
libcrypto_la_SOURCES += aes/aes_ecb.c
libcrypto_la_SOURCES += aes/aes_ige.c
libcrypto_la_SOURCES += aes/aes_misc.c
libcrypto_la_SOURCES += aes/aes_ofb.c
libcrypto_la_SOURCES += aes/aes_wrap.c
noinst_HEADERS += aes/aes_locl.h
# asn1
libcrypto_la_SOURCES += asn1/a_bitstr.c
libcrypto_la_SOURCES += asn1/a_bool.c
libcrypto_la_SOURCES += asn1/a_bytes.c
libcrypto_la_SOURCES += asn1/a_d2i_fp.c
libcrypto_la_SOURCES += asn1/a_digest.c
libcrypto_la_SOURCES += asn1/a_dup.c
libcrypto_la_SOURCES += asn1/a_enum.c
libcrypto_la_SOURCES += asn1/a_i2d_fp.c
libcrypto_la_SOURCES += asn1/a_int.c
libcrypto_la_SOURCES += asn1/a_mbstr.c
libcrypto_la_SOURCES += asn1/a_object.c
libcrypto_la_SOURCES += asn1/a_octet.c
libcrypto_la_SOURCES += asn1/a_print.c
libcrypto_la_SOURCES += asn1/a_set.c
libcrypto_la_SOURCES += asn1/a_sign.c
libcrypto_la_SOURCES += asn1/a_strex.c
libcrypto_la_SOURCES += asn1/a_strnid.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_utf8.c
libcrypto_la_SOURCES += asn1/a_verify.c
libcrypto_la_SOURCES += asn1/ameth_lib.c
libcrypto_la_SOURCES += asn1/asn1_err.c
libcrypto_la_SOURCES += asn1/asn1_gen.c
libcrypto_la_SOURCES += asn1/asn1_lib.c
libcrypto_la_SOURCES += asn1/asn1_par.c
libcrypto_la_SOURCES += asn1/asn_mime.c
libcrypto_la_SOURCES += asn1/asn_moid.c
libcrypto_la_SOURCES += asn1/asn_pack.c
libcrypto_la_SOURCES += asn1/bio_asn1.c
libcrypto_la_SOURCES += asn1/bio_ndef.c
libcrypto_la_SOURCES += asn1/d2i_pr.c
libcrypto_la_SOURCES += asn1/d2i_pu.c
libcrypto_la_SOURCES += asn1/evp_asn1.c
libcrypto_la_SOURCES += asn1/f_enum.c
libcrypto_la_SOURCES += asn1/f_int.c
libcrypto_la_SOURCES += asn1/f_string.c
libcrypto_la_SOURCES += asn1/i2d_pr.c
libcrypto_la_SOURCES += asn1/i2d_pu.c
libcrypto_la_SOURCES += asn1/n_pkey.c
libcrypto_la_SOURCES += asn1/nsseq.c
libcrypto_la_SOURCES += asn1/p5_pbe.c
libcrypto_la_SOURCES += asn1/p5_pbev2.c
libcrypto_la_SOURCES += asn1/p8_pkey.c
libcrypto_la_SOURCES += asn1/t_bitst.c
libcrypto_la_SOURCES += asn1/t_crl.c
libcrypto_la_SOURCES += asn1/t_pkey.c
libcrypto_la_SOURCES += asn1/t_req.c
libcrypto_la_SOURCES += asn1/t_spki.c
libcrypto_la_SOURCES += asn1/t_x509.c
libcrypto_la_SOURCES += asn1/t_x509a.c
libcrypto_la_SOURCES += asn1/tasn_dec.c
libcrypto_la_SOURCES += asn1/tasn_enc.c
libcrypto_la_SOURCES += asn1/tasn_fre.c
libcrypto_la_SOURCES += asn1/tasn_new.c
libcrypto_la_SOURCES += asn1/tasn_prn.c
libcrypto_la_SOURCES += asn1/tasn_typ.c
libcrypto_la_SOURCES += asn1/tasn_utl.c
libcrypto_la_SOURCES += asn1/x_algor.c
libcrypto_la_SOURCES += asn1/x_attrib.c
libcrypto_la_SOURCES += asn1/x_bignum.c
libcrypto_la_SOURCES += asn1/x_crl.c
libcrypto_la_SOURCES += asn1/x_exten.c
libcrypto_la_SOURCES += asn1/x_info.c
libcrypto_la_SOURCES += asn1/x_long.c
libcrypto_la_SOURCES += asn1/x_name.c
libcrypto_la_SOURCES += asn1/x_nx509.c
libcrypto_la_SOURCES += asn1/x_pkey.c
libcrypto_la_SOURCES += asn1/x_pubkey.c
libcrypto_la_SOURCES += asn1/x_req.c
libcrypto_la_SOURCES += asn1/x_sig.c
libcrypto_la_SOURCES += asn1/x_spki.c
libcrypto_la_SOURCES += asn1/x_val.c
libcrypto_la_SOURCES += asn1/x_x509.c
libcrypto_la_SOURCES += asn1/x_x509a.c
noinst_HEADERS += asn1/asn1_locl.h
noinst_HEADERS += asn1/charmap.h
# bf
libcrypto_la_SOURCES += bf/bf_cfb64.c
libcrypto_la_SOURCES += bf/bf_ecb.c
libcrypto_la_SOURCES += bf/bf_enc.c
libcrypto_la_SOURCES += bf/bf_ofb64.c
libcrypto_la_SOURCES += bf/bf_skey.c
noinst_HEADERS += bf/bf_locl.h
noinst_HEADERS += bf/bf_pi.h
# bio
libcrypto_la_SOURCES += bio/b_dump.c
if !HOST_WIN
libcrypto_la_SOURCES += bio/b_posix.c
endif
libcrypto_la_SOURCES += bio/b_print.c
libcrypto_la_SOURCES += bio/b_sock.c
if HOST_WIN
libcrypto_la_SOURCES += bio/b_win.c
endif
libcrypto_la_SOURCES += bio/bf_buff.c
libcrypto_la_SOURCES += bio/bf_nbio.c
libcrypto_la_SOURCES += bio/bf_null.c
libcrypto_la_SOURCES += bio/bio_cb.c
libcrypto_la_SOURCES += bio/bio_err.c
libcrypto_la_SOURCES += bio/bio_lib.c
libcrypto_la_SOURCES += bio/bss_acpt.c
libcrypto_la_SOURCES += bio/bss_bio.c
libcrypto_la_SOURCES += bio/bss_conn.c
libcrypto_la_SOURCES += bio/bss_dgram.c
libcrypto_la_SOURCES += bio/bss_fd.c
libcrypto_la_SOURCES += bio/bss_file.c
if !HOST_WIN
libcrypto_la_SOURCES += bio/bss_log.c
endif
libcrypto_la_SOURCES += bio/bss_mem.c
libcrypto_la_SOURCES += bio/bss_null.c
libcrypto_la_SOURCES += bio/bss_sock.c
# bn
libcrypto_la_SOURCES += bn/bn_add.c
libcrypto_la_SOURCES += bn/bn_asm.c
libcrypto_la_SOURCES += bn/bn_blind.c
libcrypto_la_SOURCES += bn/bn_const.c
libcrypto_la_SOURCES += bn/bn_ctx.c
libcrypto_la_SOURCES += bn/bn_depr.c
libcrypto_la_SOURCES += bn/bn_div.c
libcrypto_la_SOURCES += bn/bn_err.c
libcrypto_la_SOURCES += bn/bn_exp.c
libcrypto_la_SOURCES += bn/bn_exp2.c
libcrypto_la_SOURCES += bn/bn_gcd.c
libcrypto_la_SOURCES += bn/bn_gf2m.c
libcrypto_la_SOURCES += bn/bn_kron.c
libcrypto_la_SOURCES += bn/bn_lib.c
libcrypto_la_SOURCES += bn/bn_mod.c
libcrypto_la_SOURCES += bn/bn_mont.c
libcrypto_la_SOURCES += bn/bn_mpi.c
libcrypto_la_SOURCES += bn/bn_mul.c
libcrypto_la_SOURCES += bn/bn_nist.c
libcrypto_la_SOURCES += bn/bn_prime.c
libcrypto_la_SOURCES += bn/bn_print.c
libcrypto_la_SOURCES += bn/bn_rand.c
libcrypto_la_SOURCES += bn/bn_recp.c
libcrypto_la_SOURCES += bn/bn_shift.c
libcrypto_la_SOURCES += bn/bn_sqr.c
libcrypto_la_SOURCES += bn/bn_sqrt.c
libcrypto_la_SOURCES += bn/bn_word.c
libcrypto_la_SOURCES += bn/bn_x931p.c
noinst_HEADERS += bn/bn_lcl.h
noinst_HEADERS += bn/bn_prime.h
# buffer
libcrypto_la_SOURCES += buffer/buf_err.c
libcrypto_la_SOURCES += buffer/buf_str.c
libcrypto_la_SOURCES += buffer/buffer.c
# camellia
libcrypto_la_SOURCES += camellia/cmll_cfb.c
libcrypto_la_SOURCES += camellia/cmll_ctr.c
libcrypto_la_SOURCES += camellia/cmll_ecb.c
libcrypto_la_SOURCES += camellia/cmll_misc.c
libcrypto_la_SOURCES += camellia/cmll_ofb.c
noinst_HEADERS += camellia/camellia.h
noinst_HEADERS += camellia/cmll_locl.h
# cast
libcrypto_la_SOURCES += cast/c_cfb64.c
libcrypto_la_SOURCES += cast/c_ecb.c
libcrypto_la_SOURCES += cast/c_enc.c
libcrypto_la_SOURCES += cast/c_ofb64.c
libcrypto_la_SOURCES += cast/c_skey.c
noinst_HEADERS += cast/cast_lcl.h
noinst_HEADERS += cast/cast_s.h
# chacha
EXTRA_libcrypto_la_SOURCES += chacha/chacha-merged.c
libcrypto_la_SOURCES += chacha/chacha.c
# cmac
libcrypto_la_SOURCES += cmac/cm_ameth.c
libcrypto_la_SOURCES += cmac/cm_pmeth.c
libcrypto_la_SOURCES += cmac/cmac.c
# comp
libcrypto_la_SOURCES += comp/c_rle.c
libcrypto_la_SOURCES += comp/c_zlib.c
libcrypto_la_SOURCES += comp/comp_err.c
libcrypto_la_SOURCES += comp/comp_lib.c
# conf
libcrypto_la_SOURCES += conf/conf_api.c
libcrypto_la_SOURCES += conf/conf_def.c
libcrypto_la_SOURCES += conf/conf_err.c
libcrypto_la_SOURCES += conf/conf_lib.c
libcrypto_la_SOURCES += conf/conf_mall.c
libcrypto_la_SOURCES += conf/conf_mod.c
libcrypto_la_SOURCES += conf/conf_sap.c
noinst_HEADERS += conf/conf_def.h
# des
libcrypto_la_SOURCES += des/cbc_cksm.c
libcrypto_la_SOURCES += des/cbc_enc.c
libcrypto_la_SOURCES += des/cfb64ede.c
libcrypto_la_SOURCES += des/cfb64enc.c
libcrypto_la_SOURCES += des/cfb_enc.c
libcrypto_la_SOURCES += des/des_enc.c
libcrypto_la_SOURCES += des/ecb3_enc.c
libcrypto_la_SOURCES += des/ecb_enc.c
libcrypto_la_SOURCES += des/ede_cbcm_enc.c
libcrypto_la_SOURCES += des/enc_read.c
libcrypto_la_SOURCES += des/enc_writ.c
libcrypto_la_SOURCES += des/fcrypt.c
libcrypto_la_SOURCES += des/fcrypt_b.c
EXTRA_libcrypto_la_SOURCES += des/ncbc_enc.c
libcrypto_la_SOURCES += des/ofb64ede.c
libcrypto_la_SOURCES += des/ofb64enc.c
libcrypto_la_SOURCES += des/ofb_enc.c
libcrypto_la_SOURCES += des/pcbc_enc.c
libcrypto_la_SOURCES += des/qud_cksm.c
libcrypto_la_SOURCES += des/rand_key.c
libcrypto_la_SOURCES += des/set_key.c
libcrypto_la_SOURCES += des/str2key.c
libcrypto_la_SOURCES += des/xcbc_enc.c
noinst_HEADERS += des/des_locl.h
noinst_HEADERS += des/spr.h
# dh
libcrypto_la_SOURCES += dh/dh_ameth.c
libcrypto_la_SOURCES += dh/dh_asn1.c
libcrypto_la_SOURCES += dh/dh_check.c
libcrypto_la_SOURCES += dh/dh_depr.c
libcrypto_la_SOURCES += dh/dh_err.c
libcrypto_la_SOURCES += dh/dh_gen.c
libcrypto_la_SOURCES += dh/dh_key.c
libcrypto_la_SOURCES += dh/dh_lib.c
libcrypto_la_SOURCES += dh/dh_pmeth.c
libcrypto_la_SOURCES += dh/dh_prn.c
# dsa
libcrypto_la_SOURCES += dsa/dsa_ameth.c
libcrypto_la_SOURCES += dsa/dsa_asn1.c
libcrypto_la_SOURCES += dsa/dsa_depr.c
libcrypto_la_SOURCES += dsa/dsa_err.c
libcrypto_la_SOURCES += dsa/dsa_gen.c
libcrypto_la_SOURCES += dsa/dsa_key.c
libcrypto_la_SOURCES += dsa/dsa_lib.c
libcrypto_la_SOURCES += dsa/dsa_ossl.c
libcrypto_la_SOURCES += dsa/dsa_pmeth.c
libcrypto_la_SOURCES += dsa/dsa_prn.c
libcrypto_la_SOURCES += dsa/dsa_sign.c
libcrypto_la_SOURCES += dsa/dsa_vrf.c
noinst_HEADERS += dsa/dsa_locl.h
# dso
libcrypto_la_SOURCES += dso/dso_dlfcn.c
libcrypto_la_SOURCES += dso/dso_err.c
libcrypto_la_SOURCES += dso/dso_lib.c
libcrypto_la_SOURCES += dso/dso_null.c
libcrypto_la_SOURCES += dso/dso_openssl.c
# ec
libcrypto_la_SOURCES += ec/ec2_mult.c
libcrypto_la_SOURCES += ec/ec2_oct.c
libcrypto_la_SOURCES += ec/ec2_smpl.c
libcrypto_la_SOURCES += ec/ec_ameth.c
libcrypto_la_SOURCES += ec/ec_asn1.c
libcrypto_la_SOURCES += ec/ec_check.c
libcrypto_la_SOURCES += ec/ec_curve.c
libcrypto_la_SOURCES += ec/ec_cvt.c
libcrypto_la_SOURCES += ec/ec_err.c
libcrypto_la_SOURCES += ec/ec_key.c
libcrypto_la_SOURCES += ec/ec_lib.c
libcrypto_la_SOURCES += ec/ec_mult.c
libcrypto_la_SOURCES += ec/ec_oct.c
libcrypto_la_SOURCES += ec/ec_pmeth.c
libcrypto_la_SOURCES += ec/ec_print.c
libcrypto_la_SOURCES += ec/eck_prn.c
libcrypto_la_SOURCES += ec/ecp_mont.c
libcrypto_la_SOURCES += ec/ecp_nist.c
libcrypto_la_SOURCES += ec/ecp_oct.c
libcrypto_la_SOURCES += ec/ecp_smpl.c
noinst_HEADERS += ec/ec_lcl.h
# ecdh
libcrypto_la_SOURCES += ecdh/ech_err.c
libcrypto_la_SOURCES += ecdh/ech_key.c
libcrypto_la_SOURCES += ecdh/ech_lib.c
noinst_HEADERS += ecdh/ech_locl.h
# ecdsa
libcrypto_la_SOURCES += ecdsa/ecs_asn1.c
libcrypto_la_SOURCES += ecdsa/ecs_err.c
libcrypto_la_SOURCES += ecdsa/ecs_lib.c
libcrypto_la_SOURCES += ecdsa/ecs_ossl.c
libcrypto_la_SOURCES += ecdsa/ecs_sign.c
libcrypto_la_SOURCES += ecdsa/ecs_vrf.c
noinst_HEADERS += ecdsa/ecs_locl.h
# engine
libcrypto_la_SOURCES += engine/eng_all.c
libcrypto_la_SOURCES += engine/eng_cnf.c
libcrypto_la_SOURCES += engine/eng_ctrl.c
libcrypto_la_SOURCES += engine/eng_dyn.c
libcrypto_la_SOURCES += engine/eng_err.c
libcrypto_la_SOURCES += engine/eng_fat.c
libcrypto_la_SOURCES += engine/eng_init.c
libcrypto_la_SOURCES += engine/eng_lib.c
libcrypto_la_SOURCES += engine/eng_list.c
libcrypto_la_SOURCES += engine/eng_openssl.c
libcrypto_la_SOURCES += engine/eng_pkey.c
libcrypto_la_SOURCES += engine/eng_table.c
libcrypto_la_SOURCES += engine/tb_asnmth.c
libcrypto_la_SOURCES += engine/tb_cipher.c
libcrypto_la_SOURCES += engine/tb_dh.c
libcrypto_la_SOURCES += engine/tb_digest.c
libcrypto_la_SOURCES += engine/tb_dsa.c
libcrypto_la_SOURCES += engine/tb_ecdh.c
libcrypto_la_SOURCES += engine/tb_ecdsa.c
libcrypto_la_SOURCES += engine/tb_pkmeth.c
libcrypto_la_SOURCES += engine/tb_rand.c
libcrypto_la_SOURCES += engine/tb_rsa.c
libcrypto_la_SOURCES += engine/tb_store.c
noinst_HEADERS += engine/eng_int.h
# err
libcrypto_la_SOURCES += err/err.c
libcrypto_la_SOURCES += err/err_all.c
libcrypto_la_SOURCES += err/err_prn.c
# evp
libcrypto_la_SOURCES += evp/bio_b64.c
libcrypto_la_SOURCES += evp/bio_enc.c
libcrypto_la_SOURCES += evp/bio_md.c
libcrypto_la_SOURCES += evp/c_all.c
libcrypto_la_SOURCES += evp/digest.c
libcrypto_la_SOURCES += evp/e_aes.c
libcrypto_la_SOURCES += evp/e_aes_cbc_hmac_sha1.c
libcrypto_la_SOURCES += evp/e_bf.c
libcrypto_la_SOURCES += evp/e_camellia.c
libcrypto_la_SOURCES += evp/e_cast.c
libcrypto_la_SOURCES += evp/e_chacha.c
libcrypto_la_SOURCES += evp/e_chacha20poly1305.c
libcrypto_la_SOURCES += evp/e_des.c
libcrypto_la_SOURCES += evp/e_des3.c
libcrypto_la_SOURCES += evp/e_gost2814789.c
libcrypto_la_SOURCES += evp/e_idea.c
libcrypto_la_SOURCES += evp/e_null.c
libcrypto_la_SOURCES += evp/e_old.c
libcrypto_la_SOURCES += evp/e_rc2.c
libcrypto_la_SOURCES += evp/e_rc4.c
libcrypto_la_SOURCES += evp/e_rc4_hmac_md5.c
libcrypto_la_SOURCES += evp/e_xcbc_d.c
libcrypto_la_SOURCES += evp/encode.c
libcrypto_la_SOURCES += evp/evp_aead.c
libcrypto_la_SOURCES += evp/evp_enc.c
libcrypto_la_SOURCES += evp/evp_err.c
libcrypto_la_SOURCES += evp/evp_key.c
libcrypto_la_SOURCES += evp/evp_lib.c
libcrypto_la_SOURCES += evp/evp_pbe.c
libcrypto_la_SOURCES += evp/evp_pkey.c
libcrypto_la_SOURCES += evp/m_dss.c
libcrypto_la_SOURCES += evp/m_dss1.c
libcrypto_la_SOURCES += evp/m_ecdsa.c
libcrypto_la_SOURCES += evp/m_gost2814789.c
libcrypto_la_SOURCES += evp/m_gostr341194.c
libcrypto_la_SOURCES += evp/m_md4.c
libcrypto_la_SOURCES += evp/m_md5.c
libcrypto_la_SOURCES += evp/m_null.c
libcrypto_la_SOURCES += evp/m_ripemd.c
libcrypto_la_SOURCES += evp/m_sha1.c
libcrypto_la_SOURCES += evp/m_sigver.c
libcrypto_la_SOURCES += evp/m_streebog.c
libcrypto_la_SOURCES += evp/m_wp.c
libcrypto_la_SOURCES += evp/names.c
libcrypto_la_SOURCES += evp/p5_crpt.c
libcrypto_la_SOURCES += evp/p5_crpt2.c
libcrypto_la_SOURCES += evp/p_dec.c
libcrypto_la_SOURCES += evp/p_enc.c
libcrypto_la_SOURCES += evp/p_lib.c
libcrypto_la_SOURCES += evp/p_open.c
libcrypto_la_SOURCES += evp/p_seal.c
libcrypto_la_SOURCES += evp/p_sign.c
libcrypto_la_SOURCES += evp/p_verify.c
libcrypto_la_SOURCES += evp/pmeth_fn.c
libcrypto_la_SOURCES += evp/pmeth_gn.c
libcrypto_la_SOURCES += evp/pmeth_lib.c
noinst_HEADERS += evp/evp_locl.h
# gost
libcrypto_la_SOURCES += gost/gost2814789.c
libcrypto_la_SOURCES += gost/gost89_keywrap.c
libcrypto_la_SOURCES += gost/gost89_params.c
libcrypto_la_SOURCES += gost/gost89imit_ameth.c
libcrypto_la_SOURCES += gost/gost89imit_pmeth.c
libcrypto_la_SOURCES += gost/gost_asn1.c
libcrypto_la_SOURCES += gost/gost_err.c
libcrypto_la_SOURCES += gost/gostr341001.c
libcrypto_la_SOURCES += gost/gostr341001_ameth.c
libcrypto_la_SOURCES += gost/gostr341001_key.c
libcrypto_la_SOURCES += gost/gostr341001_params.c
libcrypto_la_SOURCES += gost/gostr341001_pmeth.c
libcrypto_la_SOURCES += gost/gostr341194.c
libcrypto_la_SOURCES += gost/streebog.c
noinst_HEADERS += gost/gost.h
noinst_HEADERS += gost/gost_asn1.h
noinst_HEADERS += gost/gost_locl.h
# hmac
libcrypto_la_SOURCES += hmac/hm_ameth.c
libcrypto_la_SOURCES += hmac/hm_pmeth.c
libcrypto_la_SOURCES += hmac/hmac.c
# idea
libcrypto_la_SOURCES += idea/i_cbc.c
libcrypto_la_SOURCES += idea/i_cfb64.c
libcrypto_la_SOURCES += idea/i_ecb.c
libcrypto_la_SOURCES += idea/i_ofb64.c
libcrypto_la_SOURCES += idea/i_skey.c
noinst_HEADERS += idea/idea_lcl.h
# krb5
libcrypto_la_SOURCES += krb5/krb5_asn.c
# lhash
libcrypto_la_SOURCES += lhash/lh_stats.c
libcrypto_la_SOURCES += lhash/lhash.c
# md4
libcrypto_la_SOURCES += md4/md4_dgst.c
libcrypto_la_SOURCES += md4/md4_one.c
noinst_HEADERS += md4/md4_locl.h
# md5
libcrypto_la_SOURCES += md5/md5_dgst.c
libcrypto_la_SOURCES += md5/md5_one.c
noinst_HEADERS += md5/md5_locl.h
# modes
libcrypto_la_SOURCES += modes/cbc128.c
libcrypto_la_SOURCES += modes/ccm128.c
libcrypto_la_SOURCES += modes/cfb128.c
libcrypto_la_SOURCES += modes/ctr128.c
libcrypto_la_SOURCES += modes/cts128.c
libcrypto_la_SOURCES += modes/gcm128.c
libcrypto_la_SOURCES += modes/ofb128.c
libcrypto_la_SOURCES += modes/xts128.c
noinst_HEADERS += modes/modes_lcl.h
# objects
libcrypto_la_SOURCES += objects/o_names.c
libcrypto_la_SOURCES += objects/obj_dat.c
libcrypto_la_SOURCES += objects/obj_err.c
libcrypto_la_SOURCES += objects/obj_lib.c
libcrypto_la_SOURCES += objects/obj_xref.c
noinst_HEADERS += objects/obj_dat.h
noinst_HEADERS += objects/obj_xref.h
# ocsp
libcrypto_la_SOURCES += ocsp/ocsp_asn.c
libcrypto_la_SOURCES += ocsp/ocsp_cl.c
libcrypto_la_SOURCES += ocsp/ocsp_err.c
libcrypto_la_SOURCES += ocsp/ocsp_ext.c
libcrypto_la_SOURCES += ocsp/ocsp_ht.c
libcrypto_la_SOURCES += ocsp/ocsp_lib.c
libcrypto_la_SOURCES += ocsp/ocsp_prn.c
libcrypto_la_SOURCES += ocsp/ocsp_srv.c
libcrypto_la_SOURCES += ocsp/ocsp_vfy.c
# pem
libcrypto_la_SOURCES += pem/pem_all.c
libcrypto_la_SOURCES += pem/pem_err.c
libcrypto_la_SOURCES += pem/pem_info.c
libcrypto_la_SOURCES += pem/pem_lib.c
libcrypto_la_SOURCES += pem/pem_oth.c
libcrypto_la_SOURCES += pem/pem_pk8.c
libcrypto_la_SOURCES += pem/pem_pkey.c
libcrypto_la_SOURCES += pem/pem_seal.c
libcrypto_la_SOURCES += pem/pem_sign.c
libcrypto_la_SOURCES += pem/pem_x509.c
libcrypto_la_SOURCES += pem/pem_xaux.c
libcrypto_la_SOURCES += pem/pvkfmt.c
# pkcs12
libcrypto_la_SOURCES += pkcs12/p12_add.c
libcrypto_la_SOURCES += pkcs12/p12_asn.c
libcrypto_la_SOURCES += pkcs12/p12_attr.c
libcrypto_la_SOURCES += pkcs12/p12_crpt.c
libcrypto_la_SOURCES += pkcs12/p12_crt.c
libcrypto_la_SOURCES += pkcs12/p12_decr.c
libcrypto_la_SOURCES += pkcs12/p12_init.c
libcrypto_la_SOURCES += pkcs12/p12_key.c
libcrypto_la_SOURCES += pkcs12/p12_kiss.c
libcrypto_la_SOURCES += pkcs12/p12_mutl.c
libcrypto_la_SOURCES += pkcs12/p12_npas.c
libcrypto_la_SOURCES += pkcs12/p12_p8d.c
libcrypto_la_SOURCES += pkcs12/p12_p8e.c
libcrypto_la_SOURCES += pkcs12/p12_utl.c
libcrypto_la_SOURCES += pkcs12/pk12err.c
# pkcs7
libcrypto_la_SOURCES += pkcs7/bio_pk7.c
libcrypto_la_SOURCES += pkcs7/pk7_asn1.c
libcrypto_la_SOURCES += pkcs7/pk7_attr.c
libcrypto_la_SOURCES += pkcs7/pk7_doit.c
libcrypto_la_SOURCES += pkcs7/pk7_lib.c
libcrypto_la_SOURCES += pkcs7/pk7_mime.c
libcrypto_la_SOURCES += pkcs7/pk7_smime.c
libcrypto_la_SOURCES += pkcs7/pkcs7err.c
# poly1305
EXTRA_libcrypto_la_SOURCES += poly1305/poly1305-donna.c
libcrypto_la_SOURCES += poly1305/poly1305.c
# rand
libcrypto_la_SOURCES += rand/rand_err.c
libcrypto_la_SOURCES += rand/rand_lib.c
libcrypto_la_SOURCES += rand/randfile.c
# rc2
libcrypto_la_SOURCES += rc2/rc2_cbc.c
libcrypto_la_SOURCES += rc2/rc2_ecb.c
libcrypto_la_SOURCES += rc2/rc2_skey.c
libcrypto_la_SOURCES += rc2/rc2cfb64.c
libcrypto_la_SOURCES += rc2/rc2ofb64.c
noinst_HEADERS += rc2/rc2_locl.h
# rc4
noinst_HEADERS += rc4/rc4_locl.h
# ripemd
libcrypto_la_SOURCES += ripemd/rmd_dgst.c
libcrypto_la_SOURCES += ripemd/rmd_one.c
noinst_HEADERS += ripemd/rmd_locl.h
noinst_HEADERS += ripemd/rmdconst.h
# rsa
libcrypto_la_SOURCES += rsa/rsa_ameth.c
libcrypto_la_SOURCES += rsa/rsa_asn1.c
libcrypto_la_SOURCES += rsa/rsa_chk.c
libcrypto_la_SOURCES += rsa/rsa_crpt.c
libcrypto_la_SOURCES += rsa/rsa_depr.c
libcrypto_la_SOURCES += rsa/rsa_eay.c
libcrypto_la_SOURCES += rsa/rsa_err.c
libcrypto_la_SOURCES += rsa/rsa_gen.c
libcrypto_la_SOURCES += rsa/rsa_lib.c
libcrypto_la_SOURCES += rsa/rsa_none.c
libcrypto_la_SOURCES += rsa/rsa_oaep.c
libcrypto_la_SOURCES += rsa/rsa_pk1.c
libcrypto_la_SOURCES += rsa/rsa_pmeth.c
libcrypto_la_SOURCES += rsa/rsa_prn.c
libcrypto_la_SOURCES += rsa/rsa_pss.c
libcrypto_la_SOURCES += rsa/rsa_saos.c
libcrypto_la_SOURCES += rsa/rsa_sign.c
libcrypto_la_SOURCES += rsa/rsa_ssl.c
libcrypto_la_SOURCES += rsa/rsa_x931.c
noinst_HEADERS += rsa/rsa_locl.h
# sha
libcrypto_la_SOURCES += sha/sha1_one.c
libcrypto_la_SOURCES += sha/sha1dgst.c
libcrypto_la_SOURCES += sha/sha256.c
libcrypto_la_SOURCES += sha/sha512.c
noinst_HEADERS += sha/sha_locl.h
# stack
libcrypto_la_SOURCES += stack/stack.c
# ts
libcrypto_la_SOURCES += ts/ts_asn1.c
libcrypto_la_SOURCES += ts/ts_conf.c
libcrypto_la_SOURCES += ts/ts_err.c
libcrypto_la_SOURCES += ts/ts_lib.c
libcrypto_la_SOURCES += ts/ts_req_print.c
libcrypto_la_SOURCES += ts/ts_req_utils.c
libcrypto_la_SOURCES += ts/ts_rsp_print.c
libcrypto_la_SOURCES += ts/ts_rsp_sign.c
libcrypto_la_SOURCES += ts/ts_rsp_utils.c
libcrypto_la_SOURCES += ts/ts_rsp_verify.c
libcrypto_la_SOURCES += ts/ts_verify_ctx.c
# txt_db
libcrypto_la_SOURCES += txt_db/txt_db.c
# ui
libcrypto_la_SOURCES += ui/ui_err.c
libcrypto_la_SOURCES += ui/ui_lib.c
if !HOST_WIN
libcrypto_la_SOURCES += ui/ui_openssl.c
endif
if HOST_WIN
libcrypto_la_SOURCES += ui/ui_openssl_win.c
endif
libcrypto_la_SOURCES += ui/ui_util.c
noinst_HEADERS += ui/ui_locl.h
# whrlpool
libcrypto_la_SOURCES += whrlpool/wp_dgst.c
noinst_HEADERS += whrlpool/wp_locl.h
# x509
libcrypto_la_SOURCES += x509/by_dir.c
libcrypto_la_SOURCES += x509/by_file.c
libcrypto_la_SOURCES += x509/by_mem.c
libcrypto_la_SOURCES += x509/x509_att.c
libcrypto_la_SOURCES += x509/x509_cmp.c
libcrypto_la_SOURCES += x509/x509_d2.c
libcrypto_la_SOURCES += x509/x509_def.c
libcrypto_la_SOURCES += x509/x509_err.c
libcrypto_la_SOURCES += x509/x509_ext.c
libcrypto_la_SOURCES += x509/x509_lu.c
libcrypto_la_SOURCES += x509/x509_obj.c
libcrypto_la_SOURCES += x509/x509_r2x.c
libcrypto_la_SOURCES += x509/x509_req.c
libcrypto_la_SOURCES += x509/x509_set.c
libcrypto_la_SOURCES += x509/x509_trs.c
libcrypto_la_SOURCES += x509/x509_txt.c
libcrypto_la_SOURCES += x509/x509_v3.c
libcrypto_la_SOURCES += x509/x509_vfy.c
libcrypto_la_SOURCES += x509/x509_vpm.c
libcrypto_la_SOURCES += x509/x509cset.c
libcrypto_la_SOURCES += x509/x509name.c
libcrypto_la_SOURCES += x509/x509rset.c
libcrypto_la_SOURCES += x509/x509spki.c
libcrypto_la_SOURCES += x509/x509type.c
libcrypto_la_SOURCES += x509/x_all.c
noinst_HEADERS += x509/x509_lcl.h
# x509v3
libcrypto_la_SOURCES += x509v3/pcy_cache.c
libcrypto_la_SOURCES += x509v3/pcy_data.c
libcrypto_la_SOURCES += x509v3/pcy_lib.c
libcrypto_la_SOURCES += x509v3/pcy_map.c
libcrypto_la_SOURCES += x509v3/pcy_node.c
libcrypto_la_SOURCES += x509v3/pcy_tree.c
libcrypto_la_SOURCES += x509v3/v3_akey.c
libcrypto_la_SOURCES += x509v3/v3_akeya.c
libcrypto_la_SOURCES += x509v3/v3_alt.c
libcrypto_la_SOURCES += x509v3/v3_bcons.c
libcrypto_la_SOURCES += x509v3/v3_bitst.c
libcrypto_la_SOURCES += x509v3/v3_conf.c
libcrypto_la_SOURCES += x509v3/v3_cpols.c
libcrypto_la_SOURCES += x509v3/v3_crld.c
libcrypto_la_SOURCES += x509v3/v3_enum.c
libcrypto_la_SOURCES += x509v3/v3_extku.c
libcrypto_la_SOURCES += x509v3/v3_genn.c
libcrypto_la_SOURCES += x509v3/v3_ia5.c
libcrypto_la_SOURCES += x509v3/v3_info.c
libcrypto_la_SOURCES += x509v3/v3_int.c
libcrypto_la_SOURCES += x509v3/v3_lib.c
libcrypto_la_SOURCES += x509v3/v3_ncons.c
libcrypto_la_SOURCES += x509v3/v3_ocsp.c
libcrypto_la_SOURCES += x509v3/v3_pci.c
libcrypto_la_SOURCES += x509v3/v3_pcia.c
libcrypto_la_SOURCES += x509v3/v3_pcons.c
libcrypto_la_SOURCES += x509v3/v3_pku.c
libcrypto_la_SOURCES += x509v3/v3_pmaps.c
libcrypto_la_SOURCES += x509v3/v3_prn.c
libcrypto_la_SOURCES += x509v3/v3_purp.c
libcrypto_la_SOURCES += x509v3/v3_skey.c
libcrypto_la_SOURCES += x509v3/v3_sxnet.c
libcrypto_la_SOURCES += x509v3/v3_utl.c
libcrypto_la_SOURCES += x509v3/v3err.c
noinst_HEADERS += x509v3/ext_dat.h
noinst_HEADERS += x509v3/pcy_int.h

View File

@@ -0,0 +1,46 @@
if !HAVE_ARC4RANDOM_BUF
libcompat_la_SOURCES += compat/arc4random.c
libcompat_la_SOURCES += compat/arc4random_uniform.c
if !HAVE_GETENTROPY
if HOST_AIX
libcompat_la_SOURCES += compat/getentropy_aix.c
endif
if HOST_FREEBSD
libcompat_la_SOURCES += compat/getentropy_freebsd.c
endif
if HOST_HPUX
libcompat_la_SOURCES += compat/getentropy_hpux.c
endif
if HOST_LINUX
libcompat_la_SOURCES += compat/getentropy_linux.c
endif
if HOST_NETBSD
libcompat_la_SOURCES += compat/getentropy_netbsd.c
endif
if HOST_DARWIN
libcompat_la_SOURCES += compat/getentropy_osx.c
endif
if HOST_SOLARIS
libcompat_la_SOURCES += compat/getentropy_solaris.c
endif
if HOST_WIN
libcompat_la_SOURCES += compat/getentropy_win.c
endif
endif
endif
noinst_HEADERS =
noinst_HEADERS += compat/arc4random.h
noinst_HEADERS += compat/arc4random_aix.h
noinst_HEADERS += compat/arc4random_freebsd.h
noinst_HEADERS += compat/arc4random_hpux.h
noinst_HEADERS += compat/arc4random_linux.h
noinst_HEADERS += compat/arc4random_netbsd.h
noinst_HEADERS += compat/arc4random_osx.h
noinst_HEADERS += compat/arc4random_solaris.h
noinst_HEADERS += compat/arc4random_win.h
noinst_HEADERS += compat/chacha_private.h

View File

@@ -0,0 +1,41 @@
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/vpaes-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 += bn/modexp512-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/gf2m-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 += modes/ghash-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 += sha/sha1-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 += whrlpool/wp-elf-x86_64.s
ASM_X86_64_ELF += cpuid-elf-x86_64.S
EXTRA_DIST += $(ASM_X86_64_ELF)
if HOST_ASM_ELF_X86_64
libcrypto_la_CPPFLAGS += -DAES_ASM
libcrypto_la_CPPFLAGS += -DBSAES_ASM
libcrypto_la_CPPFLAGS += -DVPAES_ASM
libcrypto_la_CPPFLAGS += -DOPENSSL_IA32_SSE2
libcrypto_la_CPPFLAGS += -DOPENSSL_BN_ASM_MONT
libcrypto_la_CPPFLAGS += -DOPENSSL_BN_ASM_MONT5
libcrypto_la_CPPFLAGS += -DOPENSSL_BN_ASM_GF2m
libcrypto_la_CPPFLAGS += -DMD5_ASM
libcrypto_la_CPPFLAGS += -DGHASH_ASM
libcrypto_la_CPPFLAGS += -DRSA_ASM
libcrypto_la_CPPFLAGS += -DSHA1_ASM
libcrypto_la_CPPFLAGS += -DSHA256_ASM
libcrypto_la_CPPFLAGS += -DSHA512_ASM
libcrypto_la_CPPFLAGS += -DWHIRLPOOL_ASM
libcrypto_la_CPPFLAGS += -DOPENSSL_CPUID_OBJ
libcrypto_la_SOURCES += $(ASM_X86_64_ELF)
endif

View File

@@ -0,0 +1,41 @@
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/vpaes-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 += bn/modexp512-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/gf2m-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 += modes/ghash-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 += sha/sha1-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 += whrlpool/wp-macosx-x86_64.s
ASM_X86_64_MACOSX += cpuid-macosx-x86_64.S
EXTRA_DIST += $(ASM_X86_64_MACOSX)
if HOST_ASM_MACOSX_X86_64
libcrypto_la_CPPFLAGS += -DAES_ASM
libcrypto_la_CPPFLAGS += -DBSAES_ASM
libcrypto_la_CPPFLAGS += -DVPAES_ASM
libcrypto_la_CPPFLAGS += -DOPENSSL_IA32_SSE2
libcrypto_la_CPPFLAGS += -DOPENSSL_BN_ASM_MONT
libcrypto_la_CPPFLAGS += -DOPENSSL_BN_ASM_MONT5
libcrypto_la_CPPFLAGS += -DOPENSSL_BN_ASM_GF2m
libcrypto_la_CPPFLAGS += -DMD5_ASM
libcrypto_la_CPPFLAGS += -DGHASH_ASM
libcrypto_la_CPPFLAGS += -DRSA_ASM
libcrypto_la_CPPFLAGS += -DSHA1_ASM
libcrypto_la_CPPFLAGS += -DSHA256_ASM
libcrypto_la_CPPFLAGS += -DSHA512_ASM
libcrypto_la_CPPFLAGS += -DWHIRLPOOL_ASM
libcrypto_la_CPPFLAGS += -DOPENSSL_CPUID_OBJ
libcrypto_la_SOURCES += $(ASM_X86_64_MACOSX)
endif

View File

@@ -1,94 +0,0 @@
include $(top_srcdir)/Makefile.am.common
AM_CPPFLAGS += -I$(top_srcdir)/crypto/asn1
AM_CPPFLAGS += -I$(top_srcdir)/crypto/evp
AM_CPPFLAGS += -I$(top_srcdir)/crypto/modes
lib_LTLIBRARIES = libcrypto.la
libcrypto_la_LIBADD = libcompat.la libcompatnoopt.la
libcrypto_la_LDFLAGS = -version-info libcrypto-version
libcrypto_la_CFLAGS = $(CFLAGS) $(USER_CFLAGS) -DOPENSSL_NO_HW_PADLOCK
noinst_LTLIBRARIES = libcompat.la libcompatnoopt.la
# compatibility functions that need to be built without optimizations
libcompatnoopt_la_CFLAGS = -O0
libcompatnoopt_la_SOURCES =
if NO_EXPLICIT_BZERO
libcompatnoopt_la_SOURCES += compat/explicit_bzero.c
endif
# other compatibility functions
libcompat_la_CFLAGS = $(CFLAGS) $(USER_CFLAGS)
libcompat_la_SOURCES =
libcompat_la_LIBADD = $(PLATFORM_LDADD)
if NO_STRLCAT
libcompat_la_SOURCES += compat/strlcat.c
endif
if NO_STRLCPY
libcompat_la_SOURCES += compat/strlcpy.c
endif
if NO_STRNDUP
libcompat_la_SOURCES += compat/strndup.c
libcompat_la_SOURCES += compat/strnlen.c
endif
if NO_ASPRINTF
libcompat_la_SOURCES += compat/bsd-asprintf.c
endif
if NO_REALLOCARRAY
libcompat_la_SOURCES += compat/reallocarray.c
endif
if NO_TIMINGSAFE_MEMCMP
libcompat_la_SOURCES += compat/timingsafe_memcmp.c
endif
if NO_TIMINGSAFE_BCMP
libcompat_la_SOURCES += compat/timingsafe_bcmp.c
endif
if NO_ARC4RANDOM_BUF
libcompat_la_SOURCES += compat/arc4random.c
if NO_GETENTROPY
if HOST_LINUX
libcompat_la_SOURCES += compat/getentropy_linux.c
endif
if HOST_DARWIN
libcompat_la_SOURCES += compat/getentropy_osx.c
endif
if HOST_SOLARIS
libcompat_la_SOURCES += compat/getentropy_solaris.c
endif
if HOST_WIN
libcompat_la_SOURCES += compat/getentropy_win.c
endif
endif
endif
if NO_ISSETUGID
if HOST_LINUX
libcompat_la_SOURCES += compat/issetugid_linux.c
endif
if HOST_WIN
libcompat_la_SOURCES += compat/issetugid_win.c
endif
endif
noinst_HEADERS = des/ncbc_enc.c
noinst_HEADERS += compat/arc4random.h
noinst_HEADERS += compat/arc4random_linux.h
noinst_HEADERS += compat/arc4random_osx.h
noinst_HEADERS += compat/arc4random_solaris.h
noinst_HEADERS += compat/arc4random_win.h
noinst_HEADERS += compat/chacha_private.h
libcrypto_la_SOURCES =
EXTRA_libcrypto_la_SOURCES =

View File

@@ -1,13 +1,30 @@
#if defined(__linux__)
#ifndef LIBCRYPTOCOMPAT_ARC4RANDOM_H
#define LIBCRYPTOCOMPAT_ARC4RANDOM_H
#include <sys/param.h>
#if defined(_AIX)
#include "arc4random_aix.h"
#elif defined(__FreeBSD__)
#include "arc4random_freebsd.h"
#elif defined(__hpux)
#include "arc4random_hpux.h"
#elif defined(__linux__)
#include "arc4random_linux.h"
#elif defined(__NetBSD__)
#include "arc4random_netbsd.h"
#elif defined(__APPLE__)
#include "arc4random_osx.h"
#elif defined(__sun)
#include "arc4random_solaris.h"
#elif defined(__WIN32)
#elif defined(_WIN32)
#include "arc4random_win.h"
#else
@@ -15,3 +32,4 @@
#endif
#endif

54
crypto/compat/b_win.c Normal file
View File

@@ -0,0 +1,54 @@
/*
* Public domain
*
* Dongsheng Song <dongsheng.song@gmail.com>
* Brent Cook <bcook@openbsd.org>
*/
#include <ws2tcpip.h>
#include <openssl/bio.h>
#include <openssl/err.h>
int
BIO_sock_init(void)
{
/*
* WSAStartup loads the winsock .dll and initializes the networking
* stack on Windows, or simply increases the reference count.
*/
static struct WSAData wsa_state = {0};
WORD version_requested = MAKEWORD(2, 2);
static int wsa_init_done = 0;
if (!wsa_init_done) {
if (WSAStartup(version_requested, &wsa_state) != 0) {
int err = WSAGetLastError();
SYSerr(SYS_F_WSASTARTUP, err);
BIOerr(BIO_F_BIO_SOCK_INIT, BIO_R_WSASTARTUP);
return (-1);
}
wsa_init_done = 1;
}
return (1);
}
void
BIO_sock_cleanup(void)
{
/*
* We could call WSACleanup here, but it is easy to get it wrong. Since
* this API provides no way to even tell if it failed, there is no safe
* way to expose that functionality here.
*
* The cost of leaving the networking DLLs loaded may have been large
* during the Windows 3.1/win32s era, but it is small in modern
* contexts, so don't bother.
*/
}
int
BIO_socket_nbio(int s, int mode)
{
u_long value = mode;
return ioctlsocket(s, FIONBIO, &value) != SOCKET_ERROR;
}

View File

@@ -17,7 +17,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef HAVE_VASPRINTF
#ifndef HAVE_ASPRINTF
#include <errno.h>
#include <limits.h> /* for INT_MAX */
@@ -80,9 +80,7 @@ fail:
errno = ENOMEM;
return (-1);
}
#endif
#ifndef HAVE_ASPRINTF
int asprintf(char **str, const char *fmt, ...)
{
va_list ap;

View File

@@ -0,0 +1,13 @@
/*
* Public domain.
* Win32 explicit_bzero compatibility shim.
*/
#include <windows.h>
#include <string.h>
void
explicit_bzero(void *buf, size_t len)
{
SecureZeroMemory(buf, len);
}

212
crypto/compat/inet_pton.c Normal file
View File

@@ -0,0 +1,212 @@
/* $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

@@ -1,47 +0,0 @@
/*
* issetugid implementation for Linux
* Public domain
*/
#include <errno.h>
#include <gnu/libc-version.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
/*
* Linux-specific glibc 2.16+ interface for determining if a process was
* launched setuid/setgid or with additional capabilities.
*/
#ifdef HAVE_GETAUXVAL
#include <sys/auxv.h>
#endif
int issetugid(void)
{
#ifdef HAVE_GETAUXVAL
/*
* The API for glibc < 2.19 does not indicate if there is an error with
* getauxval. While it should not be the case that any 2.6 or greater
* kernel ever does not supply AT_SECURE, an emulated software environment
* might rewrite the aux vector.
*
* See https://sourceware.org/bugzilla/show_bug.cgi?id=15846
*
* Perhaps this code should just read the aux vector itself, so we have
* backward-compatibility and error handling in older glibc versions.
* info: http://lwn.net/Articles/519085/
*
*/
const char *glcv = gnu_get_libc_version();
if (strverscmp(glcv, "2.19") >= 0) {
errno = 0;
if (getauxval(AT_SECURE) == 0) {
if (errno != ENOENT) {
return 0;
}
}
}
#endif
return 1;
}

View File

@@ -1,26 +0,0 @@
/*
* issetugid implementation for Windows
* Public domain
*/
#include <unistd.h>
/*
* Windows does not have a native setuid/setgid functionality.
* A user must enter credentials each time a process elevates its
* privileges.
*
* So, in theory, this could always return 0, given what I know currently.
* However, it makes sense to stub out initially in 'safe' mode until we
* understand more (and determine if any disabled functionality is actually
* useful on Windows anyway).
*
* Future versions of this function that are made more 'open' should thoroughly
* consider the case of this code running as a privileged service with saved
* user credentials or privilege escalations by other means (e.g. the old
* RunAsEx utility.)
*/
int issetugid(void)
{
return 1;
}

214
crypto/compat/posix_win.c Normal file
View File

@@ -0,0 +1,214 @@
/*
* Public domain
*
* BSD socket emulation code for Winsock2
* File IO compatibility shims
* Brent Cook <bcook@openbsd.org>
*/
#define NO_REDEF_POSIX_FUNCTIONS
#include <windows.h>
#include <ws2tcpip.h>
#include <errno.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
void
posix_perror(const char *s)
{
fprintf(stderr, "%s: %s\n", s, strerror(errno));
}
FILE *
posix_fopen(const char *path, const char *mode)
{
if (strchr(mode, 'b') == NULL) {
char *bin_mode = NULL;
if (asprintf(&bin_mode, "%sb", mode) == -1)
return NULL;
FILE *f = fopen(path, bin_mode);
free(bin_mode);
return f;
}
return fopen(path, 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
posix_rename(const char *oldpath, const char *newpath)
{
return MoveFileEx(oldpath, newpath, MOVEFILE_REPLACE_EXISTING) ? 0 : -1;
}
static int
wsa_errno(int err)
{
switch (err) {
case WSAENOBUFS:
errno = ENOMEM;
break;
case WSAEACCES:
errno = EACCES;
break;
case WSANOTINITIALISED:
errno = EPERM;
break;
case WSAEHOSTUNREACH:
case WSAENETDOWN:
errno = EIO;
break;
case WSAEFAULT:
errno = EFAULT;
break;
case WSAEINTR:
errno = EINTR;
break;
case WSAEINVAL:
errno = EINVAL;
break;
case WSAEINPROGRESS:
errno = EINPROGRESS;
break;
case WSAEWOULDBLOCK:
errno = EAGAIN;
break;
case WSAEOPNOTSUPP:
errno = ENOTSUP;
break;
case WSAEMSGSIZE:
errno = EFBIG;
break;
case WSAENOTSOCK:
errno = ENOTSOCK;
break;
case WSAENOPROTOOPT:
errno = ENOPROTOOPT;
break;
case WSAECONNREFUSED:
errno = ECONNREFUSED;
break;
case WSAEAFNOSUPPORT:
errno = EAFNOSUPPORT;
break;
case WSAENETRESET:
case WSAENOTCONN:
case WSAECONNABORTED:
case WSAECONNRESET:
case WSAESHUTDOWN:
case WSAETIMEDOUT:
errno = EPIPE;
break;
}
return -1;
}
int
posix_connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen)
{
int rc = connect(sockfd, addr, addrlen);
if (rc == SOCKET_ERROR)
return wsa_errno(WSAGetLastError());
return rc;
}
int
posix_close(int fd)
{
if (closesocket(fd) == SOCKET_ERROR) {
int err = WSAGetLastError();
return err == WSAENOTSOCK ?
close(fd) : wsa_errno(err);
}
return 0;
}
ssize_t
posix_read(int fd, void *buf, size_t count)
{
ssize_t rc = recv(fd, buf, count, 0);
if (rc == SOCKET_ERROR) {
int err = WSAGetLastError();
return err == WSAENOTSOCK ?
read(fd, buf, count) : wsa_errno(err);
}
return rc;
}
ssize_t
posix_write(int fd, const void *buf, size_t count)
{
ssize_t rc = send(fd, buf, count, 0);
if (rc == SOCKET_ERROR) {
int err = WSAGetLastError();
return err == WSAENOTSOCK ?
write(fd, buf, count) : wsa_errno(err);
}
return rc;
}
int
posix_getsockopt(int sockfd, int level, int optname,
void *optval, socklen_t *optlen)
{
int rc = getsockopt(sockfd, level, optname, (char *)optval, optlen);
return rc == 0 ? 0 : wsa_errno(WSAGetLastError());
}
int
posix_setsockopt(int sockfd, int level, int optname,
const void *optval, socklen_t optlen)
{
int rc = setsockopt(sockfd, level, optname, (char *)optval, optlen);
return rc == 0 ? 0 : wsa_errno(WSAGetLastError());
}
#ifdef _MSC_VER
int gettimeofday(struct timeval * tp, struct timezone * tzp)
{
/*
* Note: some broken versions only have 8 trailing zero's, the correct
* epoch has 9 trailing zero's
*/
static const uint64_t EPOCH = ((uint64_t) 116444736000000000ULL);
SYSTEMTIME system_time;
FILETIME file_time;
uint64_t time;
GetSystemTime(&system_time);
SystemTimeToFileTime(&system_time, &file_time);
time = ((uint64_t)file_time.dwLowDateTime);
time += ((uint64_t)file_time.dwHighDateTime) << 32;
tp->tv_sec = (long)((time - EPOCH) / 10000000L);
tp->tv_usec = (long)(system_time.wMilliseconds * 1000);
return 0;
}
unsigned int sleep(unsigned int seconds)
{
Sleep(seconds * 1000);
return seconds;
}
#endif

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

@@ -0,0 +1,379 @@
/* $OpenBSD: ui_openssl.c,v 1.22 2014/07/11 08:44:49 jsing Exp $ */
/* Written by Richard Levitte (richard@levitte.org) and others
* for the OpenSSL project 2001.
*/
/* ====================================================================
* Copyright (c) 2001 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* openssl-core@openssl.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* (eay@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh@cryptsoft.com).
*
*/
/* The lowest level part of this file was previously in crypto/des/read_pwd.c,
* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young (eay@cryptsoft.com).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
*
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* "This product includes cryptographic software written by
* Eric Young (eay@cryptsoft.com)"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
*
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
#include <sys/ioctl.h>
#include <openssl/opensslconf.h>
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "ui_locl.h"
#ifndef NX509_SIG
#define NX509_SIG 32
#endif
/* Define globals. They are protected by a lock */
static void (*savsig[NX509_SIG])(int );
DWORD console_mode;
static FILE *tty_in, *tty_out;
static int is_a_tty;
/* Declare static functions */
static int read_till_nl(FILE *);
static void recsig(int);
static void pushsig(void);
static void popsig(void);
static int read_string_inner(UI *ui, UI_STRING *uis, int echo, int strip_nl);
static int read_string(UI *ui, UI_STRING *uis);
static int write_string(UI *ui, UI_STRING *uis);
static int open_console(UI *ui);
static int echo_console(UI *ui);
static int noecho_console(UI *ui);
static int close_console(UI *ui);
static UI_METHOD ui_openssl = {
.name = "OpenSSL default user interface",
.ui_open_session = open_console,
.ui_write_string = write_string,
.ui_read_string = read_string,
.ui_close_session = close_console,
};
/* The method with all the built-in thingies */
UI_METHOD *
UI_OpenSSL(void)
{
return &ui_openssl;
}
/* The following function makes sure that info and error strings are printed
before any prompt. */
static int
write_string(UI *ui, UI_STRING *uis)
{
switch (UI_get_string_type(uis)) {
case UIT_ERROR:
case UIT_INFO:
fputs(UI_get0_output_string(uis), tty_out);
fflush(tty_out);
break;
default:
break;
}
return 1;
}
static int
read_string(UI *ui, UI_STRING *uis)
{
int ok = 0;
switch (UI_get_string_type(uis)) {
case UIT_BOOLEAN:
fputs(UI_get0_output_string(uis), tty_out);
fputs(UI_get0_action_string(uis), tty_out);
fflush(tty_out);
return read_string_inner(ui, uis,
UI_get_input_flags(uis) & UI_INPUT_FLAG_ECHO, 0);
case UIT_PROMPT:
fputs(UI_get0_output_string(uis), tty_out);
fflush(tty_out);
return read_string_inner(ui, uis,
UI_get_input_flags(uis) & UI_INPUT_FLAG_ECHO, 1);
case UIT_VERIFY:
fprintf(tty_out, "Verifying - %s",
UI_get0_output_string(uis));
fflush(tty_out);
if ((ok = read_string_inner(ui, uis, UI_get_input_flags(uis) &
UI_INPUT_FLAG_ECHO, 1)) <= 0)
return ok;
if (strcmp(UI_get0_result_string(uis),
UI_get0_test_string(uis)) != 0) {
fprintf(tty_out, "Verify failure\n");
fflush(tty_out);
return 0;
}
break;
default:
break;
}
return 1;
}
/* Internal functions to read a string without echoing */
static int
read_till_nl(FILE *in)
{
#define SIZE 4
char buf[SIZE + 1];
do {
if (!fgets(buf, SIZE, in))
return 0;
} while (strchr(buf, '\n') == NULL);
return 1;
}
static volatile sig_atomic_t intr_signal;
static int
read_string_inner(UI *ui, UI_STRING *uis, int echo, int strip_nl)
{
static int ps;
int ok;
char result[BUFSIZ];
int maxsize = BUFSIZ - 1;
char *p;
intr_signal = 0;
ok = 0;
ps = 0;
pushsig();
ps = 1;
if (!echo && !noecho_console(ui))
goto error;
ps = 2;
result[0] = '\0';
p = fgets(result, maxsize, tty_in);
if (!p)
goto error;
if (feof(tty_in))
goto error;
if (ferror(tty_in))
goto error;
if ((p = strchr(result, '\n')) != NULL) {
if (strip_nl)
*p = '\0';
} else if (!read_till_nl(tty_in))
goto error;
if (UI_set_result(ui, uis, result) >= 0)
ok = 1;
error:
if (intr_signal == SIGINT)
ok = -1;
if (!echo)
fprintf(tty_out, "\n");
if (ps >= 2 && !echo && !echo_console(ui))
ok = 0;
if (ps >= 1)
popsig();
explicit_bzero(result, BUFSIZ);
return ok;
}
/* Internal functions to open, handle and close a channel to the console. */
static int
open_console(UI *ui)
{
CRYPTO_w_lock(CRYPTO_LOCK_UI);
is_a_tty = 1;
tty_in = stdin;
tty_out = stderr;
HANDLE handle = GetStdHandle(STD_INPUT_HANDLE);
if (handle != NULL && handle != INVALID_HANDLE_VALUE) {
if (GetFileType(handle) == FILE_TYPE_CHAR)
return GetConsoleMode(handle, &console_mode);
else
return 1;
}
return 0;
}
static int
noecho_console(UI *ui)
{
HANDLE handle = GetStdHandle(STD_INPUT_HANDLE);
if (handle != NULL && handle != INVALID_HANDLE_VALUE) {
if (GetFileType(handle) == FILE_TYPE_CHAR)
return SetConsoleMode(handle, console_mode & ~ENABLE_ECHO_INPUT);
else
return 1;
}
return 0;
}
static int
echo_console(UI *ui)
{
HANDLE handle = GetStdHandle(STD_INPUT_HANDLE);
if (handle != NULL && handle != INVALID_HANDLE_VALUE) {
if (GetFileType(handle) == FILE_TYPE_CHAR)
return SetConsoleMode(handle, console_mode);
else
return 1;
}
return 0;
}
static int
close_console(UI *ui)
{
if (tty_in != stdin)
fclose(tty_in);
if (tty_out != stderr)
fclose(tty_out);
CRYPTO_w_unlock(CRYPTO_LOCK_UI);
return 1;
}
/* Internal functions to handle signals and act on them */
static void
pushsig(void)
{
savsig[SIGABRT] = signal(SIGABRT, recsig);
savsig[SIGFPE] = signal(SIGFPE, recsig);
savsig[SIGILL] = signal(SIGILL, recsig);
savsig[SIGINT] = signal(SIGINT, recsig);
savsig[SIGSEGV] = signal(SIGSEGV, recsig);
savsig[SIGTERM] = signal(SIGTERM, recsig);
}
static void
popsig(void)
{
signal(SIGABRT, savsig[SIGABRT]);
signal(SIGFPE, savsig[SIGFPE]);
signal(SIGILL, savsig[SIGILL]);
signal(SIGINT, savsig[SIGINT]);
signal(SIGSEGV, savsig[SIGSEGV]);
signal(SIGTERM, savsig[SIGTERM]);
}
static void
recsig(int i)
{
intr_signal = i;
}

48
dist-win.sh Executable file
View File

@@ -0,0 +1,48 @@
#!/bin/bash
set -e
#set -x
export PATH=/cygdrive/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio\ 12.0/VC/bin:$PATH
VERSION=`cat VERSION`
DIST=libressl-$VERSION-windows
rm -fr $DIST
mkdir -p $DIST
autoreconf -i
for ARCH in X86 X64; do
if [ $ARCH = X86 ]; then
HOST=i686-w64-mingw32
ARCHDIR=x86
else
HOST=x86_64-w64-mingw32
ARCHDIR=x64
fi
echo Building for $HOST
CC=$HOST-gcc ./configure --host=$HOST
make clean
PATH=$PATH:/usr/$HOST/sys-root/mingw/bin \
make -j 4 check
make -j 4 install DESTDIR=`pwd`/stage-$ARCHDIR
mkdir -p $DIST/$ARCHDIR
if [ ! -e $DIST/include ]; then
cp -r stage-$ARCHDIR/usr/local/include $DIST
fi
cp stage-$ARCHDIR/usr/local/bin/* $DIST/$ARCHDIR
for i in libcrypto libssl libtls; do
DLL=$(basename `ls -1 $DIST/$ARCHDIR/$i*.dll`|cut -d. -f1)
echo EXPORTS > $DLL.def
dumpbin /exports $DIST/$ARCHDIR/$DLL.dll | \
awk '{print $4}' | awk 'NF' |tail -n +9 >> $DLL.def
lib /MACHINE:$ARCH /def:$DLL.def /out:$DIST/$ARCHDIR/$DLL.lib
cv2pdb $DIST/$ARCHDIR/$DLL.dll
done
done
zip -r $DIST.zip $DIST

View File

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

43
gen-coverage-report.sh Executable file
View File

@@ -0,0 +1,43 @@
#!/bin/sh
VERSION=$(cat VERSION)
DESTDIR=libressl-coverage-$VERSION
echo "This will generate a code coverage report under $DESTDIR"
echo
if [ "x$(which lcov)" = "x" ]; then
echo "'lcov' is required but not found!"
exit 1
fi
if [ "x$(which genhtml)" = "x" ]; then
echo "'genhtml' is required but not found!"
exit 1
fi
find -name '*.gcda' -o -name '*.gcno' -delete
rm -fr $DESTDIR
echo "Configuring to build with code coverage support"
./configure CFLAGS='-O0 -fprofile-arcs -ftest-coverage'
echo "Running all code paths"
make clean
make check
echo "Generating report"
mkdir -p $DESTDIR
find tests -name '*.gcda' -o -name '*.gcno' -delete
lcov --capture --output-file $DESTDIR/coverage.tmp \
--rc lcov_branch_coverage=1 \
--directory crypto \
--directory ssl \
--directory tls \
--test-name "LibreSSL $VERSION"
genhtml --prefix . --output-directory $DESTDIR \
--branch-coverage --function-coverage \
--rc lcov_branch_coverage=1 \
--title "LibreSSL $VERSION" --legend --show-detail $DESTDIR/coverage.tmp
echo "Code coverage report is available under $DESTDIR"

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

5
include/CMakeLists.txt Normal file
View File

@@ -0,0 +1,5 @@
install(DIRECTORY .
DESTINATION include
PATTERN "CMakeLists.txt" EXCLUDE
PATTERN "compat" EXCLUDE
PATTERN "Makefile.*" EXCLUDE)

View File

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

View File

@@ -0,0 +1,19 @@
/*
* Public domain
* arpa/inet.h compatibility shim
*/
#ifndef _WIN32
#include_next <arpa/inet.h>
#else
#include <win32netcompat.h>
#ifndef AI_ADDRCONFIG
#define AI_ADDRCONFIG 0x00000400
#endif
#endif
#ifndef HAVE_INET_PTON
int inet_pton(int af, const char * src, void * dst);
#endif

View File

@@ -0,0 +1,23 @@
/*
* Public domain
* arpa/inet.h compatibility shim
*/
#ifndef _WIN32
#include_next <arpa/nameser.h>
#else
#include <win32netcompat.h>
#ifndef INADDRSZ
#define INADDRSZ 4
#endif
#ifndef IN6ADDRSZ
#define IN6ADDRSZ 16
#endif
#ifndef INT16SZ
#define INT16SZ 2
#endif
#endif

17
include/compat/dirent.h Normal file
View File

@@ -0,0 +1,17 @@
/*
* Public domain
* dirent.h compatibility shim
*/
#ifndef LIBCRYPTOCOMPAT_DIRENT_H
#define LIBCRYPTOCOMPAT_DIRENT_H
#ifdef _MSC_VER
#include <windows.h>
#include <dirent_msvc.h>
#else
#include_next <dirent.h>
#endif
#endif

View File

@@ -0,0 +1,611 @@
/*
* dirent.h - dirent API for Microsoft Visual Studio
*
* Copyright (C) 2006-2012 Toni Ronkko
*
* 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 TONI RONKKO 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.
*
* $Id: dirent.h,v 1.20 2014/03/19 17:52:23 tronkko Exp $
*/
#ifndef DIRENT_MSVC_H
#define DIRENT_MSVC_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/wchar.h>
#include <../include/string.h>
#include <../include/stdlib.h>
#include <../include/sys/types.h>
#include <../include/errno.h>
#endif
#include <stdarg.h>
#include <sys/stat.h>
/* Indicates that d_type field is available in dirent structure */
#define _DIRENT_HAVE_D_TYPE
/* Indicates that d_namlen field is available in dirent structure */
#define _DIRENT_HAVE_D_NAMLEN
/* Maximum length of file name */
#if !defined(PATH_MAX)
# define PATH_MAX MAX_PATH
#endif
#if !defined(FILENAME_MAX)
# define FILENAME_MAX MAX_PATH
#endif
#if !defined(NAME_MAX)
# define NAME_MAX FILENAME_MAX
#endif
/* Return the exact length of d_namlen without zero terminator */
#define _D_EXACT_NAMLEN(p)((p)->d_namlen)
/* Return number of bytes needed to store d_namlen */
#define _D_ALLOC_NAMLEN(p)(PATH_MAX)
/* Wide-character version */
struct _wdirent {
long d_ino; /* Always zero */
unsigned short d_reclen; /* Structure size */
size_t d_namlen; /* Length of name without \0 */
int d_type; /* File type */
wchar_t d_name[PATH_MAX]; /* File name */
};
typedef struct _wdirent _wdirent;
struct _WDIR {
struct _wdirent ent; /* Current directory entry */
WIN32_FIND_DATAW data; /* Private file data */
int cached; /* True if data is valid */
HANDLE handle; /* Win32 search handle */
wchar_t *patt; /* Initial directory name */
};
typedef struct _WDIR _WDIR;
static _WDIR *_wopendir(const wchar_t *dirname);
static struct _wdirent *_wreaddir(_WDIR *dirp);
static int _wclosedir(_WDIR *dirp);
static void _wrewinddir(_WDIR* dirp);
/* Multi-byte character versions */
struct dirent {
long d_ino; /* Always zero */
unsigned short d_reclen; /* Structure size */
size_t d_namlen; /* Length of name without \0 */
int d_type; /* File type */
char d_name[PATH_MAX]; /* File name */
};
typedef struct dirent dirent;
struct DIR {
struct dirent ent;
struct _WDIR *wdirp;
};
typedef struct DIR DIR;
static DIR *opendir(const char *dirname);
static struct dirent *readdir(DIR *dirp);
static int closedir(DIR *dirp);
static void rewinddir(DIR* dirp);
/* Internal utility functions */
static WIN32_FIND_DATAW *dirent_first(_WDIR *dirp);
static WIN32_FIND_DATAW *dirent_next(_WDIR *dirp);
static int dirent_mbstowcs_s(
size_t *pReturnValue,
wchar_t *wcstr,
size_t sizeInWords,
const char *mbstr,
size_t count);
static int dirent_wcstombs_s(
size_t *pReturnValue,
char *mbstr,
size_t sizeInBytes,
const wchar_t *wcstr,
size_t count);
/*
* Open directory stream DIRNAME for read and return a pointer to the
* internal working area that is used to retrieve individual directory
* entries.
*/
static _WDIR*
_wopendir(const wchar_t *dirname)
{
_WDIR *dirp = NULL;
int error;
/* Must have directory name */
if (dirname == NULL || dirname[0] == '\0') {
_set_errno(ENOENT);
return NULL;
}
/* Allocate new _WDIR structure */
dirp =(_WDIR*) malloc(sizeof(struct _WDIR));
if (dirp != NULL) {
DWORD n;
/* Reset _WDIR structure */
dirp->handle = INVALID_HANDLE_VALUE;
dirp->patt = NULL;
dirp->cached = 0;
/* Compute the length of full path plus zero terminator */
n = GetFullPathNameW(dirname, 0, NULL, NULL);
/* Allocate room for absolute directory name and search pattern */
dirp->patt =(wchar_t*) malloc(sizeof(wchar_t) * n + 16);
if (dirp->patt) {
/*
* Convert relative directory name to an absolute one. This
* allows rewinddir() to function correctly even when current
* working directory is changed between opendir() and rewinddir().
*/
n = GetFullPathNameW(dirname, n, dirp->patt, NULL);
if (n > 0) {
wchar_t *p;
/* Append search pattern \* to the directory name */
p = dirp->patt + n;
if (dirp->patt < p) {
switch(p[-1]) {
case '\\':
case '/':
case ':':
/* Directory ends in path separator, e.g. c:\temp\ */
/*NOP*/;
break;
default:
/* Directory name doesn't end in path separator */
*p++ = '\\';
}
}
*p++ = '*';
*p = '\0';
/* Open directory stream and retrieve the first entry */
if (dirent_first(dirp)) {
/* Directory stream opened successfully */
error = 0;
} else {
/* Cannot retrieve first entry */
error = 1;
_set_errno(ENOENT);
}
} else {
/* Cannot retrieve full path name */
_set_errno(ENOENT);
error = 1;
}
} else {
/* Cannot allocate memory for search pattern */
error = 1;
}
} else {
/* Cannot allocate _WDIR structure */
error = 1;
}
/* Clean up in case of error */
if (error && dirp) {
_wclosedir(dirp);
dirp = NULL;
}
return dirp;
}
/*
* Read next directory entry. The directory entry is returned in dirent
* structure in the d_name field. Individual directory entries returned by
* this function include regular files, sub-directories, pseudo-directories
* "." and ".." as well as volume labels, hidden files and system files.
*/
static struct _wdirent*
_wreaddir(_WDIR *dirp)
{
WIN32_FIND_DATAW *datap;
struct _wdirent *entp;
/* Read next directory entry */
datap = dirent_next(dirp);
if (datap) {
size_t n;
DWORD attr;
/* Pointer to directory entry to return */
entp = &dirp->ent;
/*
* Copy file name as wide-character string. If the file name is too
* long to fit in to the destination buffer, then truncate file name
* to PATH_MAX characters and zero-terminate the buffer.
*/
n = 0;
while(n + 1 < PATH_MAX && datap->cFileName[n] != 0) {
entp->d_name[n] = datap->cFileName[n];
n++;
}
dirp->ent.d_name[n] = 0;
/* Length of file name excluding zero terminator */
entp->d_namlen = n;
/* File type */
attr = datap->dwFileAttributes;
if ((attr & FILE_ATTRIBUTE_DEVICE) != 0) {
entp->d_type = DT_CHR;
} else if ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0) {
entp->d_type = DT_DIR;
} else {
entp->d_type = DT_REG;
}
/* Reset dummy fields */
entp->d_ino = 0;
entp->d_reclen = sizeof(struct _wdirent);
} else {
/* Last directory entry read */
entp = NULL;
}
return entp;
}
/*
* Close directory stream opened by opendir() function. This invalidates the
* DIR structure as well as any directory entry read previously by
* _wreaddir().
*/
static int
_wclosedir(_WDIR *dirp)
{
int ok;
if (dirp) {
/* Release search handle */
if (dirp->handle != INVALID_HANDLE_VALUE) {
FindClose(dirp->handle);
dirp->handle = INVALID_HANDLE_VALUE;
}
/* Release search pattern */
if (dirp->patt) {
free(dirp->patt);
dirp->patt = NULL;
}
/* Release directory structure */
free(dirp);
ok = /*success*/0;
} else {
/* Invalid directory stream */
_set_errno(EBADF);
ok = /*failure*/-1;
}
return ok;
}
/*
* Rewind directory stream such that _wreaddir() returns the very first
* file name again.
*/
static void
_wrewinddir(_WDIR* dirp)
{
if (dirp) {
/* Release existing search handle */
if (dirp->handle != INVALID_HANDLE_VALUE) {
FindClose(dirp->handle);
}
/* Open new search handle */
dirent_first(dirp);
}
}
/* Get first directory entry(internal) */
static WIN32_FIND_DATAW*
dirent_first(_WDIR *dirp)
{
WIN32_FIND_DATAW *datap;
/* Open directory and retrieve the first entry */
dirp->handle = FindFirstFileW(dirp->patt, &dirp->data);
if (dirp->handle != INVALID_HANDLE_VALUE) {
/* a directory entry is now waiting in memory */
datap = &dirp->data;
dirp->cached = 1;
} else {
/* Failed to re-open directory: no directory entry in memory */
dirp->cached = 0;
datap = NULL;
}
return datap;
}
/* Get next directory entry(internal) */
static WIN32_FIND_DATAW*
dirent_next(_WDIR *dirp)
{
WIN32_FIND_DATAW *p;
/* Get next directory entry */
if (dirp->cached != 0) {
/* A valid directory entry already in memory */
p = &dirp->data;
dirp->cached = 0;
} else if (dirp->handle != INVALID_HANDLE_VALUE) {
/* Get the next directory entry from stream */
if (FindNextFileW(dirp->handle, &dirp->data) != FALSE) {
/* Got a file */
p = &dirp->data;
} else {
/* The very last entry has been processed or an error occured */
FindClose(dirp->handle);
dirp->handle = INVALID_HANDLE_VALUE;
p = NULL;
}
} else {
/* End of directory stream reached */
p = NULL;
}
return p;
}
/*
* Open directory stream using plain old C-string.
*/
static DIR*
opendir(const char *dirname)
{
struct DIR *dirp;
int error;
/* Must have directory name */
if (dirname == NULL || dirname[0] == '\0') {
_set_errno(ENOENT);
return NULL;
}
/* Allocate memory for DIR structure */
dirp =(DIR*) malloc(sizeof(struct DIR));
if (dirp) {
wchar_t wname[PATH_MAX];
size_t n;
/* Convert directory name to wide-character string */
error = dirent_mbstowcs_s(&n, wname, PATH_MAX, dirname, PATH_MAX);
if (!error) {
/* Open directory stream using wide-character name */
dirp->wdirp = _wopendir(wname);
if (dirp->wdirp) {
/* Directory stream opened */
error = 0;
} else {
/* Failed to open directory stream */
error = 1;
}
} else {
/*
* Cannot convert file name to wide-character string. This
* occurs if the string contains invalid multi-byte sequences or
* the output buffer is too small to contain the resulting
* string.
*/
error = 1;
}
} else {
/* Cannot allocate DIR structure */
error = 1;
}
/* Clean up in case of error */
if (error && dirp) {
free(dirp);
dirp = NULL;
}
return dirp;
}
/*
* Read next directory entry.
*
* When working with text consoles, please note that file names returned by
* readdir() are represented in the default ANSI code page while any output to
* console is typically formatted on another code page. Thus, non-ASCII
* characters in file names will not usually display correctly on console. The
* problem can be fixed in two ways:(1) change the character set of console
* to 1252 using chcp utility and use Lucida Console font, or(2) use
* _cprintf function when writing to console. The _cprinf() will re-encode
* ANSI strings to the console code page so many non-ASCII characters will
* display correcly.
*/
static struct dirent*
readdir(DIR *dirp)
{
WIN32_FIND_DATAW *datap;
struct dirent *entp;
/* Read next directory entry */
datap = dirent_next(dirp->wdirp);
if (datap) {
size_t n;
int error;
/* Attempt to convert file name to multi-byte string */
error = dirent_wcstombs_s(
&n, dirp->ent.d_name, PATH_MAX, datap->cFileName, PATH_MAX);
/*
* If the file name cannot be represented by a multi-byte string,
* then attempt to use old 8+3 file name. This allows traditional
* Unix-code to access some file names despite of unicode
* characters, although file names may seem unfamiliar to the user.
*
* Be ware that the code below cannot come up with a short file
* name unless the file system provides one. At least
* VirtualBox shared folders fail to do this.
*/
if (error && datap->cAlternateFileName[0] != '\0') {
error = dirent_wcstombs_s(
&n, dirp->ent.d_name, PATH_MAX,
datap->cAlternateFileName, PATH_MAX);
}
if (!error) {
DWORD attr;
/* Initialize directory entry for return */
entp = &dirp->ent;
/* Length of file name excluding zero terminator */
entp->d_namlen = n - 1;
/* File attributes */
attr = datap->dwFileAttributes;
if ((attr & FILE_ATTRIBUTE_DEVICE) != 0) {
entp->d_type = DT_CHR;
} else if ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0) {
entp->d_type = DT_DIR;
} else {
entp->d_type = DT_REG;
}
/* Reset dummy fields */
entp->d_ino = 0;
entp->d_reclen = sizeof(struct dirent);
} else {
/*
* Cannot convert file name to multi-byte string so construct
* an errornous directory entry and return that. Note that
* we cannot return NULL as that would stop the processing
* of directory entries completely.
*/
entp = &dirp->ent;
entp->d_name[0] = '?';
entp->d_name[1] = '\0';
entp->d_namlen = 1;
entp->d_type = DT_UNKNOWN;
entp->d_ino = 0;
entp->d_reclen = 0;
}
} else {
/* No more directory entries */
entp = NULL;
}
return entp;
}
/*
* Close directory stream.
*/
static int
closedir(DIR *dirp)
{
int ok;
if (dirp) {
/* Close wide-character directory stream */
ok = _wclosedir(dirp->wdirp);
dirp->wdirp = NULL;
/* Release multi-byte character version */
free(dirp);
} else {
/* Invalid directory stream */
_set_errno(EBADF);
ok = /*failure*/-1;
}
return ok;
}
/*
* Rewind directory stream to beginning.
*/
static void
rewinddir(DIR* dirp)
{
/* Rewind wide-character string directory stream */
_wrewinddir(dirp->wdirp);
}
/* Convert multi-byte string to wide character string */
static int
dirent_mbstowcs_s(size_t *pReturnValue, wchar_t *wcstr,
size_t sizeInWords, const char *mbstr, size_t count)
{
return mbstowcs_s(pReturnValue, wcstr, sizeInWords, mbstr, count);
}
/* Convert wide-character string to multi-byte string */
static int
dirent_wcstombs_s(size_t *pReturnValue, char *mbstr,
size_t sizeInBytes, /* max size of mbstr */
const wchar_t *wcstr, size_t count)
{
return wcstombs_s(pReturnValue, mbstr, sizeInBytes, wcstr, count);
}
#endif /*DIRENT_H*/

79
include/compat/err.h Normal file
View File

@@ -0,0 +1,79 @@
/*
* Public domain
* err.h compatibility shim
*/
#ifdef HAVE_ERR_H
#include_next <err.h>
#else
#ifndef LIBCRYPTOCOMPAT_ERR_H
#define LIBCRYPTOCOMPAT_ERR_H
#include <errno.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
static inline void
err(int eval, const char *fmt, ...)
{
int sverrno = errno;
va_list ap;
va_start(ap, fmt);
if (fmt != NULL) {
vfprintf(stderr, fmt, ap);
fprintf(stderr, ": ");
}
fprintf(stderr, "%s\n", strerror(sverrno));
exit(eval);
va_end(ap);
}
static inline void
errx(int eval, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
if (fmt != NULL)
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
exit(eval);
va_end(ap);
}
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, ": ");
}
fprintf(stderr, "%s\n", strerror(sverrno));
va_end(ap);
}
static inline void
warnx(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
if (fmt != NULL)
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
va_end(ap);
}
#endif
#endif

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

@@ -0,0 +1,17 @@
/*
* Public domain
* limits.h compatibility shim
*/
#ifdef _MSC_VER
#include <../include/limits.h>
#else
#include_next <limits.h>
#endif
#ifdef __hpux
#include <sys/param.h>
#ifndef PATH_MAX
#define PATH_MAX MAXPATHLEN
#endif
#endif

View File

@@ -1,7 +1,12 @@
/*
* Public domain
* machine/endian.h compatibility shim
*/
#ifndef LIBCRYPTOCOMPAT_BYTE_ORDER_H_
#define LIBCRYPTOCOMPAT_BYTE_ORDER_H_
#if defined(__WIN32)
#if defined(_WIN32)
#define LITTLE_ENDIAN 1234
#define BIG_ENDIAN 4321

10
include/compat/netdb.h Normal file
View File

@@ -0,0 +1,10 @@
/*
* Public domain
* netdb.h compatibility shim
*/
#ifndef _WIN32
#include_next <netdb.h>
#else
#include <win32netcompat.h>
#endif

View File

@@ -0,0 +1,10 @@
/*
* Public domain
* netinet/in.h compatibility shim
*/
#ifndef _WIN32
#include_next <netinet/in.h>
#else
#include <win32netcompat.h>
#endif

View File

@@ -0,0 +1,43 @@
/*
* Public domain
* netinet/ip.h compatibility shim
*/
#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,10 @@
/*
* Public domain
* netinet/tcp.h compatibility shim
*/
#ifndef _WIN32
#include_next <netinet/tcp.h>
#else
#include <win32netcompat.h>
#endif

63
include/compat/poll.h Normal file
View File

@@ -0,0 +1,63 @@
/*
* Public domain
*
* poll(2) emulation for Windows
*
* This emulates just-enough poll functionality on Windows to work in the
* context of the openssl(1) program. This is not a replacement for
* POSIX.1-2001 poll(2).
*
* Dongsheng Song <dongsheng.song@gmail.com>
* Brent Cook <bcook@openbsd.org>
*/
#ifndef LIBCRYPTOCOMPAT_POLL_H
#define LIBCRYPTOCOMPAT_POLL_H
#ifndef _WIN32
#include_next <poll.h>
#else
#include <winsock2.h>
/* Type used for the number of file descriptors. */
typedef unsigned long int nfds_t;
#if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0600)
/* Data structure describing a polling request. */
struct pollfd {
int fd; /* file descriptor */
short events; /* requested events */
short revents; /* returned events */
};
/* Event types that can be polled */
#define POLLIN 0x001 /* There is data to read. */
#define POLLPRI 0x002 /* There is urgent data to read. */
#define POLLOUT 0x004 /* Writing now will not block. */
# define POLLRDNORM 0x040 /* Normal data may be read. */
# define POLLRDBAND 0x080 /* Priority data may be read. */
# define POLLWRNORM 0x100 /* Writing now will not block. */
# define POLLWRBAND 0x200 /* Priority data may be written. */
/* Event types always implicitly polled. */
#define POLLERR 0x008 /* Error condition. */
#define POLLHUP 0x010 /* Hung up. */
#define POLLNVAL 0x020 /* Invalid polling request. */
#endif
#ifdef __cplusplus
extern "C" {
#endif
int poll(struct pollfd *pfds, nfds_t nfds, int timeout);
#ifdef __cplusplus
}
#endif
#endif /* HAVE_POLL */
#endif /* LIBCRYPTOCOMPAT_POLL_H */

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

47
include/compat/stdio.h Normal file
View File

@@ -0,0 +1,47 @@
/*
* Public domain
* stdio.h compatibility shim
*/
#ifndef LIBCRYPTOCOMPAT_STDIO_H
#define LIBCRYPTOCOMPAT_STDIO_H
#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>
#endif
#else
#include_next <stdio.h>
#endif
#ifndef HAVE_ASPRINTF
#include <stdarg.h>
int vasprintf(char **str, const char *fmt, va_list ap);
int asprintf(char **str, const char *fmt, ...);
#endif
#ifdef _WIN32
void posix_perror(const char *s);
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);
#ifndef NO_REDEF_POSIX_FUNCTIONS
#define perror(errnum) posix_perror(errnum)
#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)
#endif
#ifdef _MSC_VER
#define snprintf _snprintf
#endif
#endif
#endif

View File

@@ -1,22 +1,35 @@
/*
* stdlib.h compatibility shim
* Public domain
*/
#ifdef _MSC_VER
#if _MSC_VER >= 1900
#include <../ucrt/stdlib.h>
#else
#include <../include/stdlib.h>
#endif
#else
#include_next <stdlib.h>
#endif
#ifndef LIBCRYPTOCOMPAT_STDLIB_H
#define LIBCRYPTOCOMPAT_STDLIB_H
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <stdint.h>
#ifdef NO_ARC4RANDOM_BUF
#ifndef HAVE_ARC4RANDOM_BUF
uint32_t arc4random(void);
void arc4random_buf(void *_buf, size_t n);
uint32_t arc4random_uniform(uint32_t upper_bound);
#endif
#ifdef NO_REALLOCARRAY
#ifndef HAVE_REALLOCARRAY
void *reallocarray(void *, size_t, size_t);
#endif
#ifdef NO_STRTONUM
#ifndef HAVE_STRTONUM
long long strtonum(const char *nptr, long long minval,
long long maxval, const char **errstr);
#endif

87
include/compat/string.h Normal file
View File

@@ -0,0 +1,87 @@
/*
* Public domain
* string.h compatibility shim
*/
#ifndef LIBCRYPTOCOMPAT_STRING_H
#define LIBCRYPTOCOMPAT_STRING_H
#ifdef _MSC_VER
#if _MSC_VER >= 1900
#include <../ucrt/string.h>
#else
#include <../include/string.h>
#endif
#else
#include_next <string.h>
#endif
#include <sys/types.h>
#if defined(__sun) || defined(_AIX) || defined(__hpux)
/* 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 AIX,
* Solaris, and HPUX.
*/
#include <strings.h>
#endif
#ifndef HAVE_STRCASECMP
int strcasecmp(const char *s1, const char *s2);
int strncasecmp(const char *s1, const char *s2, size_t len);
#endif
#ifndef HAVE_STRLCPY
size_t strlcpy(char *dst, const char *src, size_t siz);
#endif
#ifndef HAVE_STRLCAT
size_t strlcat(char *dst, const char *src, size_t siz);
#endif
#ifndef HAVE_STRNDUP
char * strndup(const char *str, size_t maxlen);
/* the only user of strnlen is strndup, so only build it if needed */
#ifndef HAVE_STRNLEN
size_t strnlen(const char *str, size_t maxlen);
#endif
#endif
#ifndef HAVE_STRSEP
char *strsep(char **stringp, const char *delim);
#endif
#ifndef HAVE_EXPLICIT_BZERO
void explicit_bzero(void *, size_t);
#endif
#ifndef HAVE_TIMINGSAFE_BCMP
int timingsafe_bcmp(const void *b1, const void *b2, size_t n);
#endif
#ifndef HAVE_TIMINGSAFE_MEMCMP
int timingsafe_memcmp(const void *b1, const void *b2, size_t len);
#endif
#ifndef HAVE_MEMMEM
void * memmem(const void *big, size_t big_len, const void *little,
size_t little_len);
#endif
#ifdef _WIN32
#include <errno.h>
static inline char *
posix_strerror(int errnum)
{
if (errnum == ECONNREFUSED) {
return "Connection refused";
}
return strerror(errnum);
}
#define strerror(errnum) posix_strerror(errnum)
#endif
#endif

View File

@@ -0,0 +1,31 @@
/*
* 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

@@ -0,0 +1,11 @@
/*
* Public domain
* sys/ioctl.h compatibility shim
*/
#ifndef _WIN32
#include_next <sys/ioctl.h>
#else
#include <win32netcompat.h>
#define ioctl(fd, type, arg) ioctlsocket(fd, type, arg)
#endif

View File

@@ -1,3 +1,8 @@
/*
* Public domain
* sys/mman.h compatibility shim
*/
#include_next <sys/mman.h>
#ifndef LIBCRYPTOCOMPAT_MMAN_H

View File

@@ -0,0 +1,15 @@
/*
* Public domain
* sys/param.h compatibility shim
*/
#ifndef LIBCRYPTOCOMPAT_SYS_PARAM_H
#define LIBCRYPTOCOMPAT_SYS_PARAM_H
#ifdef _MSC_VER
#include <winsock2.h>
#else
#include_next <sys/param.h>
#endif
#endif

View File

@@ -0,0 +1,10 @@
/*
* Public domain
* sys/select.h compatibility shim
*/
#ifndef _WIN32
#include_next <sys/select.h>
#else
#include <win32netcompat.h>
#endif

View File

@@ -0,0 +1,10 @@
/*
* Public domain
* sys/socket.h compatibility shim
*/
#ifndef _WIN32
#include_next <sys/socket.h>
#else
#include <win32netcompat.h>
#endif

100
include/compat/sys/stat.h Normal file
View File

@@ -0,0 +1,100 @@
/*
* Public domain
* sys/stat.h compatibility shim
*/
#ifndef LIBCRYPTOCOMPAT_SYS_STAT_H
#define LIBCRYPTOCOMPAT_SYS_STAT_H
#ifndef _MSC_VER
#include_next <sys/stat.h>
#else
#include <windows.h>
#if _MSC_VER >= 1900
#include <../ucrt/sys/stat.h>
#else
#include <../include/sys/stat.h>
#endif
/* File type and permission flags for stat() */
#if !defined(S_IFMT)
# define S_IFMT _S_IFMT /* File type mask */
#endif
#if !defined(S_IFDIR)
# define S_IFDIR _S_IFDIR /* Directory */
#endif
#if !defined(S_IFCHR)
# define S_IFCHR _S_IFCHR /* Character device */
#endif
#if !defined(S_IFFIFO)
# define S_IFFIFO _S_IFFIFO /* Pipe */
#endif
#if !defined(S_IFREG)
# define S_IFREG _S_IFREG /* Regular file */
#endif
#if !defined(S_IREAD)
# define S_IREAD _S_IREAD /* Read permission */
#endif
#if !defined(S_IWRITE)
# define S_IWRITE _S_IWRITE /* Write permission */
#endif
#if !defined(S_IEXEC)
# define S_IEXEC _S_IEXEC /* Execute permission */
#endif
#if !defined(S_IFIFO)
# define S_IFIFO _S_IFIFO /* Pipe */
#endif
#if !defined(S_IFBLK)
# define S_IFBLK 0 /* Block device */
#endif
#if !defined(S_IFLNK)
# define S_IFLNK 0 /* Link */
#endif
#if !defined(S_IFSOCK)
# define S_IFSOCK 0 /* Socket */
#endif
#if defined(_MSC_VER)
# define S_IRUSR S_IREAD /* Read user */
# define S_IWUSR S_IWRITE /* Write user */
# define S_IXUSR 0 /* Execute user */
# define S_IRGRP 0 /* Read group */
# define S_IWGRP 0 /* Write group */
# define S_IXGRP 0 /* Execute group */
# define S_IROTH 0 /* Read others */
# define S_IWOTH 0 /* Write others */
# define S_IXOTH 0 /* Execute others */
#endif
/* File type flags for d_type */
#define DT_UNKNOWN 0
#define DT_REG S_IFREG
#define DT_DIR S_IFDIR
#define DT_FIFO S_IFIFO
#define DT_SOCK S_IFSOCK
#define DT_CHR S_IFCHR
#define DT_BLK S_IFBLK
#define DT_LNK S_IFLNK
/* Macros for converting between st_mode and d_type */
#define IFTODT(mode) ((mode) & S_IFMT)
#define DTTOIF(type) (type)
/*
* File type macros. Note that block devices, sockets and links cannot be
* distinguished on Windows and the macros S_ISBLK, S_ISSOCK and S_ISLNK are
* only defined for compatibility. These macros should always return false
* on Windows.
*/
#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
#define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)
#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
#define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR)
#define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
#endif
#endif

16
include/compat/sys/time.h Normal file
View File

@@ -0,0 +1,16 @@
/*
* Public domain
* sys/time.h compatibility shim
*/
#ifndef LIBCRYPTOCOMPAT_SYS_TIME_H
#define LIBCRYPTOCOMPAT_SYS_TIME_H
#ifdef _MSC_VER
#include <winsock2.h>
int gettimeofday(struct timeval *tp, void *tzp);
#else
#include_next <sys/time.h>
#endif
#endif

View File

@@ -0,0 +1,47 @@
/*
* Public domain
* sys/types.h compatibility shim
*/
#ifdef _MSC_VER
#if _MSC_VER >= 1900
#include <../ucrt/sys/types.h>
#else
#include <../include/sys/types.h>
#endif
#else
#include_next <sys/types.h>
#endif
#ifndef LIBCRYPTOCOMPAT_SYS_TYPES_H
#define LIBCRYPTOCOMPAT_SYS_TYPES_H
#include <stdint.h>
#ifdef __MINGW32__
#include <_bsd_types.h>
#endif
#ifdef _MSC_VER
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
#include <basetsd.h>
typedef SSIZE_T ssize_t;
#ifndef SSIZE_MAX
#ifdef _WIN64
#define SSIZE_MAX _I64_MAX
#else
#define SSIZE_MAX INT_MAX
#endif
#endif
#endif
#if !defined(HAVE_ATTRIBUTE__BOUNDED__) && !defined(__bounded__)
# define __bounded__(x, y, z)
#endif
#endif

17
include/compat/sys/uio.h Normal file
View File

@@ -0,0 +1,17 @@
/*
* Public domain
* sys/select.h compatibility shim
*/
#ifndef _WIN32
#include_next <sys/uio.h>
#else
#include <sys/types.h>
struct iovec {
void *iov_base;
size_t iov_len;
};
#endif

23
include/compat/time.h Normal file
View File

@@ -0,0 +1,23 @@
/*
* Public domain
* sys/time.h compatibility shim
*/
#ifdef _MSC_VER
#if _MSC_VER >= 1900
#include <../ucrt/time.h>
#else
#include <../include/time.h>
#endif
#else
#include_next <time.h>
#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

41
include/compat/unistd.h Normal file
View File

@@ -0,0 +1,41 @@
/*
* Public domain
* unistd.h compatibility shim
*/
#ifndef LIBCRYPTOCOMPAT_UNISTD_H
#define LIBCRYPTOCOMPAT_UNISTD_H
#ifndef _MSC_VER
#include_next <unistd.h>
#else
#include <stdlib.h>
#include <io.h>
#include <process.h>
#define R_OK 4
#define W_OK 2
#define X_OK 0
#define F_OK 0
#define access _access
unsigned int sleep(unsigned int seconds);
#endif
#ifndef HAVE_GETENTROPY
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
#define pledge(request, paths) 0
#endif

View File

@@ -0,0 +1,53 @@
/*
* Public domain
*
* BSD socket emulation code for Winsock2
* Brent Cook <bcook@openbsd.org>
*/
#ifndef LIBCRYPTOCOMPAT_WIN32NETCOMPAT_H
#define LIBCRYPTOCOMPAT_WIN32NETCOMPAT_H
#ifdef _WIN32
#include <ws2tcpip.h>
#include <errno.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_close(int fd);
ssize_t posix_read(int fd, void *buf, size_t count);
ssize_t posix_write(int fd, const void *buf, size_t count);
int posix_getsockopt(int sockfd, int level, int optname,
void *optval, socklen_t *optlen);
int posix_setsockopt(int sockfd, int level, int optname,
const void *optval, socklen_t optlen);
#ifndef NO_REDEF_POSIX_FUNCTIONS
#define connect(sockfd, addr, addrlen) posix_connect(sockfd, addr, addrlen)
#define close(fd) posix_close(fd)
#define read(fd, buf, count) posix_read(fd, buf, count)
#define write(fd, buf, count) posix_write(fd, buf, count)
#define getsockopt(sockfd, level, optname, optval, optlen) \
posix_getsockopt(sockfd, level, optname, optval, optlen)
#define setsockopt(sockfd, level, optname, optval, optlen) \
posix_setsockopt(sockfd, level, optname, optval, optlen)
#endif
#endif
#endif

View File

@@ -1,28 +0,0 @@
#ifdef HAVE_ERR_H
#include_next <err.h>
#else
#ifndef LIBCRYPTOCOMPAT_ERR_H
#define LIBCRYPTOCOMPAT_ERR_H
#include <errno.h>
#include <stdio.h>
#include <string.h>
#define err(exitcode, format, args...) \
errx(exitcode, format ": %s", ## args, strerror(errno))
#define errx(exitcode, format, args...) \
do { warnx(format, ## args); exit(exitcode); } while (0)
#define warn(format, args...) \
warnx(format ": %s", ## args, strerror(errno))
#define warnx(format, args...) \
fprintf(stderr, format "\n", ## args)
#endif
#endif

View File

@@ -1,11 +0,0 @@
#include_next <stdio.h>
#ifndef LIBCRYPTOCOMPAT_STDIO_H
#define LIBCRYPTOCOMPAT_STDIO_H
#ifdef NO_ASPRINTF
int vasprintf(char **str, const char *fmt, va_list ap);
int asprintf(char **str, const char *fmt, ...);
#endif
#endif

View File

@@ -1,45 +0,0 @@
#include_next <string.h>
#ifndef LIBCRYPTOCOMPAT_STRING_H
#define LIBCRYPTOCOMPAT_STRING_H
#include <sys/types.h>
#ifdef __sun
/* 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.
*/
#include <strings.h>
#endif
#ifdef NO_STRLCPY
size_t strlcpy(char *dst, const char *src, size_t siz);
#endif
#ifdef NO_STRLCAT
size_t strlcat(char *dst, const char *src, size_t siz);
#endif
#ifdef NO_STRNDUP
char * strndup(const char *str, size_t maxlen);
size_t strnlen(const char *str, size_t maxlen);
#endif
#ifdef NO_EXPLICIT_BZERO
void explicit_bzero(void *, size_t);
#endif
#ifdef NO_TIMINGSAFE_BCMP
int timingsafe_bcmp(const void *b1, const void *b2, size_t n);
#endif
#ifdef NO_TIMINGSAFE_MEMCMP
int timingsafe_memcmp(const void *b1, const void *b2, size_t len);
#endif
#ifdef NO_MEMMEM
void * memmem(const void *big, size_t big_len, const void *little,
size_t little_len);
#endif
#endif

View File

@@ -1,16 +0,0 @@
#include_next <sys/types.h>
#ifndef LIBCRYPTOCOMPAT_SYS_TYPES_H
#define LIBCRYPTOCOMPAT_SYS_TYPES_H
#include <stdint.h>
#ifdef __MINGW32__
#include <_bsd_types.h>
#endif
#if !defined(HAVE_ATTRIBUTE__BOUNDED__) && !defined(__bounded__)
# define __bounded__(x, y, z)
#endif
#endif

View File

@@ -1,14 +0,0 @@
#include_next <unistd.h>
#ifndef LIBCRYPTOCOMPAT_UNISTD_H
#define LIBCRYPTOCOMPAT_UNISTD_H
#ifdef NO_GETENTROPY
int getentropy(void *buf, size_t buflen);
#endif
#ifdef NO_ISSETUGID
int issetugid(void);
#endif
#endif

13
libtls-standalone/COPYING Normal file
View File

@@ -0,0 +1,13 @@
libtls is ISC licensed as per OpenBSD's normal licensing policy.
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.

View File

@@ -0,0 +1,7 @@
SUBDIRS = include compat src tests man
ACLOCAL_AMFLAGS = -I m4
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libtls.pc
EXTRA_DIST = README VERSION

0
libtls-standalone/NEWS Normal file
View File

0
libtls-standalone/README Normal file
View File

View File

@@ -0,0 +1,45 @@
#
# Copyright (c) 2014-2015 Brent Cook
#
# 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.
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src
noinst_LTLIBRARIES = libcompat.la libcompatnoopt.la
# compatibility functions that need to be built without optimizations
libcompatnoopt_la_CFLAGS = -O0
libcompatnoopt_la_SOURCES =
if !HAVE_EXPLICIT_BZERO
libcompatnoopt_la_SOURCES += explicit_bzero.c
endif
# other compatibility functions
libcompat_la_CFLAGS = $(CFLAGS) $(USER_CFLAGS)
libcompat_la_SOURCES =
libcompat_la_LIBADD = $(PLATFORM_LDADD)
if !HAVE_ASPRINTF
libcompat_la_SOURCES += bsd-asprintf.c
endif
if !HAVE_STRLCPY
libcompat_la_SOURCES += strlcpy.c
endif
if !HAVE_STRSEP
libcompat_la_SOURCES += strsep.c
endif
include Makefile.am.arc4random

View File

@@ -0,0 +1,52 @@
# Copyright (c) 2014-2015 Brent Cook
#
# 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.
AC_INIT([libtls], m4_esyscmd([tr -d '\n' < VERSION]))
AC_SUBST([LIBTLS_VERSION], m4_esyscmd([sed -e 's/\./:/g' VERSION | tr -d '\n']))
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([subdir-objects])
AC_CONFIG_MACRO_DIR([m4])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
# This must be called before AC_PROG_CC
USER_CFLAGS="$CFLAGS"
AC_PROG_CC
AC_PROG_CC_STDC
AM_PROG_CC_C_O
AC_PROG_LIBTOOL
LT_INIT
CHECK_OS_OPTIONS
CHECK_C_HARDENING_OPTIONS
DISABLE_COMPILER_WARNINGS
CHECK_LIBC_COMPAT
CHECK_LIBC_CRYPTO_COMPAT
AC_CONFIG_FILES([
Makefile
include/Makefile
compat/Makefile
man/Makefile
src/Makefile
tests/Makefile
libtls.pc
])
AC_OUTPUT

View File

@@ -0,0 +1,5 @@
noinst_HEADERS = stdlib.h
noinst_HEADERS += string.h
noinst_HEADERS += unistd.h
include_HEADERS = tls.h

View File

@@ -0,0 +1,87 @@
/*
* Public domain
* string.h compatibility shim
*/
#ifndef LIBCRYPTOCOMPAT_STRING_H
#define LIBCRYPTOCOMPAT_STRING_H
#ifdef _MSC_VER
#if _MSC_VER >= 1900
#include <../ucrt/string.h>
#else
#include <../include/string.h>
#endif
#else
#include_next <string.h>
#endif
#include <sys/types.h>
#if defined(__sun) || defined(_AIX) || defined(__hpux)
/* 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 AIX,
* Solaris, and HPUX.
*/
#include <strings.h>
#endif
#ifndef HAVE_STRCASECMP
int strcasecmp(const char *s1, const char *s2);
int strncasecmp(const char *s1, const char *s2, size_t len);
#endif
#ifndef HAVE_STRLCPY
size_t strlcpy(char *dst, const char *src, size_t siz);
#endif
#ifndef HAVE_STRLCAT
size_t strlcat(char *dst, const char *src, size_t siz);
#endif
#ifndef HAVE_STRNDUP
char * strndup(const char *str, size_t maxlen);
/* the only user of strnlen is strndup, so only build it if needed */
#ifndef HAVE_STRNLEN
size_t strnlen(const char *str, size_t maxlen);
#endif
#endif
#ifndef HAVE_STRSEP
char *strsep(char **stringp, const char *delim);
#endif
#ifndef HAVE_EXPLICIT_BZERO
void explicit_bzero(void *, size_t);
#endif
#ifndef HAVE_TIMINGSAFE_BCMP
int timingsafe_bcmp(const void *b1, const void *b2, size_t n);
#endif
#ifndef HAVE_TIMINGSAFE_MEMCMP
int timingsafe_memcmp(const void *b1, const void *b2, size_t len);
#endif
#ifndef HAVE_MEMMEM
void * memmem(const void *big, size_t big_len, const void *little,
size_t little_len);
#endif
#ifdef _WIN32
#include <errno.h>
static inline char *
posix_strerror(int errnum)
{
if (errnum == ECONNREFUSED) {
return "Connection refused";
}
return strerror(errnum);
}
#define strerror(errnum) posix_strerror(errnum)
#endif
#endif

View File

@@ -0,0 +1,16 @@
#libtls pkg-config source file
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: LibreSSL-libtls
Description: Secure communications using the TLS socket protocol.
Version: @LIBTLS_VERSION@
Requires:
Requires.private: libcrypto libssl
Conflicts:
Libs: -L${libdir} -ltls
Libs.private: @LIBS@ -lcrypto -lssl
Cflags: -I${includedir}

View File

@@ -0,0 +1,16 @@
AM_CFLAGS = -I$(top_srcdir)/include
lib_LTLIBRARIES = libtls.la
libtls_la_LDFLAGS = -version-info @LIBTLS_VERSION@ -no-undefined
libtls_la_LIBADD = -lcrypto -lssl -lcrypto $(PLATFORM_LDADD)
libtls_la_LIBADD += $(top_builddir)/compat/libcompat.la
libtls_la_LIBADD += $(top_builddir)/compat/libcompatnoopt.la
libtls_la_SOURCES = tls.c
libtls_la_SOURCES += tls_client.c
libtls_la_SOURCES += tls_config.c
libtls_la_SOURCES += tls_server.c
libtls_la_SOURCES += tls_util.c
libtls_la_SOURCES += tls_verify.c
noinst_HEADERS = tls_internal.h

View File

@@ -0,0 +1,7 @@
AM_CFLAGS = -I$(top_srcdir)/include
check_PROGRAMS = test
TESTS = test
test_SOURCES = test.c
test_LDADD = -lcrypto -lssl $(top_builddir)/src/libtls.la

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