summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/TLS')
-rw-r--r--Swiften/TLS/PlatformTLSFactories.cpp2
-rw-r--r--Swiften/TLS/SecureTransport/SecureTransportCertificate.mm10
-rw-r--r--Swiften/TLS/SecureTransport/SecureTransportContext.mm20
-rw-r--r--Swiften/TLS/ServerIdentityVerifier.cpp4
4 files changed, 18 insertions, 18 deletions
diff --git a/Swiften/TLS/PlatformTLSFactories.cpp b/Swiften/TLS/PlatformTLSFactories.cpp
index c1c0868..81f560b 100644
--- a/Swiften/TLS/PlatformTLSFactories.cpp
+++ b/Swiften/TLS/PlatformTLSFactories.cpp
@@ -24,7 +24,7 @@
namespace Swift {
-PlatformTLSFactories::PlatformTLSFactories() : contextFactory(NULL), certificateFactory(NULL) {
+PlatformTLSFactories::PlatformTLSFactories() : contextFactory(nullptr), certificateFactory(nullptr) {
#ifdef HAVE_OPENSSL
contextFactory = new OpenSSLContextFactory();
certificateFactory = new OpenSSLCertificateFactory();
diff --git a/Swiften/TLS/SecureTransport/SecureTransportCertificate.mm b/Swiften/TLS/SecureTransport/SecureTransportCertificate.mm
index 398829c..ed47f56 100644
--- a/Swiften/TLS/SecureTransport/SecureTransportCertificate.mm
+++ b/Swiften/TLS/SecureTransport/SecureTransportCertificate.mm
@@ -49,9 +49,9 @@ SecureTransportCertificate::SecureTransportCertificate(SecCertificateRef certifi
SecureTransportCertificate::SecureTransportCertificate(const ByteArray& der) {
- CFDataRef derData = CFDataCreateWithBytesNoCopy(NULL, der.data(), static_cast<CFIndex>(der.size()), NULL);
+ CFDataRef derData = CFDataCreateWithBytesNoCopy(nullptr, der.data(), static_cast<CFIndex>(der.size()), nullptr);
// certificate will take ownership of derData and free it on its release.
- SecCertificateRef certificate = SecCertificateCreateWithData(NULL, derData);
+ SecCertificateRef certificate = SecCertificateCreateWithData(nullptr, derData);
if (certificate) {
certificateHandle_ = boost::shared_ptr<SecCertificate>(certificate, CFRelease);
parse();
@@ -64,10 +64,10 @@ SecureTransportCertificate::~SecureTransportCertificate() {
void SecureTransportCertificate::parse() {
assert(certificateHandle_);
- CFErrorRef error = NULL;
+ CFErrorRef error = nullptr;
// The SecCertificateCopyValues function is not part of the iOS Secure Transport API.
- CFDictionaryRef valueDict = SecCertificateCopyValues(certificateHandle_.get(), 0, &error);
+ CFDictionaryRef valueDict = SecCertificateCopyValues(certificateHandle_.get(), nullptr, &error);
if (valueDict) {
// Handle subject.
CFStringRef subject = SecCertificateCopySubjectSummary(certificateHandle_.get());
@@ -78,7 +78,7 @@ void SecureTransportCertificate::parse() {
}
// Handle a single Common Name.
- CFStringRef commonName = NULL;
+ CFStringRef commonName = nullptr;
OSStatus error = SecCertificateCopyCommonName(certificateHandle_.get(), &commonName);
if (!error && commonName) {
NSString* commonNameStr = bridge_cast<NSString*>(commonName);
diff --git a/Swiften/TLS/SecureTransport/SecureTransportContext.mm b/Swiften/TLS/SecureTransport/SecureTransportContext.mm
index 62889fd..1c5e3ab 100644
--- a/Swiften/TLS/SecureTransport/SecureTransportContext.mm
+++ b/Swiften/TLS/SecureTransport/SecureTransportContext.mm
@@ -41,7 +41,7 @@ namespace {
CFArrayRef CreateClientCertificateChainAsCFArrayRef(CertificateWithKey::ref key) {
boost::shared_ptr<PKCS12Certificate> pkcs12 = boost::dynamic_pointer_cast<PKCS12Certificate>(key);
if (!key) {
- return NULL;
+ return nullptr;
}
SafeByteArray safePassword = pkcs12->getPassword();
@@ -49,19 +49,19 @@ CFArrayRef CreateClientCertificateChainAsCFArrayRef(CertificateWithKey::ref key)
try {
passwordSize = boost::numeric_cast<CFIndex>(safePassword.size());
} catch (...) {
- return NULL;
+ return nullptr;
}
- CFMutableArrayRef certChain = CFArrayCreateMutable(NULL, 0, 0);
+ CFMutableArrayRef certChain = CFArrayCreateMutable(nullptr, 0, nullptr);
OSStatus securityError = errSecSuccess;
CFStringRef password = CFStringCreateWithBytes(kCFAllocatorDefault, safePassword.data(), passwordSize, kCFStringEncodingUTF8, false);
const void* keys[] = { kSecImportExportPassphrase };
const void* values[] = { password };
- CFDictionaryRef options = CFDictionaryCreate(NULL, keys, values, 1, NULL, NULL);
+ CFDictionaryRef options = CFDictionaryCreate(nullptr, keys, values, 1, nullptr, nullptr);
- CFArrayRef items = NULL;
+ CFArrayRef items = nullptr;
CFDataRef pkcs12Data = bridge_cast<CFDataRef>([NSData dataWithBytes: static_cast<const void *>(pkcs12->getData().data()) length:pkcs12->getData().size()]);
securityError = SecPKCS12Import(pkcs12Data, options, &items);
CFRelease(options);
@@ -85,10 +85,10 @@ CFArrayRef CreateClientCertificateChainAsCFArrayRef(CertificateWithKey::ref key)
if (securityError != errSecSuccess) {
if (items) {
CFRelease(items);
- items = NULL;
+ items = nullptr;
}
CFRelease(certChain);
- certChain = NULL;
+ certChain = nullptr;
}
if (certChain) {
@@ -104,7 +104,7 @@ CFArrayRef CreateClientCertificateChainAsCFArrayRef(CertificateWithKey::ref key)
}
SecureTransportContext::SecureTransportContext(bool checkCertificateRevocation) : state_(None), checkCertificateRevocation_(checkCertificateRevocation) {
- sslContext_ = boost::shared_ptr<SSLContext>(SSLCreateContext(NULL, kSSLClientSide, kSSLStreamType), CFRelease);
+ sslContext_ = boost::shared_ptr<SSLContext>(SSLCreateContext(nullptr, kSSLClientSide, kSSLStreamType), CFRelease);
OSStatus error = noErr;
// set IO callbacks
@@ -200,7 +200,7 @@ void SecureTransportContext::processHandshake() {
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
void SecureTransportContext::verifyServerCertificate() {
- SecTrustRef trust = NULL;
+ SecTrustRef trust = nullptr;
OSStatus error = SSLCopyPeerTrust(sslContext_.get(), &trust);
if (error != noErr) {
fatalError(boost::make_shared<TLSError>(), boost::make_shared<CertificateVerificationError>());
@@ -364,7 +364,7 @@ std::vector<Certificate::ref> SecureTransportContext::getPeerCertificateChain()
typedef boost::remove_pointer<SecTrustRef>::type SecTrust;
boost::shared_ptr<SecTrust> securityTrust;
- SecTrustRef secTrust = NULL;;
+ SecTrustRef secTrust = nullptr;;
OSStatus error = SSLCopyPeerTrust(sslContext_.get(), &secTrust);
if (error == noErr) {
securityTrust = boost::shared_ptr<SecTrust>(secTrust, CFRelease);
diff --git a/Swiften/TLS/ServerIdentityVerifier.cpp b/Swiften/TLS/ServerIdentityVerifier.cpp
index b247585..872717b 100644
--- a/Swiften/TLS/ServerIdentityVerifier.cpp
+++ b/Swiften/TLS/ServerIdentityVerifier.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -25,7 +25,7 @@ ServerIdentityVerifier::ServerIdentityVerifier(const JID& jid, IDNConverter* idn
bool ServerIdentityVerifier::certificateVerifies(Certificate::ref certificate) {
bool hasSAN = false;
- if (certificate == NULL) {
+ if (certificate == nullptr) {
return false;
}
// DNS names