Compare commits
209 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3800681201 | ||
![]() |
730f199c9c | ||
![]() |
c4ee1a6fca | ||
![]() |
bd53433877 | ||
![]() |
7442568456 | ||
![]() |
ebeda8bad3 | ||
![]() |
b67802c2db | ||
![]() |
25d8a429c1 | ||
![]() |
926aa53242 | ||
![]() |
950dcb2d07 | ||
![]() |
f6582d1d76 | ||
![]() |
3a193a58d4 | ||
![]() |
94532f9619 | ||
![]() |
0ae23dfcc3 | ||
![]() |
bff756ef62 | ||
![]() |
5b39a35bf8 | ||
![]() |
41d8aa6aef | ||
![]() |
b8b8628640 | ||
![]() |
6cb804b342 | ||
![]() |
00eb776ee9 | ||
![]() |
534ee348a9 | ||
![]() |
ad914139c4 | ||
![]() |
6a136f72ff | ||
![]() |
3b3f213ca5 | ||
![]() |
4b5daaaf44 | ||
![]() |
1ffdb2ae25 | ||
![]() |
ef874034cf | ||
![]() |
05f3422a9b | ||
![]() |
be3b129221 | ||
![]() |
2c751b1cf9 | ||
![]() |
d4d040c171 | ||
![]() |
9df51efab0 | ||
![]() |
8c91563f60 | ||
![]() |
d0ff644edc | ||
![]() |
35e669fd1a | ||
![]() |
d0009039de | ||
![]() |
07e541cc2e | ||
![]() |
cf86bf8581 | ||
![]() |
38c577d758 | ||
![]() |
07056b2949 | ||
![]() |
f5a4ee56be | ||
![]() |
4a931b58fc | ||
![]() |
53cd105d6e | ||
![]() |
733d581028 | ||
![]() |
b95c92c62b | ||
![]() |
3af1387b18 | ||
![]() |
bd8fe5868f | ||
![]() |
5727d3274e | ||
![]() |
4db1ad6797 | ||
![]() |
28aaab4323 | ||
![]() |
19f58fdb1b | ||
![]() |
1988b8f65e | ||
![]() |
905e2a3b80 | ||
![]() |
5b49c30cbc | ||
![]() |
fabe122b4e | ||
![]() |
afcc027da7 | ||
![]() |
75ef5bb160 | ||
![]() |
d7317353a9 | ||
![]() |
585b57b202 | ||
![]() |
84f0a9dbda | ||
![]() |
7a82b7c0fd | ||
![]() |
7109fb3260 | ||
![]() |
9574b6c8ec | ||
![]() |
9c5105eeb1 | ||
![]() |
fbe05ec826 | ||
![]() |
d35e8bbeaf | ||
![]() |
1d5dfff695 | ||
![]() |
7180bed3bb | ||
![]() |
24b5a96a7c | ||
![]() |
c31b03c1d4 | ||
![]() |
9be9055791 | ||
![]() |
3f79a49dd2 | ||
![]() |
959241fe88 | ||
![]() |
2c168b7127 | ||
![]() |
b28e5bedab | ||
![]() |
0086809a82 | ||
![]() |
c8c23ad8e3 | ||
![]() |
0197a58969 | ||
![]() |
c8918dd0be | ||
![]() |
a45e38e962 | ||
![]() |
e8c9210073 | ||
![]() |
dadeeb0a2e | ||
![]() |
cac089b5d6 | ||
![]() |
c02436645d | ||
![]() |
ea4658b46a | ||
![]() |
4298ac9305 | ||
![]() |
1dd79f5d8f | ||
![]() |
448645d479 | ||
![]() |
9afc452761 | ||
![]() |
9dd9d1757e | ||
![]() |
ff52e6f4e3 | ||
![]() |
41cebd325f | ||
![]() |
442cc6f1b4 | ||
![]() |
a615d3c6d3 | ||
![]() |
047926e06f | ||
![]() |
a7f031ba55 | ||
![]() |
497a47c5fc | ||
![]() |
53f8663976 | ||
![]() |
9af6ff9a3a | ||
![]() |
09e535e41d | ||
![]() |
0fa826d34f | ||
![]() |
630e7b6040 | ||
![]() |
a2e532ed01 | ||
![]() |
4ce5342e86 | ||
![]() |
f05cb999a6 | ||
![]() |
9c55d0b851 | ||
![]() |
53eacb360e | ||
![]() |
9606a6b5e9 | ||
![]() |
3b82df010a | ||
![]() |
92a04bc1ea | ||
![]() |
3ac78a5573 | ||
![]() |
eae0e9d3a4 | ||
![]() |
eb604d1d54 | ||
![]() |
c7ae7c0c9d | ||
![]() |
2cb6d19e10 | ||
![]() |
eaa4c1cc8a | ||
![]() |
696ba18c6a | ||
![]() |
8c90be2a29 | ||
![]() |
627b0261a8 | ||
![]() |
eeb286af5a | ||
![]() |
cb397a8b28 | ||
![]() |
a896d400a0 | ||
![]() |
653bbfaabf | ||
![]() |
4bb70680a0 | ||
![]() |
02b7539cf5 | ||
![]() |
82e96d3565 | ||
![]() |
a787f964a1 | ||
![]() |
dcbaa6b699 | ||
![]() |
a64c42a09d | ||
![]() |
bcd3b2fde6 | ||
![]() |
854f4f69af | ||
![]() |
34bfb6ecb5 | ||
![]() |
c84250a4e4 | ||
![]() |
f1b00f4fb8 | ||
![]() |
c5eef7f11c | ||
![]() |
b89b470316 | ||
![]() |
105c86f3ed | ||
![]() |
6db3fc7c31 | ||
![]() |
2af9873259 | ||
![]() |
ef01eb71d1 | ||
![]() |
b5090c5853 | ||
![]() |
afd031f0ed | ||
![]() |
384e71614f | ||
![]() |
1ea6203cbf | ||
![]() |
b6aded059f | ||
![]() |
1c2a3f25e2 | ||
![]() |
e04dfb2b27 | ||
![]() |
46c9a8de8b | ||
![]() |
9e090286b5 | ||
![]() |
f6999fbe4b | ||
![]() |
c0341ad131 | ||
![]() |
2728a86590 | ||
![]() |
5de4c4f0eb | ||
![]() |
5dc6303714 | ||
![]() |
adfb2bf722 | ||
![]() |
5f4e95e7c1 | ||
![]() |
9903a26661 | ||
![]() |
ca56c332e3 | ||
![]() |
4078416c36 | ||
![]() |
122acbd659 | ||
![]() |
5ccdd1380b | ||
![]() |
3057de0d2b | ||
![]() |
afcfb2d504 | ||
![]() |
444749d1d5 | ||
![]() |
dbfba1154f | ||
![]() |
058df4a234 | ||
![]() |
4e2763575f | ||
![]() |
cc3c1810e2 | ||
![]() |
935d2744aa | ||
![]() |
3bdb537aae | ||
![]() |
61fe482d46 | ||
![]() |
5461dea7f1 | ||
![]() |
9aa4e1d960 | ||
![]() |
03ba7b70b9 | ||
![]() |
13d910c11e | ||
![]() |
3465c5105b | ||
![]() |
75b90b157c | ||
![]() |
c66d80a438 | ||
![]() |
058e3ebe77 | ||
![]() |
a6d5b32276 | ||
![]() |
6527c32039 | ||
![]() |
b521a76a46 | ||
![]() |
dd0704b176 | ||
![]() |
a9b16c2d66 | ||
![]() |
a9122f74e0 | ||
![]() |
3614acd62e | ||
![]() |
1828bcb9bf | ||
![]() |
9d5eb631e3 | ||
![]() |
63161e85dc | ||
![]() |
cbdc8ca820 | ||
![]() |
5d8a1cf715 | ||
![]() |
7a4a37cf59 | ||
![]() |
792a5acb67 | ||
![]() |
998cdebf36 | ||
![]() |
a1a0f2c6e2 | ||
![]() |
fafc3e47f2 | ||
![]() |
0bab46dde2 | ||
![]() |
b9291face3 | ||
![]() |
ddeb740426 | ||
![]() |
c1a162d83b | ||
![]() |
db974c34e9 | ||
![]() |
4cffda193b | ||
![]() |
c136688ad7 | ||
![]() |
e2903fcefc | ||
![]() |
f1f3147aff | ||
![]() |
bda20bd13f | ||
![]() |
1ff2f4bc7d | ||
![]() |
83d07710b5 | ||
![]() |
5d916a25d2 |
41
.gitignore
vendored
41
.gitignore
vendored
@@ -41,16 +41,22 @@ Makefile.in
|
|||||||
*.def
|
*.def
|
||||||
*.pc
|
*.pc
|
||||||
|
|
||||||
|
# man pages
|
||||||
|
*.1
|
||||||
|
*.3
|
||||||
|
|
||||||
# tests
|
# tests
|
||||||
test-driver
|
test-driver
|
||||||
*.log
|
*.log
|
||||||
*.trs
|
*.trs
|
||||||
tests/aes_wrap*
|
tests/aes_wrap*
|
||||||
tests/arc4random_fork*
|
tests/arc4random_fork*
|
||||||
|
tests/asn1time*
|
||||||
tests/cipher*
|
tests/cipher*
|
||||||
tests/explicit_bzero*
|
tests/explicit_bzero*
|
||||||
tests/gost2814789t*
|
tests/gost2814789t*
|
||||||
tests/mont*
|
tests/mont*
|
||||||
|
tests/rfc5280time*
|
||||||
tests/timingsafe*
|
tests/timingsafe*
|
||||||
tests/*test
|
tests/*test
|
||||||
tests/tests.h
|
tests/tests.h
|
||||||
@@ -61,6 +67,7 @@ tests/*.pem
|
|||||||
tests/testssl
|
tests/testssl
|
||||||
tests/*.txt
|
tests/*.txt
|
||||||
!tests/optionstest.c
|
!tests/optionstest.c
|
||||||
|
!tests/*.test
|
||||||
|
|
||||||
# ctags stuff
|
# ctags stuff
|
||||||
TAGS
|
TAGS
|
||||||
@@ -70,8 +77,8 @@ autom4te.cache
|
|||||||
# Libtool adds these, at least sometimes
|
# Libtool adds these, at least sometimes
|
||||||
INSTALL
|
INSTALL
|
||||||
/COPYING
|
/COPYING
|
||||||
m4/l*
|
|
||||||
!m4/check*.m4
|
!m4/check*.m4
|
||||||
|
m4/l*
|
||||||
|
|
||||||
aclocal.m4
|
aclocal.m4
|
||||||
compile
|
compile
|
||||||
@@ -93,9 +100,11 @@ stamp-h2
|
|||||||
|
|
||||||
include/openssl/Makefile.am
|
include/openssl/Makefile.am
|
||||||
|
|
||||||
|
VERSION
|
||||||
crypto/VERSION
|
crypto/VERSION
|
||||||
ssl/VERSION
|
ssl/VERSION
|
||||||
tls/VERSION
|
tls/VERSION
|
||||||
|
libtls-standalone/VERSION
|
||||||
|
|
||||||
ssl/*.c
|
ssl/*.c
|
||||||
ssl/*.h
|
ssl/*.h
|
||||||
@@ -104,32 +113,39 @@ tls/*.h
|
|||||||
include/pqueue.h
|
include/pqueue.h
|
||||||
include/tls.h
|
include/tls.h
|
||||||
include/openssl/*.h
|
include/openssl/*.h
|
||||||
include/openssl/*.he
|
|
||||||
|
|
||||||
/apps/*.h
|
/apps/nc/*.h
|
||||||
/apps/*.c
|
/apps/nc/*.c
|
||||||
/apps/openssl
|
/apps/nc/nc*
|
||||||
/apps/openssl.cnf
|
!/apps/nc/readpassphrase.c
|
||||||
!/apps/apps_win.c
|
/apps/openssl/*.h
|
||||||
!/apps/poll_win.c
|
/apps/openssl/*.c
|
||||||
!/apps/certhash_disabled.c
|
/apps/openssl/*.cnf
|
||||||
|
/apps/openssl/*.pem
|
||||||
|
/apps/openssl/openssl
|
||||||
|
/apps/openssl/compat/strtonum.c
|
||||||
|
!/apps/openssl/apps_win.c
|
||||||
|
!/apps/openssl/certhash_win.c
|
||||||
|
|
||||||
/crypto
|
|
||||||
!/crypto/Makefile.am.*
|
!/crypto/Makefile.am.*
|
||||||
!/crypto/compat/arc4random.h
|
!/crypto/compat/arc4random.h
|
||||||
!/crypto/compat/b_win.c
|
!/crypto/compat/b_win.c
|
||||||
|
!/crypto/compat/explicit_bzero_win.c
|
||||||
!/crypto/compat/posix_win.c
|
!/crypto/compat/posix_win.c
|
||||||
!/crypto/compat/bsd_asprintf.c
|
!/crypto/compat/bsd_asprintf.c
|
||||||
!/crypto/compat/inet_pton.c
|
!/crypto/compat/inet_pton.c
|
||||||
|
!/crypto/compat/timegm.c
|
||||||
!/crypto/compat/ui_openssl_win.c
|
!/crypto/compat/ui_openssl_win.c
|
||||||
|
!/crypto/CMakeLists.txt
|
||||||
|
/crypto
|
||||||
|
|
||||||
|
!/libtls-standalone/compat/Makefile.am
|
||||||
/libtls-standalone/include/*.h
|
/libtls-standalone/include/*.h
|
||||||
/libtls-standalone/src/*.c
|
/libtls-standalone/src/*.c
|
||||||
/libtls-standalone/src/*.h
|
/libtls-standalone/src/*.h
|
||||||
/libtls-standalone/src
|
/libtls-standalone/src
|
||||||
/libtls-standalone/tests/test
|
/libtls-standalone/tests/test
|
||||||
/libtls-standalone/compat
|
/libtls-standalone/compat
|
||||||
!/libtls-standalone/compat/Makefile.am
|
|
||||||
/libtls-standalone/VERSION
|
/libtls-standalone/VERSION
|
||||||
/libtls-standalone/m4
|
/libtls-standalone/m4
|
||||||
/libtls-standalone/man
|
/libtls-standalone/man
|
||||||
@@ -137,7 +153,4 @@ include/openssl/*.he
|
|||||||
openbsd/
|
openbsd/
|
||||||
|
|
||||||
*.tar.gz
|
*.tar.gz
|
||||||
apps/*.1*
|
|
||||||
man/*.3
|
|
||||||
man/*.1
|
|
||||||
man/Makefile.am
|
man/Makefile.am
|
||||||
|
187
CMakeLists.txt
Normal file
187
CMakeLists.txt
Normal 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(strlcpy 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 true)
|
||||||
|
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()
|
284
ChangeLog
284
ChangeLog
@@ -28,14 +28,292 @@ history is also available from Git.
|
|||||||
|
|
||||||
LibreSSL Portable Release Notes:
|
LibreSSL Portable Release Notes:
|
||||||
|
|
||||||
This release primarily addresses a number of security issues in coordination
|
2.3.10 - Security and compatibility fixes
|
||||||
with the OpenSSL project.
|
|
||||||
|
* Avoid a side-channel cache-timing attack that can leak the ECDSA
|
||||||
|
private keys when signing. This is due to BN_mod_inverse() being
|
||||||
|
used without the constant time flag being set.
|
||||||
|
|
||||||
|
This issue was reported by Cesar Pereida Garcia and Billy Brumley
|
||||||
|
(Tampere University of Technology). The fix was developed by Cesar
|
||||||
|
Pereida Garcia.
|
||||||
|
|
||||||
|
* iOS and MacOS compatibility updates from Simone Basso and Jacob
|
||||||
|
Berkman.
|
||||||
|
|
||||||
|
2.3.9 - Reliability improvements
|
||||||
|
|
||||||
|
* Avoid continual processing of an unlimited number of TLS records,
|
||||||
|
which can cause a denial-of-service condition.
|
||||||
|
|
||||||
|
2.3.8 - Security and reliability fixes
|
||||||
|
|
||||||
|
* Avoid unbounded memory growth in libssl, which can be triggered by a
|
||||||
|
TLS client repeatedly renegotiating and sending OCSP Status Request
|
||||||
|
TLS extensions.
|
||||||
|
|
||||||
|
* Avoid falling back to a weak digest for (EC)DH when using SNI with
|
||||||
|
libssl.
|
||||||
|
|
||||||
|
2.3.7 - OCSP fixes
|
||||||
|
|
||||||
|
* Fix several issues in the OCSP code that could result in the
|
||||||
|
incorrect generation and parsing of OCSP requests. This remediates a
|
||||||
|
lack of error checking on time parsing in these functions, and
|
||||||
|
ensures that only GENERALIZEDTIME formats are accepted for OCSP, as
|
||||||
|
per RFC 6960.
|
||||||
|
|
||||||
|
Issues reported, and fixes provided by Kazuki Yamaguchi <k@rhe.jp>
|
||||||
|
and Kinichiro Inoguchi <kinichiro.inoguchi@gmail.com>
|
||||||
|
|
||||||
|
2.3.6 - Security fix
|
||||||
|
|
||||||
|
* Correct a problem that prevents the DSA signing algorithm from
|
||||||
|
running in constant time even if the flag BN_FLG_CONSTTIME is set.
|
||||||
|
This issue was reported by Cesar Pereida (Aalto University), Billy
|
||||||
|
Brumley (Tampere University of Technology), and Yuval Yarom (The
|
||||||
|
University of Adelaide and NICTA). The fix was developed by Cesar
|
||||||
|
Pereida. See OpenBSD 5.9 errata 11, June 6, 2016
|
||||||
|
|
||||||
|
2.3.5 - Reliability fix
|
||||||
|
|
||||||
|
* Fixed an error in libcrypto when parsing some ASN.1 elements > 16k.
|
||||||
|
|
||||||
|
2.3.4 - Security Update
|
||||||
|
|
||||||
|
* Fix multiple vulnerabilities in libcrypto relating to ASN.1 and encoding.
|
||||||
|
From OpenSSL.
|
||||||
|
|
||||||
|
* Minor build fixes
|
||||||
|
|
||||||
|
2.3.3 - OpenBSD 5.9 release branch tagged
|
||||||
|
|
||||||
|
* Reworked build scripts to better sync with OpenNTPD-portable
|
||||||
|
|
||||||
|
* Fixed broken manpage links
|
||||||
|
|
||||||
|
* Fixed an nginx compatibility issue by adding an 'install_sw' make alias
|
||||||
|
|
||||||
|
* Fixed HP-UX builds
|
||||||
|
|
||||||
|
* Changed the default configuration directory to c:\LibreSSL\ssl on Windows
|
||||||
|
binary builds
|
||||||
|
|
||||||
|
* cert.pem has been reorganized and synced with Mozilla's certificate store
|
||||||
|
|
||||||
|
2.3.2 - Compatibility and Reliability fixes
|
||||||
|
|
||||||
|
* Changed format of LIBRESSL_VERSION_NUMBER to match that of
|
||||||
|
OPENSSL_VERSION_NUMBER, see:
|
||||||
|
https://wiki.openssl.org/index.php/Manual:OPENSSL_VERSION_NUMBER(3)
|
||||||
|
|
||||||
|
* Added EVP_aead_chacha20_poly1305_ietf() which matches the AEAD
|
||||||
|
construction introduced in RFC 7539, which is different than that
|
||||||
|
already used in TLS with EVP_aead_chacha20_poly1305()
|
||||||
|
|
||||||
|
* Avoid a potential undefined C99+ behavior due to shift overflow in
|
||||||
|
AES_decrypt, reported by Pascal Cuoq <cuoq at trust-in-soft.com>
|
||||||
|
|
||||||
|
* More man pages converted from pod to mdoc format
|
||||||
|
|
||||||
|
* Added COMODO RSA Certification Authority and QuoVadis
|
||||||
|
root certificates to cert.pem
|
||||||
|
|
||||||
|
* Removed Remove "C=US, O=VeriSign, Inc., OU=Class 3 Public Primary Certification
|
||||||
|
Authority" (serial 3c:91:31:cb:1f:f6:d0:1b:0e:9a:b8:d0:44:bf:12:be) root
|
||||||
|
certificate from cert.pem
|
||||||
|
|
||||||
|
* Added support for building nc(1) on Solaris
|
||||||
|
|
||||||
|
* Fixed GCC 5.x+ preprocessor checks, reported by Ruslan Babayev
|
||||||
|
|
||||||
|
* Improved console handling with openssl(1) on Windows
|
||||||
|
|
||||||
|
* Ensure the network stack is enabled on Windows when running
|
||||||
|
tls_init()
|
||||||
|
|
||||||
|
* Fixed incorrect TLS certificate loading by nc(1)
|
||||||
|
|
||||||
|
* Added support for Solaris 11.3's getentropy(2) system call
|
||||||
|
|
||||||
|
* Enabled support for using NetBSD 7.0's arc4random(3) implementation
|
||||||
|
|
||||||
|
* Deprecated the SSL_OP_SINGLE_DH_USE flag by disabling its effect
|
||||||
|
|
||||||
|
* Fixes from OpenSSL 1.0.1q
|
||||||
|
- CVE-2015-3194 - NULL pointer dereference in client side certificate
|
||||||
|
validation.
|
||||||
|
- CVE-2015-3195 - Memory leak in PKCS7 - not reachable from TLS/SSL
|
||||||
|
|
||||||
|
* The following OpenSSL CVEs did not apply to LibreSSL
|
||||||
|
- CVE-2015-3193 - Carry propagating bug in the x86_64 Montgomery
|
||||||
|
squaring procedure.
|
||||||
|
- CVE-2015-3196 - Double free race condition of the identify hint
|
||||||
|
data.
|
||||||
|
|
||||||
|
See https://marc.info/?l=openbsd-announce&m=144925068504102
|
||||||
|
|
||||||
|
2.3.1 - ASN.1 and time handling cleanups
|
||||||
|
|
||||||
|
* ASN.1 cleanups and RFC5280 compliance fixes.
|
||||||
|
|
||||||
|
* Time representations switched from 'unsigned long' to 'time_t'. LibreSSL
|
||||||
|
now checks if the host OS supports 64-bit time_t.
|
||||||
|
|
||||||
|
* Fixed a leak in SSL_new in the error path.
|
||||||
|
|
||||||
|
* Support always extracting the peer cipher and version with libtls.
|
||||||
|
|
||||||
|
* Added ability to check certificate validity times with libtls,
|
||||||
|
tls_peer_cert_notbefore and tls_peer_cert_notafter.
|
||||||
|
|
||||||
|
* Changed tls_connect_servername to use the first address that resolves with
|
||||||
|
getaddrinfo().
|
||||||
|
|
||||||
|
* Remove broken conditional EVP_CHECK_DES_KEY code (non-functional since
|
||||||
|
initial commit in 2004).
|
||||||
|
|
||||||
|
* Fixed a memory leak and out-of-bounds access in OBJ_obj2txt, reported
|
||||||
|
by Qualys Security.
|
||||||
|
|
||||||
|
* Fixed an up-to 7 byte overflow in RC4 when len is not a multiple of
|
||||||
|
sizeof(RC4_CHUNK), reported by Pascal Cuoq <cuoq at trust-in-soft.com>.
|
||||||
|
|
||||||
|
* Reject too small bits value in BN_generate_prime_ex(), so that it does
|
||||||
|
not risk becoming negative in probable_prime_dh_safe(), reported by
|
||||||
|
Franck Denis.
|
||||||
|
|
||||||
|
* Enable nc(1) builds on more platforms.
|
||||||
|
|
||||||
|
2.3.0 - SSLv3 removed, libtls API changes, portability improvements
|
||||||
|
|
||||||
|
* SSLv3 is now permanently removed from the tree.
|
||||||
|
|
||||||
|
* The libtls API is changed from the 2.2.x series.
|
||||||
|
|
||||||
|
The read/write functions work correctly with external event
|
||||||
|
libraries. See the tls_init man page for examples of using libtls
|
||||||
|
correctly in asynchronous mode.
|
||||||
|
|
||||||
|
Client-side verification is now supported, with the client supplying
|
||||||
|
the certificate to the server.
|
||||||
|
|
||||||
|
Also, when using tls_connect_fds, tls_connect_socket or
|
||||||
|
tls_accept_fds, libtls no longer implicitly closes the passed in
|
||||||
|
sockets. The caller is responsible for closing them in this case.
|
||||||
|
|
||||||
|
* When loading a DSA key from an raw (without DH parameters) ASN.1
|
||||||
|
serialization, perform some consistency checks on its `p' and `q'
|
||||||
|
values, and return an error if the checks failed.
|
||||||
|
|
||||||
|
Thanks for Georgi Guninski (guninski at guninski dot com) for
|
||||||
|
mentioning the possibility of a weak (non prime) q value and
|
||||||
|
providing a test case.
|
||||||
|
|
||||||
|
See
|
||||||
|
https://cpunks.org/pipermail/cypherpunks/2015-September/009007.html
|
||||||
|
for a longer discussion.
|
||||||
|
|
||||||
|
* Fixed a bug in ECDH_compute_key that can lead to silent truncation
|
||||||
|
of the result key without error. A coding error could cause software
|
||||||
|
to use much shorter keys than intended.
|
||||||
|
|
||||||
|
* Removed support for DTLS_BAD_VER. Pre-DTLSv1 implementations are no
|
||||||
|
longer supported.
|
||||||
|
|
||||||
|
* The engine command and parameters are removed from the openssl(1).
|
||||||
|
Previous releases removed dynamic and builtin engine support
|
||||||
|
already.
|
||||||
|
|
||||||
|
* SHA-0 is removed, which was withdrawn shortly after publication 20
|
||||||
|
years ago.
|
||||||
|
|
||||||
|
* Added Certplus CA root certificate to the default cert.pem file.
|
||||||
|
|
||||||
|
* New interface OPENSSL_cpu_caps is provided that does not allow
|
||||||
|
software to inadvertently modify cpu capability flags.
|
||||||
|
OPENSSL_ia32cap and OPENSSL_ia32cap_loc are removed.
|
||||||
|
|
||||||
|
* The out_len argument of AEAD changed from ssize_t to size_t.
|
||||||
|
|
||||||
|
* Deduplicated DTLS code, sharing bugfixes and improvements with
|
||||||
|
TLS.
|
||||||
|
|
||||||
|
* Converted 'nc' to use libtls for client and server operations; it is
|
||||||
|
included in the libressl-portable distribution as an example of how
|
||||||
|
to use the library.
|
||||||
|
|
||||||
|
2.2.3 - Bug fixes, build enhancements
|
||||||
|
|
||||||
|
* LibreSSL 2.2.2 incorrectly handles ClientHello messages that do not
|
||||||
|
include TLS extensions, resulting in such handshakes being aborted.
|
||||||
|
This release corrects the handling of such messages. Thanks to
|
||||||
|
Ligushka from github for reporting the issue.
|
||||||
|
|
||||||
|
* Added install target for cmake builds. Thanks to TheNietsnie from
|
||||||
|
github.
|
||||||
|
|
||||||
|
* Updated pkgconfig files to correctly report the release version
|
||||||
|
number, not the individual library ABI version numbers. Thanks to
|
||||||
|
Jan Engelhardt for reporting the issue.
|
||||||
|
|
||||||
|
2.2.2 - More TLS parser rework, bug fixes, expanded portable build support
|
||||||
|
|
||||||
|
* 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
|
2.2.1 - Build fixes, feature added, features removed
|
||||||
|
|
||||||
* Assorted build fixes for musl, HP-UX, Mingw, Solaris.
|
* Assorted build fixes for musl, HP-UX, Mingw, Solaris.
|
||||||
|
|
||||||
* Initial support for Windows 2009, 2003, XP
|
* Initial support for Windows Embedded 2009, Server 2003, XP
|
||||||
|
|
||||||
* Protocol parsing conversions to BoringSSL's CRYPTO ByteString (CBS) API
|
* Protocol parsing conversions to BoringSSL's CRYPTO ByteString (CBS) API
|
||||||
|
|
||||||
|
@@ -5,3 +5,7 @@ pkgconfigdir = $(libdir)/pkgconfig
|
|||||||
pkgconfig_DATA = libcrypto.pc libssl.pc libtls.pc openssl.pc
|
pkgconfig_DATA = libcrypto.pc libssl.pc libtls.pc openssl.pc
|
||||||
|
|
||||||
EXTRA_DIST = README.md README.windows VERSION config scripts
|
EXTRA_DIST = README.md README.windows VERSION config scripts
|
||||||
|
EXTRA_DIST += CMakeLists.txt
|
||||||
|
|
||||||
|
.PHONY: install_sw
|
||||||
|
install_sw: install
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
AM_CFLAGS = -I$(top_srcdir)/include
|
AM_CFLAGS =
|
||||||
AM_CPPFLAGS = -DLIBRESSL_INTERNAL
|
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/include/compat -DLIBRESSL_INTERNAL
|
||||||
|
@@ -1 +1 @@
|
|||||||
master
|
OPENBSD_5_9
|
||||||
|
47
README.md
47
README.md
@@ -1,6 +1,8 @@
|
|||||||

|

|
||||||
## Official portable version of [LibreSSL](http://www.libressl.org) ##
|
## Official portable version of [LibreSSL](http://www.libressl.org) ##
|
||||||
|
|
||||||
|
[](https://travis-ci.org/libressl-portable/portable)
|
||||||
|
|
||||||
LibreSSL is a fork of [OpenSSL](https://www.openssl.org) 1.0.1g developed by the
|
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,
|
[OpenBSD](http://www.openbsd.org) project. Our goal is to modernize the codebase,
|
||||||
improve security, and apply best practice development processes from OpenBSD.
|
improve security, and apply best practice development processes from OpenBSD.
|
||||||
@@ -11,7 +13,7 @@ LibreSSL is API compatible with OpenSSL 1.0.1, but does not yet include all
|
|||||||
new APIs from OpenSSL 1.0.2 and later. LibreSSL also includes APIs not yet
|
new APIs from OpenSSL 1.0.2 and later. LibreSSL also includes APIs not yet
|
||||||
present in OpenSSL. The current common API subset is OpenSSL 1.0.1.
|
present in OpenSSL. The current common API subset is OpenSSL 1.0.1.
|
||||||
|
|
||||||
LibreSSL it is not ABI compatible with any release of OpenSSL, or necessarily
|
LibreSSL is not ABI compatible with any release of OpenSSL, or necessarily
|
||||||
earlier releases of LibreSSL. You will need to relink your programs to
|
earlier releases of LibreSSL. You will need to relink your programs to
|
||||||
LibreSSL in order to use it, just as in moving between major versions of OpenSSL.
|
LibreSSL in order to use it, just as in moving between major versions of OpenSSL.
|
||||||
LibreSSL's installed library version numbers are incremented to account for
|
LibreSSL's installed library version numbers are incremented to account for
|
||||||
@@ -35,9 +37,9 @@ At the time of this writing, LibreSSL is know to build and work on:
|
|||||||
* AIX (5.3 and later)
|
* AIX (5.3 and later)
|
||||||
|
|
||||||
LibreSSL also supports the following Windows environments:
|
LibreSSL also supports the following Windows environments:
|
||||||
* Microsoft Windows (Vista or higher, x86 and x64)
|
* Microsoft Windows (XP or higher, x86 and x64)
|
||||||
* Wine (32-bit and 64-bit)
|
* Wine (32-bit and 64-bit)
|
||||||
* Builds with Mingw-w64 and Cygwin
|
* Builds with Mingw-w64, Cygwin, and Visual Studio
|
||||||
|
|
||||||
Official release tarballs are available at your friendly neighborhood
|
Official release tarballs are available at your friendly neighborhood
|
||||||
OpenBSD mirror in directory
|
OpenBSD mirror in directory
|
||||||
@@ -60,14 +62,14 @@ If you have checked this source using Git, follow these initial steps to
|
|||||||
prepare the source tree for building:
|
prepare the source tree for building:
|
||||||
|
|
||||||
1. Ensure you have the following packages installed:
|
1. Ensure you have the following packages installed:
|
||||||
automake, autoconf, bash, git, libtool, perl, pod2man
|
automake, autoconf, git, libtool, perl, pod2man
|
||||||
2. Run './autogen.sh' to prepare the source tree for building or
|
2. Run './autogen.sh' to prepare the source tree for building or
|
||||||
run './dist.sh' to prepare a tarball.
|
run './dist.sh' to prepare a tarball.
|
||||||
|
|
||||||
## Building LibreSSL ##
|
## Building LibreSSL ##
|
||||||
|
|
||||||
Once you have a source tree from Git or FTP, run these commands to build and
|
Once you have a source tree from Git or FTP, run these commands to build and
|
||||||
install the package on most systems.
|
install the package on most systems:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./configure # see ./configure --help for configuration options
|
./configure # see ./configure --help for configuration options
|
||||||
@@ -75,6 +77,26 @@ make check # runs builtin unit tests
|
|||||||
make install # set DESTDIR= to install to an alternate location
|
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: ###
|
### OS specific build information: ###
|
||||||
|
|
||||||
#### HP-UX (11i) ####
|
#### HP-UX (11i) ####
|
||||||
@@ -95,4 +117,17 @@ 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
|
confused with the original mingw.org project. Mingw-w64 3.2 or later
|
||||||
should work. See README.windows for more information
|
should work. See README.windows for more information
|
||||||
|
|
||||||
[](https://travis-ci.org/libressl-portable/portable)
|
#### 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.
|
||||||
|
@@ -6,9 +6,8 @@ GCC or Clang as the compiler. Contrary to its name, mingw-w64 supports both
|
|||||||
then LibreSSL should integrate very nicely. Old versions of the mingw-w64
|
then LibreSSL should integrate very nicely. Old versions of the mingw-w64
|
||||||
toolchain, such as the one packaged with Ubuntu 12.04, may have trouble
|
toolchain, such as the one packaged with Ubuntu 12.04, may have trouble
|
||||||
building LibreSSL. Please try it with a recent toolchain if you encounter
|
building LibreSSL. Please try it with a recent toolchain if you encounter
|
||||||
troubles. If you are building under Cygwin, only builds with the mingw-w64
|
troubles. Cygwin provides an easy method of installing the latest mingw-w64
|
||||||
compiler are supported, though you can easily use Cygwin to drive the build
|
cross compilers on Windows.
|
||||||
process.
|
|
||||||
|
|
||||||
To configure and build LibreSSL for a 32-bit system, use the following
|
To configure and build LibreSSL for a 32-bit system, use the following
|
||||||
build steps:
|
build steps:
|
||||||
@@ -40,3 +39,7 @@ 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%,
|
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
|
compatible with code built from Visual Studio. Notably, FILE * pointers cannot
|
||||||
be shared between code built for Mingw-w64 and Visual Studio.
|
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.
|
||||||
|
80
apps/CMakeLists.txt
Normal file
80
apps/CMakeLists.txt
Normal 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)
|
@@ -1,87 +1,5 @@
|
|||||||
include $(top_srcdir)/Makefile.am.common
|
include $(top_srcdir)/Makefile.am.common
|
||||||
|
|
||||||
bin_PROGRAMS = openssl
|
SUBDIRS = openssl nc
|
||||||
|
|
||||||
openssl_LDADD = $(PLATFORM_LDADD) $(PROG_LDADD)
|
EXTRA_DIST = CMakeLists.txt
|
||||||
openssl_LDADD += $(top_builddir)/ssl/libssl.la
|
|
||||||
openssl_LDADD += $(top_builddir)/crypto/libcrypto.la
|
|
||||||
|
|
||||||
openssl_SOURCES = apps.c
|
|
||||||
openssl_SOURCES += asn1pars.c
|
|
||||||
openssl_SOURCES += ca.c
|
|
||||||
openssl_SOURCES += ciphers.c
|
|
||||||
openssl_SOURCES += cms.c
|
|
||||||
openssl_SOURCES += crl.c
|
|
||||||
openssl_SOURCES += crl2p7.c
|
|
||||||
openssl_SOURCES += dgst.c
|
|
||||||
openssl_SOURCES += dh.c
|
|
||||||
openssl_SOURCES += dhparam.c
|
|
||||||
openssl_SOURCES += dsa.c
|
|
||||||
openssl_SOURCES += dsaparam.c
|
|
||||||
openssl_SOURCES += ec.c
|
|
||||||
openssl_SOURCES += ecparam.c
|
|
||||||
openssl_SOURCES += enc.c
|
|
||||||
openssl_SOURCES += engine.c
|
|
||||||
openssl_SOURCES += errstr.c
|
|
||||||
openssl_SOURCES += gendh.c
|
|
||||||
openssl_SOURCES += gendsa.c
|
|
||||||
openssl_SOURCES += genpkey.c
|
|
||||||
openssl_SOURCES += genrsa.c
|
|
||||||
openssl_SOURCES += nseq.c
|
|
||||||
openssl_SOURCES += ocsp.c
|
|
||||||
openssl_SOURCES += openssl.c
|
|
||||||
openssl_SOURCES += passwd.c
|
|
||||||
openssl_SOURCES += pkcs12.c
|
|
||||||
openssl_SOURCES += pkcs7.c
|
|
||||||
openssl_SOURCES += pkcs8.c
|
|
||||||
openssl_SOURCES += pkey.c
|
|
||||||
openssl_SOURCES += pkeyparam.c
|
|
||||||
openssl_SOURCES += pkeyutl.c
|
|
||||||
openssl_SOURCES += prime.c
|
|
||||||
openssl_SOURCES += rand.c
|
|
||||||
openssl_SOURCES += req.c
|
|
||||||
openssl_SOURCES += rsa.c
|
|
||||||
openssl_SOURCES += rsautl.c
|
|
||||||
openssl_SOURCES += s_cb.c
|
|
||||||
openssl_SOURCES += s_client.c
|
|
||||||
openssl_SOURCES += s_server.c
|
|
||||||
openssl_SOURCES += s_socket.c
|
|
||||||
openssl_SOURCES += s_time.c
|
|
||||||
openssl_SOURCES += sess_id.c
|
|
||||||
openssl_SOURCES += smime.c
|
|
||||||
openssl_SOURCES += speed.c
|
|
||||||
openssl_SOURCES += spkac.c
|
|
||||||
openssl_SOURCES += ts.c
|
|
||||||
openssl_SOURCES += verify.c
|
|
||||||
openssl_SOURCES += version.c
|
|
||||||
openssl_SOURCES += x509.c
|
|
||||||
|
|
||||||
if BUILD_CERTHASH
|
|
||||||
openssl_SOURCES += certhash.c
|
|
||||||
else
|
|
||||||
openssl_SOURCES += certhash_disabled.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
if HOST_WIN
|
|
||||||
openssl_SOURCES += apps_win.c
|
|
||||||
else
|
|
||||||
openssl_SOURCES += apps_posix.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !HAVE_POLL
|
|
||||||
if HOST_WIN
|
|
||||||
openssl_SOURCES += poll_win.c
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !HAVE_STRTONUM
|
|
||||||
openssl_SOURCES += strtonum.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
noinst_HEADERS = apps.h
|
|
||||||
noinst_HEADERS += progs.h
|
|
||||||
noinst_HEADERS += s_apps.h
|
|
||||||
noinst_HEADERS += testdsa.h
|
|
||||||
noinst_HEADERS += testrsa.h
|
|
||||||
noinst_HEADERS += timeouts.h
|
|
||||||
noinst_HEADERS += openssl.cnf
|
|
||||||
|
@@ -1,29 +0,0 @@
|
|||||||
/*
|
|
||||||
* Public domain
|
|
||||||
*
|
|
||||||
* Dongsheng Song <dongsheng.song@gmail.com>
|
|
||||||
* Brent Cook <bcook@openbsd.org>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
#include "apps.h"
|
|
||||||
|
|
||||||
double
|
|
||||||
app_tminterval(int stop, int usertime)
|
|
||||||
{
|
|
||||||
static unsigned __int64 tmstart;
|
|
||||||
union {
|
|
||||||
unsigned __int64 u64;
|
|
||||||
FILETIME ft;
|
|
||||||
} ct, et, kt, ut;
|
|
||||||
|
|
||||||
GetProcessTimes(GetCurrentProcess(), &ct.ft, &et.ft, &kt.ft, &ut.ft);
|
|
||||||
|
|
||||||
if (stop == TM_START) {
|
|
||||||
tmstart = ut.u64 + kt.u64;
|
|
||||||
} else {
|
|
||||||
return (ut.u64 + kt.u64 - tmstart) / (double) 10000000;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
49
apps/nc/Makefile.am
Normal file
49
apps/nc/Makefile.am
Normal 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 += $(abs_top_builddir)/crypto/libcrypto.la
|
||||||
|
nc_LDADD += $(abs_top_builddir)/ssl/libssl.la
|
||||||
|
nc_LDADD += $(abs_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
17
apps/nc/compat/accept4.c
Normal 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
315
apps/nc/compat/base64.c
Normal 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);
|
||||||
|
}
|
205
apps/nc/compat/readpassphrase.c
Normal file
205
apps/nc/compat/readpassphrase.c
Normal 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
29
apps/nc/compat/socket.c
Normal 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
65
apps/nc/compat/strtonum.c
Normal 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);
|
||||||
|
}
|
31
apps/nc/compat/sys/socket.h
Normal file
31
apps/nc/compat/sys/socket.h
Normal 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
118
apps/openssl/Makefile.am
Normal 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 += $(abs_top_builddir)/ssl/libssl.la
|
||||||
|
openssl_LDADD += $(abs_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
60
apps/openssl/apps_win.c
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@@ -9,3 +9,7 @@ autoreconf -i -f
|
|||||||
sed 's/-fuse-linker-plugin)/-fuse-linker-plugin|-fstack-protector*)/' \
|
sed 's/-fuse-linker-plugin)/-fuse-linker-plugin|-fstack-protector*)/' \
|
||||||
ltmain.sh > ltmain.sh.fixed
|
ltmain.sh > ltmain.sh.fixed
|
||||||
mv -f ltmain.sh.fixed ltmain.sh
|
mv -f ltmain.sh.fixed ltmain.sh
|
||||||
|
|
||||||
|
# Update config scripts and fixup permissions
|
||||||
|
find . ! -perm -u=w -exec chmod u+w {} \;
|
||||||
|
cp scripts/config.* .
|
||||||
|
70
check-release.sh
Executable file
70
check-release.sh
Executable 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
|
45
configure.ac
45
configure.ac
@@ -49,22 +49,18 @@ AM_CONDITIONAL([BUILD_CERTHASH], [test "x$ac_cv_func_symlink" = xyes])
|
|||||||
AC_CHECK_FUNC([funopen])
|
AC_CHECK_FUNC([funopen])
|
||||||
|
|
||||||
CHECK_LIBC_COMPAT
|
CHECK_LIBC_COMPAT
|
||||||
CHECK_LIBC_CRYPTO_COMPAT
|
CHECK_SYSCALL_COMPAT
|
||||||
|
CHECK_CRYPTO_COMPAT
|
||||||
CHECK_VA_COPY
|
CHECK_VA_COPY
|
||||||
|
CHECK_B64_NTOP
|
||||||
AC_CHECK_HEADERS([err.h])
|
|
||||||
|
|
||||||
AC_ARG_WITH([openssldir],
|
AC_ARG_WITH([openssldir],
|
||||||
AS_HELP_STRING([--with-openssldir],
|
AS_HELP_STRING([--with-openssldir],
|
||||||
[Set the default openssl directory]),
|
[Set the default openssl directory]),
|
||||||
AC_DEFINE_UNQUOTED(OPENSSLDIR, "$withval")
|
OPENSSLDIR="$withval"
|
||||||
)
|
AC_SUBST(OPENSSLDIR)
|
||||||
|
|
||||||
AC_ARG_WITH([enginesdir],
|
|
||||||
AS_HELP_STRING([--with-enginesdir],
|
|
||||||
[Set the default engines directory (use with openssldir)]),
|
|
||||||
AC_DEFINE_UNQUOTED(ENGINESDIR, "$withval")
|
|
||||||
)
|
)
|
||||||
|
AM_CONDITIONAL([OPENSSLDIR_DEFINED], [test x$with_openssldir != x])
|
||||||
|
|
||||||
AC_ARG_ENABLE([extratests],
|
AC_ARG_ENABLE([extratests],
|
||||||
AS_HELP_STRING([--enable-extratests], [Enable extra tests that may be unreliable on some platforms]))
|
AS_HELP_STRING([--enable-extratests], [Enable extra tests that may be unreliable on some platforms]))
|
||||||
@@ -90,8 +86,24 @@ case $host_cpu in
|
|||||||
AS_IF([test "x$BSWAP4" = "xyes"],,
|
AS_IF([test "x$BSWAP4" = "xyes"],,
|
||||||
CPPFLAGS="$CPPFLAGS -D__STRICT_ALIGNMENT")
|
CPPFLAGS="$CPPFLAGS -D__STRICT_ALIGNMENT")
|
||||||
;;
|
;;
|
||||||
|
*amd64*)
|
||||||
|
host_cpu=x86_64
|
||||||
|
;;
|
||||||
|
|
||||||
esac
|
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],
|
AC_ARG_ENABLE([asm],
|
||||||
AS_HELP_STRING([--disable-asm], [Disable assembly]))
|
AS_HELP_STRING([--disable-asm], [Disable assembly]))
|
||||||
AM_CONDITIONAL([OPENSSL_NO_ASM], [test "x$enable_asm" = "xno"])
|
AM_CONDITIONAL([OPENSSL_NO_ASM], [test "x$enable_asm" = "xno"])
|
||||||
@@ -102,6 +114,9 @@ AM_CONDITIONAL([HOST_ASM_ELF_X86_64],
|
|||||||
AM_CONDITIONAL([HOST_ASM_MACOSX_X86_64],
|
AM_CONDITIONAL([HOST_ASM_MACOSX_X86_64],
|
||||||
[test "x$HOST_ABI" = "xmacosx" -a "$host_cpu" = "x86_64" -a "x$enable_asm" != "xno"])
|
[test "x$HOST_ABI" = "xmacosx" -a "$host_cpu" = "x86_64" -a "x$enable_asm" != "xno"])
|
||||||
|
|
||||||
|
# Check if time_t is sized correctly
|
||||||
|
AC_CHECK_SIZEOF([time_t], [time.h])
|
||||||
|
|
||||||
AC_CONFIG_FILES([
|
AC_CONFIG_FILES([
|
||||||
Makefile
|
Makefile
|
||||||
include/Makefile
|
include/Makefile
|
||||||
@@ -111,6 +126,8 @@ AC_CONFIG_FILES([
|
|||||||
tls/Makefile
|
tls/Makefile
|
||||||
tests/Makefile
|
tests/Makefile
|
||||||
apps/Makefile
|
apps/Makefile
|
||||||
|
apps/openssl/Makefile
|
||||||
|
apps/nc/Makefile
|
||||||
man/Makefile
|
man/Makefile
|
||||||
libcrypto.pc
|
libcrypto.pc
|
||||||
libssl.pc
|
libssl.pc
|
||||||
@@ -118,4 +135,12 @@ AC_CONFIG_FILES([
|
|||||||
openssl.pc
|
openssl.pc
|
||||||
])
|
])
|
||||||
|
|
||||||
|
AM_CONDITIONAL([SMALL_TIME_T], [test "$ac_cv_sizeof_time_t" = "4"])
|
||||||
|
if test "$ac_cv_sizeof_time_t" = "4"; then
|
||||||
|
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
|
AC_OUTPUT
|
||||||
|
655
crypto/CMakeLists.txt
Normal file
655
crypto/CMakeLists.txt
Normal file
@@ -0,0 +1,655 @@
|
|||||||
|
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>)
|
||||||
|
if (MSVC)
|
||||||
|
target_link_libraries(crypto-shared crypto Ws2_32.lib)
|
||||||
|
endif()
|
||||||
|
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()
|
||||||
|
|
@@ -1,16 +1,26 @@
|
|||||||
include $(top_srcdir)/Makefile.am.common
|
include $(top_srcdir)/Makefile.am.common
|
||||||
|
|
||||||
AM_CFLAGS += -I$(top_srcdir)/crypto/asn1
|
AM_CPPFLAGS += -I$(top_srcdir)/crypto/asn1
|
||||||
AM_CFLAGS += -I$(top_srcdir)/crypto/evp
|
AM_CPPFLAGS += -I$(top_srcdir)/crypto/evp
|
||||||
AM_CFLAGS += -I$(top_srcdir)/crypto/modes
|
AM_CPPFLAGS += -I$(top_srcdir)/crypto/modes
|
||||||
|
AM_CPPFLAGS += -I$(top_srcdir)/crypto
|
||||||
|
|
||||||
lib_LTLIBRARIES = libcrypto.la
|
lib_LTLIBRARIES = libcrypto.la
|
||||||
|
|
||||||
EXTRA_DIST = VERSION
|
EXTRA_DIST = VERSION
|
||||||
|
EXTRA_DIST += CMakeLists.txt
|
||||||
|
|
||||||
|
# needed for a CMake target
|
||||||
|
EXTRA_DIST += compat/strcasecmp.c
|
||||||
|
|
||||||
libcrypto_la_LDFLAGS = -version-info @LIBCRYPTO_VERSION@ -no-undefined
|
libcrypto_la_LDFLAGS = -version-info @LIBCRYPTO_VERSION@ -no-undefined
|
||||||
libcrypto_la_LIBADD = libcompat.la libcompatnoopt.la
|
libcrypto_la_LIBADD = libcompat.la
|
||||||
libcrypto_la_CPPFLAGS = -DOPENSSL_NO_HW_PADLOCK
|
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
|
if OPENSSL_NO_ASM
|
||||||
libcrypto_la_CPPFLAGS += -DOPENSSL_NO_ASM
|
libcrypto_la_CPPFLAGS += -DOPENSSL_NO_ASM
|
||||||
else
|
else
|
||||||
@@ -19,15 +29,27 @@ libcrypto_la_CPPFLAGS += -DOPENSSL_NO_ASM
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
noinst_LTLIBRARIES = libcompat.la libcompatnoopt.la
|
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
|
# compatibility functions that need to be built without optimizations
|
||||||
|
if !HAVE_EXPLICIT_BZERO
|
||||||
|
noinst_LTLIBRARIES += libcompatnoopt.la
|
||||||
|
|
||||||
libcompatnoopt_la_CFLAGS = -O0
|
libcompatnoopt_la_CFLAGS = -O0
|
||||||
libcompatnoopt_la_SOURCES =
|
libcompatnoopt_la_SOURCES =
|
||||||
|
|
||||||
if !HAVE_EXPLICIT_BZERO
|
if HOST_WIN
|
||||||
|
libcompatnoopt_la_SOURCES += compat/explicit_bzero_win.c
|
||||||
|
else
|
||||||
libcompatnoopt_la_SOURCES += compat/explicit_bzero.c
|
libcompatnoopt_la_SOURCES += compat/explicit_bzero.c
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
# other compatibility functions
|
# other compatibility functions
|
||||||
libcompat_la_SOURCES =
|
libcompat_la_SOURCES =
|
||||||
@@ -57,6 +79,10 @@ if !HAVE_INET_PTON
|
|||||||
libcompat_la_SOURCES += compat/inet_pton.c
|
libcompat_la_SOURCES += compat/inet_pton.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if !HAVE_TIMEGM
|
||||||
|
libcompat_la_SOURCES += compat/timegm.c
|
||||||
|
endif
|
||||||
|
|
||||||
if !HAVE_REALLOCARRAY
|
if !HAVE_REALLOCARRAY
|
||||||
libcompat_la_SOURCES += compat/reallocarray.c
|
libcompat_la_SOURCES += compat/reallocarray.c
|
||||||
endif
|
endif
|
||||||
@@ -103,6 +129,7 @@ libcrypto_la_SOURCES += mem_dbg.c
|
|||||||
libcrypto_la_SOURCES += o_init.c
|
libcrypto_la_SOURCES += o_init.c
|
||||||
libcrypto_la_SOURCES += o_str.c
|
libcrypto_la_SOURCES += o_str.c
|
||||||
libcrypto_la_SOURCES += o_time.c
|
libcrypto_la_SOURCES += o_time.c
|
||||||
|
noinst_HEADERS += constant_time_locl.h
|
||||||
noinst_HEADERS += cryptlib.h
|
noinst_HEADERS += cryptlib.h
|
||||||
noinst_HEADERS += md32_common.h
|
noinst_HEADERS += md32_common.h
|
||||||
noinst_HEADERS += o_time.h
|
noinst_HEADERS += o_time.h
|
||||||
@@ -125,7 +152,6 @@ libcrypto_la_SOURCES += asn1/a_d2i_fp.c
|
|||||||
libcrypto_la_SOURCES += asn1/a_digest.c
|
libcrypto_la_SOURCES += asn1/a_digest.c
|
||||||
libcrypto_la_SOURCES += asn1/a_dup.c
|
libcrypto_la_SOURCES += asn1/a_dup.c
|
||||||
libcrypto_la_SOURCES += asn1/a_enum.c
|
libcrypto_la_SOURCES += asn1/a_enum.c
|
||||||
libcrypto_la_SOURCES += asn1/a_gentm.c
|
|
||||||
libcrypto_la_SOURCES += asn1/a_i2d_fp.c
|
libcrypto_la_SOURCES += asn1/a_i2d_fp.c
|
||||||
libcrypto_la_SOURCES += asn1/a_int.c
|
libcrypto_la_SOURCES += asn1/a_int.c
|
||||||
libcrypto_la_SOURCES += asn1/a_mbstr.c
|
libcrypto_la_SOURCES += asn1/a_mbstr.c
|
||||||
@@ -137,8 +163,8 @@ libcrypto_la_SOURCES += asn1/a_sign.c
|
|||||||
libcrypto_la_SOURCES += asn1/a_strex.c
|
libcrypto_la_SOURCES += asn1/a_strex.c
|
||||||
libcrypto_la_SOURCES += asn1/a_strnid.c
|
libcrypto_la_SOURCES += asn1/a_strnid.c
|
||||||
libcrypto_la_SOURCES += asn1/a_time.c
|
libcrypto_la_SOURCES += asn1/a_time.c
|
||||||
|
libcrypto_la_SOURCES += asn1/a_time_tm.c
|
||||||
libcrypto_la_SOURCES += asn1/a_type.c
|
libcrypto_la_SOURCES += asn1/a_type.c
|
||||||
libcrypto_la_SOURCES += asn1/a_utctm.c
|
|
||||||
libcrypto_la_SOURCES += asn1/a_utf8.c
|
libcrypto_la_SOURCES += asn1/a_utf8.c
|
||||||
libcrypto_la_SOURCES += asn1/a_verify.c
|
libcrypto_la_SOURCES += asn1/a_verify.c
|
||||||
libcrypto_la_SOURCES += asn1/ameth_lib.c
|
libcrypto_la_SOURCES += asn1/ameth_lib.c
|
||||||
@@ -229,7 +255,9 @@ libcrypto_la_SOURCES += bio/bss_conn.c
|
|||||||
libcrypto_la_SOURCES += bio/bss_dgram.c
|
libcrypto_la_SOURCES += bio/bss_dgram.c
|
||||||
libcrypto_la_SOURCES += bio/bss_fd.c
|
libcrypto_la_SOURCES += bio/bss_fd.c
|
||||||
libcrypto_la_SOURCES += bio/bss_file.c
|
libcrypto_la_SOURCES += bio/bss_file.c
|
||||||
|
if !HOST_WIN
|
||||||
libcrypto_la_SOURCES += bio/bss_log.c
|
libcrypto_la_SOURCES += bio/bss_log.c
|
||||||
|
endif
|
||||||
libcrypto_la_SOURCES += bio/bss_mem.c
|
libcrypto_la_SOURCES += bio/bss_mem.c
|
||||||
libcrypto_la_SOURCES += bio/bss_null.c
|
libcrypto_la_SOURCES += bio/bss_null.c
|
||||||
libcrypto_la_SOURCES += bio/bss_sock.c
|
libcrypto_la_SOURCES += bio/bss_sock.c
|
||||||
@@ -402,7 +430,6 @@ noinst_HEADERS += ec/ec_lcl.h
|
|||||||
libcrypto_la_SOURCES += ecdh/ech_err.c
|
libcrypto_la_SOURCES += ecdh/ech_err.c
|
||||||
libcrypto_la_SOURCES += ecdh/ech_key.c
|
libcrypto_la_SOURCES += ecdh/ech_key.c
|
||||||
libcrypto_la_SOURCES += ecdh/ech_lib.c
|
libcrypto_la_SOURCES += ecdh/ech_lib.c
|
||||||
libcrypto_la_SOURCES += ecdh/ech_ossl.c
|
|
||||||
noinst_HEADERS += ecdh/ech_locl.h
|
noinst_HEADERS += ecdh/ech_locl.h
|
||||||
|
|
||||||
# ecdsa
|
# ecdsa
|
||||||
@@ -426,7 +453,6 @@ libcrypto_la_SOURCES += engine/eng_lib.c
|
|||||||
libcrypto_la_SOURCES += engine/eng_list.c
|
libcrypto_la_SOURCES += engine/eng_list.c
|
||||||
libcrypto_la_SOURCES += engine/eng_openssl.c
|
libcrypto_la_SOURCES += engine/eng_openssl.c
|
||||||
libcrypto_la_SOURCES += engine/eng_pkey.c
|
libcrypto_la_SOURCES += engine/eng_pkey.c
|
||||||
libcrypto_la_SOURCES += engine/eng_rsax.c
|
|
||||||
libcrypto_la_SOURCES += engine/eng_table.c
|
libcrypto_la_SOURCES += engine/eng_table.c
|
||||||
libcrypto_la_SOURCES += engine/tb_asnmth.c
|
libcrypto_la_SOURCES += engine/tb_asnmth.c
|
||||||
libcrypto_la_SOURCES += engine/tb_cipher.c
|
libcrypto_la_SOURCES += engine/tb_cipher.c
|
||||||
@@ -486,7 +512,6 @@ libcrypto_la_SOURCES += evp/m_md4.c
|
|||||||
libcrypto_la_SOURCES += evp/m_md5.c
|
libcrypto_la_SOURCES += evp/m_md5.c
|
||||||
libcrypto_la_SOURCES += evp/m_null.c
|
libcrypto_la_SOURCES += evp/m_null.c
|
||||||
libcrypto_la_SOURCES += evp/m_ripemd.c
|
libcrypto_la_SOURCES += evp/m_ripemd.c
|
||||||
libcrypto_la_SOURCES += evp/m_sha.c
|
|
||||||
libcrypto_la_SOURCES += evp/m_sha1.c
|
libcrypto_la_SOURCES += evp/m_sha1.c
|
||||||
libcrypto_la_SOURCES += evp/m_sigver.c
|
libcrypto_la_SOURCES += evp/m_sigver.c
|
||||||
libcrypto_la_SOURCES += evp/m_streebog.c
|
libcrypto_la_SOURCES += evp/m_streebog.c
|
||||||
@@ -680,8 +705,6 @@ libcrypto_la_SOURCES += sha/sha1_one.c
|
|||||||
libcrypto_la_SOURCES += sha/sha1dgst.c
|
libcrypto_la_SOURCES += sha/sha1dgst.c
|
||||||
libcrypto_la_SOURCES += sha/sha256.c
|
libcrypto_la_SOURCES += sha/sha256.c
|
||||||
libcrypto_la_SOURCES += sha/sha512.c
|
libcrypto_la_SOURCES += sha/sha512.c
|
||||||
libcrypto_la_SOURCES += sha/sha_dgst.c
|
|
||||||
libcrypto_la_SOURCES += sha/sha_one.c
|
|
||||||
noinst_HEADERS += sha/sha_locl.h
|
noinst_HEADERS += sha/sha_locl.h
|
||||||
|
|
||||||
# stack
|
# stack
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
if !HAVE_ARC4RANDOM_BUF
|
if !HAVE_ARC4RANDOM_BUF
|
||||||
libcompat_la_SOURCES += compat/arc4random.c
|
libcompat_la_SOURCES += compat/arc4random.c
|
||||||
|
libcompat_la_SOURCES += compat/arc4random_uniform.c
|
||||||
|
|
||||||
if !HAVE_GETENTROPY
|
if !HAVE_GETENTROPY
|
||||||
if HOST_AIX
|
if HOST_AIX
|
||||||
|
13
crypto/compat/explicit_bzero_win.c
Normal file
13
crypto/compat/explicit_bzero_win.c
Normal 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);
|
||||||
|
}
|
@@ -12,6 +12,7 @@
|
|||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -38,6 +39,20 @@ posix_fopen(const char *path, const char *mode)
|
|||||||
return fopen(path, mode);
|
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
|
int
|
||||||
posix_rename(const char *oldpath, const char *newpath)
|
posix_rename(const char *oldpath, const char *newpath)
|
||||||
{
|
{
|
||||||
@@ -166,3 +181,34 @@ posix_setsockopt(int sockfd, int level, int optname,
|
|||||||
int rc = setsockopt(sockfd, level, optname, (char *)optval, optlen);
|
int rc = setsockopt(sockfd, level, optname, (char *)optval, optlen);
|
||||||
return rc == 0 ? 0 : wsa_errno(WSAGetLastError());
|
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
220
crypto/compat/timegm.c
Normal 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;
|
||||||
|
}
|
@@ -133,6 +133,7 @@
|
|||||||
/* Define globals. They are protected by a lock */
|
/* Define globals. They are protected by a lock */
|
||||||
static void (*savsig[NX509_SIG])(int );
|
static void (*savsig[NX509_SIG])(int );
|
||||||
|
|
||||||
|
DWORD console_mode;
|
||||||
static FILE *tty_in, *tty_out;
|
static FILE *tty_in, *tty_out;
|
||||||
static int is_a_tty;
|
static int is_a_tty;
|
||||||
|
|
||||||
@@ -285,7 +286,7 @@ error:
|
|||||||
if (ps >= 1)
|
if (ps >= 1)
|
||||||
popsig();
|
popsig();
|
||||||
|
|
||||||
OPENSSL_cleanse(result, BUFSIZ);
|
explicit_bzero(result, BUFSIZ);
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,16 +301,25 @@ open_console(UI *ui)
|
|||||||
tty_in = stdin;
|
tty_in = stdin;
|
||||||
tty_out = stderr;
|
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 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
noecho_console(UI *ui)
|
noecho_console(UI *ui)
|
||||||
{
|
{
|
||||||
DWORD mode = 0;
|
|
||||||
HANDLE handle = GetStdHandle(STD_INPUT_HANDLE);
|
HANDLE handle = GetStdHandle(STD_INPUT_HANDLE);
|
||||||
if (handle != INVALID_HANDLE_VALUE && handle != handle) {
|
if (handle != NULL && handle != INVALID_HANDLE_VALUE) {
|
||||||
return GetConsoleMode(handle, &mode) && SetConsoleMode(handle, mode & (~ENABLE_ECHO_INPUT));
|
if (GetFileType(handle) == FILE_TYPE_CHAR)
|
||||||
|
return SetConsoleMode(handle, console_mode & ~ENABLE_ECHO_INPUT);
|
||||||
|
else
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -317,10 +327,12 @@ noecho_console(UI *ui)
|
|||||||
static int
|
static int
|
||||||
echo_console(UI *ui)
|
echo_console(UI *ui)
|
||||||
{
|
{
|
||||||
DWORD mode = 0;
|
|
||||||
HANDLE handle = GetStdHandle(STD_INPUT_HANDLE);
|
HANDLE handle = GetStdHandle(STD_INPUT_HANDLE);
|
||||||
if (handle != INVALID_HANDLE_VALUE && handle != handle) {
|
if (handle != NULL && handle != INVALID_HANDLE_VALUE) {
|
||||||
return GetConsoleMode(handle, &mode) && SetConsoleMode(handle, mode | ENABLE_ECHO_INPUT);
|
if (GetFileType(handle) == FILE_TYPE_CHAR)
|
||||||
|
return SetConsoleMode(handle, console_mode);
|
||||||
|
else
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
13
dist-win.sh
13
dist-win.sh
@@ -22,27 +22,18 @@ for ARCH in X86 X64; do
|
|||||||
|
|
||||||
echo Building for $HOST
|
echo Building for $HOST
|
||||||
|
|
||||||
CC=$HOST-gcc ./configure --host=$HOST
|
CC=$HOST-gcc ./configure --host=$HOST --with-openssldir=c:/libressl/ssl
|
||||||
make clean
|
make clean
|
||||||
PATH=$PATH:/usr/$HOST/sys-root/mingw/bin \
|
PATH=$PATH:/usr/$HOST/sys-root/mingw/bin \
|
||||||
make -j 4 check
|
make -j 4 check
|
||||||
make -j 4 install DESTDIR=`pwd`/stage-$ARCHDIR
|
make -j 4 install DESTDIR=`pwd`/stage-$ARCHDIR
|
||||||
|
|
||||||
mkdir -p $DIST/$ARCHDIR
|
mkdir -p $DIST/$ARCHDIR
|
||||||
#cp -a stage-$ARCHDIR/usr/local/lib/* $DIST/$ARCHDIR
|
|
||||||
if [ ! -e $DIST/include ]; then
|
if [ ! -e $DIST/include ]; then
|
||||||
cp -a stage-$ARCHDIR/usr/local/include $DIST
|
cp -r stage-$ARCHDIR/usr/local/include $DIST
|
||||||
sed -i -e 'N;/\n.*__non/s/"\? *\n/ /;P;D' \
|
|
||||||
$DIST/include/openssl/*.h $DIST/include/*.h
|
|
||||||
sed -i -e 'N;/\n.*__attr/s/"\? *\n/ /;P;D' \
|
|
||||||
$DIST/include/openssl/*.h $DIST/include/*.h
|
|
||||||
sed -i -e "s/__attr.*;/;/" \
|
|
||||||
-e "s/sys\/time.h/winsock2.h/" \
|
|
||||||
$DIST/include/openssl/*.h $DIST/include/*.h
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp stage-$ARCHDIR/usr/local/bin/* $DIST/$ARCHDIR
|
cp stage-$ARCHDIR/usr/local/bin/* $DIST/$ARCHDIR
|
||||||
#cp /usr/$HOST/sys-root/mingw/bin/libssp* $DIST/$ARCHDIR
|
|
||||||
|
|
||||||
for i in libcrypto libssl libtls; do
|
for i in libcrypto libssl libtls; do
|
||||||
DLL=$(basename `ls -1 $DIST/$ARCHDIR/$i*.dll`|cut -d. -f1)
|
DLL=$(basename `ls -1 $DIST/$ARCHDIR/$i*.dll`|cut -d. -f1)
|
||||||
|
2
dist.sh
2
dist.sh
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
rm -f man/*.1 man/*.3
|
rm -f man/*.1 man/*.3 include/openssl/*.h
|
||||||
./autogen.sh
|
./autogen.sh
|
||||||
./configure
|
./configure
|
||||||
make distcheck
|
make distcheck
|
||||||
|
20
gen-openbsd-tags.sh
Executable file
20
gen-openbsd-tags.sh
Executable 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
5
include/CMakeLists.txt
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
install(DIRECTORY .
|
||||||
|
DESTINATION include
|
||||||
|
PATTERN "CMakeLists.txt" EXCLUDE
|
||||||
|
PATTERN "compat" EXCLUDE
|
||||||
|
PATTERN "Makefile.*" EXCLUDE)
|
@@ -1,32 +1,43 @@
|
|||||||
include $(top_srcdir)/Makefile.am.common
|
include $(top_srcdir)/Makefile.am.common
|
||||||
|
|
||||||
|
EXTRA_DIST = CMakeLists.txt
|
||||||
|
|
||||||
SUBDIRS = openssl
|
SUBDIRS = openssl
|
||||||
|
|
||||||
noinst_HEADERS = err.h
|
noinst_HEADERS = pqueue.h
|
||||||
noinst_HEADERS += netdb.h
|
noinst_HEADERS += compat/dirent.h
|
||||||
noinst_HEADERS += poll.h
|
noinst_HEADERS += compat/dirent_msvc.h
|
||||||
noinst_HEADERS += pqueue.h
|
noinst_HEADERS += compat/err.h
|
||||||
noinst_HEADERS += stdio.h
|
noinst_HEADERS += compat/limits.h
|
||||||
noinst_HEADERS += stdlib.h
|
noinst_HEADERS += compat/netdb.h
|
||||||
noinst_HEADERS += string.h
|
noinst_HEADERS += compat/poll.h
|
||||||
noinst_HEADERS += syslog.h
|
noinst_HEADERS += compat/readpassphrase.h
|
||||||
noinst_HEADERS += unistd.h
|
noinst_HEADERS += compat/resolv.h
|
||||||
noinst_HEADERS += win32netcompat.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 += arpa/inet.h
|
noinst_HEADERS += compat/arpa/inet.h
|
||||||
noinst_HEADERS += arpa/nameser.h
|
noinst_HEADERS += compat/arpa/nameser.h
|
||||||
|
|
||||||
noinst_HEADERS += machine/endian.h
|
noinst_HEADERS += compat/machine/endian.h
|
||||||
|
|
||||||
noinst_HEADERS += netinet/in.h
|
noinst_HEADERS += compat/netinet/in.h
|
||||||
noinst_HEADERS += netinet/tcp.h
|
noinst_HEADERS += compat/netinet/ip.h
|
||||||
|
noinst_HEADERS += compat/netinet/tcp.h
|
||||||
|
|
||||||
noinst_HEADERS += sys/ioctl.h
|
noinst_HEADERS += compat/sys/cdefs.h
|
||||||
noinst_HEADERS += sys/mman.h
|
noinst_HEADERS += compat/sys/ioctl.h
|
||||||
noinst_HEADERS += sys/select.h
|
noinst_HEADERS += compat/sys/mman.h
|
||||||
noinst_HEADERS += sys/socket.h
|
noinst_HEADERS += compat/sys/param.h
|
||||||
noinst_HEADERS += sys/times.h
|
noinst_HEADERS += compat/sys/select.h
|
||||||
noinst_HEADERS += sys/types.h
|
noinst_HEADERS += compat/sys/socket.h
|
||||||
noinst_HEADERS += sys/uio.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
|
include_HEADERS = tls.h
|
||||||
|
@@ -15,5 +15,5 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_INET_PTON
|
#ifndef HAVE_INET_PTON
|
||||||
int inet_pton(int af, const char * restrict src, void * restrict dst);
|
int inet_pton(int af, const char * src, void * dst);
|
||||||
#endif
|
#endif
|
17
include/compat/dirent.h
Normal file
17
include/compat/dirent.h
Normal 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
|
||||||
|
|
611
include/compat/dirent_msvc.h
Normal file
611
include/compat/dirent_msvc.h
Normal 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
79
include/compat/err.h
Normal 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
17
include/compat/limits.h
Normal 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
|
47
include/compat/netinet/ip.h
Normal file
47
include/compat/netinet/ip.h
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Public domain
|
||||||
|
* netinet/ip.h compatibility shim
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(__hpux)
|
||||||
|
#include <netinet/in_systm.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
|
#include_next <netinet/ip.h>
|
||||||
|
#else
|
||||||
|
#include <win32netcompat.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Definitions for DiffServ Codepoints as per RFC2474
|
||||||
|
*/
|
||||||
|
#ifndef IPTOS_DSCP_CS0
|
||||||
|
#define IPTOS_DSCP_CS0 0x00
|
||||||
|
#define IPTOS_DSCP_CS1 0x20
|
||||||
|
#define IPTOS_DSCP_CS2 0x40
|
||||||
|
#define IPTOS_DSCP_CS3 0x60
|
||||||
|
#define IPTOS_DSCP_CS4 0x80
|
||||||
|
#define IPTOS_DSCP_CS5 0xa0
|
||||||
|
#define IPTOS_DSCP_CS6 0xc0
|
||||||
|
#define IPTOS_DSCP_CS7 0xe0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef IPTOS_DSCP_AF11
|
||||||
|
#define IPTOS_DSCP_AF11 0x28
|
||||||
|
#define IPTOS_DSCP_AF12 0x30
|
||||||
|
#define IPTOS_DSCP_AF13 0x38
|
||||||
|
#define IPTOS_DSCP_AF21 0x48
|
||||||
|
#define IPTOS_DSCP_AF22 0x50
|
||||||
|
#define IPTOS_DSCP_AF23 0x58
|
||||||
|
#define IPTOS_DSCP_AF31 0x68
|
||||||
|
#define IPTOS_DSCP_AF32 0x70
|
||||||
|
#define IPTOS_DSCP_AF33 0x78
|
||||||
|
#define IPTOS_DSCP_AF41 0x88
|
||||||
|
#define IPTOS_DSCP_AF42 0x90
|
||||||
|
#define IPTOS_DSCP_AF43 0x98
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef IPTOS_DSCP_EF
|
||||||
|
#define IPTOS_DSCP_EF 0xb8
|
||||||
|
#endif
|
@@ -14,7 +14,7 @@
|
|||||||
#ifndef LIBCRYPTOCOMPAT_POLL_H
|
#ifndef LIBCRYPTOCOMPAT_POLL_H
|
||||||
#define LIBCRYPTOCOMPAT_POLL_H
|
#define LIBCRYPTOCOMPAT_POLL_H
|
||||||
|
|
||||||
#ifdef HAVE_POLL
|
#ifndef _WIN32
|
||||||
#include_next <poll.h>
|
#include_next <poll.h>
|
||||||
#else
|
#else
|
||||||
|
|
44
include/compat/readpassphrase.h
Normal file
44
include/compat/readpassphrase.h
Normal 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
24
include/compat/resolv.h
Normal 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
|
@@ -3,11 +3,21 @@
|
|||||||
* stdio.h compatibility shim
|
* stdio.h compatibility shim
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include_next <stdio.h>
|
|
||||||
|
|
||||||
#ifndef LIBCRYPTOCOMPAT_STDIO_H
|
#ifndef LIBCRYPTOCOMPAT_STDIO_H
|
||||||
#define 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
|
#ifndef HAVE_ASPRINTF
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
int vasprintf(char **str, const char *fmt, va_list ap);
|
int vasprintf(char **str, const char *fmt, va_list ap);
|
||||||
@@ -18,14 +28,20 @@ int asprintf(char **str, const char *fmt, ...);
|
|||||||
|
|
||||||
void posix_perror(const char *s);
|
void posix_perror(const char *s);
|
||||||
FILE * posix_fopen(const char *path, const char *mode);
|
FILE * posix_fopen(const char *path, const char *mode);
|
||||||
|
char * posix_fgets(char *s, int size, FILE *stream);
|
||||||
int posix_rename(const char *oldpath, const char *newpath);
|
int posix_rename(const char *oldpath, const char *newpath);
|
||||||
|
|
||||||
#ifndef NO_REDEF_POSIX_FUNCTIONS
|
#ifndef NO_REDEF_POSIX_FUNCTIONS
|
||||||
#define perror(errnum) posix_perror(errnum)
|
#define perror(errnum) posix_perror(errnum)
|
||||||
#define fopen(path, mode) posix_fopen(path, mode)
|
#define fopen(path, mode) posix_fopen(path, mode)
|
||||||
|
#define fgets(s, size, stream) posix_fgets(s, size, stream)
|
||||||
#define rename(oldpath, newpath) posix_rename(oldpath, newpath)
|
#define rename(oldpath, newpath) posix_rename(oldpath, newpath)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#define snprintf _snprintf
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
@@ -3,18 +3,26 @@
|
|||||||
* Public domain
|
* Public domain
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#if _MSC_VER >= 1900
|
||||||
|
#include <../ucrt/stdlib.h>
|
||||||
|
#else
|
||||||
|
#include <../include/stdlib.h>
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
#include_next <stdlib.h>
|
#include_next <stdlib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef LIBCRYPTOCOMPAT_STDLIB_H
|
#ifndef LIBCRYPTOCOMPAT_STDLIB_H
|
||||||
#define LIBCRYPTOCOMPAT_STDLIB_H
|
#define LIBCRYPTOCOMPAT_STDLIB_H
|
||||||
|
|
||||||
#include <sys/stat.h>
|
#include <sys/types.h>
|
||||||
#include <sys/time.h>
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#ifndef HAVE_ARC4RANDOM_BUF
|
#ifndef HAVE_ARC4RANDOM_BUF
|
||||||
uint32_t arc4random(void);
|
uint32_t arc4random(void);
|
||||||
void arc4random_buf(void *_buf, size_t n);
|
void arc4random_buf(void *_buf, size_t n);
|
||||||
|
uint32_t arc4random_uniform(uint32_t upper_bound);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_REALLOCARRAY
|
#ifndef HAVE_REALLOCARRAY
|
@@ -3,20 +3,34 @@
|
|||||||
* string.h compatibility shim
|
* string.h compatibility shim
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include_next <string.h>
|
|
||||||
|
|
||||||
#ifndef LIBCRYPTOCOMPAT_STRING_H
|
#ifndef LIBCRYPTOCOMPAT_STRING_H
|
||||||
#define 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>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#if defined(__sun) || defined(__hpux)
|
#if defined(__sun) || defined(_AIX) || defined(__hpux)
|
||||||
/* Some functions historically defined in string.h were placed in strings.h by
|
/* Some functions historically defined in string.h were placed in strings.h by
|
||||||
* SUS. Use the same hack as OS X and FreeBSD use to work around on Solaris and HPUX.
|
* SUS. Use the same hack as OS X and FreeBSD use to work around on AIX,
|
||||||
|
* Solaris, and HPUX.
|
||||||
*/
|
*/
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#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
|
#ifndef HAVE_STRLCPY
|
||||||
size_t strlcpy(char *dst, const char *src, size_t siz);
|
size_t strlcpy(char *dst, const char *src, size_t siz);
|
||||||
#endif
|
#endif
|
31
include/compat/sys/cdefs.h
Normal file
31
include/compat/sys/cdefs.h
Normal 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 */
|
15
include/compat/sys/param.h
Normal file
15
include/compat/sys/param.h
Normal 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
|
100
include/compat/sys/stat.h
Normal file
100
include/compat/sys/stat.h
Normal 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
16
include/compat/sys/time.h
Normal 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
|
47
include/compat/sys/types.h
Normal file
47
include/compat/sys/types.h
Normal 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
|
23
include/compat/time.h
Normal file
23
include/compat/time.h
Normal 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
41
include/compat/unistd.h
Normal 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
|
@@ -11,14 +11,19 @@
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
|
|
||||||
#define SHUT_RDWR SD_BOTH
|
|
||||||
#define SHUT_RD SD_RECEIVE
|
|
||||||
#define SHUT_WR SD_SEND
|
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#ifndef SHUT_RDWR
|
||||||
|
#define SHUT_RDWR SD_BOTH
|
||||||
|
#endif
|
||||||
|
#ifndef SHUT_RD
|
||||||
|
#define SHUT_RD SD_RECEIVE
|
||||||
|
#endif
|
||||||
|
#ifndef SHUT_WR
|
||||||
|
#define SHUT_WR SD_SEND
|
||||||
|
#endif
|
||||||
|
|
||||||
int posix_connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
|
int posix_connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
|
||||||
|
|
||||||
int posix_close(int fd);
|
int posix_close(int fd);
|
@@ -1,33 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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 <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
|
|
@@ -1,10 +0,0 @@
|
|||||||
/*
|
|
||||||
* Public domain
|
|
||||||
* sys/times.h compatibility shim
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
#include_next <sys/times.h>
|
|
||||||
#else
|
|
||||||
#include <win32netcompat.h>
|
|
||||||
#endif
|
|
@@ -1,21 +0,0 @@
|
|||||||
/*
|
|
||||||
* Public domain
|
|
||||||
* sys/types.h compatibility shim
|
|
||||||
*/
|
|
||||||
|
|
||||||
#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
|
|
@@ -1,38 +0,0 @@
|
|||||||
/*
|
|
||||||
* Public domain
|
|
||||||
* syslog.h compatibility shim
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef LIBCRYPTOCOMPAT_SYSLOG_H
|
|
||||||
#define LIBCRYPTOCOMPAT_SYSLOG_H
|
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
#include_next <syslog.h>
|
|
||||||
#else
|
|
||||||
|
|
||||||
/* priorities */
|
|
||||||
#define LOG_EMERG 0
|
|
||||||
#define LOG_ALERT 1
|
|
||||||
#define LOG_CRIT 2
|
|
||||||
#define LOG_ERR 3
|
|
||||||
#define LOG_WARNING 4
|
|
||||||
#define LOG_NOTICE 5
|
|
||||||
#define LOG_INFO 6
|
|
||||||
#define LOG_DEBUG 7
|
|
||||||
|
|
||||||
/* facility codes */
|
|
||||||
#define LOG_KERN (0<<3)
|
|
||||||
#define LOG_USER (1<<3)
|
|
||||||
#define LOG_DAEMON (3<<3)
|
|
||||||
|
|
||||||
/* flags for openlog */
|
|
||||||
#define LOG_PID 0x01
|
|
||||||
#define LOG_CONS 0x02
|
|
||||||
|
|
||||||
extern void openlog(const char *ident, int option, int facility);
|
|
||||||
extern void syslog(int priority, const char *fmt, ...)
|
|
||||||
__attribute__ ((__format__ (__printf__, 2, 3)));
|
|
||||||
extern void closelog (void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* LIBCRYPTOCOMPAT_SYSLOG_H */
|
|
@@ -1,15 +0,0 @@
|
|||||||
/*
|
|
||||||
* Public domain
|
|
||||||
* unistd.h compatibility shim
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include_next <unistd.h>
|
|
||||||
|
|
||||||
#ifndef LIBCRYPTOCOMPAT_UNISTD_H
|
|
||||||
#define LIBCRYPTOCOMPAT_UNISTD_H
|
|
||||||
|
|
||||||
#ifndef HAVE_GETENTROPY
|
|
||||||
int getentropy(void *buf, size_t buflen);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
@@ -7,7 +7,7 @@ includedir=@includedir@
|
|||||||
|
|
||||||
Name: LibreSSL-libssl
|
Name: LibreSSL-libssl
|
||||||
Description: Secure Sockets Layer and cryptography libraries
|
Description: Secure Sockets Layer and cryptography libraries
|
||||||
Version: @LIBCRYPTO_VERSION@
|
Version: @VERSION@
|
||||||
Requires:
|
Requires:
|
||||||
Conflicts:
|
Conflicts:
|
||||||
Libs: -L${libdir} -lcrypto
|
Libs: -L${libdir} -lcrypto
|
||||||
|
@@ -7,7 +7,7 @@ includedir=@includedir@
|
|||||||
|
|
||||||
Name: LibreSSL-libssl
|
Name: LibreSSL-libssl
|
||||||
Description: Secure Sockets Layer and cryptography libraries
|
Description: Secure Sockets Layer and cryptography libraries
|
||||||
Version: @LIBSSL_VERSION@
|
Version: @VERSION@
|
||||||
Requires:
|
Requires:
|
||||||
Requires.private: libcrypto
|
Requires.private: libcrypto
|
||||||
Conflicts:
|
Conflicts:
|
||||||
|
@@ -1 +0,0 @@
|
|||||||
4.0.0
|
|
@@ -3,20 +3,34 @@
|
|||||||
* string.h compatibility shim
|
* string.h compatibility shim
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include_next <string.h>
|
|
||||||
|
|
||||||
#ifndef LIBCRYPTOCOMPAT_STRING_H
|
#ifndef LIBCRYPTOCOMPAT_STRING_H
|
||||||
#define 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>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#if defined(__sun) || defined(__hpux)
|
#if defined(__sun) || defined(_AIX) || defined(__hpux)
|
||||||
/* Some functions historically defined in string.h were placed in strings.h by
|
/* Some functions historically defined in string.h were placed in strings.h by
|
||||||
* SUS. Use the same hack as OS X and FreeBSD use to work around on Solaris and HPUX.
|
* SUS. Use the same hack as OS X and FreeBSD use to work around on AIX,
|
||||||
|
* Solaris, and HPUX.
|
||||||
*/
|
*/
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#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
|
#ifndef HAVE_STRLCPY
|
||||||
size_t strlcpy(char *dst, const char *src, size_t siz);
|
size_t strlcpy(char *dst, const char *src, size_t siz);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -5,7 +5,7 @@ int main()
|
|||||||
{
|
{
|
||||||
struct tls *tls;
|
struct tls *tls;
|
||||||
struct tls_config *tls_config;
|
struct tls_config *tls_config;
|
||||||
size_t written, read;
|
ssize_t written, read;
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
|
|
||||||
if (tls_init() != 0) {
|
if (tls_init() != 0) {
|
||||||
@@ -31,10 +31,10 @@ int main()
|
|||||||
if (tls_connect(tls, "google.com", "443") != 0)
|
if (tls_connect(tls, "google.com", "443") != 0)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
if (tls_write(tls, "GET /\r\n", 7, &written) != 0)
|
if ((written = tls_write(tls, "GET /\r\n", 7)) < 0)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
if (tls_read(tls, buf, sizeof(buf), &read) != 0)
|
if ((read = tls_read(tls, buf, sizeof(buf))) < 0)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
buf[read - 1] = '\0';
|
buf[read - 1] = '\0';
|
||||||
|
@@ -7,7 +7,7 @@ includedir=@includedir@
|
|||||||
|
|
||||||
Name: LibreSSL-libtls
|
Name: LibreSSL-libtls
|
||||||
Description: Secure communications using the TLS socket protocol.
|
Description: Secure communications using the TLS socket protocol.
|
||||||
Version: @LIBTLS_VERSION@
|
Version: @VERSION@
|
||||||
Requires:
|
Requires:
|
||||||
Requires.private: libcrypto libssl
|
Requires.private: libcrypto libssl
|
||||||
Conflicts:
|
Conflicts:
|
||||||
|
@@ -1,11 +1,14 @@
|
|||||||
AC_DEFUN([CHECK_LIBC_COMPAT], [
|
AC_DEFUN([CHECK_LIBC_COMPAT], [
|
||||||
|
# Check for libc headers
|
||||||
|
AC_CHECK_HEADERS([err.h readpassphrase.h])
|
||||||
# Check for general libc functions
|
# Check for general libc functions
|
||||||
AC_CHECK_FUNCS([asprintf inet_pton memmem poll reallocarray])
|
AC_CHECK_FUNCS([asprintf inet_pton memmem readpassphrase reallocarray])
|
||||||
AC_CHECK_FUNCS([strlcat strlcpy strndup strnlen strsep strtonum])
|
AC_CHECK_FUNCS([strlcat strlcpy strndup strnlen strsep strtonum])
|
||||||
|
AC_CHECK_FUNCS([timegm _mkgmtime])
|
||||||
AM_CONDITIONAL([HAVE_ASPRINTF], [test "x$ac_cv_func_asprintf" = xyes])
|
AM_CONDITIONAL([HAVE_ASPRINTF], [test "x$ac_cv_func_asprintf" = xyes])
|
||||||
AM_CONDITIONAL([HAVE_INET_PTON], [test "x$ac_cv_func_inet_pton" = xyes])
|
AM_CONDITIONAL([HAVE_INET_PTON], [test "x$ac_cv_func_inet_pton" = xyes])
|
||||||
AM_CONDITIONAL([HAVE_MEMMEM], [test "x$ac_cv_func_memmem" = xyes])
|
AM_CONDITIONAL([HAVE_MEMMEM], [test "x$ac_cv_func_memmem" = xyes])
|
||||||
AM_CONDITIONAL([HAVE_POLL], [test "x$ac_cv_func_poll" = xyes])
|
AM_CONDITIONAL([HAVE_READPASSPHRASE], [test "x$ac_cv_func_readpassphrase" = xyes])
|
||||||
AM_CONDITIONAL([HAVE_REALLOCARRAY], [test "x$ac_cv_func_reallocarray" = xyes])
|
AM_CONDITIONAL([HAVE_REALLOCARRAY], [test "x$ac_cv_func_reallocarray" = xyes])
|
||||||
AM_CONDITIONAL([HAVE_STRLCAT], [test "x$ac_cv_func_strlcat" = xyes])
|
AM_CONDITIONAL([HAVE_STRLCAT], [test "x$ac_cv_func_strlcat" = xyes])
|
||||||
AM_CONDITIONAL([HAVE_STRLCPY], [test "x$ac_cv_func_strlcpy" = xyes])
|
AM_CONDITIONAL([HAVE_STRLCPY], [test "x$ac_cv_func_strlcpy" = xyes])
|
||||||
@@ -13,13 +16,87 @@ AM_CONDITIONAL([HAVE_STRNDUP], [test "x$ac_cv_func_strndup" = xyes])
|
|||||||
AM_CONDITIONAL([HAVE_STRNLEN], [test "x$ac_cv_func_strnlen" = xyes])
|
AM_CONDITIONAL([HAVE_STRNLEN], [test "x$ac_cv_func_strnlen" = xyes])
|
||||||
AM_CONDITIONAL([HAVE_STRSEP], [test "x$ac_cv_func_strsep" = xyes])
|
AM_CONDITIONAL([HAVE_STRSEP], [test "x$ac_cv_func_strsep" = xyes])
|
||||||
AM_CONDITIONAL([HAVE_STRTONUM], [test "x$ac_cv_func_strtonum" = xyes])
|
AM_CONDITIONAL([HAVE_STRTONUM], [test "x$ac_cv_func_strtonum" = xyes])
|
||||||
|
AM_CONDITIONAL([HAVE_TIMEGM], [test "x$ac_cv_func_timegm" = xyes])
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_DEFUN([CHECK_SYSCALL_COMPAT], [
|
||||||
|
AC_CHECK_FUNCS([accept4 pledge poll])
|
||||||
|
AM_CONDITIONAL([HAVE_ACCEPT4], [test "x$ac_cv_func_accept4" = xyes])
|
||||||
|
AM_CONDITIONAL([HAVE_PLEDGE], [test "x$ac_cv_func_pledge" = xyes])
|
||||||
|
AM_CONDITIONAL([HAVE_POLL], [test "x$ac_cv_func_poll" = xyes])
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_DEFUN([CHECK_B64_NTOP], [
|
||||||
|
AC_SEARCH_LIBS([b64_ntop],[resolv])
|
||||||
|
AC_SEARCH_LIBS([__b64_ntop],[resolv])
|
||||||
|
AC_CACHE_CHECK([for b64_ntop], ac_cv_have_b64_ntop_arg, [
|
||||||
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <resolv.h>
|
||||||
|
]], [[ b64_ntop(NULL, 0, NULL, 0); ]])],
|
||||||
|
[ ac_cv_have_b64_ntop_arg="yes" ],
|
||||||
|
[ ac_cv_have_b64_ntop_arg="no"
|
||||||
|
])
|
||||||
|
])
|
||||||
|
AM_CONDITIONAL([HAVE_B64_NTOP], [test "x$ac_cv_func_b64_ntop_arg" = xyes])
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_DEFUN([CHECK_CRYPTO_COMPAT], [
|
||||||
|
# Check crypto-related libc functions and syscalls
|
||||||
|
AC_CHECK_FUNCS([arc4random arc4random_buf arc4random_uniform])
|
||||||
|
AC_CHECK_FUNCS([explicit_bzero getauxval])
|
||||||
|
|
||||||
|
AC_CACHE_CHECK([for getentropy], ac_cv_func_getentropy, [
|
||||||
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Explanation:
|
||||||
|
*
|
||||||
|
* - iOS <= 10.1 fails because of missing sys/random.h
|
||||||
|
*
|
||||||
|
* - in macOS 10.12 getentropy is not tagged as introduced in
|
||||||
|
* 10.12 so we cannot use it for target < 10.12
|
||||||
|
*/
|
||||||
|
#ifdef __APPLE__
|
||||||
|
# include <AvailabilityMacros.h>
|
||||||
|
# include <TargetConditionals.h>
|
||||||
|
|
||||||
|
# if (TARGET_OS_IPHONE || TARGET_OS_SIMULATOR)
|
||||||
|
# include <sys/random.h> /* Not available as of iOS <= 10.1 */
|
||||||
|
# else
|
||||||
|
|
||||||
|
# include <sys/random.h> /* Pre 10.12 systems should die here */
|
||||||
|
|
||||||
|
/* Based on: https://gitweb.torproject.org/tor.git/commit/?id=16fcbd21 */
|
||||||
|
# ifndef MAC_OS_X_VERSION_10_12
|
||||||
|
# define MAC_OS_X_VERSION_10_12 101200 /* Robustness */
|
||||||
|
# endif
|
||||||
|
# if defined(MAC_OS_X_VERSION_MIN_REQUIRED)
|
||||||
|
# if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12
|
||||||
|
# error "Targeting on Mac OSX 10.11 or earlier"
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# endif
|
||||||
|
#endif /* __APPLE__ */
|
||||||
|
]], [[
|
||||||
|
char buffer;
|
||||||
|
(void)getentropy(&buffer, sizeof (buffer));
|
||||||
|
]])],
|
||||||
|
[ ac_cv_func_getentropy="yes" ],
|
||||||
|
[ ac_cv_func_getentropy="no"
|
||||||
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
AC_DEFUN([CHECK_LIBC_CRYPTO_COMPAT], [
|
|
||||||
# Check crypto-related libc functions
|
|
||||||
AC_CHECK_FUNCS([arc4random_buf explicit_bzero getauxval getentropy])
|
|
||||||
AC_CHECK_FUNCS([timingsafe_bcmp timingsafe_memcmp])
|
AC_CHECK_FUNCS([timingsafe_bcmp timingsafe_memcmp])
|
||||||
|
AM_CONDITIONAL([HAVE_ARC4RANDOM], [test "x$ac_cv_func_arc4random" = xyes])
|
||||||
AM_CONDITIONAL([HAVE_ARC4RANDOM_BUF], [test "x$ac_cv_func_arc4random_buf" = xyes])
|
AM_CONDITIONAL([HAVE_ARC4RANDOM_BUF], [test "x$ac_cv_func_arc4random_buf" = xyes])
|
||||||
|
AM_CONDITIONAL([HAVE_ARC4RANDOM_UNIFORM], [test "x$ac_cv_func_arc4random_uniform" = xyes])
|
||||||
AM_CONDITIONAL([HAVE_EXPLICIT_BZERO], [test "x$ac_cv_func_explicit_bzero" = xyes])
|
AM_CONDITIONAL([HAVE_EXPLICIT_BZERO], [test "x$ac_cv_func_explicit_bzero" = xyes])
|
||||||
AM_CONDITIONAL([HAVE_GETENTROPY], [test "x$ac_cv_func_getentropy" = xyes])
|
AM_CONDITIONAL([HAVE_GETENTROPY], [test "x$ac_cv_func_getentropy" = xyes])
|
||||||
AM_CONDITIONAL([HAVE_TIMINGSAFE_BCMP], [test "x$ac_cv_func_timingsafe_bcmp" = xyes])
|
AM_CONDITIONAL([HAVE_TIMINGSAFE_BCMP], [test "x$ac_cv_func_timingsafe_bcmp" = xyes])
|
||||||
@@ -27,15 +104,15 @@ AM_CONDITIONAL([HAVE_TIMINGSAFE_MEMCMP], [test "x$ac_cv_func_timingsafe_memcmp"
|
|||||||
|
|
||||||
# Override arc4random_buf implementations with known issues
|
# Override arc4random_buf implementations with known issues
|
||||||
AM_CONDITIONAL([HAVE_ARC4RANDOM_BUF],
|
AM_CONDITIONAL([HAVE_ARC4RANDOM_BUF],
|
||||||
[test "x$HOST_OS" != xdarwin \
|
[test "x$USE_BUILTIN_ARC4RANDOM" != xyes \
|
||||||
-a "x$HOST_OS" != xfreebsd \
|
|
||||||
-a "x$HOST_OS" != xnetbsd \
|
|
||||||
-a "x$ac_cv_func_arc4random_buf" = xyes])
|
-a "x$ac_cv_func_arc4random_buf" = xyes])
|
||||||
|
|
||||||
# Check for getentropy fallback dependencies
|
# Check for getentropy fallback dependencies
|
||||||
AC_CHECK_FUNC([getauxval])
|
AC_CHECK_FUNC([getauxval])
|
||||||
AC_CHECK_FUNC([clock_gettime],, [AC_SEARCH_LIBS([clock_gettime],[rt posix4])])
|
AC_SEARCH_LIBS([clock_gettime],[rt posix4])
|
||||||
AC_CHECK_FUNC([dl_iterate_phdr],, [AC_SEARCH_LIBS([dl_iterate_phdr],[dl])])
|
AC_CHECK_FUNC([clock_gettime])
|
||||||
|
AC_SEARCH_LIBS([dl_iterate_phdr],[dl])
|
||||||
|
AC_CHECK_FUNC([dl_iterate_phdr])
|
||||||
])
|
])
|
||||||
|
|
||||||
AC_DEFUN([CHECK_VA_COPY], [
|
AC_DEFUN([CHECK_VA_COPY], [
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
# This must be called before AC_PROG_CC
|
|
||||||
AC_DEFUN([CHECK_OS_OPTIONS], [
|
AC_DEFUN([CHECK_OS_OPTIONS], [
|
||||||
|
|
||||||
CFLAGS="$CFLAGS -Wall -std=gnu99"
|
CFLAGS="$CFLAGS -Wall -std=gnu99 -fno-strict-aliasing"
|
||||||
|
BUILD_NC=yes
|
||||||
|
|
||||||
case $host_os in
|
case $host_os in
|
||||||
*aix*)
|
*aix*)
|
||||||
HOST_OS=aix
|
HOST_OS=aix
|
||||||
if test "`echo $CC | cut -d ' ' -f 1`" != "gcc" ; then
|
if test "`echo $CC | cut -d ' ' -f 1`" != "gcc" ; then
|
||||||
CFLAGS="$USER_CFLAGS"
|
CFLAGS="-qnoansialias $USER_CFLAGS"
|
||||||
fi
|
fi
|
||||||
AC_SUBST([PLATFORM_LDADD], ['-lperfstat -lpthread'])
|
AC_SUBST([PLATFORM_LDADD], ['-lperfstat -lpthread'])
|
||||||
;;
|
;;
|
||||||
@@ -17,10 +17,52 @@ case $host_os in
|
|||||||
*darwin*)
|
*darwin*)
|
||||||
HOST_OS=darwin
|
HOST_OS=darwin
|
||||||
HOST_ABI=macosx
|
HOST_ABI=macosx
|
||||||
|
#
|
||||||
|
# Don't use arc4random on systems before 10.12 because of
|
||||||
|
# weak seed on failure to open /dev/random, based on latest
|
||||||
|
# public source:
|
||||||
|
# http://www.opensource.apple.com/source/Libc/Libc-997.90.3/gen/FreeBSD/arc4random.c
|
||||||
|
#
|
||||||
|
# We use the presence of getentropy() to detect 10.12. The
|
||||||
|
# following check take into account that:
|
||||||
|
#
|
||||||
|
# - iOS <= 10.1 fails because of missing getentropy and
|
||||||
|
# hence they miss sys/random.h
|
||||||
|
#
|
||||||
|
# - in macOS 10.12 getentropy is not tagged as introduced in
|
||||||
|
# 10.12 so we cannot use it for target < 10.12
|
||||||
|
#
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||||
|
#include <AvailabilityMacros.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/random.h> /* Systems without getentropy() should die here */
|
||||||
|
|
||||||
|
/* Based on: https://gitweb.torproject.org/tor.git/commit/?id=16fcbd21 */
|
||||||
|
#ifndef MAC_OS_X_VERSION_10_12
|
||||||
|
# define MAC_OS_X_VERSION_10_12 101200
|
||||||
|
#endif
|
||||||
|
#if defined(MAC_OS_X_VERSION_MIN_REQUIRED)
|
||||||
|
# if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12
|
||||||
|
# error "Running on Mac OSX 10.11 or earlier"
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
]], [[
|
||||||
|
char buf[1]; getentropy(buf, 1);
|
||||||
|
]])],
|
||||||
|
[ USE_BUILTIN_ARC4RANDOM=no ],
|
||||||
|
[ USE_BUILTIN_ARC4RANDOM=yes ]
|
||||||
|
)
|
||||||
|
AC_MSG_CHECKING([whether to use builtin arc4random])
|
||||||
|
AC_MSG_RESULT([$USE_BUILTIN_ARC4RANDOM])
|
||||||
|
# Not available on iOS
|
||||||
|
AC_CHECK_HEADER([arpa/telnet.h], [], [BUILD_NC=no])
|
||||||
;;
|
;;
|
||||||
*freebsd*)
|
*freebsd*)
|
||||||
HOST_OS=freebsd
|
HOST_OS=freebsd
|
||||||
HOST_ABI=elf
|
HOST_ABI=elf
|
||||||
|
# fork detection missing, weak seed on failure
|
||||||
|
# https://svnweb.freebsd.org/base/head/lib/libc/gen/arc4random.c?revision=268642&view=markup
|
||||||
|
USE_BUILTIN_ARC4RANDOM=yes
|
||||||
AC_SUBST([PROG_LDADD], ['-lthr'])
|
AC_SUBST([PROG_LDADD], ['-lthr'])
|
||||||
;;
|
;;
|
||||||
*hpux*)
|
*hpux*)
|
||||||
@@ -28,7 +70,7 @@ case $host_os in
|
|||||||
if test "`echo $CC | cut -d ' ' -f 1`" = "gcc" ; then
|
if test "`echo $CC | cut -d ' ' -f 1`" = "gcc" ; then
|
||||||
CFLAGS="$CFLAGS -mlp64"
|
CFLAGS="$CFLAGS -mlp64"
|
||||||
else
|
else
|
||||||
CFLAGS="-g -O2 +DD64 $USER_CFLAGS"
|
CFLAGS="-g -O2 +DD64 +Otype_safety=off $USER_CFLAGS"
|
||||||
fi
|
fi
|
||||||
CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600 -D__STRICT_ALIGNMENT"
|
CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600 -D__STRICT_ALIGNMENT"
|
||||||
AC_SUBST([PLATFORM_LDADD], ['-lpthread'])
|
AC_SUBST([PLATFORM_LDADD], ['-lpthread'])
|
||||||
@@ -40,18 +82,30 @@ case $host_os in
|
|||||||
;;
|
;;
|
||||||
*netbsd*)
|
*netbsd*)
|
||||||
HOST_OS=netbsd
|
HOST_OS=netbsd
|
||||||
|
HOST_ABI=elf
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||||
|
#include <sys/param.h>
|
||||||
|
#if __NetBSD_Version__ < 700000001
|
||||||
|
undefined
|
||||||
|
#endif
|
||||||
|
]], [[]])],
|
||||||
|
[ USE_BUILTIN_ARC4RANDOM=no ],
|
||||||
|
[ USE_BUILTIN_ARC4RANDOM=yes ]
|
||||||
|
)
|
||||||
CPPFLAGS="$CPPFLAGS -D_OPENBSD_SOURCE"
|
CPPFLAGS="$CPPFLAGS -D_OPENBSD_SOURCE"
|
||||||
;;
|
;;
|
||||||
*openbsd* | *bitrig*)
|
*openbsd* | *bitrig*)
|
||||||
|
HOST_OS=openbsd
|
||||||
HOST_ABI=elf
|
HOST_ABI=elf
|
||||||
AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD gcc has bounded])
|
AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD gcc has bounded])
|
||||||
;;
|
;;
|
||||||
*mingw*)
|
*mingw*)
|
||||||
HOST_OS=win
|
HOST_OS=win
|
||||||
|
BUILD_NC=no
|
||||||
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE -D_POSIX -D_POSIX_SOURCE -D__USE_MINGW_ANSI_STDIO"
|
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE -D_POSIX -D_POSIX_SOURCE -D__USE_MINGW_ANSI_STDIO"
|
||||||
CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_THREAD_SAFE_FUNCTIONS"
|
CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_THREAD_SAFE_FUNCTIONS"
|
||||||
CPPFLAGS="$CPPFLAGS -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0501"
|
CPPFLAGS="$CPPFLAGS -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0501"
|
||||||
CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_SPEED -DNO_SYSLOG"
|
CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_SPEED"
|
||||||
CFLAGS="$CFLAGS -static-libgcc"
|
CFLAGS="$CFLAGS -static-libgcc"
|
||||||
LDFLAGS="$LDFLAGS -static-libgcc"
|
LDFLAGS="$LDFLAGS -static-libgcc"
|
||||||
AC_SUBST([PLATFORM_LDADD], ['-lws2_32'])
|
AC_SUBST([PLATFORM_LDADD], ['-lws2_32'])
|
||||||
@@ -65,6 +119,11 @@ case $host_os in
|
|||||||
*) ;;
|
*) ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
AC_ARG_ENABLE([nc],
|
||||||
|
AS_HELP_STRING([--enable-nc], [Enable installing TLS-enabled nc(1)]))
|
||||||
|
AM_CONDITIONAL([ENABLE_NC], [test "x$enable_nc" = xyes])
|
||||||
|
AM_CONDITIONAL([BUILD_NC], [test x$BUILD_NC = xyes -o "x$enable_nc" = xyes])
|
||||||
|
|
||||||
AM_CONDITIONAL([HOST_AIX], [test x$HOST_OS = xaix])
|
AM_CONDITIONAL([HOST_AIX], [test x$HOST_OS = xaix])
|
||||||
AM_CONDITIONAL([HOST_CYGWIN], [test x$HOST_OS = xcygwin])
|
AM_CONDITIONAL([HOST_CYGWIN], [test x$HOST_OS = xcygwin])
|
||||||
AM_CONDITIONAL([HOST_DARWIN], [test x$HOST_OS = xdarwin])
|
AM_CONDITIONAL([HOST_DARWIN], [test x$HOST_OS = xdarwin])
|
||||||
@@ -72,6 +131,7 @@ AM_CONDITIONAL([HOST_FREEBSD], [test x$HOST_OS = xfreebsd])
|
|||||||
AM_CONDITIONAL([HOST_HPUX], [test x$HOST_OS = xhpux])
|
AM_CONDITIONAL([HOST_HPUX], [test x$HOST_OS = xhpux])
|
||||||
AM_CONDITIONAL([HOST_LINUX], [test x$HOST_OS = xlinux])
|
AM_CONDITIONAL([HOST_LINUX], [test x$HOST_OS = xlinux])
|
||||||
AM_CONDITIONAL([HOST_NETBSD], [test x$HOST_OS = xnetbsd])
|
AM_CONDITIONAL([HOST_NETBSD], [test x$HOST_OS = xnetbsd])
|
||||||
|
AM_CONDITIONAL([HOST_OPENBSD], [test x$HOST_OS = xopenbsd])
|
||||||
AM_CONDITIONAL([HOST_SOLARIS], [test x$HOST_OS = xsolaris])
|
AM_CONDITIONAL([HOST_SOLARIS], [test x$HOST_OS = xsolaris])
|
||||||
AM_CONDITIONAL([HOST_WIN], [test x$HOST_OS = xwin])
|
AM_CONDITIONAL([HOST_WIN], [test x$HOST_OS = xwin])
|
||||||
])
|
])
|
||||||
|
9
man/CMakeLists.txt
Normal file
9
man/CMakeLists.txt
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
install(DIRECTORY .
|
||||||
|
DESTINATION share/man/man3
|
||||||
|
FILES_MATCHING PATTERN "*.3"
|
||||||
|
)
|
||||||
|
|
||||||
|
install(DIRECTORY .
|
||||||
|
DESTINATION share/man/man1
|
||||||
|
FILES_MATCHING PATTERN "*.1"
|
||||||
|
)
|
223
man/links
223
man/links
@@ -230,6 +230,8 @@ CRYPTO_set_locking_callback.3,CRYPTO_THREADID_current.3
|
|||||||
CRYPTO_set_locking_callback.3,CRYPTO_THREADID_get_callback.3
|
CRYPTO_set_locking_callback.3,CRYPTO_THREADID_get_callback.3
|
||||||
CRYPTO_set_locking_callback.3,CRYPTO_THREADID_hash.3
|
CRYPTO_set_locking_callback.3,CRYPTO_THREADID_hash.3
|
||||||
CRYPTO_set_locking_callback.3,CRYPTO_THREADID_set_callback.3
|
CRYPTO_set_locking_callback.3,CRYPTO_THREADID_set_callback.3
|
||||||
|
CRYPTO_set_locking_callback.3,CRYPTO_THREADID_set_numeric.3
|
||||||
|
CRYPTO_set_locking_callback.3,CRYPTO_THREADID_set_pointer.3
|
||||||
CRYPTO_set_locking_callback.3,CRYPTO_add.3
|
CRYPTO_set_locking_callback.3,CRYPTO_add.3
|
||||||
CRYPTO_set_locking_callback.3,CRYPTO_add_lock.3
|
CRYPTO_set_locking_callback.3,CRYPTO_add_lock.3
|
||||||
CRYPTO_set_locking_callback.3,CRYPTO_destroy_dynlockid.3
|
CRYPTO_set_locking_callback.3,CRYPTO_destroy_dynlockid.3
|
||||||
@@ -301,6 +303,24 @@ DSA_set_method.3,DSA_set_default_method.3
|
|||||||
DSA_set_method.3,DSA_set_default_openssl_method.3
|
DSA_set_method.3,DSA_set_default_openssl_method.3
|
||||||
DSA_sign.3,DSA_sign_setup.3
|
DSA_sign.3,DSA_sign_setup.3
|
||||||
DSA_sign.3,DSA_verify.3
|
DSA_sign.3,DSA_verify.3
|
||||||
|
ECDSA_SIG_new.3,ECDSA_OpenSSL.3
|
||||||
|
ECDSA_SIG_new.3,ECDSA_SIG_free.3
|
||||||
|
ECDSA_SIG_new.3,ECDSA_do_sign.3
|
||||||
|
ECDSA_SIG_new.3,ECDSA_do_sign_ex.3
|
||||||
|
ECDSA_SIG_new.3,ECDSA_do_verify.3
|
||||||
|
ECDSA_SIG_new.3,ECDSA_get_default_method.3
|
||||||
|
ECDSA_SIG_new.3,ECDSA_get_ex_data.3
|
||||||
|
ECDSA_SIG_new.3,ECDSA_get_ex_new_index.3
|
||||||
|
ECDSA_SIG_new.3,ECDSA_set_default_method.3
|
||||||
|
ECDSA_SIG_new.3,ECDSA_set_ex_data.3
|
||||||
|
ECDSA_SIG_new.3,ECDSA_set_method.3
|
||||||
|
ECDSA_SIG_new.3,ECDSA_sign.3
|
||||||
|
ECDSA_SIG_new.3,ECDSA_sign_ex.3
|
||||||
|
ECDSA_SIG_new.3,ECDSA_sign_setup.3
|
||||||
|
ECDSA_SIG_new.3,ECDSA_size.3
|
||||||
|
ECDSA_SIG_new.3,ECDSA_verify.3
|
||||||
|
ECDSA_SIG_new.3,d2i_ECDSA_SIG.3
|
||||||
|
ECDSA_SIG_new.3,i2d_ECDSA_SIG.3
|
||||||
EC_GFp_simple_method.3,EC_GF2m_simple_method.3
|
EC_GFp_simple_method.3,EC_GF2m_simple_method.3
|
||||||
EC_GFp_simple_method.3,EC_GFp_mont_method.3
|
EC_GFp_simple_method.3,EC_GFp_mont_method.3
|
||||||
EC_GFp_simple_method.3,EC_GFp_nist_method.3
|
EC_GFp_simple_method.3,EC_GFp_nist_method.3
|
||||||
@@ -418,6 +438,17 @@ ERR_print_errors.3,ERR_print_errors_fp.3
|
|||||||
ERR_put_error.3,ERR_add_error_data.3
|
ERR_put_error.3,ERR_add_error_data.3
|
||||||
ERR_remove_state.3,ERR_remove_thread_state.3
|
ERR_remove_state.3,ERR_remove_thread_state.3
|
||||||
ERR_set_mark.3,ERR_pop_to_mark.3
|
ERR_set_mark.3,ERR_pop_to_mark.3
|
||||||
|
EVP_AEAD_CTX_init.3,EVP_AEAD_CTX_cleanup.3
|
||||||
|
EVP_AEAD_CTX_init.3,EVP_AEAD_CTX_open.3
|
||||||
|
EVP_AEAD_CTX_init.3,EVP_AEAD_CTX_seal.3
|
||||||
|
EVP_AEAD_CTX_init.3,EVP_AEAD_key_length.3
|
||||||
|
EVP_AEAD_CTX_init.3,EVP_AEAD_max_overhead.3
|
||||||
|
EVP_AEAD_CTX_init.3,EVP_AEAD_max_tag_len.3
|
||||||
|
EVP_AEAD_CTX_init.3,EVP_AEAD_nonce_length.3
|
||||||
|
EVP_AEAD_CTX_init.3,EVP_aead_aes_128_gcm.3
|
||||||
|
EVP_AEAD_CTX_init.3,EVP_aead_aes_256_gcm.3
|
||||||
|
EVP_AEAD_CTX_init.3,EVP_aead_chacha20_poly1305.3
|
||||||
|
EVP_AEAD_CTX_init.3,EVP_aead_chacha20_poly1305_ietf.3
|
||||||
EVP_DigestInit.3,EVP_DigestFinal.3
|
EVP_DigestInit.3,EVP_DigestFinal.3
|
||||||
EVP_DigestInit.3,EVP_DigestFinal_ex.3
|
EVP_DigestInit.3,EVP_DigestFinal_ex.3
|
||||||
EVP_DigestInit.3,EVP_DigestInit_ex.3
|
EVP_DigestInit.3,EVP_DigestInit_ex.3
|
||||||
@@ -445,9 +476,7 @@ EVP_DigestInit.3,EVP_get_digestbyobj.3
|
|||||||
EVP_DigestInit.3,EVP_md2.3
|
EVP_DigestInit.3,EVP_md2.3
|
||||||
EVP_DigestInit.3,EVP_md5.3
|
EVP_DigestInit.3,EVP_md5.3
|
||||||
EVP_DigestInit.3,EVP_md_null.3
|
EVP_DigestInit.3,EVP_md_null.3
|
||||||
EVP_DigestInit.3,EVP_mdc2.3
|
|
||||||
EVP_DigestInit.3,EVP_ripemd160.3
|
EVP_DigestInit.3,EVP_ripemd160.3
|
||||||
EVP_DigestInit.3,EVP_sha.3
|
|
||||||
EVP_DigestInit.3,EVP_sha1.3
|
EVP_DigestInit.3,EVP_sha1.3
|
||||||
EVP_DigestInit.3,EVP_sha224.3
|
EVP_DigestInit.3,EVP_sha224.3
|
||||||
EVP_DigestInit.3,EVP_sha256.3
|
EVP_DigestInit.3,EVP_sha256.3
|
||||||
@@ -554,7 +583,6 @@ EVP_PKEY_CTX_ctrl.3,EVP_PKEY_CTX_set_rsa_padding.3
|
|||||||
EVP_PKEY_CTX_ctrl.3,EVP_PKEY_CTX_set_rsa_pss_saltlen.3
|
EVP_PKEY_CTX_ctrl.3,EVP_PKEY_CTX_set_rsa_pss_saltlen.3
|
||||||
EVP_PKEY_CTX_ctrl.3,EVP_PKEY_CTX_set_rsa_rsa_keygen_bits.3
|
EVP_PKEY_CTX_ctrl.3,EVP_PKEY_CTX_set_rsa_rsa_keygen_bits.3
|
||||||
EVP_PKEY_CTX_ctrl.3,EVP_PKEY_CTX_set_signature_md.3
|
EVP_PKEY_CTX_ctrl.3,EVP_PKEY_CTX_set_signature_md.3
|
||||||
EVP_PKEY_CTX_ctrl.3,EVP_PKEY_ctrl_str.3
|
|
||||||
EVP_PKEY_CTX_ctrl.3,EVP_PKEY_get_default_digest_nid.3
|
EVP_PKEY_CTX_ctrl.3,EVP_PKEY_get_default_digest_nid.3
|
||||||
EVP_PKEY_CTX_new.3,EVP_PKEY_CTX_dup.3
|
EVP_PKEY_CTX_new.3,EVP_PKEY_CTX_dup.3
|
||||||
EVP_PKEY_CTX_new.3,EVP_PKEY_CTX_free.3
|
EVP_PKEY_CTX_new.3,EVP_PKEY_CTX_free.3
|
||||||
@@ -567,7 +595,6 @@ EVP_PKEY_derive.3,EVP_PKEY_derive_init.3
|
|||||||
EVP_PKEY_derive.3,EVP_PKEY_derive_set_peer.3
|
EVP_PKEY_derive.3,EVP_PKEY_derive_set_peer.3
|
||||||
EVP_PKEY_encrypt.3,EVP_PKEY_encrypt_init.3
|
EVP_PKEY_encrypt.3,EVP_PKEY_encrypt_init.3
|
||||||
EVP_PKEY_get_default_digest.3,EVP_PKEY_get_default_digest_nid.3
|
EVP_PKEY_get_default_digest.3,EVP_PKEY_get_default_digest_nid.3
|
||||||
EVP_PKEY_keygen.3,EVP_PKEVP_PKEY_CTX_set_app_data.3
|
|
||||||
EVP_PKEY_keygen.3,EVP_PKEY_CTX_get_app_data.3
|
EVP_PKEY_keygen.3,EVP_PKEY_CTX_get_app_data.3
|
||||||
EVP_PKEY_keygen.3,EVP_PKEY_CTX_get_cb.3
|
EVP_PKEY_keygen.3,EVP_PKEY_CTX_get_cb.3
|
||||||
EVP_PKEY_keygen.3,EVP_PKEY_CTX_get_keygen_info.3
|
EVP_PKEY_keygen.3,EVP_PKEY_CTX_get_keygen_info.3
|
||||||
@@ -738,7 +765,6 @@ RSA_print.3,DSAparams_print_fp.3
|
|||||||
RSA_print.3,RSA_print_fp.3
|
RSA_print.3,RSA_print_fp.3
|
||||||
RSA_private_encrypt.3,RSA_public_decrypt.3
|
RSA_private_encrypt.3,RSA_public_decrypt.3
|
||||||
RSA_public_encrypt.3,RSA_private_decrypt.3
|
RSA_public_encrypt.3,RSA_private_decrypt.3
|
||||||
RSA_set_method.3,RSA_PKCS1_RSAref.3
|
|
||||||
RSA_set_method.3,RSA_PKCS1_SSLeay.3
|
RSA_set_method.3,RSA_PKCS1_SSLeay.3
|
||||||
RSA_set_method.3,RSA_flags.3
|
RSA_set_method.3,RSA_flags.3
|
||||||
RSA_set_method.3,RSA_get_default_method.3
|
RSA_set_method.3,RSA_get_default_method.3
|
||||||
@@ -798,7 +824,6 @@ SSL_CTX_sess_set_get_cb.3,SSL_CTX_sess_get_get_cb.3
|
|||||||
SSL_CTX_sess_set_get_cb.3,SSL_CTX_sess_get_new_cb.3
|
SSL_CTX_sess_set_get_cb.3,SSL_CTX_sess_get_new_cb.3
|
||||||
SSL_CTX_sess_set_get_cb.3,SSL_CTX_sess_get_remove_cb.3
|
SSL_CTX_sess_set_get_cb.3,SSL_CTX_sess_get_remove_cb.3
|
||||||
SSL_CTX_sess_set_get_cb.3,SSL_CTX_sess_set_new_cb.3
|
SSL_CTX_sess_set_get_cb.3,SSL_CTX_sess_set_new_cb.3
|
||||||
SSL_CTX_sess_set_get_cb.3,SSL_CTX_sess_set_remove.3
|
|
||||||
SSL_CTX_sess_set_get_cb.3,SSL_CTX_sess_set_remove_cb.3
|
SSL_CTX_sess_set_get_cb.3,SSL_CTX_sess_set_remove_cb.3
|
||||||
SSL_CTX_sess_set_get_cb.3,get_session_cb.3
|
SSL_CTX_sess_set_get_cb.3,get_session_cb.3
|
||||||
SSL_CTX_sess_set_get_cb.3,new_session_cb.3
|
SSL_CTX_sess_set_get_cb.3,new_session_cb.3
|
||||||
@@ -824,7 +849,6 @@ SSL_CTX_set_mode.3,SSL_CTX_get_mode.3
|
|||||||
SSL_CTX_set_mode.3,SSL_get_mode.3
|
SSL_CTX_set_mode.3,SSL_get_mode.3
|
||||||
SSL_CTX_set_mode.3,SSL_set_mode.3
|
SSL_CTX_set_mode.3,SSL_set_mode.3
|
||||||
SSL_CTX_set_msg_callback.3,SSL_CTX_set_msg_callback_arg.3
|
SSL_CTX_set_msg_callback.3,SSL_CTX_set_msg_callback_arg.3
|
||||||
SSL_CTX_set_msg_callback.3,SSL_get_msg_callback_arg.3
|
|
||||||
SSL_CTX_set_msg_callback.3,SSL_set_msg_callback.3
|
SSL_CTX_set_msg_callback.3,SSL_set_msg_callback.3
|
||||||
SSL_CTX_set_msg_callback.3,SSL_set_msg_callback_arg.3
|
SSL_CTX_set_msg_callback.3,SSL_set_msg_callback_arg.3
|
||||||
SSL_CTX_set_options.3,SSL_CTX_clear_options.3
|
SSL_CTX_set_options.3,SSL_CTX_clear_options.3
|
||||||
@@ -908,7 +932,6 @@ SSL_get_session.3,SSL_get1_session.3
|
|||||||
SSL_library_init.3,OpenSSL_add_ssl_algorithms.3
|
SSL_library_init.3,OpenSSL_add_ssl_algorithms.3
|
||||||
SSL_library_init.3,SSLeay_add_ssl_algorithms.3
|
SSL_library_init.3,SSLeay_add_ssl_algorithms.3
|
||||||
SSL_rstate_string.3,SSL_rstate_string_long.3
|
SSL_rstate_string.3,SSL_rstate_string_long.3
|
||||||
SSL_set_connect_state.3,SSL_get_accept_state.3
|
|
||||||
SSL_set_connect_state.3,SSL_set_accept_state.3
|
SSL_set_connect_state.3,SSL_set_accept_state.3
|
||||||
SSL_set_fd.3,SSL_set_rfd.3
|
SSL_set_fd.3,SSL_set_rfd.3
|
||||||
SSL_set_fd.3,SSL_set_wfd.3
|
SSL_set_fd.3,SSL_set_wfd.3
|
||||||
@@ -918,6 +941,30 @@ SSL_want.3,SSL_want_nothing.3
|
|||||||
SSL_want.3,SSL_want_read.3
|
SSL_want.3,SSL_want_read.3
|
||||||
SSL_want.3,SSL_want_write.3
|
SSL_want.3,SSL_want_write.3
|
||||||
SSL_want.3,SSL_want_x509_lookup.3
|
SSL_want.3,SSL_want_x509_lookup.3
|
||||||
|
UI_new.3,ERR_load_UI_strings.3
|
||||||
|
UI_new.3,UI_OpenSSL.3
|
||||||
|
UI_new.3,UI_add_error_string.3
|
||||||
|
UI_new.3,UI_add_info_string.3
|
||||||
|
UI_new.3,UI_add_input_boolean.3
|
||||||
|
UI_new.3,UI_add_input_string.3
|
||||||
|
UI_new.3,UI_add_user_data.3
|
||||||
|
UI_new.3,UI_add_verify_string.3
|
||||||
|
UI_new.3,UI_construct_prompt.3
|
||||||
|
UI_new.3,UI_ctrl.3
|
||||||
|
UI_new.3,UI_dup_error_string.3
|
||||||
|
UI_new.3,UI_dup_info_string.3
|
||||||
|
UI_new.3,UI_dup_input_boolean.3
|
||||||
|
UI_new.3,UI_dup_input_string.3
|
||||||
|
UI_new.3,UI_dup_verify_string.3
|
||||||
|
UI_new.3,UI_free.3
|
||||||
|
UI_new.3,UI_get0_result.3
|
||||||
|
UI_new.3,UI_get0_user_data.3
|
||||||
|
UI_new.3,UI_get_default_method.3
|
||||||
|
UI_new.3,UI_get_method.3
|
||||||
|
UI_new.3,UI_new_method.3
|
||||||
|
UI_new.3,UI_process.3
|
||||||
|
UI_new.3,UI_set_default_method.3
|
||||||
|
UI_new.3,UI_set_method.3
|
||||||
X509_NAME_ENTRY_get_object.3,X509_NAME_ENTRY_create_by_NID.3
|
X509_NAME_ENTRY_get_object.3,X509_NAME_ENTRY_create_by_NID.3
|
||||||
X509_NAME_ENTRY_get_object.3,X509_NAME_ENTRY_create_by_OBJ.3
|
X509_NAME_ENTRY_get_object.3,X509_NAME_ENTRY_create_by_OBJ.3
|
||||||
X509_NAME_ENTRY_get_object.3,X509_NAME_ENTRY_create_by_txt.3
|
X509_NAME_ENTRY_get_object.3,X509_NAME_ENTRY_create_by_txt.3
|
||||||
@@ -964,38 +1011,37 @@ X509_VERIFY_PARAM_set_flags.3,X509_VERIFY_PARAM_set_purpose.3
|
|||||||
X509_VERIFY_PARAM_set_flags.3,X509_VERIFY_PARAM_set_time.3
|
X509_VERIFY_PARAM_set_flags.3,X509_VERIFY_PARAM_set_time.3
|
||||||
X509_VERIFY_PARAM_set_flags.3,X509_VERIFY_PARAM_set_trust.3
|
X509_VERIFY_PARAM_set_flags.3,X509_VERIFY_PARAM_set_trust.3
|
||||||
X509_new.3,X509_free.3
|
X509_new.3,X509_free.3
|
||||||
bn_internal.3,bn_add_words.3
|
bn_dump.3,bn_add_words.3
|
||||||
bn_internal.3,bn_check_top.3
|
bn_dump.3,bn_check_top.3
|
||||||
bn_internal.3,bn_cmp_words.3
|
bn_dump.3,bn_cmp_words.3
|
||||||
bn_internal.3,bn_div_words.3
|
bn_dump.3,bn_div_words.3
|
||||||
bn_internal.3,bn_dump.3
|
bn_dump.3,bn_expand.3
|
||||||
bn_internal.3,bn_expand.3
|
bn_dump.3,bn_expand2.3
|
||||||
bn_internal.3,bn_expand2.3
|
bn_dump.3,bn_fix_top.3
|
||||||
bn_internal.3,bn_fix_top.3
|
bn_dump.3,bn_mul_add_words.3
|
||||||
bn_internal.3,bn_mul_add_words.3
|
bn_dump.3,bn_mul_comba4.3
|
||||||
bn_internal.3,bn_mul_comba4.3
|
bn_dump.3,bn_mul_comba8.3
|
||||||
bn_internal.3,bn_mul_comba8.3
|
bn_dump.3,bn_mul_high.3
|
||||||
bn_internal.3,bn_mul_high.3
|
bn_dump.3,bn_mul_low_normal.3
|
||||||
bn_internal.3,bn_mul_low_normal.3
|
bn_dump.3,bn_mul_low_recursive.3
|
||||||
bn_internal.3,bn_mul_low_recursive.3
|
bn_dump.3,bn_mul_normal.3
|
||||||
bn_internal.3,bn_mul_normal.3
|
bn_dump.3,bn_mul_part_recursive.3
|
||||||
bn_internal.3,bn_mul_part_recursive.3
|
bn_dump.3,bn_mul_recursive.3
|
||||||
bn_internal.3,bn_mul_recursive.3
|
bn_dump.3,bn_mul_words.3
|
||||||
bn_internal.3,bn_mul_words.3
|
bn_dump.3,bn_print.3
|
||||||
bn_internal.3,bn_print.3
|
bn_dump.3,bn_set_high.3
|
||||||
bn_internal.3,bn_set_high.3
|
bn_dump.3,bn_set_low.3
|
||||||
bn_internal.3,bn_set_low.3
|
bn_dump.3,bn_set_max.3
|
||||||
bn_internal.3,bn_set_max.3
|
bn_dump.3,bn_sqr_comba4.3
|
||||||
bn_internal.3,bn_sqr_comba4.3
|
bn_dump.3,bn_sqr_comba8.3
|
||||||
bn_internal.3,bn_sqr_comba8.3
|
bn_dump.3,bn_sqr_normal.3
|
||||||
bn_internal.3,bn_sqr_normal.3
|
bn_dump.3,bn_sqr_recursive.3
|
||||||
bn_internal.3,bn_sqr_recursive.3
|
bn_dump.3,bn_sqr_words.3
|
||||||
bn_internal.3,bn_sqr_words.3
|
bn_dump.3,bn_sub_words.3
|
||||||
bn_internal.3,bn_sub_words.3
|
bn_dump.3,bn_wexpand.3
|
||||||
bn_internal.3,bn_wexpand.3
|
bn_dump.3,mul.3
|
||||||
bn_internal.3,mul.3
|
bn_dump.3,mul_add.3
|
||||||
bn_internal.3,mul_add.3
|
bn_dump.3,sqr.3
|
||||||
bn_internal.3,sqr.3
|
|
||||||
crypto.3,crypto_dispatch.3
|
crypto.3,crypto_dispatch.3
|
||||||
crypto.3,crypto_done.3
|
crypto.3,crypto_done.3
|
||||||
crypto.3,crypto_freereq.3
|
crypto.3,crypto_freereq.3
|
||||||
@@ -1023,12 +1069,11 @@ d2i_ECPKParameters.3,d2i_ECPKParameters_fp.3
|
|||||||
d2i_ECPKParameters.3,i2d_ECPKParameters.3
|
d2i_ECPKParameters.3,i2d_ECPKParameters.3
|
||||||
d2i_ECPKParameters.3,i2d_ECPKParameters_bio.3
|
d2i_ECPKParameters.3,i2d_ECPKParameters_bio.3
|
||||||
d2i_ECPKParameters.3,i2d_ECPKParameters_fp.3
|
d2i_ECPKParameters.3,i2d_ECPKParameters_fp.3
|
||||||
d2i_PKCS8PrivateKey.3,d2i_PKCS8PrivateKey_bio.3
|
d2i_PKCS8PrivateKey_bio.3,d2i_PKCS8PrivateKey_fp.3
|
||||||
d2i_PKCS8PrivateKey.3,d2i_PKCS8PrivateKey_fp.3
|
d2i_PKCS8PrivateKey_bio.3,i2d_PKCS8PrivateKey_bio.3
|
||||||
d2i_PKCS8PrivateKey.3,i2d_PKCS8PrivateKey_bio.3
|
d2i_PKCS8PrivateKey_bio.3,i2d_PKCS8PrivateKey_fp.3
|
||||||
d2i_PKCS8PrivateKey.3,i2d_PKCS8PrivateKey_fp.3
|
d2i_PKCS8PrivateKey_bio.3,i2d_PKCS8PrivateKey_nid_bio.3
|
||||||
d2i_PKCS8PrivateKey.3,i2d_PKCS8PrivateKey_nid_bio.3
|
d2i_PKCS8PrivateKey_bio.3,i2d_PKCS8PrivateKey_nid_fp.3
|
||||||
d2i_PKCS8PrivateKey.3,i2d_PKCS8PrivateKey_nid_fp.3
|
|
||||||
d2i_RSAPublicKey.3,d2i_Netscape_RSA.3
|
d2i_RSAPublicKey.3,d2i_Netscape_RSA.3
|
||||||
d2i_RSAPublicKey.3,d2i_RSAPrivateKey.3
|
d2i_RSAPublicKey.3,d2i_RSAPrivateKey.3
|
||||||
d2i_RSAPublicKey.3,d2i_RSA_PUBKEY.3
|
d2i_RSAPublicKey.3,d2i_RSA_PUBKEY.3
|
||||||
@@ -1055,25 +1100,9 @@ d2i_X509_REQ.3,i2d_X509_REQ.3
|
|||||||
d2i_X509_REQ.3,i2d_X509_REQ_bio.3
|
d2i_X509_REQ.3,i2d_X509_REQ_bio.3
|
||||||
d2i_X509_REQ.3,i2d_X509_REQ_fp.3
|
d2i_X509_REQ.3,i2d_X509_REQ_fp.3
|
||||||
d2i_X509_SIG.3,i2d_X509_SIG.3
|
d2i_X509_SIG.3,i2d_X509_SIG.3
|
||||||
ecdsa.3,ECDSA_OpenSSL.3
|
des_read_pw.3,des_read_2passwords.3
|
||||||
ecdsa.3,ECDSA_SIG_free.3
|
des_read_pw.3,des_read_password.3
|
||||||
ecdsa.3,ECDSA_SIG_new.3
|
des_read_pw.3,des_read_pw_string.3
|
||||||
ecdsa.3,ECDSA_do_sign.3
|
|
||||||
ecdsa.3,ECDSA_do_sign_ex.3
|
|
||||||
ecdsa.3,ECDSA_do_verify.3
|
|
||||||
ecdsa.3,ECDSA_get_default_method.3
|
|
||||||
ecdsa.3,ECDSA_get_ex_data.3
|
|
||||||
ecdsa.3,ECDSA_get_ex_new_index.3
|
|
||||||
ecdsa.3,ECDSA_set_default_method.3
|
|
||||||
ecdsa.3,ECDSA_set_ex_data.3
|
|
||||||
ecdsa.3,ECDSA_set_method.3
|
|
||||||
ecdsa.3,ECDSA_sign.3
|
|
||||||
ecdsa.3,ECDSA_sign_ex.3
|
|
||||||
ecdsa.3,ECDSA_sign_setup.3
|
|
||||||
ecdsa.3,ECDSA_size.3
|
|
||||||
ecdsa.3,ECDSA_verify.3
|
|
||||||
ecdsa.3,d2i_ECDSA_SIG.3
|
|
||||||
ecdsa.3,i2d_ECDSA_SIG.3
|
|
||||||
engine.3,ENGINE_add.3
|
engine.3,ENGINE_add.3
|
||||||
engine.3,ENGINE_by_id.3
|
engine.3,ENGINE_by_id.3
|
||||||
engine.3,ENGINE_finish.3
|
engine.3,ENGINE_finish.3
|
||||||
@@ -1084,19 +1113,23 @@ engine.3,ENGINE_get_prev.3
|
|||||||
engine.3,ENGINE_init.3
|
engine.3,ENGINE_init.3
|
||||||
engine.3,ENGINE_load_builtin_engines.3
|
engine.3,ENGINE_load_builtin_engines.3
|
||||||
engine.3,ENGINE_remove.3
|
engine.3,ENGINE_remove.3
|
||||||
|
lh_new.3,DECLARE_LHASH_OF.3
|
||||||
|
lh_new.3,LHASH_COMP_FN_TYPE.3
|
||||||
|
lh_new.3,LHASH_DOALL_ARG_FN_TYPE.3
|
||||||
|
lh_new.3,LHASH_DOALL_FN_TYPE.3
|
||||||
|
lh_new.3,LHASH_HASH_FN_TYPE.3
|
||||||
|
lh_new.3,lh_delete.3
|
||||||
|
lh_new.3,lh_doall.3
|
||||||
|
lh_new.3,lh_doall_arg.3
|
||||||
|
lh_new.3,lh_error.3
|
||||||
|
lh_new.3,lh_free.3
|
||||||
|
lh_new.3,lh_insert.3
|
||||||
|
lh_new.3,lh_retrieve.3
|
||||||
lh_stats.3,lh_node_stats.3
|
lh_stats.3,lh_node_stats.3
|
||||||
lh_stats.3,lh_node_stats_bio.3
|
lh_stats.3,lh_node_stats_bio.3
|
||||||
lh_stats.3,lh_node_usage_stats.3
|
lh_stats.3,lh_node_usage_stats.3
|
||||||
lh_stats.3,lh_node_usage_stats_bio.3
|
lh_stats.3,lh_node_usage_stats_bio.3
|
||||||
lh_stats.3,lh_stats_bio.3
|
lh_stats.3,lh_stats_bio.3
|
||||||
lhash.3,lh_delete.3
|
|
||||||
lhash.3,lh_doall.3
|
|
||||||
lhash.3,lh_doall_arg.3
|
|
||||||
lhash.3,lh_error.3
|
|
||||||
lhash.3,lh_free.3
|
|
||||||
lhash.3,lh_insert.3
|
|
||||||
lhash.3,lh_new.3
|
|
||||||
lhash.3,lh_retrieve.3
|
|
||||||
tls_init.3,tls_accept_fds.3
|
tls_init.3,tls_accept_fds.3
|
||||||
tls_init.3,tls_accept_socket.3
|
tls_init.3,tls_accept_socket.3
|
||||||
tls_init.3,tls_client.3
|
tls_init.3,tls_client.3
|
||||||
@@ -1105,8 +1138,11 @@ tls_init.3,tls_config_clear_keys.3
|
|||||||
tls_init.3,tls_config_free.3
|
tls_init.3,tls_config_free.3
|
||||||
tls_init.3,tls_config_insecure_noverifycert.3
|
tls_init.3,tls_config_insecure_noverifycert.3
|
||||||
tls_init.3,tls_config_insecure_noverifyname.3
|
tls_init.3,tls_config_insecure_noverifyname.3
|
||||||
|
tls_init.3,tls_config_insecure_noverifytime.3
|
||||||
tls_init.3,tls_config_new.3
|
tls_init.3,tls_config_new.3
|
||||||
tls_init.3,tls_config_parse_protocols.3
|
tls_init.3,tls_config_parse_protocols.3
|
||||||
|
tls_init.3,tls_config_prefer_ciphers_client.3
|
||||||
|
tls_init.3,tls_config_prefer_ciphers_server.3
|
||||||
tls_init.3,tls_config_set_ca_file.3
|
tls_init.3,tls_config_set_ca_file.3
|
||||||
tls_init.3,tls_config_set_ca_mem.3
|
tls_init.3,tls_config_set_ca_mem.3
|
||||||
tls_init.3,tls_config_set_ca_path.3
|
tls_init.3,tls_config_set_ca_path.3
|
||||||
@@ -1120,44 +1156,27 @@ tls_init.3,tls_config_set_key_mem.3
|
|||||||
tls_init.3,tls_config_set_protocols.3
|
tls_init.3,tls_config_set_protocols.3
|
||||||
tls_init.3,tls_config_set_verify_depth.3
|
tls_init.3,tls_config_set_verify_depth.3
|
||||||
tls_init.3,tls_config_verify.3
|
tls_init.3,tls_config_verify.3
|
||||||
|
tls_init.3,tls_config_verify_client.3
|
||||||
|
tls_init.3,tls_config_verify_client_optional.3
|
||||||
tls_init.3,tls_configure.3
|
tls_init.3,tls_configure.3
|
||||||
|
tls_init.3,tls_conn_cipher.3
|
||||||
|
tls_init.3,tls_conn_version.3
|
||||||
tls_init.3,tls_connect.3
|
tls_init.3,tls_connect.3
|
||||||
tls_init.3,tls_connect_fds.3
|
tls_init.3,tls_connect_fds.3
|
||||||
tls_init.3,tls_connect_servername.3
|
tls_init.3,tls_connect_servername.3
|
||||||
tls_init.3,tls_connect_socket.3
|
tls_init.3,tls_connect_socket.3
|
||||||
tls_init.3,tls_error.3
|
tls_init.3,tls_error.3
|
||||||
tls_init.3,tls_free.3
|
tls_init.3,tls_free.3
|
||||||
|
tls_init.3,tls_handshake.3
|
||||||
tls_init.3,tls_load_file.3
|
tls_init.3,tls_load_file.3
|
||||||
|
tls_init.3,tls_peer_cert_contains_name.3
|
||||||
|
tls_init.3,tls_peer_cert_hash.3
|
||||||
|
tls_init.3,tls_peer_cert_issuer.3
|
||||||
|
tls_init.3,tls_peer_cert_notafter.3
|
||||||
|
tls_init.3,tls_peer_cert_notbefore.3
|
||||||
|
tls_init.3,tls_peer_cert_provided.3
|
||||||
|
tls_init.3,tls_peer_cert_subject.3
|
||||||
tls_init.3,tls_read.3
|
tls_init.3,tls_read.3
|
||||||
tls_init.3,tls_reset.3
|
tls_init.3,tls_reset.3
|
||||||
tls_init.3,tls_server.3
|
tls_init.3,tls_server.3
|
||||||
tls_init.3,tls_write.3
|
tls_init.3,tls_write.3
|
||||||
ui.3,ERR_load_UI_strings.3
|
|
||||||
ui.3,UI_OpenSSL.3
|
|
||||||
ui.3,UI_add_error_string.3
|
|
||||||
ui.3,UI_add_info_string.3
|
|
||||||
ui.3,UI_add_input_boolean.3
|
|
||||||
ui.3,UI_add_input_string.3
|
|
||||||
ui.3,UI_add_user_data.3
|
|
||||||
ui.3,UI_add_verify_string.3
|
|
||||||
ui.3,UI_construct_prompt.3
|
|
||||||
ui.3,UI_ctrl.3
|
|
||||||
ui.3,UI_dup_error_string.3
|
|
||||||
ui.3,UI_dup_info_string.3
|
|
||||||
ui.3,UI_dup_input_boolean.3
|
|
||||||
ui.3,UI_dup_input_string.3
|
|
||||||
ui.3,UI_dup_verify_string.3
|
|
||||||
ui.3,UI_free.3
|
|
||||||
ui.3,UI_get0_result.3
|
|
||||||
ui.3,UI_get0_user_data.3
|
|
||||||
ui.3,UI_get_default_method.3
|
|
||||||
ui.3,UI_get_method.3
|
|
||||||
ui.3,UI_new.3
|
|
||||||
ui.3,UI_new_method.3
|
|
||||||
ui.3,UI_process.3
|
|
||||||
ui.3,UI_set_default_method.3
|
|
||||||
ui.3,UI_set_method.3
|
|
||||||
ui_compat.3,des_read_2passwords.3
|
|
||||||
ui_compat.3,des_read_password.3
|
|
||||||
ui_compat.3,des_read_pw.3
|
|
||||||
ui_compat.3,des_read_pw_string.3
|
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
# Run this periodically to ensure that the manpage links are up to date
|
# Run this periodically to ensure that the manpage links are up to date
|
||||||
|
|
||||||
echo "# This is an auto-generated file by $0" > links
|
echo "# This is an auto-generated file by $0" > links
|
||||||
sudo makewhatis
|
doas makewhatis
|
||||||
for i in `ls -1 *.3`; do
|
for i in `ls -1 *.3`; do
|
||||||
name=`echo $i|cut -d. -f1`
|
name=`echo $i|cut -d. -f1`
|
||||||
links=`sqlite3 /usr/share/man/mandoc.db \
|
links=`sqlite3 /usr/share/man/mandoc.db \
|
||||||
@@ -11,7 +11,7 @@ for i in `ls -1 *.3`; do
|
|||||||
for j in $links; do
|
for j in $links; do
|
||||||
a=`echo "x$j" | tr '[:upper:]' '[:lower:]'`
|
a=`echo "x$j" | tr '[:upper:]' '[:lower:]'`
|
||||||
b=`echo "x$name" | tr '[:upper:]' '[:lower:]'`
|
b=`echo "x$name" | tr '[:upper:]' '[:lower:]'`
|
||||||
if [ $a != $b ]; then
|
if [[ $a != $b && $a != *"<type>"* ]]; then
|
||||||
echo $name.3,$j.3 >> links
|
echo $name.3,$j.3 >> links
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
21
patches/modes_lcl.h
Normal file
21
patches/modes_lcl.h
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
--- openbsd/src/lib/libssl/src/crypto/modes/modes_lcl.h Sat Dec 6 17:15:50 2014
|
||||||
|
+++ crypto/modes/modes_lcl.h Sun Jul 17 17:45:27 2016
|
||||||
|
@@ -43,14 +43,16 @@
|
||||||
|
asm ("bswapl %0" \
|
||||||
|
: "+r"(ret)); ret; })
|
||||||
|
# elif (defined(__arm__) || defined(__arm)) && !defined(__STRICT_ALIGNMENT)
|
||||||
|
-# define BSWAP8(x) ({ u32 lo=(u64)(x)>>32,hi=(x); \
|
||||||
|
+# if (__ARM_ARCH >= 6)
|
||||||
|
+# define BSWAP8(x) ({ u32 lo=(u64)(x)>>32,hi=(x); \
|
||||||
|
asm ("rev %0,%0; rev %1,%1" \
|
||||||
|
: "+r"(hi),"+r"(lo)); \
|
||||||
|
(u64)hi<<32|lo; })
|
||||||
|
-# define BSWAP4(x) ({ u32 ret; \
|
||||||
|
+# define BSWAP4(x) ({ u32 ret; \
|
||||||
|
asm ("rev %0,%1" \
|
||||||
|
: "=r"(ret) : "r"((u32)(x))); \
|
||||||
|
ret; })
|
||||||
|
+# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
#endif
|
185
patches/netcat.c.patch
Normal file
185
patches/netcat.c.patch
Normal file
@@ -0,0 +1,185 @@
|
|||||||
|
--- apps/nc/netcat.c.orig Mon Dec 28 08:46:10 2015
|
||||||
|
+++ apps/nc/netcat.c Mon Dec 28 08:46:19 2015
|
||||||
|
@@ -57,6 +57,10 @@
|
||||||
|
#include <tls.h>
|
||||||
|
#include "atomicio.h"
|
||||||
|
|
||||||
|
+#ifndef IPV6_TCLASS
|
||||||
|
+#define IPV6_TCLASS -1
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
#define PORT_MAX 65535
|
||||||
|
#define UNIX_DG_TMP_SOCKET_SIZE 19
|
||||||
|
|
||||||
|
@@ -65,7 +69,9 @@
|
||||||
|
#define POLL_NETIN 2
|
||||||
|
#define POLL_STDOUT 3
|
||||||
|
#define BUFSIZE 16384
|
||||||
|
+#ifndef DEFAULT_CA_FILE
|
||||||
|
#define DEFAULT_CA_FILE "/etc/ssl/cert.pem"
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
#define TLS_LEGACY (1 << 1)
|
||||||
|
#define TLS_NOVERIFY (1 << 2)
|
||||||
|
@@ -92,9 +98,13 @@
|
||||||
|
int Dflag; /* sodebug */
|
||||||
|
int Iflag; /* TCP receive buffer size */
|
||||||
|
int Oflag; /* TCP send buffer size */
|
||||||
|
+#ifdef TCP_MD5SIG
|
||||||
|
int Sflag; /* TCP MD5 signature option */
|
||||||
|
+#endif
|
||||||
|
int Tflag = -1; /* IP Type of Service */
|
||||||
|
+#ifdef SO_RTABLE
|
||||||
|
int rtableid = -1;
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
int usetls; /* use TLS */
|
||||||
|
char *Cflag; /* Public cert file */
|
||||||
|
@@ -150,7 +160,7 @@
|
||||||
|
struct servent *sv;
|
||||||
|
socklen_t len;
|
||||||
|
struct sockaddr_storage cliaddr;
|
||||||
|
- char *proxy;
|
||||||
|
+ char *proxy = NULL;
|
||||||
|
const char *errstr, *proxyhost = "", *proxyport = NULL;
|
||||||
|
struct addrinfo proxyhints;
|
||||||
|
char unix_dg_tmp_socket_buf[UNIX_DG_TMP_SOCKET_SIZE];
|
||||||
|
@@ -251,12 +261,14 @@
|
||||||
|
case 'u':
|
||||||
|
uflag = 1;
|
||||||
|
break;
|
||||||
|
+#ifdef SO_RTABLE
|
||||||
|
case 'V':
|
||||||
|
rtableid = (int)strtonum(optarg, 0,
|
||||||
|
RT_TABLEID_MAX, &errstr);
|
||||||
|
if (errstr)
|
||||||
|
errx(1, "rtable %s: %s", errstr, optarg);
|
||||||
|
break;
|
||||||
|
+#endif
|
||||||
|
case 'v':
|
||||||
|
vflag = 1;
|
||||||
|
break;
|
||||||
|
@@ -289,9 +301,11 @@
|
||||||
|
errx(1, "TCP send window %s: %s",
|
||||||
|
errstr, optarg);
|
||||||
|
break;
|
||||||
|
+#ifdef TCP_MD5SIG
|
||||||
|
case 'S':
|
||||||
|
Sflag = 1;
|
||||||
|
break;
|
||||||
|
+#endif
|
||||||
|
case 'T':
|
||||||
|
errstr = NULL;
|
||||||
|
errno = 0;
|
||||||
|
@@ -315,9 +329,11 @@
|
||||||
|
argc -= optind;
|
||||||
|
argv += optind;
|
||||||
|
|
||||||
|
+#ifdef SO_RTABLE
|
||||||
|
if (rtableid >= 0)
|
||||||
|
if (setrtable(rtableid) == -1)
|
||||||
|
err(1, "setrtable");
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
if (family == AF_UNIX) {
|
||||||
|
if (pledge("stdio rpath wpath cpath tmppath unix", NULL) == -1)
|
||||||
|
@@ -460,7 +476,10 @@
|
||||||
|
errx(1, "-H and -T noverify may not be used"
|
||||||
|
"together");
|
||||||
|
tls_config_insecure_noverifycert(tls_cfg);
|
||||||
|
- }
|
||||||
|
+ } else {
|
||||||
|
+ if (Rflag && access(Rflag, R_OK) == -1)
|
||||||
|
+ errx(1, "unable to find root CA file %s", Rflag);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
if (lflag) {
|
||||||
|
struct tls *tls_cctx = NULL;
|
||||||
|
@@ -807,7 +826,10 @@
|
||||||
|
remote_connect(const char *host, const char *port, struct addrinfo hints)
|
||||||
|
{
|
||||||
|
struct addrinfo *res, *res0;
|
||||||
|
- int s, error, on = 1;
|
||||||
|
+ int s, error;
|
||||||
|
+#ifdef SO_BINDANY
|
||||||
|
+ int on = 1;
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
if ((error = getaddrinfo(host, port, &hints, &res)))
|
||||||
|
errx(1, "getaddrinfo: %s", gai_strerror(error));
|
||||||
|
@@ -822,8 +844,10 @@
|
||||||
|
if (sflag || pflag) {
|
||||||
|
struct addrinfo ahints, *ares;
|
||||||
|
|
||||||
|
+#ifdef SO_BINDANY
|
||||||
|
/* try SO_BINDANY, but don't insist */
|
||||||
|
setsockopt(s, SOL_SOCKET, SO_BINDANY, &on, sizeof(on));
|
||||||
|
+#endif
|
||||||
|
memset(&ahints, 0, sizeof(struct addrinfo));
|
||||||
|
ahints.ai_family = res0->ai_family;
|
||||||
|
ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM;
|
||||||
|
@@ -892,7 +916,10 @@
|
||||||
|
local_listen(char *host, char *port, struct addrinfo hints)
|
||||||
|
{
|
||||||
|
struct addrinfo *res, *res0;
|
||||||
|
- int s, ret, x = 1;
|
||||||
|
+ int s;
|
||||||
|
+#ifdef SO_REUSEPORT
|
||||||
|
+ int ret, x = 1;
|
||||||
|
+#endif
|
||||||
|
int error;
|
||||||
|
|
||||||
|
/* Allow nodename to be null. */
|
||||||
|
@@ -914,9 +941,11 @@
|
||||||
|
res0->ai_protocol)) < 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
+#ifdef SO_REUSEPORT
|
||||||
|
ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x));
|
||||||
|
if (ret == -1)
|
||||||
|
err(1, NULL);
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
set_common_sockopts(s, res0->ai_family);
|
||||||
|
|
||||||
|
@@ -1356,11 +1385,13 @@
|
||||||
|
{
|
||||||
|
int x = 1;
|
||||||
|
|
||||||
|
+#ifdef TCP_MD5SIG
|
||||||
|
if (Sflag) {
|
||||||
|
if (setsockopt(s, IPPROTO_TCP, TCP_MD5SIG,
|
||||||
|
&x, sizeof(x)) == -1)
|
||||||
|
err(1, NULL);
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
if (Dflag) {
|
||||||
|
if (setsockopt(s, SOL_SOCKET, SO_DEBUG,
|
||||||
|
&x, sizeof(x)) == -1)
|
||||||
|
@@ -1538,14 +1569,22 @@
|
||||||
|
\t-P proxyuser\tUsername for proxy authentication\n\
|
||||||
|
\t-p port\t Specify local port for remote connects\n\
|
||||||
|
\t-R CAfile CA bundle\n\
|
||||||
|
- \t-r Randomize remote ports\n\
|
||||||
|
- \t-S Enable the TCP MD5 signature option\n\
|
||||||
|
+ \t-r Randomize remote ports\n"
|
||||||
|
+#ifdef TCP_MD5SIG
|
||||||
|
+ "\
|
||||||
|
+ \t-S Enable the TCP MD5 signature option\n"
|
||||||
|
+#endif
|
||||||
|
+ "\
|
||||||
|
\t-s source Local source address\n\
|
||||||
|
\t-T keyword TOS value or TLS options\n\
|
||||||
|
\t-t Answer TELNET negotiation\n\
|
||||||
|
\t-U Use UNIX domain socket\n\
|
||||||
|
- \t-u UDP mode\n\
|
||||||
|
- \t-V rtable Specify alternate routing table\n\
|
||||||
|
+ \t-u UDP mode\n"
|
||||||
|
+#ifdef SO_RTABLE
|
||||||
|
+ "\
|
||||||
|
+ \t-V rtable Specify alternate routing table\n"
|
||||||
|
+#endif
|
||||||
|
+ "\
|
||||||
|
\t-v Verbose\n\
|
||||||
|
\t-w timeout Timeout for connects and final net reads\n\
|
||||||
|
\t-X proto Proxy protocol: \"4\", \"5\" (SOCKS) or \"connect\"\n\
|
@@ -1,29 +1,12 @@
|
|||||||
--- apps/openssl.c.orig 2015-06-05 03:42:12.956112944 -0500
|
--- apps/openssl/openssl.c.orig Sun Sep 13 09:11:31 2015
|
||||||
+++ apps/openssl.c 2015-06-05 03:41:54.215381908 -0500
|
+++ apps/openssl/openssl.c Sun Sep 13 09:10:02 2015
|
||||||
@@ -130,6 +130,18 @@
|
@@ -399,7 +399,9 @@
|
||||||
#include <openssl/engine.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+#ifdef _WIN32
|
|
||||||
+#include <fcntl.h>
|
|
||||||
+static void set_stdio_binary(void)
|
|
||||||
+{
|
|
||||||
+ _setmode(_fileno(stdin), _O_BINARY);
|
|
||||||
+ _setmode(_fileno(stdout), _O_BINARY);
|
|
||||||
+ _setmode(_fileno(stderr), _O_BINARY);
|
|
||||||
+}
|
|
||||||
+#else
|
|
||||||
+static void set_stdio_binary(void) {};
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
#include "progs.h"
|
|
||||||
#include "s_apps.h"
|
|
||||||
|
|
||||||
@@ -216,6 +228,7 @@
|
|
||||||
#endif
|
|
||||||
|
|
||||||
setup_ui_method();
|
|
||||||
+ set_stdio_binary();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
openssl_startup(void)
|
||||||
|
{
|
||||||
|
+#ifndef _WIN32
|
||||||
|
signal(SIGPIPE, SIG_IGN);
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
OpenSSL_add_all_algorithms();
|
||||||
|
SSL_library_init();
|
||||||
|
82
patches/rfc5280.c.patch
Normal file
82
patches/rfc5280.c.patch
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
--- tests/rfc5280time.c.orig Mon Nov 2 20:00:31 2015
|
||||||
|
+++ tests/rfc5280time.c Mon Nov 2 20:03:12 2015
|
||||||
|
@@ -91,6 +91,7 @@
|
||||||
|
.data = "20150923032700Z",
|
||||||
|
.time = 1442978820,
|
||||||
|
},
|
||||||
|
+#if SIZEOF_TIME_T == 8
|
||||||
|
{
|
||||||
|
/* (times before 2050 must be UTCTIME) Per RFC 5280 4.1.2.5 */
|
||||||
|
.str = "00000101000000Z",
|
||||||
|
@@ -103,6 +104,7 @@
|
||||||
|
.data = "20491231235959Z",
|
||||||
|
.time = 2524607999LL,
|
||||||
|
},
|
||||||
|
+#endif
|
||||||
|
{
|
||||||
|
/* (times before 2050 must be UTCTIME) Per RFC 5280 4.1.2.5 */
|
||||||
|
.str = "19500101000000Z",
|
||||||
|
@@ -112,6 +114,7 @@
|
||||||
|
};
|
||||||
|
|
||||||
|
struct rfc5280_time_test rfc5280_gentime_tests[] = {
|
||||||
|
+#if SIZEOF_TIME_T == 8
|
||||||
|
{
|
||||||
|
/* Biggest RFC 5280 time */
|
||||||
|
.str = "99991231235959Z",
|
||||||
|
@@ -129,6 +132,7 @@
|
||||||
|
.data = "20500101000000Z",
|
||||||
|
.time = 2524608000LL,
|
||||||
|
},
|
||||||
|
+#endif
|
||||||
|
};
|
||||||
|
struct rfc5280_time_test rfc5280_utctime_tests[] = {
|
||||||
|
{
|
||||||
|
@@ -141,11 +145,13 @@
|
||||||
|
.data = "540226230640Z",
|
||||||
|
.time = -500000000,
|
||||||
|
},
|
||||||
|
+#if SIZEOF_TIME_T == 8
|
||||||
|
{
|
||||||
|
.str = "491231235959Z",
|
||||||
|
.data = "491231235959Z",
|
||||||
|
.time = 2524607999LL,
|
||||||
|
},
|
||||||
|
+#endif
|
||||||
|
{
|
||||||
|
.str = "700101000000Z",
|
||||||
|
.data = "700101000000Z",
|
||||||
|
@@ -273,14 +279,14 @@
|
||||||
|
|
||||||
|
if ((i = X509_cmp_time(gt, &att->time)) != -1) {
|
||||||
|
fprintf(stderr, "FAIL: test %i - X509_cmp_time failed - returned %d compared to %lld\n",
|
||||||
|
- test_no, i, att->time);
|
||||||
|
+ test_no, i, (long long)att->time);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
att->time--;
|
||||||
|
if ((i = X509_cmp_time(gt, &att->time)) != 1) {
|
||||||
|
fprintf(stderr, "FAIL: test %i - X509_cmp_time failed - returned %d compared to %lld\n",
|
||||||
|
- test_no, i, att->time);
|
||||||
|
+ test_no, i, (long long)att->time);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
att->time++;
|
||||||
|
@@ -325,14 +331,14 @@
|
||||||
|
|
||||||
|
if ((i = X509_cmp_time(ut, &att->time)) != -1) {
|
||||||
|
fprintf(stderr, "FAIL: test %i - X509_cmp_time failed - returned %d compared to %lld\n",
|
||||||
|
- test_no, i, att->time);
|
||||||
|
+ test_no, i, (long long)att->time);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
att->time--;
|
||||||
|
if ((i = X509_cmp_time(ut, &att->time)) != 1) {
|
||||||
|
fprintf(stderr, "FAIL: test %i - X509_cmp_time failed - returned %d compared to %lld\n",
|
||||||
|
- test_no, i, att->time);
|
||||||
|
+ test_no, i, (long long)att->time);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
att->time++;
|
19
patches/ssl_txt.c.patch
Normal file
19
patches/ssl_txt.c.patch
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
--- ssl/ssl_txt.orig Sun Jul 17 17:26:59 2016
|
||||||
|
+++ ssl/ssl_txt.c Sun Jul 17 17:35:44 2016
|
||||||
|
@@ -82,6 +82,7 @@
|
||||||
|
* OTHERWISE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
+#include <inttypes.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <openssl/buffer.h>
|
||||||
|
@@ -163,7 +164,7 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x->time != 0) {
|
||||||
|
- if (BIO_printf(bp, "\n Start Time: %lld", (long long)x->time) <= 0)
|
||||||
|
+ if (BIO_printf(bp, "\n Start Time: %"PRId64, (int64_t)x->time) <= 0)
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
if (x->timeout != 0L) {
|
12
patches/tls_internal.h.patch
Normal file
12
patches/tls_internal.h.patch
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
--- ./openbsd/src/lib/libtls/tls_internal.h Thu Oct 15 16:12:24 2015
|
||||||
|
+++ ./tls/tls_internal.h Sun Dec 6 20:18:17 2015
|
||||||
|
@@ -24,7 +24,9 @@
|
||||||
|
|
||||||
|
#include <openssl/ssl.h>
|
||||||
|
|
||||||
|
+#ifndef _PATH_SSL_CA_FILE
|
||||||
|
#define _PATH_SSL_CA_FILE "/etc/ssl/cert.pem"
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
#define TLS_CIPHERS_COMPAT "ALL:!aNULL:!eNULL"
|
||||||
|
#define TLS_CIPHERS_DEFAULT "TLSv1.2+AEAD+ECDHE:TLSv1.2+AEAD+DHE"
|
100
patches/windows_headers.patch
Normal file
100
patches/windows_headers.patch
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
diff -u include/openssl.orig/dtls1.h include/openssl/dtls1.h
|
||||||
|
--- include/openssl.orig/dtls1.h Mon Dec 7 07:58:32 2015
|
||||||
|
+++ include/openssl/dtls1.h Mon Dec 7 07:56:14 2015
|
||||||
|
@@ -60,7 +60,11 @@
|
||||||
|
#ifndef HEADER_DTLS1_H
|
||||||
|
#define HEADER_DTLS1_H
|
||||||
|
|
||||||
|
+#if defined(_WIN32)
|
||||||
|
+#include <winsock2.h>
|
||||||
|
+#else
|
||||||
|
#include <sys/time.h>
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
diff -u include/openssl.orig/opensslconf.h include/openssl/opensslconf.h
|
||||||
|
--- include/openssl.orig/opensslconf.h Mon Dec 7 07:58:32 2015
|
||||||
|
+++ include/openssl/opensslconf.h Mon Dec 7 07:56:14 2015
|
||||||
|
@@ -1,6 +1,10 @@
|
||||||
|
#include <openssl/opensslfeatures.h>
|
||||||
|
/* crypto/opensslconf.h.in */
|
||||||
|
|
||||||
|
+#if defined(_MSC_VER) && !defined(__attribute__)
|
||||||
|
+#define __attribute__(a)
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
/* Generate 80386 code? */
|
||||||
|
#undef I386_ONLY
|
||||||
|
|
||||||
|
diff -u include/openssl.orig/ossl_typ.h include/openssl/ossl_typ.h
|
||||||
|
--- include/openssl.orig/ossl_typ.h Mon Dec 7 07:58:32 2015
|
||||||
|
+++ include/openssl/ossl_typ.h Mon Dec 7 07:56:14 2015
|
||||||
|
@@ -80,6 +80,22 @@
|
||||||
|
typedef struct ASN1_ITEM_st ASN1_ITEM;
|
||||||
|
typedef struct asn1_pctx_st ASN1_PCTX;
|
||||||
|
|
||||||
|
+#if defined(_WIN32) && defined(__WINCRYPT_H__)
|
||||||
|
+#ifndef LIBRESSL_INTERNAL
|
||||||
|
+#ifdef _MSC_VER
|
||||||
|
+#pragma message("Warning, overriding WinCrypt defines")
|
||||||
|
+#else
|
||||||
|
+#warning overriding WinCrypt defines
|
||||||
|
+#endif
|
||||||
|
+#endif
|
||||||
|
+#undef X509_NAME
|
||||||
|
+#undef X509_CERT_PAIR
|
||||||
|
+#undef X509_EXTENSIONS
|
||||||
|
+#undef OCSP_REQUEST
|
||||||
|
+#undef OCSP_RESPONSE
|
||||||
|
+#undef PKCS7_ISSUER_AND_SERIAL
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
#ifdef BIGNUM
|
||||||
|
#undef BIGNUM
|
||||||
|
#endif
|
||||||
|
diff -u include/openssl.orig/pkcs7.h include/openssl/pkcs7.h
|
||||||
|
--- include/openssl.orig/pkcs7.h Mon Dec 7 07:58:32 2015
|
||||||
|
+++ include/openssl/pkcs7.h Mon Dec 7 07:56:14 2015
|
||||||
|
@@ -69,6 +69,18 @@
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+#if defined(_WIN32) && defined(__WINCRYPT_H__)
|
||||||
|
+#ifndef LIBRESSL_INTERNAL
|
||||||
|
+#ifdef _MSC_VER
|
||||||
|
+#pragma message("Warning, overriding WinCrypt defines")
|
||||||
|
+#else
|
||||||
|
+#warning overriding WinCrypt defines
|
||||||
|
+#endif
|
||||||
|
+#endif
|
||||||
|
+#undef PKCS7_ISSUER_AND_SERIAL
|
||||||
|
+#undef PKCS7_SIGNER_INFO
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
/*
|
||||||
|
Encryption_ID DES-CBC
|
||||||
|
Digest_ID MD5
|
||||||
|
diff -u include/openssl.orig/x509.h include/openssl/x509.h
|
||||||
|
--- include/openssl.orig/x509.h Mon Dec 7 07:58:32 2015
|
||||||
|
+++ include/openssl/x509.h Mon Dec 7 07:56:14 2015
|
||||||
|
@@ -112,6 +112,19 @@
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+#if defined(_WIN32)
|
||||||
|
+#ifndef LIBRESSL_INTERNAL
|
||||||
|
+#ifdef _MSC_VER
|
||||||
|
+#pragma message("Warning, overriding WinCrypt defines")
|
||||||
|
+#else
|
||||||
|
+#warning overriding WinCrypt defines
|
||||||
|
+#endif
|
||||||
|
+#endif
|
||||||
|
+#undef X509_NAME
|
||||||
|
+#undef X509_CERT_PAIR
|
||||||
|
+#undef X509_EXTENSIONS
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
#define X509_FILETYPE_PEM 1
|
||||||
|
#define X509_FILETYPE_ASN1 2
|
||||||
|
#define X509_FILETYPE_DEFAULT 3
|
1447
scripts/config.guess
vendored
Normal file
1447
scripts/config.guess
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1813
scripts/config.sub
vendored
Normal file
1813
scripts/config.sub
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@@ -4,12 +4,31 @@ set -e
|
|||||||
./autogen.sh
|
./autogen.sh
|
||||||
|
|
||||||
if [ "x$ARCH" = "xnative" ]; then
|
if [ "x$ARCH" = "xnative" ]; then
|
||||||
|
# test autotools
|
||||||
./configure
|
./configure
|
||||||
|
make -j 4 distcheck
|
||||||
|
|
||||||
|
# make distribution
|
||||||
|
make dist
|
||||||
|
tar zxvf libressl-*.tar.gz
|
||||||
|
cd libressl-*
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
|
||||||
|
# test cmake and ninja
|
||||||
if [ `uname` = "Darwin" ]; then
|
if [ `uname` = "Darwin" ]; then
|
||||||
# OS X runs out of resources if we run 'make -j check'
|
cmake ..
|
||||||
make check
|
make
|
||||||
|
make test
|
||||||
else
|
else
|
||||||
make -j distcheck
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y python-software-properties
|
||||||
|
sudo apt-add-repository -y ppa:kalakris/cmake
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y cmake ninja-build
|
||||||
|
cmake -GNinja ..
|
||||||
|
ninja
|
||||||
|
ninja test
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
CPU=i686
|
CPU=i686
|
||||||
|
65
ssl/CMakeLists.txt
Normal file
65
ssl/CMakeLists.txt
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
include_directories(
|
||||||
|
.
|
||||||
|
../include
|
||||||
|
../include/compat
|
||||||
|
)
|
||||||
|
|
||||||
|
set(
|
||||||
|
SSL_SRC
|
||||||
|
bio_ssl.c
|
||||||
|
bs_ber.c
|
||||||
|
bs_cbb.c
|
||||||
|
bs_cbs.c
|
||||||
|
d1_both.c
|
||||||
|
d1_clnt.c
|
||||||
|
d1_enc.c
|
||||||
|
d1_lib.c
|
||||||
|
d1_meth.c
|
||||||
|
d1_pkt.c
|
||||||
|
d1_srtp.c
|
||||||
|
d1_srvr.c
|
||||||
|
pqueue.c
|
||||||
|
s23_clnt.c
|
||||||
|
s23_lib.c
|
||||||
|
s23_pkt.c
|
||||||
|
s23_srvr.c
|
||||||
|
s3_both.c
|
||||||
|
s3_cbc.c
|
||||||
|
s3_clnt.c
|
||||||
|
s3_lib.c
|
||||||
|
s3_pkt.c
|
||||||
|
s3_srvr.c
|
||||||
|
ssl_algs.c
|
||||||
|
ssl_asn1.c
|
||||||
|
ssl_cert.c
|
||||||
|
ssl_ciph.c
|
||||||
|
ssl_err.c
|
||||||
|
ssl_err2.c
|
||||||
|
ssl_lib.c
|
||||||
|
ssl_rsa.c
|
||||||
|
ssl_sess.c
|
||||||
|
ssl_stat.c
|
||||||
|
ssl_txt.c
|
||||||
|
t1_clnt.c
|
||||||
|
t1_enc.c
|
||||||
|
t1_lib.c
|
||||||
|
t1_meth.c
|
||||||
|
t1_reneg.c
|
||||||
|
t1_srvr.c
|
||||||
|
)
|
||||||
|
|
||||||
|
if (BUILD_SHARED)
|
||||||
|
add_library(ssl-objects OBJECT ${SSL_SRC})
|
||||||
|
add_library(ssl STATIC $<TARGET_OBJECTS:ssl-objects>)
|
||||||
|
add_library(ssl-shared SHARED $<TARGET_OBJECTS:ssl-objects>)
|
||||||
|
if (MSVC)
|
||||||
|
target_link_libraries(ssl-shared crypto-shared Ws2_32.lib)
|
||||||
|
endif()
|
||||||
|
set_target_properties(ssl-shared PROPERTIES OUTPUT_NAME ssl)
|
||||||
|
set_target_properties(ssl-shared PROPERTIES VERSION ${SSL_VERSION}
|
||||||
|
SOVERSION ${SSL_MAJOR_VERSION})
|
||||||
|
install(TARGETS ssl ssl-shared DESTINATION lib)
|
||||||
|
else()
|
||||||
|
add_library(ssl STATIC ${SSL_SRC})
|
||||||
|
install(TARGETS ssl DESTINATION lib)
|
||||||
|
endif()
|
@@ -3,9 +3,10 @@ include $(top_srcdir)/Makefile.am.common
|
|||||||
lib_LTLIBRARIES = libssl.la
|
lib_LTLIBRARIES = libssl.la
|
||||||
|
|
||||||
EXTRA_DIST = VERSION
|
EXTRA_DIST = VERSION
|
||||||
|
EXTRA_DIST += CMakeLists.txt
|
||||||
|
|
||||||
libssl_la_LDFLAGS = -version-info @LIBSSL_VERSION@ -no-undefined
|
libssl_la_LDFLAGS = -version-info @LIBSSL_VERSION@ -no-undefined
|
||||||
libssl_la_LIBADD = ../crypto/libcrypto.la
|
libssl_la_LIBADD = $(abs_top_builddir)/crypto/libcrypto.la
|
||||||
|
|
||||||
libssl_la_SOURCES = bio_ssl.c
|
libssl_la_SOURCES = bio_ssl.c
|
||||||
libssl_la_SOURCES += bs_ber.c
|
libssl_la_SOURCES += bs_ber.c
|
||||||
@@ -22,15 +23,12 @@ libssl_la_SOURCES += d1_srvr.c
|
|||||||
libssl_la_SOURCES += pqueue.c
|
libssl_la_SOURCES += pqueue.c
|
||||||
libssl_la_SOURCES += s23_clnt.c
|
libssl_la_SOURCES += s23_clnt.c
|
||||||
libssl_la_SOURCES += s23_lib.c
|
libssl_la_SOURCES += s23_lib.c
|
||||||
libssl_la_SOURCES += s23_meth.c
|
|
||||||
libssl_la_SOURCES += s23_pkt.c
|
libssl_la_SOURCES += s23_pkt.c
|
||||||
libssl_la_SOURCES += s23_srvr.c
|
libssl_la_SOURCES += s23_srvr.c
|
||||||
libssl_la_SOURCES += s3_both.c
|
libssl_la_SOURCES += s3_both.c
|
||||||
libssl_la_SOURCES += s3_cbc.c
|
libssl_la_SOURCES += s3_cbc.c
|
||||||
libssl_la_SOURCES += s3_clnt.c
|
libssl_la_SOURCES += s3_clnt.c
|
||||||
libssl_la_SOURCES += s3_enc.c
|
|
||||||
libssl_la_SOURCES += s3_lib.c
|
libssl_la_SOURCES += s3_lib.c
|
||||||
libssl_la_SOURCES += s3_meth.c
|
|
||||||
libssl_la_SOURCES += s3_pkt.c
|
libssl_la_SOURCES += s3_pkt.c
|
||||||
libssl_la_SOURCES += s3_srvr.c
|
libssl_la_SOURCES += s3_srvr.c
|
||||||
libssl_la_SOURCES += ssl_algs.c
|
libssl_la_SOURCES += ssl_algs.c
|
||||||
|
651
tap-driver.sh
Executable file
651
tap-driver.sh
Executable file
@@ -0,0 +1,651 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
# Copyright (C) 2011-2014 Free Software Foundation, Inc.
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# As a special exception to the GNU General Public License, if you
|
||||||
|
# distribute this file as part of a program that contains a
|
||||||
|
# configuration script generated by Autoconf, you may include it under
|
||||||
|
# the same distribution terms that you use for the rest of that program.
|
||||||
|
|
||||||
|
# This file is maintained in Automake, please report
|
||||||
|
# bugs to <bug-automake@gnu.org> or send patches to
|
||||||
|
# <automake-patches@gnu.org>.
|
||||||
|
|
||||||
|
scriptversion=2013-12-23.17; # UTC
|
||||||
|
|
||||||
|
# Make unconditional expansion of undefined variables an error. This
|
||||||
|
# helps a lot in preventing typo-related bugs.
|
||||||
|
set -u
|
||||||
|
|
||||||
|
me=tap-driver.sh
|
||||||
|
|
||||||
|
fatal ()
|
||||||
|
{
|
||||||
|
echo "$me: fatal: $*" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
usage_error ()
|
||||||
|
{
|
||||||
|
echo "$me: $*" >&2
|
||||||
|
print_usage >&2
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
|
||||||
|
print_usage ()
|
||||||
|
{
|
||||||
|
cat <<END
|
||||||
|
Usage:
|
||||||
|
tap-driver.sh --test-name=NAME --log-file=PATH --trs-file=PATH
|
||||||
|
[--expect-failure={yes|no}] [--color-tests={yes|no}]
|
||||||
|
[--enable-hard-errors={yes|no}] [--ignore-exit]
|
||||||
|
[--diagnostic-string=STRING] [--merge|--no-merge]
|
||||||
|
[--comments|--no-comments] [--] TEST-COMMAND
|
||||||
|
The '--test-name', '-log-file' and '--trs-file' options are mandatory.
|
||||||
|
END
|
||||||
|
}
|
||||||
|
|
||||||
|
# TODO: better error handling in option parsing (in particular, ensure
|
||||||
|
# TODO: $log_file, $trs_file and $test_name are defined).
|
||||||
|
test_name= # Used for reporting.
|
||||||
|
log_file= # Where to save the result and output of the test script.
|
||||||
|
trs_file= # Where to save the metadata of the test run.
|
||||||
|
expect_failure=0
|
||||||
|
color_tests=0
|
||||||
|
merge=0
|
||||||
|
ignore_exit=0
|
||||||
|
comments=0
|
||||||
|
diag_string='#'
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case $1 in
|
||||||
|
--help) print_usage; exit $?;;
|
||||||
|
--version) echo "$me $scriptversion"; exit $?;;
|
||||||
|
--test-name) test_name=$2; shift;;
|
||||||
|
--log-file) log_file=$2; shift;;
|
||||||
|
--trs-file) trs_file=$2; shift;;
|
||||||
|
--color-tests) color_tests=$2; shift;;
|
||||||
|
--expect-failure) expect_failure=$2; shift;;
|
||||||
|
--enable-hard-errors) shift;; # No-op.
|
||||||
|
--merge) merge=1;;
|
||||||
|
--no-merge) merge=0;;
|
||||||
|
--ignore-exit) ignore_exit=1;;
|
||||||
|
--comments) comments=1;;
|
||||||
|
--no-comments) comments=0;;
|
||||||
|
--diagnostic-string) diag_string=$2; shift;;
|
||||||
|
--) shift; break;;
|
||||||
|
-*) usage_error "invalid option: '$1'";;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
test $# -gt 0 || usage_error "missing test command"
|
||||||
|
|
||||||
|
case $expect_failure in
|
||||||
|
yes) expect_failure=1;;
|
||||||
|
*) expect_failure=0;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if test $color_tests = yes; then
|
||||||
|
init_colors='
|
||||||
|
color_map["red"]="[0;31m" # Red.
|
||||||
|
color_map["grn"]="[0;32m" # Green.
|
||||||
|
color_map["lgn"]="[1;32m" # Light green.
|
||||||
|
color_map["blu"]="[1;34m" # Blue.
|
||||||
|
color_map["mgn"]="[0;35m" # Magenta.
|
||||||
|
color_map["std"]="[m" # No color.
|
||||||
|
color_for_result["ERROR"] = "mgn"
|
||||||
|
color_for_result["PASS"] = "grn"
|
||||||
|
color_for_result["XPASS"] = "red"
|
||||||
|
color_for_result["FAIL"] = "red"
|
||||||
|
color_for_result["XFAIL"] = "lgn"
|
||||||
|
color_for_result["SKIP"] = "blu"'
|
||||||
|
else
|
||||||
|
init_colors=''
|
||||||
|
fi
|
||||||
|
|
||||||
|
# :; is there to work around a bug in bash 3.2 (and earlier) which
|
||||||
|
# does not always set '$?' properly on redirection failure.
|
||||||
|
# See the Autoconf manual for more details.
|
||||||
|
:;{
|
||||||
|
(
|
||||||
|
# Ignore common signals (in this subshell only!), to avoid potential
|
||||||
|
# problems with Korn shells. Some Korn shells are known to propagate
|
||||||
|
# to themselves signals that have killed a child process they were
|
||||||
|
# waiting for; this is done at least for SIGINT (and usually only for
|
||||||
|
# it, in truth). Without the `trap' below, such a behaviour could
|
||||||
|
# cause a premature exit in the current subshell, e.g., in case the
|
||||||
|
# test command it runs gets terminated by a SIGINT. Thus, the awk
|
||||||
|
# script we are piping into would never seen the exit status it
|
||||||
|
# expects on its last input line (which is displayed below by the
|
||||||
|
# last `echo $?' statement), and would thus die reporting an internal
|
||||||
|
# error.
|
||||||
|
# For more information, see the Autoconf manual and the threads:
|
||||||
|
# <http://lists.gnu.org/archive/html/bug-autoconf/2011-09/msg00004.html>
|
||||||
|
# <http://mail.opensolaris.org/pipermail/ksh93-integration-discuss/2009-February/004121.html>
|
||||||
|
trap : 1 3 2 13 15
|
||||||
|
if test $merge -gt 0; then
|
||||||
|
exec 2>&1
|
||||||
|
else
|
||||||
|
exec 2>&3
|
||||||
|
fi
|
||||||
|
"$@"
|
||||||
|
echo $?
|
||||||
|
) | LC_ALL=C ${AM_TAP_AWK-awk} \
|
||||||
|
-v me="$me" \
|
||||||
|
-v test_script_name="$test_name" \
|
||||||
|
-v log_file="$log_file" \
|
||||||
|
-v trs_file="$trs_file" \
|
||||||
|
-v expect_failure="$expect_failure" \
|
||||||
|
-v merge="$merge" \
|
||||||
|
-v ignore_exit="$ignore_exit" \
|
||||||
|
-v comments="$comments" \
|
||||||
|
-v diag_string="$diag_string" \
|
||||||
|
'
|
||||||
|
# TODO: the usages of "cat >&3" below could be optimized when using
|
||||||
|
# GNU awk, and/on on systems that supports /dev/fd/.
|
||||||
|
|
||||||
|
# Implementation note: in what follows, `result_obj` will be an
|
||||||
|
# associative array that (partly) simulates a TAP result object
|
||||||
|
# from the `TAP::Parser` perl module.
|
||||||
|
|
||||||
|
## ----------- ##
|
||||||
|
## FUNCTIONS ##
|
||||||
|
## ----------- ##
|
||||||
|
|
||||||
|
function fatal(msg)
|
||||||
|
{
|
||||||
|
print me ": " msg | "cat >&2"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function abort(where)
|
||||||
|
{
|
||||||
|
fatal("internal error " where)
|
||||||
|
}
|
||||||
|
|
||||||
|
# Convert a boolean to a "yes"/"no" string.
|
||||||
|
function yn(bool)
|
||||||
|
{
|
||||||
|
return bool ? "yes" : "no";
|
||||||
|
}
|
||||||
|
|
||||||
|
function add_test_result(result)
|
||||||
|
{
|
||||||
|
if (!test_results_index)
|
||||||
|
test_results_index = 0
|
||||||
|
test_results_list[test_results_index] = result
|
||||||
|
test_results_index += 1
|
||||||
|
test_results_seen[result] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Whether the test script should be re-run by "make recheck".
|
||||||
|
function must_recheck()
|
||||||
|
{
|
||||||
|
for (k in test_results_seen)
|
||||||
|
if (k != "XFAIL" && k != "PASS" && k != "SKIP")
|
||||||
|
return 1
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Whether the content of the log file associated to this test should
|
||||||
|
# be copied into the "global" test-suite.log.
|
||||||
|
function copy_in_global_log()
|
||||||
|
{
|
||||||
|
for (k in test_results_seen)
|
||||||
|
if (k != "PASS")
|
||||||
|
return 1
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_global_test_result()
|
||||||
|
{
|
||||||
|
if ("ERROR" in test_results_seen)
|
||||||
|
return "ERROR"
|
||||||
|
if ("FAIL" in test_results_seen || "XPASS" in test_results_seen)
|
||||||
|
return "FAIL"
|
||||||
|
all_skipped = 1
|
||||||
|
for (k in test_results_seen)
|
||||||
|
if (k != "SKIP")
|
||||||
|
all_skipped = 0
|
||||||
|
if (all_skipped)
|
||||||
|
return "SKIP"
|
||||||
|
return "PASS";
|
||||||
|
}
|
||||||
|
|
||||||
|
function stringify_result_obj(result_obj)
|
||||||
|
{
|
||||||
|
if (result_obj["is_unplanned"] || result_obj["number"] != testno)
|
||||||
|
return "ERROR"
|
||||||
|
|
||||||
|
if (plan_seen == LATE_PLAN)
|
||||||
|
return "ERROR"
|
||||||
|
|
||||||
|
if (result_obj["directive"] == "TODO")
|
||||||
|
return result_obj["is_ok"] ? "XPASS" : "XFAIL"
|
||||||
|
|
||||||
|
if (result_obj["directive"] == "SKIP")
|
||||||
|
return result_obj["is_ok"] ? "SKIP" : COOKED_FAIL;
|
||||||
|
|
||||||
|
if (length(result_obj["directive"]))
|
||||||
|
abort("in function stringify_result_obj()")
|
||||||
|
|
||||||
|
return result_obj["is_ok"] ? COOKED_PASS : COOKED_FAIL
|
||||||
|
}
|
||||||
|
|
||||||
|
function decorate_result(result)
|
||||||
|
{
|
||||||
|
color_name = color_for_result[result]
|
||||||
|
if (color_name)
|
||||||
|
return color_map[color_name] "" result "" color_map["std"]
|
||||||
|
# If we are not using colorized output, or if we do not know how
|
||||||
|
# to colorize the given result, we should return it unchanged.
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
function report(result, details)
|
||||||
|
{
|
||||||
|
if (result ~ /^(X?(PASS|FAIL)|SKIP|ERROR)/)
|
||||||
|
{
|
||||||
|
msg = ": " test_script_name
|
||||||
|
add_test_result(result)
|
||||||
|
}
|
||||||
|
else if (result == "#")
|
||||||
|
{
|
||||||
|
msg = " " test_script_name ":"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
abort("in function report()")
|
||||||
|
}
|
||||||
|
if (length(details))
|
||||||
|
msg = msg " " details
|
||||||
|
# Output on console might be colorized.
|
||||||
|
print decorate_result(result) msg
|
||||||
|
# Log the result in the log file too, to help debugging (this is
|
||||||
|
# especially true when said result is a TAP error or "Bail out!").
|
||||||
|
print result msg | "cat >&3";
|
||||||
|
}
|
||||||
|
|
||||||
|
function testsuite_error(error_message)
|
||||||
|
{
|
||||||
|
report("ERROR", "- " error_message)
|
||||||
|
}
|
||||||
|
|
||||||
|
function handle_tap_result()
|
||||||
|
{
|
||||||
|
details = result_obj["number"];
|
||||||
|
if (length(result_obj["description"]))
|
||||||
|
details = details " " result_obj["description"]
|
||||||
|
|
||||||
|
if (plan_seen == LATE_PLAN)
|
||||||
|
{
|
||||||
|
details = details " # AFTER LATE PLAN";
|
||||||
|
}
|
||||||
|
else if (result_obj["is_unplanned"])
|
||||||
|
{
|
||||||
|
details = details " # UNPLANNED";
|
||||||
|
}
|
||||||
|
else if (result_obj["number"] != testno)
|
||||||
|
{
|
||||||
|
details = sprintf("%s # OUT-OF-ORDER (expecting %d)",
|
||||||
|
details, testno);
|
||||||
|
}
|
||||||
|
else if (result_obj["directive"])
|
||||||
|
{
|
||||||
|
details = details " # " result_obj["directive"];
|
||||||
|
if (length(result_obj["explanation"]))
|
||||||
|
details = details " " result_obj["explanation"]
|
||||||
|
}
|
||||||
|
|
||||||
|
report(stringify_result_obj(result_obj), details)
|
||||||
|
}
|
||||||
|
|
||||||
|
# `skip_reason` should be empty whenever planned > 0.
|
||||||
|
function handle_tap_plan(planned, skip_reason)
|
||||||
|
{
|
||||||
|
planned += 0 # Avoid getting confused if, say, `planned` is "00"
|
||||||
|
if (length(skip_reason) && planned > 0)
|
||||||
|
abort("in function handle_tap_plan()")
|
||||||
|
if (plan_seen)
|
||||||
|
{
|
||||||
|
# Error, only one plan per stream is acceptable.
|
||||||
|
testsuite_error("multiple test plans")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
planned_tests = planned
|
||||||
|
# The TAP plan can come before or after *all* the TAP results; we speak
|
||||||
|
# respectively of an "early" or a "late" plan. If we see the plan line
|
||||||
|
# after at least one TAP result has been seen, assume we have a late
|
||||||
|
# plan; in this case, any further test result seen after the plan will
|
||||||
|
# be flagged as an error.
|
||||||
|
plan_seen = (testno >= 1 ? LATE_PLAN : EARLY_PLAN)
|
||||||
|
# If testno > 0, we have an error ("too many tests run") that will be
|
||||||
|
# automatically dealt with later, so do not worry about it here. If
|
||||||
|
# $plan_seen is true, we have an error due to a repeated plan, and that
|
||||||
|
# has already been dealt with above. Otherwise, we have a valid "plan
|
||||||
|
# with SKIP" specification, and should report it as a particular kind
|
||||||
|
# of SKIP result.
|
||||||
|
if (planned == 0 && testno == 0)
|
||||||
|
{
|
||||||
|
if (length(skip_reason))
|
||||||
|
skip_reason = "- " skip_reason;
|
||||||
|
report("SKIP", skip_reason);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function extract_tap_comment(line)
|
||||||
|
{
|
||||||
|
if (index(line, diag_string) == 1)
|
||||||
|
{
|
||||||
|
# Strip leading `diag_string` from `line`.
|
||||||
|
line = substr(line, length(diag_string) + 1)
|
||||||
|
# And strip any leading and trailing whitespace left.
|
||||||
|
sub("^[ \t]*", "", line)
|
||||||
|
sub("[ \t]*$", "", line)
|
||||||
|
# Return what is left (if any).
|
||||||
|
return line;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
# When this function is called, we know that line is a TAP result line,
|
||||||
|
# so that it matches the (perl) RE "^(not )?ok\b".
|
||||||
|
function setup_result_obj(line)
|
||||||
|
{
|
||||||
|
# Get the result, and remove it from the line.
|
||||||
|
result_obj["is_ok"] = (substr(line, 1, 2) == "ok" ? 1 : 0)
|
||||||
|
sub("^(not )?ok[ \t]*", "", line)
|
||||||
|
|
||||||
|
# If the result has an explicit number, get it and strip it; otherwise,
|
||||||
|
# automatically assing the next progresive number to it.
|
||||||
|
if (line ~ /^[0-9]+$/ || line ~ /^[0-9]+[^a-zA-Z0-9_]/)
|
||||||
|
{
|
||||||
|
match(line, "^[0-9]+")
|
||||||
|
# The final `+ 0` is to normalize numbers with leading zeros.
|
||||||
|
result_obj["number"] = substr(line, 1, RLENGTH) + 0
|
||||||
|
line = substr(line, RLENGTH + 1)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result_obj["number"] = testno
|
||||||
|
}
|
||||||
|
|
||||||
|
if (plan_seen == LATE_PLAN)
|
||||||
|
# No further test results are acceptable after a "late" TAP plan
|
||||||
|
# has been seen.
|
||||||
|
result_obj["is_unplanned"] = 1
|
||||||
|
else if (plan_seen && testno > planned_tests)
|
||||||
|
result_obj["is_unplanned"] = 1
|
||||||
|
else
|
||||||
|
result_obj["is_unplanned"] = 0
|
||||||
|
|
||||||
|
# Strip trailing and leading whitespace.
|
||||||
|
sub("^[ \t]*", "", line)
|
||||||
|
sub("[ \t]*$", "", line)
|
||||||
|
|
||||||
|
# This will have to be corrected if we have a "TODO"/"SKIP" directive.
|
||||||
|
result_obj["description"] = line
|
||||||
|
result_obj["directive"] = ""
|
||||||
|
result_obj["explanation"] = ""
|
||||||
|
|
||||||
|
if (index(line, "#") == 0)
|
||||||
|
return # No possible directive, nothing more to do.
|
||||||
|
|
||||||
|
# Directives are case-insensitive.
|
||||||
|
rx = "[ \t]*#[ \t]*([tT][oO][dD][oO]|[sS][kK][iI][pP])[ \t]*"
|
||||||
|
|
||||||
|
# See whether we have the directive, and if yes, where.
|
||||||
|
pos = match(line, rx "$")
|
||||||
|
if (!pos)
|
||||||
|
pos = match(line, rx "[^a-zA-Z0-9_]")
|
||||||
|
|
||||||
|
# If there was no TAP directive, we have nothing more to do.
|
||||||
|
if (!pos)
|
||||||
|
return
|
||||||
|
|
||||||
|
# Let`s now see if the TAP directive has been escaped. For example:
|
||||||
|
# escaped: ok \# SKIP
|
||||||
|
# not escaped: ok \\# SKIP
|
||||||
|
# escaped: ok \\\\\# SKIP
|
||||||
|
# not escaped: ok \ # SKIP
|
||||||
|
if (substr(line, pos, 1) == "#")
|
||||||
|
{
|
||||||
|
bslash_count = 0
|
||||||
|
for (i = pos; i > 1 && substr(line, i - 1, 1) == "\\"; i--)
|
||||||
|
bslash_count += 1
|
||||||
|
if (bslash_count % 2)
|
||||||
|
return # Directive was escaped.
|
||||||
|
}
|
||||||
|
|
||||||
|
# Strip the directive and its explanation (if any) from the test
|
||||||
|
# description.
|
||||||
|
result_obj["description"] = substr(line, 1, pos - 1)
|
||||||
|
# Now remove the test description from the line, that has been dealt
|
||||||
|
# with already.
|
||||||
|
line = substr(line, pos)
|
||||||
|
# Strip the directive, and save its value (normalized to upper case).
|
||||||
|
sub("^[ \t]*#[ \t]*", "", line)
|
||||||
|
result_obj["directive"] = toupper(substr(line, 1, 4))
|
||||||
|
line = substr(line, 5)
|
||||||
|
# Now get the explanation for the directive (if any), with leading
|
||||||
|
# and trailing whitespace removed.
|
||||||
|
sub("^[ \t]*", "", line)
|
||||||
|
sub("[ \t]*$", "", line)
|
||||||
|
result_obj["explanation"] = line
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_test_exit_message(status)
|
||||||
|
{
|
||||||
|
if (status == 0)
|
||||||
|
return ""
|
||||||
|
if (status !~ /^[1-9][0-9]*$/)
|
||||||
|
abort("getting exit status")
|
||||||
|
if (status < 127)
|
||||||
|
exit_details = ""
|
||||||
|
else if (status == 127)
|
||||||
|
exit_details = " (command not found?)"
|
||||||
|
else if (status >= 128 && status <= 255)
|
||||||
|
exit_details = sprintf(" (terminated by signal %d?)", status - 128)
|
||||||
|
else if (status > 256 && status <= 384)
|
||||||
|
# We used to report an "abnormal termination" here, but some Korn
|
||||||
|
# shells, when a child process die due to signal number n, can leave
|
||||||
|
# in $? an exit status of 256+n instead of the more standard 128+n.
|
||||||
|
# Apparently, both behaviours are allowed by POSIX (2008), so be
|
||||||
|
# prepared to handle them both. See also Austing Group report ID
|
||||||
|
# 0000051 <http://www.austingroupbugs.net/view.php?id=51>
|
||||||
|
exit_details = sprintf(" (terminated by signal %d?)", status - 256)
|
||||||
|
else
|
||||||
|
# Never seen in practice.
|
||||||
|
exit_details = " (abnormal termination)"
|
||||||
|
return sprintf("exited with status %d%s", status, exit_details)
|
||||||
|
}
|
||||||
|
|
||||||
|
function write_test_results()
|
||||||
|
{
|
||||||
|
print ":global-test-result: " get_global_test_result() > trs_file
|
||||||
|
print ":recheck: " yn(must_recheck()) > trs_file
|
||||||
|
print ":copy-in-global-log: " yn(copy_in_global_log()) > trs_file
|
||||||
|
for (i = 0; i < test_results_index; i += 1)
|
||||||
|
print ":test-result: " test_results_list[i] > trs_file
|
||||||
|
close(trs_file);
|
||||||
|
}
|
||||||
|
|
||||||
|
BEGIN {
|
||||||
|
|
||||||
|
## ------- ##
|
||||||
|
## SETUP ##
|
||||||
|
## ------- ##
|
||||||
|
|
||||||
|
'"$init_colors"'
|
||||||
|
|
||||||
|
# Properly initialized once the TAP plan is seen.
|
||||||
|
planned_tests = 0
|
||||||
|
|
||||||
|
COOKED_PASS = expect_failure ? "XPASS": "PASS";
|
||||||
|
COOKED_FAIL = expect_failure ? "XFAIL": "FAIL";
|
||||||
|
|
||||||
|
# Enumeration-like constants to remember which kind of plan (if any)
|
||||||
|
# has been seen. It is important that NO_PLAN evaluates "false" as
|
||||||
|
# a boolean.
|
||||||
|
NO_PLAN = 0
|
||||||
|
EARLY_PLAN = 1
|
||||||
|
LATE_PLAN = 2
|
||||||
|
|
||||||
|
testno = 0 # Number of test results seen so far.
|
||||||
|
bailed_out = 0 # Whether a "Bail out!" directive has been seen.
|
||||||
|
|
||||||
|
# Whether the TAP plan has been seen or not, and if yes, which kind
|
||||||
|
# it is ("early" is seen before any test result, "late" otherwise).
|
||||||
|
plan_seen = NO_PLAN
|
||||||
|
|
||||||
|
## --------- ##
|
||||||
|
## PARSING ##
|
||||||
|
## --------- ##
|
||||||
|
|
||||||
|
is_first_read = 1
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
# Involutions required so that we are able to read the exit status
|
||||||
|
# from the last input line.
|
||||||
|
st = getline
|
||||||
|
if (st < 0) # I/O error.
|
||||||
|
fatal("I/O error while reading from input stream")
|
||||||
|
else if (st == 0) # End-of-input
|
||||||
|
{
|
||||||
|
if (is_first_read)
|
||||||
|
abort("in input loop: only one input line")
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if (is_first_read)
|
||||||
|
{
|
||||||
|
is_first_read = 0
|
||||||
|
nextline = $0
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
curline = nextline
|
||||||
|
nextline = $0
|
||||||
|
$0 = curline
|
||||||
|
}
|
||||||
|
# Copy any input line verbatim into the log file.
|
||||||
|
print | "cat >&3"
|
||||||
|
# Parsing of TAP input should stop after a "Bail out!" directive.
|
||||||
|
if (bailed_out)
|
||||||
|
continue
|
||||||
|
|
||||||
|
# TAP test result.
|
||||||
|
if ($0 ~ /^(not )?ok$/ || $0 ~ /^(not )?ok[^a-zA-Z0-9_]/)
|
||||||
|
{
|
||||||
|
testno += 1
|
||||||
|
setup_result_obj($0)
|
||||||
|
handle_tap_result()
|
||||||
|
}
|
||||||
|
# TAP plan (normal or "SKIP" without explanation).
|
||||||
|
else if ($0 ~ /^1\.\.[0-9]+[ \t]*$/)
|
||||||
|
{
|
||||||
|
# The next two lines will put the number of planned tests in $0.
|
||||||
|
sub("^1\\.\\.", "")
|
||||||
|
sub("[^0-9]*$", "")
|
||||||
|
handle_tap_plan($0, "")
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
# TAP "SKIP" plan, with an explanation.
|
||||||
|
else if ($0 ~ /^1\.\.0+[ \t]*#/)
|
||||||
|
{
|
||||||
|
# The next lines will put the skip explanation in $0, stripping
|
||||||
|
# any leading and trailing whitespace. This is a little more
|
||||||
|
# tricky in truth, since we want to also strip a potential leading
|
||||||
|
# "SKIP" string from the message.
|
||||||
|
sub("^[^#]*#[ \t]*(SKIP[: \t][ \t]*)?", "")
|
||||||
|
sub("[ \t]*$", "");
|
||||||
|
handle_tap_plan(0, $0)
|
||||||
|
}
|
||||||
|
# "Bail out!" magic.
|
||||||
|
# Older versions of prove and TAP::Harness (e.g., 3.17) did not
|
||||||
|
# recognize a "Bail out!" directive when preceded by leading
|
||||||
|
# whitespace, but more modern versions (e.g., 3.23) do. So we
|
||||||
|
# emulate the latter, "more modern" behaviour.
|
||||||
|
else if ($0 ~ /^[ \t]*Bail out!/)
|
||||||
|
{
|
||||||
|
bailed_out = 1
|
||||||
|
# Get the bailout message (if any), with leading and trailing
|
||||||
|
# whitespace stripped. The message remains stored in `$0`.
|
||||||
|
sub("^[ \t]*Bail out![ \t]*", "");
|
||||||
|
sub("[ \t]*$", "");
|
||||||
|
# Format the error message for the
|
||||||
|
bailout_message = "Bail out!"
|
||||||
|
if (length($0))
|
||||||
|
bailout_message = bailout_message " " $0
|
||||||
|
testsuite_error(bailout_message)
|
||||||
|
}
|
||||||
|
# Maybe we have too look for dianogtic comments too.
|
||||||
|
else if (comments != 0)
|
||||||
|
{
|
||||||
|
comment = extract_tap_comment($0);
|
||||||
|
if (length(comment))
|
||||||
|
report("#", comment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
## -------- ##
|
||||||
|
## FINISH ##
|
||||||
|
## -------- ##
|
||||||
|
|
||||||
|
# A "Bail out!" directive should cause us to ignore any following TAP
|
||||||
|
# error, as well as a non-zero exit status from the TAP producer.
|
||||||
|
if (!bailed_out)
|
||||||
|
{
|
||||||
|
if (!plan_seen)
|
||||||
|
{
|
||||||
|
testsuite_error("missing test plan")
|
||||||
|
}
|
||||||
|
else if (planned_tests != testno)
|
||||||
|
{
|
||||||
|
bad_amount = testno > planned_tests ? "many" : "few"
|
||||||
|
testsuite_error(sprintf("too %s tests run (expected %d, got %d)",
|
||||||
|
bad_amount, planned_tests, testno))
|
||||||
|
}
|
||||||
|
if (!ignore_exit)
|
||||||
|
{
|
||||||
|
# Fetch exit status from the last line.
|
||||||
|
exit_message = get_test_exit_message(nextline)
|
||||||
|
if (exit_message)
|
||||||
|
testsuite_error(exit_message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
write_test_results()
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
} # End of "BEGIN" block.
|
||||||
|
'
|
||||||
|
|
||||||
|
# TODO: document that we consume the file descriptor 3 :-(
|
||||||
|
} 3>"$log_file"
|
||||||
|
|
||||||
|
test $? -eq 0 || fatal "I/O or internal error"
|
||||||
|
|
||||||
|
# Local Variables:
|
||||||
|
# mode: shell-script
|
||||||
|
# sh-indentation: 2
|
||||||
|
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||||
|
# time-stamp-start: "scriptversion="
|
||||||
|
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||||
|
# time-stamp-time-zone: "UTC"
|
||||||
|
# time-stamp-end: "; # UTC"
|
||||||
|
# End:
|
282
tests/CMakeLists.txt
Normal file
282
tests/CMakeLists.txt
Normal file
@@ -0,0 +1,282 @@
|
|||||||
|
include_directories(
|
||||||
|
.
|
||||||
|
../include
|
||||||
|
../include/compat
|
||||||
|
../crypto/modes
|
||||||
|
../crypto/asn1
|
||||||
|
../ssl
|
||||||
|
../apps/openssl
|
||||||
|
../apps/openssl/compat
|
||||||
|
)
|
||||||
|
|
||||||
|
set(ENV{srcdir} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
|
# aeadtest
|
||||||
|
#add_executable(aeadtest aeadtest.c)
|
||||||
|
#target_link_libraries(aeadtest ${OPENSSL_LIBS})
|
||||||
|
#add_test(aeadtest aeadtest.sh)
|
||||||
|
#configure_file(aeadtests.txt aeadtests.txt COPYONLY)
|
||||||
|
#configure_file(aeadtest.sh aeadtest.sh COPYONLY)
|
||||||
|
|
||||||
|
# aes_wrap
|
||||||
|
add_executable(aes_wrap aes_wrap.c)
|
||||||
|
target_link_libraries(aes_wrap ${OPENSSL_LIBS})
|
||||||
|
add_test(aes_wrap aes_wrap)
|
||||||
|
|
||||||
|
# arc4randomforktest
|
||||||
|
# Windows/mingw does not have fork, but Cygwin does.
|
||||||
|
if(NOT CMAKE_HOST_WIN32)
|
||||||
|
add_executable(arc4randomforktest arc4randomforktest.c)
|
||||||
|
target_link_libraries(arc4randomforktest ${OPENSSL_LIBS})
|
||||||
|
add_test(arc4randomforktest ${CMAKE_CURRENT_SOURCE_DIR}/arc4randomforktest.sh)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# asn1test
|
||||||
|
add_executable(asn1test asn1test.c)
|
||||||
|
target_link_libraries(asn1test ${OPENSSL_LIBS})
|
||||||
|
add_test(asn1test asn1test)
|
||||||
|
|
||||||
|
# asn1time
|
||||||
|
add_executable(asn1time asn1time.c)
|
||||||
|
target_link_libraries(asn1time ${OPENSSL_LIBS})
|
||||||
|
add_test(asn1time asn1time)
|
||||||
|
|
||||||
|
# base64test
|
||||||
|
add_executable(base64test base64test.c)
|
||||||
|
target_link_libraries(base64test ${OPENSSL_LIBS})
|
||||||
|
add_test(base64test base64test)
|
||||||
|
|
||||||
|
# bftest
|
||||||
|
add_executable(bftest bftest.c)
|
||||||
|
target_link_libraries(bftest ${OPENSSL_LIBS})
|
||||||
|
add_test(bftest bftest)
|
||||||
|
|
||||||
|
# bntest
|
||||||
|
add_executable(bntest bntest.c)
|
||||||
|
target_link_libraries(bntest ${OPENSSL_LIBS})
|
||||||
|
add_test(bntest bntest)
|
||||||
|
|
||||||
|
# bytestringtest
|
||||||
|
add_executable(bytestringtest bytestringtest.c)
|
||||||
|
target_link_libraries(bytestringtest ${OPENSSL_LIBS})
|
||||||
|
add_test(bytestringtest bytestringtest)
|
||||||
|
|
||||||
|
# casttest
|
||||||
|
add_executable(casttest casttest.c)
|
||||||
|
target_link_libraries(casttest ${OPENSSL_LIBS})
|
||||||
|
add_test(casttest casttest)
|
||||||
|
|
||||||
|
# chachatest
|
||||||
|
add_executable(chachatest chachatest.c)
|
||||||
|
target_link_libraries(chachatest ${OPENSSL_LIBS})
|
||||||
|
add_test(chachatest chachatest)
|
||||||
|
|
||||||
|
# cipher_list
|
||||||
|
add_executable(cipher_list cipher_list.c)
|
||||||
|
target_link_libraries(cipher_list ${OPENSSL_LIBS})
|
||||||
|
add_test(cipher_list cipher_list)
|
||||||
|
|
||||||
|
# cipherstest
|
||||||
|
add_executable(cipherstest cipherstest.c)
|
||||||
|
target_link_libraries(cipherstest ${OPENSSL_LIBS})
|
||||||
|
add_test(cipherstest cipherstest)
|
||||||
|
|
||||||
|
# clienttest
|
||||||
|
add_executable(clienttest clienttest.c)
|
||||||
|
target_link_libraries(clienttest ${OPENSSL_LIBS})
|
||||||
|
add_test(clienttest clienttest)
|
||||||
|
|
||||||
|
# cts128test
|
||||||
|
add_executable(cts128test cts128test.c)
|
||||||
|
target_link_libraries(cts128test ${OPENSSL_LIBS})
|
||||||
|
add_test(cts128test cts128test)
|
||||||
|
|
||||||
|
# destest
|
||||||
|
add_executable(destest destest.c)
|
||||||
|
target_link_libraries(destest ${OPENSSL_LIBS})
|
||||||
|
add_test(destest destest)
|
||||||
|
|
||||||
|
# dhtest
|
||||||
|
add_executable(dhtest dhtest.c)
|
||||||
|
target_link_libraries(dhtest ${OPENSSL_LIBS})
|
||||||
|
add_test(dhtest dhtest)
|
||||||
|
|
||||||
|
# dsatest
|
||||||
|
add_executable(dsatest dsatest.c)
|
||||||
|
target_link_libraries(dsatest ${OPENSSL_LIBS})
|
||||||
|
add_test(dsatest dsatest)
|
||||||
|
|
||||||
|
# ecdhtest
|
||||||
|
add_executable(ecdhtest ecdhtest.c)
|
||||||
|
target_link_libraries(ecdhtest ${OPENSSL_LIBS})
|
||||||
|
add_test(ecdhtest ecdhtest)
|
||||||
|
|
||||||
|
# ecdsatest
|
||||||
|
add_executable(ecdsatest ecdsatest.c)
|
||||||
|
target_link_libraries(ecdsatest ${OPENSSL_LIBS})
|
||||||
|
add_test(ecdsatest ecdsatest)
|
||||||
|
|
||||||
|
# ectest
|
||||||
|
add_executable(ectest ectest.c)
|
||||||
|
target_link_libraries(ectest ${OPENSSL_LIBS})
|
||||||
|
add_test(ectest ectest)
|
||||||
|
|
||||||
|
# enginetest
|
||||||
|
add_executable(enginetest enginetest.c)
|
||||||
|
target_link_libraries(enginetest ${OPENSSL_LIBS})
|
||||||
|
add_test(enginetest enginetest)
|
||||||
|
|
||||||
|
# evptest
|
||||||
|
#add_executable(evptest evptest.c)
|
||||||
|
#target_link_libraries(evptest ${OPENSSL_LIBS})
|
||||||
|
#add_test(evptest ${CMAKE_CURRENT_SOURCE_DIR}/evptest.sh)
|
||||||
|
|
||||||
|
# explicit_bzero
|
||||||
|
# explicit_bzero relies on SA_ONSTACK, which is unavailable on Windows
|
||||||
|
if(NOT CMAKE_HOST_WIN32)
|
||||||
|
add_executable(explicit_bzero explicit_bzero.c)
|
||||||
|
target_link_libraries(explicit_bzero ${OPENSSL_LIBS})
|
||||||
|
add_test(explicit_bzero explicit_bzero)
|
||||||
|
#if !HAVE_MEMMEM
|
||||||
|
#explicit_bzero_SOURCES += memmem.c
|
||||||
|
#endif
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# exptest
|
||||||
|
add_executable(exptest exptest.c)
|
||||||
|
target_link_libraries(exptest ${OPENSSL_LIBS})
|
||||||
|
add_test(exptest exptest)
|
||||||
|
|
||||||
|
# gcm128test
|
||||||
|
add_executable(gcm128test gcm128test.c)
|
||||||
|
target_link_libraries(gcm128test ${OPENSSL_LIBS})
|
||||||
|
add_test(gcm128test gcm128test)
|
||||||
|
|
||||||
|
# gost2814789t
|
||||||
|
add_executable(gost2814789t gost2814789t.c)
|
||||||
|
target_link_libraries(gost2814789t ${OPENSSL_LIBS})
|
||||||
|
add_test(gost2814789t gost2814789t)
|
||||||
|
|
||||||
|
# hmactest
|
||||||
|
add_executable(hmactest hmactest.c)
|
||||||
|
target_link_libraries(hmactest ${OPENSSL_LIBS})
|
||||||
|
add_test(hmactest hmactest)
|
||||||
|
|
||||||
|
# ideatest
|
||||||
|
add_executable(ideatest ideatest.c)
|
||||||
|
target_link_libraries(ideatest ${OPENSSL_LIBS})
|
||||||
|
add_test(ideatest ideatest)
|
||||||
|
|
||||||
|
# igetest
|
||||||
|
add_executable(igetest igetest.c)
|
||||||
|
target_link_libraries(igetest ${OPENSSL_LIBS})
|
||||||
|
add_test(igetest igetest)
|
||||||
|
|
||||||
|
# md4test
|
||||||
|
add_executable(md4test md4test.c)
|
||||||
|
target_link_libraries(md4test ${OPENSSL_LIBS})
|
||||||
|
add_test(md4test md4test)
|
||||||
|
|
||||||
|
# md5test
|
||||||
|
add_executable(md5test md5test.c)
|
||||||
|
target_link_libraries(md5test ${OPENSSL_LIBS})
|
||||||
|
add_test(md5test md5test)
|
||||||
|
|
||||||
|
# mont
|
||||||
|
add_executable(mont mont.c)
|
||||||
|
target_link_libraries(mont ${OPENSSL_LIBS})
|
||||||
|
add_test(mont mont)
|
||||||
|
|
||||||
|
# optionstest
|
||||||
|
add_executable(optionstest optionstest.c)
|
||||||
|
target_link_libraries(optionstest ${OPENSSL_LIBS})
|
||||||
|
add_test(optionstest optionstest)
|
||||||
|
|
||||||
|
# pbkdf2
|
||||||
|
add_executable(pbkdf2 pbkdf2.c)
|
||||||
|
target_link_libraries(pbkdf2 ${OPENSSL_LIBS})
|
||||||
|
add_test(pbkdf2 pbkdf2)
|
||||||
|
|
||||||
|
# pkcs7test
|
||||||
|
add_executable(pkcs7test pkcs7test.c)
|
||||||
|
target_link_libraries(pkcs7test ${OPENSSL_LIBS})
|
||||||
|
add_test(pkcs7test pkcs7test)
|
||||||
|
|
||||||
|
# poly1305test
|
||||||
|
add_executable(poly1305test poly1305test.c)
|
||||||
|
target_link_libraries(poly1305test ${OPENSSL_LIBS})
|
||||||
|
add_test(poly1305test poly1305test)
|
||||||
|
|
||||||
|
# pq_test
|
||||||
|
#add_executable(pq_test pq_test.c)
|
||||||
|
#target_link_libraries(pq_test ${OPENSSL_LIBS})
|
||||||
|
#add_test(pq_test ${CMAKE_CURRENT_SOURCE_DIR}/pq_test.sh)
|
||||||
|
|
||||||
|
# randtest
|
||||||
|
add_executable(randtest randtest.c)
|
||||||
|
target_link_libraries(randtest ${OPENSSL_LIBS})
|
||||||
|
add_test(randtest randtest)
|
||||||
|
|
||||||
|
# rc2test
|
||||||
|
add_executable(rc2test rc2test.c)
|
||||||
|
target_link_libraries(rc2test ${OPENSSL_LIBS})
|
||||||
|
add_test(rc2test rc2test)
|
||||||
|
|
||||||
|
# rc4test
|
||||||
|
add_executable(rc4test rc4test.c)
|
||||||
|
target_link_libraries(rc4test ${OPENSSL_LIBS})
|
||||||
|
add_test(rc4test rc4test)
|
||||||
|
|
||||||
|
# rfc5280time
|
||||||
|
add_executable(rfc5280time rfc5280time.c)
|
||||||
|
target_link_libraries(rfc5280time ${OPENSSL_LIBS})
|
||||||
|
add_test(rfc5280time rfc5280time)
|
||||||
|
|
||||||
|
# rmdtest
|
||||||
|
add_executable(rmdtest rmdtest.c)
|
||||||
|
target_link_libraries(rmdtest ${OPENSSL_LIBS})
|
||||||
|
add_test(rmdtest rmdtest)
|
||||||
|
|
||||||
|
# sha1test
|
||||||
|
add_executable(sha1test sha1test.c)
|
||||||
|
target_link_libraries(sha1test ${OPENSSL_LIBS})
|
||||||
|
add_test(sha1test sha1test)
|
||||||
|
|
||||||
|
# sha256test
|
||||||
|
add_executable(sha256test sha256test.c)
|
||||||
|
target_link_libraries(sha256test ${OPENSSL_LIBS})
|
||||||
|
add_test(sha256test sha256test)
|
||||||
|
|
||||||
|
# sha512test
|
||||||
|
add_executable(sha512test sha512test.c)
|
||||||
|
target_link_libraries(sha512test ${OPENSSL_LIBS})
|
||||||
|
add_test(sha512test sha512test)
|
||||||
|
|
||||||
|
# ssltest
|
||||||
|
#add_executable(ssltest ssltest.c)
|
||||||
|
#target_link_libraries(ssltest ${OPENSSL_LIBS})
|
||||||
|
#add_test(ssltest ${CMAKE_CURRENT_SOURCE_DIR}/ssltest.sh)
|
||||||
|
|
||||||
|
# testdsa
|
||||||
|
#add_test(testdsa ${CMAKE_CURRENT_SOURCE_DIR}/testdsa.sh)
|
||||||
|
|
||||||
|
# testenc
|
||||||
|
add_test(testenc ${CMAKE_CURRENT_SOURCE_DIR}/testenc.sh)
|
||||||
|
|
||||||
|
# testrsa
|
||||||
|
#add_test(testrsa ${CMAKE_CURRENT_SOURCE_DIR}/testrsa.sh)
|
||||||
|
|
||||||
|
# timingsafe
|
||||||
|
add_executable(timingsafe timingsafe.c)
|
||||||
|
target_link_libraries(timingsafe ${OPENSSL_LIBS})
|
||||||
|
add_test(timingsafe timingsafe)
|
||||||
|
|
||||||
|
# utf8test
|
||||||
|
add_executable(utf8test utf8test.c)
|
||||||
|
target_link_libraries(utf8test ${OPENSSL_LIBS})
|
||||||
|
add_test(utf8test utf8test)
|
||||||
|
|
||||||
|
# verifytest
|
||||||
|
add_executable(verifytest verifytest.c)
|
||||||
|
target_link_libraries(verifytest tls ${OPENSSL_LIBS})
|
||||||
|
add_test(verifytest verifytest)
|
@@ -3,15 +3,19 @@ include $(top_srcdir)/Makefile.am.common
|
|||||||
AM_CPPFLAGS += -I $(top_srcdir)/crypto/modes
|
AM_CPPFLAGS += -I $(top_srcdir)/crypto/modes
|
||||||
AM_CPPFLAGS += -I $(top_srcdir)/crypto/asn1
|
AM_CPPFLAGS += -I $(top_srcdir)/crypto/asn1
|
||||||
AM_CPPFLAGS += -I $(top_srcdir)/ssl
|
AM_CPPFLAGS += -I $(top_srcdir)/ssl
|
||||||
AM_CPPFLAGS += -I $(top_srcdir)/apps
|
AM_CPPFLAGS += -I $(top_srcdir)/apps/openssl
|
||||||
|
AM_CPPFLAGS += -I $(top_srcdir)/apps/openssl/compat
|
||||||
|
|
||||||
LDADD = $(PLATFORM_LDADD) $(PROG_LDADD)
|
LDADD = $(PLATFORM_LDADD) $(PROG_LDADD)
|
||||||
LDADD += $(top_builddir)/ssl/libssl.la
|
LDADD += $(abs_top_builddir)/ssl/libssl.la
|
||||||
LDADD += $(top_builddir)/crypto/libcrypto.la
|
LDADD += $(abs_top_builddir)/crypto/libcrypto.la
|
||||||
|
LDADD += $(abs_top_builddir)/tls/libtls.la
|
||||||
|
|
||||||
|
TEST_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/tap-driver.sh
|
||||||
|
|
||||||
TESTS =
|
TESTS =
|
||||||
check_PROGRAMS =
|
check_PROGRAMS =
|
||||||
EXTRA_DIST =
|
EXTRA_DIST = CMakeLists.txt
|
||||||
DISTCLEANFILES = pidwraptest.txt
|
DISTCLEANFILES = pidwraptest.txt
|
||||||
|
|
||||||
# aeadtest
|
# aeadtest
|
||||||
@@ -40,6 +44,11 @@ TESTS += asn1test
|
|||||||
check_PROGRAMS += asn1test
|
check_PROGRAMS += asn1test
|
||||||
asn1test_SOURCES = asn1test.c
|
asn1test_SOURCES = asn1test.c
|
||||||
|
|
||||||
|
# asn1time
|
||||||
|
TESTS += asn1time
|
||||||
|
check_PROGRAMS += asn1time
|
||||||
|
asn1time_SOURCES = asn1time.c
|
||||||
|
|
||||||
# base64test
|
# base64test
|
||||||
TESTS += base64test
|
TESTS += base64test
|
||||||
check_PROGRAMS += base64test
|
check_PROGRAMS += base64test
|
||||||
@@ -89,6 +98,11 @@ TESTS += cipherstest
|
|||||||
check_PROGRAMS += cipherstest
|
check_PROGRAMS += cipherstest
|
||||||
cipherstest_SOURCES = cipherstest.c
|
cipherstest_SOURCES = cipherstest.c
|
||||||
|
|
||||||
|
# clienttest
|
||||||
|
TESTS += clienttest
|
||||||
|
check_PROGRAMS += clienttest
|
||||||
|
clienttest_SOURCES = clienttest.c
|
||||||
|
|
||||||
# cts128test
|
# cts128test
|
||||||
TESTS += cts128test
|
TESTS += cts128test
|
||||||
check_PROGRAMS += cts128test
|
check_PROGRAMS += cts128test
|
||||||
@@ -208,10 +222,11 @@ pbkdf2_SOURCES = pbkdf2.c
|
|||||||
# pidwraptest relies on an OS-specific way to give out pids and is generally
|
# pidwraptest relies on an OS-specific way to give out pids and is generally
|
||||||
# awkward on systems with slow fork
|
# awkward on systems with slow fork
|
||||||
if ENABLE_EXTRATESTS
|
if ENABLE_EXTRATESTS
|
||||||
TESTS += pidwraptest
|
TESTS += pidwraptest.sh
|
||||||
check_PROGRAMS += pidwraptest
|
check_PROGRAMS += pidwraptest
|
||||||
pidwraptest_SOURCES = pidwraptest.c
|
pidwraptest_SOURCES = pidwraptest.c
|
||||||
endif
|
endif
|
||||||
|
EXTRA_DIST += pidwraptest.sh
|
||||||
|
|
||||||
# pkcs7test
|
# pkcs7test
|
||||||
TESTS += pkcs7test
|
TESTS += pkcs7test
|
||||||
@@ -245,6 +260,16 @@ TESTS += rc4test
|
|||||||
check_PROGRAMS += rc4test
|
check_PROGRAMS += rc4test
|
||||||
rc4test_SOURCES = rc4test.c
|
rc4test_SOURCES = rc4test.c
|
||||||
|
|
||||||
|
# rfc5280time
|
||||||
|
check_PROGRAMS += rfc5280time
|
||||||
|
rfc5280time_SOURCES = rfc5280time.c
|
||||||
|
if SMALL_TIME_T
|
||||||
|
TESTS += rfc5280time_small.test
|
||||||
|
else
|
||||||
|
TESTS += rfc5280time
|
||||||
|
endif
|
||||||
|
EXTRA_DIST += rfc5280time_small.test
|
||||||
|
|
||||||
# rmdtest
|
# rmdtest
|
||||||
TESTS += rmdtest
|
TESTS += rmdtest
|
||||||
check_PROGRAMS += rmdtest
|
check_PROGRAMS += rmdtest
|
||||||
@@ -265,11 +290,6 @@ TESTS += sha512test
|
|||||||
check_PROGRAMS += sha512test
|
check_PROGRAMS += sha512test
|
||||||
sha512test_SOURCES = sha512test.c
|
sha512test_SOURCES = sha512test.c
|
||||||
|
|
||||||
# shatest
|
|
||||||
TESTS += shatest
|
|
||||||
check_PROGRAMS += shatest
|
|
||||||
shatest_SOURCES = shatest.c
|
|
||||||
|
|
||||||
# ssltest
|
# ssltest
|
||||||
TESTS += ssltest.sh
|
TESTS += ssltest.sh
|
||||||
check_PROGRAMS += ssltest
|
check_PROGRAMS += ssltest
|
||||||
@@ -300,3 +320,7 @@ TESTS += utf8test
|
|||||||
check_PROGRAMS += utf8test
|
check_PROGRAMS += utf8test
|
||||||
utf8test_SOURCES = utf8test.c
|
utf8test_SOURCES = utf8test.c
|
||||||
|
|
||||||
|
# verifytest
|
||||||
|
TESTS += verifytest
|
||||||
|
check_PROGRAMS += verifytest
|
||||||
|
verifytest_SOURCES = verifytest.c
|
||||||
|
10
tests/rfc5280time_small.test
Executable file
10
tests/rfc5280time_small.test
Executable file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
echo 1..2
|
||||||
|
TEST=./rfc5280time
|
||||||
|
if [ -e ./rfc5280time.exe ]; then
|
||||||
|
TEST=./rfc5280time.exe
|
||||||
|
fi
|
||||||
|
$TEST
|
||||||
|
echo "ok 1"
|
||||||
|
echo "ok 2 - rfc5280time_64-bit # SKIP this system is unable to represent times past 2038"
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user