summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/SslFactory.cpp
diff options
context:
space:
mode:
authorAnthony Neal <aneal@zeroc.com>2001-11-30 19:58:47 +0000
committerAnthony Neal <aneal@zeroc.com>2001-11-30 19:58:47 +0000
commit0943a96869b83130fb7f2c3983a918a0dbad144b (patch)
tree45203542428d3f0776f88e98733eb1ad47dbabbc /cpp/src/Ice/SslFactory.cpp
parentconverted some stuff to use Application.h (diff)
downloadice-0943a96869b83130fb7f2c3983a918a0dbad144b.tar.bz2
ice-0943a96869b83130fb7f2c3983a918a0dbad144b.tar.xz
ice-0943a96869b83130fb7f2c3983a918a0dbad144b.zip
Have fixed the handshake problem, now handshakes take place in the
read/write methods. As well, I have changed the configuration properties to be under the Ice.Security.* branch of properties. I have added a new configuration property having to do with the timeout value for the first read after the handshake has completed - the default value should be sufficient, but in case it is not, this is a tweak that is avaliable.
Diffstat (limited to 'cpp/src/Ice/SslFactory.cpp')
-rw-r--r--cpp/src/Ice/SslFactory.cpp50
1 files changed, 49 insertions, 1 deletions
diff --git a/cpp/src/Ice/SslFactory.cpp b/cpp/src/Ice/SslFactory.cpp
index 54e0af0a8fc..45d962adb9e 100644
--- a/cpp/src/Ice/SslFactory.cpp
+++ b/cpp/src/Ice/SslFactory.cpp
@@ -12,22 +12,70 @@
#endif
#include <Ice/SslFactory.h>
-#include <Ice/SslSystemOpenSSL.h>
+#include <Ice/SslSystemOpenSSL.h>
+#include <Ice/Security.h>
+
+#define OPENSSL_THREAD_DEFINES
+#include <openssl/opensslconf.h>
+#if defined(THREADS)
+#else
+#error "Thread support not enabled"
+#endif
+
namespace IceSecurity
{
namespace Ssl
{
+
+
+extern "C"
+{
+ void lockingCallback(int, int, const char*, int);
+}
// Static member instantiations.
JTCMutex Factory::_systemRepositoryMutex;
SystemMap Factory::_systemRepository;
SslHandleSystemMap Factory::_sslHandleSystemRepository;
+
+class SslLockKeeper
+{
+
+public:
+ SslLockKeeper()
+ {
+ CRYPTO_set_locking_callback((void (*)(int, int, const char*, int))lockingCallback);
+ }
+
+ ~SslLockKeeper()
+ {
+ CRYPTO_set_locking_callback(NULL);
+ }
+
+ JTCMutex sslLocks[CRYPTO_NUM_LOCKS];
+
+};
+
+SslLockKeeper lockKeeper;
}
}
+
+void IceSecurity::Ssl::lockingCallback(int mode, int type, const char *file, int line)
+{
+ if (mode & CRYPTO_LOCK)
+ {
+ lockKeeper.sslLocks[type].lock();
+ }
+ else
+ {
+ lockKeeper.sslLocks[type].unlock();
+ }
+}
+
IceSecurity::Ssl::System*
IceSecurity::Ssl::Factory::getSystem(string& systemIdentifier)