From 4f6b8899f1231fbc3250dc17c63200007a51b2f5 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Thu, 15 May 2014 18:19:59 +0000
Subject: import patch from 1.0.0j


diff --git a/Configure b/Configure
index cd849e3..0ff7727 100755
--- a/Configure
+++ b/Configure
@@ -583,6 +583,10 @@ my %table=(
 "uClinux-dist","$ENV{'CC'}:\$(CFLAGS)::-D_REENTRANT::\$(LDFLAGS) \$(LDLIBS):BN_LLONG:::::::::::::::$ENV{'LIBSSL_dlfcn'}:linux-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):$ENV{'RANLIB'}::",
 "uClinux-dist64","$ENV{'CC'}:\$(CFLAGS)::-D_REENTRANT::\$(LDFLAGS) \$(LDLIBS):SIXTY_FOUR_BIT_LONG:::::::::::::::$ENV{'LIBSSL_dlfcn'}:linux-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):$ENV{'RANLIB'}::",
 
+##### Haiku
+"haiku-x86",	"gcc:-DL_ENDIAN -O2 -fomit-frame-pointer -Wall::-D_REENTRANT::-lnetwork:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:haiku-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"haiku-x86_64",	"gcc:-m64 -DL_ENDIAN -O2 -Wall -DMD32_REG_T=int::-D_REENTRANT::-lnetwork:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:haiku-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
+
 );
 
 my @MK1MF_Builds=qw(VC-WIN64I VC-WIN64A
diff --git a/Makefile.shared b/Makefile.shared
index e753f44..cce510f 100644
--- a/Makefile.shared
+++ b/Makefile.shared
@@ -594,10 +594,10 @@ symlink.hpux:
 symlink.cygwin symlink.alpha-osf1 symlink.tru64 symlink.tru64-rpath symlink.beos:
 
 # Compatibility targets
-link_o.bsd-gcc-shared link_o.linux-shared link_o.gnu-shared: link_o.gnu
-link_a.bsd-gcc-shared link_a.linux-shared link_a.gnu-shared: link_a.gnu
-link_app.bsd-gcc-shared link_app.linux-shared link_app.gnu-shared: link_app.gnu
-symlink.bsd-gcc-shared symlink.bsd-shared symlink.linux-shared symlink.gnu-shared: symlink.gnu
+link_o.bsd-gcc-shared link_o.linux-shared link_o.gnu-shared link_o.haiku-shared: link_o.gnu
+link_a.bsd-gcc-shared link_a.linux-shared link_a.gnu-shared link_a.haiku-shared: link_a.gnu
+link_app.bsd-gcc-shared link_app.linux-shared link_app.gnu-shared link_app.haiku-shared: link_app.gnu
+symlink.bsd-gcc-shared symlink.bsd-shared symlink.linux-shared symlink.gnu-shared symlink.haiku-shared: symlink.gnu
 link_o.bsd-shared: link_o.bsd
 link_a.bsd-shared: link_a.bsd
 link_app.bsd-shared: link_app.bsd
diff --git a/config b/config
index 30e9a37..c2894cc 100755
--- a/config
+++ b/config
@@ -134,6 +134,14 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
 	echo "${MACHINE}-dg-dgux"; exit 0
 	;;
 
+    Haiku:*:BePC)
+	echo "i586-pc-haiku"; exit 0
+	;;
+
+    Haiku:*:*)
+	echo "${MACHINE}-unknown-haiku"; exit 0
+	;;
+
     HI-UX:*)
 	echo "${MACHINE}-hi-hiux"; exit 0
 	;;
@@ -799,6 +807,9 @@ case "$GUESSOS" in
 	    options="$options no-asm"
 	fi
 	;;
+     i586-*-haiku) OUT="haiku-x86" ;;
+     x86_64-*-haiku) OUT="haiku-x86_64" ;;
+
   # these are all covered by the catchall below
   # *-dgux) OUT="dgux" ;;
   mips-sony-newsos4) OUT="newsos4-gcc" ;;
diff --git a/doc/apps/cms.pod b/doc/apps/cms.pod
index a09588a..2d19d91 100644
--- a/doc/apps/cms.pod
+++ b/doc/apps/cms.pod
@@ -450,28 +450,28 @@ remains DER.
 
 =over 4
 
-=item 0
+=item C<0>
 
 the operation was completely successfully.
 
-=item 1 
+=item C<1>
 
 an error occurred parsing the command options.
 
-=item 2
+=item C<2>
 
 one of the input files could not be read.
 
-=item 3
+=item C<3>
 
 an error occurred creating the CMS file or when reading the MIME
 message.
 
-=item 4
+=item C<4>
 
 an error occurred decrypting or verifying the message.
 
-=item 5
+=item C<5>
 
 the message was verified correctly but an error occurred writing out
 the signers certificates.
diff --git a/doc/apps/genpkey.pod b/doc/apps/genpkey.pod
index 1611b5c..c74d097 100644
--- a/doc/apps/genpkey.pod
+++ b/doc/apps/genpkey.pod
@@ -114,6 +114,8 @@ hexadecimal value if preceded by B<0x>. Default value is 65537.
 
 The number of bits in the generated parameters. If not specified 1024 is used.
 
+=back
+
 =head1 DH PARAMETER GENERATION OPTIONS
 
 =over 4
diff --git a/doc/apps/openssl.pod b/doc/apps/openssl.pod
index 738142e..64a160c 100644
--- a/doc/apps/openssl.pod
+++ b/doc/apps/openssl.pod
@@ -287,8 +287,6 @@ SHA Digest
 
 SHA-1 Digest
 
-=back
-
 =item B<sha224>
 
 SHA-224 Digest
@@ -305,6 +303,8 @@ SHA-384 Digest
 
 SHA-512 Digest
 
+=back
+
 =head2 ENCODING AND CIPHER COMMANDS
 
 =over 10
diff --git a/doc/apps/smime.pod b/doc/apps/smime.pod
index e4e89af..72c7b24 100644
--- a/doc/apps/smime.pod
+++ b/doc/apps/smime.pod
@@ -308,28 +308,28 @@ remains DER.
 
 =over 4
 
-=item 0
+=item C<0>
 
 the operation was completely successfully.
 
-=item 1 
+=item C<1>
 
 an error occurred parsing the command options.
 
-=item 2
+=item C<2>
 
 one of the input files could not be read.
 
-=item 3
+=item C<3>
 
 an error occurred creating the PKCS#7 file or when reading the MIME
 message.
 
-=item 4
+=item C<4>
 
 an error occurred decrypting or verifying the message.
 
-=item 5
+=item C<5>
 
 the message was verified correctly but an error occurred writing out
 the signers certificates.
diff --git a/doc/ssl/SSL_COMP_add_compression_method.pod b/doc/ssl/SSL_COMP_add_compression_method.pod
index 42fa66b..80175a3 100644
--- a/doc/ssl/SSL_COMP_add_compression_method.pod
+++ b/doc/ssl/SSL_COMP_add_compression_method.pod
@@ -53,11 +53,11 @@ SSL_COMP_add_compression_method() may return the following values:
 
 =over 4
 
-=item 0
+=item C<0>
 
 The operation succeeded.
 
-=item 1
+=item C<1>
 
 The operation failed. Check the error queue to find out the reason.
 
diff --git a/doc/ssl/SSL_CTX_add_session.pod b/doc/ssl/SSL_CTX_add_session.pod
index 82676b2..fd927f8 100644
--- a/doc/ssl/SSL_CTX_add_session.pod
+++ b/doc/ssl/SSL_CTX_add_session.pod
@@ -52,13 +52,13 @@ The following values are returned by all functions:
 
 =over 4
 
-=item 0
+=item C<0>
 
  The operation failed. In case of the add operation, it was tried to add
  the same (identical) session twice. In case of the remove operation, the
  session was not found in the cache.
 
-=item 1
+=item C<1>
  
  The operation succeeded.
 
diff --git a/doc/ssl/SSL_CTX_load_verify_locations.pod b/doc/ssl/SSL_CTX_load_verify_locations.pod
index 84a799f..de01065 100644
--- a/doc/ssl/SSL_CTX_load_verify_locations.pod
+++ b/doc/ssl/SSL_CTX_load_verify_locations.pod
@@ -100,13 +100,13 @@ The following return values can occur:
 
 =over 4
 
-=item 0
+=item C<0>
 
 The operation failed because B<CAfile> and B<CApath> are NULL or the
 processing at one of the locations specified failed. Check the error
 stack to find out the reason.
 
-=item 1
+=item C<1>
 
 The operation succeeded.
 
diff --git a/doc/ssl/SSL_CTX_set_client_CA_list.pod b/doc/ssl/SSL_CTX_set_client_CA_list.pod
index 5e66133..bcf35dc 100644
--- a/doc/ssl/SSL_CTX_set_client_CA_list.pod
+++ b/doc/ssl/SSL_CTX_set_client_CA_list.pod
@@ -66,13 +66,13 @@ values:
 
 =over 4
 
-=item 0
+=item C<0>
 
 A failure while manipulating the STACK_OF(X509_NAME) object occurred or
 the X509_NAME could not be extracted from B<cacert>. Check the error stack
 to find out the reason.
 
-=item 1
+=item C<1>
 
 The operation succeeded.
 
diff --git a/doc/ssl/SSL_CTX_set_session_id_context.pod b/doc/ssl/SSL_CTX_set_session_id_context.pod
index 58fc685..ed0a81c 100644
--- a/doc/ssl/SSL_CTX_set_session_id_context.pod
+++ b/doc/ssl/SSL_CTX_set_session_id_context.pod
@@ -64,13 +64,13 @@ return the following values:
 
 =over 4
 
-=item 0
+=item C<0>
 
 The length B<sid_ctx_len> of the session id context B<sid_ctx> exceeded
 the maximum allowed length of B<SSL_MAX_SSL_SESSION_ID_LENGTH>. The error
 is logged to the error stack.
 
-=item 1
+=item C<1>
 
 The operation succeeded.
 
diff --git a/doc/ssl/SSL_CTX_set_ssl_version.pod b/doc/ssl/SSL_CTX_set_ssl_version.pod
index 254f2b4..5ea8f0d 100644
--- a/doc/ssl/SSL_CTX_set_ssl_version.pod
+++ b/doc/ssl/SSL_CTX_set_ssl_version.pod
@@ -42,11 +42,11 @@ and SSL_set_ssl_method():
 
 =over 4
 
-=item 0
+=item C<0>
 
 The new choice failed, check the error stack to find out the reason.
 
-=item 1
+=item C<1>
 
 The operation succeeded.
 
diff --git a/doc/ssl/SSL_CTX_use_psk_identity_hint.pod b/doc/ssl/SSL_CTX_use_psk_identity_hint.pod
index 7e60df5..721e884 100644
--- a/doc/ssl/SSL_CTX_use_psk_identity_hint.pod
+++ b/doc/ssl/SSL_CTX_use_psk_identity_hint.pod
@@ -83,6 +83,8 @@ Return values from the server callback are interpreted as follows:
 
 =over 4
 
+=over
+
 =item > 0
 
 PSK identity was found and the server callback has provided the PSK
diff --git a/doc/ssl/SSL_clear.pod b/doc/ssl/SSL_clear.pod
index d4df1bf..2da0b02 100644
--- a/doc/ssl/SSL_clear.pod
+++ b/doc/ssl/SSL_clear.pod
@@ -56,12 +56,12 @@ The following return values can occur:
 
 =over 4
 
-=item 0
+=item C<0>
 
 The SSL_clear() operation could not be performed. Check the error stack to
 find out the reason.
 
-=item 1
+=item C<1>
 
 The SSL_clear() operation was successful.
 
diff --git a/doc/ssl/SSL_read.pod b/doc/ssl/SSL_read.pod
index 7038cd2..3982b81 100644
--- a/doc/ssl/SSL_read.pod
+++ b/doc/ssl/SSL_read.pod
@@ -86,7 +86,7 @@ The following return values can occur:
 The read operation was successful; the return value is the number of
 bytes actually read from the TLS/SSL connection.
 
-=item 0
+=item C<0>
 
 The read operation was not successful. The reason may either be a clean
 shutdown due to a "close notify" alert sent by the peer (in which case
diff --git a/doc/ssl/SSL_session_reused.pod b/doc/ssl/SSL_session_reused.pod
index da7d062..033d54c 100644
--- a/doc/ssl/SSL_session_reused.pod
+++ b/doc/ssl/SSL_session_reused.pod
@@ -27,11 +27,11 @@ The following return values can occur:
 
 =over 4
 
-=item 0
+=item C<0>
 
 A new session was negotiated.
 
-=item 1
+=item C<1>
 
 A session was reused.
 
diff --git a/doc/ssl/SSL_set_fd.pod b/doc/ssl/SSL_set_fd.pod
index 7029112..59e1b2b 100644
--- a/doc/ssl/SSL_set_fd.pod
+++ b/doc/ssl/SSL_set_fd.pod
@@ -35,11 +35,11 @@ The following return values can occur:
 
 =over 4
 
-=item 0
+=item C<0>
 
 The operation failed. Check the error stack to find out why.
 
-=item 1
+=item C<1>
 
 The operation succeeded.
 
diff --git a/doc/ssl/SSL_set_session.pod b/doc/ssl/SSL_set_session.pod
index 5f54714..d35e6d3 100644
--- a/doc/ssl/SSL_set_session.pod
+++ b/doc/ssl/SSL_set_session.pod
@@ -37,11 +37,11 @@ The following return values can occur:
 
 =over 4
 
-=item 0
+=item C<0>
 
 The operation failed; check the error stack to find out the reason.
 
-=item 1
+=item C<1>
 
 The operation succeeded.
 
diff --git a/doc/ssl/SSL_write.pod b/doc/ssl/SSL_write.pod
index e013c12..30f9e2b 100644
--- a/doc/ssl/SSL_write.pod
+++ b/doc/ssl/SSL_write.pod
@@ -79,7 +79,7 @@ The following return values can occur:
 The write operation was successful, the return value is the number of
 bytes actually written to the TLS/SSL connection.
 
-=item 0
+=item C<0>
 
 The write operation was not successful. Probably the underlying connection
 was closed. Call SSL_get_error() with the return value B<ret> to find out,
-- 
1.8.3.4


From 0c4539d72e181675fcc7bd1fdbf3d5ebabed2d51 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Thu, 15 May 2014 19:58:00 +0000
Subject: doc fixes


diff --git a/doc/ssl/SSL_CTX_use_psk_identity_hint.pod b/doc/ssl/SSL_CTX_use_psk_identity_hint.pod
index 721e884..d2644c6 100644
--- a/doc/ssl/SSL_CTX_use_psk_identity_hint.pod
+++ b/doc/ssl/SSL_CTX_use_psk_identity_hint.pod
@@ -98,7 +98,7 @@ data to B<psk> and return the length of the random data, so the
 connection will fail with decryption_error before it will be finished
 completely.
 
-=item 0
+=item C<0>
 
 PSK identity was not found. An "unknown_psk_identity" alert message
 will be sent and the connection setup fails.
-- 
1.8.3.4


From 94e239bab7b08aef02831852932696e7e472ea9f Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Thu, 15 May 2014 20:16:41 +0000
Subject: doc fixes


diff --git a/doc/ssl/SSL_CTX_use_psk_identity_hint.pod b/doc/ssl/SSL_CTX_use_psk_identity_hint.pod
index d2644c6..45f1ed5 100644
--- a/doc/ssl/SSL_CTX_use_psk_identity_hint.pod
+++ b/doc/ssl/SSL_CTX_use_psk_identity_hint.pod
@@ -83,8 +83,6 @@ Return values from the server callback are interpreted as follows:
 
 =over 4
 
-=over
-
 =item > 0
 
 PSK identity was found and the server callback has provided the PSK
-- 
1.8.3.4


From 5c9a621eef12a8bb020f7994014cd34d97daee0d Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Thu, 15 May 2014 20:26:29 +0000
Subject: doc fixes


diff --git a/doc/ssl/SSL_accept.pod b/doc/ssl/SSL_accept.pod
index b1c34d1..288203f 100644
--- a/doc/ssl/SSL_accept.pod
+++ b/doc/ssl/SSL_accept.pod
@@ -44,13 +44,13 @@ The following return values can occur:
 
 =over 4
 
-=item 0
+=item C<0>
 
 The TLS/SSL handshake was not successful but was shut down controlled and
 by the specifications of the TLS/SSL protocol. Call SSL_get_error() with the
 return value B<ret> to find out the reason.
 
-=item 1
+=item C<1>
 
 The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been
 established.
-- 
1.8.3.4


From 282293a280a46d39cfecb786c45749e6532392b9 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Thu, 15 May 2014 20:40:45 +0000
Subject: doc fixes


diff --git a/doc/ssl/SSL_connect.pod b/doc/ssl/SSL_connect.pod
index 946ca89..e62a838 100644
--- a/doc/ssl/SSL_connect.pod
+++ b/doc/ssl/SSL_connect.pod
@@ -41,13 +41,13 @@ The following return values can occur:
 
 =over 4
 
-=item 0
+=item C<0>
 
 The TLS/SSL handshake was not successful but was shut down controlled and
 by the specifications of the TLS/SSL protocol. Call SSL_get_error() with the
 return value B<ret> to find out the reason.
 
-=item 1
+=item C<1>
 
 The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been
 established.
diff --git a/doc/ssl/SSL_do_handshake.pod b/doc/ssl/SSL_do_handshake.pod
index 7f8cf24..88947ca 100644
--- a/doc/ssl/SSL_do_handshake.pod
+++ b/doc/ssl/SSL_do_handshake.pod
@@ -45,13 +45,13 @@ The following return values can occur:
 
 =over 4
 
-=item 0
+=item C<0>
 
 The TLS/SSL handshake was not successful but was shut down controlled and
 by the specifications of the TLS/SSL protocol. Call SSL_get_error() with the
 return value B<ret> to find out the reason.
 
-=item 1
+=item C<1>
 
 The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been
 established.
diff --git a/doc/ssl/SSL_set_shutdown.pod b/doc/ssl/SSL_set_shutdown.pod
index 011a022..9139211 100644
--- a/doc/ssl/SSL_set_shutdown.pod
+++ b/doc/ssl/SSL_set_shutdown.pod
@@ -24,7 +24,7 @@ The shutdown state of an ssl connection is a bitmask of:
 
 =over 4
 
-=item 0
+=item C<0>
 
 No shutdown setting, yet.
 
diff --git a/doc/ssl/SSL_shutdown.pod b/doc/ssl/SSL_shutdown.pod
index 42a89b7..d86ac7c 100644
--- a/doc/ssl/SSL_shutdown.pod
+++ b/doc/ssl/SSL_shutdown.pod
@@ -92,19 +92,19 @@ The following return values can occur:
 
 =over 4
 
-=item 0
+=item C<0>
 
 The shutdown is not yet finished. Call SSL_shutdown() for a second time,
 if a bidirectional shutdown shall be performed.
 The output of L<SSL_get_error(3)|SSL_get_error(3)> may be misleading, as an
 erroneous SSL_ERROR_SYSCALL may be flagged even though no error occurred.
 
-=item 1
+=item C<1>
 
 The shutdown was successfully completed. The "close notify" alert was sent
 and the peer's "close notify" alert was received.
 
-=item -1
+=item C<-1>
 
 The shutdown was not successful because a fatal error occurred either
 at the protocol level or a connection failure occurred. It can also occur if
-- 
1.8.3.4

