diff -Naur openssl-1.0.0j/config openssl-1.0.0j-haiku/config
--- openssl-1.0.0j/config	2012-03-13 14:22:26.025427968 -0500
+++ openssl-1.0.0j-haiku/config	2013-10-19 01:35:15.671612928 -0500
@@ -134,6 +134,14 @@
 	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 @@
 	    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 -Naur openssl-1.0.0j/Configure openssl-1.0.0j-haiku/Configure
--- openssl-1.0.0j/Configure	2012-03-03 07:48:21.025690112 -0600
+++ openssl-1.0.0j-haiku/Configure	2013-10-19 01:35:15.666632192 -0500
@@ -582,6 +582,10 @@
 "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 -Naur openssl-1.0.0j/doc/apps/cms.pod openssl-1.0.0j-haiku/doc/apps/cms.pod
--- openssl-1.0.0j/doc/apps/cms.pod	2009-09-30 18:40:37.031195136 -0500
+++ openssl-1.0.0j-haiku/doc/apps/cms.pod	2013-10-19 01:35:39.000786432 -0500
@@ -450,28 +450,28 @@
 
 =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 -Naur openssl-1.0.0j/doc/apps/smime.pod openssl-1.0.0j-haiku/doc/apps/smime.pod
--- openssl-1.0.0j/doc/apps/smime.pod	2010-10-04 08:28:35.034603008 -0500
+++ openssl-1.0.0j-haiku/doc/apps/smime.pod	2013-10-19 01:35:39.003407872 -0500
@@ -308,28 +308,28 @@
 
 =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 -Naur openssl-1.0.0j/doc/crypto/X509_STORE_CTX_get_error.pod openssl-1.0.0j-haiku/doc/crypto/X509_STORE_CTX_get_error.pod
--- openssl-1.0.0j/doc/crypto/X509_STORE_CTX_get_error.pod	2009-10-18 10:28:59.056360960 -0500
+++ openssl-1.0.0j-haiku/doc/crypto/X509_STORE_CTX_get_error.pod	2013-10-19 01:35:39.005767168 -0500
@@ -278,6 +278,8 @@
 an application specific error. This will never be returned unless explicitly
 set by an application.
 
+=back
+
 =head1 NOTES
 
 The above functions should be used instead of directly referencing the fields
diff -Naur openssl-1.0.0j/doc/ssl/SSL_accept.pod openssl-1.0.0j-haiku/doc/ssl/SSL_accept.pod
--- openssl-1.0.0j/doc/ssl/SSL_accept.pod	2003-06-03 04:59:44.058982400 -0500
+++ openssl-1.0.0j-haiku/doc/ssl/SSL_accept.pod	2013-10-19 01:35:39.007864320 -0500
@@ -44,12 +44,12 @@
 
 =over 4
 
-=item 1
+=item C<1>
 
 The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been
 established.
 
-=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
diff -Naur openssl-1.0.0j/doc/ssl/SSL_clear.pod openssl-1.0.0j-haiku/doc/ssl/SSL_clear.pod
--- openssl-1.0.0j/doc/ssl/SSL_clear.pod	2011-10-13 08:24:37.059244544 -0500
+++ openssl-1.0.0j-haiku/doc/ssl/SSL_clear.pod	2013-10-19 01:35:39.009961472 -0500
@@ -56,12 +56,12 @@
 
 =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 -Naur openssl-1.0.0j/doc/ssl/SSL_COMP_add_compression_method.pod openssl-1.0.0j-haiku/doc/ssl/SSL_COMP_add_compression_method.pod
--- openssl-1.0.0j/doc/ssl/SSL_COMP_add_compression_method.pod	2003-11-29 04:33:25.059506688 -0600
+++ openssl-1.0.0j-haiku/doc/ssl/SSL_COMP_add_compression_method.pod	2013-10-19 01:35:39.012058624 -0500
@@ -53,11 +53,11 @@
 
 =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 -Naur openssl-1.0.0j/doc/ssl/SSL_connect.pod openssl-1.0.0j-haiku/doc/ssl/SSL_connect.pod
--- openssl-1.0.0j/doc/ssl/SSL_connect.pod	2003-06-03 04:59:44.059506688 -0500
+++ openssl-1.0.0j-haiku/doc/ssl/SSL_connect.pod	2013-10-19 01:35:39.014155776 -0500
@@ -41,12 +41,12 @@
 
 =over 4
 
-=item 1
+=item C<1>
 
 The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been
 established.
 
-=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
diff -Naur openssl-1.0.0j/doc/ssl/SSL_CTX_add_session.pod openssl-1.0.0j-haiku/doc/ssl/SSL_CTX_add_session.pod
--- openssl-1.0.0j/doc/ssl/SSL_CTX_add_session.pod	2002-10-28 18:33:01.059768832 -0600
+++ openssl-1.0.0j-haiku/doc/ssl/SSL_CTX_add_session.pod	2013-10-19 01:35:39.016252928 -0500
@@ -52,13 +52,13 @@
 
 =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 -Naur openssl-1.0.0j/doc/ssl/SSL_CTX_load_verify_locations.pod openssl-1.0.0j-haiku/doc/ssl/SSL_CTX_load_verify_locations.pod
--- openssl-1.0.0j/doc/ssl/SSL_CTX_load_verify_locations.pod	2001-09-07 01:13:39.060293120 -0500
+++ openssl-1.0.0j-haiku/doc/ssl/SSL_CTX_load_verify_locations.pod	2013-10-19 01:35:39.018350080 -0500
@@ -100,13 +100,13 @@
 
 =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 -Naur openssl-1.0.0j/doc/ssl/SSL_CTX_set_client_CA_list.pod openssl-1.0.0j-haiku/doc/ssl/SSL_CTX_set_client_CA_list.pod
--- openssl-1.0.0j/doc/ssl/SSL_CTX_set_client_CA_list.pod	2001-04-12 11:02:34.061079552 -0500
+++ openssl-1.0.0j-haiku/doc/ssl/SSL_CTX_set_client_CA_list.pod	2013-10-19 01:35:39.020709376 -0500
@@ -66,11 +66,11 @@
 
 =over 4
 
-=item 1
+=item C<1>
 
 The operation succeeded.
 
-=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
diff -Naur openssl-1.0.0j/doc/ssl/SSL_CTX_set_session_id_context.pod openssl-1.0.0j-haiku/doc/ssl/SSL_CTX_set_session_id_context.pod
--- openssl-1.0.0j/doc/ssl/SSL_CTX_set_session_id_context.pod	2004-06-14 08:27:28.062390272 -0500
+++ openssl-1.0.0j-haiku/doc/ssl/SSL_CTX_set_session_id_context.pod	2013-10-19 01:35:39.022806528 -0500
@@ -64,13 +64,13 @@
 
 =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 -Naur openssl-1.0.0j/doc/ssl/SSL_CTX_set_ssl_version.pod openssl-1.0.0j-haiku/doc/ssl/SSL_CTX_set_ssl_version.pod
--- openssl-1.0.0j/doc/ssl/SSL_CTX_set_ssl_version.pod	2005-08-14 16:48:32.062652416 -0500
+++ openssl-1.0.0j-haiku/doc/ssl/SSL_CTX_set_ssl_version.pod	2013-10-19 01:35:39.024903680 -0500
@@ -42,11 +42,11 @@
 
 =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 -Naur openssl-1.0.0j/doc/ssl/SSL_CTX_use_psk_identity_hint.pod openssl-1.0.0j-haiku/doc/ssl/SSL_CTX_use_psk_identity_hint.pod
--- openssl-1.0.0j/doc/ssl/SSL_CTX_use_psk_identity_hint.pod	2006-03-10 17:06:17.063176704 -0600
+++ openssl-1.0.0j-haiku/doc/ssl/SSL_CTX_use_psk_identity_hint.pod	2013-10-19 01:35:39.027262976 -0500
@@ -81,6 +81,8 @@
 
 Return values from the server callback are interpreted as follows:
 
+=over
+
 =item > 0
 
 PSK identity was found and the server callback has provided the PSK
@@ -94,9 +96,11 @@
 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.
 
+=back
+
 =cut
diff -Naur openssl-1.0.0j/doc/ssl/SSL_do_handshake.pod openssl-1.0.0j-haiku/doc/ssl/SSL_do_handshake.pod
--- openssl-1.0.0j/doc/ssl/SSL_do_handshake.pod	2002-07-19 06:05:49.063438848 -0500
+++ openssl-1.0.0j-haiku/doc/ssl/SSL_do_handshake.pod	2013-10-19 01:35:39.029622272 -0500
@@ -45,12 +45,12 @@
 
 =over 4
 
-=item 1
+=item C<1>
 
 The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been
 established.
 
-=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
diff -Naur openssl-1.0.0j/doc/ssl/SSL_read.pod openssl-1.0.0j-haiku/doc/ssl/SSL_read.pod
--- openssl-1.0.0j/doc/ssl/SSL_read.pod	2008-08-01 10:03:20.065536000 -0500
+++ openssl-1.0.0j-haiku/doc/ssl/SSL_read.pod	2013-10-19 01:35:39.031719424 -0500
@@ -86,7 +86,7 @@
 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 -Naur openssl-1.0.0j/doc/ssl/SSL_session_reused.pod openssl-1.0.0j-haiku/doc/ssl/SSL_session_reused.pod
--- openssl-1.0.0j/doc/ssl/SSL_session_reused.pod	2001-07-20 13:57:15.066060288 -0500
+++ openssl-1.0.0j-haiku/doc/ssl/SSL_session_reused.pod	2013-10-19 01:35:39.033816576 -0500
@@ -27,11 +27,11 @@
 
 =over 4
 
-=item 0
+=item C<0>
 
 A new session was negotiated.
 
-=item 1
+=item C<1>
 
 A session was reused.
 
diff -Naur openssl-1.0.0j/doc/ssl/SSL_set_fd.pod openssl-1.0.0j-haiku/doc/ssl/SSL_set_fd.pod
--- openssl-1.0.0j/doc/ssl/SSL_set_fd.pod	2000-09-16 11:00:38.066322432 -0500
+++ openssl-1.0.0j-haiku/doc/ssl/SSL_set_fd.pod	2013-10-19 01:35:39.035913728 -0500
@@ -35,11 +35,11 @@
 
 =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 -Naur openssl-1.0.0j/doc/ssl/SSL_set_session.pod openssl-1.0.0j-haiku/doc/ssl/SSL_set_session.pod
--- openssl-1.0.0j/doc/ssl/SSL_set_session.pod	2001-10-12 07:29:16.066584576 -0500
+++ openssl-1.0.0j-haiku/doc/ssl/SSL_set_session.pod	2013-10-19 01:35:39.038010880 -0500
@@ -37,11 +37,11 @@
 
 =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 -Naur openssl-1.0.0j/doc/ssl/SSL_shutdown.pod openssl-1.0.0j-haiku/doc/ssl/SSL_shutdown.pod
--- openssl-1.0.0j/doc/ssl/SSL_shutdown.pod	2004-11-14 07:55:16.066846720 -0600
+++ openssl-1.0.0j-haiku/doc/ssl/SSL_shutdown.pod	2013-10-19 01:35:39.040108032 -0500
@@ -92,12 +92,12 @@
 
 =over 4
 
-=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 0
+=item C<0>
 
 The shutdown is not yet finished. Call SSL_shutdown() for a second time,
 if a bidirectional shutdown shall be performed.
diff -Naur openssl-1.0.0j/doc/ssl/SSL_write.pod openssl-1.0.0j-haiku/doc/ssl/SSL_write.pod
--- openssl-1.0.0j/doc/ssl/SSL_write.pod	2002-07-19 06:53:54.000000000 -0500
+++ openssl-1.0.0j-haiku/doc/ssl/SSL_write.pod	2013-10-19 01:35:39.042467328 -0500
@@ -79,7 +79,7 @@
 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,
diff -Naur openssl-1.0.0j/doc/apps/genpkey.pod openssl-1.0.0j-haiku/doc/apps/genpkey.pod
--- openssl-1.0.0j/doc/apps/genpkey.pod 2009-04-10 11:42:27.032505856 -0500
+++ openssl-1.0.0j-haiku/doc/apps/genpkey.pod   2013-10-19 01:56:29.162529280 -0500
@@ -114,6 +114,8 @@
 
 The number of bits in the generated parameters. If not specified 1024 is used.
 
+=back
+
 =head1 DH PARAMETER GENERATION OPTIONS
 
 =over 4
diff -Naur openssl-1.0.0j/doc/apps/openssl.pod openssl-1.0.0j-haiku/doc/apps/openssl.pod
--- openssl-1.0.0j/doc/apps/openssl.pod 2010-01-21 12:46:28.033030144 -0600
+++ openssl-1.0.0j-haiku/doc/apps/openssl.pod   2013-10-19 02:04:12.774111232 -0500
@@ -287,8 +287,6 @@
 
 SHA-1 Digest
 
-=back
-
 =item B<sha224>
 
 SHA-224 Digest
@@ -305,6 +303,8 @@
 
 SHA-512 Digest
 
+=back
+
 =head2 ENCODING AND CIPHER COMMANDS
 
 =over 10
diff -Naur openssl-1.0.0j/Makefile.shared openssl-1.0.0j-haiku/Makefile.shared
--- openssl-1.0.0j/Makefile.shared	2010-08-21 06:36:49.017039360 -0500
+++ openssl-1.0.0j-haiku/Makefile.shared	2013-10-19 01:35:15.668991488 -0500
@@ -594,10 +594,10 @@
 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
