diff mbox

SV: [PATCH 05/18] Openssl: (better) Darwin & Windows support

Message ID BD22328D0EB182418C2A0952DC2454F88086FDD9@VMPREVAS2.prevas.se
State Not Applicable
Headers show

Commit Message

kim.hansen@prevas.dk Jan. 5, 2015, 1:37 p.m. UTC
Hi Yann,

This should be updated to work on the current openssl fixes, probably best to wait until my current patch-merge branch on github is merged to master.

Also, patch header

Br,
Kim
diff mbox

Patch

diff --git a/recipes/openssl/openssl-1.0.0e/find.pl b/recipes/openssl/openssl-1.0.0e/find.pl
new file mode 100644
index 0000000..8e1b42c
--- /dev/null
+++ b/recipes/openssl/openssl-1.0.0e/find.pl
@@ -0,0 +1,54 @@ 
+warn "Legacy library @{[(caller(0))[6]]} will be removed from the Perl core distribution in the next major release. Please install it from the CPAN distribution Perl4::CoreLibs. It is being used at @{[(caller)[1]]}, line @{[(caller)[2]]}.\n";
+
+# This library is deprecated and unmaintained. It is included for
+# compatibility with Perl 4 scripts which may use it, but it will be
+# removed in a future version of Perl. Please use the File::Find module
+# instead.
+
+# Usage:
+#      require "find.pl";
+#
+#      &find('/foo','/bar');
+#
+#      sub wanted { ... }
+#              where wanted does whatever you want.  $dir contains the
+#              current directory name, and $_ the current filename within
+#              that directory.  $name contains "$dir/$_".  You are cd'ed
+#              to $dir when the function is called.  The function may
+#              set $prune to prune the tree.
+#
+# For example,
+#
+#   find / -name .nfs\* -mtime +7 -exec rm -f {} \; -o -fstype nfs -prune
+#
+# corresponds to this
+#
+#      sub wanted {
+#          /^\.nfs.*$/ &&
+#          (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) &&
+#          int(-M _) > 7 &&
+#          unlink($_)
+#          ||
+#          ($nlink || (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_))) &&
+#          $dev < 0 &&
+#          ($prune = 1);
+#      }
+#
+# Set the variable $dont_use_nlink if you're using AFS, since AFS cheats.
+
+use File::Find ();
+
+*name          = *File::Find::name;
+*prune         = *File::Find::prune;
+*dir           = *File::Find::dir;
+*topdir                = *File::Find::topdir;
+*topdev                = *File::Find::topdev;
+*topino                = *File::Find::topino;
+*topmode       = *File::Find::topmode;
+*topnlink      = *File::Find::topnlink;
+
+sub find {
+    &File::Find::find(\&wanted, @_);
+}
+
+1;
diff --git a/recipes/openssl/openssl-1.0.0e/fix_pod_syntax.patch b/recipes/openssl/openssl-1.0.0e/fix_pod_syntax.patch
new file mode 100644
index 0000000..b90da24
--- /dev/null
+++ b/recipes/openssl/openssl-1.0.0e/fix_pod_syntax.patch
@@ -0,0 +1,426 @@ 
+diff -urN a/crypto/des/des.pod b/crypto/des/des.pod
+--- a/crypto/des/des.pod       2000-03-18 18:55:08.000000000 +0100
++++ b/crypto/des/des.pod       2013-10-06 18:08:34.511218504 +0200
+@@ -181,6 +181,8 @@
+ output.  If there is no name specified after the B<-u>, the name text.des
+ will be embedded in the header.
+
++=back
++
+ =head1 SEE ALSO
+
+ ps(1),
+diff -urN a/doc/apps/cms.pod b/doc/apps/cms.pod
+--- a/doc/apps/cms.pod 2009-10-01 01:40:37.000000000 +0200
++++ b/doc/apps/cms.pod 2013-10-06 18:08:37.611165091 +0200
+@@ -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 -urN a/doc/apps/genpkey.pod b/doc/apps/genpkey.pod
+--- a/doc/apps/genpkey.pod     2009-04-10 18:42:27.000000000 +0200
++++ b/doc/apps/genpkey.pod     2013-10-06 18:41:39.698687036 +0200
+@@ -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 -urN a/doc/apps/openssl.pod b/doc/apps/openssl.pod
+--- a/doc/apps/openssl.pod     2010-01-21 19:46:28.000000000 +0100
++++ b/doc/apps/openssl.pod     2013-10-06 18:55:11.383889303 +0200
+@@ -289,6 +289,8 @@
+
+ =back
+
++=over 4
++
+ =item B<sha224>
+
+ SHA-224 Digest
+@@ -305,6 +307,8 @@
+
+ SHA-512 Digest
+
++=back
++
+ =head2 ENCODING AND CIPHER COMMANDS
+
+ =over 10
+diff -urN a/doc/apps/smime.pod b/doc/apps/smime.pod
+--- a/doc/apps/smime.pod       2010-10-04 15:28:35.000000000 +0200
++++ b/doc/apps/smime.pod       2013-10-06 18:08:37.611165091 +0200
+@@ -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 -urN a/doc/crypto/X509_STORE_CTX_get_error.pod b/doc/crypto/X509_STORE_CTX_get_error.pod
+--- a/doc/crypto/X509_STORE_CTX_get_error.pod  2009-10-18 17:28:59.000000000 +0200
++++ b/doc/crypto/X509_STORE_CTX_get_error.pod  2013-10-06 18:08:34.515218435 +0200
+@@ -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 -urN a/doc/ssl/SSL_accept.pod b/doc/ssl/SSL_accept.pod
+--- a/doc/ssl/SSL_accept.pod   2003-06-03 11:59:44.000000000 +0200
++++ b/doc/ssl/SSL_accept.pod   2013-10-06 18:08:42.111087634 +0200
+@@ -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 -urN a/doc/ssl/SSL_clear.pod b/doc/ssl/SSL_clear.pod
+--- a/doc/ssl/SSL_clear.pod    2002-02-27 09:08:57.000000000 +0100
++++ b/doc/ssl/SSL_clear.pod    2013-10-06 18:08:42.111087634 +0200
+@@ -50,12 +50,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 -urN a/doc/ssl/SSL_COMP_add_compression_method.pod b/doc/ssl/SSL_COMP_add_compression_method.pod
+--- a/doc/ssl/SSL_COMP_add_compression_method.pod      2003-11-29 11:33:25.000000000 +0100
++++ b/doc/ssl/SSL_COMP_add_compression_method.pod      2013-10-06 18:08:42.115087565 +0200
+@@ -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 -urN a/doc/ssl/SSL_connect.pod b/doc/ssl/SSL_connect.pod
+--- a/doc/ssl/SSL_connect.pod  2003-06-03 11:59:44.000000000 +0200
++++ b/doc/ssl/SSL_connect.pod  2013-10-06 18:08:42.115087565 +0200
+@@ -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 -urN a/doc/ssl/SSL_CTX_add_session.pod b/doc/ssl/SSL_CTX_add_session.pod
+--- a/doc/ssl/SSL_CTX_add_session.pod  2002-10-29 01:33:01.000000000 +0100
++++ b/doc/ssl/SSL_CTX_add_session.pod  2013-10-06 18:08:42.115087565 +0200
+@@ -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 -urN a/doc/ssl/SSL_CTX_load_verify_locations.pod b/doc/ssl/SSL_CTX_load_verify_locations.pod
+--- a/doc/ssl/SSL_CTX_load_verify_locations.pod        2001-09-07 08:13:39.000000000 +0200
++++ b/doc/ssl/SSL_CTX_load_verify_locations.pod        2013-10-06 18:08:42.115087565 +0200
+@@ -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 -urN a/doc/ssl/SSL_CTX_set_client_CA_list.pod b/doc/ssl/SSL_CTX_set_client_CA_list.pod
+--- a/doc/ssl/SSL_CTX_set_client_CA_list.pod   2001-04-12 18:02:34.000000000 +0200
++++ b/doc/ssl/SSL_CTX_set_client_CA_list.pod   2013-10-06 18:08:34.515218435 +0200
+@@ -70,7 +70,7 @@
+
+ The operation succeeded.
+
+-=item 0
++=item 2
+
+ 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 -urN a/doc/ssl/SSL_CTX_set_session_id_context.pod b/doc/ssl/SSL_CTX_set_session_id_context.pod
+--- a/doc/ssl/SSL_CTX_set_session_id_context.pod       2004-06-14 15:27:28.000000000 +0200
++++ b/doc/ssl/SSL_CTX_set_session_id_context.pod       2013-10-06 18:08:42.115087565 +0200
+@@ -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 -urN a/doc/ssl/SSL_CTX_set_ssl_version.pod b/doc/ssl/SSL_CTX_set_ssl_version.pod
+--- a/doc/ssl/SSL_CTX_set_ssl_version.pod      2005-08-14 23:48:32.000000000 +0200
++++ b/doc/ssl/SSL_CTX_set_ssl_version.pod      2013-10-06 18:08:42.115087565 +0200
+@@ -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 -urN a/doc/ssl/SSL_CTX_use_psk_identity_hint.pod b/doc/ssl/SSL_CTX_use_psk_identity_hint.pod
+--- a/doc/ssl/SSL_CTX_use_psk_identity_hint.pod        2006-03-11 00:06:17.000000000 +0100
++++ b/doc/ssl/SSL_CTX_use_psk_identity_hint.pod        2013-10-06 18:08:42.115087565 +0200
+@@ -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 -urN a/doc/ssl/SSL_do_handshake.pod b/doc/ssl/SSL_do_handshake.pod
+--- a/doc/ssl/SSL_do_handshake.pod     2002-07-19 13:05:49.000000000 +0200
++++ b/doc/ssl/SSL_do_handshake.pod     2013-10-06 18:08:42.115087565 +0200
+@@ -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 -urN a/doc/ssl/SSL_read.pod b/doc/ssl/SSL_read.pod
+--- a/doc/ssl/SSL_read.pod     2008-08-01 17:03:20.000000000 +0200
++++ b/doc/ssl/SSL_read.pod     2013-10-06 18:08:42.115087565 +0200
+@@ -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 -urN a/doc/ssl/SSL_session_reused.pod b/doc/ssl/SSL_session_reused.pod
+--- a/doc/ssl/SSL_session_reused.pod   2001-07-20 20:57:15.000000000 +0200
++++ b/doc/ssl/SSL_session_reused.pod   2013-10-06 18:08:42.119087496 +0200
+@@ -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 -urN a/doc/ssl/SSL_set_fd.pod b/doc/ssl/SSL_set_fd.pod
+--- a/doc/ssl/SSL_set_fd.pod   2000-09-16 18:00:38.000000000 +0200
++++ b/doc/ssl/SSL_set_fd.pod   2013-10-06 18:08:42.119087496 +0200
+@@ -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 -urN a/doc/ssl/SSL_set_session.pod b/doc/ssl/SSL_set_session.pod
+--- a/doc/ssl/SSL_set_session.pod      2001-10-12 14:29:16.000000000 +0200
++++ b/doc/ssl/SSL_set_session.pod      2013-10-06 18:08:42.119087496 +0200
+@@ -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 -urN a/doc/ssl/SSL_shutdown.pod b/doc/ssl/SSL_shutdown.pod
+--- a/doc/ssl/SSL_shutdown.pod 2004-11-14 14:55:16.000000000 +0100
++++ b/doc/ssl/SSL_shutdown.pod 2013-10-06 18:08:42.119087496 +0200
+@@ -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 -urN a/doc/ssl/SSL_write.pod b/doc/ssl/SSL_write.pod
+--- a/doc/ssl/SSL_write.pod    2002-07-19 13:53:54.000000000 +0200
++++ b/doc/ssl/SSL_write.pod    2013-10-06 18:08:42.119087496 +0200
+@@ -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 --git a/recipes/openssl/openssl-1.0.0e/mingw.patch b/recipes/openssl/openssl-1.0.0e/mingw.patch
new file mode 100644
index 0000000..2b106c3
--- /dev/null
+++ b/recipes/openssl/openssl-1.0.0e/mingw.patch
@@ -0,0 +1,12 @@ 
+diff -urN openssl-1.0.0e/Makefile.shared openssl-1.0.0enew//Makefile.shared
+--- openssl-1.0.0e/Makefile.shared     2010-08-21 13:36:49.000000000 +0200
++++ openssl-1.0.0enew//Makefile.shared 2012-04-10 15:43:18.384797024 +0200
+@@ -293,7 +293,7 @@
+       fi; \
+       dll_name=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; \
+       $(PERL) util/mkrc.pl $$dll_name | \
+-              $(CROSS_COMPILE)windres -o rc.o; \
++              $(WINDRES) -o rc.o; \
+       extras="$$extras rc.o"; \
+       ALLSYMSFLAGS='-Wl,--whole-archive'; \
+       NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
diff --git a/recipes/openssl/openssl-1.0.0e/wincrypt.patch b/recipes/openssl/openssl-1.0.0e/wincrypt.patch
new file mode 100644
index 0000000..03a0c8c
--- /dev/null
+++ b/recipes/openssl/openssl-1.0.0e/wincrypt.patch
@@ -0,0 +1,11 @@ 
+diff -urN a/crypto/ossl_typ.h b/crypto/ossl_typ.h
+--- a/crypto/ossl_typ.h        2008-11-11 13:23:18.000000000 +0100
++++ b/crypto/ossl_typ.h        2013-10-11 23:23:07.634175700 +0200
+@@ -98,6 +98,7 @@
+ typedef struct asn1_pctx_st ASN1_PCTX;
+
+ #ifdef OPENSSL_SYS_WIN32
++#include <windows.h>
+ #undef X509_NAME
+ #undef X509_EXTENSIONS
+ #undef X509_CERT_PAIR
diff --git a/recipes/openssl/openssl.inc b/recipes/openssl/openssl.inc
index 2ee3c25..35d8714 100644
--- a/recipes/openssl/openssl.inc
+++ b/recipes/openssl/openssl.inc
@@ -12,7 +12,7 @@  SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz"

 DEPENDS = "${DEPENDS_HOST_OS} libc libgcc"
 DEPENDS_HOST_OS = "libdl"
-DEPENDS_HOST_OS:HOST_OS_mingw32 = ""
+DEPENDS_HOST_OS:HOST_LIBC_mingw = ""

 CFLAG = "${@['-DL_ENDIAN', '-DB_ENDIAN']['${HOST_ENDIAN}'=='b']} ${HOST_CFLAGS}"
 CFLAG:>HOST_KERNEL_linux = " -DTERMIO"
@@ -24,6 +24,10 @@  export EX_LIBS = "-lgcc -ldl"
 export AS = "${CC} -c"

 do_configure () {
+       cd util
+       cp ../../find.pl .
+       perl perlpath.pl ${bindir}
+       cd ..
        ln -sf apps/openssl.pod crypto/crypto.pod ssl/ssl.pod doc/

        case "${HOST_OS}" in
@@ -112,7 +116,7 @@  RDEPENDS_${PN} += " ${PN}-libcrypto ${PN}-libssl ${PN}-engines ${PN}-misc"
 PACKAGES =+ "${PN}-misc ${PN}-engines"
 FILES_${PN}-misc = "${libdir}/ssl/misc ${libdir}/ssl/openssl.cnf"
 FILES_${PN}-engines = "${libdir}/ssl/engines/*.so"
-FILES_${PN}-engines:HOST_OS_mingw32 = "${libdir}/ssl/engines/*.dll"
+FILES_${PN}-engines:HOST_LIBC_mingw = "${libdir}/ssl/engines/*.dll"
 FILES_${PN}-engines:HOST_KERNEL_darwin = "${libdir}/ssl/engines/*.dylib"
 FILES_${PN}-dbg =+ "${libdir}/ssl/engines/.debug"
 FILES_${PN}-doc =+ "${libdir}/ssl/man"
@@ -127,10 +131,10 @@  RDEPENDS_${PN}-openssl += "libc libdl libcrypto libssl"
 DEPENDS_${PN}-dev = ""
 FILES_${PN}-libcrypto += " ${LIBCRYPTO_FILES}"
 LIBCRYPTO_FILES = ""
-LIBCRYPTO_FILES:HOST_OS_mingw32 = "${sharedlibdir}/libeay32.dll"
+LIBCRYPTO_FILES:HOST_LIBC_mingw = "${sharedlibdir}/libeay32.dll"
 FILES_${PN}-libssl += " ${LIBSSL_FILES}"
 LIBSSL_FILES = ""
-LIBSSL_FILES:HOST_OS_mingw32 = "${sharedlibdir}/ssleay32.dll"
+LIBSSL_FILES:HOST_LIBC_mingw = "${sharedlibdir}/ssleay32.dll"
 DEPENDS_${PN}-libcrypto += " ${DEPENDS}"
 DEPENDS_${PN}-libssl += " ${DEPENDS} libcrypto"
 RDEPENDS_${PN}-libcrypto += "libc libgcc ${DEPENDS_HOST_OS}"