summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/TLS')
-rw-r--r--Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp6
-rw-r--r--Swiften/TLS/PlatformTLSFactories.cpp8
-rw-r--r--Swiften/TLS/SConscript3
3 files changed, 13 insertions, 4 deletions
diff --git a/Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp b/Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp
index ac36f4f..76b8bb9 100644
--- a/Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp
+++ b/Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp
@@ -36,6 +36,9 @@ OpenSSLCertificate::OpenSSLCertificate(const ByteArray& der) {
ByteArray OpenSSLCertificate::toDER() const {
ByteArray result;
+ if (!cert) {
+ return result;
+ }
result.resize(i2d_X509(cert.get(), NULL));
unsigned char* p = vecptr(result);
i2d_X509(cert.get(), &p);
@@ -43,6 +46,9 @@ ByteArray OpenSSLCertificate::toDER() const {
}
void OpenSSLCertificate::parse() {
+ if (!cert) {
+ return;
+ }
// Subject name
X509_NAME* subjectName = X509_get_subject_name(cert.get());
if (subjectName) {
diff --git a/Swiften/TLS/PlatformTLSFactories.cpp b/Swiften/TLS/PlatformTLSFactories.cpp
index 5f57793..64a5ab3 100644
--- a/Swiften/TLS/PlatformTLSFactories.cpp
+++ b/Swiften/TLS/PlatformTLSFactories.cpp
@@ -13,9 +13,10 @@
#ifdef HAVE_OPENSSL
#include "Swiften/TLS/OpenSSL/OpenSSLContextFactory.h"
#include "Swiften/TLS/OpenSSL/OpenSSLCertificateFactory.h"
-#elif defined SWIFTEN_PLATFORM_WINDOWS
+#endif
+#ifdef HAVE_SCHANNEL
#include "Swiften/TLS/Schannel/SchannelContextFactory.h"
-#include "Swiften/TLS/Schannel/SchannelCertificateFactory.h"
+ #include "Swiften/TLS/Schannel/SchannelCertificateFactory.h"
#endif
namespace Swift {
@@ -24,7 +25,8 @@ PlatformTLSFactories::PlatformTLSFactories() : contextFactory(NULL), certificate
#ifdef HAVE_OPENSSL
contextFactory = new OpenSSLContextFactory();
certificateFactory = new OpenSSLCertificateFactory();
-#elif defined SWIFTEN_PLATFORM_WINDOWS
+#endif
+#ifdef HAVE_SCHANNEL
contextFactory = new SchannelContextFactory();
certificateFactory = new SchannelCertificateFactory();
#endif
diff --git a/Swiften/TLS/SConscript b/Swiften/TLS/SConscript
index 225aa0a..a71a446 100644
--- a/Swiften/TLS/SConscript
+++ b/Swiften/TLS/SConscript
@@ -18,12 +18,13 @@ if myenv.get("HAVE_OPENSSL", 0) :
"OpenSSL/OpenSSLContextFactory.cpp",
])
myenv.Append(CPPDEFINES = "HAVE_OPENSSL")
-elif myenv["PLATFORM"] == "win32" :
+elif myenv.get("HAVE_SCHANNEL", 0) :
objects += myenv.StaticObject([
"Schannel/SchannelContext.cpp",
"Schannel/SchannelCertificate.cpp",
"Schannel/SchannelContextFactory.cpp",
])
+ myenv.Append(CPPDEFINES = "HAVE_SCHANNEL")
objects += myenv.SwiftenObject(["PlatformTLSFactories.cpp"])