Squashed commit of the following:

commit 5880c565888195490663b89a2b4b7b56d0495ad1
Author: Volker Hilsheimer <volker.hilsheimer@cfengine.com>
Date:   Wed May 22 19:03:44 2013 +0200

    Don't register a thread-ID callback on Windows.

    pthread_t on MinGW32 is a struct, and long is not large enough to hold the void*
    within.

    OpenSSL documentation states: If the application does not register such a callback
    using CRYPTO_THREADID_set_callback(), then a default implementation is used - on
    Windows and BeOS this uses the system's default thread identifying APIs

    So not setting this callback at all will be safe.

commit 32408d29c3d87576446f5d12523fbe2fcd26da12
Author: Volker Hilsheimer <volker.hilsheimer@cfengine.com>
Date:   Wed May 22 17:12:26 2013 +0200

    Compile on systems where alternative API is avaiable

commit 1f7beb743656c0d11f0b0b0880b2dd3f1ee03d76
Author: Volker Hilsheimer <volker.hilsheimer@cfengine.com>
Date:   Tue May 21 08:04:26 2013 +0200

    With OpenSSL initialized to be made thread-safe, we don't have to serialize
    access to the OpenSSL functions anymore.

    Some other things were protected here by the cft_system locking:

    - the ServerConnectionState *conn

    This structure is initialized in the main thread, and then passed to the
    thread handler, which takes exclusive ownership. No access to this object
    from other threads is possible or allowed.

    - malloc calls

    Those are implicily threadsafe on all supported platforms today

    Conflicts:

    	src/cf-serverd.c

commit 3cc7c617b0f035a107101bc511126086befde5a5
Author: Volker Hilsheimer <volker.hilsheimer@cfengine.com>
Date:   Tue May 21 07:55:14 2013 +0200

    Initialize OpenSSL with callback functions for threadlocking.

    This makes OpenSSL threadsafe, and allows us to remove locking around the
    calls to the RSA encryption functions in cf-serverd's AuthenticationDialogue.
    Implements #2678

    Note: the functions used - as well as most other functions used from
    OpenSSL - are marked as deprecated on Mac OSX 10.7 and later.
    Compiler warnings explicitly disabled. Functions documented in OpenSSL
    documentation (http://www.openssl.org/docs/crypto/threads.html) to replace
    some of these functions (such as CRYPTO_THREADID_set_callback) are not
    available. This implementation follows the example provided on
    http://www.opensource.apple.com/source/OpenSSL/OpenSSL-10/openssl/crypto/threads/mttest.c

    Conflicts:

    	src/crypto.c
    	src/generic_agent.c

commit 80d71ade7999c12c31902f7baa1513bd7d3e3ddb
Author: Volker Hilsheimer <volker.hilsheimer@cfengine.com>
Date:   Tue May 21 07:43:26 2013 +0200

    Silence deprecated warnings when compiling on Mac OSX.

    Majority of functions in /usr/include/openssl/crypto.h are marked as
    deprecated for Mac OSX 10.7 and later. Silence warnings.

    Conflicts:

    	src/crypto.c
(cherry picked from commit 84b98866aee85637552558845d1646f210dd9cdd)