diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-05-18 16:22:06 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-05-18 16:50:18 (GMT) |
commit | 8472194d716e0e3b95a66bf5be45c246ee79d0af (patch) | |
tree | b9f473e0e606b012ee5013e85d2cf5e7523b7029 /Swiften/TLS | |
parent | b1b3b8f88517ad8b14795cc8a6265962d2935be3 (diff) | |
download | swift-8472194d716e0e3b95a66bf5be45c246ee79d0af.zip swift-8472194d716e0e3b95a66bf5be45c246ee79d0af.tar.bz2 |
Propagate use of SafeByteArray down to the connection.
Diffstat (limited to 'Swiften/TLS')
-rw-r--r-- | Swiften/TLS/OpenSSL/OpenSSLContext.cpp | 8 | ||||
-rw-r--r-- | Swiften/TLS/OpenSSL/OpenSSLContext.h | 4 | ||||
-rw-r--r-- | Swiften/TLS/TLSContext.h | 10 |
3 files changed, 11 insertions, 11 deletions
diff --git a/Swiften/TLS/OpenSSL/OpenSSLContext.cpp b/Swiften/TLS/OpenSSL/OpenSSLContext.cpp index 97094bf..8d3970e 100644 --- a/Swiften/TLS/OpenSSL/OpenSSLContext.cpp +++ b/Swiften/TLS/OpenSSL/OpenSSLContext.cpp @@ -138,14 +138,14 @@ void OpenSSLContext::doConnect() { void OpenSSLContext::sendPendingDataToNetwork() { int size = BIO_pending(writeBIO_); if (size > 0) { - ByteArray data; + SafeByteArray data; data.resize(size); BIO_read(writeBIO_, vecptr(data), size); onDataForNetwork(data); } } -void OpenSSLContext::handleDataFromNetwork(const ByteArray& data) { +void OpenSSLContext::handleDataFromNetwork(const SafeByteArray& data) { BIO_write(readBIO_, vecptr(data), data.size()); switch (state_) { case Connecting: @@ -159,7 +159,7 @@ void OpenSSLContext::handleDataFromNetwork(const ByteArray& data) { } } -void OpenSSLContext::handleDataFromApplication(const ByteArray& data) { +void OpenSSLContext::handleDataFromApplication(const SafeByteArray& data) { if (SSL_write(handle_, vecptr(data), data.size()) >= 0) { sendPendingDataToNetwork(); } @@ -170,7 +170,7 @@ void OpenSSLContext::handleDataFromApplication(const ByteArray& data) { } void OpenSSLContext::sendPendingDataToApplication() { - ByteArray data; + SafeByteArray data; data.resize(SSL_READ_BUFFERSIZE); int ret = SSL_read(handle_, vecptr(data), data.size()); while (ret > 0) { diff --git a/Swiften/TLS/OpenSSL/OpenSSLContext.h b/Swiften/TLS/OpenSSL/OpenSSLContext.h index 30ac917..04693a3 100644 --- a/Swiften/TLS/OpenSSL/OpenSSLContext.h +++ b/Swiften/TLS/OpenSSL/OpenSSLContext.h @@ -24,8 +24,8 @@ namespace Swift { void connect(); bool setClientCertificate(const PKCS12Certificate& cert); - void handleDataFromNetwork(const ByteArray&); - void handleDataFromApplication(const ByteArray&); + void handleDataFromNetwork(const SafeByteArray&); + void handleDataFromApplication(const SafeByteArray&); Certificate::ref getPeerCertificate() const; boost::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const; diff --git a/Swiften/TLS/TLSContext.h b/Swiften/TLS/TLSContext.h index 68926c2..1538863 100644 --- a/Swiften/TLS/TLSContext.h +++ b/Swiften/TLS/TLSContext.h @@ -9,7 +9,7 @@ #include <Swiften/Base/boost_bsignals.h> #include <boost/shared_ptr.hpp> -#include <Swiften/Base/ByteArray.h> +#include <Swiften/Base/SafeByteArray.h> #include <Swiften/TLS/Certificate.h> #include <Swiften/TLS/CertificateVerificationError.h> @@ -24,8 +24,8 @@ namespace Swift { virtual bool setClientCertificate(const PKCS12Certificate& cert) = 0; - virtual void handleDataFromNetwork(const ByteArray&) = 0; - virtual void handleDataFromApplication(const ByteArray&) = 0; + virtual void handleDataFromNetwork(const SafeByteArray&) = 0; + virtual void handleDataFromApplication(const SafeByteArray&) = 0; virtual Certificate::ref getPeerCertificate() const = 0; virtual CertificateVerificationError::ref getPeerCertificateVerificationError() const = 0; @@ -33,8 +33,8 @@ namespace Swift { virtual ByteArray getFinishMessage() const = 0; public: - boost::signal<void (const ByteArray&)> onDataForNetwork; - boost::signal<void (const ByteArray&)> onDataForApplication; + boost::signal<void (const SafeByteArray&)> onDataForNetwork; + boost::signal<void (const SafeByteArray&)> onDataForApplication; boost::signal<void ()> onError; boost::signal<void ()> onConnected; }; |