FIX: implement libcurl openssl thread-safe locking

When libcurl is linked with openssl, SSL connections are not thread-safe.
E.g. using the "cheezburger" picture addon (which uses ssl) leads to crashes in libcurl/openssl on droid.
GnuTls is not a problem, apparently.

This patch implements the necessary callbacks to make libcurl with openssl connections thread-safe (see http://curl.haxx.se/libcurl/c/opensslthreadlock.html for reference).

Problem:
This patch is made for droid, where openssl is statically linked into libcurl (and even then, the HAVE_OPENSSL's are probably wrong, as it doesn't tell us with which ssl library curl is linked).
I don't know about the other potential platforms (ios? osx?)