summaryrefslogtreecommitdiff
path: root/extra/yassl/src
diff options
context:
space:
mode:
authorunknown <msvensson@neptunus.(none)>2006-04-18 12:08:06 +0200
committerunknown <msvensson@neptunus.(none)>2006-04-18 12:08:06 +0200
commit5db9db07a568c881e2dfcd48f8440d9fed027dc2 (patch)
tree2b031e71f779a6706f62a625f72e9702149cb270 /extra/yassl/src
parent83a326f28c1938d72583e62c6eda7c18d8a87b61 (diff)
downloadmariadb-git-5db9db07a568c881e2dfcd48f8440d9fed027dc2.tar.gz
Bug#18815 libmysql using yassl can't be linked with c program
- Apply patch to remove dependency on C++ libs when linking "libmysql" from c extra/yassl/include/openssl/rsa.h: Fix spelling error extra/yassl/include/openssl/ssl.h: Fix spelling error extra/yassl/include/yassl_int.hpp: Remove static instance extra/yassl/include/yassl_types.hpp: Add CleanUp function for static singletons extra/yassl/src/handshake.cpp: Use buffered.reset(0) instead of null_buffer extra/yassl/src/template_instnt.cpp: Add instantiation of two new templates extra/yassl/src/yassl_int.cpp: Use static pointers for singletons extra/yassl/taocrypt/include/integer.hpp: Remove statoc singletons from class scope extra/yassl/taocrypt/include/misc.hpp: Add clenaup function extra/yassl/taocrypt/include/runtime.hpp: Add runtime for Solaris extra/yassl/taocrypt/src/algebra.cpp: Use mySTL::vector to avoid array of Element being on the stack extra/yassl/taocrypt/src/integer.cpp: Use static pointers for singletons Add cleanup function extra/yassl/taocrypt/src/template_instnt.cpp: Add instantiation of one new template
Diffstat (limited to 'extra/yassl/src')
-rw-r--r--extra/yassl/src/handshake.cpp17
-rw-r--r--extra/yassl/src/template_instnt.cpp2
-rw-r--r--extra/yassl/src/yassl_int.cpp22
3 files changed, 29 insertions, 12 deletions
diff --git a/extra/yassl/src/handshake.cpp b/extra/yassl/src/handshake.cpp
index d7df438b8df..16c9bde2003 100644
--- a/extra/yassl/src/handshake.cpp
+++ b/extra/yassl/src/handshake.cpp
@@ -648,8 +648,6 @@ void build_certHashes(SSL& ssl, Hashes& hashes)
}
-mySTL::auto_ptr<input_buffer> null_buffer(ysDelete);
-
// do process input requests
mySTL::auto_ptr<input_buffer>
DoProcessReply(SSL& ssl, mySTL::auto_ptr<input_buffer> buffered)
@@ -659,7 +657,8 @@ DoProcessReply(SSL& ssl, mySTL::auto_ptr<input_buffer> buffered)
if (!ready) {
// Nothing to receive after blocking wait => error
ssl.SetError(receive_error);
- return buffered= null_buffer;
+ buffered.reset(0);
+ return buffered;
}
// add buffered data if its there
@@ -667,10 +666,10 @@ DoProcessReply(SSL& ssl, mySTL::auto_ptr<input_buffer> buffered)
input_buffer buffer(buffSz + ready);
if (buffSz) {
buffer.assign(buffered.get()->get_buffer(), buffSz);
- buffered = null_buffer;
+ buffered.reset(0);
}
- // add new (ys) data
+ // add new data
uint read = ssl.getSocket().receive(buffer.get_buffer() + buffSz, ready);
buffer.add_size(read);
uint offset = 0;
@@ -703,11 +702,15 @@ DoProcessReply(SSL& ssl, mySTL::auto_ptr<input_buffer> buffered)
mySTL::auto_ptr<Message> msg(mf.CreateObject(hdr.type_), ysDelete);
if (!msg.get()) {
ssl.SetError(factory_error);
- return buffered = null_buffer;
+ buffered.reset(0);
+ return buffered;
}
buffer >> *msg;
msg->Process(buffer, ssl);
- if (ssl.GetError()) return buffered = null_buffer;
+ if (ssl.GetError()) {
+ buffered.reset(0);
+ return buffered;
+ }
}
offset += hdr.length_ + RECORD_HEADER;
}
diff --git a/extra/yassl/src/template_instnt.cpp b/extra/yassl/src/template_instnt.cpp
index 5ee57e76aed..c55ca39bec2 100644
--- a/extra/yassl/src/template_instnt.cpp
+++ b/extra/yassl/src/template_instnt.cpp
@@ -87,6 +87,8 @@ template void ysDelete<BulkCipher>(BulkCipher*);
template void ysDelete<Digest>(Digest*);
template void ysDelete<X509>(X509*);
template void ysDelete<Message>(Message*);
+template void ysDelete<sslFactory>(sslFactory*);
+template void ysDelete<Sessions>(Sessions*);
template void ysArrayDelete<unsigned char>(unsigned char*);
template void ysArrayDelete<char>(char*);
}
diff --git a/extra/yassl/src/yassl_int.cpp b/extra/yassl/src/yassl_int.cpp
index 740618ce701..87d990b3506 100644
--- a/extra/yassl/src/yassl_int.cpp
+++ b/extra/yassl/src/yassl_int.cpp
@@ -1361,19 +1361,31 @@ SSL_SESSION::~SSL_SESSION()
}
-Sessions Sessions::instance_; // simple singleton
+static Sessions* sessionsInstance = 0;
Sessions& GetSessions()
{
- return Sessions::instance_;
+ if (!sessionsInstance)
+ sessionsInstance = new (ys) Sessions;
+ return *sessionsInstance;
}
-sslFactory sslFactory::instance_; // simple singleton
+static sslFactory* sslFactoryInstance = 0;
sslFactory& GetSSL_Factory()
-{
- return sslFactory::instance_;
+{
+ if (!sslFactoryInstance)
+ sslFactoryInstance = new (ys) sslFactory;
+ return *sslFactoryInstance;
+}
+
+
+void CleanUp()
+{
+ TaoCrypt::CleanUp();
+ ysDelete(sslFactoryInstance);
+ ysDelete(sessionsInstance);
}