summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2018-01-15 12:43:44 (GMT)
committerTobias Markmann <tm@ayena.de>2018-02-02 08:56:47 (GMT)
commit9e2eee27d47ff1523677eb3881b4edcf66d7c0db (patch)
treec354e42f8b5314e1727da4aa8d9a248311e4242a /BuildTools
parent9eaa75b907a515a65ccb2002632fbf2f30c5aee8 (diff)
downloadswift-9e2eee27d47ff1523677eb3881b4edcf66d7c0db.zip
swift-9e2eee27d47ff1523677eb3881b4edcf66d7c0db.tar.bz2
Add support for extracting certificate chain from PEM string
Add PrivateKey class to simply encapsulate arbitrary private key data and the corresponding password. This enables easy unit testing by loading the certificate and key from within a test case. Test-Information: Added unit tests for certificate and key generated by OpenSSL. Tested on macOS 10.13.2 with OpenSSL. Change-Id: I1c9ffc3c70f61af65c4f1c48670badaf74b672b7
Diffstat (limited to 'BuildTools')
-rw-r--r--BuildTools/SCons/SConstruct9
1 files changed, 6 insertions, 3 deletions
diff --git a/BuildTools/SCons/SConstruct b/BuildTools/SCons/SConstruct
index 2c2d629..bef388a 100644
--- a/BuildTools/SCons/SConstruct
+++ b/BuildTools/SCons/SConstruct
@@ -521,92 +521,96 @@ if env.get("editline_libdir", None) :
editline_flags["LIBPATH"] = [env["editline_libdir"]]
if env.get("editline_includedir", None) :
editline_flags["CPPPATH"] = [env["editline_includedir"]]
editline_conf_env.MergeFlags(editline_flags)
conf = Configure(editline_conf_env)
if conf.CheckLibWithHeader(env["editline_libname"], ["stdio.h", "editline/readline.h"], "c") :
env["HAVE_EDITLINE"] = 1
env["EDITLINE_FLAGS"] = { "LIBS": [env["editline_libname"]] }
env["EDITLINE_FLAGS"].update(editline_flags)
conf.Finish()
# Avahi
avahi_conf_env = conf_env.Clone()
avahi_flags = {}
if env.get("avahi_libdir", None) :
avahi_flags["LIBPATH"] = [env["avahi_libdir"]]
if env.get("avahi_includedir", None) :
avahi_flags["CPPPATH"] = [env["avahi_includedir"]]
avahi_conf_env.MergeFlags(avahi_flags)
conf = Configure(avahi_conf_env)
if env.get("try_avahi", True) and conf.CheckCHeader("avahi-client/client.h") and conf.CheckLib("avahi-client") and conf.CheckLib("avahi-common") :
env["HAVE_AVAHI"] = True
env["AVAHI_FLAGS"] = { "LIBS": ["avahi-client", "avahi-common"] }
env["AVAHI_FLAGS"].update(avahi_flags)
conf.Finish()
# Qt
if env["qt"] :
env["QTDIR"] = env["qt"]
+if env["PLATFORM"] == "win32" :
+ systemIncludeFlag = "/I"
+else:
+ systemIncludeFlag = "-isystem"
################################################################################
# TLS backend selection
################################################################################
env["OPENSSL_FLAGS"] = {}
if env.get("tls_backend") == "native" :
if env["PLATFORM"] == "win32" :
env["HAVE_SCHANNEL"] = True
elif env["PLATFORM"] == "darwin" and env["target"] == "native":
env["HAVE_SECURETRANSPORT"] = True
elif env["target"] in ("iphone-device", "iphone-simulator", "xcode", "android") :
env["tls_backend"] = "openssl_bundled"
else :
env["tls_backend"] = "openssl"
# OpenSSL
if env.get("tls_backend") == "openssl_bundled" :
env["OPENSSL_BUNDLED"] = True
env["HAVE_OPENSSL"] = True
elif env.get("tls_backend") == "openssl" :
openssl_env = conf_env.Clone()
use_openssl = bool(env["openssl"])
openssl_prefix = ""
if isinstance(env["openssl"], str) :
openssl_prefix = env["openssl"]
openssl_flags = {}
if openssl_prefix :
openssl_include = env.get("openssl_include")
openssl_libdir = env.get("openssl_libdir")
if openssl_include:
- openssl_flags = {"CPPPATH":[openssl_include]}
+ openssl_flags = { "CPPFLAGS": [systemIncludeFlag + openssl_include]}
else:
- openssl_flags = { "CPPPATH": [os.path.join(openssl_prefix, "include")] }
+ openssl_flags = { "CPPFLAGS": [systemIncludeFlag + os.path.join(openssl_prefix, "include")] }
if openssl_libdir:
openssl_flags["LIBPATH"] = [openssl_libdir]
env["OPENSSL_DIR"] = openssl_prefix
elif env["PLATFORM"] == "win32" :
openssl_flags["LIBPATH"] = [os.path.join(openssl_prefix, "lib", "VC")]
env["OPENSSL_DIR"] = openssl_prefix
else :
openssl_flags["LIBPATH"] = [os.path.join(openssl_prefix, "lib")]
openssl_env.MergeFlags(openssl_flags)
openssl_conf = Configure(openssl_env)
if use_openssl and openssl_conf.CheckCHeader("openssl/ssl.h") :
env["HAVE_OPENSSL"] = 1
env["OPENSSL_FLAGS"] = openssl_flags
openssl_libnames = env.get("openssl_libnames")
if openssl_libnames:
env["OPENSSL_FLAGS"]["LIBS"] = openssl_libnames.split(',')
elif env["PLATFORM"] == "win32" :
env["OPENSSL_FLAGS"]["LIBS"] = ["libeay32MD", "ssleay32MD"]
else:
env["OPENSSL_FLAGS"]["LIBS"] = ["ssl", "crypto"]
if env["PLATFORM"] == "darwin" :
if platform.mac_ver()[0].startswith("10.5") :
env["OPENSSL_FLAGS"]["FRAMEWORKS"] = ["Security"]
openssl_conf.Finish()
if env["PLATFORM"] == "win32" :
# On Windows link to secur32. It is needed by Swiften/SASL/WindowsAuthentication
env.Append(LIBS = ["secur32"])
@@ -753,31 +757,30 @@ if ARGUMENTS.get("sloccount", False) :
for project in env["PROJECTS"] :
env.SLOCCount("#/" + project)
################################################################################
# Print summary
################################################################################
print
print " Build Configuration"
print " -------------------"
parsers = []
if env.get("HAVE_LIBXML", 0):
parsers.append("LibXML")
if env.get("HAVE_EXPAT", 0):
parsers.append("Expat")
if env.get("EXPAT_BUNDLED", False) :
parsers.append("(Bundled)")
print " Projects: " + ' '.join(env["PROJECTS"])
print ""
print " XML Parsers: " + ' '.join(parsers)
print " TLS Support: " + (env.get("HAVE_OPENSSL",0) and "OpenSSL" or env.get("HAVE_SECURETRANSPORT",0) and "Secure Transport" or env.get("HAVE_SCHANNEL", 0) and "Schannel" or "Disabled")
print " DNSSD Support: " + (env.get("HAVE_BONJOUR") and "Bonjour" or (env.get("HAVE_AVAHI") and "Avahi" or "Disabled"))
print
if not GetOption("help") and not env.get("HAVE_OPENSSL", 0) and not env.get("HAVE_SCHANNEL", 0) and not env.get("HAVE_SECURETRANSPORT", 0):
print "Error: A working TLS backend is required. Please check the documentation for more information."
Exit(1)
-